如何将上传的STEP文件转换为其他CAD格式?最好使用PHP。
我将一个小的STEP文件上传到3dContentCentral,并立即显示了我新上传的STEP文件的20种不同的文件类型格式。示例网址: http://www.3dcontentcentral.com/Download-Model.aspx?catalogid=171&id=584767
希望你们中的一些人能指出我正确的方向:)
答案 0 :(得分:2)
您可以使用FreeCAD提供的API将STEP文件转换为其他3D格式。
API是用Python编写的,但您可以使用Pip - Python in PHP
这是一个示例,演示如何使用python将文件从STEP转换为OBJ格式:
import os
import ImportGui
files = os.listdir("path")
for file in files:
ImportGui.open("path" + file)
App.setActiveDocument("Unnamed")
App.ActiveDocument=App.getDocument("Unnamed")
Gui.ActiveDocument=Gui.getDocument("Unnamed")
Gui.SendMsgToActiveView("ViewFit")
__objs__=[]
__objs__.append(FreeCAD.getDocument("Unnamed").getObject("Part__Feature"))
index = 1
base = 'Part__Feature00'
while FreeCAD.getDocument("Unnamed").getObject(base + str(index)) is not None:
__objs__.append(FreeCAD.getDocument("Unnamed").getObject(base + str(index)))
index+=1
import Mesh
Mesh.export(__objs__,"path" + file + ".obj")
del __objs__
App.closeDocument("Unnamed")