PyAcad 0.4.1

Object Types Defined by the ADS Module

The Result Buffer Object

The Python representation of an Autolisp cons cell. Actually, this object is closer to strictly representing an ADS resbuf struct than a cons cell, because the type of the car is limited to ints and the type of the cdr is restricted to matching the type suggested by the value of the car. However, acad_cons objects should still get converted to cons cells when being passed to Autolisp.

Unfortunately, there is no easy way to represent an association list as known from Autolisp in Python. While the first guess would be a dictionary, there are some differences that make this a bad choice. An association list can have multiple entries of the same key and sequence matters. A Python dictionary has unique keys, and sequence is arbitrary.

To work around this, the ADS module defines a new object type, that is used to emulate a lisp cons cell. The emulation is not formally correct, since we don't build lists by linking cons cells, but we just have a normal Python list pretend it was an association list, as long as it only contains cons cells. This doesn't really work to exchange general association lists between Autolisp and Python, but is rather designed for building arguments to ADS functions, where the Autolisp counterpart would use an association list.

The Entity Name Object

The Python representation of an Autocad/Intellicad entity name.

Note that entity names are only valid for the current drawing editor session, so that it usually doesn't make sense to store (pickle etc.) acad_ename objects to disk.

The Selection Set Object

The Python representation of an Autocad/Intellicad selection set.

Note that selection sets are only valid for the current drawing editor session, so that it usually doesn't make sense to store (pickle etc.) acad_sset objects to disk. Even more importantly, the ADS module can't allocate more than 128 selection sets at any given time. This makes it important not to store them for longer than they are really needed. Each selection set will be deallocated automatically with Autocad/Intellicad when the acad_sset object has reached a reference count of 0.

The System Table Objects

The Python representation of an Autocad/Intellicad system table.

The systable attribute of the ads module is a dictionary, which holds a number of acad_systable objects. Each of those objects represents one of the system tables of the current drawing database. Each of those objects is unique and can only exist once in a drawing session.