FreeCAD and DWG Import: Difference between revisions

From FreeCAD Documentation
(Marked this version for translation)
mNo edit summary
 
(69 intermediate revisions by 10 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
{{TOCright}}
<translate>
<translate>
<!--T:20-->
{{VeryImportantMessage|Please note that the Teigha Converter was re-branded as ODA-File-Converter. The website hosting ODA-File-Converter has been updated. This wiki page has been updated accordingly as well. <small>September 2018</small> }}


<!--T:26-->
{{Fake heading|sub=4|< Back to [[FreeCAD Howto Import Export]]}}
== Why Can't I Import DWG Files into FreeCAD? == <!--T:1-->
The '''DWG format is a closed source binary file format''' that is not directly supported by FreeCAD. It requires an external 3rd party file converter to first convert then import the conversion into FreeCAD for use.


==Why is it hard to support DWG Files in FreeCAD?== <!--T:1-->
<!--T:19-->
Note that at this time, it is not possible to import 3D DWG in FreeCAD. 3D data is embedded as binary .SAT (ACIS) data, a proprietary and undocumented format.


<!--T:27-->
== What Do I Need To Be Able To Import DWG Files? == <!--T:2-->
The DWG format is a closed source binary file format that is not directly supported by FreeCAD. It requires an external 3rd party file converter to convert DWG files to DXF files, and vice-versa.


===ODA Converter (formerly Teigha Converter)=== <!--T:3-->
==What do I need to be able to import DWG files?== <!--T:2-->

===LibreDWG=== <!--T:31-->

<!--T:32-->
* homepage: https://www.gnu.org/software/libredwg/
* license: [https://savannah.gnu.org/projects/libredwg/ GPLv3-or-later]
* optional, used to enable import and export of DWG files

<!--T:45-->
GNU LibreDWG is a free C library to handle DWG files. It aims to be a free replacement for the Open Design Alliance Drawings SDK libraries. Be aware that, since libreDWG is a work-in-progress, it lacks support for some DWG entities.

==== Installation Windows ==== <!--T:56-->

<!--T:36-->
Downloading and unzip the appropriate [https://github.com/LibreDWG/libredwg/releases pre-compiled Windows binary]. Place the executable in the OS search path, {{Incode|os.getenv("PATH")}}, for automatic detection ({{Version|0.21}}), or set the path manually. See [[Import_Export_Preferences#DWG|Import Export Preferences]].

==== Installation Linux/Unix systems ==== <!--T:57-->

<!--T:46-->
{{Code|lang=shell|code=
git clone --recurse-submodules https://git.savannah.gnu.org/git/libredwg.git
cd libredwg
mkdir build
cd build
cmake ..
make
make install # or use checkinstall, or simply locate & copy the dwg2dxf
# utility to your executables path, it will be then autodetected by FreeCAD
}}

<!--T:58-->
Place the executable in the OS search path, {{Incode|os.getenv("PATH")}}, for automatic detection ({{Version|0.21}}), or set the path manually. See [[Import_Export_Preferences#DWG|Import Export Preferences]].

==== Installation openSUSE ==== <!--T:49-->

<!--T:50-->
To prevent problems you must use LibreDWG package compiled for the installed openSUSE OS distribution.
LibreDWG is typically installed with '''YAST''' (abbr. Yet another Setup Tool), the Linux operating system's setup and configuration tool.

<!--T:51-->
The more experienced user first gets an overview of possible packages provided.
'''Note:''' openSUSE has several options to choose from when downloading LibreDWG.
To view these options, visit [https://software.opensuse.org/search?utf8=%E2%9C%93&baseproject=ALL&q=libredwg Survey of provided LibreDWG packages on openSUSE].

<!--T:52-->
For e.g. Intel or AMD 64-bit desktops, laptops, and servers the (x86_64) release is the one to select. So '''libredwg0''' and '''libredwg-tools''' are of the right choice to install.

<!--T:53-->
It is recommended to grab the binary packages directly. Then select the correct distribution for your installed openSUSE OS.

<!--T:54-->
In any terminal/console (root rights required) the installation will be carried out with:

<!--T:59-->
{{Code|code=
zypper install libredwg0 libredwg-tools
}}

<!--T:60-->
Place the executable in the OS search path, {{Incode|os.getenv("PATH")}}, for automatic detection ({{Version|0.21}}), or set the path manually. See [[Import_Export_Preferences#DWG|Import Export Preferences]].

===ODA File Converter=== <!--T:3-->

<!--T:28-->
* homepage: https://www.opendesign.com/guestfiles/oda_file_converter
* homepage: https://www.opendesign.com/guestfiles/oda_file_converter
* license: freeware
* license: freeware
Line 19: Line 81:


<!--T:4-->
<!--T:4-->
The ODA Converter is a small freely available utility that allows to convert between several versions of DWG and DXF files. FreeCAD can use it to offer DWG import and export, by converting DWG files to the DXF format under the hood,then using its standard DXF importer to import the file contents. The restrictions of the [[Draft_DXF|DXF importer]] apply.
The ODA File Converter is a small freely available utility that allows to convert between several versions of DWG and DXF files. FreeCAD can use it to offer DWG import and export, by converting DWG files to the DXF format under the hood, then using its standard DXF importer to import the file contents. The restrictions of the [[Draft_DXF|DXF importer]] apply.


====Installation==== <!--T:5-->
====Installation==== <!--T:5-->
On all platforms, only by installing the appropriate package from https://www.opendesign.com/guestfiles/oda_file_converter. After installation, if the utility is not found automatically by FreeCAD, you might need to set the path to the converter executable manually. open Edit → Preferences → Import-Export → DWG and fill "Path to Teigha File Converter" appropriately.


<!--T:18-->
<!--T:29-->
If the utility is not found automatically by FreeCAD after installation, you need to set the path to the executable manually. See [[Import_Export_Preferences#DWG|Import Export Preferences]].
For more detailed instruction see [http://www.freecadweb.org/wiki/index.php?title=Dxf_Importer_Install#Third_step: this tutorial].


====Usage==== <!--T:14-->
=== QCAD pro === <!--T:61-->
The program may be used with the command line interface or the graphical interface.
Be sure to convert the DWG files to an ASCII-Format.


<!--T:15-->
<!--T:62-->
{{Version|0.20}}
Command Line Format is:
# Quoted Input Folder
# Quoted Output Folder
# Output_version {"ACAD9","ACAD10","ACAD12", "ACAD13","ACAD14", "ACAD2000","ACAD2004", "ACAD2007","ACAD2010"}
# Output File type {"DWG","DXF","DXB"}
# Recurse Input Folder {"0","1"}
# Audit each file {"0","1"}
# [optional] Input file filter (default:"*.DWG;*.DXF")


<!--T:16-->
<!--T:63-->
* homepage: https://qcad.org/en/qcad-command-line-tools#dwg2dwg
'''Example for Linux'''<br />
* license: commercial
ODAFileConverter "/home/dwg-data" "/home/dxf-data" "ACAD2010" "DXF" "0" "1" "test.dwg"
* optional, used to enable import and export of DWG files
The second number (audit) needs to be 1 otherwise it fails


<!--T:17-->
<!--T:64-->
QCAD is a well-known open-source DXF-based 2D CAD platform. It also offers a paid pro version, which is basically the open-source version plus support for the DWG format. When buying the pro version, QCAD also includes a DWG to DXF conversion utility that can be used by FreeCAD.
'''Example for Windows'''<br />
"C:\Program Files\ODA\Teigha File Converter 3.08.2\TeighaFileConverter.exe" "Path-To-Input-Directory" "Path-To-Output-Directory" "ACAD2010" "DXF" "0" "1" "Name-Of-A-Test-File.dwg"


== What Are The Alternatives? == <!--T:6-->
====Installation==== <!--T:65-->


===DraftSight=== <!--T:7-->
<!--T:66-->
If the utility is not found automatically by FreeCAD after installation ({{Version|0.21}}), you need to set the path to the bash file (Linux and macOS) or batch file (Windows) manually. See [[Import_Export_Preferences#DWG|Import Export Preferences]].
There is a free commercial program called DraftSight (http://www.3ds.com/products-services/draftsight/overview/) that can import most DWG files and can save and export in formats that are friendly to FreeCAD.

Draftsight runs on
=== CADExchanger Workbench === <!--T:42-->
* Windows 32 bit

* Windows 64 bit
<!--T:43-->
* Mac OS X
Installing the CADExchanger Workbench allows for working with DWG files through integration with the paid commercial file converter product [https://cadexchanger.com/ CADExchanger]. Just follow the instructions in the [https://github.com/yorikvanhavre/CADExchanger GitHub repository]. You can discuss this workbench on [https://forum.freecadweb.org/viewtopic.php?f=9&t=22227&p=462421 its forum thread].
* Linux Fedora

* Linux Ubuntu
<!--T:44-->
A free registration is required for activation of the program.
At the moment, the CADExchanger way is the only one that allows to work with 3D DWG files, by converting them to other 3D formats.

==What are the alternatives?== <!--T:6-->


===DoubleCAD XT=== <!--T:13-->
===DoubleCAD XT=== <!--T:13-->
There is also DoubleCAD XT (https://www.turbocad.com/content/doublecad-xt-v5).
The program is free for personal and commercial use.
It requires a free sign-up to receive an activation code via E-Mail.
This Program is windows-only. Note: it does not seem to have been updated for years.


<!--T:37-->
===Export Your AutoCAD files in Friendly Format=== <!--T:8-->
There is also DoubleCAD XT (https://www.turbocad.com/content/doublecad-xt-v5). The program is free for personal and commercial use. It requires a free sign-up to receive an activation code via E-Mail. This Program is windows-only. Note: it does not seem to have been updated for years.

===NanoCAD 5.0=== <!--T:47-->

<!--T:48-->
There is also nanoCAD 5.0 (https://nanocad.com/products/nanoCAD/download/). The program is free for personal and commercial use. It requires a free sign-up to receive an activation code via E-Mail. This Program is windows-only.

===Export your AutoCAD files in friendly format=== <!--T:8-->

<!--T:38-->
Exporting your AutoCAD files in a more FreeCAD friendly format, like DXF R12 or R14, SVG, and if version supports it, IGES. All are better alternatives to the DWG format when using FreeCAD.
Exporting your AutoCAD files in a more FreeCAD friendly format, like DXF R12 or R14, SVG, and if version supports it, IGES. All are better alternatives to the DWG format when using FreeCAD.


<!--T:9-->
<!--T:9-->
It is important to know that, contrarily to popular belief, there is no difference between the contents of a file saved in DWG or DXF formats, provided it is the same version (ex. DWG 2014 vs. DXF 2014). Both formats are maintained by Autodesk, and they both support exactly the same features. The difference is that DWG is closed (machine-encoded) while DXF is open.
It is important to note that there is no difference between the contents of a file saved in DWG or DXF formats, provided it is the same version (ex. DWG 2014 vs. DXF 2014). Both formats are maintained by Autodesk, and they both support exactly the same features. The difference is that DWG is closed (machine-encoded) while DXF is open.


==What Can I Do To Help? == <!--T:10-->
==What can I do to help? == <!--T:10-->


===Promote the use of alternative formats=== <!--T:11-->
===Promote the use of alternative formats=== <!--T:11-->
Simply put, stop accepting work done in DWG format. In practice, this is often easier said than done. Still, it would not be bad practice for users and supporters of FreeCAD to avoid and reject the DWG format whenever possible.


== New Perspectives == <!--T:21-->
<!--T:39-->
Simply put, stop accepting work done in DWG format. In practice, this is often easier said than done. Still, it would not be bad practice for users and supporters of FreeCAD to avoid and reject the DWG format whenever possible.
Following newest annoucements LibreDWG, the free/libre library for opening proprietary CAD files in the DWG file format, is revived.


===Use the LibreDWG library and file bug reports=== <!--T:40-->
<!--T:23-->
* http://libregraphicsworld.org/blog/entry/libredwg-revived-starts-getting-regular-releases
* https://www.gnu.org/software/libredwg/
* https://forum.freecadweb.org/viewtopic.php?f=8&t=39827&start=10


<!--T:24-->
<!--T:41-->
In development version as mentioned above you can switch from the proprietary ODA Converter to the free software LibreDWG library for DWG (and DXF) files. Please do this and report any problems you encounter.
It remains to be seen what way hopefully the development with the necessary support will show.


<!--T:25-->
[[Category:Formats]]


<!--T:22-->
{{Userdocnavi}}
</translate>
</translate>
{{Draft Tools navi{{#translation:}}}}
{{clear}}
{{Userdocnavi{{#translation:}}}}
[[Category:File_Formats{{#translation:}}]]
[[Category:Common Questions{{#translation:}}]]

Latest revision as of 15:58, 28 June 2023


Why is it hard to support DWG Files in FreeCAD?

The DWG format is a closed source binary file format that is not directly supported by FreeCAD. It requires an external 3rd party file converter to convert DWG files to DXF files, and vice-versa.

What do I need to be able to import DWG files?

LibreDWG

GNU LibreDWG is a free C library to handle DWG files. It aims to be a free replacement for the Open Design Alliance Drawings SDK libraries. Be aware that, since libreDWG is a work-in-progress, it lacks support for some DWG entities.

Installation Windows

Downloading and unzip the appropriate pre-compiled Windows binary. Place the executable in the OS search path, os.getenv("PATH"), for automatic detection (introduced in version 0.21), or set the path manually. See Import Export Preferences.

Installation Linux/Unix systems

git clone --recurse-submodules https://git.savannah.gnu.org/git/libredwg.git
cd libredwg
mkdir build
cd build
cmake ..
make
make install # or use checkinstall, or simply locate & copy the dwg2dxf 
             # utility to your executables path, it will be then autodetected by FreeCAD

Place the executable in the OS search path, os.getenv("PATH"), for automatic detection (introduced in version 0.21), or set the path manually. See Import Export Preferences.

Installation openSUSE

To prevent problems you must use LibreDWG package compiled for the installed openSUSE OS distribution. LibreDWG is typically installed with YAST (abbr. Yet another Setup Tool), the Linux operating system's setup and configuration tool.

The more experienced user first gets an overview of possible packages provided. Note: openSUSE has several options to choose from when downloading LibreDWG. To view these options, visit Survey of provided LibreDWG packages on openSUSE.

For e.g. Intel or AMD 64-bit desktops, laptops, and servers the (x86_64) release is the one to select. So libredwg0 and libredwg-tools are of the right choice to install.

It is recommended to grab the binary packages directly. Then select the correct distribution for your installed openSUSE OS.

In any terminal/console (root rights required) the installation will be carried out with:

zypper install libredwg0 libredwg-tools

Place the executable in the OS search path, os.getenv("PATH"), for automatic detection (introduced in version 0.21), or set the path manually. See Import Export Preferences.

ODA File Converter

The ODA File Converter is a small freely available utility that allows to convert between several versions of DWG and DXF files. FreeCAD can use it to offer DWG import and export, by converting DWG files to the DXF format under the hood, then using its standard DXF importer to import the file contents. The restrictions of the DXF importer apply.

Installation

If the utility is not found automatically by FreeCAD after installation, you need to set the path to the executable manually. See Import Export Preferences.

QCAD pro

introduced in version 0.20

QCAD is a well-known open-source DXF-based 2D CAD platform. It also offers a paid pro version, which is basically the open-source version plus support for the DWG format. When buying the pro version, QCAD also includes a DWG to DXF conversion utility that can be used by FreeCAD.

Installation

If the utility is not found automatically by FreeCAD after installation (introduced in version 0.21), you need to set the path to the bash file (Linux and macOS) or batch file (Windows) manually. See Import Export Preferences.

CADExchanger Workbench

Installing the CADExchanger Workbench allows for working with DWG files through integration with the paid commercial file converter product CADExchanger. Just follow the instructions in the GitHub repository. You can discuss this workbench on its forum thread.

At the moment, the CADExchanger way is the only one that allows to work with 3D DWG files, by converting them to other 3D formats.

What are the alternatives?

DoubleCAD XT

There is also DoubleCAD XT (https://www.turbocad.com/content/doublecad-xt-v5). The program is free for personal and commercial use. It requires a free sign-up to receive an activation code via E-Mail. This Program is windows-only. Note: it does not seem to have been updated for years.

NanoCAD 5.0

There is also nanoCAD 5.0 (https://nanocad.com/products/nanoCAD/download/). The program is free for personal and commercial use. It requires a free sign-up to receive an activation code via E-Mail. This Program is windows-only.

Export your AutoCAD files in friendly format

Exporting your AutoCAD files in a more FreeCAD friendly format, like DXF R12 or R14, SVG, and if version supports it, IGES. All are better alternatives to the DWG format when using FreeCAD.

It is important to note that there is no difference between the contents of a file saved in DWG or DXF formats, provided it is the same version (ex. DWG 2014 vs. DXF 2014). Both formats are maintained by Autodesk, and they both support exactly the same features. The difference is that DWG is closed (machine-encoded) while DXF is open.

What can I do to help?

Promote the use of alternative formats

Simply put, stop accepting work done in DWG format. In practice, this is often easier said than done. Still, it would not be bad practice for users and supporters of FreeCAD to avoid and reject the DWG format whenever possible.

Use the LibreDWG library and file bug reports

In development version as mentioned above you can switch from the proprietary ODA Converter to the free software LibreDWG library for DWG (and DXF) files. Please do this and report any problems you encounter.