0

stp から stl に変換しようとしています。コードは次のとおりです。

rom OCC.Core.STEPControl import STEPControl_Reader
from OCC.Core.StlAPI import StlAPI_Writer
import os
os.chdir(os.path.dirname(os.path.abspath(__file__)))


input_file  = 'stl_test.stp'   # input STEP (AP203/AP214 file)
output_file = 'stl_test.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(stl_writer.Write(myshape, output_file))
print("Written")

これは、作業ディレクトリに何も保存していません。そしてprint(stl_writer.Write(myshape, output_file))、誤った出力を出しています。

誰でも助けることができますか?

4

0 に答える 0