Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

AutoCAD Automation for Python

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 docs
Octocat-spinner-32 examples
Octocat-spinner-32 pyautocad
Octocat-spinner-32 tests
Octocat-spinner-32 .gitignore
Octocat-spinner-32 HISTORY.txt
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 MANIFEST.in
Octocat-spinner-32 README.rst
Octocat-spinner-32 cx_setup.py
Octocat-spinner-32 hello_world.py
Octocat-spinner-32 setup.py
README.rst

pyautoacad - AutoCAD Automation for Python

This library aimed to simplify writing ActiveX Automation scripts for AutoCAD with Python

Requires:

Optional:

Feautures:

  • Simplifies work with coordinates (3D points)
  • Efficient objects iteration and searching (with casting to correct type)
  • Excel/csv/json import and export (xlrd and tablib required)

Simple usage example:

from pyautocad import Autocad, APoint


acad = Autocad()
acad.prompt("Hello, Autocad from Python\n")
print acad.doc.Name

p1 = APoint(0, 0)
p2 = APoint(50, 25)
for i in range(5):
    text = acad.model.AddText('Hi %s!' % i, p1, 2.5)
    acad.model.AddLine(p1, p2)
    acad.model.AddCircle(p1, 10)
    p1.y += 10

dp = APoint(10, 0)
for text in acad.iter_objects('Text'):
    print('text: %s at: %s' % (text.TextString, text.InsertionPoint))
    text.InsertionPoint = APoint(text.InsertionPoint) + dp

for obj in acad.iter_objects(['Circle', 'Line']):
    print(obj.ObjectName)

See more examples in source distribution.

Links

Something went wrong with that request. Please try again.