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 4:09 pm

keithsloan52 wrote:
Sat Aug 17, 2019 3:36 pm
No No my friend it is you that needs to do the research.
Will do if I find the time someday
keithsloan52 wrote:
Sat Aug 17, 2019 3:36 pm
I have read bits about CATIA but it is way too expensive unless you are somebody like CERN, so cannot afford to check out what they do.
So I also don't know exactly how they have this GDML support implemented in catia, but from this presentations it seems clear that they are using the standard catia (brep) geometry, that should in general be the same as in FreeCAD... But, you do see the difference of a brep solid and a brep shell and the difference in the meshes that they produce for the same shapes?
keithsloan52
Posts: 972
Joined: Mon Feb 27, 2012 5:31 pm

Re: Output a single STEP file from muliple shapes.

Postby keithsloan52 » Sat Aug 17, 2019 4:28 pm

easyw-fc wrote:
Sat Aug 17, 2019 12:18 pm
keithsloan52 wrote:
Sat Aug 17, 2019 12:00 pm
Don't think it really solve things I am not dealing with standard Parts, can a Part contain a FreeCAD_Python_Object
and if yes when exporting as STEP will it just look at the Shape. Given Shape is not standard for such things
I doubt it.

A doc in my workbench is a whole series of FreeCAD_Python_Objects that implement GDML solids.
What I require is to loop through the document and output all the Shapes into a STEP file.

I think I need pythonOCC to do that. I have it installed and can import OCC from python, but need to get FreeCAD to recognise it.
Simply post a sample FC file... FC can handle almost everything.

EDIT
here some examples:
gdml-part.stepgdml-union.stepgdml-union.FCStd
gdml-compound.stepgdml-compound.FCStd
Tried exporting a small imported GDML file and it does create a STEP file that I can load into FreeCAD but it seems to have lost its structure, just seems to be one object.
test2.step
(19.99 KiB) Downloaded 7 times
The saved FreeCAD file. Not sure if you will be able to load this without installing the Workbench
detector_Mainz_v2.FCStd
(134.13 KiB) Downloaded 4 times
The GDML file
solids_Mainz_v2.xml
(8.51 KiB) Downloaded 3 times
matrices_Mainz_v2.xml
(188.45 KiB) Downloaded 10 times
materials.xml
(12.87 KiB) Downloaded 6 times
keithsloan52
Posts: 972
Joined: Mon Feb 27, 2012 5:31 pm

Re: Output a single STEP file from muliple shapes.

Postby keithsloan52 » Sat Aug 17, 2019 4:29 pm

Forum would not let me upload gdml file type so need to remove the txt part
detector_Mainz_v2.gdml.txt
(7.18 KiB) Downloaded 6 times
keithsloan52
Posts: 972
Joined: Mon Feb 27, 2012 5:31 pm

Re: Output a single STEP file from muliple shapes.

Postby keithsloan52 » Sat Aug 17, 2019 4:36 pm

saso wrote:
Sat Aug 17, 2019 4:09 pm
keithsloan52 wrote:
Sat Aug 17, 2019 3:36 pm
No No my friend it is you that needs to do the research.
Will do if I find the time someday
keithsloan52 wrote:
Sat Aug 17, 2019 3:36 pm
I have read bits about CATIA but it is way too expensive unless you are somebody like CERN, so cannot afford to check out what they do.
So I also don't know exactly how they have this GDML support implemented in catia, but from this presentations it seems clear that they are using the standard catia (brep) geometry, that should in general be the same as in FreeCAD... But, you do see the difference of a brep solid and a brep shell and the difference in the meshes that they produce for the same shapes?
I prefer to take the advice of an associate professor and a post grad researcher.

Monte Carlo simulation tools ROOT and Geant4 take GDML input or programmed input. They DO NOT take BREP type files. Nearest is to create GDML Tessellated objects. Like I said this years GSOC is an effort to create VecGeom from GDML files including Tessellated, the benefit of VecGeom is that it will run on parallel cores so significant improvement if you have access to the hardware. We wait to see if its enough
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 5:02 pm

keithsloan52 wrote:
Sat Aug 17, 2019 4:36 pm
I prefer to take the advice of an associate professor and a post grad researcher.
I am sure they know a lot about cad systems
keithsloan52 wrote:
Sat Aug 17, 2019 4:36 pm
Monte Carlo simulation tools ROOT and Geant4 take GDML input or programmed input. They DO NOT take BREP type files. Nearest is to create GDML Tessellated objects. Like I said this years GSOC is an effort to create VecGeom from GDML files including Tessellated, the benefit of VecGeom is that it will run on parallel cores so significant improvement if you have access to the hardware. We wait to see if its enough
Yes, ok, I understand that they don't work directly with brep, they also talk about this in the linked presentations, so I get this, but I still don't quite see the real need for building some special objects for this, why not build it in a more standard way and just export it to GDML, it is the way they seem to be doing it in catia, and we are already importing and exporting from/to many different formats... And what is the difference between tessellation and mesh?

Anyway... Attached is just the normal export of all the geometric objects from FreeCAD to step (select all, export to step) from your detector_Mainz_v2.FCStd, is this closer to what you would like to have? If we would have it properly implemented, it could also export the hierarchical structure of the model as an assembly or a multi-body part...
Attachments
test_gdml.step
(765.98 KiB) Downloaded 5 times
keithsloan52
Posts: 972
Joined: Mon Feb 27, 2012 5:31 pm

Re: Output a single STEP file from muliple shapes.

Postby keithsloan52 » Sat Aug 17, 2019 6:15 pm

It seems to have all the objects but has lost the structure i.e. hierarchy
keithsloan52
Posts: 972
Joined: Mon Feb 27, 2012 5:31 pm

Re: Output a single STEP file from muliple shapes.

Postby keithsloan52 » Sat Aug 17, 2019 6:16 pm

And what is the difference between tessellation and mesh?
I think you will find Mesh is 3 sided.

A GDML tessellation can be a mixture of 4 and 3 sided.
keithsloan52
Posts: 972
Joined: Mon Feb 27, 2012 5:31 pm

Re: Output a single STEP file from muliple shapes.

Postby keithsloan52 » Sat Aug 17, 2019 6:37 pm

it is the way they seem to be doing it in catia
At the end of the day a CAD system can create basically any BREP shape.

GDML is a set of solid geometries. A far richer set than FreeCAD parts but does not cover all possible shapes.

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.

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.

I am sure you are right in that CERN uses CATIA. It would explain why I don't see clone and fetch requests from Geneva.
On a recent log GitHub sent me just over half request were from China, next largest is US and the rest Germany. Others
viewing pages, but the only clones or fetches were from the three I mention.

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.
keithsloan52
Posts: 972
Joined: Mon Feb 27, 2012 5:31 pm

Re: Output a single STEP file from muliple shapes.

Postby keithsloan52 » Sat Aug 17, 2019 6:43 pm

I am sure they know a lot about cad systems
They know that the tools used for simulation are ROOT and Geant4 and they only take GDML and programmed input.

Perhaps if you took the time to look at the GDML User Manual http://lcgapp.cern.ch/project/simu/fram ... manual.pdf and understood how flexible CAD systems are in terms of the shapes they can create you might understand things better.
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 6:57 pm

keithsloan52 wrote:
Sat Aug 17, 2019 6:16 pm
And what is the difference between tessellation and mesh?
I think you will find Mesh is 3 sided.

A GDML tessellation can be a mixture of 4 and 3 sided.
tessellation is just a proces of how to approximate a brep in to a mesh, there are many different types of meshes (tessellation algorithms). fem is also not working directly with brep and is creating different meshes for the different type of fem calculations. i can understand that they need it optimized differently then standard fem (however as i said there are already many different mesh types used in fem, optimized for different needs) but i am not buying that there is some special magic, some special "quantum tessellation" behind it that only particle physics professors and post grads can understand...