Is there a Nuclear Physicist in the House?.

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Post Reply
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Is there a Nuclear Physicist in the House?.

Post by keithsloan52 »

Back in 2017 a number of people mentioned that CERN were uing FreeCAD seehttps://forum.freecadweb.org/viewtopic. ... RN#p178049

This got me interested on what was going on as CERN have done wonders for KiCAD by taking it under their wing. Think there are now two developers on KiCAD sponsored by CERN. Having developed the CSG importer which led to Sebastian Hoogen developing the OpenSCAD work bench, I started an effort of a FreeCAD GDML importer seehttps://github.com/KeithSloan/FreeCAD_Python_GDML

The initial post mentioned indirectly an effort by Emmanuel Deluge and I later looked at this http://cad-gdml.in2p3.fr/. Emmanuel has moved on and his interest is in other areas. This was developed in C++ and so needs updating and recompiling with new versions of FreeCAD. There is a copy of Emmanuel's effort that worked with FreeCAD 0.17 (Or may have been 0.16 ) thanks to help from @wmayer in the gdml branch of https://github.com/KeithSloan/FreeCAD_sf_master but needs work to compile with current version. I did ask about what was needed to make this an installable Workbench but was informed this was a challenge for C++ Workbenches and aimed at Python ones. Somebody Mentioned that Geant4 ( C++ libraries ) for Monte-Carlo simulation and also have function for GDML had a developing Python interface so I started to looked at this, see https://github.com/KeithSloan/FreeCAD_Geant4

There is a challenge here in that CAD systems now use and create BREP objects where as the Monte-Carlo simulations what objects as CSG. This was recognised by @jriegel back in 2013. https://forum.freecadweb.org/viewtopic. ... =10#p40281

There are a number of Research Papers and efforts of software to convert STEP files to Mesh's and then to GEANT4/GDML Tessellated-solids. (These are only supported by GEANT4 and Not by ROOT), some of these use FreeCAD code to convert the STEP files to meshes.

I have recently written an exportGDML for FreeCAD see https://github.com/KeithSloan/FreeCAD_Python_GDML ( Still needs a lot of testing and further development) but scans the current FreeCAD document for some FreeCAD objects that can easily be exported as GDML (CSG type ) Solids. But then for all other objects checks if Planar and if so outputs a Tessellated Solid with 3 or 4 vertex and for non planar objects creates a Mesh and then a Tessellates Solid with 3 Vertex. The question/challenge is finding people in the Physics community to give this a try. There is a Geant4 Forum at http://hypernews.slac.stanford.edu/Hype ... nt4/cindex But it does not seem very active. Anybody got any ideas of how to generate some interest?

In the last few days I have also come across McCAD for example this paper at https://www.kns.org/files/int_paper/pap ... -08LuL.pdf and a FreeCAD workbench at https://github.com/McCadKIT/FreeCAD-McCad This workbench is written in C++ so have the inhibitor of needing it an FreeCAD to be built from source in order to give it a try.

Would it not be better for a cooperative effort and have this as part of the FreeCAD source. Or is there a way of having installable workbenches written in C++

Anyway thanks for reading this far of my ramble.
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Is there a Nuclear Physicist in the House?.

Post by Joel_graff »

keithsloan52 wrote: Sun Mar 03, 2019 6:06 am Would it not be better for a cooperative effort and have this as part of the FreeCAD source. Or is there a way of having installable workbenches written in C++

Anyway thanks for reading this far of my ramble.
I'm not a physics guy, but I hate to see a post go unanswered. The first question I have, though, is why must the workbench be in C++? I understand existing work has been done to that end, but it seems like you're asking for a pretty significant feature (installable C++ workbenches), which represents a lot of work. I really don't know the history of this, so maybe I'm just uninformed.

Anyway, the question I have is, must the solution be implemented in C++? Or can development possibly be continued in a Python adaptation?
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Is there a Nuclear Physicist in the House?.

Post by keithsloan52 »

Joel_graff wrote: Thu Mar 07, 2019 12:41 pm
I'm not a physics guy, but I hate to see a post go unanswered. The first question I have, though, is why must the workbench be in C++? I understand existing work has been done to that end, but it seems like you're asking for a pretty significant feature (installable C++ workbenches), which represents a lot of work. I really don't know the history of this, so maybe I'm just uninformed.

Anyway, the question I have is, must the solution be implemented in C++? Or can development possibly be continued in a Python adaptation?
Emmanuel Deluge effort is using the Geant4 C++ libraries. There is now a python interface to those libraries but it is very much a work in progress. I have tried to use the interface to do something similar to Emmanuel's see
https://github.com/KeithSloan/FreeCAD_Geant4

I am also trying using native Python and Pythons ability to parse and read XML see https://github.com/KeithSloan/FreeCAD_Python_GDML

McCAD makes extensive use of Salome and as far as I know this is only available via C++

One can create interfaces to C++ from Python using Boost, but at the end of the day the C++ libraries would have to be supplied with the workbench and these tend to be supplied as source builds
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Is there a Nuclear Physicist in the House?.

Post by Joel_graff »

keithsloan52 wrote: Sun Mar 10, 2019 4:16 am Emmanuel Deluge effort is using the Geant4 C++ libraries. There is now a python interface to those libraries but it is very much a work in progress. I have tried to use the interface to do something similar to Emmanuel's see
https://github.com/KeithSloan/FreeCAD_Geant4

I am also trying using native Python and Pythons ability to parse and read XML see https://github.com/KeithSloan/FreeCAD_Python_GDML

McCAD makes extensive use of Salome and as far as I know this is only available via C++

One can create interfaces to C++ from Python using Boost, but at the end of the day the C++ libraries would have to be supplied with the workbench and these tend to be supplied as source builds
That explains it fairly well... It's really beyond me as to what's going to be the best approach - guys like @wmayer, @yorik or @kkremitzki will have to weigh in.

Also, out of curiosity, what platform are you chiefly interested in targeting?

pinging wmayer for some advice ;)
wmayer wrote:
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
ⵎⴰⵙⵏⵙⴰⵏ
Posts: 7
Joined: Tue Oct 03, 2017 11:25 pm

Re: Is there a Nuclear Physicist in the House?.

Post by ⵎⴰⵙⵏⵙⴰⵏ »

Maybe a bit off topic, but I would like to mention that during my nuclear engineering master's thesis I did use FreeCAD to generate some models in order to verify some FEM code we were writing. This was done in part with the development team of Code_Aster.

The whole Code_Aster/Code_Saturne team based in Manchester were still developing geometries using the built in features of Salome, which greatly inhibited the complexity of the models they could create. They were unaware at that time that something like FC even existed, I think that if FC would be "marketed" towards academic institutions more funding/dev time could become available.
Post Reply