Closed guillaume-florent closed 3 years ago
Ok, I have been scratching my head on this for a while, and I still don't completely understand what is going on. As opposed to @guillaume-florent, I often run into a segmentation fault while exporting a STEP file. I recently managed to activate a writing option (Interface_Static_SetCVal('write.surfacecurve.mode','0')) which allows for avoiding the segmentation fault. Yet, in some occasions the exported step file is quite weird. Some of the wires bounding the surfaces are not closed, as some edge is missing. I worked on it a lot, but can't get past this issue. Plus, I haven't been able to find anyone with a similar problem online. It might be worth writing on pythonocc forum, I guess...
So, I'll add one more comment on this subject so that it doesn't get lost. An alternative way to get a "good" step file would be that of exporting an iges file, importing it back and use the resulting shape to export a step file. As far as I have seen, that does the trick. Of course, one might argue that this is not an ideal way to go, as passing through an iges file might result in loosing part of the topological information in the geometry. For one thing, roughly speaking step files support volumes, while iges files only include surfaces and curves. So, this should in principle not be a good way to do the job. But as things are now, pygem is not preserving the topological structures in the processed CAD file anyway. In fact, regardless of possible shells, volumes, or any structures found, for the time being pygeom only loops on the faces, modifies them and saves everything as a face compound. Any structure as a volume is lost anyway, and must be put together "a posteriori" in a cad tool. For the moment, we haven't had complaints about this, so there is no reason to change things. Should some requests arrive, we might figure out if there is a way to modify the geometry preserving all the topological entities.
Applying PyGem FFD to a STEP file results in an error. Please, see example code at https://github.com/guillaume-florent/PyGeM/commit/983c1e8313462d9bf5a3f85bd60624ec0c85fa31
The modified STEP file does not seem to be a valid STEP file and crashes CAD softs like FreeCAD and Salome (no geometrical data in the imported file).