reclosedev / pyautocad

AutoCAD Automation for Python ⛺
http://pypi.python.org/pypi/pyautocad/
BSD 2-Clause "Simplified" License
506 stars 143 forks source link

How to read existing dwg file using autocad?? #40

Open skyblue0807 opened 2 years ago

skyblue0807 commented 2 years ago

I studied your tutorial materials. But most of them are drawing pictures into new file.

How could I open/load/read existing dwg file??

Derie1 commented 2 years ago

Try this:

import pyacadcom

acad = pyacadcom.AutoCAD()
acad_doc = acad.Documents.Open("path_to_your_file")
#optional
acad.Visible = True
ms = acad_doc.ModelSpace