P. 1
81959924 AutoCAD VBA Programming Tools and Techniques

81959924 AutoCAD VBA Programming Tools and Techniques

|Views: 280|Likes:
Published by xuanhuynh

More info:

Published by: xuanhuynh on Nov 02, 2012
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





Page 50

drawings. The tree trunk is the AutoCAD application object, which defines a single instance of the AutoCAD drawing
system in the computer. There are properties in this object, including the location of the window on the screen and other
items of importance to the running of the program. If you are working with more than one instance of AutoCAD at a
time in the computer, the application object can be used to help identify which one you are running inside.

AutoCAD works with one active drawing at a time. In VBA programming terms, that is the active document property of
the application object. The document object contains numerous properties and methods that relate to the drawing. If you
want to perform activities that occur across the entire drawing, such as purging unused blocks and layers, the document
object is the area where such functionality can be located.

Figure 3.2 shows a general view of the AutoCAD object tree. A complete diagram is available online while running
VBA inside AutoCAD via the help mechanism. The Object Model display in the help file for ActiveX automation
contains hyper links to detailed descriptions of the contents of the various objects found in an AutoCAD drawing.
Figure 3.2 shows a highly simplified version of this diagram, but it is helpful in showing the hierarchy of the AutoCAD
object system.

The AutoCAD application object is where it all starts. The next level up the tree trunk is the document object collection,
then onto the current or active document. The active document contains all the objects that make up the drawing,
including the tables (collections) and entity definitions. There is a direct connection between the document object and
the Paper Space and Model Space objects. This direct link bypasses the block table, allowing faster access into the
Model and Paper Space objects. That linkage exists to save time when accessing these two entity collections since they
contain the majority of the drawing detail information. The block collection contains the references to the entity groups
where the individual entities can be discovered for a given block.

This structure may appear complicated, but it is very simple to navigate. The next pages introduce each of the major
levels involved in

< previous page


next page >

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->