Plug-in for AUTODESK Inventor files

Need help, or want to share a macro? Post here!
TOMCAD
Posts: 5
Joined: Mon Mar 16, 2020 12:50 pm

Re: Plug-in for AUTODESK Inventor files

Postby TOMCAD » Mon Mar 16, 2020 1:21 pm

Hello, I just loaded Freecad 0.18 to test out your inventor plugin.

I used your work around to manually install the prerequisites found on page 5 of this post, because the Addon manager flagged the install due to missing prerequisites.
As a workaround:
[*] extract libs.zip to your temp folder.
[*] open cmd.exe
[*] chang your current folder to %temp%\libs folder
[*] type (adjust FC bin path accordingly): PATH="C:\Program files\FreeCAD\bin";%PATH%
[*] type: cd olefile
[*] type: python setup.py install
[*] type: cd ..\xlrd-1.1.0
[*] type: python setup.py install
[*] type: cd ..\xlutils-2.0.0
[*] type: python setup.py install
[*] type: cd ..\xlwt-1.3.0
[*] type: python setup.py install
[*] type: exit
[*] reopen FreeCAD

This got your plugin loaded into the workbenches but when I try to open one of the demo ipt files nothing happens.
At the bottom of the window it flashes in red text, but I never see anything convert on the screen.

Red Text Reads:
Traceback (Most recent call last):FIle"",line1,in File "C:\Users\Tom\Appdata\Roaming\FreeCad\mod\Inventorloader\importerIL.py",line 118, in open reader = read(doc,filename,True) File "C:\Users\Tom\Appdata\Roaming\FreeCad\Mod\Inventorloader\importerIL.py", Line 40, in read if (Import.ipt(doc, filename,)

When doing the manual install I copied everything to the C:\program files\Freecad\bin\mod folder and not under C:\Users...\Freecad\mod. Does the files need to be moved to the Appdata location?

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.4 (GitTag)
Build type: Release
Branch: releases/FreeCAD-0-18
Hash: 980bf9060e28555fecd9e3462f68ca74007b70f8
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
jmplonka
Posts: 98
Joined: Tue Dec 20, 2016 7:47 am
Location: Vaihingen (Enz), Germany

Re: Plug-in for AUTODESK Inventor files

Postby jmplonka » Mon Mar 16, 2020 1:50 pm

Hello "TOMCAT",

I'm sorry for any inconveniances. But unfortunately the Traceback is incomplete. Maybe you tell me the file to be imported and the options "SAT, Nativ or STEP" as well.

Thanks
Jens
TOMCAD
Posts: 5
Joined: Mon Mar 16, 2020 12:50 pm

Re: Plug-in for AUTODESK Inventor files

Postby TOMCAD » Mon Mar 16, 2020 7:20 pm

I am using the first demo file provided with the installer. (Demo-Status-0.1.ipt)

That was a question I had. What is the proper way to open the Inventor file? File--> Open or is there an import command? I haven't seen any SAT/Step options.

How can I get you the complete traceback?
jmplonka
Posts: 98
Joined: Tue Dec 20, 2016 7:47 am
Location: Vaihingen (Enz), Germany

Re: Plug-in for AUTODESK Inventor files

Postby jmplonka » Mon Mar 16, 2020 7:30 pm

Hi,

You did everything right. File->open...
Afterwards there should popup a dialog with a thumbnail of the part with three options:
"Import Autodesk-File based:
* on ACIS data (SAT) or based
* on feature model (nativ)?
The 1st option reads the ACIS (SAT) file data and tries to import all the data defined there.
The 2nd option tries to interprete the given Inventor features directly and translates them into FC features
The 3rd option converts the SAT ACIS data into a STEP file and uses the STEP file imported of FC.

To get the complete traceback: View->Panels->Report view. "Normally" the traceback will be reported there.

You
TOMCAD
Posts: 5
Joined: Mon Mar 16, 2020 12:50 pm

Re: Plug-in for AUTODESK Inventor files

Postby TOMCAD » Tue Mar 17, 2020 1:57 pm

I got it working last night!! I had gotten Windowed :roll: You can't open the demo files from the Program files directory because Windows locks the directory. Moving the demo files to your desktop/documents folder and everything works.

For those of you playing along at home here are my Windows install steps.
I couldn't use the Addon manager inside of FreeCad due to it flagging the missing libraries.
So I downloaded the package from the github repository. https://github.com/jmplonka/InventorLoader

1. Browse to C:\Program files\"FreeCad Version"\Bin\ Create a folder called MOD under the Bin folder.
2. Extract the files downloaded to the newly created MOD Folder.
3. Extract the libs.zip to a folder called libs inside the MOD folder.
3. Launch Command prompt. Remember to launch Command prompt as ADMINISTRATOR (Thank you Windows)
4. In Command Prompt type (adjust FC bin path accordingly): PATH="C:\Program files\FreeCAD\bin";%PATH%
5. Set Command Prompt to the newly created libs directory C:\Program Files\"FreeCad Version"\Bin\MOD\libs
6. In Command Prompt type: cd olefile
7. In Command Prompt type: python setup.py install
8. In Command Prompt type: cd ..\xlrd-1.1.0
9. In Command Prompt type: python setup.py install
10. In Command Prompt type: cd ..\xlutils-2.0.0
11. In Command Prompt type: python setup.py install
12. In Command Prompt type: cd ..\xlwt-1.3.0
13. In Command Prompt type: python setup.py install
14. Exit Command Prompt
15. In Windows Explorer browse to C:\Program Files\"FreeCad Version"\Bin\MOD and copy the Demo-Status folder to your desktop or your documents folder.
16. Reopen FreeCAD and browse to the new location of the Demo-Status folder and select and ipt file to open and test.

If this doesn't work turn on the Report View under View--> Panels--> Report View so that you can see the full error message.

I hope this helps someone.
Thanks to Jens for the awesome plugin.
jmplonka
Posts: 98
Joined: Tue Dec 20, 2016 7:47 am
Location: Vaihingen (Enz), Germany

Re: Plug-in for AUTODESK Inventor files

Postby jmplonka » Thu Mar 19, 2020 7:47 pm

Thank you very much for figuring out the root cause.
I'm trying to find a proriate fix for this.
jmplonka
Posts: 98
Joined: Tue Dec 20, 2016 7:47 am
Location: Vaihingen (Enz), Germany

Re: Plug-in for AUTODESK Inventor files

Postby jmplonka » Tue Mar 24, 2020 7:21 am

Well, regarding the "Read-Only" folders, maybe this will work.*
  • In case the dump folder could not be created the plugin now tries to get the systems temp folder from the OS environment variables: "TEMP" -> "TMP" -> "TMPDIR", if neither of the variables is set, than a sub-folder "_InventorLoader_Dump" in the user's home path will be created.
  • This folder will be used to create a separate folder with the name of the imported file (e.g. "Demo-Status-0.4.ipt" -> "Demo-Status-0.4_ipt")
  • As fall back: If no folder could be located, no information will be dumped!
  • When converting the IPT file to SAT or STEP these files will, the current storing location was the same folder as the file to be imported. This will changed to the users home directory in case of read only folders.
Hope this will solve some of
User avatar
Roy_043
Posts: 1224
Joined: Thu Dec 27, 2018 12:28 pm

Re: Plug-in for AUTODESK Inventor files

Postby Roy_043 » Tue May 19, 2020 2:46 pm

My first attempt to import a 3D DXF results in the following error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\<username>\AppData\Roaming\FreeCAD\Mod\InventorLoader\importerIL.py", line 108, in insert
open(filename, skip, only, root)
File "C:\Users\<username>\AppData\Roaming\FreeCAD\Mod\InventorLoader\importerIL.py", line 121, in open
reader = read(doc, filename, True)
File "C:\Users\<username>\AppData\Roaming\FreeCAD\Mod\InventorLoader\importerIL.py", line 49, in read
if (importerDXF.read(filename)):
File "C:\Users\<username>\AppData\Roaming\FreeCAD\Mod\InventorLoader\importerDXF.py", line 30, in read
stream = io.StringIO(entry.acis)
<class 'TypeError'>: initial_value must be str or None, not list


Version:

Code: Select all

OS: Windows 8.1 (6.3)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.21097 (Git)
Build type: Release
Branch: master
Hash: a5ab09aa0941cc945e59848897b160f8cbfc0831
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Dutch/Netherlands (nl_NL)
Test file (created with BricsCAD) attached.
Attachments
Cylinder_test.dxf
(14.04 KiB) Downloaded 3 times
jmplonka
Posts: 98
Joined: Tue Dec 20, 2016 7:47 am
Location: Vaihingen (Enz), Germany

Re: Plug-in for AUTODESK Inventor files

Postby jmplonka » Tue May 19, 2020 3:00 pm

Thank you for sharing the example :)
Should be fixed now.
User avatar
Roy_043
Posts: 1224
Joined: Thu Dec 27, 2018 12:28 pm

Re: Plug-in for AUTODESK Inventor files

Postby Roy_043 » Tue May 19, 2020 4:47 pm

That was fast! Thanks.