Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I open a DWG file extension with Python?

Tags:

python

dwg

I have a file with extension .dwg (AutoCAD), and I want to call that file from a Python console and present it on the web. Is there a module for the .dwg extension or some other solution?

like image 368
Ballon Avatar asked Apr 14 '10 11:04

Ballon


People also ask

What applications can open a DWG file?

You can open DWG files with many CAD programs and viewers. For example, you can open a DWG file with Autodesk AutoCAD (cross-platform), CorelCAD (Windows, Mac), Dassault Systemes SolidWorks eDrawings Viewer (Windows, Mac), and Adobe Illustrator (Windows, Mac).

Does FreeCAD open DWG files?

In FreeCAD, DWG files can be imported, making this popular CAD program much more useful.


1 Answers

GNU LibreDWG (GitHub mirror) is the canonical answer in late 2021. Hilariously forked from the now defunct LibDWG project documented in ...wait for it Esperanto, LibreDWG:

  • Optionally installs Python 3 bindings (enabled by default).
  • Optionally installs DWG→DXF converters (enabled by default).
  • Is unsurprisingly licensed under the GPL 3.0 (fine for web backends; less fine everywhere else).
  • Supports almost the entirety of R2010+.

Seriously, it's hot. LibreDWG is the only sane choice that still matters. Let's embrace sanity, everybody.

like image 161
Cecil Curry Avatar answered Sep 19 '22 17:09

Cecil Curry