Error converting from .3ds to .stl using import3DS: "Unknownchunk object"

Need help, or want to share a macro? Post here!
umardastgir
Posts: 32
Joined: Mon Apr 22, 2019 9:29 pm

Error converting from .3ds to .stl using import3DS: "Unknownchunk object"

Postby umardastgir » Mon Apr 29, 2019 8:20 pm

Hello everyone,

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:

Code: Select all

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:

Code: Select all

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:
https://github.com/FreeCAD/FreeCAD/blob ... port3DS.py
Last edited by umardastgir on Mon Apr 29, 2019 8:57 pm, edited 2 times in total.
openBrain
Posts: 1809
Joined: Fri Nov 09, 2018 5:38 pm

Re: Error converting from .3ds to .stl

Postby openBrain » Mon Apr 29, 2019 8:34 pm

Why not continue your existing thread about that problem ?

EDIT : please post your FC info both for your Win and Linux systems.
umardastgir
Posts: 32
Joined: Mon Apr 22, 2019 9:29 pm

Re: Error converting from .3ds to .stl

Postby umardastgir » Mon Apr 29, 2019 8:49 pm

Hello Brain,

Since this was a different problem (error using import3ds library) I though maybe it would be best to start a new thread.

I am working on FreeCAD version 0.17 on both windows and linux.

I am using 64 bit windows 10 and Ubuntu 18.04
openBrain
Posts: 1809
Joined: Fri Nov 09, 2018 5:38 pm

Re: Error converting from .3ds to .stl using import3DS: "Unknownchunk object"

Postby openBrain » Mon Apr 29, 2019 9:05 pm

Again please post your FC info as described in the IMPORTANT link on top of the page for both OS.
There are multiple 0.17 builds, and even the same version could have been compiled with a different version of Qt and/or Python. ;)
umardastgir
Posts: 32
Joined: Mon Apr 22, 2019 9:29 pm

Re: Error converting from .3ds to .stl using import3DS: "Unknownchunk object"

Postby umardastgir » Mon Apr 29, 2019 10:02 pm

On windows:

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 32-bit
Version: 0.17.13528 (Git)
Build type: Release
Branch: releases/FreeCAD-0-17
Hash: 5c3f7bf8ec51e2c7187789f7edba71a7aa82a88b
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: English/UnitedStates (en_US)

On Linux:
On Ubuntu, I am not sure how to access this information because I am running it on a remote computer using command line and do not have access to a screen. I will post it as soon as I get to know this.
I do know that on Ubuntu, I run the script using python3. With python 2, it gives me an error:
"ImportError: dynamic module does not define module export function (PyInit_FreeCAD)"
User avatar
sgrogan
Posts: 5241
Joined: Wed Oct 22, 2014 5:02 pm

Re: Error converting from .3ds to .stl using import3DS: "Unknownchunk object"

Postby sgrogan » Mon Apr 29, 2019 11:41 pm

openBrain wrote:
Mon Apr 29, 2019 9:05 pm
Again please post your FC info as described in the IMPORTANT link on top of the page for both OS.
There are multiple 0.17 builds, and even the same version could have been compiled with a different version of Qt and/or Python. ;)
umardastgir wrote:
Mon Apr 29, 2019 10:02 pm
On Linux:
On Ubuntu, I am not sure how to access this information because I am running it on a remote computer using command line and do not have access to a screen. I will post it as soon as I get to know this.
I do know that on Ubuntu, I run the script using python3. With python 2, it gives me an error:
"ImportError: dynamic module does not define module export function (PyInit_FreeCAD)"
This is a python2/3 issue. It's critical to know what version of FreeCAD and Python on what OS. FreeCAD should use Dice3DS from https://github.com/FreeCAD/FreeCAD/tree ... ch/Dice3DS but I bet it's not PY3 compatible.

Also how have you resolved FreeCAD's dependencies. Are you using one of FreeCAD's PPA's on Ubuntu and the installer on Win?
umardastgir
Posts: 32
Joined: Mon Apr 22, 2019 9:29 pm

Re: Error converting from .3ds to .stl using import3DS: "Unknownchunk object"

Postby umardastgir » Mon Apr 29, 2019 11:47 pm

True. I also believe its not Python3 compatible because it runs all fine on Python 2 and windows. I do not have direct access to this machine, is there a way I can see freecad version and information by typing a command on the terminal?
umardastgir
Posts: 32
Joined: Mon Apr 22, 2019 9:29 pm

Re: Error converting from .3ds to .stl using import3DS: "Unknownchunk object"

Postby umardastgir » Mon Apr 29, 2019 11:49 pm

Also, the reason I am not running the script on Python2 is because of the error I have explained in the post below:

Code: Select all

https://forum.freecadweb.org/viewtopic.php?f=22&t=36017&p=304668#p304668
I believe it would be better if I run the script on Python2 (and solve the problem I am having described in the link above)
User avatar
sgrogan
Posts: 5241
Joined: Wed Oct 22, 2014 5:02 pm

Re: Error converting from .3ds to .stl using import3DS: "Unknownchunk object"

Postby sgrogan » Mon Apr 29, 2019 11:58 pm

umardastgir wrote:
Mon Apr 29, 2019 11:47 pm
is there a way I can see freecad version and information by typing a command on the terminal?

Code: Select all

FreeCAD -v
or

Code: Select all

FreeCAD -v -l
https://www.freecadweb.org/wiki/Start_u ... figuration
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Error converting from .3ds to .stl using import3DS: "Unknownchunk object"

Postby NormandC » Tue Apr 30, 2019 2:25 am

sgrogan wrote:
Mon Apr 29, 2019 11:58 pm

Code: Select all

FreeCAD -v
I doubt either will work, because it lanches a separate Gui window using qt5ct plugin.