Output a single STEP file from muliple shapes.

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
saso
Posts: 1305
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Output a single STEP file from muliple shapes.

Postby saso » Sat Aug 17, 2019 7:45 pm

keithsloan52 wrote:
Sat Aug 17, 2019 6:37 pm
GDML is a set of solid geometries. A far richer set than FreeCAD parts but does not cover all possible shapes.
yes, I was able to catch that from a quick read over few pages
keithsloan52 wrote:
Sat Aug 17, 2019 6:37 pm
You cannot have the flexibility of creating arbitrary shapes with sketches and extrude/pocket etc and then have what
you create as GDML solids. McCAD makes an attempt to break down an arbitrary shape to a set of boolean GDML
solids it uses some software called Salome and is complex.
https://www.salome-platform.org ?
keithsloan52 wrote:
Sat Aug 17, 2019 6:37 pm
Without access to CATIA I cannot say. Maybe it is like my workbench in that it allows you to edit a GDML file and instantly see the results. Maybe by restricting some CAD functions so it is able to create GDML files, but it cannot offer full flexibility and output GDML those are mutually exclusive.
you simply do a prebuild library of parts (or bodies) with the shapes that GDML supports, you attach some custom properties to them so that you can export that together with the geometry and get a normal GDML or what ever other output you would prefer to have from it... so ok, I would have to review this a bit deeper to be able to say for sure but I don't see why it would not work and from what i understand from those presentations this is how they are doing it with catia.
keithsloan52 wrote:
Sat Aug 17, 2019 6:37 pm
Also I think CERN are hoping that the GSOC projects will allow people to use CAD systems to design, Create Tessellated objects from these and then run the analysis in reasonable time using processors with lots of cores.
https://gitlab.cern.ch/VecGeom/VecGeom
https://hepsoftwarefoundation.org/gsoc/ ... cGeom.html
http://aidasoft.web.cern.ch/USolids

i am not sure if this library is just about tessellating the model
Last edited by saso on Sun Aug 18, 2019 8:06 am, edited 2 times in total.
User avatar
saso
Posts: 1305
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Output a single STEP file from muliple shapes.

Postby saso » Sat Aug 17, 2019 8:01 pm

keithsloan52 wrote:
Sat Aug 17, 2019 6:15 pm
It seems to have all the objects but has lost the structure i.e. hierarchy
yes, you would have to use the standard structure (parts or bodies) for a standard step exported to support that (of course we would have to have a proper implementation of those in the first place :roll: ), or if you absolutely want to use your own objects and structure, then you would also have to write (modify) your own step exporter (and exporters for other formats if you would want to export to something else) to read and export the proper structure from yours. and this is why i am arguing, not just about your implementation, but also our general implementation of parts, assemblies and bodies, that it is best to stick to some standards because then things like this just miraculously work with no additional effort.
Jee-Bee
Posts: 1940
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: Output a single STEP file from muliple shapes.

Postby Jee-Bee » Sun Aug 18, 2019 7:28 am

https://indico.cern.ch/event/374775/con ... 180215.pdf

In this pdf there are 3 tools mentioned... includeing FC
User avatar
easyw-fc
Posts: 2613
Joined: Thu Jul 09, 2015 9:34 am

Re: Output a single STEP file from muliple shapes.

Postby easyw-fc » Sun Aug 18, 2019 7:55 am

Jee-Bee wrote:
Sun Aug 18, 2019 7:28 am
https://indico.cern.ch/event/374775/con ... 180215.pdf

In this pdf there are 3 tools mentioned... includeing FC
It's mentioning keithsloan52 :D
keithsloan52
Posts: 959
Joined: Mon Feb 27, 2012 5:31 pm

Re: Output a single STEP file from muliple shapes.

Postby keithsloan52 » Sun Aug 18, 2019 5:53 pm

easyw-fc wrote:
Sat Aug 17, 2019 11:24 am
keithsloan52 wrote:
Sat Aug 17, 2019 11:00 am
Cannot union or compound as mostly separate objects i.e. distinct objects.

Will have to check out container as not used them before. Could not find any obvious way to create one, which workbench
does one use? Think it is the same problem. FreeCAD is not oriented to multiple objects in a doc.
???
https://www.freecadweb.org/wiki/Std_Part/en
Okay I have been thinking about Part.

GDML has logical and physical volumes, where a Logical volume may have a number of physical volumes.
So I was thinking about having a App::Part for each logical volume, but logical volumes can exist in a hierarchy.
(I currently implement Logical and Physical volumes as Python Groups.)
Playing with Create Part in FreeCAD I have yet to find a way to create a hierarchy, each time I create a Part
it seems to go to the root of a document. Is there a way of having a Part contain a sub Part?
User avatar
easyw-fc
Posts: 2613
Joined: Thu Jul 09, 2015 9:34 am

Re: Output a single STEP file from muliple shapes.

Postby easyw-fc » Sun Aug 18, 2019 6:15 pm

keithsloan52 wrote:
Sun Aug 18, 2019 5:53 pm
Playing with Create Part in FreeCAD I have yet to find a way to create a hierarchy, each time I create a Part
You can drag one inside an other or with python:

Part.addObject(Part1)
keithsloan52
Posts: 959
Joined: Mon Feb 27, 2012 5:31 pm

Re: Output a single STEP file from muliple shapes.

Postby keithsloan52 » Mon Aug 19, 2019 5:24 am

easyw-fc wrote:
Sun Aug 18, 2019 6:15 pm
keithsloan52 wrote:
Sun Aug 18, 2019 5:53 pm
Playing with Create Part in FreeCAD I have yet to find a way to create a hierarchy, each time I create a Part
You can drag one inside an other or with python:

Part.addObject(Part1)
Thanks.

I am experimenting with this. How do I get it so that when I say insert a Cube via the Parts workbench it goes in a particular Part.
I have tried right click on a Part and toggle active part but it just goes to the highest level in the document. Am I supposed to
have a ViewProvider for the Part?
User avatar
easyw-fc
Posts: 2613
Joined: Thu Jul 09, 2015 9:34 am

Re: Output a single STEP file from muliple shapes.

Postby easyw-fc » Mon Aug 19, 2019 6:06 am

keithsloan52 wrote:
Mon Aug 19, 2019 5:24 am
I am experimenting with this. How do I get it so that when I say insert a Cube via the Parts workbench it goes in a particular Part.
I have tried right click on a Part and toggle active part but it just goes to the highest level in the document. Am I supposed to
have a ViewProvider for the Part?

Code: Select all

import FreeCAD
import FreeCADGui
FreeCAD.newDocument("Unnamed")
FreeCAD.setActiveDocument("Unnamed")
FreeCAD.ActiveDocument=FreeCAD.getDocument("Unnamed")
FreeCADGui.ActiveDocument=FreeCADGui.getDocument("Unnamed")
FreeCADGui.ActiveDocument.activeView().viewDefaultOrientation()
FreeCAD.ActiveDocument.Tip = FreeCAD.ActiveDocument.addObject('App::Part','Part')
FreeCAD.ActiveDocument.Part.Label = 'Part'
FreeCADGui.activateView('FreeCADGui::View3DInventor', True)
FreeCADGui.activeView().setActiveObject('part', FreeCAD.ActiveDocument.Part)
# FreeCAD.ActiveDocument.recompute()
FreeCAD.ActiveDocument.addObject("Part::Box","Box")
FreeCAD.ActiveDocument.ActiveObject.Label = "Cube"
FreeCAD.ActiveDocument.getObject("Part").addObject(FreeCAD.ActiveDocument.Box)
# FreeCAD.ActiveDocument.recompute()
FreeCAD.ActiveDocument.Tip = FreeCAD.ActiveDocument.addObject('App::Part','Part2')
FreeCAD.ActiveDocument.Part.Label = 'Part2'
FreeCAD.ActiveDocument.addObject("Part::Cylinder","Cylinder")
FreeCAD.ActiveDocument.ActiveObject.Label = "Cylinder"
FreeCAD.ActiveDocument.getObject("Part2").addObject(FreeCAD.ActiveDocument.Cylinder)
FreeCAD.ActiveDocument.getObject("Part").addObject(FreeCAD.ActiveDocument.Part2)
FreeCAD.ActiveDocument.recompute()
FreeCADGui.SendMsgToActiveView("ViewFit")
keithsloan52
Posts: 959
Joined: Mon Feb 27, 2012 5:31 pm

Re: Output a single STEP file from muliple shapes.

Postby keithsloan52 » Mon Aug 19, 2019 10:54 am

Okay I had a stab at changing Logical_Volume as Python Group to App::Part. ( branch Part in repository )

File looks and displays okay. FreeCAD saved version here
testSTEP.FCStd
(144.48 KiB) Downloaded 6 times
But when I try and export as STEP I get the following error
C++ exception thrown (vector::_M_range_check: __n (which is 18446744073709551614) >= this->size() (which is 26))

OS: Ubuntu 18.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.3.
Build type: Release
Python version: 3.6.8
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedKingdom (en_GB)
User avatar
easyw-fc
Posts: 2613
Joined: Thu Jul 09, 2015 9:34 am

Re: Output a single STEP file from muliple shapes.

Postby easyw-fc » Mon Aug 19, 2019 2:27 pm

Hi,
your model has an issue @ subtraction_refSolSkin1_50002
subtraction_refSolSkin1_50002.png
subtraction_refSolSkin1_50002.png (15.52 KiB) Viewed 233 times