stl_writer.Write 不保存任何文件

问题描述

我正在尝试从 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)) 给出了错误输出

有人可以帮忙吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)