can not import dwg-file
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
can not import dwg-file
Hello,
I downloaded some dwg-files and wanted to import them into fc.
I got this error popup: fc-version:
OS: Debian GNU/Linux 8.1 (jessie)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.5161 (Git)
Build type: Unknown
Branch: master
Hash: 48c25da133271a0caebec74427461f01c234c229
Python version: 2.7.9
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
//Edith:
I found a workaround and converted all dwg files with Teiga outside of FC to dxf. DXF-Import then works ...
So no more help required.
I downloaded some dwg-files and wanted to import them into fc.
I got this error popup: fc-version:
OS: Debian GNU/Linux 8.1 (jessie)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.5161 (Git)
Build type: Unknown
Branch: master
Hash: 48c25da133271a0caebec74427461f01c234c229
Python version: 2.7.9
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
//Edith:
I found a workaround and converted all dwg files with Teiga outside of FC to dxf. DXF-Import then works ...
So no more help required.
OS: Linux Debian Jessie amd64 - FC: Git Master
Re: can not import dwg-file
Usually this happens when there are non-ASCII characters in your file paths.. Teigha is very picky on that...
Re: can not import dwg-file
Hi yorik,
thanks for that hint! You're right - path contains non-ASCII characters.
I use linux and utf-8 now for years and don't think about those limitations ...
... but yes, some apps (like meshlab and others) don't handle special characters right.
But ...
I had no problem with Teigha using the same path for conversion and Teigha did it.
Ah - I see
Just tried again - the log shows the problem:
The name of downloaded file has space inside :O
May be the non-ASCII character is not the problem.
AFAIK if you quote the path with single quotes, it should do the trick - and the shell is outside.
thanks for that hint! You're right - path contains non-ASCII characters.
I use linux and utf-8 now for years and don't think about those limitations ...
... but yes, some apps (like meshlab and others) don't handle special characters right.
But ...
I had no problem with Teigha using the same path for conversion and Teigha did it.
Ah - I see
Just tried again - the log shows the problem:
Code: Select all
importDWG.insert(u"/home/xx/yy/Fr\xe4se-Selbstbau/FC/UNP 65.dwg","Unbenannt")
May be the non-ASCII character is not the problem.
AFAIK if you quote the path with single quotes, it should do the trick - and the shell is outside.
OS: Linux Debian Jessie amd64 - FC: Git Master
Re: can not import dwg-file
Are you sure? I always thought in python there is no difference between single and double quotes...django013 wrote:AFAIK if you quote the path with single quotes, it should do the trick - and the shell is outside.
Re: can not import dwg-file
Hi yorik
I'm sure, I don't know anything about python :O
... but I know linux and shell programming and every system call on linux systems involves a shell.
No matter what you do in python or c++ ... at the end a shell gets the path will all arguments. If at that stage, the arguments are not quoted, the shell starts to interpret each argument - and of cause, a space inside an argument will increase the number of arguments for the command called.
To prohibit the shell from any interaction, its best to have each argument embedded in single quotes.
... but quoted paths must match character code page from filesystem. There's no more codepage conversion then.
From python may be a good try, first embed each command argument in single quotes and then embed it into double quotes?
Don't know, whether it works that way - just an idea ...
I'm sure, I don't know anything about python :O
... but I know linux and shell programming and every system call on linux systems involves a shell.
No matter what you do in python or c++ ... at the end a shell gets the path will all arguments. If at that stage, the arguments are not quoted, the shell starts to interpret each argument - and of cause, a space inside an argument will increase the number of arguments for the command called.
To prohibit the shell from any interaction, its best to have each argument embedded in single quotes.
... but quoted paths must match character code page from filesystem. There's no more codepage conversion then.
From python may be a good try, first embed each command argument in single quotes and then embed it into double quotes?
Don't know, whether it works that way - just an idea ...
OS: Linux Debian Jessie amd64 - FC: Git Master
Re: can not import dwg-file
In any case, it's indeed worth trying to play with single/double quotes...
Re: can not import dwg-file
Hi yorik,
could you please tell me some pointers where the call of the dwg-importer happens?
I'd like to have a look at it and do some tests.
could you please tell me some pointers where the call of the dwg-importer happens?
I'd like to have a look at it and do some tests.
OS: Linux Debian Jessie amd64 - FC: Git Master
Re: can not import dwg-file
That should be a good starting point for you:
Code: Select all
[przemo@localhost freecad]$ git grep dwg
Binary file src/Doc/freecad.qch matches
src/Mod/Arch/InitGui.py: FreeCADGui.addPreferencePage(":/ui/preferences-dwg.ui","Import-Export")
src/Mod/Draft/InitGui.py: FreeCADGui.addPreferencePage(":/ui/preferences-dwg.ui","Import-Export")
src/Mod/Draft/InitGui.py:App.addImportType("Autodesk DWG (*.dwg)","importDWG")
src/Mod/Draft/InitGui.py:App.addExportType("Autodesk DWG (*.dwg)","importDWG")
src/Mod/Draft/Resources/Draft.qrc: <file>ui/preferences-dwg.ui</file>
src/Mod/Draft/importDWG.py:def convertToDxf(dwgfilename):
src/Mod/Draft/importDWG.py: indir = os.path.dirname(dwgfilename)
src/Mod/Draft/importDWG.py: basename = os.path.basename(dwgfilename)
src/Mod/Draft/importDWG.py:def convertToDwg(dxffilename,dwgfilename):
src/Mod/Draft/importDWG.py: outdir = os.path.dirname(dwgfilename)
src/Mod/Draft/importDWG.py: return dwgfilename
Binary file src/Mod/Path/DemoParts/hole_puzzle.fcstd matches
Re: can not import dwg-file
Thanks!
so after first look - how can I get the output of the print-statements?
No matter whether I enable python message redirection in fc or not - no print-message shows up
so after first look - how can I get the output of the print-statements?
No matter whether I enable python message redirection in fc or not - no print-message shows up
OS: Linux Debian Jessie amd64 - FC: Git Master