Reputation: 359
A bit of background
For simulating using openfoam, I create my mesh using snappyHexMesh and as an input I need triagulated surface files such as stl or obj for each object. In my company we work with solidEdge, which cannot export stl's from an assembly. If you export them, they will be in their local coordinate system before being added to the assembly. In order to get the assembly file to stl's, I am exporting a step file in solid edge and write that to an stl in freecad. However, I would like to automate this process using python.
Method
I found this post to convert step file to stl or this website. However, when reading in an assembly step, it creates a single stl file. I would like to create a stl for each part in the assembly. Is there a method to loop over the parts in an assembly and write them to stl?
Upvotes: 0
Views: 3429
Reputation: 11
I would suggest checking out cadquery. It can open step files and easily export them in a couple lines of code.
import cadquery as cq
afile = cq.importers.importStep('filename.STEP')
cq.exporters.export(afile,'filename.stl')
Upvotes: 1