View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001961 | FreeCAD | Bug | public | 2015-02-11 14:01 | 2015-02-13 19:50 |
Reporter | swill | Assigned To | yorik | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | reopened | ||
OS | Ubuntu 14.04 Server | ||||
Summary | 0001961: importDXF (v1.38) does not export without a GUI | ||||
Description | I also reported this issue via GitHub: https://github.com/yorikvanhavre/Draft-dxf-importer/issues/7 I am using FreeCAD using the daily build (v15) on a system without X installed. It is a Ubuntu 14.04 server which I dispatch build jobs to. After fixing the issue I posted in the last issue, I get the following issue. FreeCAD 0.15, Libs: 0.15R4542 (Git) DXF libraries not found. Downloading... The DXF import/export libraries needed by FreeCAD to handle the DXF format were not found on this system. Please either enable FreeCAD to download these libraries (menu Edit > Preferences > Import-Export > DXF > Enable downloads) or download these libraries manually, as explained on https://github.com/yorikvanhavre/Draft-dxf-importer I have extracted the contents of the 1.38 zip to my ~/.FreeCAD directory, but it seems like they are not getting picked up. Also, since I am using this library without any GUI, I can not change the preferences to allow it to download the files. Maybe that should be turned ON by default? When I test this via the interpreter I get the following. # python Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path.append('/usr/lib/freecad/lib') >>> import FreeCAD FreeCAD 0.15, Libs: 0.15R4542 (Git) >>> import importDXF DXF libraries not found. Downloading... The DXF import/export libraries needed by FreeCAD to handle the DXF format were not found on this system. Please either enable FreeCAD to download these libraries (menu Edit > Preferences > Import-Export > DXF > Enable downloads) or download these libraries manually, as explained on https://github.com/yorikvanhavre/Draft-dxf-importer >>> print importDXF.CURRENTDXFLIB 1.38 >>> So it does seem that the 'importDXF' files ARE getting picked up, but for some reason parts of the code does not recognize them? I am not sure what is going on here. I do know that the following export is not working. importDXF.export(FreeCAD.ActiveDocument.Objects, "%s/custom.dxf" % (config['app']['export'])) For comparison, all of these exports work just fine. with open("%s/custom.js" % (config['app']['export']), "w") as f: cadquery.exporters.exportShape(p, 'TJS', f) Part.export(FreeCAD.ActiveDocument.Objects, "%s/custom.brp" % (config['app']['export'])) Part.export(FreeCAD.ActiveDocument.Objects, "%s/custom.stp" % (config['app']['export'])) Mesh.export(FreeCAD.ActiveDocument.Objects, "%s/custom.stl" % (config['app']['export'])) This is a pretty major bug for me as I depend on DXF export. I have not been able to get a DXF to export when I use FreeCAD v15 on my Ubuntu 14.04 server (without X installed). I have been able to copy the exported BRP file (included) to my Mac (using FreeCAD v15) and export to DXF there, but this is not a viable workflow for me since I am building a distributed build system. Suggestions for how I get past this? | ||||
Tags | No tags attached. | ||||
FreeCAD Information | |||||
|
|
|
This was not a duplicate of 0001960. The fix you applied in this issue fixed 0001960, not this issue. After fixing 0001960 (which you resolved slightly differently than I did), you then have this issue. This issue still has not been addressed. Please read this issue and understand that even with the 0001960 fix, the export feature does not work when used without a GUI. Let me know if you have questions, but this is the more important issue of the two because the export fails and there does not seem to be any way to work around this one. |
|
Alright, I did more testing of this issue tonight to see if I could figure out what the problem was. I found it very strange that I was getting the following message even though the correct files were located in $HOME/.FreeCAD. DXF libraries not found. Downloading... The DXF import/export libraries needed by FreeCAD to handle the DXF format were not found on this system. Please either enable FreeCAD to download these libraries (menu Edit > Preferences > Import-Export > DXF > Enable downloads) or download these libraries manually, as explained on https://github.com/yorikvanhavre/Draft-dxf-importer I was pretty sure that the issue was that the DXF lib files were not getting picked up by FreeCAD. I did a bunch of tests to confirm this. I have fixed the problem by doing the following in my environment. $ vim /usr/lib/freecad/Mod/Draft/importDXF.py I changed it from: # check dxfLibrary version try: import dxfLibrary import dxfColorMap import dxfReader except ImportError: ...snip... else: ...snip... to: # check dxfLibrary version try: sys.path.append(FreeCAD.ConfigGet("UserAppData")) import dxfLibrary import dxfColorMap import dxfReader except ImportError: ...snip... else: ...snip... With this change I am now able to export DXF format files on a Ubuntu 14.04 Server (without X installed). Cheers and thanks for all the hard work. :) |
|
This problem doesn't appear for me... When I run FreeCAD in console mode, the user app path ($HOME/.FreeCAD) is present in sys.path and all works normally... Could you attach the contents of your sys.path (taken after "import FreeCAD")? |
|
Here is the contents of 'sys.path' after doing 'import FreeCAD'. [ u'/usr/lib/freecad/Mod', u'/usr/lib/freecad/lib', u'/usr/lib/freecad/Mod/Drawing', u'/usr/lib/freecad/Mod/Inspection', u'/usr/lib/freecad/Mod/Idf', u'/usr/lib/freecad/Mod/Part', u'/usr/lib/freecad/Mod/Robot', u'/usr/lib/freecad/Mod/Arch', u'/usr/lib/freecad/Mod/Mesh', u'/usr/lib/freecad/Mod/Raytracing', u'/usr/lib/freecad/Mod/Material', u'/usr/lib/freecad/Mod/Web', u'/usr/lib/freecad/Mod/Complete', u'/usr/lib/freecad/Mod/Assembly', u'/usr/lib/freecad/Mod/Import', u'/usr/lib/freecad/Mod/Test', u'/usr/lib/freecad/Mod/Draft', u'/usr/lib/freecad/Mod/Points', u'/usr/lib/freecad/Mod/Start', u'/usr/lib/freecad/Mod/Spreadsheet', u'/usr/lib/freecad/Mod/Fem', u'/usr/lib/freecad/Mod/OpenSCAD', u'/usr/lib/freecad/Mod/MeshPart', u'/usr/lib/freecad/Mod/Plot', u'/usr/lib/freecad/Mod/Ship', u'/usr/lib/freecad/Mod/PartDesign', u'/usr/lib/freecad/Mod/Image', u'/usr/lib/freecad/Mod/ReverseEngineering', u'/usr/lib/freecad/Mod/Sketcher', '/root/swillkb_builder', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/freecad/lib', '' ] I believe that the last '' is actually supposed to be my home directory. I think that the 'UserHomeData' is being included to the path rather than the 'UserAppData'. Notice their values in the tests below. >>> import FreeCAD FreeCAD 0.15, Libs: 0.15R4542 (Git) >>> sys.path [u'/usr/lib/freecad/Mod', u'/usr/lib/freecad/lib', u'/usr/lib/freecad/Mod/Drawing', u'/usr/lib/freecad/Mod/Inspection', u'/usr/lib/freecad/Mod/Idf', u'/usr/lib/freecad/Mod/Part', u'/usr/lib/freecad/Mod/Robot', u'/usr/lib/freecad/Mod/Arch', u'/usr/lib/freecad/Mod/Mesh', u'/usr/lib/freecad/Mod/Raytracing', u'/usr/lib/freecad/Mod/Material', u'/usr/lib/freecad/Mod/Web', u'/usr/lib/freecad/Mod/Complete', u'/usr/lib/freecad/Mod/Assembly', u'/usr/lib/freecad/Mod/Import', u'/usr/lib/freecad/Mod/Test', u'/usr/lib/freecad/Mod/Draft', u'/usr/lib/freecad/Mod/Points', u'/usr/lib/freecad/Mod/Start', u'/usr/lib/freecad/Mod/Spreadsheet', u'/usr/lib/freecad/Mod/Fem', u'/usr/lib/freecad/Mod/OpenSCAD', u'/usr/lib/freecad/Mod/MeshPart', u'/usr/lib/freecad/Mod/Plot', u'/usr/lib/freecad/Mod/Ship', u'/usr/lib/freecad/Mod/PartDesign', u'/usr/lib/freecad/Mod/Image', u'/usr/lib/freecad/Mod/ReverseEngineering', u'/usr/lib/freecad/Mod/Sketcher', '', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/freecad/lib', ''] >>> FreeCAD.ConfigGet("UserAppData") '/root/.FreeCAD/' >>> FreeCAD.ConfigGet("UserHomeData") '' >>> I am not sure where this stuff is set, so I am not able to verify this is actually the case. |
|
Indeed, the last one for me is /home/yorik/.FreeCAD. No idea why yours is not set. I'll try implementing your solution, after all I believe there is no problem having the same folder twice... |
|
|
|
There isn't a problem with having the same path in there more than once (in my case I actually have '/usr/lib/freecad/lib' in there more than once), however, we can just check to see if it is there before we add it and not add it if it already exists. I have attached a patch which does this. It checks to see if the path is already in sys.path and then adds it if it isnt. I have tested this in my environment and it is working for me and should not change the environment for people whose systems are working. |
|
Ok it's merged! Thanks a lot for the patch! |
FreeCAD: master fe3bb2c5 2015-02-11 19:08:34 Details Diff |
Draft: Small fix in DXF importer - fixes 0001961 |
Affected Issues 0001961 |
|
mod - src/Mod/Draft/importDXF.py | Diff File | ||
FreeCAD: master 4bb365f9 2015-02-11 19:08:34 Committer: wmayer Details Diff |
Draft: Small fix in DXF importer - fixes 0001961 |
Affected Issues 0001961 |
|
mod - src/Mod/Draft/importDXF.py | Diff File | ||
FreeCAD: master 5a9d79ac 2015-02-13 19:49:29 Details Diff |
Draft: Fixed DXF imorter for non-GUI operation - fixes 0001961 |
Affected Issues 0001961 |
|
mod - src/Mod/Draft/importDXF.py | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-02-11 14:01 | swill | New Issue | |
2015-02-11 14:01 | swill | File Added: custom.brp | |
2015-02-11 18:36 | yorik | Relationship added | has duplicate 0001960 |
2015-02-11 18:39 | yorik | Changeset attached | => FreeCAD Master master fe3bb2c5 |
2015-02-11 18:39 | yorik | Assigned To | => yorik |
2015-02-11 18:39 | yorik | Status | new => closed |
2015-02-11 18:39 | yorik | Resolution | open => fixed |
2015-02-11 19:39 | swill | Note Added: 0005785 | |
2015-02-11 19:39 | swill | Status | closed => feedback |
2015-02-11 19:39 | swill | Resolution | fixed => reopened |
2015-02-12 03:45 | swill | Note Added: 0005788 | |
2015-02-12 03:45 | swill | Status | feedback => assigned |
2015-02-12 12:26 | yorik | Note Added: 0005789 | |
2015-02-12 13:30 | wmayer | Changeset attached | => FreeCAD Master master 4bb365f9 |
2015-02-12 13:30 | wmayer | Assigned To | yorik => wmayer |
2015-02-12 13:30 | wmayer | Status | assigned => closed |
2015-02-12 15:18 | swill | Note Added: 0005791 | |
2015-02-12 15:18 | swill | Status | closed => feedback |
2015-02-12 15:32 | yorik | Note Added: 0005792 | |
2015-02-12 16:15 | swill | File Added: 0001-make-sure-UserAppData-is-in-path.patch | |
2015-02-12 16:18 | swill | Note Added: 0005793 | |
2015-02-12 16:18 | swill | Status | feedback => assigned |
2015-02-13 18:45 | wmayer | Assigned To | wmayer => yorik |
2015-02-13 18:52 | yorik | Note Added: 0005797 | |
2015-02-13 19:50 | yorik | Changeset attached | => FreeCAD Master master 5a9d79ac |
2015-02-13 19:50 | yorik | Status | assigned => closed |