DXF/DWG Importer
About
This is an extension which allows to import DWG and DXF files into InkScape (working with Linux and Windows). DWG files are getting converted into DXF and then the DXF gets processed into SVG. The SVG result will be pushed into InkScape. Because there are so much different DXF versions a lot of files fail with the default DXF import tool from InkScape. Other solutions are there. While making this extension i stumbled upon ezdxf library, which is a powerful python implementation to deal with AutoCAD DXF format really well. To support great variety there are options for pre-processing the data by filtering out entities, because some tools like sk1 UniConvertor fail to make an SVG from DXF if there occure entities which it cannot handle.
\*\*Belonging to your toolchain configuration beware. There can happen issues like:\*\*
- wrong transformations (width, height, viewport) and scales. Some can be fixed with Apply Transformations
- unselectable elements. Check the XML tree for strange clipping paths and other defs. You can try to use Ungrouper And Element Migrator/Filter
- large time consumption. Take one or two cups of coffee if you are going to import DWG or DXF files with 10, 100 or maybe 1000 MB size.
- InkScape might crash (often happens when bjnortier DXF tool is used. Try to filter entity types like ARC if this occures)
Converters
The following conversion tools are integrated or used by DXF/DWG Importer:
- https://github.com/bjnortier/dxf (bundled)
- ODA File Converter (if you want to convert DWG to DXF or DXF to another DXF version) - this is not bundled with. You need to install it! For minimum stress with Linux, just use the AppImage version of ODA File Converter!
- available for Linux and Windows - install if you want to import DWG or if you also want to re-convert DXF files (downgrading, repairing (auditing))
- You might need to install a certain Qt framework version manually and to adjust the command in Linux system to make it work. Some details doing this are also included in plugin GUI. The installation files can be found at https://download.qt.io/archive/qt - install to /opt/ directory for example. Note that you need some free account for registering to continue the installation of Qt
vim /usr/bin/ODAFileConverter
vim /usr/bin/ODAFileConverter
#!/bin/sh
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/Qt5.14.2/5.14.2/gcc_64/lib/ #we add this line to satisfy the Qt framework location
SV_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/bin/ODAFileConverter_21.7.0.0:$LD_LIBRARY_PATH
/usr/bin/ODAFileConverter_21.7.0.0/ODAFileConverter "$@"
export LD_LIBRARY_PATH=$SV_LD_LIBRARY_PATH
-
sk1 UniConvertor 1.1.6 - this is not bundled with. You need to install it!
- if you want to import high quality DXF shapes. You need to install 1.1.X version because 2.0 dropped support. On newer Linux system it's hard or impossible to install the old UniConvertor so this feature is only available for Windows users yet
-
ezdxf and matplotlib (python modules) → check MightyScape Extension Collection for instructions regarding custom Python modules with Inkscape
pip3 install ezdxf matplotlib
-
kabeja DXF to SVG converter
- to use it you need to install Java
-
-
pip3 install ezdxf matplotlib
-