I would like to create a .geo file (such as the ones included as examples) from scratch, but I cannot find any documentation on this file format. The reason I want to do this is so I can create a module that converts svg images to .geo files with a user-specified extrusion parameter. This would make creating certain geometries much easier, as their faces could be modified using any vector graphics editor.
Any information on how netgen .geo files are created would be extremely appreciated.
.geo files use the CSG format (Constructive solid geometry - Wikipedia). I don’t think this is a recommendable file format for conversion from svg images. Consider the stl format, Google search gives some svg to stl extrusion tools (i.e. http://svg2stl.com/) maybe you try one of them. In Netgen you can load stl geometries and mesh them.
Thank you for your quick reply. In the past, I have extruded svg images to stl models using blender. Unfortunately, netgen doesn’t always work properly with stl models created in this way, and I end up getting a segmentation fault more often than not. I’ve found that exporting them as ASCII stl files or using surfaceConvert (through openFoam) can improve my chances of avoiding a segmentation fault, but not always.
I have explored the reference you’ve given on CSG file formats, but I cannot find any explanation of the syntax that the netgen .geo files use.
Ideally, I would like this tool that I am creating to eventually be usable as a component netgen itself. A simple editor like this would greatly improve my workflow, and I’m sure others would benefit as well.
Some documentation for CSG is here:
rotationally symmetric objects are described here:
I tried meshing blender objects once and had problems too, but didn’t have the time to look into then. I think this is because blender can create corrupt stls (with holes and/or overlaps) and Netgen can’t handle that. I think there are some features within blender to repair stl objects (something like “repair for 3D printing” or so… but I haven’t managed to get it working with my blender objects then as well). But if you create non overlapping and hole-free stls you should be able to mesh it with Netgen. Do you have a small example stl that Netgen is unable to mesh? We should definitively do not give a segfault if there is a problem, so this is an issue anyway.
CSG objects are basically just cutted, united or substracted simple objects (plane, bricks, balls, cylinders). I think you could cut planes along the vectors of the vectorgraphic and then cut that object with planes on the top and bottom, but I still think stls would be still easier and faster (especially for more complex svgs…)
I have attached two archives – One simply contains the original .blend file used to create the STL, and the other archive contains my original SVG image along with the two types of STLs that I created using blender. The file titled “BlenderASCII.stl” causes a segmentation fault after mesh generation has completed, and the file titled “BlenderDefault.stl” causes a segmentation fault immediately after it is loaded into netgen. Obviously, the first file is an ACII STL file and the other is an STL that was created using blender’s default conversion parameters.
If you could direct me to the source files that handle mesh generation from STLs, I would be willing to explore this bug on my own as well.
Let me know if I can be of any additional assistance.
As I assumed, the stl triangles are really strange… Netgen gives a warning
WARNING: File has normal vectors which differ extremly from geometry->correct with stldoctor!!!
If you click on Geometry → stl doctor → show stl-triangles you can see what strange stl mesh blender produces
My guess is that Netgen cant handle that thin triangles.
You could try to create “nicer” ones using some existing library but I think it shouldn’t be too complicated to create your own little svg to stl converter which gives better stls…
Still it would be interesting to examine the error and maybe catch it. On my PC Netgen is unable to mesh one of the surfaces, it refines a lot to the edges but is not able to build the surface. My guess would be that the edge detection somehow fails because of the strange triangles and normal vectors. Because of the user meeting I do not have much time this and next week, but I’ll look at it afterwards
If you want to have a look at it: the main code for meshing stl geometries is in netgen/libsrc/stlgeom/meshstlsurface.*pp - this generates the surface mesh from a stl geometry. If the surface mesh is done a volume mesh is generated from the surface mesh with the standard mesher.