0

I am working on a project to convert various file formats to .stl. I have succeeded converting .step, .igs, .dae and .obj file to .stl. Whenever I try to convert .3ds file to .stl, I get the following error:

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):

AttributeError: 'UnknownChunk' object has no attribute '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. The weird part is that this code executes completely fine on a Windows platform. However, when I tried running it on Ubuntu 18.04, it gives me the above mentioned error. Can someone point whats going on here?

Code reference for import3DS library can be found here

Derek Pollard
  • 6,953
  • 6
  • 39
  • 59
Umar Dastgir
  • 688
  • 9
  • 25

1 Answers1

1

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.

sliptonic
  • 460
  • 3
  • 11
  • The problem was with Python version. It turns out that import3DS imports another file (Dice3DS) which only runs for Python 2. I installed FreeCAD for Python2 and all the dependencies on my Linux machine and it works fine. I believe your version of FreeCAD will be running Python 2. Thanks for the response though. – Umar Dastgir Apr 30 '19 at 20:15