CadQuery / cadquery

A python parametric CAD scripting framework based on OCCT
https://cadquery.readthedocs.io
Other
3.23k stars 294 forks source link

Import STEP file and save as Shape object for STL conversion #1390

Open michaelnicol opened 1 year ago

michaelnicol commented 1 year ago

Hello,

I am attempting to import and convert a STEP file to an STL file.

Currently, my code is the following for STEP to STL

import cadquery as cq
afile = cq.importers.importStep(fileNameFrom) # File in directory
cq.exporters.export(afile,fileNameOut) # Place the converted file in the same directory, ends with ".stl"

The issue is that this does not allow for tolerance modification, resulting in extremely large file sizes when going from STEP to STL (often 22 MB to 386 MB).

Instead, I would like to import the STEP file and save it to the Shape object to use the exportSTL method: https://cadquery.readthedocs.io/en/latest/importexport.html#exporting-stl

However, I can't find any documentation on this principle. How do I go about completing thing conversion?

jmwright commented 1 year ago

Have a look at the tolerance and angularTolerance options here.