简体   繁体   English

如何解决将.3ds文件转换为.stl的错误

[英]How to resolve Error converting .3ds file to .stl

I am working on a project to convert various file formats to .stl. 我正在一个项目中,将各种文件格式转换为.stl。 I have succeeded converting .step, .igs, .dae and .obj file to .stl. 我已成功将.step,.igs,.dae和.obj文件转换为.stl。 Whenever I try to convert .3ds file to .stl, I get the following error: 每当我尝试将.3ds文件转换为.stl时,都会出现以下错误:

Traceback (most recent call last): File "3DFileFormatConversion.py", line 141, in import3DS.open(INPUT) File "/usr/share/freecad/Mod/Arch/import3DS.py", line 59, in open read(filename) File "/usr/share/freecad/Mod/Arch/import3DS.py", line 92, in read for j,d_nobj in enumerate(dom.mdata.objects): 追溯(最近一次通话最近):import3DS.open(INPUT)中的文件“ 3DFileFormatConversion.py”,第141行,在打开的read中的文件“ /usr/share/freecad/Mod/Arch/import3DS.py”,文件名)文件“ /usr/share/freecad/Mod/Arch/import3DS.py”,第92行,在枚举(dom.mdata.objects)中的j,d_nobj的读取中:

AttributeError: 'UnknownChunk' object has no attribute 'mdata' AttributeError:'UnknownChunk'对象没有属性'mdata'

The code I am using for this conversion is as follows: 我用于此转换的代码如下:

import import3DS
import3DS.open(INPUT)
App.setActiveDocument(INPUTFILE)
App.ActiveDocument=App.getDocument(INPUTFILE)
__objs__=[]
for mesh in FreeCAD.getDocument(INPUTFILE).Objects:
    __objs__.append(mesh)
Mesh.export(__objs__,OUTPUT)
del __objs__

I get an error in the import3Ds.open(INPUT) command, where INPUT is the input file name. 我在import3Ds.open(INPUT)命令中遇到错误,其中INPUT是输入文件名。 The weird part is that this code executes completely fine on a Windows platform. 奇怪的是,此代码在Windows平台上完全可以执行。 However, when I tried running it on Ubuntu 18.04, it gives me the above mentioned error. 但是,当我尝试在Ubuntu 18.04上运行它时,它给了我上面提到的错误。 Can someone point whats going on here? 有人可以指出这里发生了什么吗?

Code reference for import3DS library can be found here 这里可以找到import3DS库的代码参考

Can't duplicate your problem. 无法复制您的问题。 It works for me. 这个对我有用。 There might be a problem with your input file. 您的输入文件可能有问题。 Please post to the FreeCAD forum along with your FreeCAD version information. 请连同您的FreeCAD版本信息一起发布到FreeCAD论坛。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM