Acad SelectionSets Collection

The AcadSelectionSets collection contains all the selection sets in the drawing. To add a new member to the collection, use the Add method. To select a specific selection set, use the Item method. To delete a specific selection set, use the Delete method of the AcadSelectionSet object. AutoCAD allows you up to 128 selection sets objects. However, there can be only one instance of the AcadSelectionSets collection, which is predefined for each drawing. You can make multiple references to it by...

The Translate Coordinates Method

Use the TranslateCoordinates method to translate a point from one coordinate system to another. This is often necessary when the user is working in a construction plane, for example. Most AutoCAD input and object-creation methods work exclusively in WCS, so you need to translate user input to correctly work in the construction plane. This method returns an array of doubles. It has the following syntax dblAngle UtilityObject.AngleFromXAxis Point, From, To, Displacement , Norm Table 7-17 explains...

Using the Insert Block Method

Use the InsertBlock method to add a BlockReference object to a drawing or to nest a block in another Block object. This can be either a block in the Blocks collection or an external drawing file. In either case, this method returns a BlockReference object. The PaperSpace, ModelSpace, and Block objects expose this method. Set BlockReferenceObject Object.InsertBlock InsertionPoint, BlockName, _ Xscale, Yscale, ZScale, RotationAngle Table 13-4 explains this method's parameters. Table 13-4. The...

AcadLWPolyline Object Methods

The AcadLWPolyline object inherits all the methods of the AcadEntity and AcadObject objects. It also supports the following methods. Adds a vertex to the lightweight polyline, a vertex being the end point for a new line segment. See the SetBulge method for creating an arc. Each vertex is added to a three-element array of Doubles. Parameters Index As Integer and Vertex As Variant. Index refers to the position in the array where the new vertex is added. Vertex refers to the 3-D OCS coordinates...

Controlling Plot Parameters

Vba Userforms Collection

A number of parameters are normally set using the Plot dialog box shown in Figure 15-4. AutoCAD provides a means to control these settings programmatically. In this section I cover the options that are most commonly modified. All the methods and properties for controlling the plot parameters are available to both the PlotConfiguration and Layout objects. Consequently, when I present the syntax in the following sections, I use the word object to denote either object. You can read or set the...

Using the Get Attributes Method

Use the GetAttributes method of a BlockReference or MInsertBlock object to retrieve any associated AttributeReference objects. It returns an array, varAttributeRefs, that contains all the nonconstant attributes. This method has the following syntax varAttributeRefs Object.GetAttributes The following example uses the Debug window to display information about each AttributeRef object associated with a block reference. Try it on an attributed block, such as the one created in the previous example....

Acad BlockReference Object Methods

The AcadBlockReference object inherits all the methods of the AcadEntity and AcadObject objects. It also supports the following methods. Explodes the block and returns the subentities as an array of Objects Returns an array of editable attribute references attached to the block reference, only if the HasAttributes property is set to True Returns an array of constant attributes for the block

Connectivity Automation Objects

The dbConnect feature added in AutoCAD 2000 provides a powerful means for linking drawing entities to external data sources such as Excel spreadsheets, Access databases, and other ODBC data sources. It also provides a means for automatically labeling entities using Leader callouts with special control over the text labeling that is driven directly by linked values in the external data source. This functionality is provided through a special API called Connectivity Automation Objects, or CAO....

Connecting to a Microsoft Access Database

Most AutoCAD developers use Microsoft Access to create the database structure file, and then they use the Microsoft ActiveX Data Objects (ADO) library through VBA to access the .mdb file created by Access. You can use the same approach (and quite often the same code) to work with other data sources, such as Microsoft SQL Server, Oracle, DB2, and even Microsoft Exchange. This section details the steps necessary to connect to and access the data contained in a database file in a Microsoft Access...