Abdulla Salimov
Abdulla Salimov

Reputation: 149

Is it possible to convert dwg to pdf using Python

Is it possible to convert Dwg to pdf file using Python?

I have multiple Dwg files that need to convert to pdf.

I am experimenting to create an app to convert but can not find any solution?

Please, if you have any idea help.

Upvotes: 4

Views: 8205

Answers (3)

Muneeb Ahmad Khurram
Muneeb Ahmad Khurram

Reputation: 680

Using QCAD Command Line Tools (Open Source)

According to qcad.org "QCAD is a free, open source application for computer aided drafting (CAD) in two dimensions (2D). With QCAD you can create technical drawings such as plans for buildings, interiors, mechanical parts or schematics and diagrams. QCAD works on Windows, macOS and Linux. The source code of QCAD is released under the GPL version 3 (GPLv3), a popular Open Source license."

Supported Command Line Conversions

  • dwginfo
  • dwg2csv
  • dwg2bmp
  • dwg2svg
  • dwg2pdf
  • dwgmapconvert
  • dwg2maptiles
  • dwg2dwg / pdf2dwg
  • dwghatch
  • dwghatcharea
  • dwgexplode
  • merge
  • bbox
  • dwgnest (QCAD/CAM)

The above commands are very self-explanatory for further information please refer to the above embedded url at qcad.org

Usage in Python

Though I believe that this might not be best practice but a os.system command as follows, might be enough for most use cases

Upvotes: 0

Frank Sandqvist
Frank Sandqvist

Reputation: 167

Vector Express is a free API you may able to use. (requires a network connection, though)

https://github.com/smidyo/vectorexpress-api

Upvotes: 1

utahouck
utahouck

Reputation: 71

Of course it is possible to write a code in Python to publish DWG file as PDF. However, DWG is a proprietary file format from AutoCAD, therefore there are a lot of legal issues to distribute the code (beyond your private usage), unless you get a written consent from AutoCAD...

You'll find several application that would already do the job. Maybe check Open Design Alliance as a starting point.

Upvotes: 0

Related Questions