Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

convert step in stl file python OCC.core

from OCC.Core.STEPControl import STEPControl_Reader
from OCC.Core.StlAPI import StlAPI_Writer

input_file  = 'myshape.stp'   # input STEP (AP203/AP214 file)
output_file = 'myshape.stl'   # output X3D file


step_reader = STEPControl_Reader()
step_reader.ReadFile( input_file )
step_reader.TransferRoot()
myshape = step_reader.Shape()
print("File readed")

# Export to STL
stl_writer = StlAPI_Writer()
stl_writer.SetASCIIMode(True)
stl_writer.Write(myshape, output_file)
print("Written")
Source by pythonocc-doc.readthedocs.io #
 
PREVIOUS NEXT
Tagged: #convert #step #stl #file #python
ADD COMMENT
Topic
Name
4+5 =