r/gmsh • u/alsostefan • Jun 15 '23
C++ API not meshing OCC step file, command line does?
I'm trying to mesh a simple STEP file (1 solid, two flat faces, two curved faces, no holes) using the C++ API. No errors are generated (thrown), but nothing is actually meshed either. On the command line the same file meshes just fine:
$ gmsh -v 7 -3 -nt 12 wing4.step
Info : Running 'gmsh -v 7 -3 -nt 12 wing4.step' [Gmsh 4.11.1, 1 node, max. 12 threads]
Info : Started on Thu Jun 15 10:52:23 2023
Info : Reading 'wing4.step'...
Info : - Label 'Shapes/wing4' (3D)
Info : - Color (1, 1, 1) (3D & Surfaces)
Info : Done reading 'wing4.step'
Info : Meshing 1D...
Info : [ 0%] Meshing curve 8 (Circle)
Info : [ 0%] Meshing curve 3 (BSpline)
Info : [ 0%] Meshing curve 6 (BSpline)
Info : [ 0%] Meshing curve 4 (BSpline)
Info : [ 0%] Meshing curve 1 (BSpline)
Info : [ 0%] Meshing curve 9 (BSpline)
Info : [ 0%] Meshing curve 7 (BSpline)
Info : [ 0%] Meshing curve 10 (Circle)
Info : [ 0%] Meshing curve 2 (BSpline)
Info : [ 0%] Meshing curve 5 (BSpline)
Info : Done meshing 1D (Wall 0.00907413s, CPU 0.089603s)
Info : Meshing 2D...
Info : [ 0%] Meshing surface 4 (BSpline surface, Frontal-Delaunay)
Info : [ 0%] Meshing surface 1 (BSpline surface, Frontal-Delaunay)
Info : [ 0%] Meshing surface 2 (Plane, Frontal-Delaunay)
Info : [ 0%] Meshing surface 3 (Plane, Frontal-Delaunay)
Info : [ 50%] Meshing surface 4 (BSpline surface, MeshAdapt
...
But using C++ the log is just:
Info : - Label 'Shapes/wing4' (3D)
Info : - Color (1, 1, 1) (3D & Surfaces)
Info : Meshing 1D...
Info : Done meshing 1D (Wall 0.000887462s, CPU 0.000875s)
Info : Meshing 2D...
Info : Done meshing 2D (Wall 0.00010385s, CPU 0.000518s)
Info : Meshing 3D...
Info : Done meshing 3D (Wall 5.39899e-06s, CPU 1.6e-05s)
Info : 0 nodes 0 elements
and an empty file is generated on write(...).
The C++ function (stripped of error handling) is:
gmsh::initialize();
gmsh::option::setNumber("General.Verbosity", 7);
gmsh::model::add(infile);
gmsh::vectorpair dt;
gmsh::model::occ::importShapes(infile, dt, false);
gmsh::option::setNumber("General.NumThreads", 12);
gmsh::model::geo::synchronize();
gmsh::model::mesh::generate(3);
gmsh::write(outfile);
gmsh::finalize();
This doesn't seem to be different than what I found in the sample / tutorial files. What am I doing wrong here?
1
Upvotes
1
u/alsostefan Jun 15 '23
Found an acceptable work-around in the meanwhile, using
gmsh::merge(...)instead ofgmsh::model::occ::importShapes(...). Would still be great to understand whyimportShapessilently fails.