Object Model
Autodesk AutoCAD 2015 : ActiveX Reference Guide >

Object Model

Topics in this section

  • Object Model
  • Preferences Object Model
Please send us your comment about this page


Object Model (ActiveX)

Click on a class in the image to open its associated topic.


Object Model (ActiveX)
Object Model
Objects
Autodesk AutoCAD 2015 : ActiveX Reference Guide > Object Model >

Preferences Object Model (ActiveX)

Please send us your comment about this page


Objects

Topics in this section

  • All Drawing Objects

    These objects inherit from the IAcadEntity interface.

  • _DAcadApplicationEvents Interface

    The event interface for the AutoCAD application.

  • _DAcadDocumentEvents Interface

    The event interface for the AutoCAD document.

  • 3DFace

    A 3D triangle or quadrilateral plane section.

  • 3DPolyline

    A 3D polyline of straight line segments.

  • 3DSolid

    A solid object with free-form surface support.

  • AcadState

    A special object to use in monitoring the state of AutoCAD from out-of-process applications.

  • AcCmColor

    AutoCAD true color object.

  • Application

    An instance of the AutoCAD application.

  • Arc

    A circular arc.

  • Attribute

    An object appearing as a text string that describes the characteristics of an attribute reference.

  • AttributeReference

    An object containing text that links to a block.

  • Block

    A block definition containing a name and a set of objects.

  • BlockReference

    An instance of a block definition inserted into a drawing.

  • Blocks Collection

    The collection of all blocks in the drawing.

  • Circle

    A full circle.

  • Database

    The contents of an XRef block.

  • DatabasePreferences

    An object that specifies the settings for the current AutoCAD drawing.

  • DgnUnderlay

    A source of DGN underlay content.

  • Dictionaries Collection

    The collection of all dictionaries in the drawing.

  • Dictionary

    A container object for storing and retrieving objects.

  • Dim3PointAngular

    A dimension measuring the angular distance between three points.

  • DimAligned

    A linear dimension, measuring the distance between two points, that is displayed parallel to the points being measured.

  • DimAngular

    A dimension measuring the angular distance between two lines or between the angle of a circular arc.

  • DimArcLength

    A dimension measuring the length of an arc.

  • DimDiametric

    A dimension measuring the diameter of a circle or arc.

  • DimOrdinate

    A dimension measuring the absolute X or Y position of a point from the origin.

  • DimRadial

    A dimension measuring the radius of a circle or arc.

  • DimRadialLarge

    A dimension measuring a large radius, also known as a jogged radius dimension.

  • DimRotated

    A dimension that measures the distance between two points and is displayed at a given rotation.

  • DimStyle

    A group of dimension settings that determines the appearance of a dimension.

  • DimStyles Collection

    The collection of all dimension styles in the drawing.

  • Document

    An AutoCAD drawing.

  • Documents Collection

    The collection of all AutoCAD drawings that are open in the current session.

  • DwfUnderlay

    A source of DWF/DWFx underlay content.

  • DynamicBlockReferenceProperty

    An object containing the properties of a dynamic block.

  • Ellipse

    An elliptical arc or full ellipse.

  • ExternalReference

    An instance of an external reference inserted into a drawing.

  • ExtrudedSurface

    A surface created by extruding an object or a planar face a specified distance and direction.

  • FileDependencies Collection

    Creates, updates, retrieves, and removes items in the File Dependency List.

  • FileDependency

    Provides information about entries in the File Dependency List of a drawing file.

  • GeomapImage

    An embedded raster image which is captured from a portion of LiveMap.

  • GeoPositionMarker

    A geographical location aware marker object with a label.

  • Group

    A named SelectionSet object.

  • Groups Collection

    The collection of all groups in the drawing.

  • Hatch

    An area fill consisting of a pattern of lines.

  • Helix

    A helix.

  • Hyperlink

    A URL and URL description.

  • Hyperlinks Collection

    The collection of all hyperlinks for a given object.

  • IAcadDatabase Interface

    The contents of the database associated with the Document object.

  • IAcadDimension Interface

    The common interface for AutoCAD dimensions.

  • IAcadEntity Interface

    The standard interface for a basic AutoCAD entity.

  • IAcadMLeaderLeader Interface

    AutoCAD Multileader Leader Line Interface.

  • IAcadObject Interface

    The standard interface for a basic AutoCAD object.

  • IAcadObjectEvents Interface

    The event interface for a basic AutoCAD object.

  • IDPair

    A special object for use with the CopyObjects method that contains the object IDs of both the source and destination objects.

  • Layer

    A logical grouping of data, similar to transparent acetate overlays on a drawing.

  • Layers Collection

    The collection of all layers in the drawing.

  • LayerStateManager

    Saves and restores layer settings.

  • Layout

    The plot settings and visual properties of a model space or paper space block.

  • Layouts Collection

    The collection of all layouts in the drawing.

  • Leader

    An object composed of an arrowhead attached to splines or straight line segments.

  • LWPolyline

    A 2D line with adjustable width composed of line and arc segments.

  • Line

    A single line segment.

  • Linetype

    The line characteristics consisting of combinations of dashes, dots, and spaces.

  • Linetypes Collection

    The collection of all linetypes in the drawing.

  • LoftedSurface

    A surface created by lofting through a set of two or more curves.

  • Material

    The render material characteristics.

  • Materials Collection

    The collection of all materials in the drawing.

  • MenuBar Collection

    A collection of PopupMenu objects representing the current AutoCAD menu bar.

  • MenuGroup

    An AutoCAD menu group.

  • MenuGroups Collection

    A collection of MenuGroup objects representing all the menu groups loaded in the current AutoCAD session.

  • MInsertBlock

    A rectangular array of block references.

  • MLeader

    An object composed of an arrowhead attached to multiple splines or straight line segments.

  • MLeaderStyle

    Adds, modifies, and deletes MLeader styles.

  • MLine

    Multiple parallel lines.

  • ModelSpace Collection

    A special Block object containing all model space entities.

  • MText

    A paragraph of alphanumeric characters that fits within a nonprinting text boundary.

  • NurbSurface

    A surface created when NURBS creation is enabled while creating procedural or complex 3D surfaces, or by converting existing surfaces.

  • OLE

    An AutoCAD OLE object.

  • PaperSpace Collection

    A special Block object containing all the entities in the active paper space layout.

  • PdfUnderlay

    A source of PDF underlay content.

  • PlaneSurface

    A planar surface.

  • Plot

    The set of methods and properties used for plotting layouts.

  • PlotConfiguration

    A named collection of plot settings.

  • PlotConfigurations Collection

    A collection of named plot settings.

  • Point

    A point marker appearing as a dot, square, circle, X, tick, or plus sign (+); or as a combination of these.

  • PointCloud

    A source of point cloud content.

  • PointCloudEx

    A point cloud extension entity.

  • PolyfaceMesh

    A three-dimensional polyface mesh.

  • PolygonMesh

    A free-form 3D mesh.

  • Polyline

    A 2D line of adjustable width or a 3D line or mesh of non-adjustable width composed of line and arc segments.

  • PopupMenu

    An AutoCAD cascading menu.

  • PopupMenuItem

    A single menu item on an AutoCAD pull-down menu.

  • PopupMenus Collection

    A collection of PopupMenu objects representing all the popup menus loaded in the MenuGroup.

  • Preferences

    This object specifies the current AutoCAD settings.

  • PreferencesDisplay

    This object contains the options from the Display tab on the Options dialog box.

  • PreferencesDrafting

    This object contains the options from the Drafting tab on the Options dialog box.

  • PreferencesFiles

    This object contains the options from the Files tab on the Options dialog box.

  • PreferencesOpenSave

    This object contains options from the Open and Save tab on the Options dialog box.

  • PreferencesOutput

    This object contains the options from the Output tab on the Options dialog box.

  • PreferencesProfiles

    This object contains the options from the Profiles tab on the Options dialog box.

  • PreferencesSelection

    This object contains the options from the Selection tab on the Options dialog box.

  • PreferencesSystem

    This object contains the options from the System tab on the Options dialog box.

  • PreferencesUser

    This object contains the options from the User tab on the Options dialog box.

  • PViewport

    Rectangular objects created in paper space that display views.

  • RasterImage

    A raster image consisting of a rectangular grid (or raster) of small squares or dots known as pixels.

  • Ray

    A semi-infinite line.

  • Region

    A bounded planar face consisting of lines, circles, arcs, elliptical arcs, and spline curves.

  • RegisteredApplication

    An external application that has been added to the drawing.

  • RegisteredApplications Collection

    The collection of all registered applications in the drawing.

  • RevolvedSurface

    A surface created by revolving one or more 2D objects about an axis.

  • Section

    A section plane entity created at the intersection of a plane and a solid.

  • SectionManager

    This object manages the collection of section planes in the DWG database.

  • SectionSettings

    A container for section geometry settings.

  • SectionTypeSettings

    The settings that apply to the various types of sections.

  • SecurityParams

    Supplies information necessary for performing security operations on drawing files.

  • SelectionSet

    A group of one or more AutoCAD objects specified for processing as a single unit.

  • SelectionSets Collection

    The collection of all selection sets in the drawing.

  • ShadowDisplay Interface

    Interface for AutoCAD entities with shadows.

  • Shape

    An object comprising lines, arcs, and circles defined in an SHX file.

  • Solid

    A solid-filled polygon.

  • SortentsTable

    Contains and manipulates draw order information.

  • Spline

    A quadratic or cubic NURBS (nonuniform rational B-spline) curve.

  • SubDMesh

    For internal use only.

  • SubDMeshEdge

    For internal use only.

  • SubDMeshFace

    For internal use only.

  • SubDMeshVertex

    For internal use only.

  • SubEntity

    For internal use only.

  • SubEntSolidEdge

    For internal use only.

  • SubEntSolidFace

    For internal use only.

  • SubEntSolidNode

    For internal use only.

  • SubEntSolidVertex

    For internal use only.

  • SummaryInfo

    Accesses drawing properties such as the Title, Subject, Author, and Keywords properties.

  • Surface

    A surface entity.

  • SweptSurface

    A surface created by sweeping a 2D curve along a path.

  • Table

    AutoCAD table object.

  • TableStyle

    Adds, modifies, and deletes table styles.

  • Text

    A single line of alphanumeric characters.

  • TextStyle

    A named, saved collection of settings that determines the appearance of text characters.

  • TextStyles Collection

    The collection of all text styles in the drawing.

  • Tolerance

    A geometric tolerance contained in a feature control frame.

  • Toolbar

    An AutoCAD toolbar.

  • ToolbarItem

    A single button item on an AutoCAD toolbar.

  • Toolbars Collection

    A collection of Toolbar objects representing all the toolbars loaded in the current AutoCAD session.

  • Trace

    A 2D solid line of specified width.

  • UCS

    A user-defined coordinate system that determines the orientation of the X, Y, and Z axes in 3D space.

  • UCSs Collection

    The collection of all user coordinate systems (UCSs) in the drawing.

  • Utility

    A series of methods provided for utility purposes.

  • View

    A graphical representation of a 2D drawing or 3D model from a specific location (viewpoint) in space.

  • Viewport

    A bounded area that displays some portion of a drawing's model space.

  • Viewports Collection

    The collection of all viewports in the drawing.

  • Views Collection

    The collection of all views in the drawing.

  • Wipeout

    Masking object that hides the objects below it in the current draw order.

  • XLine

    A construction line that is infinite in both directions.

  • XRecord

    XRecord objects are used to store and manage arbitrary data.


Objects
Objects
_DAcadApplicationEvents Interface (ActiveX)
Autodesk AutoCAD 2015 : ActiveX Reference Guide > Objects >

All Drawing Objects (ActiveX)

These objects inherit from the IAcadEntity interface.

Objects

  • 3DFace

    A 3D triangle or quadrilateral plane section.

  • 3DPolyline

    A 3D polyline of straight line segments.

  • 3DSolid

    A solid object with free-form surface support.

  • Arc

    A circular arc.

  • Attribute

    An object appearing as a text string that describes the characteristics of an attribute reference.

  • BlockReference

    An instance of a block definition inserted into a drawing.

  • Circle

    A full circle.

  • DgnUnderlay

    A source of DGN underlay content.

  • Dim3PointAngular

    A dimension measuring the angular distance between three points.

  • DimAligned

    A linear dimension, measuring the distance between two points, that is displayed parallel to the points being measured.

  • DimAngular

    A dimension measuring the angular distance between two lines or between the angle of a circular arc.

  • DimArcLength

    A dimension measuring the length of an arc.

  • DimDiametric

    A dimension measuring the diameter of a circle or arc.

  • DimOrdinate

    A dimension measuring the absolute X or Y position of a point from the origin.

  • DimRadial

    A dimension measuring the radius of a circle or arc.

  • DimRadialLarge

    A dimension measuring a large radius, also known as a jogged radius dimension.

  • DimRotated

    A dimension that measures the distance between two points and is displayed at a given rotation.

  • DwfUnderlay

    A source of DWF/DWFx underlay content.

  • Ellipse

    An elliptical arc or full ellipse.

  • ExternalReference

    An instance of an external reference inserted into a drawing.

  • ExtrudedSurface

    A surface created by extruding an object or a planar face a specified distance and direction.

  • GeomapImage

    An embedded raster image which is captured from a portion of LiveMap.

  • GeoPositionMarker

    A geographical location aware marker object with a label.

  • Hatch

    An area fill consisting of a pattern of lines.

  • Helix

    A helix.

  • Leader

    An object composed of an arrowhead attached to splines or straight line segments.

  • LightweightPolyline

    A 2D line with adjustable width composed of line and arc segments.

  • Line

    A single line segment.

  • LoftedSurface

    A surface created by lofting through a set of two or more curves.

  • MInsertBlock

    A rectangular array of block references.

  • MLeader

    An object composed of an arrowhead attached to multiple splines or straight line segments.

  • MLine

    Multiple parallel lines.

  • MText

    A paragraph of alphanumeric characters that fits within a nonprinting text boundary.

  • NurbSurface

    A surface created when NURBS creation is enabled while creating procedural or complex 3D surfaces, or by converting existing surfaces.

  • OLE

    An AutoCAD OLE object.

  • PdfUnderlay

    A source of PDF underlay content.

  • PlaneSurface

    A planar surface.

  • Point

    A point marker appearing as a dot, square, circle, X, tick, or plus sign (+); or as a combination of these.

  • PointCloud

    A source of point cloud content.

  • PointCloudEx

    A point cloud extension entity.

  • PolyfaceMesh

    A three-dimensional polyface mesh.

  • PolygonMesh

    A free-form 3D mesh.

  • Polyline

    A 2D line of adjustable width or a 3D line or mesh of non-adjustable width composed of line and arc segments.

  • PViewport

    Rectangular objects created in paper space that display views.

  • RasterImage

    A raster image consisting of a rectangular grid (or raster) of small squares or dots known as pixels.

  • Ray

    A semi-infinite line.

  • Region

    A bounded planar face consisting of lines, circles, arcs, elliptical arcs, and spline curves.

  • RevolvedSurface

    A surface created by revolving one or more 2D objects about an axis.

  • Section

    A section plane entity created at the intersection of a plane and a solid.

  • Shape

    An object comprising lines, arcs, and circles defined in an SHX file.

  • Solid

    A solid-filled polygon.

  • Spline

    A quadratic or cubic NURBS (nonuniform rational B-spline) curve.

  • SubDMesh

    For internal use only.

  • Surface

    A surface entity.

  • SweptSurface

    A surface created by sweeping a 2D curve along a path.

  • Table

    AutoCAD table object.

  • Text

    A single line of alphanumeric characters.

  • Tolerance

    A geometric tolerance contained in a feature control frame.

  • Trace

    A 2D solid line of specified width.

  • Wipeout

    Masking object that hides the objects below it in the current draw order.

  • XLine

    A construction line that is infinite in both directions.


_DAcadApplicationEvents Interface (ActiveX)

The event interface for the AutoCAD application.

Supported Platforms: Windows only

Class Information

Class Name

_DAcadApplicationEvents

Object Inheritance
Object
   _DAcadApplicationEvents
Create Using

VBA

Not applicable
Access Via

VBA

Not applicable

Members

These members are part of this object:

Methods | Properties | Events
None | None | AppActivate AppDeactivate ARXLoaded ARXUnloaded BeginCommand BeginFileDrop BeginLisp BeginModal BeginOpen BeginPlot BeginQuit BeginSave EndCommand EndLisp EndModal EndOpen EndPlot EndSave LispCancelled NewDrawing SysVarChanged WindowChanged WindowMovedOrResized

Remarks

IAcadObject interface represents the event interface for the AutoCAD application.


_DAcadDocumentEvents Interface (ActiveX)

The event interface for the AutoCAD document.

Supported Platforms: Windows only

Class Information

Class Name

_DAcadDocumentEvents

Object Inheritance
Object
   _DAcadDocumentEvents
Create Using

VBA

Not applicable
Access Via

VBA

Not applicable

Members

These members are part of this object:

Methods | Properties | Events
None | None | Activate BeginClose BeginCommand BeginDocClose BeginDoubleClick BeginLisp BeginPlot BeginRightClick BeginSave BeginShortcutMenuCommand BeginShortcutMenuDefault BeginShortcutMenuEdit BeginShortcutMenuGrip BeginShortcutMenuOsnap Deactivate EndCommand EndLisp EndPlot EndSave EndShortcutMenu LayoutSwitched LispCancelled ObjectAdded ObjectErased ObjectModified SelectionChanged WindowChanged WindowMovedOrResized

Remarks

IAcadObject interface represents the event interface for the AutoCAD document.


3DFace Object (ActiveX)

A 3D triangle or quadrilateral plane section.

Supported Platforms: Windows only

Class Information

Class Name

Acad3DFace

Object Inheritance
Object
   AcadObject AcadEntity
         Acad3DFace
Create Using

VBA

ModelSpace.Add3DFace
PaperSpace.Add3DFace
Block.Add3DFace
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetInvisibleEdge GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetInvisibleEdge SetXData TransformBy Update | Application Coordinate Coordinates Document EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Linetype LinetypeScale Lineweight Material ObjectID ObjectName OwnerID PlotStyleName TrueColor VisibilityEdge1 VisibilityEdge2 VisibilityEdge3 VisibilityEdge4 Visible | Modified

Remarks

You can specify different Z coordinates for each corner point of a 3DFace object. This differs from a Solid object, which creates a three- or four-sided surface that is parallel to the current UCS and can be extruded.

Six 3DFaces joined together to make a cube

You control which edges of the face are visible through the SetInvisibleEdge method. This allows accurate modeling of objects with holes.

To create a 3DFace, use the Add3DFace method.


3DPolyline Object (ActiveX)

A 3D polyline of straight line segments.

Supported Platforms: Windows only

Class Information

Class Name

Acad3DPolyline

Object Inheritance
Object
   AcadObject AcadEntity
         Acad3DPolyline
Create Using

VBA

ModelSpace.Add3DPoly
PaperSpace.Add3DPoly
Block.Add3DPoly
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
AppendVertex ArrayPolar ArrayRectangular Copy Delete Explode GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Closed Coordinate Coordinates Document EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Length Linetype LinetypeScale Lineweight Material ObjectID ObjectName OwnerID PlotStyleName TrueColor Type Visible | Modified

Remarks

To open or close a polyline, use the Closed property.

An open 3D polyline

To create a 3D polyline, use the Add3DPoly method.


3DSolid Object (ActiveX)

A solid object with free-form surface support.

Supported Platforms: Windows only

Class Information

Class Name

Acad3DSolid

Object Inheritance
Object
   AcadObject AcadEntity
         Acad3DSolid
Create Using

VBA

ModelSpace, PaperSpace, and Block objects use:
AddBox, AddCone, AddCylinder, AddEllipticalCone, AddEllipticalCylinder,
AddExtrudedSolid, AddExtrudedSolidAlongPath, AddRevolvedSolid,
AddSphere, AddTorus, or AddWedge
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Boolean CheckInterference Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate ScaleEntity SectionSolid SetXData SliceSolid TransformBy Update | Application Centroid Document EntityTransparency Handle HasExtensionDictionary History Hyperlinks Layer Linetype LinetypeScale Lineweight Material MomentOfInertia ObjectID ObjectName OwnerID PlotStyleName Position PrincipalDirections PrincipalMoments ProductOfInertia RadiiOfGyration ShowHistory SolidType TrueColor Visible Volume | Modified

Remarks

You can make 3D objects by creating basic 3D shapes: boxes, cones, cylinders, spheres, wedges, and toriis (donuts). You can then combine these shapes to create more complex solids by joining or subtracting them or finding their intersecting (overlapping) volume. You can also create solids by sweeping a 2D object along a path or revolving it about an axis.

To create a 3DSolid, use one of the following methods: AddBox , AddCone , AddCylinder , AddEllipticalCone , AddEllipticalCylinder , AddExtrudedSolid , AddExtrudedSolidAlongPath , AddRevolvedSolid , AddSphere , AddTorus , AddWedge .


AcadState Object (ActiveX)

A special object to use in monitoring the state of AutoCAD from out-of-process applications.

Supported Platforms: Windows only

Class Information

Class Name

AcadState

Object Inheritance
Object
   AcadState
Create Using

VBA

User-defined variable, returned via the GetAcadState method
Access Via

VBA

User-defined variable

Members

These members are part of this object:

Methods | Properties | Events
None | Application IsQuiescent | None

Remarks

The AcadState object is a transient object that is returned from the GetAcadState method. This object is used to check for AutoCAD quiescence from out-of-process applications.


AcCmColor Object (ActiveX)

AutoCAD true color object.

Supported Platforms: Windows only

Class Information

Class Name

AcadAcCmColor

Object Inheritance
Object
   AcadAcCmColor
Create Using

VBA

GetInterfaceObject ("AutoCAD.AcCmColor.20")
Dim col As New AcadAcCmColor
Access Via

VBA

Not applicable

Members

These members are part of this object:

Methods | Properties | Events
Delete SetColorBookColor SetNames SetRGB | Blue BookName ColorIndex ColorMethod ColorName EntityColor Green Red | None

Remarks

The AcCmColor object represents colors. You can use the AcCmColor object to set colors and perform other color-related operations on objects.

The object includes properties for colors, color names, color book names, and the color index.


Application Object (ActiveX)

An instance of the AutoCAD application.

Supported Platforms: Windows only

Class Information

Class Name

AcadApplication

Object Inheritance
Object
   AcadApplication
Create Using

VBA

GetObject("AutoCAD.Application.20")
CreateObject("AutoCAD.Application.20")
Access Via

VBA

object.Application

Members

These members are part of this object:

Methods | Properties | Events
Eval GetAcadState GetInterfaceObject ListARX LoadARX LoadDVB Quit RunMacro UnloadARX UnloadDVB Update ZoomAll ZoomCenter ZoomExtents ZoomPickWindow ZoomPrevious ZoomScaled ZoomWindow | ActiveDocument Application Caption Documents FullName Height HWND LocaleID MenuBar MenuGroups Name Path Preferences StatusID VBE Version Visible Width WindowLeft WindowState WindowTop | AppActivate AppDeactivate ARXLoaded ARXUnloaded BeginCommand BeginFileDrop BeginLisp BeginModal BeginOpen BeginPlot BeginQuit BeginSave EndCommand EndLisp EndModal EndOpen EndPlot EndSave LispCancelled NewDrawing SysVarChanged WindowChanged WindowMovedOrResized

Remarks

The properties that are associated with the Application object reflect the properties of the main application window. The methods control the loading or listing of the currently loaded external applications and interface objects.

The active document (AutoCAD drawing) can be accessed with the ActiveDocument property.

To access the Application object from VBA, use Thisdrawing.Application. To access the Application object from VB, use the Visual Basic 6 functions GetObject or CreateObject.

If AutoCAD is running, the GetObject function will retrieve the current AutoCAD Application object. When running multiple sessions of AutoCAD, the GetObject function will return the first instance of AutoCAD in the Windows Running Object Table. See the Microsoft Visual Basic 6 documentation for the Running Object Table (ROT) and the GetObject function (for more information about verifying the session returned by GetObject).

Use version-dependent ProgIDs. If a CreateObject or GetObject function uses a version-independent ProgID, change the function to use a version-dependent ProgID. For example, you would change CreateObject("AutoCAD.Application") to CreateObject("AutoCAD.Application.20").

The application object is also the Global object for the ActiveX interface. This means that all the methods and properties for the Application object are available in the global name space.

Use the Quit method to end the AutoCAD session.


Arc Object (ActiveX)

A circular arc.

Supported Platforms: Windows only

Class Information

Class Name

AcadArc

Object Inheritance
Object
   AcadObject AcadEntity
         AcadArc
Create Using

VBA

ModelSpace.AddArc
PaperSpace.AddArc
Block.AddArc
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Offset Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application ArcLength Area Center Document EndAngle EndPoint EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Linetype LinetypeScale Lineweight Material Normal ObjectID ObjectName OwnerID PlotStyleName Radius StartAngle StartPoint Thickness TotalAngle TrueColor Visible | Modified

Remarks

An arc is always drawn counterclockwise from the start point to the endpoint. The StartPoint and EndPoint properties of an arc are calculated through the StartAngle, EndAngle, and Radius properties.

To create an arc, use the AddArc method.


Attribute Object (ActiveX)

An object appearing as a text string that describes the characteristics of an attribute reference.

Supported Platforms: Windows only

Class Information

Class Name

AcadAttribute

Object Inheritance
Object
   AcadObject AcadEntity
         AcadAttribute
Create Using

VBA

ModelSpace.AddAttribute
PaperSpace.AddAttribute
Block.AddAttribute
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update UpdateMTextAttribute | Alignment Application Backward Constant Document EntityTransparency FieldLength Handle HasExtensionDictionary Height Hyperlinks InsertionPoint Invisible Layer Linetype LinetypeScale Lineweight LockPosition Material Mode MTextAttribute MTextAttributeContent MTextBoundaryWidth MTextDrawingDirection Normal ObjectID ObjectName ObliqueAngle OwnerID PlotStyleName Preset PromptString Rotation ScaleFactor StyleName TagString TextAlignmentPoint TextGenerationFlag TextString Thickness TrueColor UpsideDown Verify Visible | Modified

Remarks

In AutoCAD, this object is called an attribute definition.

To create an attribute (or attribute definition), use the AddAttribute method.


AttributeReference Object (ActiveX)

An object containing text that links to a block.

Supported Platforms: Windows only

Class Information

Class Name

AcadAttributeReference

Object Inheritance
Object
   AcadObject AcadEntity
         AcadAttributeReference
Create Using

VBA

ModelSpace.InsertBlock
PaperSpace.InsertBlock
Block.InsertBlock
Access Via

VBA

Block.GetAttributes

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetExtensionDictionary GetXData IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update UpdateMTextAttribute | Alignment Application Backward Constant Document EntityTransparency FieldLength Handle HasExtensionDictionary Height Hyperlinks InsertionPoint Invisible Layer Linetype LinetypeScale Lineweight LockPosition Material MTextAttribute MTextAttributeContent MTextBoundaryWidth MTextDrawingDirection Normal ObjectID ObjectName ObliqueAngle OwnerID PlotStyleName Rotation ScaleFactor StyleName TagString TextAlignmentPoint TextGenerationFlag TextString Thickness TrueColor UpsideDown Visible | Modified

Remarks

You cannot directly create an attribute reference. Attribute references are added to the drawing when a block containing an attribute definition is inserted into the drawing. To access an attribute reference of an inserted block, use the GetAttributes method. This method returns an array of all attribute references attached to the inserted block.


Block Object (ActiveX)

A block definition containing a name and a set of objects.

Supported Platforms: Windows only

Class Information

Class Name

AcadBlock

Object Inheritance
Object
   AcadObject
      AcadBlock
Create Using

VBA

Blocks.Add
Access Via

VBA

Blocks.Item
Layout.Block

Members

These members are part of this object:

Methods | Properties | Events
Add3DFace Add3DMesh Add3DPoly AddArc AddAttribute AddBox AddCircle AddCone AddCustomObject AddCylinder AddDim3PointAngular AddDimAligned AddDimAngular AddDimArc AddDimDiametric AddDimOrdinate AddDimRadial AddDimRadialLarge AddDimRotated AddEllipse AddEllipticalCone AddEllipticalCylinder AddExtrudedSolid AddExtrudedSolidALongPath AddHatch AddLeader AddLightWeightPolyline AddLine AddMInsertBlock AddMLeader AddMLine AddMText AddPoint AddPolyfaceMesh AddPolyline AddRaster AddRay AddRegion AddRevolvedSolid AddSection AddShape AddSolid AddSphere AddSpline AddTable AddText AddTolerance AddTorus AddTrace AddWedge AddXLine AttachExternalReference Bind Delete Detach GetExtensionDictionary GetXData InsertBlock Item Reload SetXData Unload | Application BlockScaling Comments Count Document Explodable Handle HasExtensionDictionary IsDynamicBlock IsLayout IsXRef Layout Material Name ObjectID ObjectName Origin OwnerID Path Units XRefDatabase | Modified

Remarks

There are four types of blocks: the simple block, the XRef block, the layout block, and the dynamic block.

A simple block is a collection of objects that you can associate together to form a single object, or block definition. You can insert, scale, and rotate a simple block in a drawing. You can explode a simple block into its component objects, modify them, and redefine the block definition. Simple blocks can be defined from geometry in the current drawing, or by using another AutoCAD drawing. When you use another drawing to create a block, the new simple block is stored in the current drawing database; it is not updated if the original drawing changes. Inserting an instance of a simple block into the current drawing creates a BlockReference object.

An XRef block is an external link from another drawing to the current drawing. Because the XRef block represents a link to geometry, not the geometry itself, it is updated whenever the original drawing changes. Inserting an instance of an XRef block into the current drawing creates an ExternalReference object.

The layout blocks represent the geometry in the model space and paper space layouts. These blocks have a Layout object associated with them that contains the plot settings and other layout definition information. The block name of the active paper space layout is always *PAPER_SPACE. The other paper space layouts will have blocks named *PAPER_SPACEn, where n is an integer. Block names start with *PAPER_SPACE0, and the Integer increments by 1 each time a new layout is inserted.

By default, the layout blocks in a new drawing have the following names:

  • *MODEL_SPACE - The model space layout. There is only one model space layout per drawing.

    This block corresponds to the ModelSpace collection.

  • *PAPER_SPACE - The first paper space layout created. If the model space layout is currently active, this block contains the last active paper space layout.

    This block corresponds to the PaperSpace collection.

  • *PAPER_SPACE0 - The second paper space layout created. If this layout is activated, its block is renamed *PAPER_SPACE and becomes accessible from the PaperSpace collection; the first layout's block is renamed *PAPER_SPACE0.

When you activate a new layout, it swaps block names with the layout that was formerly active. In this way, the block of the active layout is always named *PAPER_SPACE. For example, suppose Layout1 is active and Layout2 is associated with a block named *PAPER_SPACE0. If you then activate Layout2, it's block is renamed to *PAPER_SPACE, and Layout1's block is renamed to *PAPER_SPACE0.

Dynamic blocks enhance simple blocks by increasing their intelligence potential and adaptability. The internal geometry of a dynamic block instance can be adjusted independently of both its base definition and other instances. This flexibility is the central concept of dynamic blocks. Inserting an instance of a dynamic block into the current drawing creates a BlockReference object. From the block reference, you can get the DynamicBlockReferenceProperty object.

To identify a block's type, use the IsLayout , IsXRef , and IsDynamicBlock properties. If these properties are False, then the block is a simple block. If the IsXRef property is True, then the block is an external reference. If the IsLayout property is True, then the block contains all the geometry associated with a layout. If the IsDynamicBlock property is True, then the block is a dynamic block.

There is no limit to the number of objects a block can contain.

To insert a simple, XRef, or dynamic block into a drawing, use the InsertBlock method. To create a new layout block, use the Add method to add a new layout to the Layouts collection. When the new layout is created, an associated block for the layout will also be created.


BlockReference Object (ActiveX)

An instance of a block definition inserted into a drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadBlockReference

Object Inheritance
Object
   AcadObject AcadEntity
         AcadBlockReference
Create Using

VBA

ModelSpace.InsertBlock
PaperSpace.InsertBlock
Block.InsertBlock
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular ConvertToAnonymousBlock ConvertToStaticBlock Copy Delete Explode GetAttributes GetBoundingBox GetConstantAttributes GetDynamicBlockProperties GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move ResetBlock Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Document EffectiveName EntityTransparency Handle HasAttributes HasExtensionDictionary Hyperlinks InsertionPoint InsUnits InsUnitsFactor IsDynamicBlock Layer Linetype LinetypeScale Lineweight Material Name Normal ObjectID ObjectName OwnerID PlotStyleName Rotation TrueColor Visible XEffectiveScaleFactor XScaleFactor YEffectiveScaleFactor YScaleFactor ZEffectiveScaleFactor ZScaleFactor | Modified

Remarks

To create a block reference, first you must create a block definition, or block, by using the Add method. Once created, you can insert an instance of this block into your drawing using the InsertBlock method.

To add or delete items from the block reference, you must first use the Explode method to break it into its component objects. Even though a block reference is broken into its component objects, the block definition still remains in the drawings block symbol table.


Blocks Collection (ActiveX)

The collection of all blocks in the drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadBlocks

Object Inheritance
Object
   AcadObject
      AcadBlocks
Create Using

VBA

Not applicable
Access Via

VBA

Document.Blocks

Members

These members are part of this object:

Methods | Properties | Events
Add GetExtensionDictionary GetXData Item SetXData | Application Count Document Handle HasExtensionDictionary ObjectID ObjectName OwnerID | None

Remarks

To add a new member to the collection, use the Add method. To select a specific block, use the Item method.

There are two special blocks in the collection. One contains the collection of all model space entities, the ModelSpace collection; the other contains all paper space entities, the PaperSpace collection.

Although the Blocks collection inherits a Delete method, you cannot actually delete the collection. Attempting to delete the Blocks collection will result in an error, therefore the Delete method has been removed from the documentation for this collection.

There is no limit to the number of blocks you can create in your drawing. However, there can be only one instance of the Blocks collection. The Blocks collection is predefined for each drawing. You can make multiple references to it by using the Blocks property. Once done with an object, the reference is automatically released.


Circle Object (ActiveX)

A full circle.

Supported Platforms: Windows only

Class Information

Class Name

AcadCircle

Object Inheritance
Object
   AcadObject AcadEntity
         AcadCircle
Create Using

VBA

ModelSpace.AddCircle
PaperSpace.AddCircle
Block.AddCircle
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Offset Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Area Center Circumference Diameter Document EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Linetype LinetypeScale Lineweight Material Normal ObjectID ObjectName OwnerID PlotStyleName Radius Thickness TrueColor Visible | Modified

Remarks

To create a circle, use the AddCircle method.


Database Object (ActiveX)

The contents of an XRef block.

Supported Platforms: Windows only

Class Information

Class Name

AcadDatabase

Object Inheritance
Object
   AcadDatabase
Create Using

VBA

Not applicable
Access Via

VBA

Block.XRefDatabase

Members

These members are part of this object:

Methods | Properties | Events
CopyObjects HandleToObject ObjectIdToObject | Blocks Dictionaries DimStyles ElevationModelSpace ElevationPaperSpace FileDependencies Groups Layers Layouts Limits Linetypes Material ModelSpace PaperSpace PlotConfigurations Preferences RegisteredApplications SectionManager SummaryInfo TextStyles UserCoordinateSystems Viewports Views | None

Remarks

This object provides access to the contents of an external reference block. It is only available on blocks whose IsXRef property is equal to True.


DatabasePreferences Object (ActiveX)

An object that specifies the settings for the current AutoCAD drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadDatabasePreferences

Object Inheritance
Object
   AcadDatabasePreferences
Create Using

VBA

Not applicable
Access Via

VBA

Document.Preferences

Members

These members are part of this object:

Methods | Properties | Events
None | AllowLongSymbolNames Application ContourlinesPerSurface DisplaySilhouette Lineweight LineweightDisplay MaxActiveViewports ObjectSortByPlotting ObjectSortByPSOutput ObjectSortByRedraws ObjectSortByRegens ObjectSortBySelection ObjectSortBySnap OLELaunch RenderSmoothness SegmentPerPolyline SolidFill TextFrameDisplay XRefEdit XRefLayerVisibility | None

Remarks

Database preferences represent options from the Options dialog box that reside in a drawing. Options that reside in the registry can be accessed through the main Preferences object.

The DatabasePreferences object can be referenced from the Preferences property on the Document object.


DgnUnderlay Object (ActiveX)

A source of DGN underlay content.

Supported Platforms: Windows only

Class Information

Class Name

AcadDgnUnderlay

Object Inheritance
Object
   AcadObject AcadEntity
         AcadUnderlay
            AcadDgnUnderlay
Create Using

VBA

Not applicable
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular ClipBoundary Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | AdjustForBackground Application ClippingEnabled Contrast Document EntityTransparency Fade File Handle HasExtensionDictionary Height Hyperlinks ItemName Layer Linetype LinetypeScale Lineweight Material Monochrome ObjectID ObjectName OwnerID PlotStyleName Position Rotation ScaleFactor TrueColor UnderlayLayerOverrideApplied UnderlayName UnderlayVisibility Visible Width | Modified

Remarks

Underlays are similar to raster images, except that users can snap to the content of an underlay. The AcadDgnUnderlay class supports DGN files as underlays to AutoCAD drawings.


Dictionaries Collection (ActiveX)

The collection of all dictionaries in the drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadDictionaries

Object Inheritance
Object
   AcadObject
      AcadDictionaries
Create Using

VBA

Not applicable
Access Via

VBA

Document.Dictionaries

Members

These members are part of this object:

Methods | Properties | Events
Add GetExtensionDictionary GetXData Item SetXData | Application Count Document Handle HasExtensionDictionary ObjectID ObjectName OwnerID | Modified

Remarks

To add a new member to the collection, use the Add method. To select a specific dictionary, use the Item method.

Although the Dictionaries collection inherits a Delete method, you cannot actually delete the collection. Attempting to delete the Dictionaries collection will result in an error. The Delete method has been removed from the documentation for this collection.

There is no limit to the number of dictionaries that you can create in your drawing. However, there can be only one instance of the Dictionaries collection. The Dictionaries collection is predefined for each drawing. You can make multiple references to it by using the Dictionaries property. Once done with an object, the reference is automatically released.


Dictionary Object (ActiveX)

A container object for storing and retrieving objects.

Supported Platforms: Windows only

Class Information

Class Name

AcadDictionary

Object Inheritance
Object
   AcadObject
      AcadDictionary
Create Using

VBA

Dictionaries.Add
Access Via

VBA

Dictionaries.Item

Members

These members are part of this object:

Methods | Properties | Events
AddObject AddXRecord Delete GetExtensionDictionary GetName GetObject GetXData Item Remove Rename Replace SetXData | Application Count Document Handle HasExtensionDictionary Name ObjectID ObjectName OwnerID | Modified

Remarks

Dictionaries provide a mechanism for storing and retrieving objects with associated string keywords.

The objects in a dictionary may be referenced by their keywords. A dictionary can contain any type of object, including other dictionaries. A dictionary does not perform type checking of entries.

You can create new dictionaries, add entries to an existing dictionary, and get the keyword for a given object or the object for a given keyword. You can change the object that is associated with a given keyword, or rename the keyword for a given object.

This dictionary is similar to a collection in AutoCAD, and is used for custom object implementation. This object does not represent the spell checking dictionary. The spell checking dictionary is specified in the Preferences object.

To add a dictionary to the application, use the Add method.


Dim3PointAngular Object (ActiveX)

A dimension measuring the angular distance between three points.

Supported Platforms: Windows only

Class Information

Class Name

AcadDim3PointAngular

Object Inheritance
Object
   AcadObject AcadEntity AcadDimension
            AcadDim3PointAngular
Create Using

VBA

ModelSpace.AddDim3PointAngular
PaperSpace.AddDim3PointAngular
Block.AddDim3PointAngular
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods

Properties

Events

ArrayPolar

ArrayRectangular

Copy

Delete

GetBoundingBox

GetExtensionDictionary

GetXData

Highlight

IntersectWith

Mirror

Mirror3D

Move

Rotate

Rotate3D

ScaleEntity

SetXData

TransformBy

Update

AngleFormat

AngleVertex

Application

Arrowhead1Block

Arrowhead1Type

Arrowhead2Block

Arrowhead2Type

ArrowheadSize

DecimalSeparator

DimConstrDesc

DimConstrExpression

DimConstrForm

DimConstrName

DimConstrReference

DimConstrValue

DimensionLineColor

DimensionLinetype

DimensionLineWeight

DimLine1Suppress

DimLine2Suppress

DimLineInside

DimTxtDirection

Document

EntityTransparency

ExtensionLineColor

ExtensionLineExtend

ExtensionLineOffset

ExtensionLineWeight

ExtLine1EndPoint

ExtLine1Linetype

ExtLine1Suppress

ExtLine2EndPoint

ExtLine2Linetype

ExtLine2Suppress

ExtLineFixedLen

ExtLineFixedLenSuppress

Fit

ForceLineInside

Handle

HasExtensionDictionary

HorizontalTextPosition

Hyperlinks

Layer

Linetype

LinetypeScale

Lineweight

Material

Measurement

Normal

ObjectID

ObjectName

OwnerID

PlotStyleName

Rotation

ScaleFactor

StyleName

SuppressLeadingZeros

SuppressTrailingZeros

TextColor

TextFill

TextFillColor

TextGap

TextHeight

TextInside

TextInsideAlign

TextMovement

TextOutsideAlign

TextOverride

TextPosition

TextPrecision

TextPrefix

TextRotation

TextStyle

TextSuffix

ToleranceDisplay

ToleranceHeightScale

ToleranceJustification

ToleranceLowerLimit

TolerancePrecision

ToleranceSuppressLeadingZeros

ToleranceSuppressTrailingZeros

ToleranceUpperLimit

TrueColor

VerticalTextPosition

Visible

Modified

Remarks

When creating a three point angular dimension, AutoCAD draws the dimension line arc between the extension lines. The extension lines are drawn from the angle endpoints to the intersection of the dimension line arc.

A 3 point angular dimension

AutoCAD uses the location of the dimension line arc to choose between the minor and major angles specified by the angle vertex and extension lines.

To create a three point angular dimension, use the AddDim3PointAngular method.


DimAligned Object (ActiveX)

A linear dimension, measuring the distance between two points, that is displayed parallel to the points being measured.

Supported Platforms: Windows only

Class Information

Class Name

AcadDimAligned

Object Inheritance
Object
   AcadObject AcadEntity AcadDimension
            AcadDimAligned
Create Using

VBA

ModelSpace.AddDimAligned
PaperSpace.AddDimAligned
Block.AddDimAligned
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods

Properties

Events

ArrayPolar

ArrayRectangular

Copy

Delete

GetBoundingBox

GetExtensionDictionary

GetXData

Highlight

IntersectWith

Mirror

Mirror3D

Move

Rotate

Rotate3D

ScaleEntity

SetXData

TransformBy

Update

AltRoundDistance

AltSubUnitsFactor

AltSubUnitsSuffix

AltSuppressLeadingZeros

AltSuppressTrailingZeros

AltSuppressZeroFeet

AltSuppressZeroInches

AltTextPrefix

AltTextSuffix

AltTolerancePrecision

AltToleranceSuppressLeadingZeros

AltToleranceSuppressTrailingZeros

AltToleranceSuppressZeroFeet

AltToleranceSuppressZeroInches

AltUnits

AltUnitsFormat

AltUnitsPrecision

AltUnitsScale

Application

Arrowhead1Block

Arrowhead1Type

Arrowhead2Block

Arrowhead2Type

ArrowheadSize

DecimalSeparator

DimConstrDesc

DimConstrExpression

DimConstrForm

DimConstrName

DimConstrReference

DimConstrValue

DimensionLineColor

DimensionLineExtend

DimensionLinetype

DimensionLineWeight

DimLine1Suppress

DimLine2Suppress

DimLineInside

DimTxtDirection

Document

EntityTransparency

ExtensionLineColor

ExtensionLineExtend

ExtensionLineOffset

ExtensionLineWeight

ExtLine1Linetype

ExtLine1Point

ExtLine1Suppress

ExtLine2Linetype

ExtLine2Point

ExtLine2Suppress

ExtLineFixedLen

ExtLineFixedLenSupress

Fit

ForceLineInside

FractionFormat

Handle

HasExtensionDictionary

HorizontalTextPosition

Hyperlinks

Layer

LinearScaleFactor

Linetype

LinetypeScale

Lineweight

Material

Measurement

Normal

ObjectID

ObjectName

OwnerID

PlotStyleName

PrimaryUnitsPrecision

Rotation

RoundDistance

ScaleFactor

StyleName

SubUnitsFactor

SubUnitsSuffix

SuppressLeadingZeros

SuppressTrailingZeros

SuppressZeroFeet

SuppressZeroInches

TextColor

TextFill

TextFillColor

TextGap

TextHeight

TextInside

TextInsideAlign

TextMovement

TextOutsideAlign

TextOverride

TextPosition

TextPrefix

TextRotation

TextStyle

TextSuffix

ToleranceDisplay

ToleranceHeightScale

ToleranceJustification

ToleranceLowerLimit

TolerancePrecision

ToleranceSuppressLeadingZeros

ToleranceSuppressTrailingZeros

ToleranceSuppressZeroFeet

ToleranceSuppressZeroInches

ToleranceUpperLimit

TrueColor

UnitsFormat

VerticalTextPosition

Visible

Modified

Remarks

In aligned dimensions, the dimension line is parallel to the extension line origins. The extension line origins are specified using the ExtLine1Point and ExtLine2Point properties.

To create an aligned dimension use the AddDimAligned method.


DimAngular Object (ActiveX)

A dimension measuring the angular distance between two lines or between the angle of a circular arc.

Supported Platforms: Windows only

Class Information

Class Name

AcadDimAngular

Object Inheritance
Object
   AcadObject AcadEntity AcadDimension
            AcadDimAngular
Create Using

VBA

ModelSpace.AddDimAngular
PaperSpace.AddDimAngular
Block.AddDimAngular
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods

Properties

Events

ArrayPolar

ArrayRectangular

Copy

Delete

GetBoundingBox

GetExtensionDictionary

GetXData

Highlight

IntersectWith

Mirror

Mirror3D

Move

Rotate

Rotate3D

ScaleEntity

SetXData

TransformBy

Update

AngleFormat

Application

Arrowhead1Block

Arrowhead1Type

Arrowhead2Block

Arrowhead2Type

ArrowheadSize

DecimalSeparator

DimConstrDesc

DimConstrExpression

DimConstrForm

DimConstrName

DimConstrReference

DimConstrValue

DimensionLineColor

DimensionLinetype

DimensionLineWeight

DimLine1Suppress

DimLine2Suppress

DimLineInside

DimTxtDirection

Document

EntityTransparency

ExtensionLineColor

ExtensionLineExtend

ExtensionLineOffset

ExtensionLineWeight

ExtLine1EndPoint

ExtLine1Linetype

ExtLine1StartPoint

ExtLine1Suppress

ExtLine2EndPoint

ExtLine2Linetype

ExtLine2StartPoint

ExtLine2Suppress

ExtLineFixedLen

ExtLineFixedLenSuppress

Fit

ForceLineInside

Handle

HasExtensionDictionary

HorizontalTextPosition

Hyperlinks

Layer

Linetype

LinetypeScale

Lineweight

Material

Measurement

Normal

ObjectID

ObjectName

OwnerID

PlotStyleName

Rotation

ScaleFactor

StyleName

SuppressLeadingZeros

SuppressTrailingZeros

TextColor

TextFill

TextFillColor

TextGap

TextHeight

TextInside

TextInsideAlign

TextMovement

TextOutsideAlign

TextOverride

TextPosition

TextPrecision

TextPrefix

TextRotation

TextStyle

TextSuffix

ToleranceDisplay

ToleranceHeightScale

ToleranceJustification

ToleranceLowerLimit

TolerancePrecision

ToleranceSuppressLeadingZeros

ToleranceSuppressTrailingZeros

ToleranceUpperLimit

TrueColor

VerticalTextPosition

Visible

Modified

Remarks

If you need extension lines, they will be added automatically. The endpoints provided will be used as origin points for the extension lines.

An angular dimension measuring the angle of a circular arc

To create an angular dimension, use the AddDimAngular method.


DimArcLength Object (ActiveX)

A dimension measuring the length of an arc.

Supported Platforms: Windows only

Class Information

Class Name

AcadDimArcLength

Object Inheritance
Object
   AcadObject AcadEntity AcadDimension
            AcadDimArcLength
Create Using

VBA

ModelSpace.AddDimArc
PaperSpace.AddDimArc
Block.AddDimArc
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods

Properties

Events

ArrayPolar

ArrayRectangular

Copy

Delete

GetBoundingBox

GetExtensionDictionary

GetXData

Highlight

IntersectWith

Mirror

Mirror3D

Move

Rotate

Rotate3D

ScaleEntity

SetXData

TransformBy

Update

AltRoundDistance

AltSubUnitsFactor

AltSubUnitsSuffix

AltSuppressLeadingZeros

AltSuppressTrailingZeros

AltSuppressZeroFeet

AltSuppressZeroInches

AltTextPrefix

AltTextSuffix

AltTolerancePrecision

AltToleranceSuppressLeadingZeros

AltToleranceSuppressTrailingZeros

AltToleranceSuppressZeroFeet

AltToleranceSuppressZeroInches

AltUnits

AltUnitsFormat

AltUnitsPrecision

AltUnitsScale

Application

ArcEndParam

ArcPoint

ArcStartParam

Arrowhead1Block

Arrowhead1Type

Arrowhead2Block

Arrowhead2Type

ArrowheadSize

CenterPoint

DecimalSeparator

DimensionLineColor

DimensionLineExtend

DimensionLinetype

DimensionLineWeight

DimLine1Suppress

DimLine2Suppress

DimLineInside

DimTxtDirection

Document

EntityTransparency

ExtensionLineColor

ExtensionLineExtend

ExtensionLineOffset

ExtensionLineWeight

ExtLine1Linetype

ExtLine1Point

ExtLine1Suppress

ExtLine2Linetype

ExtLine2Point

ExtLine2Suppress

ExtLineFixedLen

ExtLineFixedLenSuppress

Fit

ForceLineInside

FractionFormat

Handle

HasExtensionDictionary

HasLeader

HorizontalTextPosition

Hyperlinks

IsPartial

Layer

Leader1Point

Leader2Point

LinearScaleFactor

Linetype

LinetypeScale

Lineweight

Material

Measurement

Normal

ObjectID

ObjectName

OwnerID

PlotStyleName

PrimaryUnitsPrecision

Rotation

RoundDistance

ScaleFactor

StyleName

SubUnitsFactor

SubUnitsSuffix

SuppressLeadingZeros

SuppressTrailingZeros

SuppressZeroFeet

SuppressZeroInches

SymbolPosition

TextColor

TextFill

TextFillColor

TextGap

TextHeight

TextInside

TextInsideAlign

TextMovement

TextOutsideAlign

TextOverride

TextPosition

TextPrefix

TextRotation

TextStyle

TextSuffix

ToleranceDisplay

ToleranceHeightScale

ToleranceJustification

ToleranceLowerLimit

TolerancePrecision

ToleranceSuppressLeadingZeros

ToleranceSuppressTrailingZeros

ToleranceSuppressZeroFeet

ToleranceSuppressZeroInches

ToleranceUpperLimit

TrueColor

UnitsFormat

VerticalTextPosition

Visible

Modified

Remarks

An arc length dimension


DimDiametric Object (ActiveX)

A dimension measuring the diameter of a circle or arc.

Supported Platforms: Windows only

Class Information

Class Name

AcadDimDiametric

Object Inheritance
Object
   AcadObject AcadEntity AcadDimension
            AcadDimDiametric
Create Using

VBA

ModelSpace.AddDimDiametric
PaperSpace.AddDimDiametric
Block.AddDimDiametric
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods

Properties

Events

ArrayPolar

ArrayRectangular

Copy

Delete

GetBoundingBox

GetExtensionDictionary

GetXData

Highlight

IntersectWith

Mirror

Mirror3D

Move

Rotate

Rotate3D

ScaleEntity

SetXData

TransformBy

Update

AltRoundDistance

AltSuppressLeadingZeros

AltSuppressTrailingZeros

AltSuppressZeroFeet

AltSuppressZeroInches

AltTextPrefix

AltTextSuffix

AltTolerancePrecision

AltToleranceSuppressLeadingZeros

AltToleranceSuppressTrailingZeros

AltToleranceSuppressZeroFeet

AltToleranceSuppressZeroInches

AltUnits

AltUnitsFormat

AltUnitsPrecision

AltUnitsScale

Application

Arrowhead1Block

Arrowhead1Type

Arrowhead2Block

Arrowhead2Type

ArrowheadSize

CenterMarkSize

CenterType

DecimalSeparator

DimConstrDesc

DimConstrExpression

DimConstrForm

DimConstrName

DimConstrReference

DimConstrValue

DimensionLineColor

DimensionLinetype

DimensionLineWeight

DimLine1Suppress

DimLine2Suppress

DimTxtDirection

Document

EntityTransparency

Fit

ForceLineInside

FractionFormat

Handle

HasExtensionDictionary

Hyperlinks

Layer

LeaderLength

LinearScaleFactor

Linetype

LinetypeScale

Lineweight

Material

Measurement

Normal

ObjectID

ObjectName

OwnerID

PlotStyleName

PrimaryUnitsPrecision

Rotation

RoundDistance

ScaleFactor

StyleName

SuppressLeadingZeros

SuppressTrailingZeros

SuppressZeroFeet

SuppressZeroInches

TextColor

TextFill

TextFillColor

TextGap

TextHeight

TextInside

TextInsideAlign

TextMovement

TextOutsideAlign

TextOverride

TextPosition

TextPrefix

TextRotation

TextStyle

TextSuffix

ToleranceDisplay

ToleranceHeightScale

ToleranceJustification

ToleranceLowerLimit

TolerancePrecision

ToleranceSuppressLeadingZeros

ToleranceSuppressTrailingZeros

ToleranceSuppressZeroFeet

ToleranceSuppressZeroInches

ToleranceUpperLimit

TrueColor

UnitsFormat

VerticalTextPosition

Visible

Modified

Remarks

The position of the text (TextPosition property) determines the location of the dimension line.

Examples of diameter dimensions

To create a diameter dimension, use the AddDimDiametric method.


DimOrdinate Object (ActiveX)

A dimension measuring the absolute X or Y position of a point from the origin.

Supported Platforms: Windows only

Class Information

Class Name

AcadDimOrdinate

Object Inheritance
Object
   AcadObject AcadEntity AcadDimension
            AcadDimOrdinate
Create Using

VBA

ModelSpace.AddDimOrdinate
PaperSpace.AddDimOrdinate
Block.AddDimOrdinate
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods

Properties

Events

ArrayPolar

ArrayRectangular

Copy

Delete

GetBoundingBox

GetExtensionDictionary

GetXData

Highlight

IntersectWith

Mirror

Mirror3D

Move

Rotate

Rotate3D

ScaleEntity

SetXData

TransformBy

Update

AltRoundDistance

AltSubUnitsFactor

AltSubUnitsSuffix

AltSuppressLeadingZeros

AltSuppressTrailingZeros

AltSuppressZeroFeet

AltSuppressZeroInches

AltTextPrefix

AltTextSuffix

AltTolerancePrecision

AltToleranceSuppressLeadingZeros

AltToleranceSuppressTrailingZeros

AltToleranceSuppressZeroFeet

AltToleranceSuppressZeroInches

AltUnits

AltUnitsFormat

AltUnitsPrecision

AltUnitsScale

Application

ArrowheadSize

DecimalSeparator

DimTxtDirection

Document

EntityTransparency

ExtensionLineColor

ExtensionLineOffset

ExtensionLineWeight

ExtLineFixedLen

ExtLineFixedLenSuppress

FractionFormat

Handle

HasExtensionDictionary

Hyperlinks

Layer

LinearScaleFactor

Linetype

LinetypeScale

Lineweight

Material

Measurement

Normal

ObjectID

ObjectName

OwnerID

PlotStyleName

PrimaryUnitsPrecision

Rotation

RoundDistance

ScaleFactor

StyleName

SubUnitsFactor

SubUnitsSuffix

SuppressLeadingZeros

SuppressTrailingZeros

SuppressZeroFeet

SuppressZeroInches

TextColor

TextFill

TextFillColor

TextGap

TextHeight

TextMovement

TextOverride

TextPosition

TextPrefix

TextRotation

TextStyle

TextSuffix

ToleranceDisplay

ToleranceHeightScale

ToleranceJustification

ToleranceLowerLimit

TolerancePrecision

ToleranceSuppressLeadingZeros

ToleranceSuppressTrailingZeros

ToleranceSuppressZeroFeet

ToleranceSuppressZeroInches

ToleranceUpperLimit

TrueColor

UnitsFormat

VerticalTextPosition

Visible

Modified

Remarks

Ordinate dimensions display the X or Y UCS coordinate of an object along with a simple leader line. The absolute value of the coordinate is used according to the prevailing standards for ordinate dimensions.

An ordinate dimension measuring the absolute X position of a point tangent to a circle

To change the extension lines of an ordinate dimension, change the Rotation and/or TextPosition properties. The extension lines will be recalculated to fit the new requirements.

To create an ordinate dimension, use the AddDimOrdinate method.


DimRadial Object (ActiveX)

A dimension measuring the radius of a circle or arc.

Supported Platforms: Windows only

Class Information

Class Name

AcadDimRadial

Object Inheritance
Object
   AcadObject AcadEntity AcadDimension
            AcadDimRadial
Create Using

VBA

ModelSpace.AddDimRadial
PaperSpace.AddDimRadial
Block.AddDimRadial
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods

Properties

Events

ArrayPolar

ArrayRectangular

Copy

Delete

GetBoundingBox

GetExtensionDictionary

GetXData

Highlight

IntersectWith

Mirror

Mirror3D

Move

Rotate

Rotate3D

ScaleEntity

SetXData

TransformBy

Update

AltRoundDistance

AltSuppressLeadingZeros

AltSuppressTrailingZeros

AltSuppressZeroFeet

AltSuppressZeroInches

AltTextPrefix

AltTextSuffix

AltTolerancePrecision

AltToleranceSuppressLeadingZeros

AltToleranceSuppressTrailingZeros

AltToleranceSuppressZeroFeet

AltToleranceSuppressZeroInches

AltUnits

AltUnitsFormat

AltUnitsPrecision

AltUnitsScale

Application

ArrowheadBlock

ArrowheadSize

ArrowheadType

CenterMarkSize

CenterType

DecimalSeparator

DimConstrDesc

DimConstrExpression

DimConstrForm

DimConstrName

DimConstrReference

DimConstrValue

DimensionLineColor

DimensionLinetype

DimensionLineWeight

DimLineSuppress

DimTxtDirection

Document

EntityTransparency

Fit

ForceLineInside

FractionFormat

Handle

HasExtensionDictionary

Hyperlinks

Layer

LeaderLength

LinearScaleFactor

Linetype

LinetypeScale

Lineweight

Material

Measurement

Normal

ObjectID

ObjectName

OwnerID

PlotStyleName

PrimaryUnitsPrecision

Rotation

RoundDistance

ScaleFactor

StyleName

SuppressLeadingZeros

SuppressTrailingZeros

SuppressZeroFeet

SuppressZeroInches

TextColor

TextFill

TextFillColor

TextGap

TextHeight

TextInside

TextInsideAlign

TextMovement

TextOutsideAlign

TextOverride

TextPosition

TextPrefix

TextRotation

TextStyle

TextSuffix

ToleranceDisplay

ToleranceHeightScale

ToleranceJustification

ToleranceLowerLimit

TolerancePrecision

ToleranceSuppressLeadingZeros

ToleranceSuppressTrailingZeros

ToleranceSuppressZeroFeet

ToleranceSuppressZeroInches

ToleranceUpperLimit

TrueColor

UnitsFormat

VerticalTextPosition

Visible

Modified

Remarks

The position of the text (TextPosition property) determines the location of the dimension line.

Examples of radial dimensions

To create a radial dimension, use the AddDimRadial method.


DimRadialLarge Object (ActiveX)

A dimension measuring a large radius, also known as a jogged radius dimension.

Supported Platforms: Windows only

Class Information

Class Name

AcadDimRadialLarge

Object Inheritance
Object
   AcadObject AcadEntity AcadDimension
            AcadDimRadialLarge
Create Using

VBA

ModelSpace.AddDimRadialLarge
PaperSpace.AddDimRadialLarge
Block.AddDimRadialLarge
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods

Properties

Events

ArrayPolar

ArrayRectangular

Copy

Delete

GetBoundingBox

GetExtensionDictionary

GetXData

Highlight

IntersectWith

Mirror

Mirror3D

Move

Rotate

Rotate3D

ScaleEntity

SetXData

TransformBy

Update

AltRoundDistance

AltSuppressLeadingZeros

AltSuppressTrailingZeros

AltSuppressZeroFeet

AltSuppressZeroInches

AltTextPrefix

AltTextSuffix

AltTolerancePrecision

AltToleranceSuppressLeadingZeros

AltToleranceSuppressTrailingZeros

AltToleranceSuppressZeroFeet

AltToleranceSuppressZeroInches

AltUnits

AltUnitsFormat

AltUnitsPrecision

AltUnitsScale

Application

ArrowheadBlock

ArrowheadSize

ArrowheadType

Center

CenterMarkSize

CenterType

ChordPoint

DecimalSeparator

DimensionLineColor

DimensionLinetype

DimensionLineWeight

DimLineSuppress

DimTxtDirection

Document

EntityTransparency

Fit

ForceLineInside

FractionFormat

Handle

HasExtensionDictionary

Hyperlinks

JogAngle

JogLocation

Layer

LinearScaleFactor

Linetype

LinetypeScale

Lineweight

Material

Measurement

Normal

ObjectID

ObjectName

OverrideCenter

OwnerID

PlotStyleName

PrimaryUnitsPrecision

Rotation

RoundDistance

ScaleFactor

StyleName

SuppressLeadingZeros

SuppressTrailingZeros

SuppressZeroFeet

SuppressZeroInches

TextColor

TextFill

TextFillColor

TextGap

TextHeight

TextInside

TextInsideAlign

TextMovement

TextOutsideAlign

TextOverride

TextPosition

TextPrefix

TextRotation

TextStyle

TextSuffix

ToleranceDisplay

ToleranceHeightScale

ToleranceJustification

ToleranceLowerLimit

TolerancePrecision

ToleranceSuppressLeadingZeros

ToleranceSuppressTrailingZeros

ToleranceSuppressZeroFeet

ToleranceSuppressZeroInches

ToleranceUpperLimit

TrueColor

UnitsFormat

VerticalTextPosition

Visible

Modified

Remarks

A jogged radius dimension


DimRotated Object (ActiveX)

A dimension that measures the distance between two points and is displayed at a given rotation.

Supported Platforms: Windows only

Class Information

Class Name

AcadDimRotated

Object Inheritance
Object
   AcadObject AcadEntity AcadDimension
            AcadDimRotated
Create Using

VBA

ModelSpace.AddDimRotated
PaperSpace.AddDimRotated
Block.AddDimRotated
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods

Properties

Events

ArrayPolar

ArrayRectangular

Copy

Delete

GetBoundingBox

GetExtensionDictionary

GetXData

Highlight

IntersectWith

Mirror

Mirror3D

Move

Rotate

Rotate3D

ScaleEntity

SetXData

TransformBy

Update

AltRoundDistance

AltSubUnitsFactor

AltSubUnitsSuffix

AltSuppressLeadingZeros

AltSuppressTrailingZeros

AltSuppressZeroFeet

AltSuppressZeroInches

AltTextPrefix

AltTextSuffix

AltTolerancePrecision

AltToleranceSuppressLeadingZeros

AltToleranceSuppressTrailingZeros

AltToleranceSuppressZeroFeet

AltToleranceSuppressZeroInches

AltUnits

AltUnitsFormat

AltUnitsPrecision

AltUnitsScale

Application

Arrowhead1Block

Arrowhead1Type

Arrowhead2Block

Arrowhead2Type

ArrowheadSize

DecimalSeparator

DimConstrDesc

DimConstrExpression

DimConstrForm

DimConstrName

DimConstrReference

DimConstrValue

DimensionLineColor

DimensionLineExtend

DimensionLinetype

DimensionLineWeight

DimLine1Suppress

DimLine2Suppress

DimLineInside

DimTxtDirection

Document

EntityTransparency

ExtensionLineColor

ExtensionLineExtend

ExtensionLineOffset

ExtensionLineWeight

ExtLine1Linetype

ExtLine1Suppress

ExtLine2Linetype

ExtLine2Suppress

ExtLineFixedLen

ExtLineFixedLenSuppress

Fit

ForceLineInside

FractionFormat

Handle

HasExtensionDictionary

HorizontalTextPosition

Hyperlinks

Layer

LinearScaleFactor

Linetype

LinetypeScale

Lineweight

Material

Measurement

Normal

ObjectID

ObjectName

OwnerID

PlotStyleName

PrimaryUnitsPrecision

Rotation

RoundDistance

ScaleFactor

StyleName

SubUnitsFactor

SubUnitsSuffix

SuppressLeadingZeros

SuppressTrailingZeros

SuppressZeroFeet

SuppressZeroInches

TextColor

TextFill

TextFillColor

TextGap

TextHeight

TextInside

TextInsideAlign

TextMovement

TextOutsideAlign

TextOverride

TextPosition

TextPrefix

TextRotation

TextStyle

TextSuffix

ToleranceDisplay

ToleranceHeightScale

ToleranceJustification

ToleranceLowerLimit

TolerancePrecision

ToleranceSuppressLeadingZeros

ToleranceSuppressTrailingZeros

ToleranceSuppressZeroFeet

ToleranceSuppressZeroInches

ToleranceUpperLimit

TrueColor

UnitsFormat

VerticalTextPosition

Visible

Modified

Remarks

A linear dimension created at 45 degrees

To change the extension lines of a rotated dimension, change the Rotation and/or TextPosition properties. The extension lines will be recalculated to fit the new requirements.

To create a rotated dimension, use the AddDimRotated method.


DimStyle Object (ActiveX)

A group of dimension settings that determines the appearance of a dimension.

Supported Platforms: Windows only

Class Information

Class Name

AcadDimStyle

Object Inheritance
Object
   AcadObject
      AcadDimStyle
Create Using

VBA

DimStyles.Add
Access Via

VBA

DimStyles.Item
Document.ActiveDimStyle

Members

These members are part of this object:

Methods | Properties | Events
CopyFrom Delete GetExtensionDictionary GetXData SetXData | Application Document Handle HasExtensionDictionary Name ObjectID ObjectName OwnerID | Modified

Remarks

The active dimension style determines the appearance of new dimensions that are created in the drawing. To change the style of an existing dimension, use the StyleName property found on the dimension.

To control the settings of the current document overrides, use the dimensioning system variables. See "System Variables" in the AutoCAD Online help for a list of dimensioning system variables.

When you change a dimensioning system variable, you are actually setting a document override for the active dimension style; you are not changing the active dimension style itself. This means that all newly created dimensions will still be created with the active dimension style only and will not reflect the overrides from the system variables. The overrides from the system variables will not be recognized on new dimensions until the active dimension style is updated. To change the settings of any dimension style, use the CopyFrom method. This method copies a dimension style configuration, including overrides, from a document, dimension, or other dimension style.

Dimensions created via the AutoCAD user interface are created with the active dimension style plus all document overrides. Dimensions created via ActiveX are created with the active dimension style only. To have the dimensions created via ActiveX take on the document overrides, use the CopyFrom method to copy the dimension style from the document to the active dimension style. This process will copy all existing overrides into the active dimension style.


DimStyles Collection (ActiveX)

The collection of all dimension styles in the drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadDimStyles

Object Inheritance
Object
   AcadObject
      AcadDimStyles
Create Using

VBA

Not applicable
Access Via

VBA

Document.DimStyles

Members

These members are part of this object:

Methods | Properties | Events
Add GetExtensionDictionary GetXData Item SetXData | Application Count Document Handle HasExtensionDictionary ObjectID ObjectName OwnerID | Modified

Remarks

To add a new member to the collection, use the Add method. To select a specific dimension style, use the Item method.

Although the DimStyles collection inherits a Delete method, you cannot actually delete the collection. Attempting to delete the DimStyles collection will result in an error. The Delete method has been removed from the documentation for this collection.

There is no limit to the number of dimension styles that you can create in your drawing. However, there can be only one instance of the DimStyles collection. The DimStyles collection is predefined for each drawing. You can make multiple references to it by using the DimStyles property. Once done with an object, the reference is automatically released.


Document Object (ActiveX)

An AutoCAD drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadDocument

Object Inheritance
Object
   AcadDatabase
      AcadDocument
Create Using

VBA

Documents.Add
Documents.Open
Document.New
Access Via

VBA

Documents.Item
Application.ActiveDocument

Members

These members are part of this object:

Methods | Properties | Events
Activate AuditInfo Close CopyObjects EndUndoMark Export GetVariable HandleToObject Import LoadShapeFile New ObjectIDToObject Open PurgeAll Regen Save SaveAs SendCommand SetVariable StartUndoMark WBlock | Active ActiveDimStyle ActiveLayer ActiveLayout ActiveLinetype ActiveMaterial ActivePViewport ActiveSelectionSet ActiveSpace ActiveTextStyle ActiveUCS ActiveViewport Application Blocks Database Dictionaries DimStyles ElevationModelSpace ElevationPaperSpace FileDependencies FullName Groups Height HWND Layers Layouts Limits Linetypes Materials ModelSpace MSpace Name ObjectSnapMode PaperSpace Path PickfirstSelectionSet Plot PlotConfigurations Preferences ReadOnly RegisteredApplications Saved SectionManager SelectionSets SummaryInfo TextStyles UserCoordinateSystems Utility Viewports Views Width WindowState WindowTitle | Activate BeginClose BeginCommand BeginDocClose BeginDoubleClick BeginLISP BeginPlot BeginRightClick BeginSave BeginShortcutMenuCommand BeginShortcutMenuDefault BeginShortcutMenuEdit BeginShortcutMenuGrip BeginShortcutMenuOSnap Deactivate EndCommand EndLISP EndPlot EndSave EndShortcutMenu LayoutSwitched LISPCancelled ObjectAdded ObjectErased ObjectModified SelectionChanged WindowChanged WindowMovedOrResized

Remarks

The active document (AutoCAD drawing) can be accessed using ThisDrawing in VBA, or through the ActiveDocument property in VB. Because AutoCAD works with only one document at a time, and that document represents one database, the active document can be thought of as the current database as well as the current document.

Certain objects in the drawing establish the format, location, or style that new objects being added to the drawing will adopt. These objects include the DimensionStyle , TextStyle , Linetype , Viewport , and Layer objects. A drawing may contain many of these types of objects, but only one may be active at a time. For example, there may be several linetypes available in a drawing, but only one, designated as the active one, will be used when creating a new entity. The Document object contains the references to these active objects. To set an existing object as the active object, use the properties listed below.

The Document object also contains a property (or link) for all the collections. From these collections, you can iterate through every object in the drawing.

To access drawing properties such as Title , Subject , Author , and Keywords , the AcadSummaryInfo interface, accessible as a property of the Document object, must be used.

To create or open a Document object, use the Open method.

Using Paper Space and Model Space
From the Document object, you control the model space and paper space settings. By default, a drawing is opened in the model space, with the tiled viewport setting. Use the ActiveSpace property, MSpace property, and the Display method to control the model space and paper space settings. See the PViewport object for more information about using these properties and methods.
Resetting Active Objects
Changes to most active objects, such as the active layer and active linetype, are displayed immediately. However, several objects must be reset for changes to appear. These objects are the active text style, active UCS, and the active viewport. To reset the objects, simply call the ActiveTextStyle, ActiveUCS, or ActiveViewport property, using the updated object.


Documents Collection (ActiveX)

The collection of all AutoCAD drawings that are open in the current session.

Supported Platforms: Windows only

Class Information

Class Name

AcadDocuments

Object Inheritance
Object
   AcadObject
      AcadDocuments
Create Using

VBA

Not applicable
Access Via

VBA

Application.Documents

Members

These members are part of this object:

Methods | Properties | Events
Add Close Item Open | Application Count | None

Remarks

To add a new member to the collection, use the Add or Open methods. To select a specific document, use the Item method. To close a specific document, use the Close method found on the Document object. To close all documents, use the Close method found on this collection.

There is no limit to the number of documents that you can create in your drawing. However, there can be only one instance of the Documents collection. The Documents collection is predefined for each application. You can make multiple references to it by using the Documents property. Once done with an object, the reference is automatically released.


DwfUnderlay Object (ActiveX)

A source of DWF/DWFx underlay content.

Supported Platforms: Windows only

Class Information

Class Name

AcadDwfUnderlay

Object Inheritance
Object
   AcadObject AcadEntity
         AcadUnderlay
            AcadDwfUnderlay
Create Using

VBA

Not applicable
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular ClipBoundary Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | AdjustForBackground Application ClippingEnabled Contrast Document EntityTransparency Fade File Handle HasExtensionDictionary Height Hyperlinks ItemName Layer Linetype LinetypeScale Lineweight Material Monochrome ObjectID ObjectName OwnerID PlotStyleName Position Rotation ScaleFactor TrueColor UnderlayLayerOverrideApplied UnderlayName UnderlayVisibility Visible Width | Modified

Remarks

Underlays are similar to raster images, except that users can snap to the content of an underlay. The AcadDwfUnderlay class supports DWF/DWFx files as underlays to AutoCAD drawings.


DynamicBlockReferenceProperty Object (ActiveX)

An object containing the properties of a dynamic block.

Supported Platforms: Windows only

Class Information

Class Name

AcadDynamicBlockReferenceProperty

Object Inheritance
Object
   AcadDynamicBlockReferenceProperty
Create Using

VBA

Not applicable
Access Via

VBA

BlockRef.GetDynamicBlockProperties

Members

These members are part of this object:

Methods | Properties | Events
None | AllowedValues Description PropertyName ReadOnly Show UnitsType Value | None

Remarks

You cannot create this object; GetDynamicBlockProperties method returns a collection of DynamicBlockReferenceProperty objects if the block reference is a dynamic block containing custom properties.


Ellipse Object (ActiveX)

An elliptical arc or full ellipse.

Supported Platforms: Windows only

Class Information

Class Name

AcadEllipse

Object Inheritance
Object
   AcadObject AcadEntity
         AcadEllipse
Create Using

VBA

ModelSpace.AddEllipse
PaperSpace.AddEllipse
Block.AddEllipse
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Offset Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Area Center Document EndAngle EndParameter EndPoint EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Linetype LinetypeScale Lineweight MajorAxis MajorRadius Material MinorAxis MinorRadius Normal ObjectID ObjectName OwnerID PlotStyleName RadiusRatio StartAngle StartParameter StartPoint TrueColor Visible | Modified

Remarks

The ellipse may be closed or open (elliptical arc). This object represents a true ellipse, not a polyline approximation.

To create an ellipse, use the AddEllipse method.


ExternalReference Object (ActiveX)

An instance of an external reference inserted into a drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadExternalReference

Object Inheritance
Object
   AcadObject AcadEntity AcadBlockReference
            AcadExternalReference
Create Using

VBA

ModelSpace.AttachExternalReference
PaperSpace.AttachExternalReference
Block.AttachExternalReference
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular ConvertToAnonymousBlock ConvertToStaticBlock Copy Delete Explode GetAttributes GetBoundingBox GetConstantAttributes GetDynamicBlockProperties GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move ResetBlock Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Document EffectiveName EntityTransparency Handle HasAttributes HasExtensionDictionary Hyperlinks InsertionPoint InsUnits InsUnitsFactor IsDynamicBlock Layer Linetype LinetypeScale Lineweight Material Name Normal ObjectID ObjectName OwnerID Path PlotStyleName Rotation TrueColor Visible XEffectiveScaleFactor XScaleFactor YEffectiveScaleFactor YScaleFactor ZEffectiveScaleFactor ZScaleFactor | Modified

Remarks

An external reference (xref) links another drawing to the current drawing. When you insert a drawing as a block, the block definition and all the associated geometry is stored in the current drawing database. It is not updated if the original drawing changes. When you insert a drawing as an xref, however, it is updated when the original drawing changes. A drawing containing xrefs always reflects the most current edits of each externally referenced file.

Like a block reference, AutoCAD displays an xref in the current drawing as a single object. However, an xref does not significantly increase the file size of the current drawing and cannot be exploded. As with block references, you can nest xrefs that are attached to your drawing.


ExtrudedSurface Object (ActiveX)

A surface created by extruding an object or a planar face a specified distance and direction.

Supported Platforms: Windows only

Class Information

Class Name

AcadExtrudedSurface

Object Inheritance
Object
   AcadObject AcadEntity AcadSurface
            AcadExtrudedSurface
Create Using

VBA

Not applicable
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Direction Document EdgeExtensionDistances EntityTransparency Handle HasExtensionDictionary Height Hyperlinks Layer Linetype LinetypeScale Lineweight MaintainAssociativity Material ObjectID ObjectName OwnerID PlotStyleName ShowAssociativity SurfaceType SurfTrimAssociativity TaperAngle TrueColor UIsolineDensity Visible VIsolineDensity WireframeType | Modified

Remarks

This object provides access to extruded surfaces in AutoCAD. It lets you manipulate properties of the surface. You cannot create a surface entity via ActiveX.


FileDependencies Collection (ActiveX)

Creates, updates, retrieves, and removes items in the File Dependency List.

Supported Platforms: Windows only

Class Information

Class Name

AcadFileDependencies

Object Inheritance
Object
   AcadFileDependencies
Create Using

VBA

Not applicable
Access Via

VBA

Document.FileDependencies

Members

These members are part of this object:

Methods | Properties | Events
CreateEntry IndexOf Item RemoveEntry UpdateEntry | Application Count | None

Remarks

Files in the AutoCAD 2004 drawing-file format contain a File Dependency List. The File Dependency List is a list of the files on which the drawing file depends. You can perform operations on the File Dependency List using the FileDependencies collection.


FileDependency Object (ActiveX)

Provides information about entries in the File Dependency List of a drawing file.

Supported Platforms: Windows only

Class Information

Class Name

AcadFileDependency

Object Inheritance
Object
   AcadFileDependency
Create Using

VBA

FileDependencies.CreateEntry
Access Via

VBA

FileDependencies.Item

Members

These members are part of this object:

Methods | Properties | Events
None | AffectsGraphics Feature FileName FileSize FingerprintGUID FoundPath FullFileName Index IsModified ReferenceCount TimeStamp VersionGUID | None

Remarks

The FileDependency object describes an entry in the File Dependency List. The files on which a drawing file depends are in its File Dependency List.


GeomapImage Object (ActiveX)

An embedded raster image which is captured from a portion of LiveMap.

Supported Platforms: Windows only

Class Information

Class Name

AcadGeomapImage

Object Inheritance
Object
   AcadObject AcadEntity AcadRasterImage
            AcadGeomapImage
Create Using

VBA

Not applicable
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular ClipBoundary Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Brightness ClippingEnabled Contrast Document EntityTransparency Fade GeoImageBrightness GeoImageContrast GeoImageFade GeoImageHeight GeoImagePosition GeoImageWidth Handle HasExtensionDictionary Height Hyperlinks ImageFile ImageHeight ImageVisibility ImageWidth Layer Linetype LinetypeScale Lineweight Material Name ObjectID ObjectName Origin OwnerID PlotStyleName Rotation ScaleFactor ShowRotation Transparency TrueColor Visible Width | None

Remarks

It lets you manipulate the properties of an embedded image that is captured from a LiveMap. You cannot create a GeomapImage entity via ActiveX.


GeoPositionMarker Object (ActiveX)

A geographical location aware marker object with a label.

Supported Platforms: Windows only

Class Information

Class Name

AcadGeoPositionMarker

Object Inheritance
Object
   AcadObject AcadEntity
         AcadGeoPositionMarker
Create Using

VBA

Not applicable
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Altitude Application BackgroundFill Document DrawingDirection EntityTransparency Handle HasExtensionDictionary Height LandingGap Latitude Layer LineSpacingDistance LineSpacingFactor LineSpacingStyle Linetype LinetypeScale Lineweight Longitude Material Notes ObjectID ObjectName OwnerID PlotStyleName Position Radius Rotation TextFrameDisplay TextJustify TextString TextStyleName TextWidth TrueColor Visible | Modified

Remarks

It lets you manipulate the properties of a geographically positioned marker. You cannot create a GeoPositionMarker entity via ActiveX.


Group Object (ActiveX)

A named SelectionSet object.

Supported Platforms: Windows only

Class Information

Class Name

AcadGroup

Object Inheritance
Object
   AcadObject
      AcadGroup
Create Using

VBA

Groups.Add
Access Via

VBA

Groups.Item

Members

These members are part of this object:

Methods | Properties | Events
AppendItems Delete GetExtensionDictionary GetXData Highlight Item RemoveItems SetXData Update | Application Count Document Handle HasExtensionDictionary Layer Linetype LinetypeScale Lineweight Material Name ObjectID ObjectName OwnerID PlotStyleName TrueColor Visible | Modified

Remarks

For more information about selection sets, see the SelectionSet object.

To create a group, use the Add method.


Groups Collection (ActiveX)

The collection of all groups in the drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadGroups

Object Inheritance
Object
   AcadObject
      AcadGroups
Create Using

VBA

Not applicable
Access Via

VBA

Document.Groups

Members

These members are part of this object:

Methods | Properties | Events
Add GetExtensionDictionary GetXData Item SetXData | Application Count Document Handle HasExtensionDictionary ObjectID ObjectName OwnerID | Modified

Remarks

To add a new member to the collection, use the Add method. To select a specific group, use the Item method.

Although the Groups collection inherits a Delete method, you cannot actually delete the collection. Attempting to delete the Groups collection will result in an error, therefore the Delete method has been removed from the documentation for this collection.

There is no limit to the number of groups you can create in your drawing. However, there can be only one instance of the Groups collection. The Groups collection is predefined for each drawing. You can make multiple references to it by using the Groups property. Once done with an object, the reference is automatically released.


Hatch Object (ActiveX)

An area fill consisting of a pattern of lines.

Supported Platforms: Windows only

Class Information

Class Name

AcadHatch

Object Inheritance
Object
   AcadObject AcadEntity
         AcadHatch
Create Using

VBA

ModelSpace.AddHatch
PaperSpace.AddHatch
Block.AddHatch
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
AppendInnerLoop AppendOuterLoop ArrayPolar ArrayRectangular Copy Delete Evaluate GetBoundingBox GetExtensionDictionary GetLoopAt GetXData Highlight InsertLoopAt IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetPattern SetXData TransformBy Update | Application Area AssociativeHatch BackgroundColor Document Elevation EntityTransparency GradientAngle GradientCentered GradientColor1 GradientColor2 GradientName Handle HasExtensionDictionary HatchObjectType HatchStyle Hyperlinks ISOPenWidth Layer Linetype LinetypeScale Lineweight Material Normal NumberOfLoops ObjectID ObjectName Origin OwnerID PatternAngle PatternDouble PatternName PatternScale PatternSpace PatternType PlotStyleName TrueColor Visible | Modified

Remarks

To create a hatch, first create the Hatch object using the AddHatch method. After the Hatch object has been created, add the outer loop using the AppendOuterLoop method. The outer loop must be closed and must be created before any inner loops can be added. After a valid outer loop has been created, add any inner loops, one at a time, using AppendInnerLoop method.

WarningOnce the Hatch object has been created, you must add the outer loop to the Hatch object for it to become a valid AutoCAD object. If you attempt any operation other than calling the AppendOuterLoop method, AutoCAD will enter an unpredictable state.


Helix Object (ActiveX)

A helix.

Supported Platforms: Windows only

Class Information

Class Name

AcadHelix

Object Inheritance
Object
  AcadObject AcadEntity
         AcadHelix
Create Using

VBA

Not applicable
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application BaseRadius Constrain Document EntityTransparency Handle HasExtensionDictionary Height Hyperlinks Layer Linetype LinetypeScale Lineweight Material ObjectID ObjectName OwnerID PlotStyleName Position TopRadius TotalLength TrueColor TurnHeight Turns TurnSlope Twist Visible | Modified

Remarks

The Helix object encapsulates a Spline object that helps it maintain its basic shape. You can use ActiveX to query and edit Helix entities in an AutoCAD drawing. However, you cannot create a Helix object with ActiveX.


Hyperlink Object (ActiveX)

A URL and URL description.

Supported Platforms: Windows only

Class Information

Class Name

AcadHyperlink

Object Inheritance
Object
   AcadHyperlink
Create Using

VBA

Hyperlinks.Add
Access Via

VBA

Hyperlinks.Item

Members

These members are part of this object:

Methods | Properties | Events
Delete | Application URL URLDescription URLNamedLocation | None

Remarks

URL and URL descriptions are stored within the XData of their corresponding object. The Hyperlink objects themselves are not stored with the drawing. This means that every time you request the Hyperlink object for an object, a new Hyperlink object is created and the URL and URL description for that hyperlink is read out of the XData. Because of this, you should be careful to avoid creating multiple Hyperlink objects to reference the same URL information. Updating one of these Hyperlink objects would not update the second object.

To create a hyperlink use the Add method.


Hyperlinks Collection (ActiveX)

The collection of all hyperlinks for a given object.

Supported Platforms: Windows only

Class Information

Class Name

AcadHyperlinks

Object Inheritance
Object
   AcadHyperlinks
Create Using

VBA

Not applicable
Access Via

VBA

Hyperlinks property found on all objects

Members

These members are part of this object:

Methods | Properties | Events
Add Item | Application Count | None

Remarks

To add a new member to the collection, use the Add method. To select a specific Hyperlink , use the Item method. To delete a specific Hyperlink, use the Delete method found in the Hyperlink object.


IAcadDatabase Interface (ActiveX)

The contents of the database associated with the Document object.

Supported Platforms: Windows only

Class Information

Class Name

AcadDatabase

Object Inheritance
Object
   AcadDatabase
Create Using

VBA

Not applicable
Access Via

VBA

Document.Database

Members

These members are part of this object:

Methods | Properties | Events
CopyObjects HandleToObject ObjectIDToObject | Application Blocks Dictionaries DimStyles ElevationModelSpace ElevationPaperSpace FileDependencies Groups Layers Layouts Limits Linetypes ModelSpace PaperSpace PlotConfigurations Preferences RegisteredApplications SectionManager SummaryInfo TextStyles UserCoordinateSystems Viewports Views | None

Remarks

Provides an interface to the database resident objects in an AutoCAD document.


IAcadDimension Interface (ActiveX)

The common interface for AutoCAD dimensions.

Supported Platforms: Windows only

Class Information

Class Name

AcadDimension

Object Inheritance
Object
   AcadObject AcadEntity
         AcadDimension
Create Using

VBA

<object>.AddDim3PointAngular
<object>.AddDimAligned
<object>.AddDimAngular
<object>.AddDimArc
<object>.AddDimDiametric
<object>.AddDimOrdinate
<object>.AddDimRadial
<object>.AddDimRadialLarge
<object>.AddDimRotated
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application DecimalSeparator DimTxtDirection Document EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Linetype LinetypeScale Lineweight Material Normal ObjectID ObjectName OwnerID PlotStyleName Rotation ScaleFactor StyleName SuppressLeadingZeros SuppressTrailingZeros TextColor TextFill TextFillColor TextGap TextHeight TextMovement TextOverride TextPosition TextPrefix TextRotation TextStyle TextSuffix ToleranceDisplay ToleranceHeightScale ToleranceJustification ToleranceLowerLimit TolerancePrecision ToleranceSuppressLeadingZeros ToleranceSuppressTrailingZeros ToleranceUpperLimit TrueColor VerticalTextPosition Visible | Modified

Remarks

IAcadDimension interface represents the common interface for all AutoCAD dimensions.


IAcadEntity Interface (ActiveX)

The standard interface for a basic AutoCAD entity.

Supported Platforms: Windows only

Class Information

Class Name

AcadEntity

Object Inheritance
Object
   AcadObject
      AcadEntity
Create Using

VBA

ModelSpace.Add<object>
PaperSpace.Add<object>
Block.Add<object>
ModelSpace.AttachExternalReference
PaperSpace.AttachExternalReference
Block.AttachExternalReference
ModelSpace.InsertBlock
PaperSpace.InsertBlock
Block.InsertBlock
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Document EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Linetype LinetypeScale Lineweight Material ObjectID ObjectName OwnerID PlotStyleName TrueColor Visible | Modified

Remarks

IAcadEntity interface represents the default interface for AutoCAD entities.

If you are familiar with the ObjectARX environment you will see that IAcadEntity exposes AcDbEntity functionality.


IAcadMLeaderLeader Interface (ActiveX)

AutoCAD Multileader Leader Line Interface.

Supported Platforms: Windows only

Class Information

Class Name

AcadMLeaderLeader

Object Inheritance
Object
   AcadSubEntity
      AcadMLeaderLeader
Create Using

VBA

MLeader.AddLeader
MLeader.AddLeaderLine
MLeader.AddLeaderLineEx
Access Via

VBA

MLeader.GetLeaderIndex
MLeader.GetLeaderLineIndexes
MLeader.GetLeaderLineVertices

Members

These members are part of this object:

Methods | Properties | Events
None | ArrowheadBlock ArrowheadSize ArrowheadType Color Hyperlinks Layer LeaderLineColor LeaderLinetype LeaderLineWeight LeaderType Linetype LinetypeScale Lineweight ObjectName PlotStyleName | Modified

Remarks

IAcadMLeaderLeader interface represents one leader line of the multileader.


IAcadObject Interface (ActiveX)

The standard interface for a basic AutoCAD object.

Supported Platforms: Windows only

Class Information

Class Name

AcadObject

Object Inheritance
Object
   AcadObject
Create Using

VBA

ModelSpace.Add<object>
PaperSpace.Add<object>
Block.Add<object>
ModelSpace.AttachExternalReference
PaperSpace.AttachExternalReference
Block.AttachExternalReference
ModelSpace.InsertBlock
PaperSpace.InsertBlock
Block.InsertBlock
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
Delete GetExtensionDictionary GetXData SetXData | Application Document Handle HasExtensionDictionary ObjectID ObjectName OwnerID | Modified

Remarks

IAcadObject interface represents the default interface for most AutoCAD objects.

If you are familiar with the ObjectARX environment, you will see that IAcadObject exposes AcDbObject functionality.


IAcadObjectEvents Interface (ActiveX)

The event interface for a basic AutoCAD object.

Supported Platforms: Windows only

Class Information

Class Name

AcadObjectEvents

Object Inheritance
Object
   AcadObjectEvents
Create Using

VBA

Not applicable
Access Via

VBA

Not applicable

Members

These members are part of this object:

Methods | Properties | Events
None | None | Modified

Remarks

IAcadObject interface represents the event interface for most AutoCAD objects.


IDPair Object (ActiveX)

A special object for use with the CopyObjects method that contains the object IDs of both the source and destination objects.

Supported Platforms: Windows only

Class Information

Class Name

AcadIDPair

Object Inheritance
Object
   AcadIDPair
Create Using

VBA

User-defined variable, populated through the CopyObjects method
Access Via

VBA

User-defined variable

Members

These members are part of this object:

Methods | Properties | Events
None | Application IsCloned IsOwnerXlated IsPrimary Key Value | None

Remarks

The IDPair object is a transient object that is used as an optional parameter in the CopyObjects method. The CopyObjects method populates the IDPair object with the object IDs of the source objects, and the newly created copied objects, thus creating a map between all of the objects that are copied and created.

The IDPair object returns all objects that are copied in the operation. This includes the primary set of objects being copied, as well as any objects owning, or owned by, the primary objects. The IDPair object also contains information about the copy and translation process.

NoteThis object is used for advanced cloning functions. General users should avoid using this optional functionality.


Layer Object (ActiveX)

A logical grouping of data, similar to transparent acetate overlays on a drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadLayer

Object Inheritance
Object
   AcadObject
      AcadLayer
Create Using

VBA

Layers.Add
Access Via

VBA

Layers.Item
Document.ActiveLayer

Members

These members are part of this object:

Methods | Properties | Events
Delete GetExtensionDictionary GetXData SetXData | Application Description Document Freeze Handle HasExtensionDictionary LayerOn Linetype Lineweight Lock Material Name ObjectID ObjectName OwnerID PlotStyleName Plottable TrueColor Used ViewportDefault | Modified

Remarks

All new objects are added to the active layer. To make a layer active, use the ActiveLayer property.

To create a layer, use the Add method.


Layers Collection (ActiveX)

The collection of all layers in the drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadLayers

Object Inheritance
Object
   AcadObject
      AcadLayers
Create Using

VBA

Not applicable
Access Via

VBA

Document.Layers

Members

These members are part of this object:

Methods | Properties | Events
Add GenerateUsageData GetExtensionDictionary GetXData Item SetXData | Application Count Document Handle HasExtensionDictionary ObjectID ObjectName OwnerID | Modified

Remarks

To add a new member to the collection, use the Add method. To select a specific layer, use the Item method.

Although the Layers collection inherits a Delete method, you cannot actually delete the collection. Attempting to delete the Layers collection will result in an error. The Delete method has been removed from the documentation for this collection.

There is no limit to the number of layers that you can create in your drawing. However, there can be only one instance of the Layers collection. The Layers collection is predefined for each drawing. You can make multiple references to it by using the Layers property. Once done with an object, the reference is automatically released.


LayerStateManager Object (ActiveX)

Saves and restores layer settings.

Supported Platforms: Windows only

Class Information

Class Name

AcadLayerStateManager

Object Inheritance
Object
   AcadLayerStateManager
Create Using

VBA

Not applicable
Access Via

VBA

GetInterfaceObject("AutoCAD.AcadLayerStateManager.20")

Members

These members are part of this object:

Methods | Properties | Events
Delete Export Import Rename Restore Save SetDatabase | Mask | None

Remarks

The LayerStateManager object provides a set of functions for working with saved layer settings. The LayerStateManager manipulates XRecord objects that define the properties of a layer. These XRecords are stored in the ACAD_LAYERSTATE dictionary, which is an extension dictionary in the drawing's Layers collection. (An extension dictionary is a mechanism for attaching data to objects. Every object can have an extension dictionary.)

After you retrieve the LayerStateManager object, you must associate a database with it before you can access the object's methods. Use the SetDatabase method to associate a database with the LayerStateManager object.


Layout Object (ActiveX)

The plot settings and visual properties of a model space or paper space block.

Supported Platforms: Windows only

Class Information

Class Name

AcadLayout

Object Inheritance
Object
   AcadObject AcadPlotConfiguration
         AcadLayout
Create Using

VBA

Layouts.Add
Access Via

VBA

Layouts.Item
Document.ActiveLayout
ModelSpace.Layout
PaperSpace.Layout
Block.Layout

Members

These members are part of this object:

Methods | Properties | Events
CopyFrom Delete GetCanonicalMediaNames GetCustomScale GetExtensionDictionary GetLocaleMediaName GetPaperMargins GetPaperSize GetPlotDeviceNames GetPlotStyleTableNames GetWindowToPlot GetXData RefreshPlotDeviceInfo SetCustomScale SetWindowToPlot SetXData | Application Block CanonicalMediaName CenterPlot ConfigName Document Handle HasExtensionDictionary ModelType Name ObjectID ObjectName OwnerID PaperUnits PlotHidden PlotOrigin PlotRotation PlotType PlotViewportBorders PlotViewportsFirst PlotWithLineweights PlotWithPlotStyles ScaleLineweights ShowPlotStyles StandardScale StyleSheet TabOrder UseStandardScale ViewToPlot | Modified

Remarks

The representation of a layout is slightly different in ActiveX from that of the AutoCAD user interface. In ActiveX, the content of a standard AutoCAD layout is broken out into two separate objects: Layout object and Block object. The Layout object contains the plot settings and the visual properties of the layout as it appears in the AutoCAD user interface. The Block object contains the geometry for the layout.

Each Layout object is associated with one Block object. To access the Block object associated with a given layout, use the Block property. Conversely, each Block object is associated with one Layout object. To access the Layout object associated with a given Block, use the Layout property for that block.

In ActiveX, in addition to the paper space layouts, model space is considered a layout.

To create a new layout, use the Add method.


Layouts Collection (ActiveX)

The collection of all layouts in the drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadLayouts

Object Inheritance
Object
   AcadObject
      AcadLayouts
Create Using

VBA

Not applicable
Access Via

VBA

Document.Layouts

Members

These members are part of this object:

Methods | Properties | Events
Add GetExtensionDictionary GetXData Item SetXData | Application Count Document Handle HasExtensionDictionary ObjectID ObjectName OwnerID | None

Remarks

To add a new Layout to the collection, use the Add method. When a new layout is created, it is not automatically made current. To make a layout current, use the ActiveLayout property.

You can create a maximum of 255 layouts in your drawing. There can be only one instance of the Layouts collection. The Layouts collection is predefined for each document.

To select a specific layout, including the ModelSpace and PaperSpace collections, use the Item method.

Although the Layouts collection inherits a Delete method, you cannot actually delete the collection. Attempting to delete the Layouts collection will result in an error. The Delete method has been removed from the documentation for this collection.


Leader Object (ActiveX)

An object composed of an arrowhead attached to splines or straight line segments.

Supported Platforms: Windows only

Class Information

Class Name

AcadLeader

Object Inheritance
Object
   AcadObject AcadEntity
         AcadLeader
Create Using

VBA

ModelSpace.AddLeader
PaperSpace.AddLeader
Block.AddLeader
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete Evaluate GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Annotation Application ArrowheadBlock ArrowheadSize ArrowheadType Coordinate Coordinates DimensionLineColor DimensionLineWeight Document EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Linetype LinetypeScale Lineweight Material Normal ObjectID ObjectName OwnerID PlotStyleName ScaleFactor StyleName TextGap TrueColor Type VerticalTextPosition Visible | Modified

Remarks

A leader line is an object that can be composed of an arrowhead attached to splines or straight line segments. In some cases, a short horizontal line, called a hook line, dogleg, or landing, connects text and feature control frames to the leader line. The Leader object specifies a complex leader line. In contrast, the Leader property of the DimDiametric and DimRadial objects specifies a simple leader line.

Any annotation attached to the end of the leader line is associated with the Leader object and can be found using the Annotation property.

You can use various dimensioning system variables to format the leader line, such as placing text above the hook line with the DIMTAD system variable. The color of the leader line and arrowhead is controlled by the TrueColor property, or by the DIMCLRD system variable. The arrowhead types are specified by the DIMBLK, or DIMBLK1 system variables when the arrowheads vary. The arrowhead and hook line length is determined by the DIMASZ system variable. The scale is set by the DIMSCALE system variable, and the basic dimension notation is set by the DIMGAP system variable.

Examples of AutoCAD leader objects

To create a leader, use the AddLeader method.


LWPolyline Object (ActiveX)

A 2D line with adjustable width composed of line and arc segments.

Supported Platforms: Windows only

Class Information

Class Name

AcadLWPolyline

Object Inheritance
Object
   AcadObject AcadEntity
         AcadLWPolyline
Create Using

VBA

ModelSpace.AddLightweightPolyline
PaperSpace.AddLightweightPolyline
Block.AddLightweightPolyline
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
AddVertex ArrayPolar ArrayRectangular Copy Delete Explode GetBoundingBox GetBulge GetExtensionDictionary GetWidth GetXData Highlight IntersectWith Mirror Mirror3D Move Offset Rotate Rotate3D ScaleEntity SetBulge SetWidth SetXData TransformBy Update | Application Area Closed ConstantWidth Coordinate Coordinates Document Elevation EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Length Linetype LinetypeGeneration LinetypeScale Lineweight Material Normal ObjectID ObjectName OwnerID PlotStyleName Thickness TrueColor Visible | Modified

Remarks

To create a lightweight polyline, use the AddLightweightPolyline method.


Line Object (ActiveX)

A single line segment.

Supported Platforms: Windows only

Class Information

Class Name

AcadLine

Object Inheritance
Object
   AcadObject AcadEntity
         AcadLine
Create Using

VBA

ModelSpace.AddLine
PaperSpace.AddLine
Block.AddLine
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Offset Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Angle Application Delta Document EndPoint EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Length Linetype LinetypeScale Lineweight Material Normal ObjectID ObjectName OwnerID PlotStyleName StartPoint Thickness TrueColor Visible | Modified

Remarks

Lines can be one segment or a series of connected segments, but each segment is a separate Line object. Use the Line object if you want to edit individual segments. If you need to draw a series of line segments as a single object, use the LWPolyline object.

To create a line, use the AddLine method.


Linetype Object (ActiveX)

The line characteristics consisting of combinations of dashes, dots, and spaces.

Supported Platforms: Windows only

Class Information

Class Name

AcadLinetype

Object Inheritance
Object
   AcadObject
      AcadLinetype
Create Using

VBA

Linetypes.Add
Linetypes.Load
Access Via

VBA

Linetypes.Item
Document.ActiveLinetype

Members

These members are part of this object:

Methods | Properties | Events
Delete GetExtensionDictionary GetXData SetXData | Application Description Document Handle HasExtensionDictionary Name ObjectID ObjectName OwnerID | Modified

Remarks

You can only create default linetypes programmatically using the Add method. However, you can load an existing linetype to your drawing programmatically using the Load method.

There is no limit to the number of linetypes that can exist in your drawing. However, only one linetype can be active at a time. New objects are created with the linetype that is specified for the active layer. If no linetype has been specified for the active layer, new objects are created with the active linetype. To make a linetype active, use the ActiveLinetype property.

To add an existing linetype to your drawing, use either the Add or Load method.


Linetypes Collection (ActiveX)

The collection of all linetypes in the drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadLineTypes

Object Inheritance
Object
   AcadObject
      AcadLineTypes
Create Using

VBA

Not applicable
Access Via

VBA

Document.Linetypes

Members

These members are part of this object:

Methods | Properties | Events
Add GetExtensionDictionary GetXData Item Load SetXData | Application Count Document Handle HasExtensionDictionary ObjectID ObjectName OwnerID | Modified

Remarks

To add a new member to the collection, use the Add method. To select a specific linetype, use the Item method.

Although the Linetypes collection inherits a Delete method, you cannot actually delete the collection. Attempting to delete the Linetypes collection will result in an error. The Delete method has been removed from the documentation for this collection.

There is no limit to the number of linetypes that you can create in your drawing. However, there can be only one instance of the Linetypes collection that is predefined for each drawing. You can make multiple references to it by using the Linetypes property. Once done with an object, the reference is automatically released.


LoftedSurface Object (ActiveX)

A surface created by lofting through a set of two or more curves.

Supported Platforms: Windows only

Class Information

Class Name

AcadLoftedSurface

Object Inheritance
Object
   AcadObject AcadEntity
         AcadLoftedSurface
Create Using

VBA

Not applicable
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Closed Document EdgeExtensionDistances EndDraftAngle EndDraftMagnitude EndSmoothContinuity EndSmoothMagnitude EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Linetype LinetypeScale Lineweight MaintainAssociativity Material NumCrossSections NumGuidePaths ObjectID ObjectName OwnerID Periodic PlotStyleName ShowAssociativity StartDraftAngle StartDraftMagnitude StartSmoothContinuity StartSmoothMagnitude SurfaceNormals SurfaceType SurfTrimAssociativity TrueColor UIsolineDensity Visible VIsolineDensity WireframeType | Modified

Remarks

You can use ActiveX to query and edit LoftedSurface entities in AutoCAD drawings. You cannot create a LoftedSurface object with ActiveX. A lofted surface is created in AutoCAD by drawing a solid or surface through a set of two or more cross-section curves. The cross sections define the profile (shape) of the resulting solid or surface. Cross sections (generally, curves or lines) can be open (for example, an arc) or closed (for example, a circle).


Material Object (ActiveX)

The render material characteristics.

Supported Platforms: Windows only

Class Information

Class Name

AcadMaterial

Object Inheritance
Object
   AcadObject
      AcadMaterial
Create Using

VBA

Materials.Add
Access Via

VBA

Document.ActiveMaterial
Materials.Item

Members

These members are part of this object:

Methods | Properties | Events
Delete GetExtensionDictionary GetXData SetXData | Application Description Document Handle HasExtensionDictionary Name ObjectID ObjectName OwnerID | Modified

Remarks

To set the visual properties of a material, use the MATERIALS command in AutoCAD. Use the Material property to retrieve the name of the material applied to Group , Layer , and Block objects, and SubEntSolidFace entities.


Materials Collection (ActiveX)

The collection of all materials in the drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadMaterials

Object Inheritance
Object
   AcadObject
      AcadMaterials
Create Using

VBA

Not applicable
Access Via

VBA

Database.Materials

Members

These members are part of this object:

Methods | Properties | Events
Add GetExtensionDictionary GetXData Item SetXData | Application Count Document Handle HasExtensionDictionary ObjectID ObjectName OwnerID | Modified

Remarks

Use the Materials object to access materials defined in a drawing. You can create new materials by using the Add method.

Although the Materials collection inherits a Delete method, you cannot actually delete the collection. Attempting to delete this collection will result in an error. The Delete method has been removed from the documentation for this collection.


MenuBar Collection (ActiveX)

A collection of PopupMenu objects representing the current AutoCAD menu bar.

Supported Platforms: Windows only

Class Information

Class Name

AcadMenuBar

Object Inheritance
Object
   AcadMenuBar
Create Using

VBA

Not applicable
Access Via

VBA

Application.MenuBar

Members

These members are part of this object:

Methods | Properties | Events
Item | Application Count Parent | None

Remarks

The MenuBar object contains all the menus that are currently displayed on the AutoCAD menu bar. Any menu from a currently loaded menu group can be displayed on the menu bar.

To display a menu on the menu bar, use the InsertInMenuBar method found on the PopupMenu object. To remove a menu from the current menu bar, use the RemoveFromMenuBar method also found on the PopupMenu object.

You cannot create or delete the MenuBar collection.


MenuGroup Object (ActiveX)

An AutoCAD menu group.

Supported Platforms: Windows only

Class Information

Class Name

AcadMenuGroup

Object Inheritance
Object
   AcadMenuGroup
Create Using

VBA

MenuGroups.Load
Access Via

VBA

MenuGroups.Item

Members

These members are part of this object:

Methods | Properties | Events
Save SaveAs Unload | Application MenuFileName Menus Name Parent Toolbars Type | None

Remarks

A menu group contains menus and toolbars, some or all of which may be currently displayed in AutoCAD.

Each menu group contains a PopupMenus collection and a Toolbars collection. The PopupMenus collection contains all the menus within the menu group and can be accessed through the Menus property. Likewise, the Toolbars collection contains all the toolbars within the menu group and can be accessed through the Toolbars property.

Menu groups are loaded into the AutoCAD session using the Load method. This method loads a specified customization file that contains the menu group. The menu group is then added to the MenuGroups collection. Once loaded, individual menus can be inserted into the menu bar and toolbars can be displayed. The Load method also provides a mechanism to load the menu group as the base menu in the same manner as the MENU command in AutoCAD. When a menu group is loaded as the base menu, the Type property for that menu group will be set to acBaseMenuGroup.


MenuGroups Collection (ActiveX)

A collection of MenuGroup objects representing all the menu groups loaded in the current AutoCAD session.

Supported Platforms: Windows only

Class Information

Class Name

AcadMenuGroups

Object Inheritance
Object
   AcadMenuGroups
Create Using

VBA

Not applicable
Access Via

VBA

Application.MenuGroups

Members

These members are part of this object:

Methods | Properties | Events
Item Load | Application Count Parent | None

Remarks

The MenuGroups collection contains all the menu groups that are loaded in the current AutoCAD session.

Menu groups contain all the menus that are available to the AutoCAD session, some or all of which may be displayed on the AutoCAD menu bar. In addition to the menus, the menu groups also contain all the toolbars that are available to the current AutoCAD session.

To load a new menu group into this collection, use the Load method.

To unload a menu group from this collection, use the Unload method found on the MenuGroup object.


MInsertBlock Object (ActiveX)

A rectangular array of block references.

Supported Platforms: Windows only

Class Information

Class Name

AcadMInsertBlock

Object Inheritance
Object
   AcadObject AcadEntity AcadBlockReference
            AcadMInsertBlock
Create Using

VBA

ModelSpace.AddMInsertBlock
PaperSpace.AddMInsertBlock
Block.AddMInsertBlock
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular ConvertToAnonymousBlock ConvertToStaticBlock Copy Delete Explode GetAttributes GetBoundingBox GetConstantAttributes GetDynamicBlockProperties GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move ResetBlock Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Columns ColumnSpacing Document EffectiveName EntityTransparency Handle HasAttributes HasExtensionDictionary Hyperlinks InsertionPoint InsUnits InsUnitsFactor IsDynamicBlock Layer Linetype LinetypeScale Lineweight Material Name Normal ObjectID ObjectName OwnerID PlotStyleName Rotation Rows RowSpacing TrueColor Visible XEffectiveScaleFactor XScaleFactor YEffectiveScaleFactor YScaleFactor ZEffectiveScaleFactor ZScaleFactor | Modified

Remarks

To add an MInsertBlock to your drawing, use the AddMInsertBlock method.

Original block

Array of inserted blocks


MLeader Object (ActiveX)

An object composed of an arrowhead attached to multiple splines or straight line segments.

Supported Platforms: Windows only

Class Information

Class Name

AcadMLeader

Object Inheritance
Object
   AcadObject AcadEntity
         AcadMLeader
Create Using

VBA

ModelSpace.AddMLeader
PaperSpace.AddMLeader
Block.AddMLeader
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
AddLeader AddLeaderLine AddLeaderLineEx ArrayPolar ArrayRectangular Copy Delete Evaluate GetBlockAttributeValue GetBoundingBox GetDoglegDirection GetExtensionDictionary GetLeaderIndex GetLeaderLineIndexes GetLeaderLineVertices GetVertexCount GetXData Highlight IntersectWith Mirror Mirror3D Move RemoveLeader RemoveLeaderLine Rotate Rotate3D ScaleEntity SetBlockAttributeValue SetDoglegDirection SetLeaderLineVertices SetXData TransformBy Update | Application ArrowheadBlock ArrowheadSize ArrowheadType BlockConnectionType BlockScale ContentBlockName ContentBlockType ContentType Document DogLegged DoglegLength EntityTransparency Handle HasExtensionDictionary Hyperlinks LandingGap Layer LeaderCount LeaderLineColor LeaderLineType LeaderLineWeight LeaderType Linetype LinetypeScale Lineweight Material Normal ObjectID ObjectName OwnerID PlotStyleName ScaleFactor StyleName TextAttachmentDirection TextBackgroundFill TextBottomAttachmentType TextDirection TextFrameDisplay TextHeight TextJustify TextLeftAttachmentType TextLineSpacingDistance TextLineSpacingFactor TextLineSpacingStyle TextRightAttachmentType TextRotation TextString TextStyleName TextTopAttachmentType TextWidth TrueColor Type Visible | Modified

Remarks

A multileader line is an object that can be composed of an arrowhead attached to multiple splines or straight line segments. In some cases, a short horizontal line, called a hook line, dogleg, or landing, connects text and feature control frames to the multileader line. The MLeader object specifies a complex leader line. In contrast, the MLeader property of the DimDiametric and DimRadial objects specifies a simple leader line.

Any annotation attached to the end of the leader line is associated with the MLeader object and can be found using the Annotation property.

To create an multileader, use the AddMLeader method.


MLeaderStyle Object (ActiveX)

Adds, modifies, and deletes MLeader styles.

Supported Platforms: Windows only

Class Information

Class Name

AcadMLeaderStyle

Object Inheritance
Object
   AcadObject
      AcadMLeaderStyle
Create Using

VBA

Dim Dictionary As AcadDictionary
Set Dictionary = Document.Dictionaries.Item("ACAD_MLEADERSTYLE")
Dictionary.AddObject("<Style Name>", "AcDbMLeaderStyle")
Access Via

VBA

Dim Dictionary As AcadDictionary
Set Dictionary = Document.Dictionaries.Item("ACAD_MLEADERSTYLE")
Dictionary.Item

Members

These members are part of this object:

Methods | Properties | Events
Delete GetBoundingBox GetXData SetXData | AlignSpace Annotative Application ArrowSize ArrowSymbol BitFlags Block BlockColor BlockConnectionType BlockRotation BlockScale BreakSize ContentType Description Document DoglegLength DrawLeaderOrderType DrawMLeaderOrderType EnableBlockRotation EnableBlockScale EnableDogleg EnableFrameText EnableLanding FirstSegmentAngleConstraint Handle HasExtensionDictionary LandingGap LeaderLineColor LeaderLineType LeaderLineTypeId LeaderLineWeight MaxLeaderSegmentsPoints Name ObjectID ObjectName OverwritePropChanged OwnerID ScaleFactor SecondSegmentAngleConstraint TextAlignmentType TextAngleType TextAttachmentDirection TextBottomAttachmentType TextColor TextHeight TextLeftAttachmentType TextRightAttachmentType TextString TextStyle TextTopAttachmentType | Modified

Remarks

You can use the MLeaderStyle object to store MLeader formatting. The object controls the initial formatting of a newly created MLeader object.


MLine Object (ActiveX)

Multiple parallel lines.

Supported Platforms: Windows only

Class Information

Class Name

AcadMLine

Object Inheritance
Object
   AcadObject AcadEntity
         AcadMLine
Create Using

VBA

ModelSpace.AddMLine
PaperSpace.AddMLine
Block.AddMLine
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Coordinates Document EntityTransparency Handle HasExtensionDictionary Hyperlinks Justification Layer Linetype LinetypeScale Lineweight Material MLineScale ObjectID ObjectName OwnerID PlotStyleName StyleName TrueColor Visible | Modifed

Remarks

MLine objects can be comprised of up to 16 lines.

To add an MLine to your drawing, use the AddMLine method.


ModelSpace Collection (ActiveX)

A special Block object containing all model space entities.

Supported Platforms: Windows only

Class Information

Class Name

AcadModelSpace

Object Inheritance
Object
   AcadObject AcadBlock
         AcadModelSpace
Create Using

VBA

Not applicable
Access Via

VBA

Document.ModelSpace

Members

These members are part of this object:

Methods | Properties | Events
Add3DFace Add3DMesh Add3DPoly AddArc AddAttribute AddBox AddCircle AddCone AddCustomObject AddCylinder AddDim3PointAngular AddDimAligned AddDimAngular AddDimArc AddDimDiametric AddDimOrdinate AddDimRadial AddDimRadialLarge AddDimRotated AddEllipse AddEllipticalCone AddEllipticalCylinder AddExtrudedSolid AddExtrudedSolidALongPath AddHatch AddLeader AddLightWeightPolyline AddLine AddMInsertBlock AddMLeader AddMLine AddMText AddPoint AddPolyfaceMesh AddPolyline AddRaster AddRay AddRegion AddRevolvedSolid AddSection AddShape AddSolid AddSphere AddSpline AddTable AddText AddTolerance AddTorus AddTrace AddWedge AddXLine AttachExternalReference GetExtensionDictionary GetXdata InsertBlock Item SetXdata | Application Comments Count Document Handle HasExtensionDictionary Layout Name ObjectID ObjectName Origin OwnerID Units | Modified

Remarks

This collection represents all the objects in model space. To add new objects to model space, use the Add* methods listed below.

Because this collection is actually a block, it possesses several block characteristics. For example, this collection has a Layout object associated with it. In addition, all the objects in this collection can also be found in the Blocks collection under a block named *MODEL_SPACE. Both the block named *MODEL_SPACE and the ModelSpace collection actually point to the same data. The ModelSpace collection was created to provide a faster and easier means of accessing the data in model space.

You cannot create or delete a ModelSpace collection. There is always one ModelSpace collection provided in the drawing. You cannot delete, detach, bind, unload, or reload ModelSpace like an external reference can be so those functions are not listed. Nor cannot you manipulate ModelSpace like you can with a block definition.


MText Object (ActiveX)

A paragraph of alphanumeric characters that fits within a nonprinting text boundary.

Supported Platforms: Windows only

Class Information

Class Name

AcadMtext

Object Inheritance
Object
   AcadObject AcadEntity
         AcadMtext
Create Using

VBA

ModelSpace.AddMText
PaperSpace.AddMText
Block.AddMText
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete FieldCode GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application AttachmentPoint BackgroundFill Document DrawingDirection EntityTransparency Handle HasExtensionDictionary Height Hyperlinks InsertionPoint Layer LineSpacingDistance LineSpacingFactor LineSpacingStyle Linetype LinetypeScale Lineweight Material Normal ObjectID ObjectName OwnerID PlotStyleName Rotation StyleName TextString TrueColor Visible Width | Modified

Remarks

You define the text boundary, which specifies the width and alignment of the paragraph. Each MText object is a single object, regardless of the number of lines it contains. The text boundary, although not plotted or printed, remains part of the object's framework.

MText objects use word wrap to break long lines into paragraphs. AutoCAD automatically breaks lines at the edge of the text boundary, as specified by the Width property.

Note that RTF text is not recognized. Text from other programs with embedded formatting will lose formatting when imported into an multiline text paragraph.

To create an MText object use the AddMText method.


NurbSurface Object (ActiveX)

A surface created when NURBS creation is enabled while creating procedural or complex 3D surfaces, or by converting existing surfaces.

Supported Platforms: Windows only

Class Information

Class Name

AcadNurbSurface

Object Inheritance
Object
   AcadObject AcadEntity AcadSurface
            AcadNurbSurface
Create Using

VBA

Not applicable
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application CvHullDisplay Document EdgeExtensionDistances EntityTransparency Handle HasExtensionDictionary Height Hyperlinks Layer Linetype LinetypeScale Lineweight MaintainAssociativity Material ObjectID ObjectName OwnerID PlotStyleName ShowAssociativity SurfaceType SurfTrimAssociativity TrueColor UIsolineDensity Visible VIsolineDensity WireframeType | Modified

Remarks

This object provides access to NURBS surfaces in AutoCAD. It lets you manipulate properties of the surface. You cannot create a NURBS surface entity via ActiveX.

NURBS surfaces can be created with the LOFT, SWEEP, EXTRUDE, REVOLVE, SURFPATH, SURFBLEND, SURFOFFSET, and several other commands.


OLE Object (ActiveX)

An AutoCAD OLE object.

Supported Platforms: Windows only

Class Information

Class Name

AcadOle

Object Inheritance
Object
   AcadObject AcadEntity
         AcadOle
Create Using

VBA

Not applicable
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Document EntityTransparency Handle HasExtensionDictionary Height Hyperlinks InsertionPoint Layer Linetype LinetypeScale Lineweight LockAspectRatio Material ObjectID ObjectName OleItemType OlePlotQuality OleSourceApp OwnerID PlotStyleName Rotation ScaleHeight ScaleWidth TrueColor Visible Width | Modified

Remarks

The OLE object allows you to use VBA to insert information from another application into AutoCAD.


PaperSpace Collection (ActiveX)

A special Block object containing all the entities in the active paper space layout.

Supported Platforms: Windows only

Class Information

Class Name

AcadPaperSpace

Object Inheritance
Object
   AcadObject AcadBlock
         AcadPaperSpace
Create Using

VBA

Not applicable
Access Via

VBA

Document.PaperSpace

Members

These members are part of this object:

Methods | Properties | Events
Add3DFace Add3DMesh Add3DPoly AddArc AddAttribute AddBox AddCircle AddCone AddCustomObject AddCylinder AddDim3PointAngular AddDimAligned AddDimAngular AddDimArc AddDimDiametric AddDimOrdinate AddDimRadial AddDimRadialLarge AddDimRotated AddEllipse AddEllipticalCone AddEllipticalCylinder AddExtrudedSolid AddExtrudedSolidALongPath AddHatch AddLeader AddLightWeightPolyline AddLine AddMInsertBlock AddMLeader AddMLine AddMText AddPoint AddPolyfaceMesh AddPolyline AddPViewport AddRaster AddRay AddRegion AddRevolvedSolid AddSection AddShape AddSolid AddSphere AddSpline AddTable AddText AddTolerance AddTorus AddTrace AddWedge AddXLine AttachExternalReference GetExtensionDictionary GetXdata InsertBlock Item SetXdata | Application Count Document Handle HasExtensionDictionary Layout Name ObjectID ObjectName OwnerID | Modified

Remarks

This collection represents all the objects in the active paper space layout. If a different paper space layout is made active, the data in the PaperSpace collection will be changed to reflect the data in the new active paper space layout.

Because this collection is actually a block, it possesses several block characteristics. For example, this collection has a Layout object associated with it that contains all of the plot settings and visible attributes of the paper space layout. Additionally, all the objects in the PaperSpace collection can be found in the Blocks collection under a block named *PAPER_SPACE. Both the block named *PAPER_SPACE and the PaperSpace collection actually point to the same data. The PaperSpace collection was created to provide a faster and easier means of accessing the data in active paper space layout.

Paper space layouts are used for creating a finished layout for printing or plotting the drawing, as opposed to doing drafting or design work, which is accomplished in model space. Although both 2D and 3D objects can exist in paper space, commands that render a 3D viewpoint are disabled.

You cannot create or delete the PaperSpace collection. You cannot delete, detach, bind, unload, or reload PaperSpace like an external reference can be so those functions are not listed. Nor cannot you manipulate ModelSpace like you can with a block definition.


PdfUnderlay Object (ActiveX)

A source of PDF underlay content.

Supported Platforms: Windows only

Class Information

Class Name

AcadPdfUnderlay

Object Inheritance
Object
   AcadObject AcadEntity
         AcadUnderlay
            AcadPdfUnderlay
Create Using

VBA

Not applicable
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular ClipBoundary Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | AdjustForBackground Application ClippingEnabled Contrast Document EntityTransparency Fade File Handle HasExtensionDictionary Height Hyperlinks ItemName Layer Linetype LinetypeScale Lineweight Material Monochrome ObjectID ObjectName OwnerID PlotStyleName Position Rotation ScaleFactor TrueColor UnderlayLayerOverrideApplied UnderlayName UnderlayVisibility Visible Width | Modified

Remarks

Underlays are similar to raster images, except that users can snap to the content of an underlay. The AcadPdfUnderlay class supports PDF files as underlays to AutoCAD drawings.


PlaneSurface Object (ActiveX)

A planar surface.

Supported Platforms: Windows only

Class Information

Class Name

AcadPlaneSurface

Object Inheritance
Object
   AcadObject AcadEntity AcadSurface
            AcadPlaneSurface
Create Using

VBA

Not applicable
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Document EdgeExtensionDistances EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Linetype LinetypeScale Lineweight MaintainAssociativity Material ObjectID ObjectName OwnerID PlotStyleName ShowAssociativity SurfaceType SurfTrimAssociativity TrueColor UIsolineDensity Visible VIsolineDensity WireframeType | Modified

Remarks

This object provides access to planar surfaces in AutoCAD. You cannot create a surface entity via ActiveX.


Plot Object (ActiveX)

The set of methods and properties used for plotting layouts.

Supported Platforms: Windows only

Class Information

Class Name

AcadPlot

Object Inheritance
Object
   AcadPlot
Create Using

VBA

Not applicable
Access Via

VBA

Document.Plot

Members

These members are part of this object:

Methods | Properties | Events
DisplayPlotPreview PlotToDevice PlotToFile SetLayoutsToPlot StartBatchMode | Application BatchPlotProgress NumberOfCopies QuietErrorMode | None

Remarks

This object contains the methods and properties that initiate a plot of specified layouts. You can choose to:

  • Display a plot preview
  • Plot to a file
  • Plot to a plot device

To plot in the foreground using VBA, you must set the BACKGROUNDPLOT system variable to 0. Otherwise, plotting occurs in the background.

To specify the layouts to plot, use the SetLayoutsToPlot method. This method must be called before each PlotToDevice or PlotToFile method. If SetLayoutsToPlot is not called, or is called with a NULL input, the active layout will be plotted.

The NumberOfCopies property specifies the number of copies to plot. If this property is not reset before each PlotToDevice call, the last value specified in the NumberOfCopies property will be used.

You cannot create a configured plotter (PC3) file using ActiveX. To create a PC3 file, use the Add-a-Plotter wizard in AutoCAD. If you want to use a PC3 file for plotting, the file should be located in the Plotters folder. For more information, see the AutoCAD user documentation.


PlotConfiguration Object (ActiveX)

A named collection of plot settings.

Supported Platforms: Windows only

Class Information

Class Name

AcadPlotConfiguration

Object Inheritance
Object
   AcadObject
      AcadPlotConfiguration
Create Using

VBA

PlotConfigurations.Add
Access Via

VBA

PlotConfigurations.Item

Members

These members are part of this object:

Methods | Properties | Events
CopyFrom Delete GetCanonicalMediaNames GetCustomScale GetExtensionDictionary GetLocaleMediaName GetPaperMargins GetPaperSize GetPlotDeviceNames GetPlotStyleTableNames GetWindowToPlot GetXData RefreshPlotDeviceInfo SetCustomScale SetWindowToPlot SetXData | Application CanonicalMediaName CenterPlot ConfigName Document Handle HasExtensionDictionary ModelType Name ObjectID ObjectName OwnerID PaperUnits PlotHidden PlotOrigin PlotRotation PlotType PlotViewportBorders PlotViewportsFirst PlotWithLineweights PlotWithPlotStyles ScaleLineweights ShowPlotStyles StandardScale StyleSheet UseStandardScale ViewToPlot | Modified

Remarks

A plot configuration is similar to a layout; as both contain identical plot information. The difference is that a layout is associated with a Block object containing the geometry to plot. A plot configuration is not associated with a particular Block object. A plot configuration is simply a named collection of plot settings available for use with any geometry.

To create a new plot configuration, use the Add method.


PlotConfigurations Collection (ActiveX)

A collection of named plot settings.

Supported Platforms: Windows only

Class Information

Class Name

AcadPlotConfigurations

Object Inheritance
Object
   AcadObject
      AcadPlotConfigurations
Create Using

VBA

Not applicable
Access Via

VBA

Document.PlotConfigurations

Members

These members are part of this object:

Methods | Properties | Events
Add GetExtensionDictionary GetXData Item SetXData | Application Count Document Handle HasExtensionDictionary ObjectID ObjectName OwnerID | Modified

Remarks

A plot configuration is similar to a layout; as both contain identical plot information. The difference is that a layout is associated with a Block object containing the geometry to plot. A plot configuration is not associated with a particular Block object. A plot configuration is simply a named collection of plot settings available for use with any geometry.

Although the PlotConfigurations collection inherits a Delete method, you cannot actually delete the collection. Attempting to delete this collection will result in an error. The Delete method has been removed from the documentation for this collection.

To create a new plot configuration, use the Add method.


Point Object (ActiveX)

A point marker appearing as a dot, square, circle, X, tick, or plus sign (+); or as a combination of these.

Supported Platforms: Windows only

Class Information

Class Name

AcadPoint

Object Inheritance
Object
   AcadObject AcadEntity
         AcadPoint
Create Using

VBA

ModelSpace.AddPoint
PaperSpace.AddPoint
Block.AddPoint
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Coordinates Document EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Linetype LinetypeScale Lineweight Material Normal ObjectID ObjectName OwnerID PlotStyleName Thickness TrueColor Visible | Modified

Remarks

You can specify a full 3D location for a point. The current elevation is assumed if you omit the Z coordinate.

Points can act as nodes to which you can snap objects. Also, the Coordinates property provides an array that can be used in any method requiring a point as an input parameter.

Controlling the Appearance of Points

The PDMODE and PDSIZE system variables control the appearance of point objects. PDMODE values 0, 2, 3, and 4 specify a figure to draw through the point. A value of 1 selects nothing to be displayed.

Adding 32, 64, or 96 to the values above selects a shape to draw around the point in addition to the figure drawn through it:

PDSIZE controls the size of the point figures, except for PDMODE values 0 and 1. A 0 setting generates the point at 5 percent of the graphics area height. A positive PDSIZE value specifies an absolute size for the point figures. A negative value is interpreted as a percentage of the viewport size. The size of all points is recalculated when the drawing is regenerated.

After you change PDMODE and PDSIZE, the appearance of existing points changes the next time AutoCAD regenerates the drawing.

Creating Points

To create a point, use the AddPoint method.


PointCloud Object (ActiveX)

A source of point cloud content.

Supported Platforms: Windows only

Class Information

Class Name

AcadPointCloud

Object Inheritance
Object
   AcadObject AcadEntity
         AcadPointCloud
Create Using

VBA

Not applicable
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Document EntityTransparency Handle HasExtensionDictionary Height Hyperlinks InsertionPoint IntensityColorScheme Layer Length Linetype LinetypeScale Lineweight Locked Material Name ObjectID ObjectName OwnerID Path PlotStyleName Rotation Scale ShowClipped ShowIntensity Stylization TrueColor Unit UnitFactor UseEntityColor Visible Width | Modified

Remarks

Point clouds are large collection of points placed on a 3D coordinate system.

You can use ActiveX to query and edit PointCloud entities in AutoCAD drawings. You cannot create a PointCloud object with ActiveX.


PointCloudEx Object (ActiveX)

A point cloud extension entity.

Supported Platforms: Windows only

Class Information

Class Name

Object Inheritance
Object
   AcadObject AcadEntity AcadPointCloudEx
Create Using

VBA

Not applicable
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application ColorScheme Document EntityTransparency Geolocate Handle HasExtensionDictionary Hyperlinks InsertionPoint Layer Linetype LinetypeScale Lineweight Locked Material Name ObjectID ObjectName OwnerID Path PlotStyleName Rotation Scale ShowCropped Stylization TrueColor Unit UnitFactor Visible | Modified

Remarks

Point clouds are large collection of points placed on a 3D coordinate system.

You can use ActiveX to query and edit PointCloud entities in AutoCAD drawings. You cannot create a PointCloud object with ActiveX.


PolyfaceMesh Object (ActiveX)

A three-dimensional polyface mesh.

Supported Platforms: Windows only

Class Information

Class Name

AcadPolyfaceMesh

Object Inheritance
Object
   AcadObject AcadEntity
         AcadPolyfaceMesh
Create Using

VBA

ModelSpace.AddPolyfaceMesh
PaperSpace.AddPolyfaceMesh
Block.AddPolyfaceMesh
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Coordinate Coordinates Document EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Linetype LinetypeScale Lineweight Material NumberOfFaces NumberOfVertices ObjectID ObjectName OwnerID PlotStyleName TrueColor Visible | Modified

Remarks

To create a polyface mesh, use the AddPolyfaceMesh method.


PolygonMesh Object (ActiveX)

A free-form 3D mesh.

Supported Platforms: Windows only

Class Information

Class Name

AcadPolygonMesh

Object Inheritance
Object
   AcadObject AcadEntity
         AcadPolygonMesh
Create Using

VBA

ModelSpace.AddPolygonMesh
PaperSpace.AddPolygonMesh
Block.AddPolygonMesh
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
AppendVertex ArrayPolar ArrayRectangular Copy Delete Explode GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Coordinate Coordinates Document EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Linetype LinetypeScale Lineweight Material MClose MDensity MVertexCount NClose NDensity NVertexCount ObjectID ObjectName OwnerID PlotStyleName TrueColor Type Visible | Modified

Remarks

A PolygonMesh object is an M x N mesh where M represents the number of vertices in a row of the mesh and N represents the number of vertices in a column of the mesh.

A mesh can be open or closed in either or both the M and N directions. A mesh that is closed in a given direction is considered to be continuous from the last row or column on to the first row or column.

To create a PolygonMesh use the Add3DMesh method.


Polyline Object (ActiveX)

A 2D line of adjustable width or a 3D line or mesh of non-adjustable width composed of line and arc segments.

Supported Platforms: Windows only

Class Information

Class Name

AcadPolyline

Object Inheritance
Object
   AcadObject AcadEntity
         AcadPolyline
Create Using

VBA

ModelSpace.AddPolyline
PaperSpace.AddPolyline
Block.AddPolyline
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
AppendVertex ArrayPolar ArrayRectangular Copy Delete Explode GetBoundingBox GetBulge GetExtensionDictionary GetWidth GetXData Highlight IntersectWith Mirror Mirror3D Move Offset Rotate Rotate3D ScaleEntity SetBulge SetWidth SetXData TransformBy Update | Application Area Closed ConstantWidth Coordinate Coordinates Document Elevation EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Length Linetype LinetypeGeneration LinetypeScale Lineweight Material Normal ObjectID ObjectName OwnerID PlotStyleName Thickness TrueColor Type Visible | Modified

Remarks

This object is an earlier version of the LightweightPolyline object.

This object exists for backward compatibility only. Use the LightweightPolyline object to create polylines with an optimized format that saves memory and disk space.


PopupMenu Object (ActiveX)

An AutoCAD cascading menu.

Supported Platforms: Windows only

Class Information

Class Name

AcadPopupMenu

Object Inheritance
Object
   AcadPopupMenu
Create Using

VBA

PopupMenus.Add
Access Via

VBA

PopupMenus.Item
MenuBar.Item

Members

These members are part of this object:

Methods | Properties | Events
AddMenuItem AddSeparator AddSubmenu InsertInMenuBar Item RemoveFromMenuBar | Application Count Name NameNoMnemonic OnMenuBar Parent ShortcutMenu TagString | None

Remarks

There are two types of AutoCAD menus:

  • Pull-down menus (menus accessed from the AutoCAD menu bar)
  • Shortcut menus (menus accessed from a mouse right-click)

A pull-down menu can contain up to 999 menu items. A shortcut menu can contain up to 499 menu items. If the number of menu items in a menu exceed these limits, AutoCAD ignores the extra items. If a pull-down or shortcut menu is taller than the available space on the graphics screen, it is truncated to fit on the screen.

The shortcut menu is a special menu in the base menu group. You can identify the shortcut menu by using the ShortcutMenu property.

To create a new menu, use the Add method to add a new PopupMenu object to the PopupMenus collection. To create a new shortcut menu, you must first delete any existing shortcut menu. There can be only one shortcut menu per menu group. If there is no other shortcut menu in a menu group, you can then add a menu with the label "POP0". This label will tell AutoCAD that you want to create a shortcut menu.

You can add new menu entries or separators to the menu using the AddMenuItem and AddSeparator methods. You can create submenus using the AddSubmenu method.

You can add the menu to the menu bar using the InsertInMenuBar method. Conversely, you can remove menus from the menu bar by using the RemoveFromMenuBar method.


PopupMenuItem Object (ActiveX)

A single menu item on an AutoCAD pull-down menu.

Supported Platforms: Windows only

Class Information

Class Name

AcadPopupMenuItem

Object Inheritance
Object
   AcadPopupMenuItem
Create Using

VBA

PopupMenu.AddMenuItem
PopupMenu.AddSeparator
PopupMenu.AddSubmenu
Access Via

VBA

PopupMenu.Item

Members

These members are part of this object:

Methods | Properties | Events
Delete | Application Caption Check Enable EndSubMenuLevel HelpString Index Label Macro Parent SubMenu TagString Type | None

Remarks

A popup menu item represents an entry in a menu. There are three types of popup menu items available:

  • Simple menu item (a menu that contains no submenu items)
  • Separator (a border that appears on a menu)
  • Submenu (a menu containing submenu items)

Simple menu items have an index, a label, a tag, and a macro. The index is the position on the menu where the individual menu item is located. The label is a string that defines the content and formatting of the menu item as it appears to the user. The tag is a string consisting of alphanumeric and underscore (_) characters. This tag uniquely identifies the menu item within a given menu. Menu items may have identical labels within the menu, but they cannot have identical tags. The end user does not see the tag. The macro is a series of commands that execute specific actions when a menu item is selected.

Submenu items also have an index, a label, and a tag. They do not have a macro associated with them. Instead, they have an entire PopupMenu object associated with them. This PopupMenu object is the menu that appears when the user selects the submenu item. To find a PopupMenu object associated with a submenu item, use the SubMenu property.

Separators have only an index. The index for a separator specifies where on the menu the separator is to appear.

To add a new menu item, use the AddMenuItem , AddSeparator , or AddSubmenu methods.


PopupMenus Collection (ActiveX)

A collection of PopupMenu objects representing all the popup menus loaded in the MenuGroup.

Supported Platforms: Windows only

Class Information

Class Name

AcadPopupMenus

Object Inheritance
Object
   AcadPopupMenus
Create Using

VBA

Not applicable
Access Via

VBA

MenuGroup.Menus

Members

These members are part of this object:

Methods | Properties | Events
Add InsertMenuInMenuBar Item RemoveMenuFromMenuBar | Application Count Parent | None

Remarks

The PopupMenus collection represents all the menus loaded in the current AutoCAD session, some or all of which may be currently displayed in AutoCAD. To load an existing menu into the current session, load the menu group containing the menu using the Load method. To create a new menu, use the Add method.

To display a menu on the AutoCAD menu bar, use the InsertMenuInMenuBar method. To remove a menu from the menu bar, use the RemoveMenuFromMenuBar method.


Preferences Object (ActiveX)

This object specifies the current AutoCAD settings.

Supported Platforms: Windows only

Class Information

Class Name

AcadPreferences

Object Inheritance
Object
   AcadPreferences
Create Using

VBA

Not applicable
Access Via

VBA

Application.Preferences

Members

These members are part of this object:

Methods | Properties | Events
None | Application Display Drafting Files OpenSave Output Profiles Selection System User | None

Remarks

The Preferences object holds all the options from the Options dialog box that reside in the registry. Options that reside in the drawing can be found through the DatabasePreferences object.

The Preferences object is divided into separate objects, with each representing a tab on the Options dialog box.

The Preferences object can be referenced from the Preferences property on the Application object.


PreferencesDisplay Object (ActiveX)

This object contains the options from the Display tab on the Options dialog box.

Supported Platforms: Windows only

Class Information

Class Name

AcadPreferencesDisplay

Object Inheritance
Object
   AcadPreferencesDisplay
Create Using

VBA

Not applicable
Access Via

VBA

Application.Preferences.Display

Members

These members are part of this object:

Methods | Properties | Events
None | Application AutoTrackingVecColor CursorSize DisplayLayoutTabs DisplayScreenMenu DisplayScrollBars DockedVisibleLines GraphicsWinLayoutBackgrndColor GraphicsWinModelBackgrndColor HistoryLines ImageFrameHighlight LayoutCreateViewport LayoutCrosshairColor LayoutDisplayMargins LayoutDisplayPaper LayoutDisplayPaperShadow LayoutShowPlotSetup MaxAutoCADWindow ModelCrosshairColor ShowRasterImage TextFont TextFontSize TextFontStyle TextWinBackgrndColor TextWinTextColor TrueColorImages XRefFadeIntensity | None

Remarks

This object holds all the options from the Display tab on the Options dialog box stored in the registry. All options that are stored with the drawing can be found on the DatabasePreferences object.


PreferencesDrafting Object (ActiveX)

This object contains the options from the Drafting tab on the Options dialog box.

Supported Platforms: Windows only

Class Information

Class Name

AcadPreferencesDrafting

Object Inheritance
Object
   AcadPreferencesDrafting
Create Using

VBA

Not applicable
Access Via

VBA

Application.Preferences.Drafting

Members

These members are part of this object:

Methods | Properties | Events
None | AlignmentPointAcquisition Application AutoSnapAperture AutoSnapApertureSize AutoSnapMagnet AutoSnapMarker AutoSnapMarkerColor AutoSnapMarkerSize AutoSnapToolTip AutoTrackToolTip FullScreenTrackingVector PolarTrackingVector | None

Remarks

This object holds all the options from the Drafting tab on the Options dialog box stored in the registry. All options that are stored with the drawing can be found on the DatabasePreferences object.


PreferencesFiles Object (ActiveX)

This object contains the options from the Files tab on the Options dialog box.

Supported Platforms: Windows only

Class Information

Class Name

AcadPreferencesFiles

Object Inheritance
Object
   AcadPreferencesFiles
Create Using

VBA

Not applicable
Access Via

VBA

Application.Preferences.Files

Members

These members are part of this object:

Methods | Properties | Events
GetProjectFilePath SetProjectFilePath | ActiveInvProject AltFontFile AltTabletMenuFile Application AutoSavePath ColorBookPath ConfigFile CustomDictionary CustomIconPath DefaultInternetURL DriversPath EnterpriseMenuFile FontFileMap HelpFilePath LogFilePath MainDictionary MenuFile PageSetupOverridesTemplateFile PlotLogFilePath PostScriptPrologFile PrinterConfigPath PrinterDescPath PrinterStyleSheetPath PrintFile PrintSpoolerPath PrintSpoolExecutable QNewTemplateFile SupportPath TempFilePath TemplateDWGPath TempXRefPath TextEditor TextureMapPath ToolPalettePath WorkspacePath | None

Remarks

This object holds all the options from the Files tab on the Options dialog box stored in the registry. All options that are stored with the drawing can be found on the DatabasePreferences object.


PreferencesOpenSave Object (ActiveX)

This object contains options from the Open and Save tab on the Options dialog box.

Supported Platforms: Windows only

Class Information

Class Name

AcadPreferencesOpenSave

Object Inheritance
Object
   AcadPreferencesOpenSave
Create Using

VBA

Not applicable
Access Via

VBA

Application.Preferences.OpenSave

Members

These members are part of this object:

Methods | Properties | Events
None | Application AutoAudit AutoSaveInterval CreateBackup DemandLoadARXApp FullCRCValidation IncrementalSavePercent LogFileOn MRUNumber ProxyImage SaveAsType SavePreviewThumbnail ShowProxyDialogBox TempFileExtension XrefDemandLoad | None

Remarks

This object holds options from the Open and Save tab on the Options dialog box. They are stored in the registry.


PreferencesOutput Object (ActiveX)

This object contains the options from the Output tab on the Options dialog box.

Supported Platforms: Windows only

Class Information

Class Name

AcadPreferencesOutput

Object Inheritance
Object
   AcadPreferencesOutput
Create Using

VBA

Not applicable
Access Via

VBA

Application.Preferences.Output

Members

These members are part of this object:

Methods | Properties | Events
None | Application AutomaticPlotLog ContinuousPlotLog DefaultOutputDevice DefaultPlotStyleForLayer DefaultPlotStyleForObjects DefaultPlotStyleTable DefaultPlotToFilePath OLEQuality PlotLegacy PlotPolicy PrinterPaperSizeAlert PrinterSpoolAlert UseLastPlotSettings | None

Remarks

This object holds all the options from the Output tab on the Options dialog box stored in the registry. All options that are stored with the drawing can be found on the DatabasePreferences object.


PreferencesProfiles Object (ActiveX)

This object contains the options from the Profiles tab on the Options dialog box.

Supported Platforms: Windows only

Class Information

Class Name

AcadPreferencesProfiles

Object Inheritance
Object
   AcadPreferencesProfiles
Create Using

VBA

Not applicable
Access Via

VBA

Application.Preferences.Profiles

Members

These members are part of this object:

Methods | Properties | Events
CopyProfile DeleteProfile ExportProfile GetAllProfileNames ImportProfile RenameProfile ResetProfile | ActiveProfile Application | None

Remarks

This object holds all the options from the Profiles tab on the Options dialog box stored in the registry. All options that are stored with the drawing can be found on the DatabasePreferences object.


PreferencesSelection Object (ActiveX)

This object contains the options from the Selection tab on the Options dialog box.

Supported Platforms: Windows only

Class Information

Class Name

AcadPreferencesSelection

Object Inheritance
Object
   AcadPreferencesSelection
Create Using

VBA

Not applicable
Access Via

VBA

Application.Preferences.Selection

Members

These members are part of this object:

Methods | Properties | Events
None | Application DisplayGrips DisplayGripsWithinBlocks GripColorSelected GripColorUnselected GripSize PickAdd PickAuto PickBoxSize PickDrag PickFirst PickGroup | None

Remarks

This object holds all the options from the Selection tab on the Options dialog box stored in the registry. All options that are stored with the drawing can be found on the DatabasePreferences object.


PreferencesSystem Object (ActiveX)

This object contains the options from the System tab on the Options dialog box.

Supported Platforms: Windows only

Class Information

Class Name

AcadPreferencesSystem

Object Inheritance
Object
   AcadPreferencesSystem
Create Using

VBA

Not applicable
Access Via

VBA

Application.Preferences.System

Members

These members are part of this object:

Methods | Properties | Events
None | Application BeepOnError DisplayOLEScale EnableStartupDialog LoadAcadLspInAllDocuments ShowWarningMessages SingleDocumentMode StoreSQLIndex TablesReadOnly | None

Remarks

This object holds all the options from the System tab on the Options dialog box stored in the registry. All options that are stored with the drawing can be found on the DatabasePreferences object.


PreferencesUser Object (ActiveX)

This object contains the options from the User tab on the Options dialog box.

Supported Platforms: Windows only

Class Information

Class Name

AcadPreferencesUser

Object Inheritance
Object
   AcadPreferencesUser
Create Using

VBA

Not applicable
Access Via

VBA

Application.Preferences.User

Members

These members are part of this object:

Methods | Properties | Events
None | ADCInsertUnitsDefaultSource ADCInsertUnitsDefaultTarget Application HyperlinkDisplayCursor KeyboardAccelerator KeyboardPriority SCMCommandMode SCMDefaultMode SCMEditMode SCMTimeMode SCMTimeValue ShortCutMenuDisplay | None

Remarks

This object holds all the options from the User tab on the Options dialog box stored in the registry. All options that are stored with the drawing can be found on the DatabasePreferences object.


PViewport object (ActiveX)

Rectangular objects created in paper space that display views.

Supported Platforms: Windows only

Class Information

Class Name

AcadPViewport

Object Inheritance
Object
   AcadObject AcadEntity
         AcadPViewport
Create Using

VBA

PaperSpace.AddPViewport
Access Via

VBA

PaperSpace.Item
Document.ActivePViewport

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete Display GetBoundingBox GetExtensionDictionary GetGridSpacing GetSnapSpacing GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetGridSpacing SetSnapSpacing SetXData SyncModelView TransformBy Update | Application ArcSmoothness Center Clipped CustomScale Direction DisplayLocked Document EntityTransparency GridOn Handle HasExtensionDictionary HasSheetView Height Hyperlinks LabelBlockId Layer LayerPropertyOverrides LensLength Linetype LinetypeScale Lineweight Material ModelView ObjectID ObjectName OwnerID PlotStyleName ShadePlot SheetView SnapBasePoint SnapOn SnapRotationAngle StandardScale StandardScale2 Target TrueColor TwistAngle UCSIconAtOrigin UCSIconOn UCSPerViewport ViewportOn Visible VisualStyle Width | Modified

Remarks

The functionality of the PViewport object is slightly different from what is used in the AutoCAD user interface. Users familiar with AutoCAD paper space viewport functionality will find the following information helpful.

In ActiveX Automation, the ActiveSpace property is used to control the TILEMODE system variable. Setting ThisDrawing.ActiveSpace = acModelSpace is equivalent to setting TILEMODE = 1, and setting ThisDrawing.ActiveSpace = acPaperSpace is equivalent to setting TILEMODE = 0.

Similarly, the MSpace property is the equivalent of both the MSPACE and PSPACE commands in AutoCAD. Setting ThisDrawing.MSpace = True is the same as using the MSPACE command, and setting ThisDrawing.MSpace = False is the same as using the PSPACE command.

In addition, the ActiveX Automation user is required to use the Display method before setting the MSpace property to True. The Display method initializes certain graphic settings that must be set before switching to model space. In AutoCAD this is done "behind the scenes." However, in the ActiveX Automation interface, the programmer must take care of this initialization.

NoteRemember, you must turn on the display using the Display method for at least one PViewport object before you can set the MSpace property to True. Failure to turn on the display will result in an error being returned when you try to set the MSpace property.

The ActiveSpace and MSpace properties are found on the Document object.

To create a PViewport object, use the AddPViewport method.


RasterImage Object (ActiveX)

A raster image consisting of a rectangular grid (or raster) of small squares or dots known as pixels.

Supported Platforms: Windows only

Class Information

Class Name

AcadRasterImage

Object Inheritance
Object
   AcadObject AcadEntity
         AcadRasterImage
Create Using

VBA

ModelSpace.AddRaster
PaperSpace.AddRaster
Block.AddRaster
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular ClipBoundary Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Brightness ClippingEnabled Contrast Document EntityTransparency Fade Handle HasExtensionDictionary Height Hyperlinks ImageFile ImageHeight ImageVisibility ImageWidth Layer Linetype LinetypeScale Lineweight Material Name ObjectID ObjectName Origin OwnerID PlotStyleName Rotation ScaleFactor ShowRotation Transparency TrueColor Visible Width | Modified

Remarks

To create a raster image, use the AddRaster method.


Ray Object (ActiveX)

A semi-infinite line.

Supported Platforms: Windows only

Class Information

Class Name

AcadRay

Object Inheritance
Object
   AcadObject AcadEntity
         AcadRay
Create Using

VBA

ModelSpace.AddRay
PaperSpace.AddRay
Block.AddRay
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application BasePoint DirectionVector Document EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Linetype LinetypeScale Lineweight Material ObjectID ObjectName OwnerID PlotStyleName SecondPoint TrueColor Visible | Modified

Remarks

Rays are commonly used as construction lines. A ray has a finite starting point and extends to infinity.

To create a ray, use the AddRay method.


Region object (ActiveX)

A bounded planar face consisting of lines, circles, arcs, elliptical arcs, and spline curves.

Supported Platforms: Windows only

Class Information

Class Name

AcadRegion

Object Inheritance
Object
   AcadObject AcadEntity
         AcadRegion
Create Using

VBA

ModelSpace.AddRegion
PaperSpace.AddRegion
Block.AddRegion
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Boolean Copy Delete Explode GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Area Centroid Document EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Linetype LinetypeScale Lineweight Material MomentOfInertia Normal ObjectID ObjectName OwnerID Perimeter PlotStyleName PrincipalDirections PrincipalMoments ProductOfInertia RadiiOfGyration TrueColor Visible | Modified

Remarks

Each object in the region retains its layer, linetype, and color. AutoCAD deletes the original objects after converting them to regions and does not hatch the regions by default.

You can explode a region into the individual loops by using the Explode method. The Boolean method allows you to create composite 3D solids or regions from the intersection, union, or subtraction of a solid or region from another solid or region.

To create a region, use the AddRegion method.


RegisteredApplication Object (ActiveX)

An external application that has been added to the drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadRegisteredApplication

Object Inheritance
Object
   AcadObject
      AcadRegisteredApplication
Create Using

VBA

RegisteredApplications.Add
Access Via

VBA

RegisteredApplications.Item

Members

These members are part of this object:

Methods | Properties | Events
Delete GetExtensionDictionary GetXData SetXData | Application Document Handle HasExtensionDictionary Name ObjectID ObjectName OwnerID | Modified

Remarks

To be recognized by AutoCAD, an application must register the name or names that it uses. The application name needs to be registered only once per drawing.

Application names are saved with the extended data of each entity that uses them. Every instance of extended data referenced in a drawing must have its application registered in the drawing.

To register an application, add it to the RegisteredApplications collection using the Add method.


RegisteredApplications Collection (ActiveX)

The collection of all registered applications in the drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadRegisteredApplications

Object Inheritance
Object
   AcadObject
      AcadRegisteredApplications
Create Using

VBA

Not applicable
Access Via

VBA

Document.RegisteredApplications

Members

These members are part of this object:

Methods | Properties | Events
Add GetExtensionDictionary GetXData Item SetXData | Application Count Document Handle HasExtensionDictionary ObjectID ObjectName OwnerID | Modified

Remarks

To add a new member to the collection, use the Add method. To select a specific registered application, use the Item method. To delete a specific registered application, use the Delete method found on the RegisteredApplication object.

Although this collection inherits a Delete method, you cannot actually delete the collection. Attempting to delete this collection will result in an error. The Delete method has been removed from the documentation for this collection.

There is no limit to the number of registered applications that you can create in your drawing. However, there can be only one instance of the RegisteredApplications collection. The RegisteredApplications collection is predefined for each drawing. You can make multiple references to it by using the RegisteredApplications property.


RevolvedSurface Object (ActiveX)

A surface created by revolving one or more 2D objects about an axis.

Supported Platforms: Windows only

Class Information

Class Name

AcadRevolvedSurface

Object Inheritance
Object
   AcadObject AcadEntity AcadSurface
            AcadRevolvedSurface
Create Using

VBA

Not applicable
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application AxisDirection AxisPosition Document EdgeExtensionDistances EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Linetype LinetypeScale Lineweight MaintainAssociativity Material ObjectID ObjectName OwnerID PlotStyleName RevolutionAngle ShowAssociativity SurfaceType SurfTrimAssociativity TrueColor UIsolineDensity Visible VIsolineDensity WireframeType | Modified

Remarks

This object provides access to revolved surfaces in AutoCAD. It lets you manipulate the properties of the surface. You cannot create a surface entity via ActiveX.


Section Object (ActiveX)

A section plane entity created at the intersection of a plane and a solid.

Supported Platforms: Windows only

Class Information

Class Name

AcadSection

Object Inheritance
Object
   AcadObject AcadEntity
         AcadSection
Create Using

VBA

ModelSpace.AddSection
PaperSpace.AddSection
Block.AddSection
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
AddVertex ArrayPolar ArrayRectangular Copy CreateJog Delete GenerateSectionGeometry GetBoundingBox GetExtensionDictionary GetSettings GetXData Highlight HitTest IntersectWith Mirror Mirror3D Move RemoveVertex Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application BottomHeight Coordinate Document Elevation EntityTransparency Handle HasExtensionDictionary Hyperlinks IndicatorFillColor IndicatorTransparency Layer Linetype LinetypeScale Lineweight LiveSectionEnabled Material Name Normal NumVertices ObjectID ObjectName OwnerID PlotStyleName Settings State TopHeight TrueColor VerticalDirection Vertices ViewingDirection Visible | Modified

Remarks

The Section object represents a cross section through a 3D solid. The result can be a two-dimensional object that represents the shape of the section. To create a Section object, use AddSection .


SectionManager Object (ActiveX)

This object manages the collection of section planes in the DWG database.

Supported Platforms: Windows only

Class Information

Class Name

AcadSectionManager

Object Inheritance
Object
   AcadObject
      AcadSectionManager
Create Using

VBA

Not applicable
Access Via

VBA

Database.SectionManager

Members

These members are part of this object:

Methods | Properties | Events
GetExtensionDictionary GetLiveSection GetUniqueSectionName GetXData Item SetXData | Application Count Document Handle HasExtensionDictionary ObjectID ObjectName OwnerID | Modified

Remarks

SectionManager objects cannot be created through ActiveX. You can obtain the SectionManager object for a database from the SectionManager property. However, the SectionManager object is available in a drawing only after a section plane has been created.


SectionSettings object (ActiveX)

A container for section geometry settings.

Supported Platforms: Windows only

Class Information

Class Name

AcadSectionSettings

Object Inheritance
Object
   AcadObject
      AcadSectionSettings
Create Using

VBA

Not applicable
Access Via

VBA

Section.Settings

Members

These members are part of this object:

Methods | Properties | Events
Delete GetExtensionDictionary GetSectionTypeSettings GetXData SetXData | Application CurrentSectionType Document Handle HasExtensionDictionary ObjectID ObjectName OwnerID | Modified

Remarks

Settings that control the type and settings used to display a section.


SectionTypeSettings Object (ActiveX)

The settings that apply to the various types of sections.

Supported Platforms: Windows only

Class Information

Class Name

AcadSectionTypeSettings

Object Inheritance
Object
   AcadSectionTypeSettings
Create Using

VBA

Not applicable
Access Via

VBA

SectionSettings.GetSectionTypeSettings

Members

These members are part of this object:

Methods

Properties

Events

None

BackgroundLinesColor

BackgroundLinesHiddenLine

BackgroundLinesLayer

BackgroundLinesLinetype

BackgroundLinesLinetypeScale

BackgroundLinesLineweight

BackgroundLinesPlotStyleName

BackgroundLinesVisible

CurveTangencyLinesColor

CurveTangencyLinesLayer

CurveTangencyLinesLinetype

CurveTangencyLinesLinetypeScale

CurveTangencyLinesLineweight

CurveTangencyLinesPlotStyleName

CurveTangencyLinesVisible

DestinationBlock

DestinationFile

ForegroundLinesColor

ForegroundLinesEdgeTransparency

ForegroundLinesFaceTransparency

ForegroundLinesHiddenLine

ForegroundLinesLayer

ForegroundLinesLinetype

ForegroundLinesLinetypeScale

ForegroundLinesLineweight

ForegroundLinesPlotStyleName

ForegroundLinesVisible

GenerationOptions

IntersectionBoundaryColor

IntersectionBoundaryDivisionLines

IntersectionBoundaryLayer

IntersectionBoundaryLinetype

IntersectionBoundaryLinetypeScale

IntersectionBoundaryLineweight

IntersectionBoundaryPlotStyleName

IntersectionBoundaryVisible

IntersectionFillColor

IntersectionFillFaceTransparency

IntersectionFillHatchAngle

IntersectionFillHatchPatternName

IntersectionFillHatchPatternType

IntersectionFillHatchScale

IntersectionFillHatchSpacing

IntersectionFillLayer

IntersectionFillLinetype

IntersectionFillLinetypeScale

IntersectionFillLineweight

IntersectionFillPlotStyleName

IntersectionFillVisible

SourceObjects

None

Remarks

Types of sections include live sections, 2D sections, and 3D sections. Geometry that is generated during section creation falls into one of five categories: intersection boundary, intersection fill, background geometry, foreground geometry, and curve tangency lines. Properties of the SectionTypeSettings object control the AutoCAD characteristics of these five categories for each of the three types.


SecurityParams Object (ActiveX)

Supplies information necessary for performing security operations on drawing files.

Supported Platforms: Windows only

Class Information

Class Name

AcadSecurityParams

Object Inheritance
Object
   AcadSecurityParams
Create Using

VBA

GetInterfaceObject("AutoCAD.SecurityParams.20")
Dim sp As New AcadSecurityParams
Access Via

VBA

Not applicable

Members

These members are part of this object:

Methods | Properties | Events
None | Action Algorithm Comment Issuer KeyLength Password ProviderName ProviderType SerialNumber Subject TimeServer | None

Remarks

The SecurityParams object stores settings used for drawing security. You can use the SecurityParams object to encrypt and digitally sign drawing files.

The object includes properties for information about cryptography providers and other settings for drawing security. Additional information about cryptography providers is available on MSDN.


SelectionSet Object (ActiveX)

A group of one or more AutoCAD objects specified for processing as a single unit.

Supported Platforms: Windows only

Class Information

Class Name

AcadSelectionSet

Object Inheritance
Object
   AcadSelectionSet
Create Using

VBA

SelectionSets.Add
Access Via

VBA

SelectionSets.Item
Document.ActiveSelectionSet

Members

These members are part of this object:

Methods | Properties | Events
AddItems Clear Delete Erase Highlight Item RemoveItems Select SelectAtPoint SelectByPolygon SelectOnScreen Update | Application Count Name | None

Remarks

To delete a selection set, or delete items from a selection set, use one of the following methods:

  • Clear: Empties the selection set. The selection set will still exist, but will not contain any items. The items that previously resided in the selection still exist, but they no longer reside in the selection set.
  • RemoveItems: Removes one or more items from a selection set. The removed items still exist, but they no longer reside in the selection set.
  • Erase: Deletes all items in a selection set. The selection set still exists, but will not contain any items. The items that previously resided in the selection set no longer exist.
  • Delete: Deletes a selection set object, but not the objects in the selection set. While the selection set itself will not exist after the call to the Delete method, the items previously in the selection set will still exist.

To create a selection set, use the Add method.


SelectionSets Collection (ActiveX)

The collection of all selection sets in the drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadSelectionSets

Object Inheritance
Object
   AcadSelectionSets
Create Using

VBA

Not applicable
Access Via

VBA

Document.SelectionSets

Members

These members are part of this object:

Methods | Properties | Events
Add Item | Application Count | None

Remarks

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 found in the SelectionSet object. You can create up to 128 selection sets in your drawing.

There can be only one instance of the SelectionSets collection. The SelectionSets collection is predefined for each drawing. You can make multiple references to it by using the SelectionSets property. Once done with an object, the reference is automatically released.


ShadowDisplay Interface (ActiveX)

Interface for AutoCAD entities with shadows.

Supported Platforms: Windows only

Class Information

Class Name

AcadShadowDisplay

Object Inheritance
Object
   AcadShadowDisplay
Create Using

VBA

Not applicable
Access Via

VBA

Dim shadowObj As AcadShadowDisplay
Set shadowObj = Document.ModelSpace.Item(0)

Members

These members are part of this object:

Methods | Properties | Events
None | EnableShadowDisplay ShadowDisplay | None

Remarks

This interface encapsulates the Shadow display property shown in the Properties palette for shadow-enabled entities. Entities that can display shadows include 3D entities such as Acad3DSolid , Acad3DFace , and Acad3DPolyline . 2D entities, such as AcadLine , can display shadows only if they can have thickness and if their thickness is non-zero.


Shape Object (ActiveX)

An object comprising lines, arcs, and circles defined in an SHX file.

Supported Platforms: Windows only

Class Information

Class Name

AcadShape

Object Inheritance
Object
   AcadObject AcadEntity
         AcadShape
Create Using

VBA

ModelSpace.AddShape
PaperSpace.AddShape
Block.AddShape
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Document EntityTransparency Handle HasExtensionDictionary Height Hyperlinks InsertionPoint Layer Linetype LinetypeScale Lineweight Material Name Normal ObjectID ObjectName ObliqueAngle OwnerID PlotStyleName Rotation ScaleFactor Thickness TrueColor Visible | Modified

Remarks

Before inserting a shape, you must load the file containing the desired shape. To load a shape file, use the LoadShapeFile method. To insert the shape into the drawing, use the AddShape method.


Solid Object (ActiveX)

A solid-filled polygon.

Supported Platforms: Windows only

Class Information

Class Name

AcadSolid

Object Inheritance
Object
   AcadObject AcadEntity
         AcadSolid
Create Using

VBA

ModelSpace.AddSolid
PaperSpace.AddSolid
Block.AddSolid
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Coordinate Coordinates Document EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Linetype LinetypeScale Lineweight Material Normal ObjectID ObjectName OwnerID PlotStyleName Thickness TrueColor Visible | Modified

Remarks

Solids are only filled when the FILLMODE system variable is on. To set or query a system variable, use the SetVariable and GetVariable methods, respectively.

To create a solid, use the AddSolid method.


SortentsTable Object (ActiveX)

Contains and manipulates draw order information.

Supported Platforms: Windows only

Class Information

Class Name

AcadSortentsTable

Object Inheritance
Object
   AcadObject
      AcadSortentsTable
Create Using

VBA

Dictionary.AddObject
Access Via

VBA

object.GetExtensionDictionary

Members

These members are part of this object:

Methods | Properties | Events
Block Delete GetExtensionDictionary GetFullDrawOrder GetRelativeDrawOrder GetXData MoveAbove MoveBelow MoveToBottom MoveToTop SetRelativeDrawOrder SetXData SwapObjects | Application Document Handle HasExtensionDictionary ObjectID ObjectName OwnerID | Modified

Remarks

The SortentsTable object contains draw order information.


Spline Object (ActiveX)

A quadratic or cubic NURBS (nonuniform rational B-spline) curve.

Supported Platforms: Windows only

Class Information

Class Name

AcadSpline

Object Inheritance
Object
   AcadObject AcadEntity
         AcadSpline
Create Using

VBA

ModelSpace.AddSpline
PaperSpace.AddSpline
Block.AddSpline
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
AddFitPoint ArrayPolar ArrayRectangular Copy Delete DeleteFitPoint ElevateOrder GetBoundingBox GetControlPoint GetExtensionDictionary GetFitPoint GetWeight GetXData Highlight IntersectWith Mirror Mirror3D Move Offset PurgeFitData Reverse Rotate Rotate3D ScaleEntity SetControlPoint SetFitPoint SetWeight SetXData TransformBy Update | Application Area Closed Closed2 ControlPoints Degree Degree2 Document EndTangent EntityTransparency FitPoints FitTolerance Handle HasExtensionDictionary Hyperlinks IsPeriodic IsPlanar IsRational KnotParameterization Knots Layer Linetype LinetypeScale Lineweight Material NumberOfControlPoints NumberOfFitPoints ObjectID ObjectName OwnerID PlotStyleName SplineFrame SplineMethod StartTangent TrueColor Visible Weights | Modified

Remarks

A spline is a smooth curve passing through a given set of points. AutoCAD uses a particular type of spline known as a nonuniform rational B-spline (NURBS) curve. A NURBS curve produces a smooth curve between control points. Splines are useful for creating irregular-shaped curves, for example, drawing contour lines for geographic information system (GIS) applications or automobile design.

You create splines by specifying coordinate points. You can close the spline so the start point and endpoint are coincident and tangent. You can also change the spline-fitting tolerance. Fit tolerance refers to how closely the spline fits the set of fit points you specify. The lower the tolerance, the more closely the spline fits the points. At zero tolerance, the spline passes through the points.

To create a spline, use the AddSpline method.


SubDMesh Object (ActiveX)

For internal use only.

Supported Platforms: Windows only

Class Information

Class Name

AcadSubDMesh

Object Inheritance
Object
   AcadObject AcadEntity
         AcadSubDMesh
Create Using

VBA

Not applicable
Access Via

VBA

Not applicable

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetControlPoint GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Coordinate Coordinates Document EntityTransparency FaceCount Handle HasExtensionDictionary Hyperlinks Layer Linetype LinetypeScale Lineweight Material ObjectID ObjectName OwnerID PlotStyleName Smoothness TrueColor VertexCount Visible | None

Remarks

For internal use only.


SubDMeshEdge Object (ActiveX)

For internal use only.

Supported Platforms: Windows only

Class Information

Class Name

AcadSubDMeshEdge

Object Inheritance
Object
   AcadSubEntity
      AcadSubDMeshEdge
Create Using

VBA

Not applicable
Access Via

VBA

Not applicable

Members

These members are part of this object:

Methods | Properties | Events
None | Color CreaseLevel CreaseType Hyperlinks Layer Linetype LinetypeScale Lineweight ObjectName PlotStyleName | Modified

Remarks

For internal use only.


SubDMeshFace Object (ActiveX)

For internal use only.

Supported Platforms: Windows only

Class Information

Class Name

AcadSubDMeshFace

Object Inheritance
Object
   AcadSubEntity
      AcadSubDMeshFace
Create Using

VBA

Not applicable
Access Via

VBA

Not applicable

Members

These members are part of this object:

Methods | Properties | Events
None | Color CreaseLevel CreaseType Hyperlinks Layer Linetype LinetypeScale Lineweight Material ObjectName PlotStyleName | Modified

Remarks

For internal use only.


SubDMeshVertex Object (ActiveX)

For internal use only.

Supported Platforms: Windows only

Class Information

Class Name

AcadSubDMeshVertex

Object Inheritance
Object
   AcadSubEntity
      AcadSubDMeshVertex
Create Using

VBA

Not applicable
Access Via

VBA

Not applicable

Members

These members are part of this object:

Methods | Properties | Events
None | Color Coordinates CreaseLevel CreaseType Hyperlinks Layer Linetype LinetypeScale Lineweight ObjectName PlotStyleName | Modified

Remarks

For internal use only.


SubEntity Object (ActiveX)

For internal use only.

Supported Platforms: Windows only

Class Information

Class Name

AcadSubEntity

Object Inheritance
Object
   AcadSubEntity
Create Using

VBA

Not applicable
Access Via

VBA

Not applicable

Members

These members are part of this object:

Methods | Properties | Events
None | color Hyperlinks Layer Linetype LinetypeScale Lineweight ObjectName PlotStyleName | None

Remarks

For internal use only.


SubEntSolidEdge Object (ActiveX)

For internal use only.

Supported Platforms: Windows only

Class Information

Class Name

AcadSubEntSolidEdge

Object Inheritance
Object
   AcadSubEntity
      AcadSubEntSolidEdge
Create Using

VBA

Not applicable
Access Via

VBA

Not applicable

Members

These members are part of this object:

Methods | Properties | Events
None | color Hyperlinks Layer Linetype LinetypeScale Lineweight ObjectName PlotStyleName | None

Remarks

For internal use only.


SubEntSolidFace Object (ActiveX)

For internal use only.

Supported Platforms: Windows only

Class Information

Class Name

AcadSubEntSolidFace

Object Inheritance
Object
   AcadSubEntity
      AcadSubEntSolidFace
Create Using

VBA

Not applicable
Access Via

VBA

Not applicable

Members

These members are part of this object:

Methods | Properties | Events
None | color Hyperlinks Layer Linetype LinetypeScale Lineweight Material ObjectName PlotStyleName | None

Remarks

For internal use only.


SubEntSolidNode Object (ActiveX)

For internal use only.

Supported Platforms: Windows only

Class Information

Class Name

AcadSubEntSolidNode

Object Inheritance
Object
   AcadSubEntity
      AcadSubEntSolidNode
Create Using

VBA

Not applicable
Access Via

VBA

Not applicable

Members

These members are part of this object:

Methods | Properties | Events
None | color Hyperlinks Layer Linetype LinetypeScale Lineweight ObjectName PlotStyleName | None

Remarks

For internal use only.


SubEntSolidVertex Object (ActiveX)

For internal use only.

Supported Platforms: Windows only

Class Information

Class Name

AcadSubEntSolidVertex

Object Inheritance
Object
   AcadSubEntity
      AcadSubEntSolidVertex
Create Using

VBA

Not applicable
Access Via

VBA

Not applicable

Members

These members are part of this object:

Methods | Properties | Events
None | color Hyperlinks Layer Linetype LinetypeScale Lineweight ObjectName PlotStyleName | None

Remarks

For internal use only.


SummaryInfo Object (ActiveX)

Accesses drawing properties such as the Title, Subject, Author, and Keywords properties.

Supported Platforms: Windows only

Class Information

Class Name

AcadSummaryInfo

Object Inheritance
Object
   AcadSummaryInfo
Create Using

VBA

Not applicable
Access Via

VBA

Document.SummaryInfo

Members

These members are part of this object:

Methods | Properties | Events
AddCustomInfo GetCustomByIndex GetCustomByKey NumCustomInfo RemoveCustomByIndex RemoveCustomByKey SetCustomByIndex SetCustomByKey | Author Comments HyperlinkBase Keywords LastSavedBy RevisionNumber Subject Title | None

Remarks

You can use the SummaryInfo object to access the properties of a drawing. You can also use the SummaryInfo object to specify custom properties.

The object includes properties for specifying the title, subject, author, and keywords of a drawing.


Surface Object (ActiveX)

A surface entity.

Supported Platforms: Windows only

Class Information

Class Name

AcadSurface

Object Inheritance
Object
   AcadObject AcadEntity
         AcadSurface
Create Using

VBA

Not applicable
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Document EdgeExtensionDistances EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Linetype LinetypeScale Lineweight MaintainAssociativity Material ObjectID ObjectName OwnerID PlotStyleName ShowAssociativity SurfaceType SurfTrimAssociativity TrueColor UIsolineDensity Visible VIsolineDensity WireframeType | Modified

Remarks

This object provides access to surfaces in AutoCAD. It lets you manipulate properties of the surface. You cannot create a surface entity via ActiveX.


SweptSurface Object (ActiveX)

A surface created by sweeping a 2D curve along a path.

Supported Platforms: Windows only

Class Information

Class Name

AcadSweptSurface

Object Inheritance
Object
   AcadObject AcadEntity AcadSurface
            AcadSweptSurface
Create Using

VBA

Not applicable
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Bank Document EdgeExtensionDistances EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Length Linetype LinetypeScale Lineweight MaintainAssociativity Material ObjectID ObjectName OwnerID PlotStyleName ProfileRotation Scale ShowAssociativity SurfaceType SurfTrimAssociativity TrueColor Twist UIsolineDensity Visible VIsolineDensity WireframeType | Modified

Remarks

This object provides access to swept surfaces in AutoCAD. It lets you manipulate properties of the surface. You cannot create a surface entity via ActiveX.


Table Object (ActiveX)

AutoCAD table object.

Supported Platforms: Windows only

Class Information

Class Name

AcadTable

Object Inheritance
Object
   AcadObject AcadEntity
         AcadTable
Create Using

VBA

ModelSpace.AddTable
PaperSpace.AddTable
Block.AddTable
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods

Properties

Events

ArrayPolar

ArrayRectangular

ClearSubSelection

ClearTableStyleOverrides

Copy

CreateContent

Delete

DeleteCellContent

DeleteColumns

DeleteContent

DeleteRows

EnableMergeAll

FormatValue

GenerateLayout

GetAlignment

GetAttachmentPoint

GetAutoScale

GetAutoScale2

GetBackgroundColor

GetBackgroundColorNone

GetBlockAttributeValue

GetBlockAttributeValue2

GetBlockRotation

GetBlockScale

GetBlockTableRecordId

GetBlockTableRecordId2

GetBoundingBox

GetBreakHeight

GetCellAlignment

GetCellBackgroundColor

GetCellBackgroundColorNone

GetCellContentColor

GetCellDataType

GetCellExtents

GetCellFormat

GetCellGridColor

GetCellGridLineWeight

GetCellGridVisibility

GetCellState

GetCellStyle

GetCellStyleOverrides

GetCellTextHeight

GetCellTextStyle

GetCellType

GetCellValue

GetColumnName

GetColumnWidth

GetContentColor

GetContentColor2

GetContentLayout

GetContentType

GetCustomData

GetDataFormat

GetDataType

GetDataType2

GetExtensionDictionary

GetFieldId

GetFieldId2

GetFormat

GetFormula

GetGridColor

GetGridColor2

GetGridDoubleLineSpacing

GetGridLineStyle

GetGridLinetype

GetGridLineWeight

GetGridLineWeight2

GetGridVisibility

GetGridVisibility2

GetHasFormula

GetMargin

GetMinimumColumnWidth

GetMinimumRowHeight

GetOverride

GetRotation

GetRowHeight

GetRowType

GetScale

GetSubSelection

GetText

GetTextHeight

GetTextHeight2

GetTextRotation

GetTextString

GetTextStyle

GetTextStyle2

GetValue

GetXData

Highlight

HitTest

InsertColumns

InsertColumnsAndInherit

InsertRows

InsertRowsAndInherit

IntersectWith

IsContentEditable

IsEmpty

IsFormatEditable

IsMergeAllEnabled

IsMergedCell

MergeCells

Mirror

Mirror3D

Move

MoveContent

RecomputeTableBlock

RemoveAllOverrides

ReselectSubRegion

ResetCellValue

Rotate

Rotate3D

ScaleEntity

Select

SelectSubRegion

SetAlignment

SetAutoScale

SetAutoScale2

SetBackgroundColor

SetBackgroundColorNone

SetBlockAttributeValue

SetBlockAttributeValue2

SetBlockRotation

SetBlockScale

SetBlockTableRecordId

SetBlockTableRecordId2

SetBreakHeight

SetCellAlignment

SetCellBackgroundColor

SetCellBackgroundColorNone

SetCellContentColor

SetCellDataType

SetCellFormat

SetCellGridColor

SetCellGridLineWeight

SetCellGridVisibility

SetCellState

SetCellStyle

SetCellTextHeight

SetCellTextStyle

SetCellType

SetCellValue

SetCellValueFromText

SetColumnName

SetColumnWidth

SetContentColor

SetContentColor2

SetContentLayout

SetCustomData

SetDataFormat

SetDataType

SetDataType2

SetFieldId

SetFieldId2

SetFormat

SetFormula

SetGridColor

SetGridColor2

SetGridDoubleLineSpacing

SetGridLineStyle

SetGridLinetype

SetGridLineWeight

SetGridLineWeight2

SetGridVisibility

SetGridVisibility2

SetMargin

SetOverride

SetRotation

SetRowHeight

SetScale

SetSubSelection

SetText

SetTextHeight

SetTextHeight2

SetTextRotation

SetTextString

SetTextStyle

SetTextStyle2

SetToolTip

SetValue

SetValueFromText

SetXData

TransformBy

UnmergeCells

Update

AllowManualHeights

AllowManualPositions

Application

BreaksEnabled

BreakSpacing

Columns

ColumnWidth

Direction

Document

EnableBreak

EntityTransparency

FlowDirection

Handle

HasExtensionDictionary

HasSubSelection

HeaderSuppressed

Height

HorzCellMargin

Hyperlinks

InsertionPoint

Layer

Linetype

LinetypeScale

Lineweight

Material

MinimumTableHeight

MinimumTableWidth

ObjectID

ObjectName

OwnerID

PlotStyleName

RegenerateTableSuppressed

RepeatBottomLabels

RepeatTopLabels

RowHeight

Rows

StyleName

TableBreakFlowDirection

TableBreakHeight

TableStyleOverrides

TitleSuppressed

TrueColor

VertCellMargin

Visible

Width

Modified

Remarks

A table contains data in rows and columns. You can use the Table object to add and modify tables in a drawing.

To add a table to a drawing, use the AddTable method. After you add a table, you can modify the number of columns, the number of rows, and other settings.

All methods that change the Table object do the following:

  1. Open the Table object in write mode
  2. Modify the Table object based on the input parameters
  3. Close the Table object, which recomputes the Table

Recomputing large tables consumes a lot of time and memory because the Table object is reconstructed from scratch. If you are making multiple calls to update a table, you can improve performance by setting RegenerateTableSuppressed before and after making the modifications.


TableStyle Object (ActiveX)

Adds, modifies, and deletes table styles.

Supported Platforms: Windows only

Class Information

Class Name

AcadTableStyle

Object Inheritance
Object
   AcadObject
      AcadTableStyle
Create Using

VBA

Dictionary.AddObject "<style name>", "AcDbTableStyle"
Access Via

VBA

Dictionary.Item

Members

These members are part of this object:

Methods | Properties | Events
CreateCellStyle CreateCellStyleFromStyle Delete DeleteCellStyle EnableMergeAll GetAlignment GetAlignment2 GetBackgroundColor GetBackgroundColor2 GetBackgroundColorNone GetCellClass GetCellStyles GetColor GetColor2 GetDataType GetDataType2 GetExtensionDictionary GetFormat GetFormat2 GetGridColor GetGridColor2 GetGridLineWeight GetGridLineWeight2 GetGridVisibility GetGridVisibility2 GetIsCellStyleInUse GetIsMergeAllEnabled GetRotation GetTextHeight GetTextHeight2 GetTextStyle GetTextStyleId GetUniqueCellStyleName GetXData RenameCellStyle SetAlignment SetAlignment2 SetBackgroundColor SetBackgroundColor2 SetBackgroundColorNone SetCellClass SetColor SetColor2 SetDataType SetDataType2 SetFormat SetFormat2 SetGridColor SetGridColor2 SetGridLineWeight SetGridLineWeight2 SetGridVisibility SetGridVisibility2 SetRotation SetTemplateId SetTextHeight SetTextHeight2 SetTextStyle SetTextStyleId SetXData | Application BitFlags Description Document FlowDirection Handle HasExtensionDictionary HeaderSuppressed HorzCellMargin Name NumCellStyles ObjectID ObjectName OwnerID TemplateId TitleSuppressed VertCellMargin | Modified

Remarks

You can use the TableStyle object to store table formatting, such as grid visibility, lineweight, and color. The object controls the initial formatting of a newly created Table object.

The TableStyle object includes methods for specifying the colors, margins, and other attributes of table styles.


Text Object (ActiveX)

A single line of alphanumeric characters.

Supported Platforms: Windows only

Class Information

Class Name

AcadText

Object Inheritance
Object
   AcadObject AcadEntity
         AcadText
Create Using

VBA

ModelSpace.AddText
PaperSpace.AddText
Block.AddText
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete FieldCode GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Alignment Application Backward Document EntityTransparency Handle HasExtensionDictionary Height Hyperlinks InsertionPoint Layer Linetype LinetypeScale Lineweight Material Normal ObjectID ObjectName ObliqueAngle OwnerID PlotStyleName Rotation ScaleFactor StyleName TextAlignmentPoint TextGenerationFlag TextString Thickness TrueColor UpsideDown Visible | Modified

Remarks

This object differs from the MText object in that it creates only a single line of text. The MText object creates a paragraph of text.

Note that RTF text is not recognized. Text from other programs with embedded formatting will lose formatting when imported into an multiline text paragraph.

To create a Text object, use the AddText method.


TextStyle Object (ActiveX)

A named, saved collection of settings that determines the appearance of text characters.

Supported Platforms: Windows only

Class Information

Class Name

AcadTextStyle

Object Inheritance
Object
   AcadObject
      AcadTextStyle
Create Using

VBA

TextStyles.Add
Access Via

VBA

TextStyles.Item
Document.ActiveTextStyle

Members

These members are part of this object:

Methods | Properties | Events
Delete GetExtensionDictionary GetFont GetXData SetFont SetXData | Application BigFontFile Document FontFile Handle HasExtensionDictionary Height LastHeight Name ObjectID ObjectName ObliqueAngle OwnerID TextGenerationFlag Width | Modified

Remarks

To control the settings on a text style, use the properties below, or the text style system variables. See "System Variables" in the AutoCAD user documentation for a list of text style system variables.

The active text style (set with the ActiveTextStyle property) determines the appearance of new text created in the drawing, and existing text that has no distinct text style specified.

If changes are made to the active TextStyle, the new TextStyle object must be reset as the active TextStyle, and the Regen method must be called for the changes to appear. To reset the active TextStyle, simply call the ActiveTextStyle property again with the updated TextStyle object.

To specify a distinct text style for an object so it will not change along with the active text style, use the StyleName property for the specific object.


TextStyles Collection (ActiveX)

The collection of all text styles in the drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadTextStyles

Object Inheritance
Object
   AcadObject
      AcadTextStyles
Create Using

VBA

Not applicable
Access Via

VBA

Document.TextStyles

Members

These members are part of this object:

Methods | Properties | Events
Add GetExtensionDictionary GetXData Item SetXData | Application Count Document Handle HasExtensionDictionary ObjectID ObjectName OwnerID | Modified

Remarks

To add a new member to the collection, use the Add method. To select a specific text style, use the Item method. To delete a specific text style, use the Delete method found on the TextStyle object.

Although the TextStyles collection inherits a Delete method, you cannot actually delete the collection. Attempting to delete the TextStyles collection will result in an error. The Delete method has been removed from the documentation for this collection.

There is no limit to the number of text styles that you can create in your drawing. However, there can be only one instance of the TextStyles collection. The TextStyles Collection is predefined for each drawing. You can make multiple references to it by using the TextStyles property. Once done with an object, the reference is automatically released.


Tolerance Object (ActiveX)

A geometric tolerance contained in a feature control frame.

Supported Platforms: Windows only

Class Information

Class Name

AcadTolerance

Object Inheritance
Object
   AcadObject AcadEntity
         AcadTolerance
Create Using

VBA

ModelSpace.AddTolerance
PaperSpace.AddTolerance
Block.AddTolerance
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application DimensionLineColor DirectionVector Document EntityTransparency Handle HasExtensionDictionary Hyperlinks InsertionPoint Layer Linetype LinetypeScale Lineweight Material Normal ObjectID ObjectName OwnerID PlotStyleName ScaleFactor StyleName TextColor TextHeight TextString TextStyle TrueColor Visible | Modified

Remarks

Tolerances are influenced by several system variables: DIMCLRD controls the color of the feature control frame; DIMCLRT controls the color of the tolerance text; DIMGAP controls the gap between the feature control frame and the text; DIMTXT controls the size of the tolerance text; and DIMTXSTY controls the style of the tolerance text.

System variables can be set and queried using the SetVariable and GetVariable methods.

To create a tolerance, use the AddTolerance method.


Toolbar Object (ActiveX)

An AutoCAD toolbar.

Supported Platforms: Windows only

Class Information

Class Name

AcadToolbar

Object Inheritance
Object
   AcadToolbar
Create Using

VBA

Toolbars.Add
Access Via

VBA

Toolbars.Item

Members

These members are part of this object:

Methods | Properties | Events
AddSeparator AddToolbarButton Delete Dock Float Item | Application Count DockStatus FloatingRows Height HelpString LargeButtons Left Name Parent TagString Top Visible Width | None

Remarks

Toolbars provide access to frequently used or custom commands, settings, macros, and modes. You can add tools to the AutoCAD default toolbars or create your own toolbars. You can also remove toolbar items or entire toolbars, and reposition toolbars.

To create a new toolbar, use the Add method. The Add method will create an empty toolbar to which you can add toolbar buttons. To add a toolbar button to a toolbar, use the AddToolbarButton method. You can add separators to your toolbar using the AddSeparator method. Both the AddToolbarbutton and AddSeparator methods return a ToolbarItem object representing an individual button on the toolbar. Use the ToolbarItem object to add functionality to the toolbar button, or to create flyout toolbar buttons.

You can change the position of toolbars by docking them along the top, bottom, or sides of the AutoCAD screen, or you can float toolbars anywhere on the screen. To dock a toolbar, use the Dock method. To float a toolbar, use the Float method. To check the current positioning of a toolbar, use the DockStatus property. If you do not want the toolbar to be visible at all, use the Visible property to hide it.


ToolbarItem Object (ActiveX)

A single button item on an AutoCAD toolbar.

Supported Platforms: Windows only

Class Information

Class Name

AcadToolbarItem

Object Inheritance
Object
   AcadToolbarItem
Create Using

VBA

Toolbar.AddToolbarButton
Toolbar.AddSeparator
Access Via

VBA

Toolbar.Item

Members

These members are part of this object:

Methods | Properties | Events
AttachToolbarToFlyout Delete GetBitmaps SetBitmaps | Application CommandDisplayName Flyout HelpString Index Macro Name Parent TagString Type | None

Remarks

A toolbar item represents a single button or separator on a toolbar. Toolbar buttons can contain a macro to be executed when they are selected by the user, or they can contain a nested toolbar called a flyout. Separators cannot contain macros or flyouts.

To add or change the macro associated with a toolbar button, use the Macro property. To create a flyout toolbar button, first set the Flyout property to acToolbarFlyout. Then use the AttachToolbarToFlyout method to attach an existing Toolbar object to the button.

You can change the bitmap associated with a button by using the SetBitmaps method. This method allows you to set both the large and small button bitmaps.


Toolbars Collection (ActiveX)

A collection of Toolbar objects representing all the toolbars loaded in the current AutoCAD session.

Supported Platforms: Windows only

Class Information

Class Name

AcadToolbars

Object Inheritance
Object
   AcadToolbars
Create Using

VBA

Not applicable
Access Via

VBA

MenuGroup.Toolbars

Members

These members are part of this object:

Methods | Properties | Events
Add Item | Application Count LargeButtons Parent | None

Remarks

The Toolbars collection represents all the toolbars loaded in the current AutoCAD session, some or all of which may be currently displayed in AutoCAD. To load an existing toolbar into the current session, load the menu group that contains the toolbar using the Load method. To create a new toolbar, use the Add method.

To display large buttons for all toolbars, set the LargeButtons property to True. This property changes the toolbar buttons for all the toolbars loaded in the current AutoCAD session.


Trace Object (ActiveX)

A 2D solid line of specified width.

Supported Platforms: Windows only

Class Information

Class Name

AcadTrace

Object Inheritance
Object
   AcadObject AcadEntity
         AcadTrace
Create Using

VBA

ModelSpace.AddTrace
PaperSpace.AddTrace
Block.AddTrace
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Coordinate Coordinates Document EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Linetype LinetypeScale Lineweight Material Normal ObjectID ObjectName OwnerID PlotStyleName Thickness TrueColor Visible | Modified

Remarks

The endpoints of a trace are always on the centerline and are always cut square. AutoCAD automatically calculates the correct bevels for connection to adjacent trace segments.

Traces are solid-filled when the Fill mode is on. When the Fill mode is off, only the outline of a trace appears. To set the Fill mode, use the system variable FILLMODE. The system variable TRACEWID stores the current width used for a Trace object. To query a system variable, use the GetVariable method. To set a system variable, use the SetVariable method.

To create a trace, use the AddTrace method.


UCS Object (ActiveX)

A user-defined coordinate system that determines the orientation of the X, Y, and Z axes in 3D space.

Supported Platforms: Windows only

Class Information

Class Name

AcadUCS

Object Inheritance
Object
   AcadObject
      AcadUCS
Create Using

VBA

UserCoordinateSystems.Add
Access Via

VBA

UserCoordinateSystems.Item
Document.ActiveUCS

Members

These members are part of this object:

Methods | Properties | Events
Delete GetExtensionDictionary GetUCSMatrix GetXData SetXData | Application Document Handle HasExtensionDictionary Name ObjectID ObjectName Origin OwnerID XVector YVector | Modified

Remarks

You define a UCS to change the location of the (0, 0, 0) origin point and the orientation of the XY plane and the Z axis. You can locate and orient a UCS anywhere in 3D space, and you can define as many UCSs as you require.

All coordinates in ActiveX Automation are entered in the world coordinate system (WCS). Use the GetUCSMatrix method to return the transformation matrix of a given UCS. Use this transformation matrix to find the equivalent WCS coordinates.

Use the UCSIconOn property to turn the UCS icon on or off for a given viewport.

To make a UCS active, use the ActiveUCS property on the Document object. If changes are made to the active UCS, the new UCS object must be reset as the active UCS for the changes to appear. To reset the active UCS, simply call the ActiveUCS property again with the updated UCS object.

To add a new UCS to the drawing, use the Add method off the UCSs Collection.


UCSs Collection (ActiveX)

The collection of all user coordinate systems (UCSs) in the drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadUCSs

Object Inheritance
Object
   AcadObject
      AcadUCSs
Create Using

VBA

Not applicable
Access Via

VBA

Document.UserCoordinateSystems

Members

These members are part of this object:

Methods | Properties | Events
Add GetExtensionDictionary GetXData Item SetXData | Application Count Document Handle HasExtensionDictionary ObjectID ObjectName OwnerID | Modified

Remarks

To add a new member to the collection, use the Add method. To select a specific UCS, use the Item method. To delete a specific UCS, use the Delete method found on the UCS object.

Although the UCSs collection inherits a Delete method, you cannot actually delete the collection. Attempting to delete the UCSs collection will result in an error. The Delete method has been removed from the documentation for this collection.

There is no limit to the number of UCSs that you can create in your drawing. However, there can be only one instance of the UCSs collection. The UCSs collection is predefined for each drawing. You can make multiple references to the UCSs collection by using the UserCoordinateSystems property. Once done with an object, the reference is automatically released.


Utility Object (ActiveX)

A series of methods provided for utility purposes.

Supported Platforms: Windows only

Class Information

Class Name

AcadUtility

Object Inheritance
Object
   AcadUtility
Create Using

VBA

Not applicable
Access Via

VBA

Document.Utility

Members

These members are part of this object:

Methods | Properties | Events
AngleFromXAxis AngleToReal AngleToString CreateTypedArray DistanceToReal GetAngle GetCorner GetDistance GetEntity GetInput GetInteger GetKeyword GetObjectIdString GetOrientation GetPoint GetReal GetRemoteFile GetString GetSubEntity InitializeUserInput IsRemoteFile IsURL LaunchBrowserDialog PolarPoint Prompt PutRemoteFile RealToString SendModelessOperationEnded SendModelessOperationStart TranslateCoordinates | None | None

Remarks

Utility functions that allow you to request input from the user or perform geometric calculations.


View Object (ActiveX)

A graphical representation of a 2D drawing or 3D model from a specific location (viewpoint) in space.

Supported Platforms: Windows only

Class Information

Class Name

AcadView

Object Inheritance
Object
   AcadObject
      AcadView
Create Using

VBA

Views.Add
Access Via

VBA

Views.Item

Members

These members are part of this object:

Methods | Properties | Events
Delete GetExtensionDictionary GetXData SetXData | Application CategoryName Center Direction Document Handle HasExtensionDictionary HasVpAssociation Height LayerState LayoutID Name ObjectID ObjectName OwnerID Target Width | Modified

Remarks

The line of sight is drawn from the viewpoint (represented by the Center property) to the target point. The Height and Width properties crop the view. Note that these properties do not change the viewport size, only the size of the view visible within the viewport.

Note that the Delete method for a view is found on the View object, not the Views collection. This is due to programming requirements specific to the View object.

To add a view, use the Add method from the Views collection object.


Viewport Object (ActiveX)

A bounded area that displays some portion of a drawing's model space.

Supported Platforms: Windows only

Class Information

Class Name

AcadViewport

Object Inheritance
Object
   AcadObject
      AcadViewport
Create Using

VBA

Viewports.Add
Access Via

VBA

Viewports.Item
Document.ActiveViewport

Members

These members are part of this object:

Methods | Properties | Events
Delete GetExtensionDictionary GetGridSpacing GetSnapSpacing GetXData SetGridSpacing SetSnapSpacing SetView SetXData Split | Application ArcSmoothness Center Direction Document GridOn Handle HasExtensionDictionary Height LowerLeftCorner Name ObjectID ObjectName OrthoOn OwnerID SnapBasePoint SnapOn SnapRotationAngle Target UCSIconAtOrigin UCSIconOn UpperRightCorner Width | Modified

Remarks

The ActiveSpace property (equivalent to the TILEMODE system variable) determines the type of viewport used.

No editing or view changes can be performed unless the viewport is active. To make a viewport active, use the ActiveViewport property on the Document object.

Once changes have been completed, the viewport must be reset as the active viewport for the changes to appear. To reset the active viewport, simply call the ActiveViewport property again with the updated Viewport object.


Viewports Collection (ActiveX)

The collection of all viewports in the drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadViewports

Object Inheritance
Object
   AcadObject
      AcadViewports
Create Using

VBA

Not applicable
Access Via

VBA

Document.Viewports

Members

These members are part of this object:

Methods | Properties | Events
Add DeleteConfiguration GetExtensionDictionary GetXData Item SetXData | Application Count Document Handle HasExtensionDictionary ObjectID ObjectName OwnerID | Modified

Remarks

To add a new member to the collection, use the Add method. To select a specific viewport, use the Item method. To delete a specific viewport, use the DeleteConfiguration method or the Delete method found on the Viewport object.

The number of viewports you can have active at one time is controlled by the MAXACTVP system variable. There can be only one instance of the Viewports collection. The Viewports collection is predefined for each drawing. You can make multiple references to it by using the Viewports property. Once done with an object, the reference is automatically released.


Views Collection (ActiveX)

The collection of all views in the drawing.

Supported Platforms: Windows only

Class Information

Class Name

AcadViews

Object Inheritance
Object
   AcadObject
      AcadViews
Create Using

VBA

Not applicable
Access Via

VBA

Document.Views

Members

These members are part of this object:

Methods | Properties | Events
Add GetExtensionDictionary GetXData Item SetXData | Application Count Document Handle HasExtensionDictionary ObjectID ObjectName OwnerID | Modified

Remarks

To add a new member to the collection, use the Add method. To select a specific view, use the Item method. To delete a specific view, use the Delete method found on the View object.

Although the Views collection inherits a Delete method, you cannot actually delete the collection. Attempting to delete the Views collection will result in an error. The Delete method has been removed from the documentation for this collection.

There is no limit to the number of views that you can create in your drawing. However, there can be only one instance of the Views collection. The Views collection is predefined for each drawing. You can make multiple references to it by using the Views property. Once done with an object, the reference is automatically released.


Wipeout Object (ActiveX)

Masking object that hides the objects below it in the current draw order.

Supported Platforms: Windows only

Class Information

Class Name

AcadWipeout

Object Inheritance
Object
   AcadObject AcadEntity AcadRasterImage
            AcadWipeout
Create Using

VBA

Not applicable
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular ClipBoundary Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application Brightness ClippingEnabled Contrast Document EntityTransparency Fade Handle HasExtensionDictionary Height Hyperlinks ImageFile ImageHeight ImageVisibility ImageWidth Layer Linetype LinetypeScale Lineweight Material Name ObjectID ObjectName Origin OwnerID PlotStyleName Rotation ScaleFactor ShowRotation Transparency TrueColor Visible Width | Modified

Remarks

Objects of the Wipeout class are polygonally clipped raster entities that are used as masks to cover parts of other entities in the drawing. The most common use is as a background mask for text entities.


XLine Object (ActiveX)

A construction line that is infinite in both directions.

Supported Platforms: Windows only

Class Information

Class Name

AcadXline

Object Inheritance
Object
   AcadObject AcadEntity
         AcadXline
Create Using

VBA

ModelSpace.AddXline
PaperSpace.AddXline
Block.AddXline
Access Via

VBA

ModelSpace.Item
PaperSpace.Item
Block.Item
SelectionSet.Item
Group.Item

Members

These members are part of this object:

Methods | Properties | Events
ArrayPolar ArrayRectangular Copy Delete GetBoundingBox GetExtensionDictionary GetXData Highlight IntersectWith Mirror Mirror3D Move Offset Rotate Rotate3D ScaleEntity SetXData TransformBy Update | Application BasePoint DirectionVector Document EntityTransparency Handle HasExtensionDictionary Hyperlinks Layer Linetype LinetypeScale Lineweight Material ObjectID ObjectName OwnerID PlotStyleName SecondPoint TrueColor Visible | Modified

Remarks

To create an XLine, use the AddXLine method.


XRecord Object (ActiveX)

XRecord objects are used to store and manage arbitrary data.

Supported Platforms: Windows only

Class Information

Class Name

AcadXRecord

Object Inheritance
Object
   AcadObject
      AcadXRecord
Create Using

VBA

Dictionary.AddXRecord
Access Via

VBA

Dictionary.Item

Members

These members are part of this object:

Methods | Properties | Events
Delete GetExtensionDictionary GetXData GetXRecordData SetXData SetXRecordData | Application Document Handle HasExtensionDictionary Name ObjectID ObjectName OwnerID TranslateIDs | Modified

Remarks

This object is similar in concept to XData but is not limited by size or order.

Unlike XData, XRecords work with the standard AutoCAD group codes that are all below 1000 in value. All the standard AutoCAD group codes are supported. This means that, in addition to all the normally used data types, an XRecord is capable of storing object IDs, which allows XRecords to own other objects including other XRecords.

The following group codes are common to all XRecord objects:

  • 100: Subclass marker (AcDbXrecord)
  • 1-369 (except 5 and 105 and 210-239): These values can be used by an application in any way

XRecord objects are saved with the drawing and are directly accessible by other ObjectARX and AutoLISP programs. So, if data security is an issue for your application, you should be careful when storing information in XRecords.

NoteXRecord objects are designed to work in such a way as to not offend Releases 13c0 through 13c3. However, if read into a pre-Release 13c4 level of AutoCAD, XRecord objects disappear.

To create an XRecord, use the AddXRecord method.


Methods

Topics in this section

  • Activate

    Makes the specified drawing active.

  • Add

    Creates a member object and adds it to the appropriate collection.

  • Add3DFace

    Creates a 3DFace object given four vertices.

  • Add3DMesh

    Creates a free-form 3D mesh, given the number of points in the M and N directions and the coordinates of the points in the M and N directions.

  • Add3DPoly

    Creates a 3D polyline from the given array of coordinates.

  • AddArc

    Creates an arc given the center, radius, start angle, and end angle of the arc.

  • AddAttribute

    Creates an attribute definition at the given location with the specified properties.

  • AddBox

    Creates a 3D solid box with edges parallel to the axes of the WCS.

  • AddCircle

    Creates a circle given a center point and radius.

  • AddCone

    Creates a 3D solid cone with the base on the XY plane of the WCS.

  • AddCustomInfo

    Adds a custom property field at the end of the existing list of fields.

  • AddCustomObject

    Creates a custom object.

  • AddCylinder

    Creates a 3D solid cylinder whose base is on the XY plane of the WCS.

  • AddDim3PointAngular

    Creates an angular dimension using 3 points.

  • AddDimAligned

    Creates an aligned dimension object.

  • AddDimAngular

    Creates an angular dimension for an arc, two lines, or a circle.

  • AddDimArc

    Creates an arc length dimension for an arc.

  • AddDimDiametric

    Creates a diametric dimension for a circle or arc given the two points on the diameter and the length of the leader line.

  • AddDimOrdinate

    Creates an ordinate dimension given the definition point and the leader endpoint.

  • AddDimRadial

    Creates a radial dimension for the selected object at the given location.

  • AddDimRadialLarge

    Creates a jogged radial dimension for an arc, circle, or polyline arc segment.

  • AddDimRotated

    Creates a rotated linear dimension.

  • AddEllipse

    Creates an ellipse in the XY plane of the WCS given the center point, a point on the major axis, and the radius ratio.

  • AddEllipticalCone

    Creates a 3D solid elliptical cone on the XY plane of the WCS given the Center, MajorRadius, MinorRadius, and Height.

  • AddEllipticalCylinder

    Creates a 3D solid elliptical cylinder whose base is on the XY plane of the WCS, given the Center, MajorRadius, MinorRadius, and Height.

  • AddExtrudedSolid

    Creates an extruded solid given the Profile, Height, and TaperAngle.

  • AddExtrudedSolidAlongPath

    Creates an extruded solid given the profile and an extrusion path.

  • AddFitPoint

    Adds the fit point to the spline at a given index.

  • AddHatch

    Creates a Hatch object.

  • AddItems

    Adds one or more objects to the specified selection set.

  • AddLeader

    Creates a leader line based on the provided coordinates or adds a new leader cluster to the MLeader object.

  • AddLeaderLine

    Adds a leaderLine to the leader cluster with specified index.

  • AddLeaderLineEx

    Adds a leaderLine to the leader cluster with specified index.

  • AddLightWeightPolyline

    Creates a lightweight polyline from a list of vertices.

  • AddLine

    Creates a line passing through two points.

  • AddMenuItem

    Adds a popup menu item to a popup menu.

  • AddMInsertBlock

    Inserts an array of blocks.

  • AddMLeader

    Creates an mleader line, given coordinates.

  • AddMLine

    Creates multiple lines passing through an array of points.

  • AddMText

    Creates an MText entity in a rectangle defined by the insertion point and width of the bounding box.

  • AddObject

    Adds an object to a named dictionary.

  • AddPoint

    Creates a Point object at a given location.

  • AddPolyfaceMesh

    Creates a polyface mesh from a list of vertices.

  • AddPolyline

    Creates a polyline from a list of vertices.

  • AddPViewport

    Adds a paper space viewport, given the center, height, and width.

  • AddRaster

    Creates a new raster image based on an existing image file.

  • AddRay

    Creates a ray passing through two unique points.

  • AddRegion

    Creates a region from a set of entities. The given entities must form a closed coplanar region.

  • AddRevolvedSolid

    Creates a revolved solid, given the region around an axis.

  • AddSection

    Creates a section plane.

  • AddSeparator

    Adds a separator to an existing menu or toolbar.

  • AddShape

    Creates a Shape object based on a template identified by name, at the given insertion point, scale factor, and rotation.

  • AddSolid

    Creates a 2D solid polygon.

  • AddSphere

    Creates a sphere given the center and radius.

  • AddSpline

    Creates a quadratic or cubic NURBS (nonuniform rational B-spline) curve.

  • AddSubMenu

    Adds a submenu to an existing menu.

  • AddTable

    Adds a table to a drawing.

  • AddText

    Creates a single line of text.

  • AddTolerance

    Creates a tolerance entity.

  • AddToolbarButton

    Adds a toolbar item to a toolbar at a specified position.

  • AddTorus

    Creates a torus at the given location.

  • AddTrace

    Creates a Trace object from an array of points.

  • AddVertex

    Adds a vertex to a lightweight polyline or a section.

  • AddWedge

    Creates a wedge with edges parallel to the axes given the length, width, and height.

  • AddXLine

    Creates an xline (an infinite line) passing through two specified points.

  • AddXRecord

    Creates an XRecord object in any dictionary.

  • AngleFromXAxis

    Gets the angle of a line from the X axis.

  • AngleToReal

    Converts an angle as a string to a real (double) value.

  • AngleToString

    Converts an angle from a real (double) value to a string.

  • AppendInnerLoop

    Appends an inner loop to the hatch.

  • AppendItems

    Appends one or more entities to the specified group.

  • AppendOuterLoop

    Appends an outer loop to the hatch.

  • AppendVertex

    Appends a vertex to the end of a 3DPolyline, Polyline, or PolygonMesh object.

  • ArrayPolar

    Creates a polar array of objects given a NumberOfObjects, AngleToFill, and CenterPoint.

  • ArrayRectangular

    Creates a 2D or 3D rectangular array of objects.

  • AttachExternalReference

    Attaches an external reference (xref) to the drawing.

  • AttachToolbarToFlyout

    Attaches a toolbar to a toolbar button defined as a flyout.

  • AuditInfo

    Evaluates the integrity of the drawing.

  • Bind

    Binds an external reference (xref) to a drawing.

  • Block

    Returns the block of a SortentsTable object.

  • Boolean

    Performs a Boolean operation (union, intersect, or subtract) between the object and another 3DSolid or Region object.

  • CheckInterference

    Checks for interference between two solids and, if specified, creates a solid from the interference.

  • Clear

    Clears the specified selection set of all items.

  • ClearSubSelection

    Removes a subselection set of cells from a table.

  • ClearTableStyleOverrides

    Clears table style overrides.

  • ClipBoundary

    Specifies the clipping boundary for a raster image or an underlay.

  • Close

    Closes the specified drawing, or all open drawings.

  • ConvertToAnonymousBlock

    Converts a dynamic block to a regular anonymous block.

  • ConvertToStaticBlock

    Converts a dynamic block to a regular named block.

  • Copy

    Duplicates the given object to the same location.

  • CopyFrom

    Copies the settings for a dimension style, layout, or plot configuration.

  • CopyObjects

    Duplicates multiple objects (deep cloning).

  • CopyProfile

    Copies the specified profile.

  • CreateCellStyle

    Creates a cell style with the given name.

  • CreateCellStyleFromStyle

    Creates a cell style from a given name.

  • CreateContent

    Creates new content in a cell.

  • CreateEntry

    Creates a new entry in the File Dependency List.

  • CreateJog

    Creates a jog on the section plane.

  • CreateTypedArray

    Creates a variant that contains an array of typed arguments.

  • Delete

    Deletes a specified object or a set of saved layer settings.

  • DeleteCellContent

    Deletes the cell content in the specified row and column.

  • DeleteCellStyle

    Deletes a cell style.

  • DeleteColumns

    Deletes columns from a table.

  • DeleteConfiguration

    Deletes a viewport configuration.

  • DeleteContent

    Deletes content of a cell.

  • DeleteFitPoint

    Deletes the fit point of a spline at a given index.

  • DeleteProfile

    Deletes the specified profile.

  • DeleteRows

    Deletes rows from a table.

  • Detach

    Detaches an external reference (xref) from a drawing.

  • Display

    Toggles the display control of the PViewport object on or off.

  • DisplayPlotPreview

    Displays the Plot Preview dialog box with the full view preview.

  • DistanceToReal

    Converts a distance from a string to a real (double) value.

  • Dock

    Docks the toolbar to the owning frame window.

  • ElevateOrder

    Elevates the order of the spline to the given order.

  • EnableMergeAll

    Controls cell merging.

  • EndUndoMark

    Marks the end of a block of operations.

  • Erase

    Erases all the objects in a selection set.

  • Eval

    Evaluates an expression in VBA.

  • Evaluate

    Evaluates the given hatch or leader.

  • Explode

    Explodes the compound object into subentities.

  • Export

    Exports an AutoCAD drawing or a group of saved layer settings to a file.

  • ExportProfile

    Exports the active profile so it can be shared with other users.

  • FieldCode

    Returns a text string containing field codes.

  • Float

    Floats the toolbar.

  • FormatValue

    Gets the formatted text string for the specified row and column.

  • GenerateLayout

    Generates the layout of a table.

  • GenerateSectionGeometry

    Generates 2D or 3D section geometry.

  • GenerateUsageData

    Generates data specifying whether a layer is in use.

  • GetAcadState

    Gets an AcadState object to monitor the state of AutoCAD from out-of-process applications.

  • GetAlignment

    Returns the cell alignment for a row type.

  • GetAlignment2

    Gets the cell alignment.

  • GetAllProfileNames

    Gets all available profiles for the system.

  • GetAngle

    Gets the angle specified. Considers the setting of the ANGBASE system variable.

  • GetAttachmentPoint

    Returns the attachment point for the specified row and column.

  • GetAttributes

    Gets the attributes in the block reference.

  • GetAutoScale

    Returns the value specifying whether auto scale is used in the specified row and column.

  • GetAutoScale2

    Gets the auto scale flag value for a cell.

  • GetBackgroundColor

    Returns the background color value for the specified row type.

  • GetBackgroundColor2

    Returns the background color value for the specified cell style.

  • GetBackgroundColorNone

    Returns the value specifying that there is no background color for the specified row type.

  • GetBitmaps

    Gets the large and small bitmaps used as icons for the toolbar item.

  • GetBlockAttributeValue

    Gets the attribute value in the block content with an attribute definition id.

  • GetBlockAttributeValue2

    Gets the attribute value associated to a specified block cell.

  • GetBlockRotation

    Returns the block rotation angle for the specified row and column.

  • GetBlockScale

    Returns the block scale value for the specified row and column.

  • GetBlockTableRecordId

    Returns the block table record ID of the cell.

  • GetBlockTableRecordId2

    Gets the block table record object id associated to a specified cell.

  • GetBoundingBox

    Gets two points of a box enclosing the specified object.

  • GetBreakHeight

    Get the break height of the table.

  • GetBulge

    Gets the bulge value at a given index of the polyline.

  • GetCanonicalMediaNames

    Gets all available canonical media names for the specified plot device.

  • GetCellAlignment

    Returns the alignment for the cell in the specified row and column.

  • GetCellBackgroundColor

    Returns the background true color value of a cell in the specified row and column.

  • GetCellBackgroundColorNone

    Returns the value specifying that there is no background color for the specified row and column.

  • GetCellClass

    Gets the class of a cell style.

  • GetCellContentColor

    Returns the true color value for the content of the specified row and column.

  • GetCellContentColor2

    Gets the true color value for a cell.

  • GetCellDataType

    Gets the cell data and unit type for the given row and column.

  • GetCellExtents

    Returns the cell extents for the specified row and column.

  • GetCellFormat

    Gets the cell format for the given row and column.

  • GetCellGridColor

    Returns the grid color value for an edge of the specified row and column.

  • GetCellGridLineWeight

    Returns the grid lineweight value for an edge of the specified row and column.

  • GetCellGridVisibility

    Returns the grid visibility value for an edge of the specified row and column.

  • GetCellState

    Get a cell's state.

  • GetCellStyle

    Gets the cell style.

  • GetCellStyleOverrides

    Returns the cell style overrides.

  • GetCellStyles

    Gets an array of all the named cell styles associated with the table style.

  • GetCellTextHeight

    Returns the text height for the specified row and column.

  • GetCellTextStyle

    Returns the text style name for the specified row and column.

  • GetCellType

    Returns the cell type for the specified row and column.

  • GetCellValue

    Gets the cell value for the given row and column.

  • GetColor

    Returns the true color value for the specified row type.

  • GetColor2

    Returns the color value for the specified named cell style.

  • GetColumnName

    Gets a column's name.

  • GetColumnWidth

    Returns the column width for the column at the specified column index in the table.

  • GetConstantAttributes

    Gets the constant attributes in the block or external reference.

  • GetContentColor

    Returns the true color value for the specified row type.

  • GetContentColor2

    Returns the color value for the specified content located at the provided row, column, and content index.

  • GetContentLayout

    Get a cell's content layout.

  • GetContentType

    Get a cell's content type.

  • GetControlPoint

    Gets the coordinates of the control point at a given index.

  • GetCorner

    Gets a corner of a rectangle.

  • GetCustomByIndex

    Returns the custom property name (key) and value that correspond to an index value.

  • GetCustomByKey

    Returns the custom property value that corresponds to a name (key) value.

  • GetCustomData

    Gets the custom data associated to a cell.

  • GetCustomScale

    Gets the custom scale for a layout or plot configuration.

  • GetDataFormat

    Gets a cell's format.

  • GetDataType

    Returns the data type and unit type for the specified row type.

  • GetDataType2

    Gets the row data type and unit type for the specified row type and nContent.

  • GetDistance

    Gets the distance from the prompt line or a selected set of points on the screen.

  • GetDoglegDirection

    Gets the dog leg direction of the specific leader.

  • GetDynamicBlockProperties

    Gets the properties of the dynamic block.

  • GetEntity

    Gets an object interactively.

  • GetExtensionDictionary

    Gets the extension dictionary associated with an object.

  • GetFieldId

    Returns the field object ID of the specified cell.

  • GetFieldId2

    Gets the field object id associated to the specified cell.

  • GetFitPoint

    Gets the fit point of a spline at a given index.

  • GetFont

    Gets the definition data of the font for the TextStyle.

  • GetFormat

    Returns the format for the specified row type.

  • GetFormat2

    Gets the format of a cell style.

  • GetFormula

    Get a cell's formula.

  • GetFullDrawOrder

    Returns all of the objects in a block, sorted by draw order with the bottom object first.

  • GetGridColor

    Returns the grid color value for a grid linetype and row type.

  • GetGridColor2

    Gets the gridColor for the specified cell.

  • GetGridDoubleLineSpacing

    Gets the lineSpacing value for the specified cell.

  • GetGridLineStyle

    Get a cell's gridLineStyle.

  • GetGridLinetype

    Gets the idLinetype with the gridLinetype value for the specified cell.

  • GetGridLineWeight

    Returns a grid lineweight value for a grid linetype and row type.

  • GetGridLineWeight2

    Gets the gridLineWeight value for the specified cell.

  • GetGridSpacing

    Gets the grid spacing for the viewport.

  • GetGridVisibility

    Returns a grid visibility value for the specified grid linetype and row type.

  • GetGridVisibility2

    Returns the gridVisibility value for the specified cell.

  • GetHasFormula

    Check if a cell has a formula.

  • GetInput

    Converts a user's input string into a keyword index.

  • GetInteger

    Gets an integer value from the user.

  • GetInterfaceObject

    Accepts a program ID and attempts to load it into AutoCAD as an in-process server.

  • GetInvisibleEdge

    Gets the visibility setting for an edge of a 3DFace object at a given index.

  • GetIsCellStyleInUse

    Gets the usage status of a cell style.

  • GetIsMergeAllEnabled

    Gets value of the "merge all" property.

  • GetKeyword

    Gets a keyword string from the user.

  • GetLeaderIndex

    Gets the index of leader cluster which the specified leader line is in.

  • GetLeaderLineIndexes

    Gets the indexes of leaderlines of the specific leader.

  • GetLeaderLineVertices

    Gets the vertices of leaderLine with specified index.

  • GetLiveSection

    Gets the live section plane that is currently enabled in the database.

  • GetLocaleMediaName

    Gets the localized version of the canonical media name.

  • GetLoopAt

    Gets the hatch loop at a given index.

  • GetMargin

    Get a cell's margin value.

  • GetMinimumColumnWidth

    Gets the minimum column width for the column at the specified column index in the table.

  • GetMinimumRowHeight

    Returns the minimum row height for the specified row.

  • GetName

    Gets the name (keyword) of an object in a dictionary.

  • GetObject

    Gets the object in a dictionary, given the name (keyword) of the object.

  • GetObjectIdString

    Returns an object's ID as a string.

  • GetOrientation

    Gets the angle specified. Ignores the setting of the ANGBASE system variable.

  • GetOverride

    Get a cell's overrides.

  • GetPaperMargins

    Gets the margins for the layout or plot configuration.

  • GetPaperSize

    Gets the width and height of the configured paper.

  • GetPlotDeviceNames

    Gets all available plot device names.

  • GetPlotStyleTableNames

    Gets all available plot style table names.

  • GetPoint

    Gets the point selected in AutoCAD.

  • GetProjectFilePath

    Gets the directory in which AutoCAD looks for external reference files.

  • GetReal

    Gets a real (double) value from the user.

  • GetRelativeDrawOrder

    Returns the objects specified, sorted by the draw order, with the bottom object first.

  • GetRemoteFile

    Downloads the file specified by a URL.

  • GetRotation

    Gets the rotation value for a cell or cell style.

  • GetRowHeight

    Returns the row height for the row at the specified row index in the table.

  • GetRowType

    Returns the row type for the specified row.

  • GetScale

    Gets the scale value for a cell.

  • GetSectionTypeSettings

    Gets the section type settings object.

  • GetSnapSpacing

    Gets the snap spacing for the viewport.

  • GetString

    Gets a string from the user.

  • GetSubEntity

    Gets an object or subentity interactively.

  • GetSubSelection

    Returns the row and column indexes of the cells in a subselection set.

  • GetText

    Returns the text value for the specified row and column.

  • GetTextHeight

    Returns the text height for the specified row type.

  • GetTextHeight2

    Gets the text height for a cell.

  • GetTextRotation

    Returns the text rotation for the specified row and column.

  • GetTextString

    Gets the text value of a cell.

  • GetTextStyle

    Gets the text style name for the specified row types.

  • GetTextStyle2

    Gets the text style name for a cell.

  • GetTextStyleId

    Gets the object id for a named cell style.

  • GetUCSMatrix

    Gets the transformation matrix consisting of UCS coordinate system data.

  • GetUniqueCellStyleName

    Gets a unique cell style name with the base name that is passed as the prefix.

  • GetUniqueSectionName

    Finds a unique section plane name.

  • GetValue

    Gets the value of a cell.

  • GetVariable

    Gets the current setting of an AutoCAD system variable.

  • GetVertexCount

    Gets the number of vertices in the specified leaderline.

  • GetWeight

    Gets the weight of the control point at a given index.

  • GetWidth

    Gets the start and end width for a polyline.

  • GetWindowToPlot

    Gets the coordinates that define the portion of the layout to plot.

  • GetXData

    Gets the extended data (XData) associated with an object.

  • GetXRecordData

    Gets the extended record data (XRecordData) associated with a dictionary.

  • HandleToObject

    Gets the object that corresponds to the given handle.

  • Highlight

    Sets the highlight status for the given object, or for all objects in a given selection set.

  • HitTest

    Performs a hit test on the section plane or table cell at the specified location.

  • Import

    Imports a drawing or a group of saved layer settings from a file.

  • ImportProfile

    Imports a profile created by another user.

  • IndexOf

    Provides the index of an entry in the File Dependency List.

  • InitializeUserInput

    Initializes the GetKeyword method.

  • InsertBlock

    Inserts a drawing file or a named block that has been defined in the current drawing.

  • InsertColumns

    Inserts columns in a table.

  • InsertColumnsAndInherit

    Insert columns into a table from another table.

  • InsertInMenuBar

    Inserts the popup menu into the AutoCAD menu bar at a specified location.

  • InsertLoopAt

    Inserts a loop at a given index of a hatch.

  • InsertMenuInMenuBar

    Inserts a menu into the AutoCAD menu bar.

  • InsertRows

    Inserts rows in a table.

  • InsertRowsAndInherit

    Insert rows into a table from another table.

  • IntersectWith

    Gets the points where one object intersects another object in the drawing.

  • IsContentEditable

    Check if a cell has editable content.

  • IsEmpty

    Determines if a cell is empty based on its row and column position.

  • IsFormatEditable

    Check if a cell has editable format.

  • IsMergeAllEnabled

    Checks if cell merging is on.

  • IsMergedCell

    Returns the merge status of a cell.

  • IsRemoteFile

    Returns the URL from which a remote file was downloaded.

  • IsURL

    Validates a given URL.

  • Item

    Gets the member object at a given index in a collection, group, or selection set.

  • LaunchBrowserDialog

    Launches a dialog box in which a user can enter a URL.

  • ListARX

    Gets the currently loaded ObjectARX applications.

  • Load

    Loads a menu group from a customization (CUIx) file or the definition of a linetype from a library (LIN) file.

  • LoadARX

    Loads the specified ObjectARX application.

  • LoadDVB

    Loads the specified AutoCAD VBA project file.

  • LoadShapeFile

    Loads a shape file (SHX).

  • MergeCells

    Merges cells in a table.

  • Mirror

    Creates a mirror-image copy of a planar object around an axis.

  • Mirror3D

    Creates a mirror image of the given object about a plane.

  • Move

    Moves an object along a vector.

  • MoveAbove

    Moves objects above the target in the draw order.

  • MoveBelow

    Moves objects below the target in the draw order.

  • MoveContent

    Moves the index content of a cell.

  • MoveToBottom

    Moves objects to the bottom of the draw order.

  • MoveToTop

    Moves objects to the top of the draw order.

  • New

    Creates a new document in SDI mode.

  • NumCustomInfo

    Returns the number of custom property fields that have been set.

  • ObjectIDToObject

    Gets the object that corresponds to the given object ID.

  • Offset

    Creates a new object at a specified offset distance from an existing object.

  • Open

    Opens an existing drawing file (DWG) and makes it the active document.

  • PlotToDevice

    Plots a layout to a device.

  • PlotToFile

    Plots a layout to the specified file.

  • PolarPoint

    Gets the point at a specified angle and distance from a given point.

  • Prompt

    Displays a prompt on the command line.

  • PurgeAll

    Removes unused named references such as unused blocks or layers from the document.

  • PurgeFitData

    Purges the fit data of a spline.

  • PutRemoteFile

    Uploads a file to a remote FTP location specified by a URL known to AutoCAD.

  • Quit

    Closes the drawing file and exits the AutoCAD application.

  • RealToString

    Converts a real (double) value to a string.

  • RecomputeTableBlock

    Updates a table block.

  • RefreshPlotDeviceInfo

    Updates the plot, canonical media, and plot style table information to reflect the current system state.

  • Regen

    Regenerates the entire drawing and recomputes the screen coordinates and view resolution for all objects.

  • Reload

    Reloads the external reference (xref).

  • Remove

    Removes a named object from the dictionary.

  • RemoveAllOverrides

    Removes all the overrides for a cell.

  • RemoveCustomByIndex

    Deletes the custom property name (key) and value that correspond to an index value.

  • RemoveCustomByKey

    Deletes the custom property value that corresponds to a name (key) value.

  • RemoveEntry

    Removes an identified entry from the File Dependency List.

  • RemoveFromMenuBar

    Removes the popup menu from the AutoCAD menu bar.

  • RemoveItems

    Removes specified items from the group or selection set.

  • RemoveLeader

    Removes the leader cluster with specified index.

  • RemoveLeaderLine

    Removes the leaderLine with specified index.

  • RemoveMenuFromMenuBar

    Removes the popup menu, as specified from the collection, from the AutoCAD menu bar.

  • RemoveVertex

    Removes a vertex in the section line.

  • Rename

    Renames an item in a dictionary or a set of saved layer settings.

  • RenameCellStyle

    Renames a cell style.

  • RenameProfile

    Renames the specified profile.

  • Replace

    Replaces an item in the dictionary by a given item.

  • ReselectSubRegion

    Returns subentities of a selection set in a table.

  • ResetBlock

    Resets the dynamic block to the default state.

  • ResetCellValue

    Reset the cell value for the given row and column.

  • ResetProfile

    Resets the value in the specified profile to its default values.

  • Restore

    Restores a group of layer property settings.

  • Reverse

    Reverses the direction of a spline.

  • Rotate

    Rotates an object around a base point.

  • Rotate3D

    Rotates an object around a 3D axis. Point1 and Point2 define the line that becomes the axis of rotation.

  • RunMacro

    Runs a VBA macro from the Application object.

  • Save

    Saves a document or group of layer property settings; no longer supported for menu groups.

  • SaveAs

    Saves the document to a specified file; no longer supported for menu groups.

  • ScaleEntity

    Scales an object equally in the X, Y, and Z directions.

  • SectionSolid

    Creates a region that represents the intersection of a plane defined by three points and the solid.

  • Select

    Selects objects and places them into a selection set, or selects a cell in a table.

  • SelectAtPoint

    Selects an object passing through a given point and places it into a selection set.

  • SelectByPolygon

    Selects objects within a fence and adds them to the selection set.

  • SelectOnScreen

    Prompts the user to pick an object from the screen.

  • SelectSubRegion

    Selects a set of cells in a table.

  • SendCommand

    Sends a command string from a VB or VBA application to the document for processing.

  • SendModelessOperationEnded

    Indicates a modeless operation has ended.

  • SendModelessOperationStart

    Indicates a modeless operation will start.

  • SetAlignment

    Sets a cell alignment for the specified row types.

  • SetAlignment2

    Sets the cell alignment.

  • SetAutoScale

    Sets the value specifying whether auto scale is used in the specified row and column.

  • SetAutoScale2

    Sets the auto-scale flag value for a cell.

  • SetBackgroundColor

    Sets a background color value for the specified row types.

  • SetBackgroundColor2

    Sets a background color value for the specified named cell style.

  • SetBackgroundColorNone

    Sets the value specifying whether there is no background color for the specified row types.

  • SetBitmaps

    Sets the large and small bitmaps used as icons for the toolbar item.

  • SetBlockAttributeValue

    Sets the attribute value for an attribute in a block contained within a MLeader or Table object.

  • SetBlockAttributeValue2

    Sets the attribute value associated to a specified block cell.

  • SetBlockRotation

    Sets the block rotation angle for the specified row and column.

  • SetBlockScale

    Sets the block scale value for the specified row and column.

  • SetBlockTableRecordId

    Sets the block table record ID of the cell.

  • SetBlockTableRecordId2

    Sets the block table record object id associated to a specified cell.

  • SetBreakHeight

    Sets the break height for the table.

  • SetBulge

    Sets the bulge for the polyline at the given index.

  • SetCellAlignment

    Sets the cell alignment for the specified row and column.

  • SetCellBackgroundColor

    Sets the background true color value for the specified row and column.

  • SetCellBackgroundColorNone

    Sets the value specifying that there is no background color for the specified row and column.

  • SetCellClass

    Sets the class of a cell style.

  • SetCellContentColor

    Sets the true color value for the content of the specified row and column.

  • SetCellDataType

    Sets the cell data and unit type for the given row and column.

  • SetCellFormat

    Sets the cell format for the given row and column.

  • SetCellGridColor

    Sets the grid color value for an edge of the specified row and column.

  • SetCellGridLineWeight

    Sets the grid lineweight value for an edge of the specified row and column.

  • SetCellGridVisibility

    Sets the grid visibility value for an edge of the specified row and column.

  • SetCellState

    Sets the state for a cell.

  • SetCellStyle

    Sets a cell style to the cell.

  • SetCellTextHeight

    Sets the text height for the specified row and column.

  • SetCellTextStyle

    Sets the text style name for the specified row and column.

  • SetCellType

    Sets the cell type for the specified row and column.

  • SetCellValue

    Sets the cell value for the given row and column.

  • SetCellValueFromText

    Sets the cell value for the given row and column.

  • SetColor

    Sets the true color value for the specified row types.

  • SetColor2

    Sets the color value for the specified named cell style.

  • SetColorBookColor

    Specifies the color name from an existing color book.

  • SetColumnName

    Sets a name to a column.

  • SetColumnWidth

    Sets the column width for the column at the specified column index in the table.

  • SetContentColor

    Sets the true color value for the specified row types.

  • SetContentColor2

    Sets the color value for the cell content based on the row, column, and content location.

  • SetContentLayout

    Sets the content layout for a cell.

  • SetControlPoint

    Sets the control point of the spline at a given index.

  • SetCustomByIndex

    Sets the custom property name (key) and value that correspond to an index value.

  • SetCustomByKey

    Sets the custom property value that corresponds to a name (key) value.

  • SetCustomData

    Sets the custom data associated to a cell.

  • SetCustomScale

    Sets the custom scale for a layout or plot configuration.

  • SetDatabase

    Associates an AutoCAD database with the LayerStateManager object.

  • SetDataFormat

    Sets the format for the cell.

  • SetDataType

    Sets the data type and unit type for the specified row type.

  • SetDataType2

    Sets the row data type and unit type for the specified row type and nContent.

  • SetDoglegDirection

    Sets the dog leg direction of the specific leader.

  • SetFieldId

    Sets the field object ID of the specified cell.

  • SetFieldId2

    Sets the field object id associated to a specified cell.

  • SetFitPoint

    Sets a fit point for the spline.

  • SetFont

    Sets the definition data of the font for the TextStyle.

  • SetFormat

    Sets the format for the specified row type.

  • SetFormat2

    Sets the format of a cell style.

  • SetFormula

    Sets the formula for a cell.

  • SetGridColor

    Sets the grid color value for the specified grid linetypes and row types.

  • SetGridColor2

    Sets the gridColor for the specified cell.

  • SetGridDoubleLineSpacing

    Sets the lineSpacing value for the specified cell.

  • SetGridLineStyle

    Sets the gridLineStyle for a cell.

  • SetGridLinetype

    Sets the object with the gridLinetype value for the specified cell.

  • SetGridLineWeight

    Sets the grid lineweight value for the specified grid linetypes and row types.

  • SetGridLineWeight2

    Sets the gridLineWeight value for the specified cell.

  • SetGridSpacing

    Sets the grid spacing for the viewport.

  • SetGridVisibility

    Sets the grid visibility value for the specified grid linetype and row types.

  • SetGridVisibility2

    Sets the gridVisibility value for the specified cell or cell style.

  • SetInvisibleEdge

    Sets the visibility state of an edge at a given index.

  • SetLayoutsToPlot

    Specifies the layout or layouts to plot.

  • SetLeaderLineVertices

    Sets the vertices of leaderLine with specified index.

  • SetMargin

    Sets the margin for a cell.

  • SetNames

    Specifies the color name and book name of the color.

  • SetOverride

    Sets the overrides for a cell.

  • SetPattern

    Sets the pattern name and pattern type for the hatch.

  • SetProjectFilePath

    Sets the directory in which AutoCAD looks for external reference files.

  • SetRelativeDrawOrder

    Sets the relative draw order specified, with the bottom objects first.

  • SetRGB

    Specifies the RGB values of the True Color.

  • SetRotation

    Sets the rotation value for a cell.

  • SetRowHeight

    Sets the height for the row at the specified row index in the table.

  • SetScale

    Sets the scale value for a cell.

  • SetSnapSpacing

    Sets the snap spacing for the viewport.

  • SetSubSelection

    Sets the row and column indices of the cells in a subselection set.

  • SetTemplateId

    Sets a template using an object ID to the table style.

  • SetText

    Sets the text value for the specified row and column.

  • SetTextHeight

    Sets the text height for the specified row types.

  • SetTextHeight2

    Sets the text height for a cell.

  • SetTextRotation

    Sets the text rotation for the specified row and column.

  • SetTextString

    Sets the text value of a cell.

  • SetTextStyle

    Sets the text style name for the specified row types.

  • SetTextStyle2

    Sets the text style name for a cell.

  • SetTextStyleId

    Sets a text style using an object ID to a named cell style.

  • SetToolTip

    Sets the tooltip for a cell.

  • SetValue

    Sets the value of a cell.

  • SetValueFromText

    Sets the value of a cell by parsing the text.

  • SetVariable

    Sets the value of an AutoCAD system variable.

  • SetView

    Sets the view in a viewport to a saved view in the Views collection object.

  • SetWeight

    Sets the weight of the control point at a given index.

  • SetWidth

    Sets the start and end width of a polyline, given the segment index.

  • SetWindowToPlot

    Sets the coordinates that define the portion of the layout to plot.

  • SetXData

    Sets the extended data (XData) associated with an object.

  • SetXRecordData

    Sets the extended record data (XRecordData) associated with a dictionary.

  • SliceSolid

    Creates a slice of the 3DSolid object given three points that define the plane.

  • Split

    Splits a viewport into the given number of views.

  • StartBatchMode

    Starts printing in batch mode. (Obsolete)

  • StartUndoMark

    Marks the beginning of a block of operations.

  • SwapOrder

    Swaps the draw order positions of two objects.

  • SyncModelView

    Updates the viewport parameters with the parameters in the associated model view.

  • TransformBy

    Moves, scales, or rotates an object given a 4x4 transformation matrix.

  • TranslateCoordinates

    Translates a point from one coordinate system to another.

  • Unload

    Unloads the menu group or external reference.

  • UnloadARX

    Unloads the specified AutoCAD ARX application.

  • UnloadDVB

    Unloads the specified AutoCAD VBA project file.

  • UnmergeCells

    Splits merged cells in a table.

  • Update

    Updates the object to the drawing screen.

  • UpdateEntry

    Erases and then recreates an identified entry in the File Dependency List.

  • UpdateMTextAttribute

    Updates attribute from the multiline text and multiline text from an attribute.

  • WBlock

    Writes out the given selection set as a new drawing file.

  • ZoomAll

    Zooms the current viewport to display the entire drawing.

  • ZoomCenter

    Zooms the current viewport to a specified center point and magnification.

  • ZoomExtents

    Zooms the current viewport to the drawing extents.

  • ZoomPickWindow

    Zooms the current viewport to a window defined by points picked on the screen.

  • ZoomPrevious

    Zooms the current viewport to its previous extents.

  • ZoomScaled

    Zooms the current viewport to given scale factor.

  • ZoomWindow

    Zooms the current viewport to the area specified by two opposite corners of a rectangle.


Activate Method (ActiveX)

Makes the specified drawing active.

Supported platforms: Windows only

Signature

VBA:

object.Activate
object

Type: Document

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ActivateMethod()
    ' This example creates two new drawings and activates each drawing in turn.

    Dim NewDrawing1 As AcadDocument
    Dim Newdrawing2 As AcadDocument
    Set NewDrawing1 = ThisDrawing.Application.Documents.Add("")
    Set Newdrawing2 = ThisDrawing.Application.Documents.Add("")

    Dim drawing As AcadDocument
    For Each drawing In ThisDrawing.Application.Documents
        drawing.Activate
        MsgBox "Drawing " & drawing.name & " is active."
    Next drawing
End Sub

Visual LISP:

Not available


Add Method (ActiveX)

Creates a member object and adds it to the appropriate collection.

Supported platforms: Windows only

Signature - Blocks

VBA:

RetVal = object.Add(InsertionPoint, Name)
object

Type: Blocks

The object this method applies to.

InsertionPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying where the Blocks object will be added.

Name

Access: Input-only

Type: String

The name of the block to add to the collection.

Signature - UCSs

VBA:

RetVal = object.Add(Origin, XAxisPoint, YAxisPoint, Name)
object

Type: UCSs

The object this method applies to.

Origin

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying where the UCS is to be added.

XAxisPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying a point on the positive X axis of the UCS. The XAxisPoint and YAxisPoint together cannot specify the same location as the Origin.

YAxisPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying a point on the positive Y axis of the UCS. (The Z axis follows by applying the right-hand rule.)

Name

Access: Input-only

Type: String

The name of the UCS to add to the collection.

Signature - Hyperlinks

VBA:

RetVal = object.Add(Name [, Description] [, NamedLocation])
object

Type: Hyperlinks

The object this method applies to.

Name

Access: Input-only

Type: String

The name of the hyperlink to add.

Description

Access: Input-only; optional

Type: Variant

The description of the hyperlink to add.

NamedLocation

Access: Input-only; optional

Type: Variant

A given location, such as a named view in AutoCAD or a bookmark in a word processing program. If you specify a named view to jump to in an AutoCAD drawing, AutoCAD restores that view when the hyperlink is opened.

Signature - PlotConfigurations

VBA:

RetVal = object.Add(Name [, ModelType])
object

Type: PlotConfigurations

The object this method applies to.

Name

Access: Input-only

Type: String

The name of the object to add to the collection.

ModelType

Access: Input-only; optional

Type: Boolean

  • True: The plot configuration applies only to the Model tab.
  • False: The plot configuration applies to all layouts.

Signature - All other supported objects

VBA:

RetVal = object.Add(Name)
object

Type: Dictionaries, DimStyles, Documents, Groups, Layers, Layouts, Linetypes, Materials, PopupMenus, RegisteredApplications, SelectionSets, TextStyles, Toolbars, Views, Viewports

The object this method applies to.

Name

Access: Input-only; optional the Documents object

Type: String

The name of the object to add to the collection. For the Documents, this name represents the name of the drawing template to use and will accept a URL address or a fully qualified path and file name.

Return Value (RetVal)

Type: Block, Dictionary, DimStyle, Document, Group, Hyperlink, Layer, Layout, Linetype, Material, PlotConfiguration, PopupMenu, RegisteredApplication, SelectionSet, TextStyle, Toolbar, UCS, View, Viewport

The newly added object.

Remarks

Although you can create a linetype and add it to the Linetypes object using this method, it will be created with the default properties only. Because you cannot edit properties of the Linetype object with this release of ActiveX Automation, use the Load method to load existing linetypes into your drawing.

Layers are created with default color and linetype properties. The default color is white, and the default linetype is standard.

Documents: When accessing a secure URL, a dialog box will be posted that prompts the user for the necessary password information. Message boxes may also be displayed if the user has not suppressed this activity in the browser. When downloading a file, AutoCAD creates a temporary file for internal processing. Do not attempt to access this temporary file. Information in this file is deleted at the end of the AutoCAD session.

Group: You should not specify a Name that is excessively long or contains spaces, because these names are not handled well in the Group dialog box and cannot be entered at the command line.

Examples

VBA:

Sub Example_Add()
    ' This example adds a block, dictionary, dimension style,
    ' group, layer, registered application, selection set,
    ' textstyle, view, viewport and UCS using the Add method.

    GoSub ADDBLOCK
    GoSub ADDDICTIONARY
    GoSub ADDDIMSTYLE
    GoSub ADDGROUP
    GoSub ADDLAYER
    GoSub ADDREGISTEREDAPP
    GoSub ADDSELECTIONSET
    GoSub ADDTEXTSTYLE
    GoSub ADDVIEW
    GoSub ADDVIEWPORT
    GoSub ADDUCS
    GoSub ADDMATERIAL
    Exit Sub

ADDBLOCK:
    ' Create a new block called "New_Block"
    Dim blockObj As AcadBlock

    ' Define the block
    Dim insertionPnt(0 To 2) As Double
    insertionPnt(0) = 0#: insertionPnt(1) = 0#: insertionPnt(2) = 0#

    ' Add the block to the blocks collection
    Set blockObj = ThisDrawing.Blocks.Add(insertionPnt, "New_Block")
    MsgBox blockObj.name & " has been added." & vbCrLf & _
            "Origin: " & blockObj.origin(0) & ", " & blockObj.origin(1) _
            & ", " & blockObj.origin(2), , "Add Example"
    Return

ADDDICTIONARY:
    ' Create a new dictionary called "New_Dictionary"
    Dim dictObj As AcadDictionary

    ' Add the dictionary to the dictionaries collection
    Set dictObj = ThisDrawing.Dictionaries.Add("New_Dictionary")
    MsgBox dictObj.name & " has been added.", , "Add Example"
    Return

ADDDIMSTYLE:
    ' Create a new dimension style called "New_Dimstyle" in current drawing
    Dim DimStyleObj As AcadDimStyle

    ' Add the dimstyle to the dimstyles collection
    Set DimStyleObj = ThisDrawing.DimStyles.Add("New_Dimstyle")
    MsgBox DimStyleObj.name & " has been added.", , "Add Example"
    Return

ADDGROUP:
    ' Create a new group called "New_Group" in current drawing
    Dim groupObj As AcadGroup

    ' Add the group to the groups collection
    Set groupObj = ThisDrawing.Groups.Add("New_Group")
    MsgBox groupObj.name & " has been added.", , "Add Example"
    Return

ADDLAYER:
    ' This example creates a new layer called "New_Layer"
    Dim layerObj As AcadLayer

    ' Add the layer to the layers collection
    Set layerObj = ThisDrawing.Layers.Add("New_Layer")

    ' Make the new layer the active layer for the drawing
    ThisDrawing.ActiveLayer = layerObj

    ' Display the status of the new layer
     MsgBox layerObj.name & " has been added." & vbCrLf & _
            "LayerOn Status: " & layerObj.LayerOn & vbCrLf & _
            "Freeze Status: " & layerObj.Freeze & vbCrLf & _
            "Lock Status: " & layerObj.Lock & vbCrLf & _
            "Color: " & layerObj.Color, , "Add Example"
    Return

ADDREGISTEREDAPP:
    ' Create a registered application named "New_RegApp" in current drawing
    Dim RegAppObj As AcadRegisteredApplication

    ' Add the registered application to the registered applications collection
    Set RegAppObj = ThisDrawing.RegisteredApplications.Add("New_RegApp")
    MsgBox RegAppObj.name & " has been added.", , "Add Example"
    Return

ADDSELECTIONSET:
    ' Create a selectionset named "New_SelectionSet" in current drawing
    Dim ssetObj As AcadSelectionSet

    ' Add the selection set to the selection sets collection
    Set ssetObj = ThisDrawing.SelectionSets.Add("New_SelectionSet")
    MsgBox ssetObj.name & " has been added." & vbCrLf & _
           "The number of items in the selection set is " & ssetObj.count _
           , , "Add Example"
    Return

ADDTEXTSTYLE:
    ' Create a textstyle named "New_Textstyle" in current drawing
    Dim txtStyleObj As AcadTextStyle

    ' Add the textstyle to the textstyles collection
    Set txtStyleObj = ThisDrawing.TextStyles.Add("New_Textstyle")
    MsgBox txtStyleObj.name & " has been added." & vbCrLf & _
           "Height: " & txtStyleObj.height & vbCrLf & _
           "Width: " & txtStyleObj.width, , "Add Example"
    Return

ADDVIEW:
    ' Create a view named "New_View" in current drawing
    Dim viewObj As AcadView

    ' Add the view to the views collection
    Set viewObj = ThisDrawing.Views.Add("New_View")
    MsgBox viewObj.name & " has been added." & vbCrLf & _
           "Height: " & viewObj.height & vbCrLf & _
           "Width: " & viewObj.width, , "Add Example"
    Return

ADDVIEWPORT:
    ' Create a viewport named "New_Viewport" in current drawing
    Dim vportObj As AcadViewport

    ' Add the viewport to the viewports collection
    Set vportObj = ThisDrawing.Viewports.Add("New_Viewport")
    MsgBox vportObj.name & " has been added." & vbCrLf & _
           "GridOn Status: " & vportObj.GridOn & vbCrLf & _
           "OrthoOn Status: " & vportObj.OrthoOn & vbCrLf & _
           "SnapOn Status: " & vportObj.SnapOn, , "Add Example"
    Return

ADDUCS:
    ' Create a UCS named "New_UCS" in current drawing
    Dim ucsObj As AcadUCS
    Dim origin(0 To 2) As Double
    Dim xAxisPnt(0 To 2) As Double
    Dim yAxisPnt(0 To 2) As Double

    ' Define the UCS
    origin(0) = 4#: origin(1) = 5#: origin(2) = 3#
    xAxisPnt(0) = 5#: xAxisPnt(1) = 5#: xAxisPnt(2) = 3#
    yAxisPnt(0) = 4#: yAxisPnt(1) = 6#: yAxisPnt(2) = 3#

    ' Add the UCS to the UserCoordinatesSystems collection
    Set ucsObj = ThisDrawing.UserCoordinateSystems.Add(origin, xAxisPnt, yAxisPnt, "New_UCS")
    MsgBox ucsObj.name & " has been added." & vbCrLf & _
            "Origin: " & ucsObj.origin(0) & ", " & ucsObj.origin(1) _
            & ", " & ucsObj.origin(2), , "Add Example"
    Return

ADDMATERIAL:
    Dim oMaterial As AcadMaterial
    Dim oMaterials As AcadMaterials
    Set oMaterial = ThisDrawing.Materials.Add("TestMaterial")
    oMaterial.Description = "This example demonstrates how to add a material to a database."
    ThisDrawing.ActiveMaterial = oMaterial
        ' Display the status of the new layer
    MsgBox oMaterial.Name & " has been added." & vbCrLf & _
            "Name: " & oMaterial.Name & vbCrLf & vbCrLf & _
            "Description: " & vbCrLf & vbCrLf & _
            oMaterial.Description
    Return

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Add()
    ;; This example adds a block, dictionary, dimension style,
    ;; group, layer, registered application, selection set,
    ;; textstyle, view, viewport and UCS using the Add method.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

;; ADDBLOCK:
    ;; Create a new block called "New_Block"

    ;; Define the insertion point
    (setq insertionPnt (vlax-3d-point 0 0 0))

    ;; Add the block to the blocks collection
    (setq blocks (vla-get-Blocks doc))
    (setq blockObj (vla-Add blocks insertionPnt "New_Block"))
    (alert (strcat (vla-get-Name blockObj) " has been added."
                    "\nOrigin: " (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-Origin blockObj)) 0) 2 2) ", "
                         (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-Origin blockObj)) 1) 2 2) ", "
                         (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-Origin blockObj)) 2) 2 2)
           )
    )

;; ADDDICTIONARY:
    ;; Create a new dictionary called "New_Dictionary"

    ;; Add the dictionary to the dictionaries collection
    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Add dictionaries "New_Dictionary"))
    (alert (strcat (vla-get-Name dictObj) " has been added."))

;; ADDDIMSTYLE:
    ;; Create a new dimension style called "New_Dimstyle" in current drawing

    ;; Add the dimstyle to the dimstyles collection
    (setq dimStyles (vla-get-DimStyles doc))
    (setq dimStyleObj (vla-Add dimStyles "New_Dimstyle"))
    (alert (strcat (vla-get-Name dimStyleObj) " has been added."))

;; ADDGROUP:
    ;; Create a new group called "New_Group" in current drawing

    ;; Add the group to the groups collection
    (setq groups (vla-get-Groups doc))
    (setq groupObj (vla-Add dimStyles "New_Group"))
    (alert (strcat (vla-get-Name groupObj) " has been added."))

;; ADDLAYER:
    ;; This example creates a new layer called "New_Layer"

    ;; Add the layer to the layers collection
    (setq layers (vla-get-Layers doc))
    (setq layerObj (vla-Add layers "New_Layer"))

    ;; Make the new layer the active layer for the drawing
    (vla-put-ActiveLayer doc layerObj)

    ;; Display the status of the new layer
    (alert (strcat (vla-get-Name layerObj) " has been added."
                   "\nLayerOn Status: " (if (= (vla-get-LayerOn layerObj) :vlax-true) "1" "0")
                   "\nFreeze Status: " (if (= (vla-get-Freeze layerObj) :vlax-true) "1" "0")
                   "\nLock Status: "  (if (= (vla-get-Lock layerObj) :vlax-true) "1" "0")
                   "\nColor: " (itoa (vla-get-Color layerObj))
           )
    )

;; ADDREGISTEREDAPP:
    ;; Create a registered application named "New_RegApp" in current drawing

    ;; Add the registered application to the registered applications collection
    (setq regApps (vla-get-RegisteredApplications doc))
    (setq regAppObj (vla-Add regApps "New_RegApp"))
    (alert (strcat (vla-get-Name regAppObj) " has been added."))

;; ADDSELECTIONSET:
    ;; Create a selectionset named "New_SelectionSet" in current drawing

    ;; Add the selection set to the selection sets collection
    (setq ssets (vla-get-SelectionSets doc))
    (setq ssetObj (vla-Add ssets "New_SelectionSet"))
    (alert (strcat (vla-get-Name ssetObj) " has been added."
                    "\nThe number of items in the selection set is " (itoa (vla-get-Count ssetObj))
           )
    )

;; ADDTEXTSTYLE:
    ;; Create a textstyle named "New_Textstyle" in current drawing

    ;; Add the textstyle to the textstyles collection
    (setq textStyles (vla-get-TextStyles doc))
    (setq txtStyleObj (vla-Add textStyles "New_Textstyle"))
    (alert (strcat (vla-get-Name txtStyleObj) " has been added."
                    "\nHeight: " (rtos (vla-get-Height txtStyleObj) 2 2)
                    "\nWidth: " (rtos (vla-get-Width txtStyleObj) 2 2)
           )
    )

;; ADDVIEW:
    ;; Create a view named "New_View" in current drawing

    ;; Add the view to the views collection
    (setq views (vla-get-Views doc))
    (setq viewObj (vla-Add views "New_View"))
    (alert (strcat (vla-get-Name viewObj) " has been added."
                    "\nHeight: " (rtos (vla-get-Height viewObj) 2 2)
                    "\nWidth: " (rtos (vla-get-Width viewObj) 2 2)
           )
    )

;; ADDVIEWPORT:
    ;; Create a viewport named "New_Viewport" in current drawing

    ;; Add the viewport to the viewports collection
    (setq viewports (vla-get-Viewports doc))
    (setq vportObj (vla-Add viewports "New_Viewport"))
    (alert (strcat (vla-get-Name vportObj) " has been added."
                    "\nGridOn Status: " (if (= (vla-get-GridOn vportObj) :vlax-true) "1" "0")
                    "\nOrthoOn Status: " (if (= (vla-get-OrthoOn vportObj) :vlax-true) "1" "0")
                    "\nSnapOn Status: " (if (= (vla-get-SnapOn vportObj) :vlax-true) "1" "0")
           )
    )

;; ADDUCS:
    ;; Create a UCS named "New_UCS" in current drawing

    ;; Define the UCS
    (setq origin (vlax-3d-point 4 5 3)
          xAxisPnt (vlax-3d-point 5 5 3)
          yAxisPnt (vlax-3d-point 4 6 4))

    ;; Add the UCS to the UserCoordinatesSystems collection
    (setq UCSs (vla-get-UserCoordinateSystems doc))
    (setq ucsObj (vla-Add UCSs origin xAxisPnt yAxisPnt "New_UCS"))
    (alert (strcat (vla-get-Name ucsObj) " has been added."
                    "\nOrigin: " (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-Origin ucsObj)) 0) 2 2) ", "
                         (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-Origin ucsObj)) 1) 2 2) ", "
                         (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-Origin ucsObj)) 2) 2 2)
           )
    )

;; ADDMATERIAL:
    ;; Creates a material named "New_UCS" in the current drawing
    (setq oMaterials (vla-get-Materials doc))
    (setq oMaterial (vla-Add oMaterials "TestMaterial"))
    (vla-put-Description oMaterial "This example demonstrates how to add a material to a database.")
    (vla-put-ActiveMaterial doc oMaterial)

    ;; Display information about the material
    (alert (strcat (vla-get-Name oMaterial) " has been added."
                    "\nName: " (vla-get-Name oMaterial)
                    "\nDescription: " (vla-get-Description oMaterial)
           )
    )
)


Add3DFace Method (ActiveX)

Creates a 3DFace object given four vertices.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.Add3DFace(Point1, Point2, Point3 [, Point4])
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Point1

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying a point on the 3DFace object.

Point2

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying a point on the 3DFace object.

Point3

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying a point on the 3DFace object.

Point4

Access: Input-only; optional

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying a point on the 3DFace object. If omitted, this point will default to the coordinates of Point3 in order to create a three-sided face.

Return Value (RetVal)

Type: 3DFace

The newly created 3DFace object.

Remarks

To create a three-sided face, omit the last point. Use the SetInvisibleEdge method to set the visibility of an edge.

Points must be entered sequentially in either a clockwise or counterclockwise direction to create a 3DFace object. You can create multiple adjacent faces by specifying the first two points of an additional face exactly as the last two points of the previous face.

Examples

VBA:

Sub Example_Add3DFace()
    ' This example creates a 3D face in model space.

    Dim faceObj As Acad3DFace
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    Dim point3(0 To 2) As Double
    Dim point4(0 To 2) As Double

    ' Define the four coordinates of the face
    point1(0) = 0#: point1(1) = 0#: point1(2) = 0#
    point2(0) = 5#: point2(1) = 0#: point2(2) = 1#
    point3(0) = 5#: point3(1) = 5#: point3(2) = 1#
    point4(0) = 1#: point4(1) = 10#: point4(2) = 0#

    ' Create the 3DFace object in model space
    Set faceObj = ThisDrawing.ModelSpace.Add3DFace(point1, point2, point3, point4)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Add3DFace()
    ;; This example creates a 3D face in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the four coordinates of the face
    (setq point1 (vlax-3d-point 0 0 0)
          point2 (vlax-3d-point 5 0 1)
          point3 (vlax-3d-point 5 10 1)
          point4 (vlax-3d-point 0 10 0))

    ;; Create the 3DFace object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq faceObj (vla-Add3DFace modelSpace point1 point2 point3 point4))
    (vla-ZoomAll acadObj)
)


Add3DMesh Method (ActiveX)

Creates a free-form 3D mesh, given the number of points in the M and N directions and the coordinates of the points in the M and N directions.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.Add3Dmesh(M, N, PointsMatrix)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

M, N

Access: Input-only

Type: Integer

Dimensions of the point array. The size of the mesh in both the M and N directions is limited to between 2 and 256.

PointsMatrix

Access: Input-only

Type: Variant (array of doubles)

M x N matrix of 3D WCS coordinates. Defining vertices begins with vertex (0,0). Supplying the coordinate locations for each vertex in row M must be done before specifying vertices in row M + 1.

Return Value (RetVal)

Type: PolygonMesh

A PolygonMesh as the newly created 3DMesh object.

Remarks

Vertices may be any distance from each other.

A PolygonMesh is always open in both M and N directions. A mesh can be closed after creation by using the MClose and NClose properties on the PolygonMesh object.

A PolygonMesh is always created as a simple mesh. A mesh can be smoothed after creation by using the Type property.

Examples

VBA:

Sub Example_Add3DMesh()
    ' This example creates a 4 X 4 polygonmesh in model space.
    Dim meshObj As AcadPolygonMesh
    Dim mSize, nSize, count As Integer
    Dim points(0 To 47) As Double

    ' Create the matrix of points
    points(0) = 0: points(1) = 0: points(2) = 0
    points(3) = 2: points(4) = 0: points(5) = 1
    points(6) = 4: points(7) = 0: points(8) = 0
    points(9) = 6: points(10) = 0: points(11) = 1
    points(12) = 0: points(13) = 2: points(14) = 0
    points(15) = 2: points(16) = 2: points(17) = 1
    points(18) = 4: points(19) = 2: points(20) = 0
    points(21) = 6: points(22) = 2: points(23) = 1
    points(24) = 0: points(25) = 4: points(26) = 0
    points(27) = 2: points(28) = 4: points(29) = 1
    points(30) = 4: points(31) = 4: points(32) = 0
    points(33) = 6: points(34) = 4: points(35) = 0
    points(36) = 0: points(37) = 6: points(38) = 0
    points(39) = 2: points(40) = 6: points(41) = 1
    points(42) = 4: points(43) = 6: points(44) = 0
    points(45) = 6: points(46) = 6: points(47) = 0

    mSize = 4: nSize = 4

    ' creates a 3Dmesh in model space
    Set meshObj = ThisDrawing.ModelSpace.Add3DMesh(mSize, nSize, points)

    ' Change the viewing direction of the viewport to better see the polygonmesh
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Add3DMesh()
    ;; This example creates a 4 X 4 polygonmesh in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the matrix of points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 47)))
    (vlax-safearray-fill points '(0 0 0
                                  2 0 1
                                  4 0 0
                                  6 0 1
                                  0 2 0
                                  2 2 1
                                  4 2 0
                                  6 2 1
                                  0 4 0
                                  2 4 1
                                  4 4 0
                                  6 4 0
                                  0 6 0
                                  2 6 1
                                  4 6 0
                                  6 6 0
                                 )
    )
    (setq mSize 4
             nSize 4)

    ;; creates a 3Dmesh in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq meshObj (vla-Add3DMesh modelSpace mSize nSize points))

    ;; Change the viewing direction of the viewport to better see the polygonmesh
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)
)


Add3DPoly Method (ActiveX)

Creates a 3D polyline from the given array of coordinates.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.Add3Dpoly(PointsArray)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

PointsArray

Access: Input-only

Type: Variant (array of doubles)

An array of 3D WCS coordinates. The polyline will be created according to the order of the coordinates in the array. The number of elements in the array must be a multiple of three. (Three elements define a single coordinate.)

Return Value (RetVal)

Type: 3DPolyline

The newly created 3DPolyline object.

Remarks

To close the polyline, use the Closed property on the 3DPolyline object.

Examples

VBA:

Sub Example_Add3DPoly()

    Dim polyObj As Acad3DPolyline
    Dim points(0 To 8) As Double

    ' Create the array of points
    points(0) = 0: points(1) = 0: points(2) = 0
    points(3) = 10: points(4) = 10: points(5) = 10
    points(6) = 30: points(7) = 20: points(8) = 30

    ' Create a 3DPolyline in model space
    Set polyObj = ThisDrawing.ModelSpace.Add3DPoly(points)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Add3DPoly()
    ;; This example creates a 3 segment 3D polyline in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the array of points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill points '(0 0 0
                                  10 10 10
                                  30 20 30
                                 )
    )

    ;; Create a 3D polyline in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq polyObj (vla-Add3DPoly modelSpace points))
    (vla-ZoomAll acadObj)
)


AddArc Method (ActiveX)

Creates an arc given the center, radius, start angle, and end angle of the arc.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddArc(Center, Radius, StartAngle, EndAngle)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Center

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the center point of the arc.

Radius

Access: Input-only

Type: Double

The radius of the arc.

StartAngle, EndAngle

Access: Input-only

Type: Double

The start and end angles, in radians, defining the arc. A start angle greater than an end angle defines a counterclockwise arc.

Return Value (RetVal)

Type: Arc

The newly created Arc object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddArc()
    ' This example creates an arc in model space.

    Dim arcObj As AcadArc
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    Dim startAngleInDegree As Double
    Dim endAngleInDegree As Double

    ' Define the circle
    centerPoint(0) = 0#: centerPoint(1) = 0#: centerPoint(2) = 0#
    radius = 5#
    startAngleInDegree = 10#
    endAngleInDegree = 230#

    ' Convert the angles in degrees to angles in radians
    Dim startAngleInRadian As Double
    Dim endAngleInRadian As Double
    startAngleInRadian = startAngleInDegree * 3.141592 / 180#
    endAngleInRadian = endAngleInDegree * 3.141592 / 180#

    ' Create the arc object in model space
    Set arcObj = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngleInRadian, endAngleInRadian)
    ZoomAll
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddArc()
    ;; This example creates an arc in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the arc
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius 5
          startAngleInDegree 10
          endAngleInDegree 230)

    ;; Convert the angles in degrees to angles in radians
    (setq startAngleInRadian (/ (* startAngleInDegree 3.141592) 180))
    (setq endAngleInRadian (/ (* endAngleInDegree 3.141592) 180))

    ;; Create the arc object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq arcObj (vla-AddArc modelSpace centerPoint radius startAngleInRadian endAngleInRadian))
    (vla-ZoomAll acadObj)
)


AddAttribute Method (ActiveX)

Creates an attribute definition at the given location with the specified properties.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddAttribute(Height, Mode, Prompt, InsertionPoint, Tag, Value)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Height

Access: Input-only

Type: Double

The text height in the current drawing unit.

Mode

Access: Input-only

Type: AcAttributeMode enum

Any combination of constants can be used by adding them together:

  • acAttributeModeInvisible: Specifies that attribute values will not appear when you insert the block. The AutoCAD ATTDISP command overrides the Invisible mode.
  • acAttributeModeConstant: Gives attributes a fixed value for block insertions.
  • acAttributeModeVerify: Prompts to verify the attribute value is correct when the block is inserted.
  • acAttributeModeLockPosition: Locks the position of the attributes.
  • acAttributeModeMultipleLine: Allows the attributes to carry-over onto multiple lines. Prompts you to verify that the attribute value is correct when you insert the block.
  • acAttributeModePreset: Sets the attribute to its default value when you insert a block containing a current attribute. The value cannot be edited in this mode.
Prompt

Access: Input-only

Type: String

This string appears when a block containing this attribute is inserted. The default for this string is the Tag string. Inputting acAttributeModeConstant for the Mode parameter disables the prompt.

InsertionPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the location for the attribute.

Tag

Access: Input-only

Type: String

This non-null string identifies each occurrence of the attribute. Enter any characters except spaces or exclamation points. AutoCAD changes lowercase letters to uppercase.

Value

Access: Input-only

Type: String

This non-null string is the default attribute value.

Return Value (RetVal)

Type: Attribute

The newly created Attribute object.

Remarks

An attribute definition is associated to the block for which it is created. Attribute definitions created in model space or paper space are not considered to be attached to any given block.

The AutoCAD AFLAGS system variable stores the mode setting. You can query this value using the GetVariable method, or set it using the SetVariable method.

Examples

VBA:

Sub Example_AddAttribute()
    ' This example creates an attribute definition in model space.

    Dim attributeObj As AcadAttribute
    Dim height As Double
    Dim mode As Long
    Dim prompt As String
    Dim insertionPoint(0 To 2) As Double
    Dim tag As String
    Dim value As String

    ' Define the attribute definition
    height = 1#
    mode = acAttributeModeVerify
    prompt = "New Prompt"
    insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0
    tag = "NEW_TAG"
    value = "New Value"

    ' Create the attribute definition object in model space
    Set attributeObj = ThisDrawing.ModelSpace.AddAttribute(height, mode, prompt, insertionPoint, tag, value)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddAttribute()
    ;; This example creates an attribute definition in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the attribute definition
    (setq insertionPoint (vlax-3d-point 5 5 0)
          attHeight 1
          attMode acAttributeModeVerify
          attPrompt "New Prompt"
          attTag "NEW_TAG"
          attValue "New Value")

    ;; Create the attribute definition object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq attributeObj (vla-AddAttribute modelSpace attHeight attMode attPrompt insertionPoint attTag attValue))
    (vla-ZoomAll acadObj)
)


AddBox Method (ActiveX)

Creates a 3D solid box with edges parallel to the axes of the WCS.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddBox(Origin, Length, Width, Height)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Origin

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the origin of the box. This coordinate represents the center of the bounding box for the object, not a corner.

Length

Access: Input-only

Type: Double

The length of the box. Must be a positive number.

Width

Access: Input-only

Type: Double

The width of the box. Must be a positive number.

Height

Access: Input-only

Type: Double

The height of the box. Must be a positive number.

Return Value (RetVal)

Type: 3DSolid

A 3DSolid object as the newly created box.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddBox()
    ' This example creates a box in model space.

    Dim boxObj As Acad3DSolid
    Dim length As Double, width As Double, height As Double
    Dim center(0 To 2) As Double

    ' Define the box
    center(0) = 5#: center(1) = 5#: center(2) = 0
    length = 5#: width = 7: height = 10#

    ' Create the box (3DSolid) object in model space
    Set boxObj = ThisDrawing.ModelSpace.AddBox(center, length, width, height)

    ' Change the viewing direction of the viewport to better see the box
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddBox()
    ;; This example creates a box in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the box
    (setq center (vlax-3d-point 5 5 0)
          boxLength 5
             boxWidth 7
             boxHeight 10)

    ;; Create the box (3DSolid) object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq boxObj (vla-AddBox modelSpace center boxLength boxWidth boxHeight))

    ;; Change the viewing direction of the viewport to better see the box
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)
)


AddCircle Method (ActiveX)

Creates a circle given a center point and radius.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddCircle(Center, Radius)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Center

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the circle's center.

Radius

Access: Input-only

Type: Double

The radius of the circle. Must be a positive number.

Return Value (RetVal)

Type: Circle

The newly created Circle object.

Remarks

This circle is created on the XY plane of the WCS.

Examples

VBA:

Sub Example_AddCircle()
    ' This example creates a circle in model space.

    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double

    ' Define the circle
    centerPoint(0) = 0#: centerPoint(1) = 0#: centerPoint(2) = 0#
    radius = 5#

    ' Create the Circle object in model space
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddCircle()
    ;; This example creates a circle in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the circle
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius 5)

    ;; Create the Circle object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))
    (vla-ZoomAll acadObj)
)


AddCone Method (ActiveX)

Creates a 3D solid cone with the base on the XY plane of the WCS.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddCone(Center, BaseRadius, Height)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Center

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the center of the bounding box.

BaseRadius

Access: Input-only

Type: Double

The radius of the cone base. Must be a positive number.

Height

Access: Input-only

Type: Double

The height of the cone. Must be a positive number.

Return Value (RetVal)

Type: 3DSolid

A 3DSolid object as the newly created cone.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddCone()
    ' This example creates a cone in model space.

    Dim coneObj As Acad3DSolid
    Dim radius As Double
    Dim center(0 To 2) As Double
    Dim height As Double

    ' Define the cone
    center(0) = 0#: center(1) = 0#: center(2) = 0#
    radius = 5#
    height = 20#

    ' Create the Cone (3DSolid) object in model space
    Set coneObj = ThisDrawing.ModelSpace.AddCone(center, radius, height)

    ' Change the viewing direction of the viewport to better see the cone
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddCone()
    ;; This example creates a cone in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the cone
    (setq center (vlax-3d-point 0 0 0)
          coneRadius 5
             coneHeight 20)

    ;; Create the Cone (3DSolid) object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq coneObj (vla-AddCone modelSpace center coneRadius coneHeight))

    ;; Change the viewing direction of the viewport to better see the cone
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)
)


AddCustomInfo Method (ActiveX)

Adds a custom property field at the end of the existing list of fields.

Supported platforms: Windows only

Signature

VBA:

object.AddCustomInfo key, Value
object

Type: SummaryInfo

The object this method applies to.

key

Access: Input-only

Type: String

The name of the custom property.

Value

Access: Input-only

Type: String

The value of the custom property.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddCustomInfo()
    ' This example shows how to access drawing properties

    ' Add and display standard properties
    ThisDrawing.SummaryInfo.Author = "John Doe"
    ThisDrawing.SummaryInfo.Comments = "Includes all ten levels of Building Five"
    ThisDrawing.SummaryInfo.HyperlinkBase = "http://www.autodesk.com"
    ThisDrawing.SummaryInfo.Keywords = "Building Complex"
    ThisDrawing.SummaryInfo.LastSavedBy = "JD"
    ThisDrawing.SummaryInfo.RevisionNumber = "4"
    ThisDrawing.SummaryInfo.Subject = "Plan for Building Five"
    ThisDrawing.SummaryInfo.Title = "Building Five"

    Author = ThisDrawing.SummaryInfo.Author
    Comments = ThisDrawing.SummaryInfo.Comments
    HLB = ThisDrawing.SummaryInfo.HyperlinkBase
    KW = ThisDrawing.SummaryInfo.Keywords
    LSB = ThisDrawing.SummaryInfo.LastSavedBy
    RN = ThisDrawing.SummaryInfo.RevisionNumber
    Subject = ThisDrawing.SummaryInfo.Subject
    Title = ThisDrawing.SummaryInfo.Title
    MsgBox "The standard drawing properties are " & vbCrLf & _
           "Author = " & Author & vbCrLf & _
           "Comments = " & Comments & vbCrLf & _
           "HyperlinkBase = " & HLB & vbCrLf & _
           "Keywords = " & KW & vbCrLf & _
           "LastSavedBy = " & LSB & vbCrLf & _
           "RevisionNumber = " & RN & vbCrLf & _
           "Subject = " & Subject & vbCrLf & _
           "Title = " & Title & vbCrLf

    ' Add and display custom properties
    Dim Key0 As String
    Dim Value0 As String
    Dim Key1 As String
    Dim Value1 As String
    Dim CustomPropertyBranch As String
    Dim PropertyBranchValue As String
    Dim CustomPropertyZone As String
    Dim PropertyZoneValue As String

    CustomPropertyBranch = "Branch"
    PropertyBranchValue = "Main"
    CustomPropertyZone = "Zone"
    PropertyZoneValue = "Industrial"

    ' Add custom properties
    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 1) Then
        ThisDrawing.SummaryInfo.SetCustomByIndex 0, CustomPropertyBranch, PropertyBranchValue
    Else
        ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyBranch, PropertyBranchValue
    End If

    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 2) Then
         ThisDrawing.SummaryInfo.SetCustomByKey CustomPropertyBranch, "Satellite"
    Else
         ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyZone, PropertyZoneValue
    End If

    'Get custom properties
    ThisDrawing.SummaryInfo.GetCustomByIndex 0, Key0, Value0
    Key1 = CustomPropertyZone
    ThisDrawing.SummaryInfo.GetCustomByKey Key1, Value1

    MsgBox "The custom drawing properties are " & vbCrLf & _
           "First property name = " & Key0 & vbCrLf & _
           "First property value = " & Value0 & vbCrLf & _
           "Second property name = " & Key1 & vbCrLf & _
           "Second property value = " & Value1 & vbCrLf
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddCustomInfo()
    ;; This example shows how to access drawing properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq summaryInfo (vla-get-SummaryInfo doc))

    ;; Add and display standard properties
    (vla-put-Author summaryInfo "John Doe")
    (vla-put-Comments summaryInfo "Includes all ten levels of Building Five")
    (vla-put-HyperlinkBase summaryInfo "http://www.autodesk.com")
    (vla-put-Keywords summaryInfo "Building Complex")
    (vla-put-LastSavedBy summaryInfo "JD")
    (vla-put-RevisionNumber summaryInfo "4")
    (vla-put-Subject summaryInfo "Plan for Building Five")
    (vla-put-Title summaryInfo "Building Five")

    (setq author (vla-get-Author summaryInfo))
    (setq comments (vla-get-Comments summaryInfo))
    (setq HLB (vla-get-HyperlinkBase summaryInfo))
    (setq KW (vla-get-Keywords summaryInfo))
    (setq LSB (vla-get-LastSavedBy summaryInfo))
    (setq RN (vla-get-RevisionNumber summaryInfo))
    (setq subject (vla-get-Subject summaryInfo))
    (setq Title (vla-get-Title summaryInfo))
    (alert (strcat "The standard drawing properties are "
                   "\nAuthor = " author
                   "\nComments = " comments
                   "\nHyperlinkBase = " HLB
                   "\nKeywords = " KW
                   "\nLastSavedBy = " LSB
                   "\nRevisionNumber = " RN
                   "\nSubject = " Subject
                   "\nTitle = " Title
           )
    )

    ;; Add and display custom properties
    (setq CustomPropertyBranch "Branch")
    (setq PropertyBranchValue "Main")
    (setq CustomPropertyZone "Zone")
    (setq PropertyZoneValue "Industrial")

    ;; Add custom properties
    (if (>= (vla-NumCustomInfo summaryInfo) 1)
        (vla-SetCustomByIndex summaryInfo 0 CustomPropertyBranch PropertyBranchValue)
        (vla-AddCustomInfo summaryInfo CustomPropertyBranch PropertyBranchValue)
    )

    (if (>= (vla-NumCustomInfo summaryInfo) 2)
        (vla-SetCustomByKey summaryInfo CustomPropertyBranch "Satellite")
        (vla-AddCustomInfo summaryInfo CustomPropertyZone PropertyZoneValue)
    )

    ;; Get custom properties
    (vla-GetCustomByIndex summaryInfo 0 'Key0 'Value0)
    (setq Key1 CustomPropertyZone)
    (vla-GetCustomByKey summaryInfo Key1 'Value1)

    (alert (strcat "The custom drawing properties are "
                   "\nFirst property name = " Key0
                   "\nFirst property value = " Value0
                   "\nSecond property name = " Key1
                   "\nSecond property value = " Value1
           )
    )
)


AddCustomObject Method (ActiveX)

Creates a custom object.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddCustomObject(ClassName)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

ClassName

Access: Input-only

Type: String

The rxClassName must be defined in an ObjectARX® application (ObjectARX DLL) or the method will fail.

Return Value (RetVal)

Type: Custom object

The newly created Custom object.

Remarks

The ObjectARX DLL defining the rxClassName custom class must be loaded. Use the LoadARX method on the Application object to explicitly load the ObjectARX file.

Examples

VBA:

Sub Example_AddCustomObject()
    ' This example adds a custom object to model space.

    ' Load the ObjectARX application that defines the custom object.
    ' Note: The application listed here does not exist and
    ' will cause an error when run. Change the application name
    ' to the path and name of your ObjectARX Application.
    ThisDrawing.Application.LoadArx "MyARXApp.dll"

    ' Once the application has been loaded successfully,
    ' add the custom object to model space.
    Dim customObj As AcadObject
    Set customObj = ThisDrawing.ModelSpace.AddCustomObject("MyNewObject")
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddCustomObject()
    ;; This example adds a custom object to model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Load the ObjectARX application that defines the custom object.
    ;; Note: The application listed here does not exist and
    ;; will cause an error when run. Change the application name
    ;; to the path and name of your ObjectARX Application.
    (vla-LoadArx acadObj "MyARXApp.dll")

    ;; Once the application has been loaded successfully,
    ;; add the custom object to model space.
    (setq customObj (vla-AddCustomObject (vla-get-ModelSpace doc) "MyNewObject"))
)


AddCylinder Method (ActiveX)

Creates a 3D solid cylinder whose base is on the XY plane of the WCS.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddCylinder(Center, Radius, Height)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Center

Access: Input-only

Type: Variant (three-element array of doubles)

A 3D WCS coordinates specifying the center of the bounding box.

Radius

Access: Input-only

Type: Double

The cylinder radius. Must be a positive number.

Height

Access: Input-only

Type: Double

The cylinder height. Must be a positive number.

Return Value (RetVal)

Type: 3DSolid

A 3DSolid object as the newly created cylinder.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddCylinder()
    ' This example creates a cylinder in model space.

    Dim cylinderObj As Acad3DSolid
    Dim radius As Double
    Dim center(0 To 2) As Double
    Dim height As Double

    ' Define the cylinder
    center(0) = 0#: center(1) = 0#: center(2) = 0#
    radius = 5#
    height = 20#

    ' Create the Cylinder (3DSolid) object in model space
    Set cylinderObj = ThisDrawing.ModelSpace.AddCylinder(center, radius, height)

    ' Change the viewing direction of the viewport to better see the cylinder
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddCylinder()
    ;; This example creates a cylinder in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the cylinder
    (setq center (vlax-3d-point 0 0 0)
          cylRadius 5
             cylHeight 20)

    ;; Create the Cylinder (3DSolid) object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq cylinderObj (vla-AddCylinder modelSpace center cylRadius cylHeight))

    ;; Change the viewing direction of the viewport to better see the cylinder
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)
)


AddDim3PointAngular Method (ActiveX)

Creates an angular dimension using 3 points.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddDim3PointAngular(AngleVertex, FirstEndPoint, SecondEndPoint, TextPoint)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

AngleVertex

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the vertex of the angle to be measured.

FirstEndPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the point through which the first extension line passes.

SecondEndPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the point through which the second extension line passes.

TextPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the point at which the dimension text is to be displayed.

Return Value (RetVal)

Type: Dim3PointAngular

The newly created angular dimension.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddDim3PointAngular()
    ' This example creates a Dim3PointAngular object in model space

    Dim DimPointAngularObj As AcadDim3PointAngular
    Dim AngleVertex(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double

    ' Define the new Dim3PointAngular object
    AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
    FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
    SecondPoint(0) = 2: SecondPoint(1) = 4: SecondPoint(2) = 0
    TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

    ' Create the new Dim3PointAngular object in model space
    Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)
    ThisDrawing.Application.ZoomAll

    MsgBox "A Dim3PointAngular object has been created."

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddDim3PointAngular()
    ;; This example creates a Dim3PointAngular object in model space
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Dim3PointAngular object
    (setq AngleVertex (vlax-3d-point 0 0 0)
          FirstPoint (vlax-3d-point 2 2 0)
          SecondPoint (vlax-3d-point 2 4 0)
          TextPoint (vlax-3d-point 6 6 0))

    ;; Create the new Dim3PointAngular object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimPointAngularObj (vla-AddDim3PointAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    (alert "A Dim3PointAngular object has been created.")
)


AddDimAligned Method (ActiveX)

Creates an aligned dimension object.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddDimAligned(ExtLine1Point, ExtLine2Point, TextPosition)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

ExtLine1Point

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the first endpoint of the extension line.

ExtLine2Point

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the second endpoint of the extension line.

TextPosition

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the text position.

Return Value (RetVal)

Type: DimAligned

The newly created aligned dimension.

Remarks

In aligned dimensions, the dimension line is parallel to the extension line origins. The extension line origins are specified using the ExtLine1Point and ExtLine2Point properties.

Examples

VBA:

Sub Example_AddDimAligned()
    ' This example creates an aligned dimension in model space.

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5#: point1(1) = 5#: point1(2) = 0#
    point2(0) = 10#: point2(1) = 5#: point2(2) = 0#
    location(0) = 5#: location(1) = 7#: location(2) = 0#

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ZoomAll
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddDimAligned()
    ;; This example creates an aligned dimension in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 10 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)
)


AddDimAngular Method (ActiveX)

Creates an angular dimension for an arc, two lines, or a circle.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddDimAngular(AngleVertex, FirstEndPoint, SecondEndPoint, TextPoint)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

AngleVertex

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the center of the circle or arc, or the common vertex between the two dimensioned lines.

FirstEndPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the point through which the first extension line passes.

SecondEndPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the point through which the second extension line passes.

TextPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the point at which the dimension text is to be displayed.

Return Value (RetVal)

Type: DimAngular

The newly created angular dimension.

Remarks

The AngleVertex is the center of the circle or arc, or the common vertex between the two lines being dimensioned. FirstEndPoint and SecondEndPoint are the points through which the two extension lines pass.

The AngleVertex can be the same as one of the angle endpoints. If you need extension lines, they will be added automatically. The endpoints provided are used as origin points for the extension lines.

Examples

VBA:

Sub Example_AddDimAngular()
    ' This example creates an angular dimension in model space.

    Dim dimObj As AcadDimAngular
    Dim angVert(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double

    ' Define the dimension
    angVert(0) = 0#: angVert(1) = 5#: angVert(2) = 0#
    FirstPoint(0) = 1#: FirstPoint(1) = 7#: FirstPoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    TextPoint(0) = 3#: TextPoint(1) = 5#: TextPoint(2) = 0#

    ' Create the angular dimension in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAngular(angVert, FirstPoint, SecondPoint, TextPoint)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddDimAngular()
    ;; This example creates an angular dimension in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq angVert (vlax-3d-point 0 5 0)
          FirstPoint (vlax-3d-point 1 7 0)
          SecondPoint (vlax-3d-point 1 3 0)
          TextPoint (vlax-3d-point 3 5 0))

    ;; Create the angular dimension in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAngular modelSpace angVert FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)
)


AddDimArc Method (ActiveX)

Creates an arc length dimension for an arc.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddDimArc(ArcCenter, FirstEndPoint, SecondEndPoint, ArcPoint)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

ArcCenter

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the center of the arc.

FirstEndPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the point through which the first extension line passes.

SecondEndPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the point through which the second extension line passes.

ArcPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying a point on the arc.

Return Value (RetVal)

Type: DimArcLength

The newly created arc length dimension.

Remarks

The ArcCenter is the center of the arc being dimensioned. FirstEndPoint and SecondEndPoint are the points through which the two extension lines pass.

Examples

VBA:

Sub Example_AddDimArc()
    Dim PI As Double: PI = 3.141592
    Dim oMS As AcadModelSpace
    Set oMS = ThisDrawing.ModelSpace

    Dim ptCenter(2) As Double
    Dim oA As AcadArc
    Set oA = oMS.AddArc(ptCenter, 10, PI / 3, PI * 3 / 4)

    Dim ptArcPoint(2) As Double
    ptArcPoint(0) = 0: ptArcPoint(1) = 15

    Dim oAcadDimArcLength As AcadDimArcLength
    Set oAcadDimArcLength = oMS.AddDimArc(oA.Center, oA.startPoint, oA.endPoint, ptArcPoint)

    Update
    ZoomExtents
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddDimArc()
    ;; This example creates an arc and arc length dimension in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Define the arc
    (setq center (vlax-3d-point 0 0 0))

    ;; Create the arc in model space
    (setq arc (vla-AddArc modelSpace center 10 (/ PI 3) (/ (* PI 3) 4)))

    ;; Define the arc length dimension
    (setq arcPoint (vlax-3d-point 0 15 0)
          startPoint (vla-get-StartPoint arc)
          endPoint (vla-get-EndPoint arc))

    ;; Create the arc length dimension in model space
    (setq dimArcLength (vla-AddDimArc modelSpace center startPoint endPoint arcPoint))
    (vla-ZoomExtents acadObj)
)


AddDimDiametric Method (ActiveX)

Creates a diametric dimension for a circle or arc given the two points on the diameter and the length of the leader line.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddDimDiametric(ChordPoint, FarChordPoint, LeaderLength)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

ChordPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the first diameter point on the circle or arc.

FarChordPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the second diameter point on the circle or arc.

LeaderLength

Access: Input-only

Type: Double

The positive value representing the length from the ChordPoint to the annotation text or dogleg.

Return Value (RetVal)

Type: DimDiametric

The newly created diameter dimension object.

Remarks

Different types of diameter dimensions are created depending on the size of the circle or arc, the length of the leader line, and the values of the AutoCAD DIMUPT, DIMTOFL, DIMFIT, DIMTIH, DIMTOH, DIMJUST, and DIMTAD system variables.

For horizontal dimension text, if the angle of the dimension line is more than 15 degrees from horizontal, and is outside the circle or arc, AutoCAD draws a hook line, also called a landing or dogleg. The hook line is one arrowhead long, and is placed next to the dimension text, as shown in the first two illustrations.

This function uses the LeaderLength parameter as the distance from the ChordPoint to the point where the dimension will do a horizontal dogleg to the annotation text (or stop if no dogleg is necessary).

The LeaderLength setting will only be used during the creation of the dimension (and even then only if the dimension is set to use the default text position value). After the dimension has been closed for the first time, changing the LeaderLength value will not affect how the dimension displays, but the new setting will be stored and will show up in DXF, LISP, and ARX.

Examples

VBA:

Sub Example_AddDimDiametric()
    ' This example creates a diametric dimension in model space.

    Dim dimObj As AcadDimDiametric
    Dim chordPoint(0 To 2) As Double
    Dim farChordPoint(0 To 2) As Double
    Dim leaderLength As Double

    ' Define the dimension
    chordPoint(0) = 5#: chordPoint(1) = 3#: chordPoint(2) = 0#
    farChordPoint(0) = 5#: farChordPoint(1) = 5#: farChordPoint(2) = 0#
    leaderLength = 1#

    ' Create the diametric dimension in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimDiametric(chordPoint, farChordPoint, leaderLength)
    ZoomAll
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddDimDiametric()
    ;; This example creates a diametric dimension in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq chordPoint (vlax-3d-point 5 3 0)
          farChordPoint (vlax-3d-point 5 5 0)
          leaderLength 1)

    ;; Create the diametric dimension in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimDiametric modelSpace chordPoint farChordPoint leaderLength))
    (vla-ZoomAll acadObj)
)


AddDimOrdinate Method (ActiveX)

Creates an ordinate dimension given the definition point and the leader endpoint.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddDimOrdinate(DefinitionPoint, LeaderEndPoint, UseXAxis)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

DefinitionPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the point to be dimensioned.

LeaderEndPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the endpoint of the leader. This will be the location at which the dimension text is displayed.

UseXAxis

Access: Input-only

Type: Integer

  • True: Creates an ordinate dimension displaying the X axis value.
  • False: Creates an ordinate dimension displaying the Y axis value.

Return Value (RetVal)

Type: DimOrdinate

The newly created ordinate dimension object.

Remarks

Ordinate dimensions display the X or Y coordinate of an object along with a simple leader line. The absolute value of the coordinate is used according to the prevailing standards for ordinate dimensions.

An ordinate dimension measuring the absolute X position of a point tangent to a circle

Examples

VBA:

Sub Example_AddDimOrdinate()
    ' This example creates an ordinate dimension in model space.

    Dim dimObj As AcadDimOrdinate
    Dim definingPoint(0 To 2) As Double
    Dim leaderEndPoint(0 To 2) As Double
    Dim useXAxis As Long

    ' Define the dimension
    definingPoint(0) = 5#: definingPoint(1) = 5#: definingPoint(2) = 0#
    leaderEndPoint(0) = 10#: leaderEndPoint(1) = 5#: leaderEndPoint(2) = 0#
    useXAxis = 5#

    ' Create an ordinate dimension in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimOrdinate(definingPoint, leaderEndPoint, useXAxis)
    ZoomAll
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddDimOrdinate()
    ;; This example creates an ordinate dimension in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq definingPoint (vlax-3d-point 5 5 0)
          leaderEndPoint (vlax-3d-point 10 5 0)
          useXAxis 5)

    ;; Create an ordinate dimension in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimOrdinate modelSpace definingPoint leaderEndPoint useXAxis))
    (vla-ZoomAll acadObj)
)


AddDimRadial Method (ActiveX)

Creates a radial dimension for the selected object at the given location.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddDimRadial(Center, ChordPoint, LeaderLength)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Center

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the center point on the circle or arc.

ChordPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the point on the circle or arc to attach the leader line.

LeaderLength

Access: Input-only

Type: Double

The positive value representing the length from the ChordPoint to the annotation text or dogleg.

Return Value (RetVal)

Type: DimRadial

The newly created radius dimension object.

Remarks

Different types of radial dimensions are created depending on the size of the circle or arc, the TextPosition property and the values in the AutoCAD DIMUPT, DIMTOFL, DIMFIT, DIMTIH, DIMTOH, DIMJUST, and DIMTAD dimension system variables. (System variables can be queried or set using the GetVariable and SetVariable methods.)

For horizontal dimension text, if the angle of the dimension line is more than 15 degrees from horizontal, and is outside the circle or arc, AutoCAD draws a hook line, also called a landing or dogleg. The hook line is one arrowhead long, and is placed next to the dimension text, as shown in the first two illustrations.

This method uses length as the distance from the ChordPoint out to where the dimension will do a horizontal dogleg to the annotation text (or stop if no dogleg is necessary).

The LeaderLength setting will only be used during the creation of the dimension (and even then only if the dimension is set to use the default text position value). After the dimension has been closed for the first time, changing the LeaderLength value will not affect how the dimension displays, but the new setting will be stored and will show up in DXF, LISP, and ARX.

Examples

VBA:

Sub Example_AddDimRadial()
    ' This example creates a radial dimension in model space.

    Dim dimObj As AcadDimRadial
    Dim center(0 To 2) As Double
    Dim chordPoint(0 To 2) As Double
    Dim leaderLen As Integer

    ' Define the dimension
    center(0) = 0#: center(1) = 0#: center(2) = 0#
    chordPoint(0) = 5#: chordPoint(1) = 5#: chordPoint(2) = 0#
    leaderLen = 5

    ' Create the radial dimension in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimRadial(center, chordPoint, leaderLen)
    ZoomAll
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddDimRadial()
    ;; This example creates a radial dimension in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq center (vlax-3d-point 0 0 0)
          chordPoint (vlax-3d-point 5 5 0)
          leaderLen 5)

    ;; Create the radial dimension in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimRadial modelSpace center chordPoint leaderLen))
    (vla-ZoomAll acadObj)
)


AddDimRadialLarge Method (ActiveX)

Creates a jogged radial dimension for an arc, circle, or polyline arc segment.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddDimRadialLarge(Center, ChordPoint, OverrideCenter, JogPoint, JogAngle)
object

Type: Block, ModelSpace, PaperSpace

The object this method applies to.

Center

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the center of the arc, circle, or polyline arc segment.

ChordPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the chord point for the arc.

OverrideCenter

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the override center location or pick point.

JogPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the jog location or pick point.

JogAngle

Access: Input-only

Type: Double

The value for the jog angle.

Return Value (RetVal)

Type: DimRadialLarge

The newly created jogged radius dimension.

Remarks

The Center is the center of the arc, circle, or polyline arc segment being dimensioned. The OverrideCenter is the origin point of the dimension.

Examples

VBA:

Sub Example_AddDimRadialLarge()
    Dim PI As Double: PI = 3.141592
    Dim oMS As AcadModelSpace
    Set oMS = ThisDrawing.ModelSpace

    Dim ptCenter(2) As Double
    Dim oA As AcadArc
    Set oA = oMS.AddArc(ptCenter, 10, PI / 3, PI * 3 / 4)

    Dim ptChordPoint(2) As Double
    ptChordPoint(0) = 0: ptChordPoint(1) = 10: ptChordPoint(2) = 0

    Dim ptOverrideCenter(2) As Double
    ptOverrideCenter(0) = -3: ptOverrideCenter(1) = -6: ptOverrideCenter(2) = 0

    Dim ptJogPoint(2) As Double
    ptJogPoint(0) = 0: ptJogPoint(1) = 5: ptJogPoint(2) = 0

    Dim oDimRadialLarge As AcadDimRadialLarge
    Set oDimRadialLarge = oMS.AddDimRadialLarge(oA.Center, ptChordPoint, ptOverrideCenter, ptJogPoint, PI / 4)

    Dim ptTextPosition(2) As Double
    ptTextPosition(0) = 0: ptTextPosition(1) = 6: ptTextPosition(2) = 0
    oDimRadialLarge.TextPosition = ptTextPosition

    Update
    ZoomExtents
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddDimRadialLarge()
    ;; This example creates an arc and a jogged arc dimension in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Define the arc
    (setq center (vlax-3d-point 0 0 0))

    ;; Create the arc in model space
    (setq arc (vla-AddArc modelSpace center 10 (/ PI 3) (/ (* PI 3) 4)))

    ;; Define the jogged arc dimension
    (setq ptChordPoint (vlax-3d-point 0 10 0)
          ptOverrideCenter (vlax-3d-point -3 -6 0)
          ptJogPoint (vlax-3d-point 0 5 0))

    ;; Create the jogged arc dimension in model space
    (setq oDimRadialLarge (vla-AddDimRadialLarge modelSpace center ptChordPoint ptOverrideCenter ptJogPoint (/ PI 4)))

    ;; Set the position of the text for the dimension
    (setq ptTextPosition (vlax-3d-point 0 6 0))
    (vla-put-TextPosition oDimRadialLarge ptTextPosition)

    (vla-ZoomExtents acadObj)
)


AddDimRotated Method (ActiveX)

Creates a rotated linear dimension.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddDimRotated(XLine1Point, XLine2Point, DimLineLocation, RotationAngle)
object

Type: Block, ModelSpace, PaperSpace

The object this method applies to.

XLine1Point

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the first end of the linear dimension to be measured. This is where the first extension line will be attached.

XLine2Point

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the second end of the linear dimension to be measured. This is where the second extension line will be attached.

DimLineLocation

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying a point on the dimension line. This will define the placement of the dimension line and the dimension text.

RotationAngle

Access: Input-only

Type: Double

The angle, in radians, of rotation displaying the linear dimension.

Return Value (RetVal)

Type: DimRotated

The newly created rotated linear dimension object.

Remarks

A linear dimension created at 45 degrees

Examples

VBA:

Sub Example_AddDimRotated()
    ' This example creates a rotated dimension in model space.

    Dim dimObj As AcadDimRotated
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim rotAngle As Double

    ' Define the dimension
    point1(0) = 0#: point1(1) = 5#: point1(2) = 0#
    point2(0) = 5#: point2(1) = 5#: point2(2) = 0#
    location(0) = 0#: location(1) = 0#: location(2) = 0#
    rotAngle = 120
    rotAngle = rotAngle * 3.141592 / 180#       ' covert to Radians

    ' Create the rotated dimension in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimRotated(point1, point2, location, rotAngle)
    ZoomAll
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddDimRotated()
    ;; This example creates a rotated dimension in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 0 5 0)
          point2 (vlax-3d-point 5 5 0)
          location (vlax-3d-point 0 0 0)
          rotAngle (/ (* 120 3.141592) 180))

    ;; Create the rotated dimension in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimRotated modelSpace point1 point2 location rotAngle))
    (vla-ZoomAll acadObj)
)


AddEllipse Method (ActiveX)

Creates an ellipse in the XY plane of the WCS given the center point, a point on the major axis, and the radius ratio.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddEllipse(Center, MajorAxis, RadiusRatio)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Center

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the center of the ellipse.

MajorAxis

Access: Input-only

Type: Variant (double)

A positive value defining the length of the major axis of the ellipse.

RadiusRatio

Access: Input-only

Type: Double

A positive value defining the major to minor axis ratio of an ellipse. A radius ratio of 1.0 defines a circle.

Radius ratio = 0.25

Radius ratio = 0.75

Return Value (RetVal)

Type: Ellipse

The newly created Ellipse object.

Remarks

The ellipse may be closed, or open (elliptical arc), and is created on the XY plane of the current WCS.

This object represents a true ellipse, not a polyline approximation.

Examples

VBA:

Sub Example_AddEllipse()
    ' This example creates an ellipse in model space.

    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double

    ' Create an ellipse in model space
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddEllipse()
    ;; This example creates an ellipse in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create an ellipse in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)

    ;; Create the ellipse in mode space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))
    (vla-ZoomAll acadObj)
)


AddEllipticalCone Method (ActiveX)

Creates a 3D solid elliptical cone on the XY plane of the WCS given the Center, MajorRadius, MinorRadius, and Height.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddEllipticalCone(Center, MajorRadius, MinorRadius, Height)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Center

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the center of the bounding box.

MajorRadius

Access: Input-only

Type: Double

The length of the major radius for the ellipse base. Must be a positive number.

MinorRadius

Access: Input-only

Type: Double

The length of the minor radius for the ellipse base. Must be a positive number.

Height

Access: Input-only

Type: Double

The height of the cone. Must be a positive number.

Return Value (RetVal)

Type: 3DSolid

A 3DSolid object as the newly created elliptical cone.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddEllipticalCone()
    ' This example creates an elliptical cone in model space.

    Dim coneObj As Acad3DSolid
    Dim center(0 To 2) As Double
    Dim majorRadius As Double
    Dim minorRadius As Double
    Dim height As Double

    ' Define the elliptical cone
    center(0) = 0#: center(1) = 0#: center(2) = 0#
    majorRadius = 10#
    minorRadius = 5#
    height = 20#

    ' Create the elliptical cone in model space
    Set coneObj = ThisDrawing.ModelSpace.AddEllipticalCone(center, majorRadius, minorRadius, height)

    ' Change the viewing direction of the viewport to better see the cone
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddEllipticalCone()
    ;; This example creates an elliptical cone in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the elliptical cone
    (setq center (vlax-3d-point 0 0 0)
          majorRadius 10
             minorRadius 5
             height 20)

    ;; Create the elliptical cone in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq coneObj (vla-AddEllipticalCone modelSpace center majorRadius minorRadius height))

    ;; Change the viewing direction of the viewport to better see the cone
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)
)


AddEllipticalCylinder Method (ActiveX)

Creates a 3D solid elliptical cylinder whose base is on the XY plane of the WCS, given the Center, MajorRadius, MinorRadius, and Height.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddEllipticalCylinder(Center, MajorRadius, MinorRadius, Height)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Center

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the center of the bounding box.

MajorRadius

Access: Input-only

Type: Double

The length of the major radius for the ellipse base. Must be a positive number.

MinorRadius

Access: Input-only

Type: Double

The length of the minor radius for the ellipse base. Must be a positive number.

Height

Access: Input-only

Type: Double

The height of the cylinder. Must be a positive number.

Return Value (RetVal)

Type: 3DSolid

A 3DSolid object as the newly created elliptical cylinder.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddEllipticalCylinder()
    ' This example creates an elliptical cylinder in model space.

    Dim cylinderObj As Acad3DSolid
    Dim center(0 To 2) As Double
    Dim majorRadius As Double
    Dim minorRadius As Double
    Dim height As Double

    ' Define the elliptical cylinder
    center(0) = 0#: center(1) = 0#: center(2) = 0#
    majorRadius = 5#
    minorRadius = 2.5
    height = 10#

    ' Create the elliptical cylinder in model space
    Set cylinderObj = ThisDrawing.ModelSpace.AddEllipticalCylinder(center, majorRadius, minorRadius, height)

    ' Change the viewing direction of the viewport to better see the cylinder
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddEllipticalCylinder()
    ;; This example creates an elliptical cylinder in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the elliptical cylinder
    (setq center (vlax-3d-point 0 0 0)
          majorRadius 5
          minorRadius 2.5
          height 10)

    ;; Create the elliptical cylinder in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq cylinderObj (vla-AddEllipticalCylinder modelSpace center majorRadius minorRadius height))

    ;; Change the viewing direction of the viewport to better see the cylinder
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)
)


AddExtrudedSolid Method (ActiveX)

Creates an extruded solid given the Profile, Height, and TaperAngle.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddExtrudedSolid(Profile, Height, TaperAngle)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Profile

Access: Input-only

Type: Region

A profile can only be a Region object.

Height

Access: Input-only

Type: Double

The height of the extrusion along the Z axis of the object's coordinate system. If you enter a positive number, AutoCAD extrudes the object along the positive Z axis. If you enter a negative number, AutoCAD extrudes the object along the negative Z axis.

TaperAngle

Access: Input-only

Type: Double

The taper angle of the extrusion must be provided in radians. The range of the taper angle is from -90 to +90 degrees.

Positive angles taper in from the base, negative angles taper out. The default angle, 0, extrudes a 2D object perpendicular to its plane.

Return Value (RetVal)

Type: 3DSolid

A 3DSolid object as the newly created extruded solid.

Remarks

You can extrude only 2D planar regions.

Tapered extrusions are possible only with loops that are continuous at the vertices. A large taper angle or long extrusion height can cause the object, or portions of the object, to intersect with itself before reaching the extrusion height. AutoCAD does not allow an extrusion when the resulting solid intersects with itself.

Examples

VBA:

Sub Example_AddExtrudedSolid()
    ' This example extrudes a solid from a region.
    ' The region is created from an arc and a line.

    Dim curves(0 To 1) As AcadEntity

    ' Define the arc
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    centerPoint(0) = 5#: centerPoint(1) = 3#: centerPoint(2) = 0#
    radius = 2#
    startAngle = 0
    endAngle = 3.141592
    Set curves(0) = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngle, endAngle)

    ' Define the line
    Set curves(1) = ThisDrawing.ModelSpace.AddLine(curves(0).startPoint, curves(0).endPoint)

    ' Create the region
    Dim regionObj As Variant
    regionObj = ThisDrawing.ModelSpace.AddRegion(curves)

    ' Define the extrusion
    Dim height As Double
    Dim taperAngle As Double
    height = 3
    taperAngle = 0

    ' Create the solid
    Dim solidObj As Acad3DSolid
    Set solidObj = ThisDrawing.ModelSpace.AddExtrudedSolid(regionObj(0), height, taperAngle)

    ' Change the viewing direction of the viewport
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddExtrudedSolid()
    ;; This example extrudes a solid from a region.
    ;; The region is created from an arc and a line.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Define the arc
    (setq centerPoint (vlax-3d-point 5 3 0)
          radius 2
          startAngle 0
          endAngle 3.141592)
    (setq arc (vla-AddArc modelSpace centerPoint radius startAngle endAngle))

    ;; Define the line
    (setq line (vla-AddLine modelSpace (vla-get-StartPoint arc) (vla-get-EndPoint arc)))

    (setq curves (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element curves 0 arc)
    (vlax-safearray-put-element curves 1 line)

    ;; Create the region
    (setq regionObj (vla-AddRegion modelSpace curves))

    ;; Define the extrusion
    (setq height 3
          taperAngle 0)

    ;; Create the solid
    (setq solidObj (vla-AddExtrudedSolid modelSpace (vlax-safearray-get-element (vlax-variant-value regionObj) 0) height taperAngle))

    ;; Change the viewing direction of the viewport
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)
)


AddExtrudedSolidAlongPath Method (ActiveX)

Creates an extruded solid given the profile and an extrusion path.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddExtrudedSolidAlongPath(Profile, Path)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Profile

Access: Input-only

Type: Region

A profile can only be a Region object.

Path

Access: Input-only

Type: Arc, Circle, Ellipse, Polyline, Spline

The path can only be a Polyline, Circle, Ellipse, Spline, or Arc object.

Return Value (RetVal)

Type: 3DSolid

The extruded 3DSolid object.

Remarks

You can extrude only 2D planar regions.

The path should not lie on the same plane as the profile, nor should it have areas of high curvature.

Examples

VBA:

Sub Example_AddExtrudedSolidAlongPath()
    ' This example extrudes a solid from a region
    ' along a path defined by a spline.
    ' The region is created from an arc and a line.

    Dim curves(0 To 1) As AcadEntity

    ' Define the arc
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    centerPoint(0) = 5#: centerPoint(1) = 3#: centerPoint(2) = 0#
    radius = 2#
    startAngle = 0
    endAngle = 3.141592
    Set curves(0) = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngle, endAngle)

    ' Define the line
    Set curves(1) = ThisDrawing.ModelSpace.AddLine(curves(0).startPoint, curves(0).endPoint)

    ' Create the region
    Dim regionObj As Variant
    regionObj = ThisDrawing.ModelSpace.AddRegion(curves)

    ' Define the extrusion path (spline object)
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    ' Define the Spline Object
    startTan(0) = 10: startTan(1) = 10: startTan(2) = 10
    endTan(0) = 10: endTan(1) = 10: endTan(2) = 10
    fitPoints(0) = 0: fitPoints(1) = 10: fitPoints(2) = 10
    fitPoints(0) = 10: fitPoints(1) = 10: fitPoints(2) = 10
    fitPoints(0) = 15: fitPoints(1) = 10: fitPoints(2) = 10
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)

    ' Create the solid
    Dim solidObj As Acad3DSolid
    Set solidObj = ThisDrawing.ModelSpace.AddExtrudedSolidAlongPath(regionObj(0), splineObj)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddExtrudedSolidAlongPath()
    ;; This example extrudes a solid from a region
    ;; along a path defined by a spline.
    ;; The region is created from an arc and a line.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Define the arc
    (setq centerPoint (vlax-3d-point 5 3 0)
          radius 2
          startAngle 0
          endAngle 3.141592)
    (setq arc (vla-AddArc modelSpace centerPoint radius startAngle endAngle))

    ;; Define the line
    (setq line (vla-AddLine modelSpace (vla-get-StartPoint arc) (vla-get-EndPoint arc)))

    (setq curves (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element curves 0 arc)
    (vlax-safearray-put-element curves 1 line)

    ;; Create the region
    ;(setq regionObj (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (setq regionObj (vla-AddRegion modelSpace curves))

    ;; Define the extrusion path (spline object)
    (setq startTan (vlax-3d-point 10 10 10)
          endTan (vlax-3d-point 10 10 10))
    (setq fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(0 10 10
                                                 10 10 10
                                                 15 10 10
                                                )
    )
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))

    ;; Create the solid
    (setq solidObj (vla-AddExtrudedSolidAlongPath modelSpace (vlax-safearray-get-element (vlax-variant-value regionObj) 0) splineObj))

    (vla-ZoomAll acadObj)
)


AddFitPoint Method (ActiveX)

Adds the fit point to the spline at a given index.

Supported platforms: Windows only

Signature

VBA:

object.AddFitPoint Index, FitPoint
object

Type: Spline

The object this method applies to.

Index

Access: Input-only

Type: Integer

Position in the fit point list to add the fit point. If the index is a negative number, then the point is added to the beginning of the spline. If the index exceeds the number of fit points in the spline, then the point is added to the end of the spline.

FitPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the fit point to be added.

Return Value (RetVal)

No return value.

Remarks

AutoCAD adds the point and refits the spline through the new set of points. To view the changes, use the Update or Regen method.

Examples

VBA:

Sub Example_AddFitPoint()
    ' This example creates a spline object in model space.
    ' It then adds a fit point to the spline.

    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0

    ' Create the spline object
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ZoomAll
    MsgBox "The Spline has " & splineObj.NumberOfFitPoints & " fit points.", , "AddFitPoint Example"

    ' Define the new fit point
    Dim newFitPoint(0 To 2) As Double
    newFitPoint(0) = 8: newFitPoint(1) = 5: newFitPoint(2) = 0

    ' Add the new fit point at the first index in the spline's array of points
    splineObj.AddFitPoint 1, newFitPoint
    ThisDrawing.Regen True
    MsgBox "A fit point has been added at Index:1  WCS: 8, 5, 0" & vbCrLf & "The Spline has " & splineObj.NumberOfFitPoints & " fit points.", , "AddFitPoint Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddFitPoint()
    ;; This example creates a spline object in model space.
    ;; It then adds a fit point to the spline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the spline
    (setq startTan (vlax-3d-point 0.5 0.5 10)
          endTan (vlax-3d-point 0.5 0.5 10))
    (setq fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(1 1 10
                                     5 5 10
                                     10 0 10
                                    )
    )

    ;; Create the spline object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)
    (alert (strcat "The Spline has " (itoa (vla-get-NumberOfFitPoints splineObj)) " fit points."))

    ;; Define the new fit point
    (setq newFitPoint (vlax-3d-point 8 5 0))

    ;; Add the new fit point at the first index in the spline's array of points
    (vla-AddFitPoint splineObj 1 newFitPoint)
    (vla-Regen doc :vlax-true)
    (alert (strcat "A fit point has been added at Index:1  WCS: 8, 5, 0"
                         "\nThe Spline has " (itoa (vla-get-NumberOfFitPoints splineObj)) " fit points."
           )
    )
)


AddHatch Method (ActiveX)

Creates a Hatch object.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddHatch(PatternType, PatternName, Associativity [, HatchObjectType])
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

PatternType

Access: Input-only

Type: AcPatternType or AcGradientPatternType enum

If the HatchObjectType parameter value is acHatchObject, then use the AcPatternType enum; if the HatchObjectType parameter value is AcGradientObject, then use the AcGradientPatternType enum.

AcPatternType enum

  • acHatchPatternTypePredefined: Selects the pattern name from those defined in the acad.pat file.
  • acHatchPatternTypeUserDefined: Defines a pattern of lines using the current linetype.
  • acHatchPatternTypeCustomDefined: Selects the pattern name from a PAT file other than the acad.pat file.

AcGradientPatternType enum

  • acPreDefinedGradient: Selects the fill name from one of the standard values.
  • acUserDefinedGradient: Defines a pattern based on property values.
PatternName

Access: Input-only

Type: String

If the HatchObjectType parameter value is acHatchObject, then PatternName should contain the hatch pattern name. If the HatchObjectType parameter value is acGradientObject, then PatternName should contain one of the gradient pattern names listed in GradientName.

Associativity

Access: Input-only

Type: Boolean

  • True: The hatch will be associative.
  • False: The hatch will not be associative.
HatchObjectType

Access: Input-only

Type: AcHatchObjectType enum

The default value is the AcHatchObjectType enum value of AcHatchObject. If the AcHatchObjectType enum value is AcGradientObject, then PatternType should be of type AcGradientPatternType, and PatternName should contain the gradient pattern name.

Return Value (RetVal)

Type: Hatch

The newly created Hatch object.

Remarks

After the Hatch object is created, you must add the outer loop using the AppendOuterLoop method. The outer loop must be closed and must be created before any inner loops can be created. Inner loops are created one at a time, using the AppendInnerLoop method.

WarningOnce the Hatch object has been created, you must append the outer loop to the Hatch object for it to become a valid AutoCAD object. If you attempt any operation other than calling the AppendOuterLoop method, AutoCAD will enter an unpredictable state.

Examples

VBA:

Sub Example_AddHatch()
    ' This example creates an associative gradient hatch in model space.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "CYLINDER"
    PatternType = acPreDefinedGradient '0
    bAssociativity = True

    ' Create the associative Hatch object in model space
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity, acGradientObject)
    Dim col1 As AcadAcCmColor, col2 As AcadAcCmColor
    Set col1 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Set col2 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Call col1.SetRGB(255, 0, 0)
    Call col2.SetRGB(0, 255, 0)
    hatchObj.GradientColor1 = col1
    hatchObj.GradientColor2 = col2

    ' Create the outer boundary for the hatch (a circle)
    Dim outerLoop(0 To 0) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 3: center(1) = 3: center(2) = 0
    radius = 1
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)

    ' Append the outerboundary to the hatch object, and display the hatch
    hatchObj.AppendOuterLoop (outerLoop)
    hatchObj.Evaluate
    ThisDrawing.Regen True
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddHatch()
    ;; This example creates an associative gradient hatch in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "CYLINDER")
    (setq patternType acPreDefinedGradient)
    (setq bAssociativity :vlax-true)

    ;; Create the associative Hatch object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acGradientObject))

    (setq col1 (vlax-create-object "AutoCAD.AcCmColor.20"))
    (setq col2 (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col1 255 0 0)
    (vla-SetRGB col2 0 255 0)
    (vla-put-GradientColor1 hatchObj col1)
    (vla-put-GradientColor2 hatchObj col2)

    ;; Create the outer boundary for the hatch (a circle)
    (setq center (vlax-3d-point 3 3 0))

    (setq radius 1)
    (setq circle (vla-AddCircle modelSpace center radius))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element outerLoop 0 circle)

    ;; Append the outerboundary to the hatch object, and display the hatch
    (vla-AppendOuterLoop hatchObj outerLoop)
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)

    (vlax-release-object col1)
    (vlax-release-object col2)
)


AddItems Method (ActiveX)

Adds one or more objects to the specified selection set.

Supported platforms: Windows only

Signature

VBA:

object.AddItems Items
object

Type: SelectionSet

The object this method applies to.

Items

Access: Input-only

Type: Variant

An array of objects to add to the selection set.

Return Value (RetVal)

No return value.

Remarks

Objects currently in the specified selection set remain in the selection set. To replace the objects in the selection set, clear the selection set using the Clear method, then add the objects.

To remove individual objects from a selection set, use the RemoveItems method.

Examples

VBA:

Sub Example_AddItems()
    ' This example creates a selection set and several objects.
    ' It then adds the objects to the selection set.

    ' Create the new selection set
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_SELECTIONSET")

    ' Create a Ray object in model space
    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)

    ' Create a polyline object in model space
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True

    ' Create a line object in model space
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ' Create a circle object in model space
    Dim circObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 20: centerPt(1) = 30: centerPt(2) = 0
    radius = 3
    Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)

    ' Create an ellipse object in model space
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    ZoomAll

    ' Iterate through the model space collection.
    ' Collect the objects found into an array of objects
    ' to be added to the selection set.
    ReDim ssobjs(0 To ThisDrawing.ModelSpace.count - 1) As AcadEntity
    Dim I As Integer
    For I = 0 To ThisDrawing.ModelSpace.count - 1
        Set ssobjs(I) = ThisDrawing.ModelSpace.Item(I)
    Next

    ' Add the array of objects to the selection set
    ssetObj.AddItems ssobjs

    ThisDrawing.Regen acActiveViewport

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddItems()
    ;; This example creates a selection set and several objects.
    ;; It then adds the objects to the selection set.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Create the new selection set
    (setq ssets (vla-get-SelectionSets doc))
    (setq ssetObj (vla-Add ssets "TEST_SELECTIONSET"))

    ;; Create a Ray object in model space
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 1 3 0))
    (setq rayObj (vla-AddRay modelSpace basePoint secondPoint))

    ;; Create a polyline object in model space
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
                                  9 2
                                  3 5
                                 )
    )
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)

    ;; Create a line object in model space
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 2 2 0))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    ;; Create a circle object in model space
    (setq centerPt (vlax-3d-point 20 30 0)
          radius 3)
    (setq circObj (vla-AddCircle modelSpace centerPt radius))

    ;; Create an ellipse object in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

    (vla-ZoomAll acadObj)

    ;; Iterate through the model space collection.
    ;; Collect the objects found into an array of objects
    ;; to be added to the selection set.
    (setq ssobjs (vlax-make-safearray vlax-vbObject (cons 0 (- (vla-get-Count modelSpace) 1))))

    (setq cnt 0)
    (vlax-for each-item modelSpace
        (vlax-safearray-put-element ssobjs cnt each-item)
        (setq cnt (1+ cnt))
    )

    ;; Add the array of objects to the selection set
    (vla-AddItems ssetObj ssobjs)

    (vla-Regen doc acActiveViewport)
)


AddLeader Method (ActiveX)

Creates a leader line based on the provided coordinates or adds a new leader cluster to the MLeader object.

Supported platforms: Windows only

Signature - Block, ModelSpace, PaperSpace

VBA:

RetVal = object.AddLeader(PointsArray, Annotation, Type)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

PointsArray

Access: Input-only

Type: Variant (array of doubles)

The array of 3D WCS coordinates specifying the leader. You must provide at least two points to define the leader. The third point is optional.

Annotation

Access: Input-only

Type: BlockReference, MText, Tolerance

The object that should be attached to the leader. The value can also be NULL to not attach an object.

Type

Access: Input-only

Type: AcLeaderType enum

  • acLineNoArrow
  • acLineWithArrow
  • acSplineNoArrow
  • acSplineWithArrow

Signature - MLeader

VBA:

RetVal = object.AddLeader
object

Type: MLeader

The object this method applies to.

Return Value (RetVal) - Block, ModelSpace, PaperSpace

Type: Leader

The newly created Leader object.

Return Value (RetVal) - MLeader

Type: Long

The index of the added leader cluster

Remarks

Block, ModelSpace, PaperSpace: The leader is a line that connects some annotation to a feature in a drawing. Leaders and their annotation are associative, which means if you modify the annotation, the leader updates accordingly. The annotation can be a Tolerance, MText, or BlockReference object.

You can also create leaders that are not associated to a particular object. To do this, simply input a NULL object as the annotation.

Examples

VBA:

Sub Example_AddLeader()
    ' This example creates a leader in model space.
    ' The leader is not attached to any annotation object
    ' in this example.

    Dim leaderObj As AcadLeader
    Dim points(0 To 8) As Double
    Dim leaderType As Integer
    Dim annotationObject As AcadObject

    points(0) = 0: points(1) = 0: points(2) = 0
    points(3) = 4: points(4) = 4: points(5) = 0
    points(6) = 4: points(7) = 5: points(8) = 0
    leaderType = acLineWithArrow
    Set annotationObject = Nothing

    ' Create the leader object in model space
    Set leaderObj = ThisDrawing.ModelSpace.AddLeader(points, annotationObject, leaderType)
    ZoomAll

End Sub

Sub Example_MLeaderLine()
    Dim oML As AcadMLeader
    Dim points(0 To 5) As Double
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 4: points(4) = 4: points(5) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    Dim r As Long
    r = oML.AddLeader()

    points(4) = 10
    Call oML.AddLeaderLine(r, points)

    MsgBox "LeaderCount = " & oML.LeaderCount
    ZoomExtents
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddLeader()
    ;; This example creates a leader in model space.
    ;; The leader is not attached to any annotation object
    ;; in this example.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill points '(0 0 0
                                  4 4 0
                                  4 5 0
                                 )
    )
    (setq leaderType acLineWithArrow)

    ;; Create a temporary annotaion object
    (setq point (vlax-3d-point 4 5 0))
    (setq annotationObject (vla-AddMText modelSpace point 1 ""))

    ;; Create the leader object in model space
    (setq leaderObj (vla-AddLeader modelSpace points annotationObject leaderType))

    ;; Remove the temporary annotaion object and adjust the last coordinate of the leader
    (vla-Erase annotationObject)
    (vla-put-Coordinate leaderObj 2 (vlax-3D-point 4 5 0))
    (vla-ZoomAll acadObj)
)

(defun c:Example_MLeaderLine()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(1 1 0
                                  4 4 0
                                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (setq r (vla-AddLeader oML))

    (vlax-safearray-put-element points 4 10)
    (vla-AddLeaderLine oML r points)

    (alert (strcat "LeaderCount = " (itoa (vla-get-LeaderCount oML))))
    (vla-ZoomExtents acadObj)
)


AddLeaderLine Method (ActiveX)

Adds a leaderLine to the leader cluster with specified index.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddLeaderLine(leaderIndex, pointArray)
object

Type: MLeader

The object this method applies to.

leaderIndex

Access: Input-only

Type: Long

The index of the leader cluster where the new leader line is to be added. Index must be a positive integer.

pointArray

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D OCS coordinates at which to create the new leader line.

Return Value (RetVal)

Type: Long

The index of the added leader line.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_MLeaderLine()
    Dim oML As AcadMLeader
    Dim points(0 To 5) As Double
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 4: points(4) = 4: points(5) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    Dim r As Long
    r = oML.AddLeader()

    points(4) = 10
    Call oML.AddLeaderLine(r, points)

    MsgBox "LeaderCount = " & oML.LeaderCount
    ZoomExtents
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MLeaderLine()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(1 1 0
                                  4 4 0
                                             )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (setq r (vla-AddLeader oML))

    (vlax-safearray-put-element points 4 10)
    (vla-AddLeaderLine oML r points)

    (alert (strcat "LeaderCount = " (itoa (vla-get-LeaderCount oML))))
    (vla-ZoomExtents acadObj)
)


AddLeaderLineEx Method (ActiveX)

Adds a leaderLine to the leader cluster with specified index.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddLeaderLineEx(pointArray)
object

Type: MLeader

The object this method applies to.

pointArray

Access: Input-only

Type: Variant (three-element array of doubles)

The position of the first (head) vertex of the new leader line.

Return Value (RetVal)

Type: Long

The index of the added leader line.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


AddLightWeightPolyline Method (ActiveX)

Creates a lightweight polyline from a list of vertices.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddLightWeightPolyline(VerticesList)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

VerticesList

Access: Input-only

Type: Variant (array of doubles)

The array of 2D OCS coordinates specifying the vertices of the polyline. At least two points (four elements) are required for constructing a lightweight polyline. The array size must be a multiple of 2.

Return Value (RetVal)

Type: LightweightPolyline

The newly created LightweightPolyline object.

Remarks

The vertices specify the endpoints for the line segments that make up the polyline. To add an arc segment, first create the polyline with all line segments, and then add a bulge to the individual segments you want to be arcs. To add a bulge value to a segment, use the SetBulge method.

The elevation for the polyline will be set at the current elevation for the layout. Use the ElevationModelspace or ElevationPaperspace property to determine the elevation for the polyline.

Coordinates can be converted to and from the OCS using the TranslateCoordinates method.

Examples

VBA:

Sub Example_AddLightWeightPolyline()
    ' This example creates a lightweight polyline in model space.

    Dim plineObj As AcadLWPolyline
    Dim points(0 To 9) As Double

    ' Define the 2D polyline points
    points(0) = 1: points(1) = 1
    points(2) = 1: points(3) = 2
    points(4) = 2: points(5) = 2
    points(6) = 3: points(7) = 2
    points(8) = 4: points(9) = 4

    ' Create a lightweight Polyline object in model space
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddLightWeightPolyline()
    ;; This example creates a lightweight polyline in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the 2D polyline points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 9)))
    (vlax-safearray-fill points '(1 1
                                  1 2
                                  2 2
                                  3 2
                                  4 4
                                 )
    )

    ;; Create a lightweight Polyline object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-ZoomAll acadObj)
)


AddLine Method (ActiveX)

Creates a line passing through two points.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddLine(StartPoint, EndPoint)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

StartPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the line start point.

EndPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the line endpoint.

Return Value (RetVal)

Type: Line

The newly created Line object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddLine()
    ' This example adds a line in model space

    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double

    ' Define the start and end points for the line
    startPoint(0) = 1#: startPoint(1) = 1#: startPoint(2) = 0#
    endPoint(0) = 5#: endPoint(1) = 5#: endPoint(2) = 0#

    ' Create the line in model space
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddLine()
    ;; This example adds a line in model space
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the start and end points for the line
    (setq startPoint (vlax-3d-point 1 1 0)
          endPoint (vlax-3d-point 5 5 0))

    ;; Create the line in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-ZoomAll acadObj)
)


AddMenuItem Method (ActiveX)

Adds a popup menu item to a popup menu.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddMenuItem(Index, Label, Macro)
object

Type: PopupMenu

The object this method applies to.

Index

Access: Input-only

Type: Variant

The index location in the popup menu where the item is to be added. The index must be either an integer or a string.

If an integer is supplied to specify a given location in the menu, the index must be between 0 and N-1, where N is the number of objects in the popup menu. The new item will be added immediately before the specified index location. To add the new menu item to the end of a menu, set the index to be greater than N.

If a string is specified and the indexed item does not exist, then the new menu item is added at the end of the menu.

Label

Access: Input-only

Type: String

The label for the menu item. The label may contain DIESEL string expressions. Labels also identify the accelerator keys (keyboard key sequences) that correspond to the menu item by placing an ampersand (&) in front of the accelerator character.

Macro

Access: Input-only

Type: String

The name of the macro associated with this menu item.

Return Value (RetVal)

Type: PopupMenuItem

The newly created popup menu item.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddMenuItem()
    ' This example creates a new menu called TestMenu and inserts a menu item
    ' into it. The menu is then displayed on the menu bar.
    ' To remove the menu after execution of this macro, use the Customize Menu
    ' option from the Tools menu.

    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    ' Create the new menu
    Dim newMenu As AcadPopupMenu
    Set newMenu = currMenuGroup.Menus.Add("TestMenu")

    ' Add a menu item to the new menu
    Dim newMenuItem As AcadPopupMenuItem
    Dim openMacro As String
    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set newMenuItem = newMenu.AddMenuItem(newMenu.count + 1, "Open", openMacro)

    ' Display the menu on the menu bar
    newMenu.InsertInMenuBar ThisDrawing.Application.MenuBar.count + 1

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddMenuItem()
    ;; This example creates a new menu called TestMenu and inserts a menu item
    ;; into it. The menu is then displayed on the menu bar.
    ;; To remove the menu after execution of this macro, use the Customize Menu
    ;; option from the Tools menu.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new menu
    (setq newMenu (vla-Add (vla-get-Menus currMenuGroup) "TestMenu"))

    ;; Add a menu item to the new menu
    ;; Assign the macro string the VB equivalent of "ESC ESC _open "
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))
    (setq newMenuItem (vla-AddMenuItem newMenu (1+ (vla-get-Count newMenu)) "Open" openMacro))

    ;; Display the menu on the menu bar
    (vla-InsertInMenuBar newMenu (1+ (vla-get-Count (vla-get-MenuBar acadObj))))

    ;; Display the menu bar
    (vla-SetVariable doc "MENUBAR" 1)
)


AddMInsertBlock Method (ActiveX)

Inserts an array of blocks.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddMInsertBlock(InsertionPoint, Name, XScale, YScale, ZScale, Rotation, NumRows, NumColumns, RowSpacing, ColumnSpacing [, Password])
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

InsertionPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates at which to insert the array of blocks.

Name

Access: Input-only

Type: String

The name of the MInsertBlock.

NoteYou cannot precede the name of an MInsertBlock with an asterisk to separate the block's objects during insertion, as you can with a standard Block.
XScale

Access: Input-only

Type: Double

The X scale factor.

YScale

Access: Input-only

Type: Double

The Y scale factor.

ZScale

Access: Input-only

Type: Double

The Z scale factor.

Rotation

Access: Input-only

Type: Double

The rotation angle in radians.

NumRows

Access: Input-only

Type: Long

A positive integer representing the number of rows for the array.

NumColumns

Access: Input-only

Type: Long

A positive integer representing the number of columns for the array.

RowSpacing

Access: Input-only

Type: Double

The distance between the array rows.

ColumnSpacing

Access: Input-only

Type: Double

The distance between the array columns.

Password

Access: Input-only

Type: Variant

The password that is required to open and insert the drawing.

Return Value (RetVal)

Type: MInsertBlock

The newly created array of blocks.

Remarks

The following illustration shows an array of inserted blocks.

Original block

Array of inserted blocks

Examples

VBA:

Sub Example_AddMInsertBlock()
    ' This example creates a new Block in the current drawing, adds a
    ' Circle object to the new block, and uses the newly created block
    ' to create a rectangular array of block references using AddMInsertBlock

    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double, InsertPoint(0 To 2) As Double
    Dim radius As Double
    Dim newMBlock As AcadMInsertBlock
    Dim newBlock As AcadBlock

    ' Define the Circle object that will be inserted into the block
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    InsertPoint(0) = 1: InsertPoint(1) = 1: InsertPoint(2) = 0
    radius = 0.5

    ' Create a new block to hold the Circle object
    Set newBlock = ThisDrawing.Blocks.Add(centerPoint, "CBlock")

    ' Add the Circle object to the new block object
    Set circleObj = ThisDrawing.Blocks("CBlock").AddCircle(centerPoint, radius)

    ' Create a rectangular array of Circles using the new block containing the Circle
    ' and the AddMInsertBlock method
    Set newMBlock = ThisDrawing.ModelSpace.AddMInsertBlock(InsertPoint, "CBlock", 1, 1, 1, 1, 2, 2, 1, 1)

    ThisDrawing.Application.ZoomAll

    MsgBox "A rectangular array has been created from the original block."

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddMInsertBlock()
    ;; This example creates a new Block in the current drawing, adds a
    ;; Circle object to the new block, and uses the newly created block
    ;; to create a rectangular array of block references using AddMInsertBlock
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Circle object that will be inserted into the block
    (setq centerPoint (vlax-3d-point 0 0 0)
          InsertPoint (vlax-3d-point 1 1 0)
          radius 0.5)

    ;; Create a new block to hold the Circle object
    (setq blocks (vla-get-Blocks doc))
    (setq newBlock (vla-Add blocks centerPoint "CBlock"))

    ;; Add the Circle object to the new block object
    (setq circleObj (vla-AddCircle newBlock centerPoint radius))

    ;; Create a rectangular array of Circles using the new block containing the Circle
    ;; and the AddMInsertBlock method
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq newMBlock (vla-AddMInsertBlock modelSpace InsertPoint "CBlock" 1 1 1 1 2 2 1 1))

    (vla-ZoomAll acadObj)

    (alert "A rectangular array has been created from the original block.")
)


AddMLeader Method (ActiveX)

Creates an mleader line, given coordinates.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddMLeader(pointsArray, leaderLineIndex)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

pointsArray

Access: Input-only

Type: Variant (three-element array of Doubles)

The array of 3D WCS coordinates specifying the leader. You must provide at least two point to define the leader. The third point is optional.

leaderLineIndex

Access: Input-only

Type: Long

Input index of the mleader cluster.

Return Value (RetVal)

Type: MLeader

The newly created MLeader object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddMLeader()
    Dim oML As AcadMLeader
    Dim points(0 To 14) As Double

    ' Define the leader points
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 1: points(4) = 2: points(5) = 0
    points(6) = 2: points(7) = 2: points(8) = 0
    points(9) = 3: points(10) = 2: points(11) = 0
    points(12) = 4: points(13) = 4: points(14) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddMLeader()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the leader points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill points '(1 1 0
                                  1 2 0
                                  2 2 0
                                  3 2 0
                                  4 4 0
                                 )
    )
    (setq i 0)

    ;; Add the mleader object to model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq mLeader (vla-AddMLeader modelSpace points i))
)


AddMLine Method (ActiveX)

Creates multiple lines passing through an array of points.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddMLine(VertexList)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

VertexList

Access: Input-only

Type: Variant (array of doubles)

An array of the 3D WCS coordinates specifying the vertices for the multiline.

Return Value (RetVal)

Type: MLine

The newly created MLine object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddMLine()
   ' This example adds an Mline in model space

    Dim mLineObj As AcadMLine
    Dim vertexList(0 To 17) As Double

    ' Define data for new object
    vertexList(0) = 4: vertexList(1) = 7: vertexList(2) = 0
    vertexList(3) = 5: vertexList(4) = 7: vertexList(5) = 0
    vertexList(6) = 6: vertexList(7) = 7: vertexList(8) = 0
    vertexList(9) = 4: vertexList(10) = 6: vertexList(11) = 0
    vertexList(12) = 5: vertexList(13) = 6: vertexList(14) = 0
    vertexList(15) = 6: vertexList(16) = 6: vertexList(17) = 6

    ' Create the line in model space
    Set mLineObj = ThisDrawing.ModelSpace.AddMLine(vertexList)

    ThisDrawing.Application.ZoomAll

    MsgBox "A new MLine has been added to the drawing."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddMLine()
    ;; This example adds an Mline in model space
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define data for new object
    (setq vertexList (vlax-make-safearray vlax-vbDouble '(0 . 17)))
    (vlax-safearray-fill vertexList '(4 7 0
                                      5 7 0
                                      6 7 0
                                      4 6 0
                                      5 6 0
                                      6 6 0
                                     )
    )

    ;; Create the line in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq mLineObj (vla-AddMLine modelSpace vertexList))

    (vla-ZoomAll acadObj)

    (alert "A new MLine has been added to the drawing.")
)


AddMText Method (ActiveX)

Creates an MText entity in a rectangle defined by the insertion point and width of the bounding box.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddMText(InsertionPoint, Width, Text)
object

Type: Block, ModelSpace, PaperSpace

The object this method applies to.

InsertionPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The insertion point of the MText bounding box.

Width

Access: Input-only

Type: Double

The width of the MText bounding box.

Text

Access: Input-only

Type: String

The actual text string for the MText object.

Return Value (RetVal)

Type: MText

The newly created MText object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddMtext()
    ' This example creates an MText object in model space.

    Dim MTextObj As AcadMText
    Dim corner(0 To 2) As Double
    Dim width As Double
    Dim text As String
    corner(0) = 0#: corner(1) = 10#: corner(2) = 0#
    width = 10
    text = "This is the text String for the mtext Object"

    ' Creates the mtext Object
    Set MTextObj = ThisDrawing.ModelSpace.AddMText(corner, width, text)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddMtext()
    ;; This example creates an MText object in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the multiline text object
    (setq corner (vlax-3d-point 0 10 0)
          width 10
          text "This is the text String for the mtext Object")

    ;; Creates the mtext Object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MTextObj (vla-AddMText modelSpace corner width text))
    (vla-ZoomAll acadObj)
)


AddObject Method (ActiveX)

Adds an object to a named dictionary.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddObject(Keyword, ObjectName)
object

Type: Dictionary

The object this method applies to.

Keyword

Access: Input-only

Type: String

The keyword to be listed in the dictionary for this object.

ObjectName

Access: Input-only

Type: String

The rxClassName of the object to be created in the dictionary.

Return Value (RetVal)

Type: Object

The newly created object.

Remarks

This method adds a new entry specified by ObjectName to the dictionary. If the entry already exists, it is replaced by the new object. The name of the object is specified by Keyword.

For example, an object with the Keyword "ThirdKeyword" and an object type "Object3" can be added to MyDictionary to create the following:

MyDictionary

Keyword Object

FirstKeyword Object1

SecondKeyword Object2

ThirdKeyword Object3

NoteThe ObjectARX application that defines the object must be loaded for this method to function correctly. See the LoadARX method for information on loading ObjectARX applications.

Examples

VBA:

Sub Example_AddObject()
    ' This example creates a dictionary and adds
    ' a custom object to that dictionary.

    Dim dictObj As AcadDictionary
    Set dictObj = ThisDrawing.Dictionaries.Add("TEST_DICTIONARY")

    ' Load the ObjectARX application that defines the custom object.
    ' Note: The application listed here does not exist and
    ' will cause an error when run. Change the application name
    ' to the path and name of your ObjectARX application.
    ThisDrawing.Application.LoadArx "MyARXApp.dll"

    ' Create the custom object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadObject

    keyName = "OBJ1"
    className = "CAsdkDictObject"

    Set customObj = dictObj.AddObject(keyName, className)

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddObject()
    ;; This example creates a dictionary and adds
    ;; a custom object to that dictionary.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq dictionaries (vla-get-Dictionaries doc))

    (setq dictObj (vla-Add dictionaries "TEST_DICTIONARY"))

    ;; Load the ObjectARX application that defines the custom object.
    ;; Note: The application listed here does not exist and
    ;; will cause an error when run. Change the application name
    ;; to the path and name of your ObjectARX application.
    (vla-LoadArx acadObj "MyARXApp.dll")

    ;; Create the custom object in the dictionary
    (setq keyName "OBJ1")
    (setq className "CAsdkDictObject")

    (setq customObj (vla-AddObject dictObj keyName className))
)


AddPoint Method (ActiveX)

Creates a Point object at a given location.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddPoint(Point)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Point

Access: Input-only

Type: Variant (three-element array of doubles)

The coordinates of the point to be created.

Return Value (RetVal)

Type: Point

The newly created Point object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddPoint()
    ' This example creates a point in model space.
    Dim pointObj As AcadPoint
    Dim location(0 To 2) As Double

    ' Define the location of the point
    location(0) = 5#: location(1) = 5#: location(2) = 0#

    ' Create the point
    Set pointObj = ThisDrawing.ModelSpace.AddPoint(location)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddPoint()
    ;; This example creates a point in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the location of the point
    (setq location (vlax-3d-point 5 5 0))

    ;; Create the point
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq pointObj (vla-AddPoint modelSpace location))
    (vla-ZoomAll acadObj)
)


AddPolyfaceMesh Method (ActiveX)

Creates a polyface mesh from a list of vertices.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddPolyfaceMesh(VerticesList, FaceList)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

VerticesList

Access: Input-only

Type: Variant (array of doubles)

An array of 3D WCS coordinates used to create the polyface mesh vertices. At least four points (twelve elements) are required for constructing a polyface mesh object. The array size must be a multiple of three.

FaceList

Access: Input-only

Type: Variant (array of integers)

An array of integers representing the vertex numbers for each face. Faces are defined in groups of four vertex index values, so the size of this array must be a multiple of four.

Return Value (RetVal)

Type: PolyfaceMesh

The newly created PolyfaceMesh object.

Remarks

Creating a polyface mesh is similar to creating a rectangular mesh. To create a polyface mesh, you specify the coordinates for its vertices and the vertex numbers for all the vertices of that face.

In the following illustration, face 1 is defined by vertices 1, 5, 6, and 2. Face 2 is defined by vertices 1, 4, 3, and 2. Face 3 is defined by vertices 1, 4, 7, and 5, and face 4 is defined by vertices 3, 4, 7, and 8.

To make an edge invisible, enter the vertex number for the edge as a negative value. For instance, to make the edge between vertices 5 and 7 invisible in the following illustration, you would set the following:

Face 3, vertex 3: -7

Examples

VBA:

Sub Example_AddPolyfaceMesh()

    Dim vertexList(0 To 17) As Double

    'Data
    vertexList(0) = 4: vertexList(1) = 7: vertexList(2) = 0
    vertexList(3) = 5: vertexList(4) = 7: vertexList(5) = 0
    vertexList(6) = 6: vertexList(7) = 7: vertexList(8) = 0
    vertexList(9) = 4: vertexList(10) = 6: vertexList(11) = 0
    vertexList(12) = 5: vertexList(13) = 6: vertexList(14) = 0
    vertexList(15) = 6: vertexList(16) = 6: vertexList(17) = 1

    Dim FaceList(0 To 7) As Integer

    FaceList(0) = 1
    FaceList(1) = 2
    FaceList(2) = 5
    FaceList(3) = 4
    FaceList(4) = 2
    FaceList(5) = 3
    FaceList(6) = 6
    FaceList(7) = 5

    Dim obj As AcadPolyfaceMesh
    Set obj = ModelSpace.AddPolyfaceMesh(vertexList, FaceList)
    obj.Update

    ' Change the viewing direction of the viewport to
    ' better see the polyface mesh
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddPolyfaceMesh()
    ;; This example creates a polyface mesh in model space
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the vertices for the polyface mesh
    (setq vertexList (vlax-make-safearray vlax-vbDouble '(0 . 17)))
    (vlax-safearray-fill vertexList '(4 7 0
                                      5 7 0
                                      6 7 0
                                      4 6 0
                                      5 6 0
                                      6 6 1
                                     )
    )

    ;; Define the face order for the polyface mesh
    (setq FaceList (vlax-make-safearray vlax-vbInteger '(0 . 7)))
    (vlax-safearray-fill FaceList '(1
                                    2
                                    5
                                    4
                                    2
                                    3
                                    6
                                    5
                                   )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq obj (vla-AddPolyfaceMesh modelSpace vertexList FaceList))

    ;; Change the viewing direction of the viewport to
    ;; better see the polyface mesh
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)
)


AddPolyline Method (ActiveX)

Creates a polyline from a list of vertices.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddPolyline(VerticesList)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

VerticesList

Access: Input-only

Type: Variant (array of doubles)

An array of OCS coordinates used to create the polyline vertices. Each vertex is represented with three elements, with the first two being the X and Y coordinates in OCS; the third element is ignored. At least two points (six elements) are required for constructing a polyline object. The array size must be a multiple of three.

Return Value (RetVal)

Type: Polyline

The newly created Polyline object.

Remarks

To create a polyline containing arcs, first create the straight polyline, and then set the bulge at specific vertices using the SetBulge method.

This method exists for backward compatibility only. Use the AddLightweightPolyline method to create polylines with an optimized format that saves memory and disk space.

Coordinates can be converted to and from the OCS using the TranslateCoordinates method.

Examples

VBA:

Sub Example_AddPolyline()
    ' This example creates a polyline in model space.

    Dim plineObj As AcadPolyline
    Dim points(0 To 14) As Double

    ' Define the 2D polyline points
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 1: points(4) = 2: points(5) = 0
    points(6) = 2: points(7) = 2: points(8) = 0
    points(9) = 3: points(10) = 2: points(11) = 0
    points(12) = 4: points(13) = 4: points(14) = 0

    ' Create a lightweight Polyline object in model space
    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddPolyline()
    ;; This example creates a polyline in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the 2D polyline points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill points '(1 1 0
                                  1 2 0
                                  2 2 0
                                  3 2 0
                                  4 4 0
                                 )
    )

    ;; Create a lightweight Polyline object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddPolyline modelSpace points))
    (vla-ZoomAll acadObj)
)


AddPViewport Method (ActiveX)

Adds a paper space viewport, given the center, height, and width.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddPViewport(Center, Width, Height)
object

Type: PaperSpace

The object this method applies to.

Center

Access: Input-only

Type: Variant (three-element array of doubles)

The center coordinates of the viewport.

Width

Access: Input-only

Type: Double

The width of the viewport. Must be a positive number.

Height

Access: Input-only

Type: Double

The height of the viewport. Must be a positive number.

Return Value (RetVal)

Type: PViewport

The newly created PViewport object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddPViewport()
    ' This example creates a new paper space viewport

    Dim pviewportObj As AcadPViewport
    Dim center(0 To 2) As Double
    Dim width As Double
    Dim height As Double

    ' Define the paper space viewport
    center(0) = 3: center(1) = 3: center(2) = 0
    width = 40
    height = 40

    ' Change from model space to paper space
    ThisDrawing.ActiveSpace = acPaperSpace

    ' Create the paper space viewport
    Set pviewportObj = ThisDrawing.PaperSpace.AddPViewport(center, width, height)

    ThisDrawing.Regen acAllViewports

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddPViewport()
    ;; This example creates a new paper space viewport
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the paper space viewport
    (setq center (vlax-3d-point 3 3 0)
          width 40
          height 40)

    ;; Change from model space to paper space
    (vla-put-ActiveSpace doc acPaperSpace)

    ;; Create the paper space viewport
    (setq paperSpace (vla-get-PaperSpace doc))
    (setq pviewportObj (vla-AddPViewport paperSpace center width height))

    ;; Turn the viewport on, by default it is off
    (vla-Display pviewportObj :vlax-true)

    (vla-Regen doc acAllViewports)
)


AddRaster Method (ActiveX)

Creates a new raster image based on an existing image file.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddRaster(ImageFileName, InsertionPoint, ScaleFactor, RotationAngle)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

ImageFileName

Access: Input-only

Type: String

The full path and file name of the image.

InsertionPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates in the drawing where the raster image will be created.

ScaleFactor

Access: Input-only

Type: Double

The raster image scale factor. The default image scale factor is 1. The scale factor must be a positive number. You can set the scale of the image to the scale of the geometry created in the AutoCAD drawing.

RotationAngle

Access: Input-only

Type: Double

The rotation angle in radians for the raster image.

Return Value (RetVal)

Type: RasterImage

The newly created RasterImage object.

Remarks

Images placed through the AddRaster method are not actually part of the drawing file. The raster image is linked to the drawing file through a path name or document ID. Linked image paths can be changed or removed at any time by using the SupportPath property. By attaching images using linked image paths, you place images in your drawing without increasing the file size of the drawing.

You can add the same raster image file to your drawing file multiple times. Each instance has its own clip boundary and its own settings for brightness, contrast, fade, and transparency. A single image can be cut into multiple pieces that can be rearranged independently in your drawing.

Examples

VBA:

Sub Example_AddRaster()
    ' This example adds a raster image in model space.

    ' This example uses a file named "2d Projected Polylines.jpg."
    ' You should change this example to use
    ' a raster file on your computer.

    Dim insertionPoint(0 To 2) As Double
    Dim scalefactor As Double
    Dim rotationAngle As Double
    Dim imageName As String
    Dim rasterObj As AcadRasterImage
    imageName = "C:\AutoCAD\2d Projected Polylines.jpg"
    insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0#
    scalefactor = 1#
    rotationAngle = 0

    On Error Resume Next
    ' Creates a raster image in model space
    Set rasterObj = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotationAngle)

    If Err.Description = "File error" Then
        MsgBox imageName & " could not be found."
        Exit Sub
    End If
    ZoomExtents
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddRaster()
    ;; This example adds a raster image in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; This example uses a file named "2d Projected Polylines.jpg."
    ;; You should change this example to use
    ;; a raster file on your computer.
    (setq insertionPoint (vlax-3d-point 5 5 0)
          imageName ".\\Sample\\VBA\\2d Projected Polylines.jpg"
          scalefactor 1
          rotationAngle 0)

    ;; Creates a raster image in model space
    (if (/= (findfile imageName) nil)
        (progn
            (setq modelSpace (vla-get-ModelSpace doc))
            (setq rasterObj (vla-AddRaster modelSpace (findfile imageName) insertionPoint scalefactor rotationAngle))

            (vla-ZoomExtents acadObj)
        )
        (alert (strcat imageName " could not be found."))
    )
)


AddRay Method (ActiveX)

Creates a ray passing through two unique points.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddRay(Point1, Point2)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Point1

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the finite start point of the ray.

Point2

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying a point through which the ray will pass. The ray extends from Point1, through Point2 to infinity.

Return Value (RetVal)

Type: Ray

The newly created Ray object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddRay()
    ' This example creates a ray in model space.

    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double

    ' Define the ray
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 4#: SecondPoint(1) = 4#: SecondPoint(2) = 0#

    ' Creates a Ray object in model space
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddRay()
    ;; This example creates a ray in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the ray
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 4 4 0))

    ;; Creates a Ray object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq rayObj (vla-AddRay modelSpace basePoint secondPoint))
    (vla-ZoomAll acadObj)
)


AddRegion Method (ActiveX)

Creates a region from a set of entities. The given entities must form a closed coplanar region.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddRegion(ObjectList)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

ObjectList

Access: Input-only

Type: Variant (array of Arc, Circle, Ellipse, Line, LWPolyline, Spline objects)

The array of objects forming the closed coplanar face to be made into a region.

Return Value (RetVal)

Type: Variant (array of Region objects)

This method outputs an array of the newly created Region objects.

Remarks

This method will create a region out of every closed loop formed by the input array of curves. AutoCAD converts closed 2D and planar 3D polylines to separate regions, and then converts polylines, lines, and curves that form closed planar loops. If more than two curves share an endpoint, the resultant region might be arbitrary.

You can explode a region into the individual loops by using the Explode method. The Boolean method allows you to create composite 3D solids or regions from the intersection, union, or subtraction of a solid or region from another solid or region.

The total number of Region objects created is Ubound(objRegions) - Lbound(objRegions) + 1.

Examples

VBA:

Sub Example_AddRegion()
    ' This example creates a region from an arc and a line.

    Dim curves(0 To 1) As AcadEntity

    ' Define the arc
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    centerPoint(0) = 5#: centerPoint(1) = 3#: centerPoint(2) = 0#
    radius = 2#
    startAngle = 0
    endAngle = 3.141592
    Set curves(0) = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngle, endAngle)

    ' Define the line
    Set curves(1) = ThisDrawing.ModelSpace.AddLine(curves(0).startPoint, curves(0).endPoint)

    ' Create the region
    Dim regionObj As Variant
    regionObj = ThisDrawing.ModelSpace.AddRegion(curves)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddRegion()
    ;; This example creates a region from an arc and a line.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Define the arc
    (setq centerPoint (vlax-3d-point 5 3 0)
          radius 2
          startAngle 0
          endAngle 3.141592)
    (setq arc (vla-AddArc modelSpace centerPoint radius startAngle endAngle))

    ;; Define the line
    (setq line (vla-AddLine modelSpace (vla-get-StartPoint arc) (vla-get-EndPoint arc)))

    (setq curves (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element curves 0 arc)
    (vlax-safearray-put-element curves 1 line)

    ;; Create the region
    (setq regionObj (vla-AddRegion modelSpace curves))
    (vla-ZoomAll acadObj)
)


AddRevolvedSolid Method (ActiveX)

Creates a revolved solid, given the region around an axis.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddRevolvedSolid(Profile, AxisPoint, AxisDir, Angle)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Profile

Access: Input-only

Type: Region

A profile can only a Region object.

AxisPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the start point of the axis of revolution.

AxisDir

Access: Input-only

Type: Variant (three-element array of doubles)

A 3D vector specifying the direction of the axis of revolution.

Angle

Access: Input-only

Type: Double

The angle of revolution in radians. Enter 6.28 for a full circle revolution.

Return Value (RetVal)

Type: 3DSolid

A 3DSolid object as the newly created revolved solid.

Remarks

The region to revolve must be closed. You cannot revolve objects contained within a block. You can revolve only one object at a time.

The right-hand rule determines the positive direction of rotation.

Examples

VBA:

Sub Example_AddRevolvedSolid()
    ' This example creates a solid from a region
    ' rotated around an axis.
    ' The region is created from an arc and a line.
    Dim curves(0 To 1) As AcadEntity

    ' Define the arc
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    centerPoint(0) = 5#: centerPoint(1) = 3#: centerPoint(2) = 0#
    radius = 2#
    startAngle = 0
    endAngle = 3.141592
    Set curves(0) = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngle, endAngle)

    ' Define the line
    Set curves(1) = ThisDrawing.ModelSpace.AddLine(curves(0).startPoint, curves(0).endPoint)

    ' Create the region
    Dim regionObj As Variant
    regionObj = ThisDrawing.ModelSpace.AddRegion(curves)
    ZoomAll
    MsgBox "Revolve the region to create the solid.", , "AddRevolvedSolid Example"

    ' Define the rotation axis
    Dim axisPt(0 To 2) As Double
    Dim axisDir(0 To 2) As Double
    Dim angle As Double
    axisPt(0) = 7: axisPt(1) = 2.5: axisPt(2) = 0
    axisDir(0) = 11: axisDir(1) = 1: axisDir(2) = 3
    angle = 6.28

    ' Create the solid
    Dim solidObj As Acad3DSolid
    Set solidObj = ThisDrawing.ModelSpace.AddRevolvedSolid(regionObj(0), axisPt, axisDir, angle)
    ZoomAll

     ' Change the viewing direction of the viewport
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll
    MsgBox "Solid created.", , "AddRevolvedSolid Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddRevolvedSolid()
    ;; This example creates a solid from a region
    ;; rotated around an axis.
    ;; The region is created from an arc and a line.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Define the arc
    (setq centerPoint (vlax-3d-point 5 3 0)
          radius 2
          startAngle 0
          endAngle 3.141592)
    (setq arc (vla-AddArc modelSpace centerPoint radius startAngle endAngle))

    ;; Define the line
    (setq line (vla-AddLine modelSpace (vla-get-StartPoint arc) (vla-get-EndPoint arc)))

    (setq curves (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element curves 0 arc)
    (vlax-safearray-put-element curves 1 line)

    ;; Create the region
    (setq regionObj (vla-AddRegion modelSpace curves))
    (vla-ZoomAll acadObj)
    (alert "Revolve the region to create the solid.")

    ;; Define the rotation axis
    (setq rotAxisPt (vlax-3d-point 7 2.5 0)
          rotAxisDir (vlax-3d-point 11 1 3)
          rotAngle 6.28)

    ;; Create the solid
    (setq solidObj (vla-AddRevolvedSolid modelSpace (vlax-safearray-get-element (vlax-variant-value regionObj) 0) rotAxisPt rotAxisDir rotAngle))

    ;; Change the viewing direction of the viewport
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)
    (alert "Solid created.")
)


AddSection Method (ActiveX)

Creates a section plane.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddSection(FromPoint, ToPoint, planeVector)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

FromPoint

Access: Input-only

Type: Variant

The 3D WCS coordinates specifying the finite start point of the section.

ToPoint

Access: Input-only

Type: Variant

The 3D WCS coordinates specifying a point through which the section will pass. The section extends from FromPoint, through ToPoint to infinity.

planeVector

Access: Input-only

Type: Variant

A 3D directional vector specifying the direction of the section plane.

Return Value (RetVal)

Type: Section

The newly created Section object.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


AddSeparator Method (ActiveX)

Adds a separator to an existing menu or toolbar.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddSeparator(Index)
object

Type: PopupMenu, Toolbar

The objects this method applies to.

Index

Access: Input-only

Type: Variant

The index location in the menu or toolbar where the item is to be added.

If an integer is used to specify a given location in the menu or toolbar, the index must be between 1 and N-1, where N is the number of objects in the popup menu or in the toolbar. The separator will be added immediately before the specified index location. To add the separator to the end of a menu or toolbar, set the index to be greater than N.

If a string is specified and the indexed item does not exist, then the separator is added at the end of the menu or toolbar.

Return Value (RetVal)

Type: PopupMenuItem, ToolbarItem

The newly created separator item.

Remarks

The first item in a menu or toolbar cannot be a separator, therefore you cannot add a separator into index position 0.

You cannot add a separator immediately next to another separator.

Examples

VBA:

Sub Example_AddSeparator()
    ' This example creates a new menu called TestMenu and inserts a menu item
    ' and a separator into it. The menu is then displayed on the menu bar.
    ' To remove the menu after execution of this macro, use the Customize Menu
    ' option from the Tools menu.

    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    ' Create the new menu
    Dim newMenu As AcadPopupMenu
    Set newMenu = currMenuGroup.Menus.Add("TestMenu")

    ' Add a menu item to the new menu
    Dim newMenuItem As AcadPopupMenuItem
    Dim openMacro As String

    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set newMenuItem = newMenu.AddMenuItem(newMenu.count + 1, "Open", openMacro)

    ' Add a separator to the end of the menu
    Dim newMenuSeparator As AcadPopupMenuItem
    Set newMenuSeparator = newMenu.AddSeparator("")

    ' Display the menu on the menu bar
    newMenu.InsertInMenuBar ThisDrawing.Application.MenuBar.count + 1

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddSeparator()
    ;; This example creates a new menu called TestMenu and inserts a menu item
    ;; and a separator into it. The menu is then displayed on the menu bar.
    ;; To remove the menu after execution of this macro, use the Customize Menu
    ;; option from the Tools menu.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new menu
    (setq newMenu (vla-Add (vla-get-Menus currMenuGroup) "TestMenu"))

    ;; Add a menu item to the new menu
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))
    (setq newMenuItem (vla-AddMenuItem newMenu (1+ (vla-get-Count newMenu)) "Open" openMacro))

    ;; Add a separator to the end of the menu
    (setq newMenuSeparator (vla-AddSeparator newMenu ""))

    ;; Display the menu on the menu bar
    (vla-InsertInMenuBar newMenu (1+ (vla-get-Count (vla-get-MenuBar acadObj))))

    ;; Display the menu bar
    (vla-SetVariable doc "MENUBAR" 1)
)


AddShape Method (ActiveX)

Creates a Shape object based on a template identified by name, at the given insertion point, scale factor, and rotation.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddShape(Name, InsertionPoint, ScaleFactor, Rotation)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Name

Access: Input-only

Type: String

The name of the shape to insert.

InsertionPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates at which to insert the shape.

ScaleFactor

Access: Input-only

Type: Double

The scale factor to be applied to the shape. Use 1.0 to specify no scale. Must be a positive number.

Rotation

Access: Input-only

Type: Double

The angle of rotation in radians to be applied to the shape.

Return Value (RetVal)

Type: Shape

The newly created Shape object.

Remarks

Before adding a Shape object, you must load the file containing the desired shape using the LoadShapeFile method.

Examples

VBA:

Sub Example_AddShape()
    ' This example creates a BAT shape from the ltypeshp.shx file.

    ' Load the shape file containing the shape you wish to create.
    ' Note: Replace the ltypeshp.shx file name
    ' with a valid shape file for your system.
    On Error GoTo ERRORHANDLER
    ThisDrawing.LoadShapeFile ("C:/Program Files/AutoCAD/Support/ltypeshp.shx")

    Dim shapeObj As AcadShape
    Dim shapeName As String
    Dim insertionPoint(0 To 2) As Double
    Dim scalefactor As Double
    Dim rotation As Double

    ' "diode" is defined in es.shx file
    shapeName = "BAT"
    insertionPoint(0) = 2#: insertionPoint(1) = 2#: insertionPoint(2) = 0#
    scalefactor = 1#
    rotation = 0#       ' Radians

    ' Create the diode shape object in model space
    Set shapeObj = ThisDrawing.ModelSpace.AddShape(shapeName, insertionPoint, scalefactor, rotation)
    Exit Sub

ERRORHANDLER:
    MsgBox "Cannot find the shape file.", , "AddShape Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddShape()
    ;; This example creates a BAT shape from the ltypeshp.shx file.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Load the shape file containing the shape you wish to create.
    ;; Note: Replace the ltypeshp.shx file name
    ;; with a valid shape file for your system.
    (setq shapeFile ".\\ltypeshp.shx")

    (if (/= (findfile shapeFile) nil)
        (progn
               (vla-LoadShapeFile doc (findfile shapeFile))

            ;; "diode" is defined in es.shx file
            (setq insertionPoint (vlax-3d-point 2 2 0)
                  shapeName "BAT"
                  scalefactor 1
                  rotation 0)      ;; Radians

            ;; Create the diode shape object in model space
               (setq modelSpace (vla-get-ModelSpace doc))
               (setq shapeObj (vla-AddShape modelSpace shapeName insertionPoint scalefactor rotation))
        )
        (alert "Cannot find the shape file.")
    )
)


AddSolid Method (ActiveX)

Creates a 2D solid polygon.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddSolid(Point1, Point2, Point3, Point4)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Point1

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the first point.

Point2

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the second point.

Point3

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the third point.

Point4

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the fourth point.

Return Value (RetVal)

Type: Solid

The newly created polygon.

Remarks

The first two points define one edge of the polygon. The third point is defined diagonally opposite from the second. If the fourth point is set equal to the third point, then a filled triangle is created.

Solids are filled only when the AutoCAD FILLMODE system variable is set to On. To set or query a system variable, use the SetVariable and GetVariable methods, respectively.

Examples

VBA:

Sub Example_AddSolid()
    ' This example creates a solid in model space.

    Dim solidObj As AcadSolid
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    Dim point3(0 To 2) As Double
    Dim point4(0 To 2) As Double

    ' Define the solid
    point1(0) = 0#: point1(1) = 1#: point1(2) = 0#
    point2(0) = 5#: point2(1) = 1#: point2(2) = 0#
    point3(0) = 4#: point3(1) = 6#: point3(2) = 0#
    point4(0) = 8#: point4(1) = 8#: point4(2) = 0#

    ' Create the solid object in model space
    Set solidObj = ThisDrawing.ModelSpace.AddSolid(point1, point2, point3, point4)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddSolid()
    ;; This example creates a solid in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the solid
    (setq point1 (vlax-3d-point 0 1 0)
          point2 (vlax-3d-point 5 1 0)
          point3 (vlax-3d-point 4 6 0)
          point4 (vlax-3d-point 8 8 0))

    ;; Create the solid object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq solidObj (vla-AddSolid modelSpace point1 point2 point3 point4))
    (vla-ZoomAll acadObj)
)


AddSphere Method (ActiveX)

Creates a sphere given the center and radius.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddSphere(Center, Radius)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Center

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the sphere center point.

Radius

Access: Input-only

Type: Double

The radius of the sphere. Must be a positive number.

Return Value (RetVal)

Type: 3DSolid

A 3DSolid object as the newly created sphere.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddSphere()
    ' This example creates a sphere in model space.

    Dim sphereObj As Acad3DSolid
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double

    centerPoint(0) = 5#: centerPoint(1) = 5#: centerPoint(2) = 0#
    radius = 5#
    Set sphereObj = ThisDrawing.ModelSpace.AddSphere(centerPoint, radius)

     ' Change the viewing direction of the viewport
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddSphere()
    ;; This example creates a sphere in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the solid sphere
    (setq centerPoint (vlax-3d-point 5 5 0)
          radius 5)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq sphereObj (vla-AddSphere modelSpace centerPoint radius))

    ;; Change the viewing direction of the viewport
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)
)


AddSpline Method (ActiveX)

Creates a quadratic or cubic NURBS (nonuniform rational B-spline) curve.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddSpline(PointsArray, StartTangent, EndTangent)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

PointsArray

Access: Input-only

Type: Variant (three-element array of doubles)

An array of 3D WCS coordinates defining the spline curve. At least two points (six elements) are required for constructing a Spline object. The array size must be in multiples of three.

StartTangent

Access: Input-only

Type: Variant (three-element array of doubles)

A 3D vector specifying the tangency of the spline curve at the first point.

EndTangent

Access: Input-only

Type: Variant (three-element array of doubles)

A 3D vector specifying the tangency of the spline curve at the last point.

Return Value (RetVal)

Type: Spline

The newly created Spline object.

Remarks

The StartTangent and EndTangent parameters specify the tangents at the two ends of the spline. By default, a spline is created open. The read-only Closed property indicates whether the spline is open or closed.

Examples

VBA:

Sub Example_AddSpline()
    ' This example creates a spline object in model space.

    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddSpline()
    ;; This example creates a spline object in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the spline
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0))
    (setq fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(1 1 0
                                     5 5 0
                                     10 0 0
                                    )
    )

    ;; Create the spline
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)
)


AddSubMenu Method (ActiveX)

Adds a submenu to an existing menu.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddSubMenu(Index, Label)
object

Type: PopupMenu

The object this method applies to.

Index

Access: Input-only

Type: Variant

The index location in the menu where the item is to be added.

If an integer is used to specify a given location in the menu, the index must be between 0 and N-1, where N is the number of objects in the popup menu. The new item will be added immediately before the specified index location. To add the new menu item to the end of a menu, set the index to be greater than N.

If a string is specified and the indexed item does not exist, then the new menu item is added at the end of the menu.

Label

Access: Input-only

Type: String

The label for the menu item. The label may contain DIESEL string expressions. Labels also identify the accelerator keys (keyboard key sequences) that correspond to the menu item by placing an ampersand (&) in front of the accelerator character.

Return Value (RetVal)

Type: PopupMenu

The newly created submenu. This new cascading menu is blank, and can be populated with standard menu handling techniques.

Remarks

This method creates a new PopupMenuItem object and adds it to the designated menu. This special kind of PopupMenuItem object is assigned the type of acSubmenu.

In the following example menu, the Align Text menu item has been inserted into the Dimension menu at the 17th index. The Align Text menu item is of the type acSubmenu. All other menu entries in the example are of the type acMenuItem or acMenuSeparator. The small cascading menu that is displayed when Align Text is selected is the new menu that was returned by the AddSubmenu method. It has been populated using the AddMenuItem and AddSeparator methods.

Examples

VBA:

Sub Example_AddSubMenu()
    ' This example creates a new menu called TestMenu and inserts a submenu item
    ' called NewFile. It then creates a menu item, called open,
    ' on the submenu.

    ' The menu is then displayed on the menu bar.
    ' To remove the menu after execution of this macro, use the Customize Menu
    ' option from the Tools menu.

    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    ' Create the new menu
    Dim newMenu As AcadPopupMenu
    Set newMenu = currMenuGroup.Menus.Add("TestMenu")

    ' Add the submenu
    Dim FileSubMenu As AcadPopupMenu
    Set FileSubMenu = newMenu.AddSubMenu("", "NewFile")

    ' Add a menu item to the sub menu
    Dim newMenuItem As AcadPopupMenuItem
    Dim openMacro As String

    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set newMenuItem = FileSubMenu.AddMenuItem(newMenu.count + 1, "Open", openMacro)

    ' Display the menu on the menu bar
    newMenu.InsertInMenuBar ThisDrawing.Application.MenuBar.count + 1

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddSubMenu()
    ;; This example creates a new menu called TestMenu and inserts a submenu item
    ;; called NewFile. It then creates a menu item, called open,
    ;; on the submenu.

    ;; The menu is then displayed on the menu bar.
    ;; To remove the menu after execution of this macro, use the Customize Menu
    ;; option from the Tools menu.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new menu
    (setq newMenu (vla-Add (vla-get-Menus currMenuGroup) "TestMenu"))

    ;; Add the submenu
    (setq FileSubMenu (vla-AddSubMenu newMenu "" "NewFile"))

    ;; Assign the macro string the VB equivalent of "ESC ESC _open "
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))
    (setq newMenuItem (vla-AddMenuItem FileSubMenu (1+ (vla-get-Count newMenu)) "Open" openMacro))

    ;; Display the menu on the menu bar
    (vla-InsertInMenuBar newMenu (1+ (vla-get-Count (vla-get-MenuBar acadObj))))

    ;; Display the menu bar
    (vla-SetVariable doc "MENUBAR" 1)
)


AddTable Method (ActiveX)

Adds a table to a drawing.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddTable(InsertionPoint, NumRows, NumColumns, RowHeight, ColWidth)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

InsertionPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates in the drawing where the table is inserted.

NumRows

Access: Input-only

Type: Long

The number of rows in the table.

NumColumns

Access: Input-only

Type: Long

The number of columns in the table.

RowHeight

Access: Input-only

Type: Double

The height of the rows in the table.

ColWidth

Access: Input-only

Type: Double

The width of the columns in the table.

Return Value (RetVal)

Type: Table

The newly created table object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddTable()
    ' This example adds a table in model space

    Dim MyModelSpace As AcadModelSpace
    Set MyModelSpace = ThisDrawing.ModelSpace
    Dim pt(2) As Double
    Dim MyTable As AcadTable
    Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30)
    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddTable()
    ;; This example adds a table in model space
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MyTable (vla-Addtable modelSpace pt 5 5 10 30))
    (vla-ZoomExtents acadObj)
)


AddText Method (ActiveX)

Creates a single line of text.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddText(TextString, InsertionPoint, Height)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

TextString

Access: Input-only

Type: String

The actual text to be displayed.

InsertionPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates on the drawing where the text is placed.

Height

Access: Input-only

Type: Double

The height of the text. Must be a positive number.

Return Value (RetVal)

Type: Text

The newly created Text object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddText()
    ' This example creates a text object in model space.

    Dim textObj As AcadText
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double

    ' Define the text object
    textString = "Hello, World."
    insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 0
    height = 0.5

    ' Create the text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddText()
    ;; This example creates a text object in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the text object
    (setq insertionPoint (vlax-3d-point 2 2 0)
          textString "Hello, World."
          height 0.5)

    ;; Create the text object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq textObj (vla-AddText modelSpace textString insertionPoint height))
    (vla-ZoomAll acadObj)
)


AddTolerance Method (ActiveX)

Creates a tolerance entity.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddTolerance(Text, InsertionPoint, Direction)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Text

Access: Input-only

Type: String

The text string for the tolerance.

InsertionPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates in the drawing specifying the placement of the tolerance symbol.

Direction

Access: Input-only

Type: Variant (three-element array of doubles)

A 3D directional vector specifying the direction of the tolerance symbol.

Return Value (RetVal)

Type: Tolerance

The newly created Tolerance object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddTolerance()
    ' This example creates a tolerance object in model space.

    Dim toleranceObj As AcadTolerance
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim direction(0 To 2) As Double

    ' Define the tolerance object
    textString = "{\Fgdt;r}%%vasdf{\Fgdt;l}%%vdf%%vxc%%v12{\Fgdt;m}%%vsd" & vbCrLf & _
                 "{\Fgdt;t}%%vdfd%%v3dd{\Fgdt;l}%%vv%%v%%vxc{\Fgdt;m}" & vbCrLf & _
                 "123"
    insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0#
    direction(0) = 1#: direction(1) = 1#: direction(2) = 0#

    ' Create the tolerance object in model space
    Set toleranceObj = ThisDrawing.ModelSpace.AddTolerance(textString, insertionPoint, direction)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddTolerance()
    ;; This example creates a tolerance object in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the tolerance object
    (setq insertionPoint (vlax-3d-point 5 5 0)
          direction (vlax-3d-point 1 0 0))

;;"{\Fgdt;r}%%vasdf{\Fgdt;l}%%vdf%%vxc%%v12{\Fgdt;m}%%vsd"

    (setq textString (strcat "{\\Fgdt;r}%%vasdf{\\Fgdt;l}%%vdf%%vxc%%v12{\\Fgdt;m}%%vsd\n"
                             "{\\Fgdt;t}%%vdfd%%v3dd{\\Fgdt;l}%%vv%%v%%vxc{\\Fgdt;m}\n"
                             "123"
                     )
    )

    ;; Create the tolerance object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq toleranceObj (vla-AddTolerance modelSpace textString insertionPoint direction))
    (vla-ZoomAll acadObj)
)


AddToolbarButton Method (ActiveX)

Adds a toolbar item to a toolbar at a specified position.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddToolbarButton(Index, Name, HelpString, Macro [, FlyoutButton])
object

Type: Toolbar

The object this method applies to.

Index

Access: Input-only

Type: Variant

The index location in the toolbar where the item is to be added.

The index must be either an integer or a string. If an integer is specified, the index must be between 0 and N-1, where N is the number of objects in the toolbar. The new item will be added immediately before the specified index location.

Name

Access: Input-only

Type: String

The string that identifies the toolbar button. The string must comprise alphanumeric characters with no punctuation other than a dash (-) or an underscore (_). This string is displayed as the tooltip when the cursor is placed over the toolbar button.

HelpString

Access: Input-only

Type: String

The string that is displayed in the AutoCAD status line for the button.

Macro

Access: Input-only

Type: String

The name of the macro associated with this item.

FlyoutButton

Access: Input-only; optional

Type: Variant

A Boolean variable stating if the new button is to be a flyout button or not. If the button is a flyout button, this parameter must be set to True. If the button is not a flyout button, this parameter can be set to False or ignored and the new ToolbarItem object will be returned.

  • True: The button is a flyout button.
  • False: The button is not a flyout button.

Return Value (RetVal)

Type: ToolbarItem

The newly created toolbar item.

Remarks

You can only add or remove toolbar buttons when the toolbar is visible.

Examples

VBA:

Sub Example_AddToolbarButton()
    ' This example creates a new toolbar called TestToolbar and inserts a
    ' toolbar button into it. The toolbar is then displayed.
    ' To remove the toolbar after execution of this macro, use the Customize Menu
    ' option from the Tools menu.

    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    ' Create the new toolbar
    Dim newToolBar As AcadToolbar
    Set newToolBar = currMenuGroup.Toolbars.Add("TestToolbar")

    ' Add a button to the new toolbar
    Dim newButton As AcadToolbarItem
    Dim openMacro As String

    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set newButton = newToolBar.AddToolbarButton("", "NewButton", "Open a file.", openMacro)

    ' Display the toolbar
    newToolBar.Visible = True

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddToolbarButton()
    ;; This example creates a new toolbar called TestToolbar and inserts a
    ;; toolbar button into it. The toolbar is then displayed.
    ;; To remove the toolbar after execution of this macro, use the Customize Menu
    ;; option from the Tools menu.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new toolbar
    (setq newToolBar (vla-Add (vla-get-Toolbars currMenuGroup) "TestToolbar"))

    ;; Assign the macro string the VB equivalent of "ESC ESC _open "
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))
    (setq newButton (vla-AddToolbarButton newToolBar "" "NewButton" "Open a file." openMacro))

    ;; Display the toolbar
    (vla-put-Visible newToolBar :vlax-true)
)


AddTorus Method (ActiveX)

Creates a torus at the given location.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddTorus(Center, TorusRadius, TubeRadius)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Center

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates in the drawing around which the torus is centered.

TorusRadius

Access: Input-only

Type: Double

The distance from the center of the torus to the center of the tube. Must be a positive number.

TubeRadius

Access: Input-only

Type: Double

The radius of the tube. Must be a positive number.

Return Value (RetVal)

Type: 3DSolid

A 3DSolid object as the newly created torus.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddTorus()
    ' This example creates a torus in model space.

    Dim torusObj As Acad3DSolid
    Dim centerPoint(0 To 2) As Double
    Dim torusRadius As Double
    Dim tubeRadius As Double

    ' Define the torus
    centerPoint(0) = 5: centerPoint(1) = 5: centerPoint(2) = 0
    torusRadius = 15
    tubeRadius = 5

    ' Create the torus
    Set torusObj = ThisDrawing.ModelSpace.AddTorus(centerPoint, torusRadius, tubeRadius)

     ' Change the viewing direction of the viewport
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddTorus()
    ;; This example creates a torus in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the torus
    (setq centerPoint (vlax-3d-point 5 5 0)
          torusRadius 15
          tubeRadius 5)

    ;; Create the torus
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq torusObj (vla-AddTorus modelSpace centerPoint torusRadius tubeRadius))

    ;; Change the viewing direction of the viewport
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)
)


AddTrace Method (ActiveX)

Creates a Trace object from an array of points.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddTrace(PointsArray)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

PointsArray

Access: Input-only

Type: Variant (array of doubles)

An array of 3D WCS coordinates specifying the trace endpoints.

Return Value (RetVal)

Type: Trace

The newly created Trace object.

Remarks

The endpoints of a trace are always on the centerline and are always cut square. AutoCAD automatically calculates the correct bevels for connection to adjacent trace segments.

Traces are solid filled when the Fill mode is on. When Fill mode is off, only the outline of a trace appears.

To set the Fill mode, use the AutoCAD FILLMODE system variable. The AutoCAD TRACEWID system variable stores the current width used for Trace objects.

Examples

VBA:

Sub Example_AddTrace()
    ' This example creates a trace in model space.

    Dim traceObj As AcadTrace
    Dim tracePts(0 To 11) As Double       ' 4 (3D) points

    ' Define the points of the trace
    tracePts(0) = 1: tracePts(1) = 1: tracePts(2) = 0
    tracePts(3) = 3: tracePts(4) = 3: tracePts(5) = 0
    tracePts(6) = 5: tracePts(7) = 3: tracePts(8) = 0
    tracePts(9) = 5: tracePts(10) = 1: tracePts(11) = 0

    ' Turn on the system variable (FILLMODE)
    ' to fill the outline of the trace
    ThisDrawing.SetVariable "FILLMODE", 1

    ' Create the trace object in model space
    Set traceObj = ThisDrawing.ModelSpace.AddTrace(tracePts)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddTrace()
    ;; This example creates a trace in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the points of the trace
    (setq tracePts (vlax-make-safearray vlax-vbDouble '(0 . 11)))
    (vlax-safearray-fill tracePts '(1 1 0
                                    3 3 0
                                    5 3 0
                                    5 1 0
                                   )
    )

    ;; Turn on the system variable (FILLMODE)
    ;; to fill the outline of the trace
    (vla-SetVariable doc "FILLMODE" 1)

    ;; Create the trace object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq traceObj (vla-AddTrace modelSpace tracePts))
    (vla-ZoomAll acadObj)
)


AddVertex Method (ActiveX)

Adds a vertex to a lightweight polyline or a section.

Supported platforms: Windows only

Signature

VBA:

object.AddVertex Index, Point
object

Type: LWPolyline, Section

The objects this method applies to.

Index

Access: Input-only

Type: Long

The index in the array of vertices where the vertex is to be added. Index must be a positive integer. The first element of the array is index 0.

Point

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D OCS coordinates at which to create the new vertex.

Return Value (RetVal)

No return value.

Remarks

LWPolyline: The vertex specifies the endpoint for a new line segment. To add an arc segment to a lightweight polyline, first create the line segment, and then add a "bulge" to the individual segment that is to become an arc. To add a bulge value to a segment, use the SetBulge method.

Section: The vertex specifies a point on the section line.

Coordinates can be converted to and from the OCS using the TranslateCoordinates method.

Examples

VBA:

Sub Example_AddVertex()
    ' This example creates a lightweight polyline in model space.
    ' It then adds a vertex to the polyline.

    Dim plineObj As AcadLWPolyline
    Dim points(0 To 9) As Double

    ' Define the 2D polyline points
    points(0) = 1: points(1) = 1
    points(2) = 1: points(3) = 2
    points(4) = 2: points(5) = 2
    points(6) = 3: points(7) = 2
    points(8) = 4: points(9) = 4

    ' Create a lightweight Polyline object in model space
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    ZoomAll
    MsgBox "Add a vertex to the end of the polyline.", , "AddVertex Example"

    ' Define the new vertex
    Dim newVertex(0 To 1) As Double
    newVertex(0) = 4: newVertex(1) = 1

    ' Add the vertex to the polyline
    plineObj.AddVertex 5, newVertex
    plineObj.Update
    MsgBox "Vertex added.", , "AddVertex Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddVertex()
    ;; This example creates a lightweight polyline in model space.
    ;; It then adds a vertex to the polyline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the 2D polyline points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 9)))
    (vlax-safearray-fill points '(1 1
                                  1 2
                                  2 2
                                  3 2
                                  4 4
                                 )
    )

    ;; Create a lightweight Polyline object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-ZoomAll acadObj)
    (alert "Add a vertex to the end of the polyline.")

    ;; Define the new vertex
    (setq newVertex (vlax-make-safearray vlax-vbDouble '(0 . 1)))
    (vlax-safearray-fill newVertex '(4 1))

    ;; Add the vertex to the polyline
    (vla-AddVertex plineObj 5 newVertex)
    (vla-Update plineObj)
    (alert "Vertex added.")
)


AddWedge Method (ActiveX)

Creates a wedge with edges parallel to the axes given the length, width, and height.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddWedge(Center, Length, Width, Height)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Center

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the center of the wedge face.

Length

Access: Input-only

Type: Double

The length of the wedge corresponding to the X axis. Must be a positive number.

Width

Access: Input-only

Type: Double

The width of the wedge corresponding to the Y axis. Must be a positive number.

Height

Access: Input-only

Type: Double

The height of the wedge corresponding to the Z axis. Must be a positive number.

Return Value (RetVal)

Type: 3DSolid

A 3DSolid object as the newly created wedge.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddWedge()
    ' This example creates a wedge in model space.

    Dim wedgeObj As Acad3DSolid
    Dim center(0 To 2) As Double
    Dim length As Double
    Dim width As Double
    Dim height As Double

    ' Define the wedge
    center(0) = 5#: center(1) = 5#: center(2) = 0
    length = 10#: width = 15#: height = 20#

    ' Create the wedge in model space
    Set wedgeObj = ThisDrawing.ModelSpace.AddWedge(center, length, width, height)

    ' Change the viewing direction of the viewport
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddWedge()
    ;; This example creates a wedge in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the wedge
    (setq wedgeCenter (vlax-3d-point 5 5 0)
          wedgeLength 10
          wedgeWidth 15
          wedgeHeight 20)

    ;; Create the wedge in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq wedgeObj (vla-AddWedge modelSpace wedgeCenter wedgeLength wedgeWidth wedgeHeight))

    ;; Change the viewing direction of the viewport
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)
)


AddXLine Method (ActiveX)

Creates an xline (an infinite line) passing through two specified points.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddXline(Point1, Point2)
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

Point1

Access: Input-only

Type:Variant (three-element array of doubles)

The 3D WCS coordinates specifying the infinite start point of the xline.

Point2

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying a point through which the xline will pass. The xline extends through Point1 and Point2 in both directions to infinity.

Return Value (RetVal)

Type: XLine

The newly created XLine object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddXLine()
    ' This example creates an XLine in model space.

    Dim xlineObj As AcadXline
    Dim basePoint(0 To 2) As Double
    Dim directionVec(0 To 2) As Double

    ' Define the xline
    basePoint(0) = 2#: basePoint(1) = 2#: basePoint(2) = 0#
    directionVec(0) = 1#: directionVec(1) = 1#: directionVec(2) = 0#

    ' Create the xline in model space
    Set xlineObj = ThisDrawing.ModelSpace.AddXline(basePoint, directionVec)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddXLine()
    ;; This example creates an XLine in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the xline
    (setq basePoint (vlax-3d-point 2 2 0)
          directionVec (vlax-3d-point 1 1 0))

    ;; Create the xline in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq xlineObj (vla-AddXline modelSpace basePoint directionVec))
    (vla-ZoomAll acadObj)
)


AddXRecord Method (ActiveX)

Creates an XRecord object in any dictionary.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AddXRecord(Keyword)
object

Type: Dictionary

The object this method applies to.

Keyword

Access: Input-only

Type: String

The name of the XRecord within the dictionary.

Return Value (RetVal)

Type: XRecord

The newly created XRecord object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddXRecord()
    ' This example creates a new XRecord if one does not exist,
    ' appends data to the XRecord, and then reads it back.  To see data being added,
    ' run the example more than once.

    Dim TrackingDictionary As AcadDictionary, TrackingXRecord As AcadXRecord
    Dim XRecordDataType As Variant, XRecordData As Variant
    Dim ArraySize As Long, iCount As Long
    Dim DataType As Integer, Data As String, msg As String

    ' Unique identifiers to distinguish this XRecordData from other XRecordData
    Const TYPE_STRING = 1
    Const TAG_DICTIONARY_NAME = "ObjectTrackerDictionary"
    Const TAG_XRECORD_NAME = "ObjectTrackerXRecord"

    ' Connect to the dictionary in which to store the XRecord
    On Error GoTo CREATE
    Set TrackingDictionary = ThisDrawing.Dictionaries(TAG_DICTIONARY_NAME)
    Set TrackingXRecord = TrackingDictionary.GetObject(TAG_XRECORD_NAME)
    On Error GoTo 0

    ' Get current XRecordData
    TrackingXRecord.GetXRecordData XRecordDataType, XRecordData

    ' If there is no array yet then create one
    If VarType(XRecordDataType) And vbArray = vbArray Then
        ArraySize = UBound(XRecordDataType) + 1       ' Get the size of the data elements returned
        ArraySize = ArraySize + 1                        ' Increase to hold new data

        ReDim Preserve XRecordDataType(0 To ArraySize)
        ReDim Preserve XRecordData(0 To ArraySize)
    Else
        ArraySize = 0
        ReDim XRecordDataType(0 To ArraySize) As Integer
        ReDim XRecordData(0 To ArraySize) As Variant
    End If

    ' Append new XRecord Data
    '
    ' For this sample we only append the current time to the XRecord
    XRecordDataType(ArraySize) = TYPE_STRING: XRecordData(ArraySize) = CStr(Now)
    TrackingXRecord.SetXRecordData XRecordDataType, XRecordData

    ' Read back all XRecordData entries
    TrackingXRecord.GetXRecordData XRecordDataType, XRecordData
    ArraySize = UBound(XRecordDataType)

    ' Retrieve and display stored XRecordData
    For iCount = 0 To ArraySize
        ' Get information for this element
        DataType = XRecordDataType(iCount)
        Data = XRecordData(iCount)

        If DataType = TYPE_STRING Then
            msg = msg & Data & vbCrLf
        End If
    Next

    MsgBox "The data in the XRecord is: " & vbCrLf & vbCrLf & msg, vbInformation

    Exit Sub

CREATE:
    ' Create the objects that hold this XRecordData
    If TrackingDictionary Is Nothing Then  ' Make sure to have tracking object
        Set TrackingDictionary = ThisDrawing.Dictionaries.Add(TAG_DICTIONARY_NAME)
        Set TrackingXRecord = TrackingDictionary.AddXRecord(TAG_XRECORD_NAME)
    End If

    Resume
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddXRecord()
    ;; This example creates a new XRecord if one does not exist,
    ;; appends data to the XRecord, and then reads it back.  To see data being added,
    ;; run the example more than once.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Unique identifiers to distinguish this XRecordData from other XRecordData
    (setq TYPE_STRING 1
          TAG_DICTIONARY_NAME "ObjectTrackerDictionary"
          TAG_XRECORD_NAME "ObjectTrackerXRecord")

    ;; Connect to the dictionary in which to store the XRecord
    (setq dictionaries (vla-get-Dictionaries doc))
    (setq TrackingDictionary (vl-catch-all-apply 'vla-Item (list dictionaries TAG_DICTIONARY_NAME)))

    ;; (= (vl-catch-all-error-message TrackingDictionary) "Automation Error. Key not found")

    (if (= (type TrackingDictionary) 'VLA-OBJECT)
        (setq TrackingXRecord (vla-GetObject TrackingDictionary TAG_XRECORD_NAME))
        (progn
            ;; Create the objects that hold this XRecordData
            (setq TrackingDictionary (vla-Add dictionaries TAG_DICTIONARY_NAME))
            (setq TrackingXRecord  (vla-AddXRecord TrackingDictionary TAG_XRECORD_NAME))
           )
    )

    ;; Get current XRecordData
    (vla-GetXRecordData TrackingXRecord 'temp-XRecordDataType 'temp-XRecordData)

    ;; If there is no array yet then create one
    (setq ArraySize 0)
    (if (/= temp-XRecordDataType nil)
        (progn
               (setq ArraySize (vlax-safearray-get-u-bound temp-XRecordDataType 1))
            (setq XRecordDataType (vlax-make-safearray vlax-vbInteger (cons 0 (1+ ArraySize))))
            (setq XRecordData (vlax-make-safearray vlax-vbVariant (cons 0 (1+ ArraySize))))

            (setq iCount 0)
            (while (>= ArraySize iCount)
                ;; Get information for this element
                (setq DataType (vlax-safearray-get-element temp-XRecordDataType iCount))
                (setq Data (vlax-variant-value (vlax-safearray-get-element temp-XRecordData iCount)))

                (vlax-safearray-put-element XRecordDataType iCount DataType)
                (vlax-safearray-put-element XRecordData iCount Data)

                (setq iCount (1+ iCount))
            )
           )
        (progn
            (setq XRecordDataType (vlax-make-safearray vlax-vbInteger '(0 . 0)))
            (setq XRecordData (vlax-make-safearray vlax-vbVariant '(0 . 0)))
           )
    )

    ;; Append new XRecord Data
    ;;
    ;; For this sample we only append the current time to the XRecord
    (vlax-safearray-put-element XRecordDataType ArraySize TYPE_STRING)
    (setq cdate (rtos (vlax-variant-value (vla-GetVariable doc "CDATE")) 2 6))
    (vlax-safearray-put-element XRecordData ArraySize (strcat (substr cdate 5 2) "/"
                                                              (substr cdate 7 2) "/"
                                                              (substr cdate 1 4) "-"
                                                              (substr cdate 10 2) ":"
                                                              (substr cdate 12 2) ":"
                                                              (substr cdate 14)))
    (vla-SetXRecordData TrackingXRecord XRecordDataType XRecordData)

    ;; Read back all XRecordData entries
    (vla-GetXRecordData TrackingXRecord XRecordDataType XRecordData)
    (setq ArraySize (vlax-safearray-get-u-bound XRecordDataType 1))

    ;; Retrieve and display stored XRecordData
    (setq iCount 0
             msg "")
    (while (>= ArraySize iCount)
        ;; Get information for this element
        (setq DataType (vlax-safearray-get-element XRecordDataType iCount))
        (setq Data (vlax-variant-value (vlax-safearray-get-element XRecordData iCount)))

        (if (= DataType TYPE_STRING)
            (setq msg (strcat msg Data "\n"))
        )

        (setq iCount (1+ iCount))
    )

    (alert (strcat "The data in the XRecord is: \n\n" msg))
)


AngleFromXAxis Method (ActiveX)

Gets the angle of a line from the X axis.

Supported platforms: Windows only

Signature

VBA:

RetVal = AngleFromXAxis(Point1, Point2)
object

Type: Utility

The object this method applies to.

Point1

Access: Input-only

Type: Variant (three-element array of doubles)

The start point of the line.

Point2

Access: Input-only

Type: Variant (three-element array of doubles)

The endpoint of the line.

Return Value (RetVal)

Type: Double

The angle of the line in radians.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AngleFromXAxis()
    ' This example finds the angle, in radians, between the X axis
    ' and a line defined by two points.

    Dim pt1(0 To 2) As Double
    Dim pt2(0 To 2) As Double
    Dim retAngle As Double

    pt1(0) = 2: pt1(1) = 5: pt1(2) = 0
    pt2(0) = 5: pt2(1) = 2: pt2(2) = 0

    ' Return the angle
    retAngle = ThisDrawing.Utility.AngleFromXAxis(pt1, pt2)

    ' Create the line for a visual reference
    Dim lineObj As AcadLine
    Set lineObj = ThisDrawing.ModelSpace.AddLine(pt1, pt2)
    ZoomAll

    ' Display the angle found
    MsgBox "The angle in radians between the X axis and the line is " & retAngle, , "AngleFromXAxis Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AngleFromXAxis()
    ;; This example finds the angle, in radians, between the X axis
    ;; and a line defined by two points.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Return the angle
    (setq pt1 (vlax-3d-point 2 5 0)
          pt2 (vlax-3d-point 5 2 0))
    (setq retAngle (vla-AngleFromXAxis (vla-get-Utility doc) pt1 pt2))

    ;; Create the line for a visual reference
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace pt1 pt2))

    (vla-ZoomAll acadObj)

    ;; Display the angle found
    (alert (strcat "The angle in radians between the X axis and the line is " (rtos retAngle 2)))
)


AngleToReal Method (ActiveX)

Converts an angle as a string to a real (double) value.

Supported platforms: Windows only

Signature

VBA:

RetVal = AngleToReal(Angle, Unit)
object

Type: Utility

The object this method applies to.

Angle

Access: Input-only

Type: String

The angle as a string value.

Unit

Access: Input-only

Type: AcAngleUnits enum

The unit to which the string will be converted.

  • acDegrees
  • acDegreeMinuteSeconds
  • acGrads
  • acRadians

Return Value (RetVal)

Type: Double

The angle as a real number.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AngleToReal()
    ' This example passes several different strings representing
    ' an angle in different units to be converted to radians.

    Dim angAsStr As String
    Dim unit As Integer
    Dim angAsReal As Double

    ' Convert the angle given in degrees unit to a real
    angAsStr = "45"
    unit = acDegrees
    angAsReal = ThisDrawing.Utility.AngleToReal(angAsStr, unit)
    MsgBox "45 degrees converts to " & angAsReal & " radians.", , "AngleAsReal Example"

    ' Convert the angle given in degrees/minutes/seconds unit to Radians
    angAsStr = "45d0' 0"""
    unit = acDegreeMinuteSeconds
    angAsReal = ThisDrawing.Utility.AngleToReal(angAsStr, unit)
    MsgBox "45 degrees, 0 minutes, 0 seconds converts to " & angAsReal & " radians.", , "AngleAsReal Example"

    ' Convert the angle given in grads unit to Radians
    angAsStr = "50"
    unit = acGrads
    angAsReal = ThisDrawing.Utility.AngleToReal(angAsStr, unit)
    MsgBox "50 grads converts to " & angAsReal & " radians.", , "AngleAsReal Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AngleToReal()
    ;; This example passes several different strings representing
    ;; an angle in different units to be converted to radians.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Convert the angle given in degrees unit to a real
    (setq angAsStr "45"
          unit acDegrees
          angAsReal (vla-AngleToReal (vla-get-Utility doc) angAsStr unit))
    (alert (strcat "45 degrees converts to " (rtos angAsReal 2) " radians."))

    ;; Convert the angle given in degrees/minutes/seconds unit to Radians
    (setq angAsStr "45d0' 0\""
          unit acDegreeMinuteSeconds
          angAsReal (vla-AngleToReal (vla-get-Utility doc) angAsStr unit))
    (alert (strcat "45 degrees, 0 minutes, 0 seconds converts to " (rtos angAsReal 2) " radians."))

    ;; Convert the angle given in grads unit to Radians
    (setq angAsStr "50"
          unit acGrads
          angAsReal (vla-AngleToReal (vla-get-Utility doc) angAsStr unit))
    (alert (strcat "50 grads converts to " (rtos angAsReal 2) " radians."))
)


AngleToString Method (ActiveX)

Converts an angle from a real (double) value to a string.

Supported platforms: Windows only

Signature

VBA:

RetVal = AngleToString(Angle, Unit, Precision)
object

Type: Utility

The object this method applies to.

Angle

Access: Input-only

Type: Double

The angle as a double value.

Unit

Access: Input-only

Type: AcAngleUnits enum

The unit to which the string will be converted.

  • acDegrees
  • acDegreeMinuteSeconds
  • acGrads
  • acRadians
Precision

Access: Input-only

Type: Long

The precision of the angle. An integer between 0 and 8.

Return Value (RetVal)

Type: String

The angle as a string.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AngleToString()
    ' This example converts a radian value to several different
    ' strings representing the value in different units.

    Dim angAsRad As Double
    Dim unit As Integer
    Dim precision As Long
    Dim angAsString As String
    angAsRad = 0.785398163397448
    unit = acDegrees
    precision = 6

    ' Convert the radian value to degrees with a precision of 6
    angAsString = ThisDrawing.Utility.AngleToString(angAsRad, unit, precision)
    MsgBox "0.785398163397448 radians =  " & angAsString & " degrees", , "AngleAsString Example"

    ' Convert the radian value to degrees/Minutes/Seconds with a precision of 6
    unit = acDegreeMinuteSeconds
    angAsString = ThisDrawing.Utility.AngleToString(angAsRad, unit, precision)
    MsgBox "0.785398163397448 radians =  " & angAsString, , "AngleAsString Example"

    ' Convert the radian value to grads with a precision of 6
    unit = acGrads
    angAsString = ThisDrawing.Utility.AngleToString(angAsRad, unit, precision)
    MsgBox "0.785398163397448 radians =  " & angAsString, , "AngleAsString Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AngleToString()
    ;; This example converts a radian value to several different
    ;; strings representing the value in different units.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq angAsRad 0.785398163397448
          unit acDegrees
          precision 6)

    ;; Convert the radian value to degrees with a precision of 6
    (setq angAsString (vla-AngleToString (vla-get-Utility doc) angAsRad unit precision))
    (alert (strcat "0.785398163397448 radians =  " angAsString))

    ;; Convert the radian value to degrees/Minutes/Seconds with a precision of 6
    (setq unit acDegreeMinuteSeconds)
    (setq angAsString (vla-AngleToString (vla-get-Utility doc) angAsRad unit precision))
    (alert (strcat "0.785398163397448 radians =  " angAsString))

    ;; Convert the radian value to grads with a precision of 6
    (setq unit acGrads)
    (setq angAsString (vla-AngleToString (vla-get-Utility doc) angAsRad unit precision))
    (alert (strcat "0.785398163397448 radians =  " angAsString))
)


AppendInnerLoop Method (ActiveX)

Appends an inner loop to the hatch.

Supported platforms: Windows only

Signature

VBA:

object.AppendInnerLoop Loop
object

Type: Hatch

The object this method applies to.

Loop

Access: Input-only

Type: Variant (array of Arc, Circle, Ellipse, Line, Polyline, Region, Spline objects)

An array of objects forming a closed boundary. The array can consist of one or more objects. If more than one object is used, their endpoints must coincide for the loop to be created properly.

Return Value (RetVal)

No return value.

Remarks

After the Hatch object has been created using the AddHatch method, add the outer loop using AppendOuterLoop. The outer loop must be closed and must be created before any inner loops can be added.

Examples

VBA:

Sub Example_AppendInnerLoop()
    ' This example creates an associative hatch in model space, and then appends an outer loop to the hatch.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "ANSI31"
    PatternType = 0
    bAssociativity = True

    ' Create the associative Hatch object
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)

    ' Create the outer loop for the hatch.
    ' An arc and a line are used to create a closed loop.

    Dim outerLoop(0 To 1) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    center(0) = 5: center(1) = 3: center(2) = 0
    radius = 3
    startAngle = 0
    endAngle = 3.141592
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddArc(center, radius, startAngle, endAngle)
    Set outerLoop(1) = ThisDrawing.ModelSpace.AddLine(outerLoop(0).startPoint, outerLoop(0).endPoint)

    ' Append the outer loop to the hatch object
    hatchObj.AppendOuterLoop (outerLoop)

    ' Append a circle as the inner loop for the hatch.
    Dim innerLoop(0) As AcadEntity
    center(0) = 5: center(1) = 4.5: center(2) = 0
    radius = 1
    Set innerLoop(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop)

    ' Evaluate and display the hatch
    hatchObj.Evaluate
    ThisDrawing.Regen True

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AppendInnerLoop()
    ;; This example creates an associative hatch in model space, and then appends an outer loop to the hatch.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "ANSI31"
          patternType 0
          bAssociativity :vlax-true)

    ;; Create the associative Hatch object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acHatchObject))

    ;; Create the outer loop for the hatch.
    ;; An arc and a line are used to create a closed loop.
    (setq center (vlax-3d-point 5 3 0)
          radius 3
          startAngle 0
          endAngle 3.141592)

    (setq arc (vla-AddArc modelSpace center radius startAngle endAngle))
    (setq line (vla-AddLine modelSpace (vla-get-StartPoint arc) (vla-get-EndPoint arc)))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element outerLoop 0 arc)
    (vlax-safearray-put-element outerLoop 1 line)

    ;; Append the outer loop to the hatch object
    (vla-AppendOuterLoop hatchObj outerLoop)

    ;; Append a circle as the inner loop for the hatch.
    (setq center (vlax-3d-point 5 4.5 0)
          radius 1)
    (setq circle (vla-AddCircle modelSpace center radius))

    (setq innerLoop (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element innerLoop 0 circle)

    (vla-AppendInnerLoop hatchObj innerLoop)

    ;; Evaluate and display the hatch
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)
)


AppendItems Method (ActiveX)

Appends one or more entities to the specified group.

Supported platforms: Windows only

Signature

VBA:

object.AppendItems Objects
object

Type: Group

The object this method applies to.

Objects

Access: Input-only

Type: Variant (array of any drawing objects)

An array of objects to append. The array can consist of any drawing objects.

Return Value (RetVal)

No return value.

Remarks

To query items in a group, use the Item method.

To remove individual items from a group, use the RemoveItems method.

Examples

VBA:

Sub Example_AppendItems()
    ' This example creates a group and several objects.
    ' It then appends the objects to the group.

    ' Create the new group
    Dim groupObj As AcadGroup
    Set groupObj = ThisDrawing.Groups.Add("TEST_GROUP")

    ' Create a Ray object in model space
    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)

    ' Create a polyline object in model space
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True

    ' Create a line object in model space
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ' Create a circle object in model space
    Dim circObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 20: centerPt(1) = 30: centerPt(2) = 0
    radius = 3
    Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)

    ' Create an ellipse object in model space
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    ZoomAll

    ' Iterate through the model space collection.
    ' Collect the objects found into an array of objects
    ' to be added to the group.
    ReDim appendObjs(0 To ThisDrawing.ModelSpace.count - 1) As AcadEntity
    Dim I As Integer
    For I = 0 To ThisDrawing.ModelSpace.count - 1
        Set appendObjs(I) = ThisDrawing.ModelSpace.Item(I)
    Next

    ' Add the array of objects to the group
    groupObj.AppendItems appendObjs

    ThisDrawing.Regen acActiveViewport

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AppendItems()
    ;; This example creates a group and several objects.
    ;; It then appends the objects to the group.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the new group
    (setq groupObj (vla-Add (vla-get-Groups doc) "TEST_GROUP"))

    ;; Create a Ray object in model space
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 1 3 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq rayObj (vla-AddRay modelSpace basePoint SecondPoint))

    ;; Create a polyline object in model space
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
                                  9 2
                                  3 5
                                 )
    )

    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)

    ;; Create a line object in model space
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 2 2 0))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    ;; Create a circle object in model space
    (setq centerPt (vlax-3d-point 20 30 0)
          radius 3)
    (setq circObj (vla-AddCircle modelSpace centerPt radius))

    ;; Create an ellipse object in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

    (vla-ZoomAll acadObj)

    ;; Iterate through the model space collection.
    ;; Collect the objects found into an array of objects
    ;; to be added to the group.
    (setq I 0
             totalObjs (vla-get-Count modelSpace))
    (setq appendObjs (vlax-make-safearray vlax-vbObject (cons 0 (- totalObjs 1))))
    (while (>= (- totalObjs 1) I)
        (vlax-safearray-put-element appendObjs I (vla-Item modelSpace I))
        (setq I (1+ I))
    )

    ;; Add the array of objects to the group
    (vla-AppendItems groupObj appendObjs)

    (vla-Regen doc acActiveViewport)
)


AppendOuterLoop Method (ActiveX)

Appends an outer loop to the hatch.

Supported platforms: Windows only

Signature

VBA:

object.AppendOuterLoop loop
object

Type: Hatch

The object this method applies to.

Loop

Access: Input-only

Type: Variant (array of Arc, Circle, Ellipse, Line, Polyline, Region, Spline objects)

An array of objects forming a closed boundary. The array can consist of one or more objects. If more than one object is used, their endpoints must coincide for the loop to be created properly.

Return Value (RetVal)

No return value.

Remarks

After the Hatch object has been created using the AddHatch method, add the outer loop. The outer loop must be closed and must be created before any inner loops can be added. After a valid outer loop has been created, add any inner loops, one at a time, using the AppendInnerLoop method.

Once you have finished defining the boundaries for the hatch, use the Evaluate method to calculate the hatch lines or fill for the boundaries, then use the Regen method to update the display of the hatch.

Examples

VBA:

Sub Example_AppendOuterLoop()
    ' This example creates an associative hatch in model space, and then creates an outer loop for the hatch.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "ANSI31"
    PatternType = 0
    bAssociativity = True

    ' Create the associative Hatch object
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)

    ' Create the outer loop for the hatch.
    ' An arc and a line are used to create a closed loop.
    Dim outerLoop(0 To 1) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    center(0) = 5: center(1) = 3: center(2) = 0
    radius = 1
    startAngle = 0
    endAngle = 3.141592
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddArc(center, radius, startAngle, endAngle)
    Set outerLoop(1) = ThisDrawing.ModelSpace.AddLine(outerLoop(0).startPoint, outerLoop(0).endPoint)

    ' Append the outer loop to the hatch object, and display the hatch
    hatchObj.AppendOuterLoop (outerLoop)
    hatchObj.Evaluate
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AppendOuterLoop()
    ;; This example creates an associative hatch in model space, and
    ;; then creates an outer loop for the hatch.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "ANSI31"
          patternType 0
          bAssociativity :vlax-true)

    ;; Create the associative Hatch object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acHatchObject))

    ;; Create the outer loop for the hatch.
    ;; An arc and a line are used to create a closed loop.
    (setq center (vlax-3d-point 5 3 0)
          radius 3
          startAngle 0
          endAngle 3.141592)

    (setq arc (vla-AddArc modelSpace center radius startAngle endAngle))
    (setq line (vla-AddLine modelSpace (vla-get-StartPoint arc) (vla-get-EndPoint arc)))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element outerLoop 0 arc)
    (vlax-safearray-put-element outerLoop 1 line)

    ;; Append the outer loop to the hatch object, and display the hatch
    (vla-AppendOuterLoop hatchObj outerLoop)
    (vla-Evaluate hatchObj)
    (vla-ZoomAll acadObj)
)


AppendVertex Method (ActiveX)

Appends a vertex to the end of a 3DPolyline, Polyline, or PolygonMesh object.

Supported platforms: Windows only

Signature

VBA:

object.AppendVertex Point
object

Type: 3DPolyline, PolygonMesh, Polyline

The objects this method applies to.

Point

Access: Input-only

Type: Variant (three-element array of doubles)

The coordinates specifying the vertex to be appended.

PolygonMesh: An array of 3D WCS coordinates specifying the appended row of vertices.

3DPolyline: An array of 3D WCS coordinates specifying the vertex to append.

Polyline: An array of 3D coordinates. The X and Y coordinates are given in OCS, the Z coordinate is ignored.

Return Value (RetVal)

No return value.

Remarks

PolygonMesh: When you append a vertex to the end of a PolygonMesh object, you are appending a row of vertices. For example, for a 4 x 3 PolygonMesh you define 12 vertices. Appending a vertex would make the matrix 5 x 3, thereby requiring three additional coordinates. If the 4 x 3 matrix had the following as its last vertex:

  • vertex(3,0): 6,6,6
  • vertex(3,1): 7,7,7
  • vertex(3,2): 8,8,8

You would append:

  • vertex(4,0): 10,10,10
  • vertex(4,1): 10,5,0
  • vertex(4,2): 10,20,30

The OCS coordinates for the Polyline object can be converted to and from other coordinate systems using the TranslateCoordinates method.

Examples

VBA:

Sub Example_AppendVertex()
    ' This example creates a polyline in model space.
    ' It then appends a vertex to the polyline.

    Dim plineObj As AcadPolyline
    Dim points(0 To 14) As Double

    ' Define the 2D polyline points
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 1: points(4) = 2: points(5) = 0
    points(6) = 2: points(7) = 2: points(8) = 0
    points(9) = 3: points(10) = 2: points(11) = 0
    points(12) = 4: points(13) = 4: points(14) = 0

    ' Create a lightweight Polyline object in model space
    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
    ZoomAll
    MsgBox "Append the vertex 4, 1, 0.", , "AppendVertex Example"

    Dim newVertex(0 To 2) As Double
    newVertex(0) = 4: newVertex(1) = 1: newVertex(2) = 0
    plineObj.AppendVertex newVertex
    ZoomAll
    MsgBox "The vertex 4, 1, 0 as been appended.", , "AppendVertex Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AppendVertex()
    ;; This example creates a polyline in model space.
    ;; It then appends a vertex to the polyline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the 2D polyline points
    (setq center (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill center '(1 1 0
                                  1 2 0
                                  2 2 0
                                  3 2 0
                                  4 4 0
                                 )
    )

    ;; Create a lightweight Polyline object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddPolyline modelSpace points))
    (vla-ZoomAll acadObj)
    (alert "Append the vertex 4, 1, 0.")

    (setq newVertex (vlax-3d-point 4 1 0))
    (vla-AppendVertex plineObj newVertex)
    (vla-ZoomAll acadObj)
    (alert "The vertex 4, 1, 0 as been appended.")
)


ArrayPolar Method (ActiveX)

Creates a polar array of objects given a NumberOfObjects, AngleToFill, and CenterPoint.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.ArrayPolar(NumberOfObjects, AngleToFill, CenterPoint)
object

Type: All drawing objects

The objects this method applies to.

NumberOfObjects

Access: Input-only

Type: Long

The number of objects to be created in the polar array. This must be a positive integer greater than 1.

AngleToFill

Access: Input-only

Type: Double

The angle to fill in radians. A positive value specifies counterclockwise rotation. A negative value specifies clockwise rotation. An error is returned for an angle that equals 0.

CenterPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the center point for the polar array.

Return Value (RetVal)

Type: Variant (array of objects)

The array of new objects.

Remarks

AutoCAD determines the distance from the array's center point to a reference point on the last object selected. The reference point used depends on the type of object previously selected. AutoCAD uses the center point of a circle or arc, the insertion point of a block or shape, the start point of text, and one endpoint of a line or trace.

Note that this method does not support the Rotate While Copying option of the AutoCAD ARRAY command.

Polar array with NumberOfObjects = 5, AngleToFill = 180, CenterPoint = 0,0,0.

NoteYou cannot execute this method while simultaneously iterating through a collection. An iteration will open the work space for a read-only operation, while this method attempts to perform a read-write operation. Complete any iteration before you call this method.

AttributeReference: You should not attempt to use this method on AttributeReference objects. AttributeReference objects inherit this method because they are one of the drawing objects, however, it is not feasible to perform this operation on an attribute reference.

Examples

VBA:

Sub Example_ArrayPolar()
    ' This example creates a circle and then performs a polar array
    ' on that circle.

    ' Create the circle
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 2#: center(1) = 2#: center(2) = 0#
    radius = 1
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, radius)
    ZoomAll
    MsgBox "Perform the polar array on the circle.", , "ArrayPolar Example"

    ' Define the polar array
    Dim noOfObjects As Integer
    Dim angleToFill As Double
    Dim basePnt(0 To 2) As Double
    noOfObjects = 4
    angleToFill = 3.14          ' 180 degrees
    basePnt(0) = 4#: basePnt(1) = 4#: basePnt(2) = 0#

    ' The following example will create 4 copies of an object
    ' by rotating and copying it about the point (3,3,0).
    Dim retObj As Variant
    retObj = circleObj.ArrayPolar(noOfObjects, angleToFill, basePnt)

    ZoomAll
    MsgBox "Polar array completed.", , "ArrayPolar Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ArrayPolar()
    ;; This example creates a circle and then performs a polar array
    ;; on that circle.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the circle
    (setq center (vlax-3d-point 2 2 0)
          radius 1)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace center radius))
    (vla-ZoomAll acadObj)

    (alert "Perform the polar array on the circle.")

    ;; Define the polar array
    (setq basePnt (vlax-3d-point 3 3 0)
          noOfObjects 4
          angleToFill 3.14)          ;; 180 degrees

    ;; The following example will create 4 copies of an object
    ;; by rotating and copying it about the point (3,3,0).
    (setq retObj (vla-ArrayPolar circleObj noOfObjects angleToFill basePnt))

    (vla-ZoomAll acadObj)
    (alert "Polar array completed.")
)


ArrayRectangular Method (ActiveX)

Creates a 2D or 3D rectangular array of objects.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.ArrayRectangular(NumberOfRows, NumberOfColumns, NumberOfLevels, DistBetweenRows, DistBetweenColumns, DistBetweenLevels)
object

Type: All drawing objects

The objects this method applies to.

NumberOfRows

Access: Input-only

Type: Long

The number of rows in the rectangular array. This must be a positive number. If this number is 1, then NumberOfColumns must be greater than 1.

NumberOfColumns

Access: Input-only

Type: Long

The number of columns in the rectangular array. This must be a positive number. If this number is 1, then NumberOfRows must be greater than 1.

NumberOfLevels

Access: Input-only

Type: Long

The number of levels in a 3D array.

DistBetweenRows

Access: Input-only

Type: Double

The distance between the rows. If the distance between rows is a positive number, rows are added upward from the base entity. If the distance is a negative number, rows are added downward.

DistBetweenColumns

Access: Input-only

Type: Double

The distance between the columns. If the distance between columns is a positive number, columns are added to the right of the base entity. If the distance is a negative number, columns are added to the left.

DistBetweenLevels

Access: Input-only

Type: Double

The distance between the array levels. If the distance between levels is a positive number, levels are added in the positive direction from the base entity. If the distance is a negative number, levels are added in the negative direction.

Return Value (RetVal)

Type: Variant (array of objects)

The array of newly created objects.

Remarks

For a 2D array, specify the NumberOfRows, NumberOfColumns, DistBetweenRow, and DistBetweenColumns. For creating a 3D array, specify the NumberOfLevels and DistBetweenLevels as well.

A rectangular array is constructed by replicating the object in the selection set the appropriate number of times. If you define one row, you must specify more than one column and vice versa.

The object in the selection set is assumed to be in the lower left-hand corner, and the array is generated up and to the right. If the distance between rows is a negative number, rows are added downward. If the distance between columns is a negative number, the columns are added to the left.

AutoCAD builds the rectangular array along a baseline defined by the current snap rotation angle. This angle is zero by default, so the rows and columns of a rectangular array are orthogonal with respect to the X and Y drawing axes. You can change this angle and create a rotated array by setting the snap rotation angle to a nonzero value. To do this, use the SnapRotationAngle property.

Rectangular array with NumberOfRows = 4, NumberOfColumns = 3, DistBetweenRows = a, DistBetweenColumns = b. The base entity is represented in blue.

NoteYou cannot execute this method while simultaneously iterating through a collection. An iteration will open the work space for a read-only operation, while this method attempts to perform a read-write operation. Complete any iteration before you call this method.

AttributeReference: You should not attempt to use this method on AttributeReference objects. AttributeReference objects inherit this method because they are one of the drawing objects, however, it is not feasible to perform this operation on an attribute reference.

Examples

VBA:

Sub Example_ArrayRectangular()
    ' This example creates a circle and then performs
    ' a rectangular array on that circle.

    ' Create the circle
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 2#: center(1) = 2#: center(2) = 0#
    radius = 0.5
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, radius)
    ThisDrawing.Application.ZoomAll
    MsgBox "Perform the rectangular array on the circle.", , "ArrayRectangular Example"

    ' Define the rectangular array
    Dim numberOfRows As Long
    Dim numberOfColumns As Long
    Dim numberOfLevels As Long
    Dim distanceBwtnRows As Double
    Dim distanceBwtnColumns As Double
    Dim distanceBwtnLevels As Double
    numberOfRows = 5
    numberOfColumns = 5
    numberOfLevels = 2
    distanceBwtnRows = 1
    distanceBwtnColumns = 1
    distanceBwtnLevels = 1

    ' Create the array of objects
    Dim retObj As Variant
    retObj = circleObj.ArrayRectangular(numberOfRows, numberOfColumns, numberOfLevels, distanceBwtnRows, distanceBwtnColumns, distanceBwtnLevels)

    ZoomAll
    MsgBox "Rectangular array completed.", , "ArrayRectangular Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ArrayRectangular()
    ;; This example creates a circle and then performs
    ;; a rectangular array on that circle.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the circle
    (setq center (vlax-3d-point 2 2 0)
          radius 0.5)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace center radius))
    (vla-ZoomAll acadObj)

    (alert "Perform the rectangular array on the circle.")

    ;; Define the rectangular array
    (setq numberOfRows 5
          numberOfColumns 5
          numberOfLevels 2
          distanceBwtnRows 1.0
          distanceBwtnColumns 1.0
          distanceBwtnLevels 1.0)

    ;; Create the array of objects
    (setq retObj (vla-ArrayRectangular circleObj numberOfRows numberOfColumns numberOfLevels
                                         distanceBwtnRows distanceBwtnColumns distanceBwtnLevels))

    (vla-ZoomAll acadObj)
    (alert "Rectangular array completed.")
)


AttachExternalReference Method (ActiveX)

Attaches an external reference (xref) to the drawing.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.AttachExternalReference(PathName, Name, InsertionPoint, XScale, YScale, ZScale, Rotation, Overlay [, Password])
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

PathName

Access: Input-only

Type: String

The full path and file name of the drawing to be referenced.

Name

Access: Input-only

Type: String

The name for the xref to be created.

InsertionPoint

Access: Input-only

Type: Variant (three-element array of Doubles)

The 3D WCS coordinates specifying the point at which an ExternalReference instance is inserted into the drawing. The insertion point in the current drawing is aligned with the point defined by the AutoCAD BASE system variable in the referenced file.

XScale

Access: Input-only

Type: Double

The X scaling factor for the xref instance.

YScale

Access: Input-only

Type: Double

The Y scaling factor for the xref instance.

ZScale

Access: Input-only

Type: Double

The Z scaling factor for the xref instance.

Rotation

Access: Input-only

Type: Double

The rotation angle for the xref instance. This angle is specified in radians.

Overlay

Access: Input-only

Type: Boolean

  • True: The xref instance is an overlay.
  • False: The xref instance is an attachment.
Password

Access: Input-only; optional

Type: Variant

; optional

Return Value (RetVal)

Type: ExternalReference

The newly created ExternalReference object.

Remarks

Like Block objects, attached ExternalReference objects can be nested. If another person is editing the drawing to be referenced, the drawing attached is based on the most recently saved version.

If the referenced file is missing or corrupt, its data is not displayed in the current drawing.

Examples

VBA:

Sub Example_AttachExternalReference()
    ' This example displays all the blocks in the current drawing
    ' before and after adding an external reference.
    '
    ' This example uses the "city map.dwg" found in the Sample
    ' directory. If you do not have this drawing, or if it is
    ' in a different directory, insert a valid path and file name
    ' for the PathName variable below.

    Dim InsertPoint(0 To 2) As Double
    Dim insertedBlock As AcadExternalReference
    Dim tempBlock As AcadBlock
    Dim msg As String, PathName As String

    ' Define external reference to be inserted
    InsertPoint(0) = 1: InsertPoint(1) = 1: InsertPoint(2) = 0
    PathName = "c:\program files\autocad\sample\city map.dwg"

    ' Display current Block information for this drawing
    GoSub ListBlocks

    ' Add the external reference to the drawing
    Set insertedBlock = ThisDrawing.ModelSpace.AttachExternalReference(PathName, "XREF_IMAGE", InsertPoint, 1, 1, 1, 0, False)

    ThisDrawing.Application.ZoomAll

    ' Display new Block information for this drawing
    GoSub ListBlocks

    Exit Sub

ListBlocks:
    msg = vbCrLf    ' Reset message

    For Each tempBlock In ThisDrawing.Blocks
        msg = msg & tempBlock.name & vbCrLf     ' Add Block to list
    Next

    MsgBox "The current blocks in this drawing are: " & msg

    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AttachExternalReference()
    ;; This example displays all the blocks in the current drawing
    ;; before and after adding an external reference.
    ;;
    ;; This example uses the "STAIR1.dwg" found in the Sample
    ;; directory. If you do not have this drawing, or if it is
    ;; in a different directory, insert a valid path and file name
    ;; for the PathName variable below.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define external reference to be inserted
    (setq InsertPoint (vlax-3d-point 1 1 0))
    (setq pathName (findfile ".\\Sample\\Sheet Sets\\Architectural\\Res\\STAIR1.dwg"))

    ;; Display current Block information for this drawing
    (setq msg "")
    (vlax-for tempBlock (vla-get-Blocks doc)
        (setq msg (strcat msg (vla-get-Name tempBlock) "\n"))     ;; Add Block to list
    )

    (alert (strcat "The current blocks in this drawing are: " msg))

    ;; Add the external reference to the drawing
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq insertedBlock (vla-AttachExternalReference modelSpace pathName "XREF_IMAGE" InsertPoint 1 1 1 0 :vlax-false))

    (vla-ZoomAll acadObj)

    ;; Display new Block information for this drawing
    (setq msg "")
    (vlax-for tempBlock (vla-get-Blocks doc)
        (setq msg (strcat msg (vla-get-Name tempBlock) "\n"))     ;; Add Block to list
    )

    (alert (strcat "The current blocks in this drawing are: " msg))
)


AttachToolbarToFlyout Method (ActiveX)

Attaches a toolbar to a toolbar button defined as a flyout.

Supported platforms: Windows only

Signature

VBA:

object.AttachToolbarToFlyout MenuGroupName, ToolbarName
object

Type: ToolbarItem

The object this method applies to.

MenuGroupName

Access: Input-only

Type: String

The name of the menu group containing the toolbar you want to attach.

ToolbarName

Access: Input-only

Type: String

The name of the toolbar you want to attach.

Return Value (RetVal)

No return value.

Remarks

To create a new button as a flyout, use the AddToolBarButton method and set the FlyoutButton parameter to True. Once a button has been created as a flyout button, you can then use the AttachToolbarToFlyout method to attach a flyout toolbar to that button.

To query a toolbar button to see if it is a flyout button, use the Type property. To find the toolbar attached to a flyout toolbar button, use the Flyout property.

Examples

VBA:

Sub Example_AttachToolbarToFlyout()
    ' This example uses MenuGroups to obtain a reference to the AutoCAD main menu.
    ' It then creates a new Toolbar(TestMenu) with a Toolbar button that will act
    ' as a flyout.  It then sets the Flyout menu to an existing Toolbar menu.
    ' The Toolbar will automatically be displayed and will display the UCS menu
    ' as a flyout.

    Dim currMenuGroup As acadMenuGroup
    Dim newToolBar As AcadToolbar, newToolBarFlyoutButton As AcadToolbarItem

    On Error GoTo ERRORTRAP

    ' Use MenuGroups property to obtain reference to main AutoCAD menu
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item("ACAD")

    ' Create a new Toolbar in this group
    Set newToolBar = currMenuGroup.Toolbars.Add("TestMenu")

    ' Add new button to TestMenu that will link to the Flyout menu
    '
    ' * NOTE: Set the macro name to the name of the flyout toolbar because
    ' setting it to an empty string causes an error.  The paremeter
    ' is actually ignored when the style is flyout, but must have any value other than "".
    Set newToolBarFlyoutButton = newToolBar.AddToolbarButton(newToolBar.count + 1, "Flyout", "Flyout", "UCS", True)

    ' Link the existing toolbar "UCS" as the flyout for the new toolbar button
    '
    ' * NOTE: To change the flyout, simply change the MenuGroup and Toolbar name below
    newToolBarFlyoutButton.AttachToolbarToFlyout "ACAD", "UCS"

    MsgBox "A new Toolbar with a flyout has been added to the AutoCAD menu system!"

    Exit Sub

ERRORTRAP:
    MsgBox "The following error has occurred: " & Err.Description
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AttachToolbarToFlyout()
    ;; This example uses MenuGroups to obtain a reference to the AutoCAD main menu.
    ;; It then creates a new Toolbar(TestMenu) with a Toolbar button that will act
    ;; as a flyout.  It then sets the Flyout menu to an existing Toolbar menu.
    ;; The Toolbar will automatically be displayed and will display the UCS menu
    ;; as a flyout.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create a new Toolbar in this group
    (setq newToolBar (vla-Add (vla-get-Toolbars currMenuGroup) "TestMenu"))

    ;; Add new button to TestMenu that will link to the Flyout menu
    ;;
    ;; * NOTE: Set the macro name to the name of the flyout toolbar because
    ;; setting it to an empty string causes an error.  The paremeter
    ;; is actually ignored when the style is flyout, but must have any value other than "".
    (setq newToolBarFlyoutButton (vla-AddToolbarButton newToolBar (1+ (vla-get-Count newToolBar)) "Flyout" "Flyout" "UCS" :vlax-true))

    ;; Link the existing toolbar "UCS" as the flyout for the new toolbar button
    ;;
    ;; * NOTE: To change the flyout, simply change the MenuGroup and Toolbar name below
    (vla-AttachToolbarToFlyout newToolBarFlyoutButton "ACAD" "UCS")

    (alert "A new Toolbar with a flyout has been added to the AutoCAD menu system!")
)


AuditInfo Method (ActiveX)

Evaluates the integrity of the drawing.

Supported platforms: Windows only

Signature

VBA:

object.AuditInfo FixError
object

Type: Document

The object this method applies to.

FixError

Access: Input-only

Type: Boolean

  • True: AutoCAD should attempt to fix any problems it encounters.
  • False: AutoCAD should not attempt to fix any problems it encounters.

Return Value (RetVal)

No return value.

Remarks

For every error detected, AutoCAD provides a description of the error and recommends corrective action.

If you specify FixError = True, AutoCAD will attempt to fix any errors it encounters.

Examples

VBA:

Sub Example_AuditInfo()
    ' This example has AutoCAD audit
    ' and fix any problems found

    ThisDrawing.AuditInfo True

    MsgBox "Auditing has been requested." & vbCrLf & _
           "The fix error flag is set to True", , "AuditInfo Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AuditInfo()
    ;; This example has AutoCAD audit
    ;; and fix any problems found
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (vla-AuditInfo doc :vlax-true)

    (alert (strcat "Auditing has been requested."
                   "\nThe fix error flag is set to True."))
)


Bind Method (ActiveX)

Binds an external reference (xref) to a drawing.

Supported platforms: Windows only

Signature

VBA:

object.Bind bPrefixName
object

Type: Block

The object this method applies to.

bPrefixName

Access: Input-only

Type: Boolean

  • True: Symbol names are not prefixed.
  • False: Symbol names are prefixed with <blockname>$x$.

Return Value (RetVal)

No return value.

Remarks

Binding an xref to a drawing makes the xref a permanent part of the drawing and no longer an externally referenced file. The externally referenced information becomes a block. When the externally referenced drawing is updated, the bound xref is not updated. This method binds the entire drawing's database, including all of its dependent symbols. Dependent symbols are named objects such as blocks, dimension styles, layers, linetypes, and text styles. Binding the xref allows named objects from the xref to be used in the current drawing.

If the bPrefixName parameter is set to False, the symbol names of the xref drawing are prefixed in the current drawing with <blockname>$x$, where x is an integer that is automatically incremented to avoid overriding existing block definitions. If the bPrefixName parameter is set to True, the symbol names of the xref drawing are merged into the current drawing without the prefix. If duplicate names exist, AutoCAD uses the symbols already defined in the local drawing. If you are unsure whether your drawing contains duplicate symbol names, it is recommended that you set bPrefixName to False.

Examples

VBA:

Sub Example_Bind()
    On Error GoTo ERRORHANDLER

    ' Define external reference to be inserted
    Dim xrefHome As AcadBlock
    Dim xrefInserted As AcadExternalReference
    Dim insertionPnt(0 To 2) As Double
    Dim PathName As String
    insertionPnt(0) = 1
    insertionPnt(1) = 1
    insertionPnt(2) = 0
    PathName = "c:/AutoCAD/sample/City map.dwg"

    ' Add the external reference
    Set xrefInserted = ThisDrawing.ModelSpace. _
            AttachExternalReference(PathName, "XREF_IMAGE", _
            insertionPnt, 1, 1, 1, 0, False)
    ZoomAll
    MsgBox "The external reference is attached."

    ' Bind the external reference definition
    ThisDrawing.Blocks.Item(xrefInserted.name).Bind False
    MsgBox "The external reference is bound."
    Exit Sub
ERRORHANDLER:
    MsgBox Err.Description
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Bind()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define external reference to be inserted
    (setq insertionPnt (vlax-3d-point 1 1 0)
          pathName (findfile ".\\Sample\\Sheet Sets\\Architectural\\Res\\STAIR1.dwg"))

    ;; Add the external reference
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq xrefInserted (vla-AttachExternalReference modelSpace pathName "XREF_IMAGE" insertionPnt 1 1 1 0 :vlax-false))
    (vla-ZoomAll acadObj)
    (alert "The external reference is attached.")

    ;; Bind the external reference definition
    (vla-Bind (vla-Item (vla-get-Blocks doc) (vla-get-Name xrefInserted)) :vlax-false)
    (alert "The external reference is bound.")
)


Block Method (ActiveX)

Returns the block of a SortentsTable object.

Signature

VBA:

RetVal = object.Block
object

Type: SortentsTable

The object this method applies to.

Return Value (RetVal)

Type: Block

The Block of the object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SortentsTable()
    ' This example creates a SortentsTable object and
    ' changes the draw order.

    ' Set drawing to display lineweights and create a True Color object
    Dim ACADPref As AcadDatabasePreferences
    Set ACADPref = ThisDrawing.preferences
    ACADPref.LineWeightDisplay = True
    Dim MyColorObjOne As AcadAcCmColor
    Set MyColorObjOne = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Call MyColorObjOne.SetRGB(80, 100, 244)

    ' Draw a polyline
    Dim plineObj As AcadPolyline
    Dim points(0 To 8) As Double
    points(0) = 4: points(1) = 4: points(2) = 0
    points(3) = 3: points(4) = 5: points(5) = 0
    points(6) = 6: points(7) = 20: points(8) = 0
    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
    plineObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(90, 110, 150)
    plineObj.TrueColor = MyColorObjOne

    ' Draw a line
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 5: startPoint(1) = 13: startPoint(2) = 0
    endPoint(0) = 5: endPoint(1) = 27: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    lineObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(50, 80, 230)
    lineObj.TrueColor = MyColorObjOne

    ' Draw a circle
    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    centerPoint(0) = 10: centerPoint(1) = 15: centerPoint(2) = 0#
    radius = 5#
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)
    circleObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(60, 200, 220)
    circleObj.TrueColor = MyColorObjOne
    ZoomAll
    AcadApplication.Update

    ' Get an extension dictionary and, if necessary, add a SortentsTable object
    Dim eDictionary As Object
    Set eDictionary = ThisDrawing.ModelSpace.GetExtensionDictionary
    ' Prevent failed GetObject calls from throwing an exception
    On Error Resume Next
    Dim sentityObj As Object
    Set sentityObj = eDictionary.GetObject("ACAD_SORTENTS")
    On Error GoTo 0
    If sentityObj Is Nothing Then
         ' No SortentsTable object, so add one
         Set sentityObj = eDictionary.AddObject("ACAD_SORTENTS", "AcDbSortentsTable")
    End If

    Dim ObjIds(2) As Long
    ObjIds(0) = plineObj.ObjectID
    ObjIds(1) = lineObj.ObjectID
    ObjIds(2) = circleObj.ObjectID

    Dim varObject As AcadObject
    Set varObject = ThisDrawing.ObjectIdToObject(ObjIds(2))
    Dim arr(0) As AcadObject
    Set arr(0) = varObject

    ' Move the circle object to the bottom
    sentityObj.MoveToBottom arr
    AcadApplication.Update

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SortentsTable()
    ;; This example creates a SortentsTable object and
    ;; changes the draw order.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Set drawing to display lineweights and create a True Color object
    (vla-put-LineWeightDisplay (vla-get-Preferences doc) :vlax-true)
    (setq MyColorObjOne (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB MyColorObjOne 80 100 244)

    ;; Draw a polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill points '(4 4 0
                                  3 5 0
                  6 20 0
                 )
    )

    (setq plineObj (vla-AddPolyline modelSpace points))

    (vla-put-Lineweight plineObj acLnWt211)
    (vla-SetRGB MyColorObjOne 90 110 150)
    (vla-put-TrueColor plineObj MyColorObjOne)

    ;; Draw a line
    (setq startPoint (vlax-3d-point 5 13 0)
          endPoint (vlax-3d-point 5 27 0))

    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-put-Lineweight lineObj acLnWt211)
    (vla-SetRGB MyColorObjOne 50 80 230)
    (vla-put-TrueColor lineObj MyColorObjOne)

    ;; Draw a circle
    (setq centerPoint (vlax-3d-point 10 15 0)
          radius 5)

    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))
    (vla-put-Lineweight circleObj acLnWt211)
    (vla-SetRGB MyColorObjOne 60 200 220)
    (vla-put-TrueColor circleObj MyColorObjOne)

    (vla-ZoomAll acadObj)
    (vla-Update acadObj)

    ;; Get an extension dictionary and, if necessary, add a SortentsTable object
    (setq eDictionary (vla-GetExtensionDictionary modelSpace))

    ;; Prevent failed GetObject calls from throwing an exception
    (setq sentityObj (vl-catch-all-apply 'vla-GetObject (list eDictionary "ACAD_SORTENTS")))

    (if (= (type sentityObj)'VL-CATCH-ALL-APPLY-ERROR)
         ;; No SortentsTable object, so add one
         (setq sentityObj (vla-AddObject eDictionary "ACAD_SORTENTS" "AcDbSortentsTable"))
    )

    (setq ObjIds (vlax-make-safearray vlax-vbLong '(0 . 2)))
    (vlax-safearray-put-element ObjIds 0 (vla-get-ObjectID plineObj))
    (vlax-safearray-put-element ObjIds 1 (vla-get-ObjectID lineObj))
    (vlax-safearray-put-element ObjIds 2 (vla-get-ObjectID circleObj))

    (setq varObject circleObj)
    (setq arr (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element arr 0 varObject)

    ;; Move the circle object to the bottom
    (vla-MoveToBottom sentityObj arr)
    (vla-Update acadObj)

    (vlax-release-object MyColorObjOne)
)


Boolean Method (ActiveX)

Performs a Boolean operation (union, intersect, or subtract) between the object and another 3DSolid or Region object.

Supported platforms: Windows only

Signature

VBA:

object.Boolean(Operation, Object)
object

Type: 3DSolid, Region

The objects this method applies to.

Operation

Access: Input-only

Type: AcBooleanType enum

  • acUnion: Performs a union operation.
  • acIntersection: Performs an intersection operation.
  • acSubtraction: Performs a subtraction operation.
Object

Access: input-only

Type: 3DSolid, Region

The object the operation is performed against.

Return Value (RetVal)

No return value.

Remarks

The first object is modified as a result of the operation.

Solids before Boolean intersection

Resulting solid from Boolean intersection

NoteIf there is no result from the operation, the first object is not changed. For example, when finding the intersection between two non-intersecting objects, there is no change to the first object.

Examples

VBA:

Sub Example_Boolean()
    ' This example creates a box and a cylinder in model space.
    ' It then performs a Boolean operation on the two solids.

    Dim boxObj As Acad3DSolid
    Dim boxLength As Double, boxWidth As Double, boxHeight As Double
    Dim boxCenter(0 To 2) As Double
    boxCenter(0) = 5#: boxCenter(1) = 5#: boxCenter(2) = 0
    boxLength = 10#: boxWidth = 7: boxHeight = 10#

    ' Create the box (3DSolid) object in model space
    Set boxObj = ThisDrawing.ModelSpace.AddBox(boxCenter, boxLength, boxWidth, boxHeight)

    ' Define the cylinder
    Dim cylinderObj As Acad3DSolid
    Dim cylinderCenter(0 To 2) As Double
    Dim cylinderRadius As Double
    Dim cylinderHeight As Double
    cylinderCenter(0) = 0#: cylinderCenter(1) = 0#: cylinderCenter(2) = 0#
    cylinderRadius = 5#
    cylinderHeight = 20#

    ' Create the Cylinder (3DSolid) object in model space
    Set cylinderObj = ThisDrawing.ModelSpace.AddCylinder(cylinderCenter, cylinderRadius, cylinderHeight)

    ' Change the viewing direction of the viewport
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

    ' Perform an intersection on the two solids
    MsgBox "Perform an intersection on the two solids.", vbOKOnly, "Boolean Example"
    boxObj.Boolean acIntersection, cylinderObj
    ThisDrawing.Regen True

    MsgBox "Intersection complete.", , "Boolean Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Boolean()
    ;; This example creates a box and a cylinder in model space.
    ;; It then performs a Boolean operation on the two solids.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq boxCenter (vlax-3d-point 5 5 0)
          boxLength 10
             boxWidth 7
             boxHeight 10)

    ;; Create the box (3DSolid) object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq boxObj (vla-AddBox modelSpace boxCenter boxLength boxWidth boxHeight))

    ;; Define the cylinder
    (setq cylinderCenter (vlax-3d-point 0 0 0)
          cylinderRadius 5
          cylinderHeight 20)

    ;; Create the Cylinder (3DSolid) object in model space
    (setq cylinderObj (vla-AddCylinder modelSpace cylinderCenter cylinderRadius cylinderHeight))

    ;; Change the viewing direction of the viewport
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)

    ;; Perform an intersection on the two solids
    (alert "Perform an intersection on the two solids.")
    (vla-Boolean boxObj acIntersection cylinderObj)
    (vla-Regen doc :vlax-true)

    (alert "Intersection complete.")
)


CheckInterference Method (ActiveX)

Checks for interference between two solids and, if specified, creates a solid from the interference.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.CheckInterference(Object, CreateInterferenceSolid, SolidsInterfere)
object

Type: 3DSolid

The object this method applies to.

Object

Access: input-only

Type: 3DSolid

The object to check against.

CreateInterferenceSolid

Access: input-only

Type: Boolean

  • True: Creates the interference solid.
  • False: Does not create the interference solid.
SolidsInterfere

Access: output-only

Type: Boolean

  • True: The solids do interfere.
  • False: The solids do not interfere.

Return Value (RetVal)

Type: 3DSolid

The resulting object if CreateInterferenceSolid is set to True.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CheckInterference()
    ' This example creates a box and a cylinder in model space.
    ' It then finds the interference between the two solids and
    ' creates a new solid from that interference.

    ' For ease of viewing, different colors are used for the box, the
    ' cylinder, and the interference solid.

    Dim color As AcadAcCmColor
    Set color = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")

    Dim boxObj As Acad3DSolid
    Dim boxLength As Double, boxWidth As Double, boxHeight As Double
    Dim boxCenter(0 To 2) As Double
    boxCenter(0) = 5#: boxCenter(1) = 5#: boxCenter(2) = 0
    boxLength = 10#: boxWidth = 7: boxHeight = 10#

    ' Create the box (3DSolid) object in model space
    Set boxObj = ThisDrawing.ModelSpace.AddBox(boxCenter, boxLength, boxWidth, boxHeight)
    Call color.SetRGB(80, 100, 244)
    boxObj.TrueColor = color

    ' Define the cylinder
    Dim cylinderObj As Acad3DSolid
    Dim cylinderCenter(0 To 2) As Double
    Dim cylinderRadius As Double
    Dim cylinderHeight As Double
    cylinderCenter(0) = 0#: cylinderCenter(1) = 0#: cylinderCenter(2) = 0#
    cylinderRadius = 5#
    cylinderHeight = 20#

    ' Create the Cylinder (3DSolid) object in model space
    Set cylinderObj = ThisDrawing.ModelSpace.AddCylinder(cylinderCenter, cylinderRadius, cylinderHeight)
    Call color.SetRGB(244, 150, 50)
    cylinderObj.TrueColor = color

    ' Find the interference between the two solids and create a new solid from it
    Dim solidObj As Acad3DSolid
    Dim bSolidsInterfere As Boolean
    Set solidObj = boxObj.CheckInterference(cylinderObj, True, bSolidsInterfere)
    Call color.SetRGB(200, 150, 244)
    solidObj.TrueColor = color

    ' Change the viewing direction of the viewport
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

    ' You can now delete the box and cylinder in AutoCAD to
    ' see the interference solid more clearly.

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CheckInterference()
    ;; This example creates a box and a cylinder in model space.
    ;; It then finds the interference between the two solids and
    ;; creates a new solid from that interference.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; For ease of viewing, different colors are used for the box, the
    ;; cylinder, and the interference solid.
    (setq color (vlax-create-object "AutoCAD.AcCmColor.20"))

    (setq boxCenter (vlax-3d-point 5 5 0)
          boxLength 10
             boxWidth 7
             boxHeight 10)

    ;; Create the box (3DSolid) object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq boxObj (vla-AddBox modelSpace boxCenter boxLength boxWidth boxHeight))

    (vla-SetRGB color 80 100 244)
    (vla-put-TrueColor boxObj color)

    ;; Define the cylinder
    (setq cylinderCenter (vlax-3d-point 0 0 0)
          cylinderRadius 5
             cylinderHeight 20)

    ;; Create the Cylinder (3DSolid) object in model space
    (setq cylinderObj (vla-AddCylinder modelSpace cylinderCenter cylinderRadius cylinderHeight))
    (vla-SetRGB color 244 150 50)
    (vla-put-TrueColor cylinderObj color)

    ;; Find the interference between the two solids and create a new solid from it
    (setq solidObj (vla-CheckInterference boxObj cylinderObj :vlax-true :vlax-true))
    (vla-SetRGB color 200 150 244)
    (vla-put-TrueColor solidObj color)

    ;; Change the viewing direction of the viewport
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)

    ;; You can now delete the box and cylinder in AutoCAD to
    ;; see the interference solid more clearly.
    (vlax-release-object color)
)


Clear Method (ActiveX)

Clears the specified selection set of all items.

Supported platforms: Windows only

Signature

VBA:

object.Clear
object

Type: SelectionSet

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

Items cleared from a selection set remain in the drawing; they are simply no longer associated to the selection set.

To clear a subset of the items in a selection set, use the RemoveItems method.

This method differs from the Delete method in that it does not remove objects from the drawing.

Examples

VBA:

Sub Example_Clear()
    ' This example creates a selection set and several objects.
    ' It then adds the objects to the selection set. It then
    ' clears the objects from the selection set.

    ' Create the new selection set
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_SELECTIONSET")

    ' Create a Ray object in model space
    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)

    ' Create a polyline object in model space
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True

    ' Create a line object in model space
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ' Create a circle object in model space
    Dim circObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 20: centerPt(1) = 30: centerPt(2) = 0
    radius = 3
    Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)

    ' Create an ellipse object in model space
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    ZoomAll

    ' Iterate through the model space collection.
    ' Collect the objects found into an array of objects
    ' to be added to the selection set.
    ReDim ssobjs(0 To ThisDrawing.ModelSpace.count - 1) As AcadEntity
    Dim I As Integer
    For I = 0 To ThisDrawing.ModelSpace.count - 1
        Set ssobjs(I) = ThisDrawing.ModelSpace.Item(I)
    Next

    ' Add the array of objects to the selection set
    ssetObj.AddItems ssobjs
    GoSub LISTOBJS

    ' Clear the selection set
    ssetObj.Clear

    ThisDrawing.Regen acActiveViewport
    GoSub LISTOBJS
Exit Sub
LISTOBJS:

        ' List all the objects in the selection set
        If ssetObj.count = 0 Then
            MsgBox "The selection set is empty"
        Else
            For I = 0 To ssetObj.count - 1
                MsgBox "The selection set contains: " & ssetObj.Item(I).ObjectName
            Next
        End If
        Return

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Clear()
    ;; This example creates a selection set and several objects.
    ;; It then adds the objects to the selection set. It then
    ;; clears the objects from the selection set.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Create the new selection set
    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_SELECTIONSET"))

    ;; Create a Ray object in model space
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 1 3 0))
    (setq rayObj (vla-AddRay modelSpace basePoint SecondPoint))

    ;; Create a polyline object in model space
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
                                              9 2
                                              3 5
                                             )
    )

    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)

    ;; Create a line object in model space
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 2 2 0))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    ;; Create a circle object in model space
    (setq centerPt (vlax-3d-point 20 30 0)
          radius 3)
    (setq circObj (vla-AddCircle modelSpace centerPt radius))

    ;; Create an ellipse object in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

    (vla-ZoomAll acadObj)

    ;; Iterate through the model space collection.
    ;; Collect the objects found into an array of objects
    ;; to be added to the selection set.
    (setq ssobjs (vlax-make-safearray vlax-vbObject (cons 0 (- (vla-get-Count modelSpace) 1))))
    (setq I 0)
    (while (>= (- (vla-get-Count modelSpace) 1) I)
        (vlax-safearray-put-element ssobjs I (vla-Item modelSpace I))
        (setq I (1+ I))
    )

    ;; Add the array of objects to the selection set
    (vla-AddItems ssetObj ssobjs)

    ;; List all the objects in the selection set
    (if (> (vla-get-Count ssetObj) 0)
        (progn
        (setq msg (strcat "The selection set contains " (itoa (vla-get-Count ssetObj)) " objects of types: "))
            (vlax-for obj ssetObj
                (setq msg (strcat msg "\n" (vla-get-ObjectName obj)))
            )
            (alert msg)
        )
    )

    ;; Clear the selection set
    (vla-Clear ssetObj)

    (vla-Regen doc acActiveViewport)

    ;; List all the objects in the selection set
    (if (= (vla-get-Count ssetObj) 0)
        (alert "The selection set is empty.")
    )
)


ClearSubSelection Method (ActiveX)

Removes a subselection set of cells from a table.

Supported platforms: Windows only

Signature

VBA:

object.ClearSubSelection
object

Type: Table

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ClearTableStyleOverrides Method (ActiveX)

Clears table style overrides.

Supported platforms: Windows only

Signature

VBA:

object.ClearTableStyleOverrides flag
object

Type: Table

The object this method applies to.

flag

Access: Input-only

Type: Long; one of three integer values

  • 0: Deletes all table and cell overrides.
  • 1: Deletes all table overrides, but retains cell overrides.
  • 2: Deletes all cell overrides, but retains table overrides.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ClipBoundary Method (ActiveX)

Specifies the clipping boundary for a raster image or an underlay.

Supported platforms: Windows only

Signature

VBA:

object.ClipBoundary PointsArray
object

Type: DgnUnderlay, DwfUnderlay, PdfUnderlay, RasterImage, Wipeout

The objects this method applies to.

PointsArray

Access: Input-only

Type: Variant (array of two-element array of doubles)

An array of 2D WCS coordinates specifying the clipping boundary of a raster image or underlay.

Return Value (RetVal)

No return value.

Remarks

You can define a region of an image or underlay object for display and plotting by clipping the object. Multiple instances of the same object can have different boundaries.

The clipping boundary must be a closed 2D polygon or rectangle with vertices constrained to lie within the boundaries of the image or underlay.

To clip an image or underlay, the object's boundary must be visible. Use the ClippingEnabled property to turn the clipping boundary on or off.

Examples

VBA:

Sub Example_ClipBoundary()
    ' This example adds a raster image in model space.
    ' It then clips the image based on a clip boundary.

    ' This example uses the "2d Projected Polylines.jpg" found in the Sample
    ' directory. If you do not have the image, or if it is located
    ' in a different directory, insert a valid path and name for the
    ' imageName variable below.

    Dim insertionPoint(0 To 2) As Double
    Dim scalefactor As Double
    Dim rotationAngle As Double
    Dim imageName As String
    Dim rasterObj As AcadRasterImage

    imageName = "C:\AutoCAD\sample\2d Projected Polylines.jpg"
    insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0#
    scalefactor = 2#
    rotationAngle = 0

    On Error Resume Next
    ' Creates a raster image in model space
    Set rasterObj = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotationAngle)

    If Err.Description = "Filer error" Then
        MsgBox imageName & " could not be found."
        Exit Sub
    End If

    ZoomAll
    MsgBox "Clip the image?", , "ClipBoundary Example"

    ' Establish the clip boundary with an array of points
    Dim clipPoints(0 To 9) As Double
    clipPoints(0) = 6: clipPoints(1) = 6.75
    clipPoints(2) = 7: clipPoints(3) = 6
    clipPoints(4) = 6: clipPoints(5) = 5
    clipPoints(6) = 5: clipPoints(7) = 6
    clipPoints(8) = 6: clipPoints(9) = 6.75

    ' Clip the image
    rasterObj.clipBoundary clipPoints

    ' Enable the display of the clip
    rasterObj.ClippingEnabled = True
    ThisDrawing.Regen acActiveViewport
    MsgBox "The image has been clipped.", , "ClipBoundary Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ClipBoundary()
    ;; This example adds a raster image in model space.
    ;; It then clips the image based on a clip boundary.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; This example uses the "2d Projected Polylines.jpg" found in the Sample
    ;; directory. If you do not have the image, or if it is located
    ;; in a different directory, insert a valid path and name for the
    ;; imageName variable below.
    (setq insertionPoint (vlax-3d-point 5 5 0)
          imageName ".\\Sample\\VBA\\2d Projected Polylines.jpg"
          scalefactor 2
          rotationAngle 0)

    (if (/= (findfile ".\\Sample\\VBA\\2d Projected Polylines.jpg") nil)
        (progn
        ;; Creates a raster image in model space
            (setq modelSpace (vla-get-ModelSpace doc))
            (setq rasterObj (vla-AddRaster modelSpace (findfile ".\\Sample\\VBA\\2d Projected Polylines.jpg") insertionPoint scalefactor rotationAngle))

        (vla-ZoomAll acadObj)
        (alert "Clip the image?")

        ;; Establish the clip boundary with an array of points
        (setq clipPoints (vlax-make-safearray vlax-vbDouble '(0 . 9)))
        (vlax-safearray-fill clipPoints '(6 6.75
                                                      7 6
                                                      6 5
                                                      5 6
                                                      6 6.75
                                                     )
        )

        ;; Clip the image
        (vla-ClipBoundary rasterObj clipPoints)

        ;; Enable the display of the clip
        (vla-put-ClippingEnabled rasterObj :vlax-true)
        (vla-Regen doc acActiveViewport)
        (alert "The image has been clipped.")
        )
        (alert (strcat imageName " could not be found."))
    )
)


Close Method (ActiveX)

Closes the specified drawing, or all open drawings.

Supported platforms: Windows only

Signature

VBA:

object.Close [SaveChanges] [, FileName]
object

Type: Document, Documents

The objects this method applies to.

SaveChanges

Access: Input-only; optional

Type: Variant

Specifies if the drawing is to be saved or not. (Not applicable when called from Documents collection.)

  • True: Save the drawing.
  • False: Do not save the drawing.
FileName

Access: Input-only; optional

Type: String

The name to assign to the drawing. If no name is provided when saving a drawing for the first time, the drawing will be saved using the VBA project information: ThisDrawing.Path\ThisDrawing.Name. (Not applicable when called from Documents collection.)

Return Value (RetVal)

No return value.

Remarks

If there are no changes to the drawing, SaveChanges and FileName are ignored. If there are changes to the drawing, SaveChanges specifies whether changes should be saved. The default value for the SaveChanges parameter is True.

  • If SaveChanges is True and there is not yet a file name associated with a drawing, then the FileName argument is used. If FileName is omitted, or if calling this method from the Documents collection, an error will be issued.
  • If SaveChanges is False, then the drawing is closed and the changes are not saved.

Calling this method from the Documents collection in MDI mode will close all open drawings. To close a single drawing, call this method from the drawing to be closed.

You cannot close a drawing from inside an event handler for that drawing.

NoteClosing a drawing destroys the Document object. Never try to reference an object once it has been destroyed, or in this case, closed. In-process clients (VBA macros) may notice that objects are not destroyed until the subroutine is exited. However, references to destroyed objects are not recommended at all, even in the in-process code.

Examples

VBA:

Sub Example_Close()
    ' This example cycles through the documents collection
    ' and closes all open drawings using the Close method.

    Dim DOC As AcadDocument

    ' If there are no open documents, then exit
    If Documents.count = 0 Then
        MsgBox "There are no open documents!"
        Exit Sub
    End If

    ' Close all open documents
    For Each DOC In Documents
        If MsgBox("Do you wish to close the document: " & DOC.WindowTitle, vbYesNo & vbQuestion) = vbYes Then
            If DOC.FullName <> "" Then
                DOC.Close
            Else
                MsgBox DOC.name & " has not been saved yet, so it will not be closed."
            End If
        End If
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Close()
    ;; This example cycles through the documents collection
    ;; and closes all open drawings using the Close method
    ;; except the current drawing.
    (setq acadObj (vlax-get-acad-object))
    (setq curDoc (vla-get-ActiveDocument acadObj))
    (setq docs (vla-get-Documents acadObj))

    ;; Close all open documents and discard changes, except for the current drawing
    (vlax-for doc docs
        (if (/= (vla-get-Name doc) (vla-get-Name curDoc))
        (progn
            (alert (strcat "Closing " (vla-get-Name doc) " file."))
                (vla-Close doc :vlax-false)
        )
        )
    )
)


ConvertToAnonymousBlock Method (ActiveX)

Converts a dynamic block to a regular anonymous block.

Supported platforms: Windows only

Signature

VBA:

object.ConvertToAnonymousBlock
object

Type: BlockReference, MInsertBlock

The objects this method applies to.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ConvertToStaticBlock Method (ActiveX)

Converts a dynamic block to a regular named block.

Supported platforms: Windows only

Signature

VBA:

object.ConvertToStaticBlock newBlockName
object

Type: BlockReference, MInsertBlock

The objects this method applies to.

newBlockName

Access: Input-only

Type: String

The name for the block.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Copy Method (ActiveX)

Duplicates the given object to the same location.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.Copy
object

Type: All drawing objects, AttributeReference, Dimension

The objects this method applies to.

Return Value (RetVal)

Type: All drawing objects, AttributeReference, Dimension

The newly created duplicate object.

Remarks

AttributeReference: You should not attempt to use this method on AttributeReference objects. AttributeReference objects inherit this method because they are one of the drawing objects, however, it is not feasible to perform this operation on an attribute reference.

NoteYou cannot execute this method while simultaneously iterating through a collection. An iteration will open the work space for a read-only operation, while this method attempts to perform a read-write operation. Complete any iteration before you call this method.

Examples

VBA:

Sub Example_Copy()
    ' This example creates a circle and then copies
    ' that circle. The new circle is then moved.

    ' Create the circle
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 2#: center(1) = 2#: center(2) = 0#
    radius = 0.5
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, radius)
    ZoomAll
    MsgBox "Copy the circle.", , "Copy Example"

    ' Copy the circle
    Dim copyCircleObj As AcadCircle
    Set copyCircleObj = circleObj.Copy()

    ' Define the points that make up the move vector
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    point1(0) = 0: point1(1) = 0: point1(2) = 0
    point2(0) = 2: point2(1) = 0: point2(2) = 0

    MsgBox "Move the copied circle 2 units in the X direction.", , "Copy Example"

    ' Move the circle and color it
    copyCircleObj.Move point1, point2

    ZoomAll
    MsgBox "Move completed.", , "Copy Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Copy()
    ;; This example creates a circle and then copies
    ;; that circle. The new circle is then moved.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the circle
    (setq center (vlax-3d-point 2 2 0)
          radius 0.5)
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace center radius))
    (vla-ZoomAll acadObj)
    (alert "Copy the circle.")

    ;; Copy the circle
    (setq copyCircleObj (vla-Copy circleObj))

    ;; Define the points that make up the move vector
    (setq point1 (vlax-3d-point 0 0 0)
          point2 (vlax-3d-point 2 0 0))

    (alert "Move the copied circle 2 units in the X direction.")

    ;; Move the circle and color it
    (vla-Move copyCircleObj point1 point2)

    (vla-ZoomAll acadObj)
    (alert "Move completed.")
)


CopyFrom Method (ActiveX)

Copies the settings for a dimension style, layout, or plot configuration.

Supported platforms: Windows only

Signature

VBA:

object.CopyFrom SourceObject
object

Type: DimStyle, Layout, PlotConfiguration

The objects this method applies to.

SourceObject

Access: Input-only

Type: DimStyle, Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated, Document, Layout, Leader, PlotConfiguration

The source object to be copied.

Layout and PlotConfiguration: The source object must be a PlotConfiguration object.

DimStyle: The source object must be either a DimStyle, Document, Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated, or Leader.

Return Value (RetVal)

No return value.

Remarks

DimStyle: This method allows users to copy dimension style data into an existing dimension style from three different types of sources.

  1. If SourceObject is a dimension (this includes all dimension objects), Tolerance, or Leader object, this method copies the style for that object plus any object overrides.
  2. If SourceObject is a DimStyle object, this method copies the style data from that dimension style.
  3. If SourceObject is a Document object, this method copies the active dimension style settings for the drawing plus any drawing overrides.

Examples

VBA:

Sub Example_CopyFrom()
    ' This example will create two new plot configurations, NewPC1 and NewPC2, and will use
    ' the CopyFrom method to duplicate the settings in the first plot configuration
    ' to the second plot configuration.

    Dim PlotConfigurations As AcadPlotConfigurations
    Dim PlotConfiguration As AcadPlotConfiguration
    Dim NewPC1 As AcadPlotConfiguration, NewPC2 As AcadPlotConfiguration

    ' Get PlotConfigurations collection from document object
    Set PlotConfigurations = ThisDrawing.PlotConfigurations

    ' Add NewPC1 and customize some of the properties
    Set NewPC1 = PlotConfigurations.Add("NEW_CONFIGURATION1")
    NewPC1.PlotRotation = ac270degrees
    NewPC1.PlotHidden = True
    NewPC1.PaperUnits = acMillimeters

    ' Add NewPC2 and leave default values intact
    Set NewPC2 = PlotConfigurations.Add("NEW_CONFIGURATION2")

    ' Show NewPC2 settings before we copy information from NewPC1
    GoSub VIEWPC2SETTINGS

    ' Copy setting information from NewPC1 to NewPC2
    NewPC2.CopyFrom NewPC1
    NewPC2.name = "NEW_CONFIGURATION2"

    ' Show NewPC2 settings after we copy information from NewPC1
    GoSub VIEWPC2SETTINGS

    Exit Sub

VIEWPC2SETTINGS:
    MsgBox "The settings for NEW_CONFIGURATION2 are: " & vbCrLf & _
           "Plot Rotation: " & NewPC2.PlotRotation & vbCrLf & _
           "Plot Hidden: " & NewPC2.PlotHidden & vbCrLf & _
           "Paper Units: " & NewPC2.PaperUnits

    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CopyFrom()
    ;; This example will create two new plot configurations, NewPC1 and NewPC2, and will use
    ;; the CopyFrom method to duplicate the settings in the first plot configuration
    ;; to the second plot configuration.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get PlotConfigurations collection from document object
    (setq PlotConfigurations (vla-get-PlotConfigurations doc))

    ;; Add NewPC1 and customize some of the properties
    (setq NewPC1 (vla-Add PlotConfigurations "NEW_CONFIGURATION1"))
    (vla-put-PlotRotation NewPC1 ac270degrees)
    (vla-put-PlotHidden NewPC1 :vlax-true)
    (vla-put-PaperUnits NewPC1 acMillimeters)

    ;; Add NewPC2 and leave default values intact
    (setq NewPC2 (vla-Add PlotConfigurations "NEW_CONFIGURATION2"))

    ;; Show NewPC2 settings before we copy information from NewPC1
    (alert (strcat "The settings for NEW_CONFIGURATION2 are: "
                   "\nPlot Rotation: " (itoa (vla-get-PlotRotation NewPC2))
                   "\nPlot Hidden: " (if (= (vla-get-PlotHidden NewPC2) :vlax-true) "True" "False")
                   "\nPaper Units: " (itoa (vla-get-PaperUnits NewPC2))
              )
    )

    ;; Copy setting information from NewPC1 to NewPC2
    (vla-CopyFrom NewPC2 NewPC1)
    (vla-put-Name NewPC2 "NEW_CONFIGURATION2")

    ;; Show NewPC2 settings after we copy information from NewPC1
    (alert (strcat "The settings for NEW_CONFIGURATION2 are: "
                   "\nPlot Rotation: " (itoa (vla-get-PlotRotation NewPC2))
                   "\nPlot Hidden: " (if (= (vla-get-PlotHidden NewPC2) :vlax-true) "True" "False")
                   "\nPaper Units: " (itoa (vla-get-PaperUnits NewPC2))
              )
    )
)


CopyObjects Method (ActiveX)

Duplicates multiple objects (deep cloning).

Supported platforms: Windows only

Signature

VBA:

RetVal = object.CopyObjects(Objects [, Owner] [, IDPairs])
object

Type: Database, Document

The objects this method applies to.

Objects

Access: Input-only

Type: Variant (array of Objects)

The array of primary objects to be copied. All the objects must have the same owner, and the owner must belong to the database or document that is calling this method.

Owner

Access: Input-only; optional

Type: Variant (a single object)

The new owner for the copied objects. If no owner is specified, the objects will be created with the same owner as the objects in the Objects array.

IDPairs

Access: Input-output; optional

Type: Variant (array of IDPair objects)

Information on what happened during the copy and translation process.

  • Input: an empty variant.
  • Output: an array of IDPair objects.

Return Value (RetVal)

Type: Variant (array of objects)

An array of newly created duplicate objects. Only primary objects are returned in this array. For more information on what occurred during the CopyObjects operation, or a list of objects owned by primary objects that were also copied, consult the IDPairs parameter.

Remarks

To copy objects to another open drawing, set the Owner parameter to the other drawing's model space.

During the CopyObjects operation, objects that are owned or referenced by the primary objects in the Objects parameter will also be copied.

NoteYou cannot execute this method while simultaneously iterating through a collection. An iteration will open the work space for a read-only operation, while this method attempts to perform a read-write operation. Complete any iteration before you call this method.

Examples

VBA:

Sub Example_CopyObjects()
    ' This example creates a Circle object and uses the CopyObjects
    ' method to make a copy of the new Circle.

    Dim DOC1 As AcadDocument
    Dim circleObj1 As AcadCircle, circleObj2 As AcadCircle
    Dim circleObj1Copy As AcadCircle, circleObj2Copy As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius1 As Double, radius2 As Double
    Dim radius1Copy As Double, radius2Copy As Double
    Dim objCollection(0 To 1) As Object
    Dim retObjects As Variant

    ' Define the Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    radius1 = 5#: radius2 = 7#
    radius1Copy = 1#: radius2Copy = 2#

    ' Create a new drawing
    Set DOC1 = Documents.Add

    ' Add two circles to the drawing
    Set circleObj1 = DOC1.ModelSpace.AddCircle(centerPoint, radius1)
    Set circleObj2 = DOC1.ModelSpace.AddCircle(centerPoint, radius2)
    ThisDrawing.Application.ZoomAll

    ' Copy objects
    '
    ' First put the objects to be copied into a form compatible with CopyObjects
    Set objCollection(0) = circleObj1
    Set objCollection(1) = circleObj2

    ' Copy object and get back a collection of the new objects (copies)
    retObjects = DOC1.CopyObjects(objCollection)

    ' Get newly created object and apply new properties to the copies
    Set circleObj1Copy = retObjects(0)
    Set circleObj2Copy = retObjects(1)

    circleObj1Copy.radius = radius1Copy
    circleObj2Copy.radius = radius2Copy

    ThisDrawing.Application.ZoomAll

    MsgBox "Circles copied."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CopyObjects()
    ;; This example creates a Circle object and uses the CopyObjects
    ;; method to make a copy of the new Circle.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Load the ObjectDBX library
    (if (= acLibImport nil)
           (progn
               (vlax-import-type-library :tlb-filename "C:\\Program Files\\Common Files\\Autodesk Shared\\axdb19enu.tlb"
                                         :methods-prefix "acdbm-"
                                         :properties-prefix "acdbp-"
                                         :constants-prefix "acdbc-"
               )
            (setq acLibImport T)
        )
    )

    ;; Create a reference to the ObjectDBX object
    (setq acdbObj (vlax-create-object "ObjectDBX.AxDbDocument.20"))

    ;; Open an external drawing file
    (acdbm-open acdbObj (findfile ".\\Sample\\VBA\\Tower.dwg"))

    ;; Add two circles to the drawing
    (setq objCollection (vlax-make-safearray vlax-vbObject (cons 0 (- (vla-get-Count (vla-get-ModelSpace acdbObj)) 1)))
      count 0)

    ;; Copy objects
    (vlax-for eachObj (vla-get-ModelSpace acdbObj)
        (vlax-safearray-put-element objCollection count eachObj)
        (setq count (1+ count))
    )

    ;; Copy object and get back a collection of the new objects (copies)
    (setq retObjects (vla-CopyObjects acdbObj objCollection (vla-get-ModelSpace (vla-get-Database doc))))

    (vla-ZoomAll acadObj)

    (alert "Model space objects copied.")

    ;; Close the in memory drawing
    (vlax-release-object acdbObj)
)


CopyProfile Method (ActiveX)

Copies the specified profile.

Supported platforms: Windows only

Signature

VBA:

object.CopyProfile oldProfileName, newProfileName
object

Type: PreferencesProfiles

The object this method applies to.

oldProfileName

Access: Input-only

Type: String

The name of the profile to copy.

newProfileName

Access: Input-only

Type: String

The name of the new profile to be created.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CopyProfile()
    ' This example copies an existing profile.
    ' You can see the new profile under Options/Profiles
    '
    ' *Note: This example relies on the default profile "<<Unnamed Profile>>".
    ' If this profile has already been renamed or removed, be sure to change the
    ' name of the SourceProfile to one that currently exists.

    Dim ACADPref As AcadPreferencesProfiles
    Dim SourceProfile As String, DestinationProfile As String

    ' Use the PreferencesProfiles object
    Set ACADPref = ThisDrawing.Application.Preferences.Profiles

    ' Copy the default profile
    On Error GoTo ERRORTRAP

    SourceProfile = "<<Unnamed Profile>>"
    DestinationProfile = "NEW_PROFILE"

    ACADPref.CopyProfile SourceProfile, DestinationProfile

    MsgBox "We have just copied the existing profile " & SourceProfile & " to " & DestinationProfile

    Exit Sub

ERRORTRAP:
    If Err.Description <> "" Then
        MsgBox "The default profile '" & SourceProfile & "' cannot be found, please use a different source profile."
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CopyProfile()
    ;; This example copies an existing profile.
    ;; You can see the new profile under Options/Profiles
    ;;
    ;; *Note: This example relies on the default profile "<<Unnamed Profile>>".
    ;; If this profile has already been renamed or removed, be sure to change the
    ;; name of the SourceProfile to one that currently exists.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Use the PreferencesProfiles object
    (setq ACADPref (vla-get-Profiles preferences))

    (setq SourceProfile "<<Unnamed Profile>>"
          DestinationProfile "NEW_PROFILE")

    (vla-CopyProfile ACADPref SourceProfile DestinationProfile)

    (alert (strcat "We have just copied the existing profile " SourceProfile " to " DestinationProfile))
)


CreateCellStyle Method (ActiveX)

Creates a cell style with the given name.

Supported platforms: Windows only

Signature

VBA:

object.CreateCellStyle StringCellStyle
object

Type: TableStyle

The object this method applies to.

StringCellStyle

Access: Input-only

Type: String

New cell style name.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellStyle()
    ' This example creates a TableStyle object and sets values for
    ' the style name and formatting.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As IAcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.CreateCellStyle ("NewTestStyle")
    Dim cellTestFormat As String

    customObj.SetFormat2 "NewTestStyle", "test format"
    customObj.GetFormat2 "NewTestStyle", cellTestFormat

    MsgBox "Cell Style Name = " & cellTestFormat

    customObj.RenameCellStyle "NewTestStyle", "NewTestStyle2"
    customObj.GetFormat2 "NewTestStyle2", cellTestFormat

    MsgBox "Cell Style Name = " & cellTestFormat

    Dim uniqueStyleName As String

    uniqueStyleName = customObj.GetUniqueCellStyleName("testbase")

    MsgBox "Cell Style Name = " & uniqueStyleName

    If customObj.GetIsCellStyleInUse("testbase") = False Then
        MsgBox "That cell style is not being used!"
    End If

    customObj.CreateCellStyleFromStyle "TestStyleFromStyle", "NewTestStyle2"

    customObj.DeleteCellStyle "NewTestStyle2"

    Dim numOfStyles As Long
    numOfStyles = customObj.NumCellStyles
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellStyle()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and formatting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-CreateCellStyle customObj "NewTestStyle")

    (setq cellTestFormat "")
    (vla-SetFormat2 customObj "NewTestStyle" "test format")
    (vla-GetFormat2 customObj "NewTestStyle" 'cellTestFormat)

    (alert (strcat "Cell Style Name = " cellTestFormat))

    (vla-RenameCellStyle customObj "NewTestStyle" "NewTestStyle2")
    (vla-GetFormat2 customObj "NewTestStyle2" 'cellTestFormat)

    (alert (strcat "Cell Style Name = " cellTestFormat))

    (setq uniqueStyleName (vla-GetUniqueCellStyleName customObj "testbase"))

    (alert (strcat "Cell Style Name = " uniqueStyleName))

    (if (= (vla-GetIsCellStyleInUse customObj "testbase") :vlax-false)
        (alert "That cell style is not being used!")
    )

    (vla-CreateCellStyleFromStyle customObj "TestStyleFromStyle" "NewTestStyle2")

    (vla-DeleteCellStyle customObj "NewTestStyle2")

    (setq numOfStyles (vla-get-NumCellStyles customObj))
    (alert (strcat "Number of Cell Styles = " (itoa numOfStyles)))
)


CreateCellStyleFromStyle Method (ActiveX)

Creates a cell style from a given name.

Supported platforms: Windows only

Signature

VBA:

object.CreateCellStyleFromStyle StringCellStyle, StringSourceCellStyle
object

Type: TableStyle

The object this method applies to.

StringCellStyle

Access: Input-only

Type: String

New cell style name.

StringSourceCellStyle

Access: Input-only

Type: String

Source cell style name.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellStyle()
    ' This example creates a TableStyle object and sets values for
    ' the style name and formatting.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As IAcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.CreateCellStyle ("NewTestStyle")
    Dim cellTestFormat As String

    customObj.SetFormat2 "NewTestStyle", "test format"
    customObj.GetFormat2 "NewTestStyle", cellTestFormat

    MsgBox "Cell Style Name = " & cellTestFormat

    customObj.RenameCellStyle "NewTestStyle", "NewTestStyle2"
    customObj.GetFormat2 "NewTestStyle2", cellTestFormat

    MsgBox "Cell Style Name = " & cellTestFormat

    Dim uniqueStyleName As String

    uniqueStyleName = customObj.GetUniqueCellStyleName("testbase")

    MsgBox "Cell Style Name = " & uniqueStyleName

    If customObj.GetIsCellStyleInUse("testbase") = False Then
        MsgBox "That cell style is not being used!"
    End If

    customObj.CreateCellStyleFromStyle "TestStyleFromStyle", "NewTestStyle2"

    customObj.DeleteCellStyle "NewTestStyle2"

    Dim numOfStyles As Long
    numOfStyles = customObj.NumCellStyles
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellStyle()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and formatting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-CreateCellStyle customObj "NewTestStyle")

    (setq cellTestFormat "")
    (vla-SetFormat2 customObj "NewTestStyle" "test format")
    (vla-GetFormat2 customObj "NewTestStyle" 'cellTestFormat)

    (alert (strcat "Cell Style Name = " cellTestFormat))

    (vla-RenameCellStyle customObj "NewTestStyle" "NewTestStyle2")
    (vla-GetFormat2 customObj "NewTestStyle2" 'cellTestFormat)

    (alert (strcat "Cell Style Name = " cellTestFormat))

    (setq uniqueStyleName (vla-GetUniqueCellStyleName customObj "testbase"))

    (alert (strcat "Cell Style Name = " uniqueStyleName))

    (if (= (vla-GetIsCellStyleInUse customObj "testbase") :vlax-false)
        (alert "That cell style is not being used!")
    )

    (vla-CreateCellStyleFromStyle customObj "TestStyleFromStyle" "NewTestStyle2")

    (vla-DeleteCellStyle customObj "NewTestStyle2")

    (setq numOfStyles (vla-get-NumCellStyles customObj))
    (alert (strcat "Number of Cell Styles = " (itoa numOfStyles)))
)


CreateContent Method (ActiveX)

Creates new content in a cell.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.CreateContent(nRow, nCol, nIndex)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to check.

nCol

Access: Input-only

Type: Long

The column number of the cell to check.

nIndex

Access: Input-only

Type: Long

Index at which to create the new context.

Return Value (RetVal)

Type: Long

An ID for the created content.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ContentChange()
    ' This example adds a table in model space
    ' and manipulates its contents

    ' Note: One content is created for each cell by default;
    ' this function need to be called only to create additional contents.

    Dim MyModelSpace As AcadModelSpace
    Set MyModelSpace = ThisDrawing.modelSpace
    Dim pt(2) As Double
    Dim MyTable As IAcadTable
    Dim sID As Long
    Dim newSID As Long
    Dim row As Long
    Dim col As Long

    ' Creates arbitrary cell points to check
    row = 2
    col = 2

    ' Creates the table with an arbitrary number of cells
    Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30)

    If MyTable.IsEmpty(row, col) Then
        If MyTable.IsContentEditable(row, col) Then
            MsgBox "There is no content in the cell, but it is editable"
        End If
    End If

    ' Create some content in an arbitrary cell
    sID = MyTable.CreateContent(row, col, 8)

    MsgBox "The content ID is " & sID

    ' Move the content to another index
    MyTable.MoveContent row, col, sID, 4

    ' Check that the content has been deleted
    MyTable.DeleteContent row, col

    If MyTable.IsEmpty(row, col) Then
        If MyTable.IsContentEditable(row, col) Then
            MsgBox "There is no content in the cell, but it is editable"
        End If
    End If

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ContentChange()
    ;; This example adds a table in model space
    ;; and manipulates its contents
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Note: One content is created for each cell by default;
    ;; this function need to be called only to create additional contents.

    (setq pt (vlax-3d-point 0 0 0))

    ;; Creates arbitrary cell points to check
    (setq row 2
          col 2)

    ;; Creates the table with an arbitrary number of cells
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MyTable (vla-AddTable modelSpace pt 5 5 10 30))
    (vla-SetTextHeight MyTable (+ acDataRow acHeaderRow acTitleRow) 1)

    (vla-Regen doc :vlax-true)
    (vla-ZoomExtents acadObj)

    (if (= (vla-IsEmpty MyTable row col) :vlax-true)
        (if (= (vla-IsContentEditable MyTable row col) :vlax-true)
            (alert "There is no content in the cell, but it is editable")
        )
    )

    ;; Create some content in an arbitrary cell
    (setq sID1 (vla-CreateContent MyTable row col 0))
    (setq sID2 (vla-CreateContent MyTable row col 1))
    (vla-SetTextString MyTable row col sID1 "Value1")
    (vla-SetTextString MyTable row col sID2 "Value2")
    (vla-Regen doc :vlax-true)

    (alert (strcat "The content IDs are "
           "\nValue1: " (itoa sID1)
           "\nValue2: " (itoa sID2)))

    ;; Move the content to another index
    (vla-MoveContent MyTable row col sID2 sID1)
    (vla-Regen doc :vlax-true)
    (alert "Content order changed")

    ;  Check that the content has been deleted
    (vla-DeleteContent MyTable row col)
    (vla-Regen doc :vlax-true)

    (if (= (vla-IsEmpty MyTable row col) :vlax-true)
        (if (= (vla-IsContentEditable MyTable row col) :vlax-true)
            (alert "There is no content in the cell, but it is editable")
        )
    )
)


CreateEntry Method (ActiveX)

Creates a new entry in the File Dependency List.

Supported platforms: Windows only

Signature

VBA:

object.CreateEntry Feature, FullFileName, AffectsGraphics, noIncrement
object

Type: FileDependencies

The object this method applies to.

Feature

Access: Input-only

Type: String

Description of the application or feature creating the entry.

FullFileName

Access: Input-only

Type: String

Name of the file to be stored in the File Dependency List (must be an existing file).

AffectsGraphics

Access: Input-only

Type: Boolean

True means that the entry affects the on-screen view of the drawing file, specifically the graphics cache; false means it does not affect the on-screen view.

noIncrement

Access:Input-only

Type: Boolean

True does not increment the reference count on existing entries; false increments the reference count when an existing entry is added.

Return Value (RetVal)

No return value.

Remarks

This method takes a string indicating a feature description. The string is stored with the File Dependency List (FDL) entry and identifies the application or feature that created this entry, such as Acad::xref. No unique-application-name checking is done on the feature string. This method also takes a parameter to indicate the name of the file stored in the FDL, and the stored path, if any, can be included.

If no path is included, AutoCAD searches for the file in the current directory and the AutoCAD support file search path, and the found is stored with the entry. If the file cannot be found or if it cannot be opened, no entry is created and 0 is returned. If the file is found, its time/date and file size are stored with the entry, and a unique index is assigned to the entry and is returned.

You can use this method to recreate a set of entries by setting noIncrement to True. This prevents the increment of the reference count when an entry already is in the FDL. If noIncrement is set to False, then the same entry can be added multiple times. In this case, the reference count is incremented for the entry to record the number of times the entry is referenced in the FDL. Duplicate records are never created.

Examples

VBA:

Sub Example_CreateEntry()
    ' This example adds an entry to the File Dependency List, returns its Index, updates
    ' the entry, and then removes the entry.

    Dim objFDLCol As AutoCAD.AcadFileDependencies
    Dim objFDL As AutoCAD.AcadFileDependency

    Set objFDLCol = ThisDrawing.FileDependencies
    MsgBox "The number of entries in the File Dependency List is " & objFDLCol.Count & "."

    Dim FDLIndex As Long
    FDLIndex = objFDLCol.CreateEntry("acad:xref", "c:\referenced.dwg", True, True)
    MsgBox "The number of entries in the File Dependency List is " & objFDLCol.Count & "."

    Dim IndexNumber As Long
    IndexNumber = objFDLCol.IndexOf("acad:xref", "c:\referenced.dwg")
    Dim IndexString As String
    IndexString = CStr(IndexNumber)
    MsgBox "The index of the new entry is " & IndexString & "."

    objFDLCol.UpdateEntry FDLIndex

    objFDLCol.RemoveEntry FDLIndex, True
    MsgBox "The number of entries in the File Dependency List is " & objFDLCol.Count & "."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CreateEntry()
    ;; This example adds an entry to the File Dependency List, returns its Index, updates
    ;; the entry, and then removes the entry.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq objFDLCol (vla-get-FileDependencies doc))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))

    (setq FDLIndex (vla-CreateEntry objFDLCol "acad:xref" (findfile ".\\Sample\\Sheet Sets\\Architectural\\Res\\Wall Base.dwg") :vlax-true :vlax-true))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))

    (setq IndexNumber (vla-IndexOf objFDLCol "acad:xref" (findfile ".\\Sample\\Sheet Sets\\Architectural\\Res\\Wall Base.dwg")))
    (setq IndexString (itoa IndexNumber))
    (alert (strcat "The index of the new entry is " IndexString "."))

    (vla-UpdateEntry objFDLCol FDLIndex)

    (vla-RemoveEntry objFDLCol FDLIndex :vlax-true)
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))
)


CreateJog Method (ActiveX)

Creates a jog on the section plane.

Supported platforms: Windows only

Signature

VBA:

object.CreateJog varPt
object

Type: Section

The object this method applies to.

varPt

Access: Input-only

Type: Variant

Point at which to create the jog.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


CreateTypedArray Method (ActiveX)

Creates a variant that contains an array of typed arguments.

Supported platforms: Windows only

Signature

VBA:

object.CreateTypedArray VarArr, Type, Value1, [value2, value3, ...valueN]
object

Type: Utility

The object this method applies to.

VarArr

Access: Output-only

Type: Variant

The array of values as a variant.

Type

Access: Input-only

Type: VbVarType enum

The type of values you are supplying.

vbBoolean, vbInteger, vbLong, vbSingle, or vbDouble.

Value1 [Value2, ...ValueN]

Access: Input-only

Type: Of the type specified in the Type parameter above.

The value(s) to be included in the variant.

Return Value (RetVal)

No return value.

Remarks

The resulting variant can be passed into any AutoCAD method or property that accepts an array of numbers as a variant.

This method can only be accessed using late-binding programming techniques. To use this method, define the Utility object as Object (Dim myObj As Object), not as AcadUtility.

Examples

VBA:

Sub Example_CreateTypedArray()
    ' This example creates a spline from variant arrays created
    ' from doubles using the CreateTypedArray method.
    ' Note that this method must be late bound. This is done
    ' by declaring the utility object (utilObj) as Object,
    ' not as AcadUtility.

    Dim splineObj As AcadSpline

    ' Even though these are arrays, they are declared as variants
    Dim startTan As Variant
    Dim endTan As Variant
    Dim fitPoints As Variant

    Dim utilObj As Object   ' Late bound object
    Set utilObj = ThisDrawing.Utility

    ' Define the spline.
    utilObj.CreateTypedArray startTan, vbDouble, 0.5, 0.5, 0
    utilObj.CreateTypedArray endTan, vbDouble, 0.5, 0.5, 0
    utilObj.CreateTypedArray fitPoints, vbDouble, 0, 0, 0, 5, 5, 0, 10, 0, 0

    ' Create the spline
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CreateTypedArray()
    ;; This example creates a spline from variant arrays created
    ;; from doubles using the CreateTypedArray method.
    ;; Note that this method must be late bound. This is done
    ;; by declaring the utility object (utilObj) as Object,
    ;; not as AcadUtility.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq utilObj (vla-get-Utility doc))

    ;; Define the spline.
    (vla-CreateTypedArray utilObj 'startTan vlax-vbDouble 0.5 0.5 0)
    (vla-CreateTypedArray utilObj 'endTan vlax-vbDouble 0.5 0.5 0)
    (vla-CreateTypedArray utilObj 'fitPoints vlax-vbDouble 0 0 0 5 5 0 10 0 0)

    ;; Create the spline
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)
)


Delete Method (ActiveX)

Deletes a specified object or a set of saved layer settings.

Supported platforms: Windows only

Signature

VBA:

object.Delete
object

Type: All drawing objects, AttributeReference, Block, Dictionary, DimStyle, Group, Hyperlink, Layer, LayerStateManager, Layout, Linetype, Material, MLeaderStyle, PlotConfiguration, PopupMenuItem, RegisteredApplication, SelectionSet, TableStyle, TextStyle, Toolbar, ToolbarItem, UCS, View, Viewport, XRecord

The objects this method applies to.

Return Value (RetVal)

No return value.

Remarks

When you delete an object in a collection, all remaining items in the collection are reassigned a new index based on the current count. You should therefore avoid loops that delete an object while iterating through the collection. For example, the following VBA code will result in a runtime error:

For i = 0 To ThisDrawing.Groups.Count - 1
    ThisDrawing.Groups.Item(i).Delete
Next I

Instead, use the following VBA code to delete all members in a collection:

For Each obj In ThisDrawing.Groups
    obj.Delete
Next obj

You can also use the following VBA code to delete a single member of a collection:

ThisDrawing.Groups.Item("group1").Delete

An error will result if you attempt to delete a collection object.

ToolbarItem: You can only add or remove toolbar items when the toolbar is visible.

LayerStateManager: This object takes an argument, Name, which is a string representing the layer state to be deleted.

Examples

VBA:

Sub Example_Delete()
    ' This example creates a Layer named "TEST".
    ' It then iterates the Layers collection and displays
    ' the names of the available layers.
    ' It then deletes the layer "TEST", and again iterates
    ' the layers collection and displays the names of
    ' available layers.

    Dim layerObj As AcadLayer

    ' Create the new layer
    Set layerObj = ThisDrawing.Layers.Add("TEST")

    ' Display the names of the layers in the drawing
    GoSub DISPLAYLAYERS

    ' Delete the layer "TEST"
    layerObj.Delete

    ' Display the names of the layers remaining in the drawing
    GoSub DISPLAYLAYERS

    Exit Sub

DISPLAYLAYERS:
    Dim entry As AcadLayer
    Dim layerNames As String
    layerNames = ""
    For Each entry In ThisDrawing.Layers
       layerNames = layerNames & entry.name & ", "
    Next
    MsgBox "The drawing consists of the following layers:" & vbCr & layerNames, , "Delete Example"
    Return

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Delete()
    ;; This example creates a Layer named "TEST".
    ;; It then iterates the Layers collection and displays
    ;; the names of the available layers.
    ;; It then deletes the layer "TEST", and again iterates
    ;; the layers collection and displays the names of
    ;; available layers.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the new layer
    (setq layerObj (vla-Add (vla-get-Layers doc) "TEST"))

    ;; Display the names of the layers in the drawing
    (setq layerNames "")
    (vlax-for entry (vla-get-Layers doc)
       (setq layerNames (strcat layerNames (vla-get-Name entry) ", "))
    )
    (alert (strcat "The drawing consists of the following layers: \n" layerNames))

    ;; Delete the layer "TEST"
    (vla-Delete layerObj)

    ;; Display the names of the layers remaining in the drawing
    (setq layerNames "")
    (vlax-for entry (vla-get-Layers doc)
       (setq layerNames (strcat layerNames (vla-get-Name entry) ", "))
    )
    (alert (strcat "The drawing consists of the following layers: \n" layerNames))
)


DeleteCellContent Method (ActiveX)

Deletes the cell content in the specified row and column.

Supported platforms: Windows only

Signature

VBA:

object.DeleteCellContent(row, col)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


DeleteCellStyle Method (ActiveX)

Deletes a cell style.

Supported platforms: Windows only

Signature

VBA:

object.DeleteCellStyle StringCellStyle
object

Type: TableStyle

The object this method applies to.

StringCellStyle

Access: Input-only

Type: String

Cell style name.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellStyle()
    ' This example creates a TableStyle object and sets values for
    ' the style name and formatting.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As IAcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.CreateCellStyle ("NewTestStyle")
    Dim cellTestFormat As String

    customObj.SetFormat2 "NewTestStyle", "test format"
    customObj.GetFormat2 "NewTestStyle", cellTestFormat

    MsgBox "Cell Style Name = " & cellTestFormat

    customObj.RenameCellStyle "NewTestStyle", "NewTestStyle2"
    customObj.GetFormat2 "NewTestStyle2", cellTestFormat

    MsgBox "Cell Style Name = " & cellTestFormat

    Dim uniqueStyleName As String

    uniqueStyleName = customObj.GetUniqueCellStyleName("testbase")

    MsgBox "Cell Style Name = " & uniqueStyleName

    If customObj.GetIsCellStyleInUse("testbase") = False Then
        MsgBox "That cell style is not being used!"
    End If

    customObj.CreateCellStyleFromStyle "TestStyleFromStyle", "NewTestStyle2"

    customObj.DeleteCellStyle "NewTestStyle2"

    Dim numOfStyles As Long
    numOfStyles = customObj.NumCellStyles
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellStyle()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and formatting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-CreateCellStyle customObj "NewTestStyle")

    (setq cellTestFormat "")
    (vla-SetFormat2 customObj "NewTestStyle" "test format")
    (vla-GetFormat2 customObj "NewTestStyle" 'cellTestFormat)

    (alert (strcat "Cell Style Name = " cellTestFormat))

    (vla-RenameCellStyle customObj "NewTestStyle" "NewTestStyle2")
    (vla-GetFormat2 customObj "NewTestStyle2" 'cellTestFormat)

    (alert (strcat "Cell Style Name = " cellTestFormat))

    (setq uniqueStyleName (vla-GetUniqueCellStyleName customObj "testbase"))

    (alert (strcat "Cell Style Name = " uniqueStyleName))

    (if (= (vla-GetIsCellStyleInUse customObj "testbase") :vlax-false)
        (alert "That cell style is not being used!")
    )

    (vla-CreateCellStyleFromStyle customObj "TestStyleFromStyle" "NewTestStyle2")

    (vla-DeleteCellStyle customObj "NewTestStyle2")

    (setq numOfStyles (vla-get-NumCellStyles customObj))
    (alert (strcat "Number of Cell Styles = " (itoa numOfStyles)))
)


DeleteColumns Method (ActiveX)

Deletes columns from a table.

Supported platforms: Windows only

Signature

VBA:

object.DeleteColumns col, cols
object

Type: Table

The object this method applies to.

col

Access: Input-only

Type: Long

The column index.

cols

Access: Input-only

Type: Long

The number of columns to delete from the table.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


DeleteConfiguration Method (ActiveX)

Deletes a viewport configuration.

Supported platforms: Windows only

Signature

VBA:

object.DeleteConfiguration Name
object

Type: Viewports

The object this method applies to.

Name

Access: Input-only

Type: String

The name of the viewport configuration to delete.

Return Value (RetVal)

No return value.

Remarks

A viewport configuration consists of a single viewport that has been split using the Split method. Once a viewport has been split, the resulting viewports are considered a viewport configuration. All the viewports in the configuration have the same name as the original viewport before the split.

Examples

VBA:

Sub Example_DeleteConfiguration()
    ' This example creates a new viewport and splits
    ' the viewport into 4 windows.
    ' It then deletes the viewport configuration
    Dim oldViewport As AcadViewport
    Set oldViewport = ThisDrawing.ActiveViewport

    ' Create a new viewport and make it active
    Dim newViewport As AcadViewport
    Set newViewport = ThisDrawing.Viewports.Add("TESTVIEWPORT")
    ThisDrawing.ActiveViewport = newViewport

    ' Split the viewport in 4 windows
    newViewport.Split acViewport4

    ' Make the newly split viewport active
    ThisDrawing.ActiveViewport = newViewport
    MsgBox "The viewport configuration split into 4 windows."

    ' Delete the viewport configuration
    ThisDrawing.ActiveViewport = oldViewport
    ThisDrawing.Viewports.DeleteConfiguration ("TESTVIEWPORT")
    ThisDrawing.Regen acAllViewports
    MsgBox "The viewport configuration has been deleted."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DeleteConfiguration()
    ;; This example creates a new viewport and splits
    ;; the viewport into 4 windows.
    ;; It then deletes the viewport configuration
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq oldViewport (vla-Add (vla-get-Viewports doc) "CurrentViewport"))

    ;; Create a new viewport and make it active
    (setq newViewport (vla-Add (vla-get-Viewports doc) "NewViewport"))
    (vla-put-ActiveViewport doc newViewport)

    ;; Split the viewport in 4 windows
    (vla-Split newViewport acViewport4)

    ;; Make the newly split viewport active
    (vla-put-ActiveViewport doc newViewport)
    (alert "The viewport configuration split into 4 windows.")

    ;; Delete the viewport configuration
    (vla-put-ActiveViewport doc oldViewport)
    (vla-DeleteConfiguration (vla-get-Viewports doc) "NewViewport")
    (vla-DeleteConfiguration (vla-get-Viewports doc) "CurrentViewport")
    (vla-Regen doc acAllViewports)
    (alert "The viewport configurations have been deleted and original viewport restored.")
)


DeleteContent Method (ActiveX)

Deletes content of a cell.

Supported platforms: Windows only

Signature

VBA:

object.DeleteContent nRow, nCol
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to delete.

nCol

Access: Input-only

Type: Long

The column number of the cell to delete.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ContentChange()
    ' This example adds a table in model space
    ' and manipulates its contents

    ' Note: One content is created for each cell by default;
    ' this function need to be called only to create additional contents.

    Dim MyModelSpace As AcadModelSpace
    Set MyModelSpace = ThisDrawing.modelSpace
    Dim pt(2) As Double
    Dim MyTable As IAcadTable
    Dim sID As Long
    Dim newSID As Long
    Dim row As Long
    Dim col As Long

    ' Creates arbitrary cell points to check
    row = 2
    col = 2

    ' Creates the table with an arbitrary number of cells
    Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30)

    If MyTable.IsEmpty(row, col) Then
        If MyTable.IsContentEditable(row, col) Then
            MsgBox "There is no content in the cell, but it is editable"
        End If
    End If

    ' Create some content in an arbitrary cell
    sID = MyTable.CreateContent(row, col, 8)

    MsgBox "The content ID is " & sID

    ' Move the content to another index
    MyTable.MoveContent row, col, sID, 4

    ' Check that the content has been deleted
    MyTable.DeleteContent row, col

    If MyTable.IsEmpty(row, col) Then
        If MyTable.IsContentEditable(row, col) Then
            MsgBox "There is no content in the cell, but it is editable"
        End If
    End If

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ContentChange()
    ;; This example adds a table in model space
    ;; and manipulates its contents
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Note: One content is created for each cell by default;
    ;; this function need to be called only to create additional contents.

    (setq pt (vlax-3d-point 0 0 0))

    ;; Creates arbitrary cell points to check
    (setq row 2
          col 2)

    ;; Creates the table with an arbitrary number of cells
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MyTable (vla-AddTable modelSpace pt 5 5 10 30))
    (vla-SetTextHeight MyTable (+ acDataRow acHeaderRow acTitleRow) 1)

    (vla-Regen doc :vlax-true)
    (vla-ZoomExtents acadObj)

    (if (= (vla-IsEmpty MyTable row col) :vlax-true)
        (if (= (vla-IsContentEditable MyTable row col) :vlax-true)
            (alert "There is no content in the cell, but it is editable")
        )
    )

    ;; Create some content in an arbitrary cell
    (setq sID1 (vla-CreateContent MyTable row col 0))
    (setq sID2 (vla-CreateContent MyTable row col 1))
    (vla-SetTextString MyTable row col sID1 "Value1")
    (vla-SetTextString MyTable row col sID2 "Value2")
    (vla-Regen doc :vlax-true)

    (alert (strcat "The content IDs are "
           "\nValue1: " (itoa sID1)
           "\nValue2: " (itoa sID2)))

    ;; Move the content to another index
    (vla-MoveContent MyTable row col sID2 sID1)
    (vla-Regen doc :vlax-true)
    (alert "Content order changed")

    ;  Check that the content has been deleted
    (vla-DeleteContent MyTable row col)
    (vla-Regen doc :vlax-true)

    (if (= (vla-IsEmpty MyTable row col) :vlax-true)
        (if (= (vla-IsContentEditable MyTable row col) :vlax-true)
            (alert "There is no content in the cell, but it is editable")
        )
    )
)


DeleteFitPoint Method (ActiveX)

Deletes the fit point of a spline at a given index.

Supported platforms: Windows only

Signature

VBA:

object.DeleteFitPoint Index
object

Type: Spline

The object this method applies to.

Index

Access: Input-only

Type: Integer

An index position in the fit point list. Positive integers between 0 and N-1, where N is the total number of fit points for the spline.

Return Value (RetVal)

No return value.

Remarks

AutoCAD removes the fit point and refits the spline through the remaining points. There must be at least three fit points in the spline for this method to succeed. To view the changes, use the Update or Regen method.

Examples

VBA:

Sub Example_DeleteFitPoint()
    ' This example creates a spline object in model space.
    ' It then deletes a fit point from the spline.

    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ZoomAll
    MsgBox "Delete the first fit point", , "DeleteFitPoint Example"

    ' Delete the first fit point in the spline
    splineObj.DeleteFitPoint 0
    ThisDrawing.Regen True
    MsgBox "A fit point has been deleted at Index: 0", , "DeleteFitPoint Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DeleteFitPoint()
    ;; This example creates a spline object in model space.
    ;; It then deletes a fit point from the spline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the spline
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(1 1 0
                                                 5 5 0
                                                 10 0 0
                                                )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)
    (alert "Delete the first fit point.")

    ;; Delete the first fit point in the spline
    (vla-DeleteFitPoint splineObj 0)
    (vla-Regen doc :vlax-true)
    (alert "A fit point has been deleted at Index: 0")
)


DeleteProfile Method (ActiveX)

Deletes the specified profile.

Supported platforms: Windows only

Signature

VBA:

object.DeleteProfile ProfileName
object

Type: PreferencesProfiles

The object this method applies to.

ProfileName

Access: Input-only

Type: String

The name of the profile to delete.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_DeleteProfile()
    ' This example deletes a profile.

    Dim preferences As AcadPreferences
    Dim strProfileToDelete As String

    Set preferences = ThisDrawing.Application.preferences

    ' Specify the profile to delete.
    strProfileToDelete = "TestProfile"

    ' Delete the profile
    ' The call will fail if "TestProfile" does not exist or
    ' if "TestProfile" is the current profile.
    On Error GoTo Error
    preferences.Profiles.DeleteProfile strProfileToDelete
    Exit Sub

Error:
    MsgBox "DeleteProfile of " & strProfileToDelete & " failed. " & Err.Description, , "DeleteProfile Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DeleteProfile()
    ;; This example deletes a profile.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Specify the profile to delete.
    (setq strProfileToDelete "TestProfile")
    (vla-CopyProfile (vla-get-Profiles preferences) "<<Unnamed Profile>>" strProfileToDelete)

    (alert (strcat "Profile " strProfileToDelete " created from <<Unnamed Profile>>."))

    ;; Delete the profile
    ;; The call will fail if "TestProfile" does not exist or
    ;; if "TestProfile" is the current profile.
    (vla-DeleteProfile (vla-get-Profiles preferences) strProfileToDelete)
    (alert (strcat "Profile " strProfileToDelete " deleted."))
)


DeleteRows Method (ActiveX)

Deletes rows from a table.

Supported platforms: Windows only

Signature

VBA:

object.DeleteRows row, Rows
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row index.

Rows

Access: Input-only

Type: Long

The number of rows to delete from the table.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Detach Method (ActiveX)

Detaches an external reference (xref) from a drawing.

Supported platforms: Windows only

Signature

VBA:

object.Detach
object

Type: Block

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

Detaching an xref removes the xref from the current drawing. All copies of the xref are erased, and the xref definition is deleted. All xref-dependent symbol table information (such as layers and linetypes) is deleted from the current drawing.

You cannot detach an xref that contains other xrefs.

Examples

VBA:

Sub Example_Detach()
    On Error GoTo ERRORHANDLER

    ' Define external reference to be inserted
    Dim xrefHome As AcadBlock
    Dim xrefInserted As AcadExternalReference
    Dim insertionPnt(0 To 2) As Double
    Dim PathName As String
    insertionPnt(0) = 1
    insertionPnt(1) = 1
    insertionPnt(2) = 0
    PathName = "c:/AutoCAD/sample/City map.dwg"

    ' Add the external reference
    Set xrefInserted = ThisDrawing.ModelSpace. _
            AttachExternalReference(PathName, "XREF_IMAGE", _
            insertionPnt, 1, 1, 1, 0, False)
    ZoomAll
    MsgBox "The external reference is attached."

    ' Detach the external reference definition
    Dim name As String
    name = xrefInserted.name
    ThisDrawing.Blocks.Item(name).Detach
    MsgBox "The external reference is detached."
    Exit Sub

ERRORHANDLER:
    MsgBox Err.Description
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Detach()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define external reference to be inserted
    (setq insertionPnt (vlax-3d-point 1 1 0)
          pathName (findfile ".\\Sample\\Sheet Sets\\Architectural\\Res\\STAIR1.dwg"))

    ;; Add the external reference
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq xrefInserted (vla-AttachExternalReference modelSpace pathName "XREF_IMAGE" insertionPnt 1 1 1 0 :vlax-false))
    (vla-ZoomAll acadObj)

    (alert "The external reference is attached.")

    ;; Detach the external reference definition
    (setq name (vla-get-Name xrefInserted))
    (vla-Detach (vla-Item (vla-get-Blocks doc) name))
    (alert "The external reference is detached.")
)


Display Method (ActiveX)

Toggles the display control of the PViewport object on or off.

Supported platforms: Windows only

Signature

VBA:

object.Display Status
object

Type: PViewport

The object this method applies to.

Status

Access: Input-only

Type: Boolean

  • True: Viewport display is on.
  • False: Viewport display is off.

Return Value (RetVal)

No return value.

Remarks

The display control must be on before the MSpace property can be used to activate the model space editing capabilities.

Use the ViewportOn property to determine if a paper space viewport display has already been turned on with this method.

Examples

VBA:

Sub Example_DisplayMethod()
    ' This example creates a paper space viewport and makes it active.

    Dim newPViewport As AcadPViewport
    Dim centerPoint(0 To 2) As Double
    Dim height As Double
    Dim width As Double
    height = 30#
    width = 40#
    centerPoint(0) = 30#: centerPoint(1) = 30#: centerPoint(2) = 0#

    ' Create a paper space Viewport object
    ThisDrawing.ActiveSpace = acPaperSpace
    Set newPViewport = ThisDrawing.PaperSpace.AddPViewport(centerPoint, width, height)
    ZoomAll
    newPViewport.Display True

    ' Before making a pViewport active,
    ' the mspace property needs to be True
    ThisDrawing.mspace = True
    ThisDrawing.ActivePViewport = newPViewport
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DisplayMethod()
    ;; This example creates a paper space viewport and makes it active.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq centerPoint (vlax-3d-point 30 30 0)
          height 30
          width 40)

    ;; Create a paper space Viewport object
    (vla-put-ActiveSpace doc acPaperSpace)
    (setq newPViewport (vla-AddPViewport (vla-get-PaperSpace doc) centerPoint width height))
    (vla-ZoomAll acadObj)
    (vla-Display newPViewport :vlax-true)

    ;; Before making a pViewport active,
    ;; the mspace property needs to be True
    (vla-put-MSpace doc :vlax-true)
    (vla-put-ActivePViewport doc newPViewport)
)


DisplayPlotPreview Method (ActiveX)

Displays the Plot Preview dialog box with the full view preview.

Supported platforms: Windows only

Signature

VBA:

object.DisplayPlotPreview Preview
object

Type: Plot

The object this method applies to.

Preview

Access: Input-only

Type: AcPreviewMode enum

  • acFullPreview
  • acPartialPreview

Return Value (RetVal)

No return value.

Remarks

The preview is invoked on the active layout.

Full preview displays the drawing on the screen as it will appear when plotted on paper. This requires a regeneration of the drawing. It is faster than the normal plot regeneration because AutoCAD performs no vector sorting or optimization.

The NumberOfCopies property and SetLayoutsToPlot method settings are ignored during the call to this method.

This method is not available while in batch mode and will return E_FAIL if called in batch mode.

The associated drawing is made active when this method is called. This drawing will remain active after completion of the DisplayPlotPreview method.

This method puts the associated drawing into a special display mode that can only be exited by user interaction. Thus, upon successful return from the DisplayPlotPreview method, the associated drawing will be active, and will be left in plot preview display mode.

Examples

VBA:

Sub Example_DisplayPlotPreview()
    ' This example creates a circle and then performs
    ' a plot preview.

    ' Create the circle
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 2: center(1) = 2: center(2) = 0
    radius = 1
    Set circleObj = ThisDrawing.modelSpace.AddCircle(center, radius)
    ZoomAll

    ' Preview the plot of the circle
    ThisDrawing.ActiveLayout.ConfigName = "DWG to PDF.pc3"
    ThisDrawing.Plot.DisplayPlotPreview acFullPreview

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DisplayPlotPreview()
    ;; This example creates a circle and then performs
    ;; a plot preview.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the circle
    (setq center (vlax-3d-point 2 2 0)
          radius 1)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace center radius))
    (vla-ZoomAll acadObj)

    ;; Preview the plot of the circle
    (vla-put-ConfigName (vla-get-ActiveLayout doc) "DWG to PDF.pc3")
    (vla-DisplayPlotPreview (vla-get-Plot doc) acFullPreview)
)


DistanceToReal Method (ActiveX)

Converts a distance from a string to a real (double) value.

Supported platforms: Windows only

Signature

VBA:

RetVal = DistanceToReal(Distance, Unit)
object

Type: Utility

The object this method applies to.

Distance

Access: Input-only

Type: String

The distance as a string value.

Unit

Access: Input-only

Type: AcUnits enum

The unit to which the string is to be converted.

  • acDefaultUnits
  • acScientific
  • acDecimal
  • acEngineering
  • acArchitectural
  • acFractional

Return Value (RetVal)

Type: Double

The distance as a real number.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_DistanceToReal()
    ' This example passes several different distances in
    ' different units to be converted to real values.

    Dim distAsString As String
    Dim unit As Long
    Dim distAsReal As Double

    ' Convert the distance to a real in scientific units
    unit = acScientific
    distAsString = "1.75E+01"
    distAsReal = ThisDrawing.Utility.DistanceToReal(distAsString, unit)
    MsgBox "1.75E+01 converts to " & distAsReal & " in scientific units.", , "DistanceToReal Example"

    ' Convert the distance to a real in decimal units
    unit = acDecimal
    distAsString = "17.5"
    distAsReal = ThisDrawing.Utility.DistanceToReal(distAsString, unit)
    MsgBox "1.75 converts to " & distAsReal & " in decimal units.", , "DistanceToReal Example"

    ' Convert the distance to a real in engineering units
    unit = acEngineering
    distAsString = "1'-5.50"""
    distAsReal = ThisDrawing.Utility.DistanceToReal(distAsString, unit)
    MsgBox "1'-5.50"" converts to " & distAsReal & " in engineering units.", , "DistanceToReal Example"

    ' Convert the distance to a real in architectural units
    unit = acArchitectural
    distAsString = "1'-5 1/2"""
    distAsReal = ThisDrawing.Utility.DistanceToReal(distAsString, unit)
    MsgBox "1'-5 1/2"" converts to " & distAsReal & " in architectural units.", , "DistanceToReal Example"

    ' Convert the distance to a real in fractional units
    unit = acFractional
    distAsString = "17 1/2"
    distAsReal = ThisDrawing.Utility.DistanceToReal(distAsString, unit)
    MsgBox "1'-5 1/2"" converts to " & distAsReal & " in fractional units.", , "DistanceToReal Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DistanceToReal()
    ;; This example passes several different distances in
    ;; different units to be converted to real values.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Convert the distance to a real in scientific units
    (setq unit acScientific
          distAsString "1.75E+01"
          distAsReal (vla-DistanceToReal (vla-get-Utility doc) distAsString unit))
    (alert (strcat "1.75E+01 converts to " (rtos distAsReal 2) " in scientific units."))

    ;; Convert the distance to a real in decimal units
    (setq unit acDecimal
          distAsString "17.5"
             distAsReal (vla-DistanceToReal (vla-get-Utility doc) distAsString unit))
    (alert (strcat "17.5 converts to " (rtos distAsReal 2) " in decimal units."))

    ;; Convert the distance to a real in engineering units
    (setq unit acEngineering
          distAsString "1'-5.50\""
             distAsReal (vla-DistanceToReal (vla-get-Utility doc) distAsString unit))
    (alert (strcat "1'-5.50\" converts to " (rtos distAsReal 2) " in engineering units."))

    ;; Convert the distance to a real in architectural units
    (setq unit acArchitectural
          distAsString "1'-5 1/2\""
             distAsReal (vla-DistanceToReal (vla-get-Utility doc) distAsString unit))
    (alert (strcat "1'-5 1/2\" converts to " (rtos distAsReal 2) " in architectural units."))

    ;; Convert the distance to a real in fractional units
    (setq unit acFractional
          distAsString "17 1/2"
             distAsReal (vla-DistanceToReal (vla-get-Utility doc) distAsString unit))
    (alert (strcat "17 1/2 converts to " (rtos distAsReal 2) " in fractional units."))
)


Dock Method (ActiveX)

Docks the toolbar to the owning frame window.

Supported platforms: Windows only

Signature

VBA:

object.Dock Side
object

Type: Toolbar

The object this method applies to.

Side

Access: Input-only

Type: AcToolbarDockStatus enum

The side of the toolbar to dock.

  • acToolbarDockTop
  • acToolbarDockBottom
  • acToolbarDockLeft
  • acToolbarDockRight

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Dock()
    ' This example creates a new toolbar called TestToolbar and inserts three
    ' buttons into it. The toolbar is then displayed as a floating toolbar,
    ' and then as a docked toolbar.
    ' To remove the toolbar after execution of this macro, use the Customize Menu
    ' option from the Tools menu.

    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    ' Create the new toolbar
    Dim newToolBar As AcadToolbar
    Set newToolBar = currMenuGroup.Toolbars.Add("TestToolbar")

    ' Add three buttons to the new toolbar.
    ' All three buttons will have the same macro attached.
    Dim newButton1 As AcadToolbarItem
    Dim newButton2 As AcadToolbarItem
    Dim newButton3 As AcadToolbarItem
    Dim openMacro As String

    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set newButton1 = newToolBar.AddToolbarButton("", "NewButton1", "Open a file.", openMacro)
    Set newButton2 = newToolBar.AddToolbarButton("", "NewButton2", "Open a file.", openMacro)
    Set newButton3 = newToolBar.AddToolbarButton("", "NewButton3", "Open a file.", openMacro)

    ' Display the toolbar
    newToolBar.Visible = True

    ' Dock the toolbar to the left of the screen.
    newToolBar.Dock acToolbarDockLeft
    MsgBox "The toolbar is docked to the left."

    ' Dock the toolbar to the right of the screen.
    newToolBar.Dock acToolbarDockRight
    MsgBox "The toolbar is docked to the right."

    ' Dock the toolbar at the top of the screen.
    newToolBar.Dock acToolbarDockTop
    MsgBox "The toolbar is docked at the top."

    ' Dock the toolbar at the bottom of the screen.
    newToolBar.Dock acToolbarDockBottom
    MsgBox "The toolbar is docked at the bottom."

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Dock()
    ;; This example creates a new toolbar called TestToolbar and inserts three
    ;; buttons into it. The toolbar is then displayed as a floating toolbar,
    ;; and then as a docked toolbar.
    ;; To remove the toolbar after execution of this macro, use the Customize Menu
    ;; option from the Tools menu.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new toolbar
    (setq newToolBar (vla-Add (vla-get-Toolbars currMenuGroup) "TestToolbar"))

    ;; Add three buttons to the new toolbar.
    ;; All three buttons will have the same macro attached.

    ;; Assign the macro string the VB equivalent of "ESC ESC _open "
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))

    (setq newButton1 (vla-AddToolbarButton newToolBar "" "NewButton1" "Open a file." openMacro))
    (setq newButton2 (vla-AddToolbarButton newToolBar "" "NewButton2" "Open a file." openMacro))
    (setq newButton3 (vla-AddToolbarButton newToolBar "" "NewButton3" "Open a file." openMacro))

    ;; Display the toolbar
    (vla-put-Visible newToolBar :vlax-true)

    ;; Dock the toolbar to the left of the screen.
    (vla-Dock newToolBar acToolbarDockLeft)
    (alert "The toolbar is docked to the left.")

    ;; Dock the toolbar to the right of the screen.
    (vla-Dock newToolBar acToolbarDockRight)
    (alert "The toolbar is docked to the right.")

    ;; Dock the toolbar at the top of the screen.
    (vla-Dock newToolBar acToolbarDockTop)
    (alert "The toolbar is docked at the top.")

    ;; Dock the toolbar at the bottom of the screen.
    (vla-Dock newToolBar acToolbarDockBottom)
    (alert "The toolbar is docked at the bottom.")
)


ElevateOrder Method (ActiveX)

Elevates the order of the spline to the given order.

Supported platforms: Windows only

Signature

VBA:

object.ElevateOrder Order
object

Type: Spline

The object this method applies to.

Order

Access: Input-only

Type: Integer

A positive value greater than the current order. The maximum order is 26.

Return Value (RetVal)

No return value.

Remarks

The order of a spline is equal to the degree of the spline plus one (+1). You can query the degree of the spline by using the Degree property.

Entering a value greater than the current value increases the number of control points uniformly across the spline for more localized control. Once a spline order has been elevated, it cannot be reduced.

When a spline is elevated, it is converted from an interpolated (fit) spline to a control point spline. This means that after elevation, the spline no longer has fit tangents and the StartTangent and EndTangent properties for the spline are no longer accessible. The only way to edit a control point spline is through the ControlPoints property, or the SetControlPoint or GetControlPoint methods.

Examples

VBA:

Sub Example_ElevateOrder()
    ' This example creates a spline object in model space.
    ' It then elevates the order of the spline.

    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ZoomAll
    MsgBox "The current order of the spline is " & splineObj.Degree + 1, , "ElevateOrder Example"

    ' Elevate the order of the spline
    splineObj.ElevateOrder (splineObj.Degree + 10)
    ThisDrawing.Regen True
    MsgBox "The order of the spline has been raised to " & splineObj.Degree + 1, , "ElevateOrder Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ElevateOrder()
    ;; This example creates a spline object in model space.
    ;; It then elevates the order of the spline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the spline
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(1 1 0
                                     5 5 0
                                     10 0 0
                                    )
    )

    ;; Create the spline
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)

    (alert (strcat "The current order of the spline is " (itoa (1+ (vla-get-Degree splineObj)))))

    ;; Elevate the order of the spline
    (vla-ElevateOrder splineObj (+ (vla-get-Degree splineObj) 10))
    (vla-Regen doc :vlax-true)
    (alert (strcat "The order of the spline has been raised to " (itoa (1+ (vla-get-Degree splineObj)))))
)


EnableMergeAll Method (ActiveX)

Controls cell merging.

Supported platforms: Windows only

Signature

VBA:

object.EnableMergeAll nRow, nCol, bEnable
object

Type: Table, TableStyle

The objects this method applies to.

nRow

Access: Input-only

Type: Integer

The value of the row.

nCol

Access: Input-only

Type: Integer

The value of the column.

bEnable

Access: Input-only

Type: Boolean

The flag for cell merging.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_EnableMergeAll()
    ' This example creates a TableStyle object and sets values for
    ' the style cell merging.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As IAcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.CreateCellStyle "NewTestStyle2"
    customObj.EnableMergeAll "NewTestStyle2", False

    If customObj.GetIsMergeAllEnabled("NewTestStyle2") = False Then
        MsgBox "Merge all is not enabled!"
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_EnableMergeAll()
    ;; This example creates a TableStyle object and sets values for
    ;; the style cell merging.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")
    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-CreateCellStyle customObj "NewTestStyle2")
    (vla-EnableMergeAll customObj "NewTestStyle2" :vlax-false)

    (if (= (vla-GetIsMergeAllEnabled customObj "NewTestStyle2") :vlax-false)
        (alert "Merge all is not enabled!")
    )
)


EndUndoMark Method (ActiveX)

Marks the end of a block of operations.

Supported platforms: Windows only

Signature

VBA:

object.EndUndoMark
object

Type: Document

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

This method allows AutoCAD to close the environment so operations from StartUndoMark to EndUndoMark can be treated as a group of operations.

Examples

VBA:

Sub Example_EndUndoMark()
    ' This example creates a series of lines, each one with an undo marker
    ' defined for it. After lines are created you can switch to AutoCAD and type
    ' the Undo command, and only one line at a time will be undone. If StartUndoMark
    ' call is not made, an undo in AutoCAD will undo all the lines at once.

    Dim line As AcadLine
    Dim stPnt(0 To 2) As Double
    Dim endPnt(0 To 2) As Double
    stPnt(0) = 1: stPnt(1) = 2: stPnt(2) = 0
    endPnt(0) = 2: stPnt(1) = 1: stPnt(2) = 0

    ' Create the lines
    Dim j As Integer
    For j = 0 To 3
        ThisDrawing.StartUndoMark
        Set line = ThisDrawing.ModelSpace.AddLine(stPnt, endPnt)
        stPnt(0) = stPnt(0) + 3
        endPnt(0) = endPnt(0) + 3
        ThisDrawing.EndUndoMark
    Next
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_EndUndoMark()
    ;; This example creates a series of lines, each one with an undo marker
    ;; defined for it. After lines are created you can switch to AutoCAD and type
    ;; the Undo command, and only one line at a time will be undone. If StartUndoMark
    ;; call is not made, an undo in AutoCAD will undo all the lines at once.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    (setq stPnt (vlax-3d-point 1 2 0)
          endPnt (vlax-3d-point 2 1 0))

    ;; Create the lines
    (setq j 0)
    (while (>= 3 j)
        (vla-StartUndoMark doc)
        (setq line (vla-AddLine modelSpace stPnt endPnt))
        (vlax-safearray-put-element (vlax-variant-value stPnt) 0 (+ (vlax-safearray-get-element (vlax-variant-value stPnt) 0) 3))
        (vlax-safearray-put-element (vlax-variant-value endPnt) 0 (+ (vlax-safearray-get-element (vlax-variant-value endPnt) 0) 3))
        (setq j (1+ j))
        (vla-EndUndoMark doc)
    )
    (vla-ZoomAll acadObj)
)


Erase Method (ActiveX)

Erases all the objects in a selection set.

Supported platforms: Windows only

Signature

VBA:

object.Erase
object

Type: SelectionSet

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Erase()
    ' This example creates a selection set and several objects.
    ' It then adds the objects to the selection set, and then
    ' erases the objects from the selection set.

    ' Create the new selection set
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_SELECTIONSET")

    ' Create a Ray object in model space
    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)

    ' Create a polyline object in model space
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True

    ' Create a line object in model space
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ' Create a circle object in model space
    Dim circObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 20: centerPt(1) = 30: centerPt(2) = 0
    radius = 3
    Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)

    ' Create an ellipse object in model space
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    ZoomAll

    ' Iterate through the model space collection.
    ' Collect the objects found into an array of objects
    ' to be added to the selection set.
    ReDim ssobjs(0 To ThisDrawing.ModelSpace.count - 1) As AcadEntity
    Dim I As Integer
    For I = 0 To ThisDrawing.ModelSpace.count - 1
        Set ssobjs(I) = ThisDrawing.ModelSpace.Item(I)
    Next

    ' Add the array of objects to the selection set
    ssetObj.AddItems ssobjs

    GoSub LISTOBJS

    ' Erase the objects in the selection set
    ssetObj.Erase

    GoSub LISTOBJS

    ' exit the subroutine
    Exit Sub

LISTOBJS:

    ' List all the objects in the selection set
    If ssetObj.count = 0 Then
        MsgBox "The selection set is empty"
    Else
        For I = 0 To ssetObj.count - 1
            MsgBox "The selection set contains: " & ssetObj.Item(I).ObjectName
        Next
    End If

    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Erase()
    ;; This example creates a selection set and several objects.
    ;; It then adds the objects to the selection set, and then
    ;; erases the objects from the selection set.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the new selection set
    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_SELECTIONSET"))

    ;; Create a Ray object in model space
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 1 3 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq rayObj (vla-AddRay modelSpace basePoint SecondPoint))

    ;; Create a polyline object in model space
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
                                  9 2
                                  3 5
                                 )
    )

    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)

    ;; Create a line object in model space
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 2 2 0))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    ;; Create a circle object in model space
    (setq centerPt (vlax-3d-point 20 30 0)
          radius 3)
    (setq circObj (vla-AddCircle modelSpace centerPt radius))

    ;; Create an ellipse object in model space
    (setq majAxis (vlax-3d-point 5 5 0)
          center (vlax-3d-point 10 20 0)
          radRatio 0.3)
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

    (vla-ZoomAll acadObj)

    ;; Iterate through the model space collection.
    ;; Collect the objects found into an array of objects
    ;; to be added to the selection set.
    (setq ssobjs (vlax-make-safearray vlax-vbObject (cons 0 (- (vla-get-Count modelSpace) 1))))
    (setq I 0)
    (while (>= (- (vla-get-Count modelSpace) 1) I)
        (vlax-safearray-put-element ssobjs I (vla-Item modelSpace I))
        (setq I (1+ I))
    )

    ;; Add the array of objects to the selection set
    (vla-AddItems ssetObj ssobjs)

    ;; List all the objects in the selection set
    (if (= (vla-get-Count ssetObj) 0)
        (alert "The selection set is empty")
        (progn
               (setq I 0)
               (while (>= (- (vla-get-Count ssetObj) 1) I)
                (alert (strcat "The selection set contains: " (vla-get-ObjectName (vla-Item ssetObj I))))
                (setq I (1+ I))
            )
           )
    )

    ;; Erase the objects in the selection set
    (vla-Erase ssetObj)

    ;; List all the objects in the selection set
    (if (= (vla-get-Count ssetObj) 0)
        (alert "The selection set is empty")
        (progn
               (setq I 0)
               (while (>= (- (vla-get-Count ssetObj) 1) I)
                (alert (strcat "The selection set contains: " (vla-get-ObjectName (vla-Item ssetObj I))))
            )
           )
    )
)


Eval Method (ActiveX)

Evaluates an expression in VBA.

Supported platforms: Windows only

Signature

VBA:

object.Eval Expression
object

Type: Application

The object this method applies to.

Expression

Access: Input-only

Type: String

The expression to be evaluated.

Return Value (RetVal)

No return value.

Remarks

This method allows Automation clients to execute a line of VBA code in the context of the current project without creating modules and functions.

Examples

VBA:

Sub Example_Eval()
    ' This example shows how to can use Eval to run a VBA code fragment
    ' without having to create a Module or procedure.

    Dim VBACode As String

    ' Create VBA code fragment
    VBACode = "MsgBox ""Simple code fragment"""

    ' Use Eval method to evaluate the small VBA script
    Eval VBACode
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Eval()
    ;; This example shows how to can use Eval to run a VBA code fragment
    ;; without having to create a Module or procedure.
    (setq acadObj (vlax-get-acad-object))

    ;; Create VBA code fragment
    (setq VBACode "MsgBox \"Simple code fragment\"")

    ;; Use Eval method to evaluate the small VBA script
    (vla-Eval acadObj VBACode)
)


Evaluate Method (ActiveX)

Evaluates the given hatch or leader.

Supported platforms: Windows only

Signature

VBA:

object.Evaluate
object

Type: Hatch, Leader

The objects this method applies to.

Return Value (RetVal)

No return value.

Remarks

Leader: Evaluates the relation of the leader to its associated annotation, and updates the leader geometry if necessary.

Hatch: Evaluates the hatch lines or solid fill for the Hatch object using the specified hatch pattern. For regular hatch patterns, this method performs intersection calculations between pattern definition lines and hatch boundary curves to form hatch lines. For solid fill hatch patterns, this method performs triangulation of the hatch area and fills in the triangular meshes with the given color.

Examples

VBA:

Sub Example_Evaluate()
    ' This example creates an associative hatch in model space.
    ' It uses the Evaluate method to calculate the hatch
    ' lines for the given boundary.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "ANSI31"
    PatternType = 0
    bAssociativity = True

    ' Create the associative Hatch object in model space
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)

    ' Create the outer boundary for the hatch. (a circle)
    Dim outerLoop(0 To 0) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 3: center(1) = 3: center(2) = 0
    radius = 1
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)

    ' Append the outerboundary to the hatch object, and display the hatch
    hatchObj.AppendOuterLoop (outerLoop)
    hatchObj.Evaluate
    ThisDrawing.Regen True

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Evaluate()
    ;; This example creates an associative hatch in model space.
    ;; It uses the Evaluate method to calculate the hatch
    ;; lines for the given boundary.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "ANSI31"
          patternType acHatchPatternTypePreDefined
          bAssociativity :vlax-true)

    ;; Create the associative Hatch object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acHatchObject))

    ;; Create the outer boundary for the hatch. (a circle)
    (setq center (vlax-3d-point 3 3 0)
          radius 1)

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element outerLoop 0 (vla-AddCircle modelSpace center radius))

    ;; Append the outerboundary to the hatch object, and display the hatch
    (vla-AppendOuterLoop hatchObj outerLoop)
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)
)


Explode Method (ActiveX)

Explodes the compound object into subentities.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.Explode
object

Type: 3DPolyline , BlockReference, ExternalReference, LWPolyline, MInsertBlock, PolygonMesh, Polyline, Region

The object this method applies to.

Return Value (RetVal)

Type: Variant (array of objects)

The array of exploded objects.

Remarks

Depending on the type of compound object you are exploding, different results occur. Refer to the EXPLODE command topic in the AutoCAD Command Reference for a detailed list of explodable objects and their results.

You do not have to explode a block in order to manipulate its constituent entities. All block definitions have an Item method that allow you to manipulate the entities within the block without exploding the block definition itself.

Examples

VBA:

Sub Example_Explode()
    ' This example creates a lightweight polyline in model space.
    ' It then explodes the polyline.

    Dim plineObj As AcadLWPolyline
    Dim points(0 To 11) As Double

    ' Define the 2D polyline points
    points(0) = 1: points(1) = 1
    points(2) = 1: points(3) = 2
    points(4) = 2: points(5) = 2
    points(6) = 3: points(7) = 2
    points(8) = 4: points(9) = 4
    points(10) = 4: points(11) = 1

    ' Create a lightweight Polyline object in model space
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)

    ' Set the bulge on one segment to vary the
    ' type of objects in the polyline
    plineObj.SetBulge 3, -0.5
    ZoomAll

    ' Explode the polyline
    MsgBox "Explode the polyline?", , "Explode Example"
    Dim explodedObjects As Variant
    explodedObjects = plineObj.Explode

    ' Loop through the exploded objects
    Dim I As Integer
    For I = 0 To UBound(explodedObjects)
        explodedObjects(I).Update
        MsgBox "Exploded Object " & I & ": " & explodedObjects(I).ObjectName, , "Explode Example"
        explodedObjects(I).Color = acByLayer
        explodedObjects(I).Update
    Next

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Explode()
    ;; This example creates a lightweight polyline in model space.
    ;; It then explodes the polyline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the 2D polyline points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 11)))
    (vlax-safearray-fill points '(1 1
                                              1 2
                                              2 2
                                              3 2
                                              4 4
                                              4 1
                                             )
    )

    ;; Create a lightweight Polyline object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Color plineObj acRed)

    ;; Set the bulge on one segment to vary the
    ;; type of objects in the polyline
    (vla-SetBulge plineObj 3 -0.5)
    (vla-ZoomAll acadObj)

    ;; Explode the polyline
    (alert "Explode the polyline?")
    (setq explodedObjects (vlax-variant-value (vla-Explode plineObj)))

    ;; Loop through the exploded objects
    (setq I 0)
    (while (>= (vlax-safearray-get-u-bound explodedObjects 1) I)
        (vla-Update (vlax-safearray-get-element explodedObjects I))
        (alert (strcat "Exploded Object " (itoa I) ": " (vla-get-ObjectName (vlax-safearray-get-element explodedObjects I))))
        (vla-put-Color (vlax-safearray-get-element explodedObjects I) acByLayer)
        (vla-Update (vlax-safearray-get-element explodedObjects I))
        (setq I (1+ I))
    )
)


Export Method (ActiveX)

Exports an AutoCAD drawing or a group of saved layer settings to a file.

Supported platforms: Windows only

Signature - Document

VBA:

object.Export FileName, Extension, SelectionSet
object

Type: Document

The object this method applies to.

FileName

Access: Input-only

Type: String

The name for the newly exported file.

Extension

Access: Input-only

Type: String

This string should contain three characters specifying the type of file to export the drawing into. Case is not important. Use one of the following extensions: .wmf, .sat, .eps, .dxf, or .bmp.

SelectionSet

Access: Input-only

Type: SelectionSet

For WMF, SAT, and BMP formats, the selection set specifies the objects to be exported. For EPS and DXF formats, the selection set is ignored and the entire drawing is exported.

Signature - LayerStateManager

VBA:

object.Export Name, FileName
object

Type: LayerStateManager

The object this method applies to.

Name

Access: Input-only

Type: String

The name of the saved layer settings you are exporting.

FileName

Access: Input-only

Type: String

The name of the file you are exporting layer settings to.

Return Value (RetVal)

No return value.

Remarks

When exporting to WMF or BMP formats, the selection set specifies the objects from the drawing to export. If an empty selection set is provided, the user is prompted to select objects. If Nothing is provided, not an empty selection set, the entire drawing is exported.

When exporting to SAT format, the selection set specified must contain one or more objects. This selection set specifies the objects from the drawing to export. Only Region objects, 3DSolid objects, non-manifold solids, and other ShapeManager entities that do not fit the characteristics of the 3DSolid or Region objects will be exported; all other objects in the selection set will be ignored. If an empty selection set is provided, the method is executed without an error and no objects are exported.

When exporting to EPS or DXF formats, the selection set is ignored and the entire drawing is exported.

When exporting saved layer settings, you must name your output file with a .las extension in order for AutoCAD to automatically identify it as a saved layer settings export file.

Examples

VBA:

Sub Example_Export()
    ' This example exports the current drawing to DXF format.
    ' Note that a valid selection set must be provided, even
    ' though the contents of the selection set are ignored.

    ' Define the name for the exported file
    Dim exportFile As String
    exportFile = "C:\AutoCAD\DXFExport"     ' Adjust path to match your system

    ' Create an empty selection set
    Dim sset As AcadSelectionSet
    Set sset = ThisDrawing.SelectionSets.Add("TEST")

    ' Export the current drawing to the file specified above.
    ThisDrawing.Export exportFile, "DXF", sset

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Export()
    ;; This example exports the current drawing to DXF format.
    ;; Note that a valid selection set must be provided, even
    ;; though the contents of the selection set are ignored.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the name for the exported file
    (setq exportFile "C:\\AutoCAD\\DXFExport")     ;; Adjust path to match your system

    ;; Create an empty selection set
    (setq sset (vla-Add (vla-get-SelectionSets doc) "TEST"))
    (vla-Select sset acSelectionSetAll)

    ;; Export the current drawing to the file specified above.
    (vla-Export doc exportFile "DXF" sset)

    (vla-Delete sset)
)


ExportProfile Method (ActiveX)

Exports the active profile so it can be shared with other users.

Supported platforms: Windows only

Signature

VBA:

object.ExportProfile Profile, RegFile
object

Type: PreferencesProfiles

The object this method applies to.

Profile

Access: Input-only

Type: String

The name of the profile to be exported.

RegFile

Access: Input-only

Type: String

The name of the file the profile will be exported to. The extension of the file should be .arg.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ExportProfile()
    ' This example exports the active profile to a new name.

    Dim preferences As AcadPreferences
    Dim currActiveProfile As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current ActiveProfile value
    currActiveProfile = preferences.Profiles.ActiveProfile
    MsgBox "The current ActiveProfile is: " & preferences.Profiles.ActiveProfile, , "ExportProfile Example"

    ' Export the active profile
    preferences.Profiles.ExportProfile currActiveProfile, "TestProfile.arg"
    MsgBox "The ActiveProfile has been exported to: TestProfile.arg", , "ExportProfile Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ExportProfile()
    ;; This example exports the active profile to a new name.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current ActiveProfile value
    (setq currActiveProfile (vla-get-ActiveProfile (vla-get-Profiles preferences)))
    (alert (strcat "The current ActiveProfile is: " currActiveProfile))

    ;; Export the active profile
    (vla-ExportProfile (vla-get-Profiles preferences) currActiveProfile "c:\\Temp\\TestProfile.arg")
    (alert "The ActiveProfile has been exported to: TestProfile.arg")
)


FieldCode Method (ActiveX)

Returns a text string containing field codes.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.FieldCode
object

Type: MText, Text

The objects this method applies to.

Return Value (RetVal)

Type: String

The field codes of the object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_FieldCode()
    ' This example creates a text object in model space.
    ' It then returns the field code string for the object.

    Dim textObj As AcadText
    Dim text As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double

    ' Define the text object
    text = "%<\AcVar Date \f ""M/d/yyyy""%>%"
    insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 0
    height = 0.5

    ' Create the text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(text, insertionPoint, height)
    ZoomAll

    ' Return the current text string for the object
    text = textObj.FieldCode
    MsgBox "The FieldCode for the text object equals: " & text, vbInformation, "FieldCode Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_FieldCode()
    ;; This example creates a text object in model space.
    ;; It then returns the field code string for the object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the text object
    (setq insertionPoint (vlax-3d-point 2 2 0)
          text "%<\\AcVar Date \\f \"M/d/yyyy\"%>%"
          height 0.5)

    ;; Create the text object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq textObj (vla-AddText modelSpace text insertionPoint height))
    (vla-ZoomAll acadObj)

    ;; Return the current text string for the object
    (setq text (vla-FieldCode textObj))
    (alert (strcat "The FieldCode for the text object equals: " text))
)


Float Method (ActiveX)

Floats the toolbar.

Supported platforms: Windows only

Signature

VBA:

object.Float Top, Left, NumberFloatRows
object

Type: Toolbar

The object this method applies to.

Top

Access: Input-only

Type: Long

The pixel location for the top edge of the toolbar.

Left

Access: Input-only

Type: Long

The pixel location for the left edge of the toolbar.

NumberFloatRows

Access: Input-only

Type: Long

The number of rows to create in the horizontal toolbar. The buttons on the toolbar will be distributed automatically across the number of rows designated.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Float()
    ' This example creates a new toolbar called "TestToolbar" and inserts three
    ' buttons into it. The toolbar is then displayed as a floating toolbar,
    ' and then as a docked toolbar.
    ' To remove the toolbar after execution of this macro, use the Customize Menu
    ' option from the Tools menu.

    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    ' Create the new toolbar
    Dim newToolBar As AcadToolbar
    Set newToolBar = currMenuGroup.Toolbars.Add("TestToolbar")

    ' Add three buttons to the new toolbar.
    ' All three buttons will have the same macro attached.
    Dim newButton1 As AcadToolbarItem
    Dim newButton2 As AcadToolbarItem
    Dim newButton3 As AcadToolbarItem
    Dim openMacro As String

    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set newButton1 = newToolBar.AddToolbarButton("", "NewButton1", "Open a file.", openMacro)
    Set newButton2 = newToolBar.AddToolbarButton("", "NewButton2", "Open a file.", openMacro)
    Set newButton3 = newToolBar.AddToolbarButton("", "NewButton3", "Open a file.", openMacro)

    ' Display the toolbar
    newToolBar.Visible = True

    ' Dock the toolbar to the left of the screen.
    newToolBar.Dock acToolbarDockLeft
    GoSub QUERYSTATUS

    ' Float the toolbar
    newToolBar.Float 200, 200, 1
    GoSub QUERYSTATUS

    Exit Sub

QUERYSTATUS:
    ' Query the toolbar to see if it is docked.
    If newToolBar.DockStatus = acToolbarFloating Then
        MsgBox "The toolbar is floating."
    Else
        MsgBox "The toolbar is docked."
    End If
    Return

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Float()
    ;; This example creates a new toolbar called "TestToolbar" and inserts three
    ;; buttons into it. The toolbar is then displayed as a floating toolbar,
    ;; and then as a docked toolbar.
    ;; To remove the toolbar after execution of this macro, use the Customize Menu
    ;; option from the Tools menu.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new toolbar
    (setq newToolBar (vla-Add (vla-get-Toolbars currMenuGroup) "TestToolbar"))

    ;; Add three buttons to the new toolbar.
    ;; All three buttons will have the same macro attached.
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))

    (setq newButton1 (vla-AddToolbarButton newToolBar "" "NewButton1" "Open a file." openMacro))
    (setq newButton2 (vla-AddToolbarButton newToolBar "" "NewButton2" "Open a file." openMacro))
    (setq newButton3 (vla-AddToolbarButton newToolBar "" "NewButton3" "Open a file." openMacro))

    ;; Display the toolbar
    (vla-put-Visible newToolBar :vlax-true)

    ;; Dock the toolbar to the left of the screen.
    (vla-Dock newToolBar acToolbarDockLeft)

    ;; Query the toolbar to see if it is docked.
    (if (= (vla-get-DockStatus newToolBar) acToolbarFloating)
        (alert "The toolbar is floating.")
        (alert "The toolbar is docked.")
    )

    ;; Float the toolbar
    (vla-Float newToolBar 200 200 1)

    (if (= (vla-get-DockStatus newToolBar) acToolbarFloating)
        (alert "The toolbar is floating.")
        (alert "The toolbar is docked.")
    )
)


FormatValue Method (ActiveX)

Gets the formatted text string for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.FormatValue(row, col, nOption, pVal)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Integer

The row number of the cell.

col

Access: Input-only

Type: Integer

The column number of the cell.

nOption

Access: Input-only

Type: AcFormatOption enum

The formatting option flag.

  • acForEditing
  • acForExpression
  • acIgnoreMtextFormat
  • acUseMaximumPrecision
  • kFormatOptionNone

Return Value (RetVal)

Type: String

The formatted text in the table.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GenerateLayout Method (ActiveX)

Generates the layout of a table.

Supported platforms: Windows only

Signature

VBA:

object.GenerateLayout
object

Type: Table

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

This method updates the Table object according to the current table style. This method computes the table geometry, including gridlines, text content, block content, and background fills.

Examples

VBA:

Not available

Visual LISP:

Not available


GenerateSectionGeometry Method (ActiveX)

Generates 2D or 3D section geometry.

Supported platforms: Windows only

Signature

VBA:

object.GenerateSectionGeometry pEntity, pIntersectionBoundaryObjs, pIntersectionFillObjs, pBackgroudnObjs, pForegroudObjs, pCurveTangencyObjs
object

Type: Section

The object this method applies to.

pEntity

Access: Input-only

Type: IAcadEntity

The sectionable entity.

pIntersectionBoundaryObjs

Access: Output-only

Type: Variant

The intersection boundary objects.

pIntersectionFillObjs

Access: Output-only

Type: Variant

The objects representing intersection fill annotation geometry.

pBackgroundObjs

Access: Output-only

Type: Variant

The background geometry objects.

pForegroundObjs

Access: Output-only

Type: Variant

The foreground geometry objects.

pCurveTangencyObjs

Access: Output-only

Type: Variant

The curve tangency geometry objects.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GenerateUsageData Method (ActiveX)

Generates data specifying whether a layer is in use.

Supported platforms: Windows only

Signature

VBA:

object.GenerateUsageData
object

Type: Layers

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GenerateUsageData()
    ' This example provides usage information for the layers
    ' in a drawing
    Dim MyLayers As AcadLayers
    Set MyLayers = ThisDrawing.Layers

    MyLayers.GenerateUsageData

    Dim MyLayerObj As AcadLayer
    For Each MyLayerObj In ThisDrawing.Layers
        MyLayerObj.Description = "Test"
        MsgBox (MyLayerObj.Used)
    Next MyLayerObj
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GenerateUsageData()
    ;; This example provides usage information for the layers
    ;; in a drawing
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq MyLayers (vla-get-Layers doc))
    (vla-GenerateUsageData MyLayers)

    (vlax-for MyLayerObj MyLayers
        (vla-put-Description MyLayerObj "Test")
        (alert (strcat "Layer " (vla-get-Name MyLayerObj) (if (= (vla-get-Used MyLayerObj) :vlax-true) " is used." " is not used.")))
    )
)


GetAcadState Method (ActiveX)

Gets an AcadState object to monitor the state of AutoCAD from out-of-process applications.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetAcadState()
object

Type: Application

The object this method applies to.

Return Value (RetVal)

Type: AcadState

An object containing an IsQuiescent property used to monitor the state of AutoCAD.

Remarks

It is recommended that you call this method immediately after acquiring the AutoCAD application object. This is the best opportunity to identify AutoCAD in a quiescent state.

Examples

VBA:

Sub Example_GetAcadState()
    ' This example gets the acadState object and checks to see if
    ' AutoCAD is in a quiescent state.
    Dim State As AcadState
    Set State = GetAcadState

    If State.IsQuiescent Then
        MsgBox "AutoCAD is quiescent."
    Else
        MsgBox "AutoCAD is not quiescent."
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetAcadState()
    ;; This example gets the acadState object and checks to see if
    ;; AutoCAD is in a quiescent state.
    (setq acadObj (vlax-get-acad-object))

    (setq State (vla-GetAcadState acadObj))
    (if (= (vla-get-IsQuiescent State) :vlax-true)
        (alert "AutoCAD is quiescent.")
        (alert "AutoCAD is not quiescent.")
    )
)


GetAlignment Method (ActiveX)

Returns the cell alignment for a row type.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetAlignment(rowType)
object

Type: Table, TableStyle

The objects this method applies to.

rowType

Access: Input-only

Type: AcRowType enum

The row type to get the alignment for.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow

Return Value (RetVal)

Type: AcCellAlignment enum

The alignment used for the row type.

  • acBottomCenter: Centers text at a point based on the bottom of the text.
  • acBottomLeft: Left-justifies text at a point based on the bottom of the text.
  • acBottomRight: Right-justifies text at a point based on the bottom of the text.
  • acMiddleCenter: Centers text at a point based on the middle of the text.
  • acMiddleLeft: Left-justifies text at a point based on the middle of the text.
  • acMiddleRight: Right-justifies text at a point based on the middle of the text.
  • acTopCenter: Centers text at a point based on the top of the text.
  • acTopLeft: Left-justifies text at a point based on the top of the text.
  • acTopRight: Right-justifies text at a point based on the top of the text.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetAlignment()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.FlowDirection = acTableBottomToTop
    customObj.HorzCellMargin = 0.22
    customObj.BitFlags = 1
    customObj.SetTextHeight AcRowType.acDataRow + AcRowType.acTitleRow, 1.3
    customObj.SetTextStyle AcRowType.acDataRow + AcRowType.acTitleRow, "Standard"

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 12, 23, 45
    customObj.SetBackgroundColor AcRowType.acDataRow + AcRowType.acTitleRow, col
    customObj.SetGridVisibility AcGridLineType.acHorzInside + AcGridLineType.acHorzTop _
                                , AcRowType.acDataRow + AcRowType.acTitleRow, True

    customObj.SetAlignment AcRowType.acDataRow + AcRowType.acTitleRow, acBottomRight
    col.SetRGB 244, 0, 0
    customObj.SetGridColor 3, 1, col

    MsgBox "Table Style Name = " & customObj.Name & vbCrLf & _
           "Style Description = " & customObj.Description & vbCrLf & _
           "Flow Direction = " & customObj.FlowDirection & vbCrLf & _
           "Horzontal Cell Margin = " & customObj.HorzCellMargin & vbCrLf & _
           "Bit Flags = " & customObj.BitFlags & vbCrLf & _
           "Title Row Text Height = " & customObj.GetTextHeight(acTitleRow) & vbCrLf & _
           "Title Row Text Style = " & customObj.GetTextStyle(acTitleRow) & vbCrLf & _
           "Grid Visibility for HorizontalBottom TitleRow  = " & customObj.GetGridVisibility(acHorzBottom, acTitleRow) & vbCrLf & _
           "Title Row Alignment = " & customObj.GetAlignment(acTitleRow) & vbCrLf & _
           "Header Suppression = " & customObj.HeaderSuppressed

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetAlignment()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-put-FlowDirection customObj acTableBottomToTop)
    (vla-put-HorzCellMargin customObj 0.22)
    (vla-put-BitFlags customObj 1)
    (vla-SetTextHeight customObj (+ acDataRow acTitleRow) 1.3)

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 12 23 45)

    (vla-SetBackgroundColor customObj (+ acDataRow acTitleRow) col)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) (+ acDataRow acTitleRow) :vlax-true)
    (vla-SetAlignment customObj (+ acDataRow acTitleRow) acBottomRight)
    (vla-SetRGB col 244 0 0)
    (vla-SetGridColor customObj (+ acHorzTop acHorzInside) acDataRow col)

    (alert (strcat "Table Style Name = " (vla-get-Name customObj)
                   "\nStyle Description = " (vla-get-Description customObj)
                   "\nFlow Direction = " (itoa (vla-get-FlowDirection customObj))
                   "\nHorzontal Cell Margin = " (rtos (vla-get-HorzCellMargin customObj) 2)
                   "\nBit Flags = " (itoa (vla-get-BitFlags customObj))
                   "\nTitle Row Text Height = " (rtos (vla-GetTextHeight customObj acTitleRow) 2)
                   "\nGrid Visibility for HorizontalBottom TitleRow  = " (if (= (vla-GetGridVisibility customObj acHorzBottom acTitleRow) :vlax-true) "True" "False")
                   "\nTitle Row Alignment = " (itoa (vla-GetAlignment customObj acTitleRow))
                      "\nHeader Suppression = " (if (= (vla-get-HeaderSuppressed customObj) :vlax-true) "True" "False")
              )
    )
    (vlax-release-object col)
)


GetAlignment2 Method (ActiveX)

Gets the cell alignment.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetAlignment2(bstrCellStyle)
object

Type: TableStyle

The object this method applies to.

bstrCellStyle

Access: Input-only

Type: String

The cell style to check.

Return Value (RetVal)

Type: AcCellAlignment enum

The alignment used for the cell style.

  • acBottomCenter: Centers text at a point based on the bottom of the text.
  • acBottomLeft: Left-justifies text at a point based on the bottom of the text.
  • acBottomRight: Right-justifies text at a point based on the bottom of the text.
  • acMiddleCenter: Centers text at a point based on the middle of the text.
  • acMiddleLeft: Left-justifies text at a point based on the middle of the text.
  • acMiddleRight: Right-justifies text at a point based on the middle of the text.
  • acTopCenter: Centers text at a point based on the top of the text.
  • acTopLeft: Left-justifies text at a point based on the top of the text.
  • acTopRight: Right-justifies text at a point based on the top of the text.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetAlignment2()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.FlowDirection = acTableBottomToTop
    customObj.HorzCellMargin = 0.22
    customObj.BitFlags = 1
    customObj.SetTextHeight AcRowType.acDataRow + AcRowType.acTitleRow, 1.3
    customObj.SetTextStyle AcRowType.acDataRow + AcRowType.acTitleRow, "Standard"

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 12, 23, 45
    customObj.SetBackgroundColor AcRowType.acDataRow + AcRowType.acTitleRow, col
    customObj.SetGridVisibility AcGridLineType.acHorzInside + AcGridLineType.acHorzTop _
                                , AcRowType.acDataRow + AcRowType.acTitleRow, True

    customObj.CreateCellStyle "NewCellStyle"
    customObj.SetAlignment2 "NewCellStyle", acBottomRight

    col.SetRGB 244, 0, 0
    customObj.SetGridColor 3, 1, col

    MsgBox "Table Style Name = " & customObj.Name & vbCrLf & _
           "Style Description = " & customObj.Description & vbCrLf & _
           "Flow Direction = " & customObj.FlowDirection & vbCrLf & _
           "Horzontal Cell Margin = " & customObj.HorzCellMargin & vbCrLf & _
           "Bit Flags = " & customObj.BitFlags & vbCrLf & _
           "Title Row Text Height = " & customObj.GetTextHeight(acTitleRow) & vbCrLf & _
           "Title Row Text Style = " & customObj.GetTextStyle(acTitleRow) & vbCrLf & _
           "Grid Visibility for HorizontalBottom TitleRow  = " & customObj.GetGridVisibility(acHorzBottom, acTitleRow) & vbCrLf & _
           "Title Row Alignment = " & customObj.GetAlignment2("NewCellStyle") & vbCrLf & _
           "Header Suppression = " & customObj.HeaderSuppressed

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetAlignment2()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-put-FlowDirection customObj acTableBottomToTop)
    (vla-put-HorzCellMargin customObj 0.22)
    (vla-put-BitFlags customObj 1)
    (vla-SetTextHeight customObj (+ acDataRow acTitleRow) 1.3)
    (vla-SetTextStyle customObj (+ acDataRow acTitleRow) "Standard")

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 12 23 45)

    (vla-SetBackgroundColor customObj (+ acDataRow acTitleRow) col)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) (+ acDataRow acTitleRow) :vlax-true)
    (vla-SetAlignment customObj (+ acDataRow acTitleRow) acBottomRight)

    (vla-CreateCellStyle customObj "NewCellStyle")
    (vla-SetAlignment2 customObj "NewCellStyle" acBottomRight)

    (vla-SetRGB col 244 0 0)
    (vla-SetGridColor customObj (+ acHorzTop acHorzInside) acDataRow col)

    (alert (strcat "Table Style Name = " (vla-get-Name customObj)
                   "\nStyle Description = " (vla-get-Description customObj)
                   "\nFlow Direction = " (itoa (vla-get-FlowDirection customObj))
                   "\nHorzontal Cell Margin = " (rtos (vla-get-HorzCellMargin customObj) 2)
                   "\nBit Flags = " (itoa (vla-get-BitFlags customObj))
                   "\nTitle Row Text Height = " (rtos (vla-GetTextHeight customObj acTitleRow) 2)
                   "\nTitle Row Text Style = " (vla-GetTextStyle customObj acTitleRow)
                   "\nGrid Visibility for HorizontalBottom TitleRow  = " (if (= (vla-GetGridVisibility customObj acHorzBottom acTitleRow) :vlax-true) "True" "False")
                   "\nCell Style Alignment = " (itoa (vla-GetAlignment2 customObj "NewCellStyle"))
                      "\nHeader Suppression = " (if (= (vla-get-HeaderSuppressed customObj) :vlax-true) "True" "False")
              )
    )
    (vlax-release-object col)
)


GetAllProfileNames Method (ActiveX)

Gets all available profiles for the system.

Supported platforms: Windows only

Signature

VBA:

object.GetAllProfileNames pNames
object

Type: PreferencesProfiles

The object this method applies to.

pNames

Access: Output-only

Type: Variant (array of strings)

The array of available profile names for the system.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetAllProfileNames()
    ' This example gets all the profiles available for the system.

    Dim systemProfiles As Variant
    AcadApplication.Preferences.Profiles.GetAllProfileNames systemProfiles

    ' List all the profiles for the system
    Dim x As Integer
    Dim msg As String
    msg = ""
    For x = LBound(systemProfiles) To UBound(systemProfiles)
        msg = msg & systemProfiles(x) & vbCrLf
    Next
    MsgBox msg, vbInformation, "Available Profiles"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetAllProfileNames()
    ;; This example gets all the profiles available for the system.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Use the PreferencesProfiles object
    (setq systemProfiles "")
    (vla-GetAllProfileNames (vla-get-Profiles preferences) 'systemProfiles)

    ;; List all the profiles for the system
    (setq x 0
          msg "")
    (while (>= (vlax-safearray-get-u-bound systemProfiles 1) x)
        (setq msg (strcat msg (vlax-safearray-get-element systemProfiles x) "\n"))
        (setq x (1+ x))
    )
    (alert msg)
)


GetAngle Method (ActiveX)

Gets the angle specified. Considers the setting of the ANGBASE system variable.

Supported platforms: Windows only

Signature

VBA:

RetVal = GetAngle([Point] [, Prompt])
object

Type: Utility

The object this method applies to.

Point

Access: Input-only; optional

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the first point.

Prompt

Access: Input-only; optional

Type: Variant (string)

The text used to prompt the user for input.

Return Value (RetVal)

Type: Double

The angle specified.

Remarks

AutoCAD pauses for user input of an angle and sets the return value to the value of the selected angle. The Point parameter specifies an angle base point in the two-dimensional WCS. The Prompt parameter specifies a string that AutoCAD displays before it pauses. Both Point and Prompt are optional.

The AutoCAD user can specify the angle by entering a number in the current angular units format. The user can set the angle also by specifying two 2D locations on the graphics screen. AutoCAD draws a rubber-band line from the first point to the current crosshair position to help the user visualize the angle. If the Point parameter is provided, AutoCAD uses this value as the first of the two points. The angle is measured in the XY plane of the WCS (GetAngle ignores the Z field of Point).

Regardless of the method used to specify the angle, GetAngle always sets the return value to a value expressed in radians. The direction of angular increase is always counterclockwise.

This function is almost identical to GetOrientation, but it takes into account the current value of the ANGBASE system variable. For GetOrientation, the zero angle is always to the right: "east" or "three o'clock." For GetAngle, the zero angle is the value of ANGBASE, which can be set to any of the four 90-degree quadrants. Both GetAngle and GetOrientation return a (real) angle value in radians measured counterclockwise from a base (zero) angle. For GetAngle, the base equals ANGBASE; for GetOrientation, the base is at the right. Both functions honor the current value of ANGDIR, which affects the value the user enters but not the value that these functions return.

User input (degrees) | GetAngle returns | GetOrientation returns
0 | 0.0 | 1.5708
-90 | 1.5708 | 3.14159
180 | 3.14159 | 4.71239
90 | 4.71239 | 0.0

You can use GetAngle to obtain a rotation amount for a block insertion, because an input of 0 degrees always returns 0 radians. You can use GetOrientation to obtain the baseline angle for a text entity to be aligned with other objects.

If a keyword is returned instead of an angle, AutoCAD will generate the error message "User input keyword." Use the GetInput method to obtain the keyword from the return value.

Examples

VBA:

Sub Example_GetAngle()
    ' This example demonstrates 4 different ways to retrieve
    ' an angle from the user using the GetAngle method.

    AppActivate ThisDrawing.Application.Caption

    Dim retAngle As Double

    ' Return the angle in radians with a prompt
    retAngle = ThisDrawing.Utility.GetAngle(, "Enter an angle: ")
    MsgBox "The angle entered was " & retAngle, , "GetAngle Example"

    ' Return the angle in radians without any prompt
    retAngle = ThisDrawing.Utility.GetAngle()
    MsgBox "The angle entered was " & retAngle, , "GetAngle Example"

    ' Return the angle in radians with a prompt and an angle base point
    Dim basePnt(0 To 2) As Double
    basePnt(0) = 2#: basePnt(1) = 2#: basePnt(2) = 0#
    retAngle = ThisDrawing.Utility.GetAngle(basePnt, "Enter an angle: ")
    MsgBox "The angle entered was " & retAngle, , "GetAngle Example"

    ' Return the angle in radians with an angle base point but no prompt
    retAngle = ThisDrawing.Utility.GetAngle(basePnt)
    MsgBox "The angle entered was " & retAngle, , "GetAngle Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetAngle()
    ;; This example demonstrates 4 different ways to retrieve
    ;; an angle from the user using the GetAngle method.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Return the angle in radians with a prompt
    (setq retAngle (vla-GetAngle (vla-get-Utility doc) nil "\nEnter an angle: "))
    (alert (strcat "The angle entered was " (rtos retAngle 2)))

    ;; Return the angle in radians without any prompt
    (setq retAngle (vla-GetAngle (vla-get-Utility doc)))
    (alert (strcat "The angle entered was " (rtos retAngle 2)))

    ;; Return the angle in radians with a prompt and an angle base point
    (setq basePnt (vlax-3d-point 2 2 0))
    (setq retAngle (vla-GetAngle (vla-get-Utility doc) basePnt "\nEnter an angle: "))
    (alert (strcat "The angle entered was " (rtos retAngle 2)))

    ;; Return the angle in radians with an angle base point but no prompt
    (setq retAngle (vla-GetAngle (vla-get-Utility doc) basePnt))
    (alert (strcat "The angle entered was " (rtos retAngle 2)))
)


GetAttachmentPoint Method (ActiveX)

Returns the attachment point for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetAttachmentPoint(row, col)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row of the table.

col

Access: Input-only

Type: Long

The column of the table.

Return Value (RetVal)

Type: AcAttachmentPoint enum

  • acAttachmentPointBottomCenter
  • acAttachmentPointBottomLeft
  • acAttachmentPointBottomRight
  • acAttachmentPointMiddleCenter
  • acAttachmentPointMiddleLeft
  • acAttachmentPointMiddleRight
  • acAttachmentPointTopCenter
  • acAttachmentPointTopLeft
  • acAttachmentPointTopRight

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetAttributes Method (ActiveX)

Gets the attributes in the block reference.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetAttributes
object

Type: BlockReference, ExternalReference, MInsertBlock

The object this method applies to.

Return Value (RetVal)

Type: Variant (array of AttributeReference objects)

The array of AttributeReference objects.

Remarks

This method returns an array of editable attribute references attached to the block reference.

You can only return the constant attributes for an external reference. To find the constant attributes of an external reference or block reference, use the GetConstantAttributes method.

Examples

VBA:

Sub Example_GetAttributes()
    ' This example creates a block. It then adds attributes to that
    ' block. The block is then inserted into the drawing to create
    ' a block reference.

    ' Create the block
    Dim blockObj As AcadBlock
    Dim insertionPnt(0 To 2) As Double
    insertionPnt(0) = 0#: insertionPnt(1) = 0#: insertionPnt(2) = 0#
    Set blockObj = ThisDrawing.Blocks.Add(insertionPnt, "TESTBLOCK")

    ' Define the attribute definition
    Dim attributeObj As AcadAttribute
    Dim height As Double
    Dim mode As Long
    Dim prompt As String
    Dim insertionPoint(0 To 2) As Double
    Dim tag As String
    Dim value As String
    height = 1#
    mode = acAttributeModeVerify
    prompt = "Attribute Prompt"
    insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0
    tag = "Attribute_Tag"
    value = "Attribute Value"

    ' Create the attribute definition object in model space
    Set attributeObj = blockObj.AddAttribute(height, mode, prompt, insertionPoint, tag, value)

    ' Insert the block
    Dim blockRefObj As AcadBlockReference
    insertionPnt(0) = 2#: insertionPnt(1) = 2#: insertionPnt(2) = 0
    Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, "TESTBLOCK", 1#, 1#, 1#, 0)
    ZoomAll

    ' Get the attributes for the block reference
    Dim varAttributes As Variant
    varAttributes = blockRefObj.GetAttributes

    ' Move the attribute tags and values into a string to be displayed in a Msgbox
    Dim strAttributes As String
    Dim I As Integer
    For I = LBound(varAttributes) To UBound(varAttributes)
        strAttributes = strAttributes & vbLf & "  Tag: " & varAttributes(I).TagString & _
                        vbLf & "  Value: " & varAttributes(I).TextString & vbLf & "    "
    Next
    MsgBox "The attributes for blockReference " & blockRefObj.Name & " are: " & strAttributes, , "GetAttributes Example"

    ' Change the value of the attribute
    ' Note: There is no SetAttributes. Once you have the variant array, you have the objects.
    ' Changing them changes the objects in the drawing.
    varAttributes(0).TextString = "NEW VALUE!"

    ' Get the attributes
    Dim newvarAttributes As Variant
    newvarAttributes = blockRefObj.GetAttributes

    ' Again, display the tags and values
    strAttributes = ""
    For I = LBound(varAttributes) To UBound(varAttributes)
        strAttributes = strAttributes & vbLf & "  Tag: " & varAttributes(I).TagString & _
                        vbLf & "  Value: " & varAttributes(I).TextString & vbLf & "    "
    Next
    MsgBox "The attributes for blockReference " & blockRefObj.Name & " are: " & strAttributes, , "GetAttributes Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetAttributes()
    ;; This example creates a block. It then adds attributes to that
    ;; block. The block is then inserted into the drawing to create
    ;; a block reference.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the block
    (setq insertionPnt (vlax-3d-point 0 0 0))
    (setq blockObj (vla-Add (vla-get-Blocks doc) insertionPnt "TESTBLOCK"))

    ;; Define the attribute definition
    (setq attHeight 1
          attMode acAttributeModeVerify
          attPrompt "Attribute Prompt"
          attTag "Attribute_Tag"
          attValue "Attribute Value"
          insertionPoint (vlax-3d-point 5 5 0))

    ;; Create the attribute definition object in model space
    (setq attributeObj (vla-AddAttribute blockObj attHeight attMode attPrompt insertionPoint attTag attValue))

    ;; Insert the block
    (setq insertionPnt (vlax-3d-point 2 2 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq blockRefObj (vla-InsertBlock modelSpace insertionPnt "TESTBLOCK" 1 1 1 0))
    (vla-ZoomAll acadObj)

    ;; Get the attributes for the block reference
    (setq varAttributes (vlax-variant-value (vla-GetAttributes blockRefObj)))

    ;; Move the attribute tags and values into a string to be displayed in a Msgbox
    (setq strAttributes ""
          I 0)
    (while (>= (vlax-safearray-get-u-bound varAttributes 1) I)
        (setq strAttributes (strcat strAttributes "\n  Tag: " (vla-get-TagString (vlax-safearray-get-element varAttributes I))
                                                  "\n  Value: " (vla-get-TextString (vlax-safearray-get-element varAttributes I)) "\n"))
        (setq I (1+ I))
    )

    (alert (strcat "The attributes for blockReference " (vla-get-Name blockRefObj) " are: " strAttributes))

    ;; Change the value of the attribute
    ;; Note: There is no SetAttributes. Once you have the variant array, you have the objects.
    ;; Changing them changes the objects in the drawing.
    (vla-put-TextString (vlax-safearray-get-element varAttributes 0) "NEW VALUE!")

    ;; Get the attributes
    (setq newvarAttributes (vlax-variant-value (vla-GetAttributes blockRefObj)))

    ;; Again, display the tags and values
    (setq strAttributes ""
          I 0)
    (while (>= (vlax-safearray-get-u-bound varAttributes 1) I)
        (setq strAttributes (strcat strAttributes "\n  Tag: " (vla-get-TagString (vlax-safearray-get-element varAttributes I))
                                                  "\n  Value: " (vla-get-TextString (vlax-safearray-get-element varAttributes I)) "\n"))
        (setq I (1+ I))
    )
    (alert (strcat "The attributes for blockReference " (vla-get-Name blockRefObj) " are: " strAttributes))
)


GetAutoScale Method (ActiveX)

Returns the value specifying whether auto scale is used in the specified row and column.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetAutoScale(row, col)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row in the table.

col

Access: Input-only

Type: Long

The column in the table.

Return Value (RetVal)

Type: Boolean

  • True: AutoScale is used in the cell location.
  • False: AutoScale is not used in the cell location.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetAutoScale2 Method (ActiveX)

Gets the auto scale flag value for a cell.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetAutoScale2(nRow, nCol, nContent)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value for the cell.

Return Value (RetVal)

Type: Boolean

  • True: AutoScale is used for the content with the index at the cell location.
  • False: AutoScale is not used for the content with the index at the cell location.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetBackgroundColor Method (ActiveX)

Returns the background color value for the specified row type.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetBackgroundColor(rowType)
object

Type: Table, TableStyle

The objects this method applies to.

rowType

Access: Input-only

Type: AcRowType enum

The row type.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow

Return Value (RetVal)

Type: AcCmColor

The AutoCAD true color object assigned to the background color of the row type.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetBackgroundColor()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Get the current TableStyle object
    Dim tableStyle As AcadTableStyle
    Set tableStyle = dictObj.Item(ThisDrawing.GetVariable("CTABLESTYLE"))

    Dim colCurrent As AcadAcCmColor, colRowCurrent As AcadAcCmColor, colNoneCurrent As Boolean
    Set colCurrent = tableStyle.GetBackgroundColor(AcRowType.acDataRow + AcRowType.acTitleRow)
    Set colRowCurrent = tableStyle.GetColor(acDataRow)
    colNoneCurrent = tableStyle.GetBackgroundColorNone(AcRowType.acHeaderRow)

    MsgBox "Table colors " & vbLf & _
           "Background ACI value = " & colCurrent.ColorIndex & vbLf & _
           "Row Text ACI value = " & colRowCurrent.ColorIndex & vbLf & _
           "Background None = " & colNoneCurrent

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 0, 0, 255
    tableStyle.SetBackgroundColor AcRowType.acTitleRow, col
    col.SetRGB 255, 0, 0
    tableStyle.SetColor AcRowType.acDataRow, col
    If colNoneCurrent = False Then
        tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, True
    Else
        tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, False
    End If

    Dim colNew As AcadAcCmColor, colRowNew As AcadAcCmColor, colNoneNew As Boolean
    Set colNew = tableStyle.GetBackgroundColor(AcRowType.acTitleRow)
    Set colRowNew = tableStyle.GetColor(acDataRow)
    colNoneNew = tableStyle.GetBackgroundColorNone(acHeaderRow)

    MsgBox "Table colors " & vbLf & _
           "Background ACI value = " & colNew.ColorIndex & vbLf & _
           "Row Text ACI value = " & colRowNew.ColorIndex & vbLf & _
           "Background None = " & colNoneNew

    tableStyle.SetBackgroundColor AcRowType.acTitleRow, colCurrent
    tableStyle.SetColor AcRowType.acDataRow, colRowCurrent
    tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, colNoneCurrent

    MsgBox "Reset the table style back to its original values."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetBackgroundColor()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Get the current TableStyle object
    (setq tableStyle (vla-Item dictObj (vla-GetVariable doc "CTABLESTYLE")))

    (setq colCurrent (vla-GetBackgroundColor tableStyle (+ acDataRow acTitleRow)))
    (setq colRowCurrent (vla-GetColor tableStyle acDataRow))
    (setq colNoneCurrent (vla-GetBackgroundColorNone tableStyle acHeaderRow))

    (alert (strcat "Table colors \n"
                         "Background ACI value = " (itoa (vla-get-ColorIndex colCurrent)) "\n"
                         "Row Text ACI value = " (itoa (vla-get-ColorIndex colRowCurrent)) "\n"
                         "Background None = " (if (= colNoneCurrent :vlax-true) "True" "False")))

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 0 0 255)
    (vla-SetBackgroundColor tableStyle acTitleRow col)
    (vla-SetRGB col 255 0 0)
    (vla-SetColor tableStyle acDataRow col)
    (vla-SetBackgroundColorNone tableStyle acHeaderRow (if (= colNoneCurrent :vlax-true) :vlax-false :vlax-true))

    (setq colNew (vla-GetBackgroundColor tableStyle acTitleRow))
    (setq colRowNew (vla-GetColor tableStyle acDataRow))
    (setq colNoneNew (vla-GetBackgroundColorNone tableStyle acHeaderRow))
    (alert (strcat "Table colors \n"
                         "Background ACI value = " (itoa (vla-get-ColorIndex colNew)) "\n"
                         "Row Text ACI value = " (itoa (vla-get-ColorIndex colRowNew)) "\n"
                         "Background None = " (if (= colNoneNew :vlax-true) "True" "False")))

    (vla-SetBackgroundColor tableStyle acTitleRow colCurrent)
    (vla-SetColor tableStyle acDataRow colRowCurrent)
    (vla-SetBackgroundColorNone tableStyle acHeaderRow colNoneCurrent)

    (alert "Reset the table style back to its original values.")

    (vlax-release-object col)
)


GetBackgroundColor2 Method (ActiveX)

Returns the background color value for the specified cell style.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetBackgroundColor2(bstrCellStyle)
object

Type: TableStyle

The object this method applies to.

bstrCellStyle

Access: Input-only

Type: String

The cell style name.

Return Value (RetVal)

Type: AcCmColor

The AutoCAD true color object assigned to the background color of the cell style.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetBackgroundColor()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Get the current TableStyle object
    Dim tableStyle As AcadTableStyle
    Set tableStyle = dictObj.Item(ThisDrawing.GetVariable("CTABLESTYLE"))

    Dim colCurrent As AcadAcCmColor, colRowCurrent As AcadAcCmColor, colNoneCurrent As Boolean
    Set colCurrent = tableStyle.GetBackgroundColor(AcRowType.acDataRow + AcRowType.acTitleRow)
    Set colRowCurrent = tableStyle.GetColor(acDataRow)
    colNoneCurrent = tableStyle.GetBackgroundColorNone(AcRowType.acHeaderRow)

    MsgBox "Table colors " & vbLf & _
           "Background ACI value = " & colCurrent.ColorIndex & vbLf & _
           "Row Text ACI value = " & colRowCurrent.ColorIndex & vbLf & _
           "Background None = " & colNoneCurrent

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 0, 0, 255
    tableStyle.SetBackgroundColor AcRowType.acTitleRow, col
    col.SetRGB 255, 0, 0
    tableStyle.SetColor AcRowType.acDataRow, col
    If colNoneCurrent = False Then
        tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, True
    Else
        tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, False
    End If

    Dim colNew As AcadAcCmColor, colRowNew As AcadAcCmColor, colNoneNew As Boolean
    Set colNew = tableStyle.GetBackgroundColor(AcRowType.acTitleRow)
    Set colRowNew = tableStyle.GetColor(acDataRow)
    colNoneNew = tableStyle.GetBackgroundColorNone(acHeaderRow)

    MsgBox "Table colors " & vbLf & _
           "Background ACI value = " & colNew.ColorIndex & vbLf & _
           "Row Text ACI value = " & colRowNew.ColorIndex & vbLf & _
           "Background None = " & colNoneNew

    tableStyle.SetBackgroundColor AcRowType.acTitleRow, colCurrent
    tableStyle.SetColor AcRowType.acDataRow, colRowCurrent
    tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, colNoneCurrent

    MsgBox "Reset the table style back to its original values."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetBackgroundColor()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Get the current TableStyle object
    (setq tableStyle (vla-Item dictObj (vla-GetVariable doc "CTABLESTYLE")))

    (setq colCurrent (vla-GetBackgroundColor tableStyle (+ acDataRow acTitleRow)))
    (setq colRowCurrent (vla-GetColor tableStyle acDataRow))
    (setq colNoneCurrent (vla-GetBackgroundColorNone tableStyle acHeaderRow))

    (alert (strcat "Table colors \n"
                         "Background ACI value = " (itoa (vla-get-ColorIndex colCurrent)) "\n"
                         "Row Text ACI value = " (itoa (vla-get-ColorIndex colRowCurrent)) "\n"
                         "Background None = " (if (= colNoneCurrent :vlax-true) "True" "False")))

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 0 0 255)
    (vla-SetBackgroundColor tableStyle acTitleRow col)
    (vla-SetRGB col 255 0 0)
    (vla-SetColor tableStyle acDataRow col)
    (vla-SetBackgroundColorNone tableStyle acHeaderRow (if (= colNoneCurrent :vlax-true) :vlax-false :vlax-true))

    (setq colNew (vla-GetBackgroundColor tableStyle acTitleRow))
    (setq colRowNew (vla-GetColor tableStyle acDataRow))
    (setq colNoneNew (vla-GetBackgroundColorNone tableStyle acHeaderRow))
    (alert (strcat "Table colors \n"
                         "Background ACI value = " (itoa (vla-get-ColorIndex colNew)) "\n"
                         "Row Text ACI value = " (itoa (vla-get-ColorIndex colRowNew)) "\n"
                         "Background None = " (if (= colNoneNew :vlax-true) "True" "False")))

    (vla-SetBackgroundColor tableStyle acTitleRow colCurrent)
    (vla-SetColor tableStyle acDataRow colRowCurrent)
    (vla-SetBackgroundColorNone tableStyle acHeaderRow colNoneCurrent)

    (alert "Reset the table style back to its original values.")

    (vlax-release-object col)
)


GetBackgroundColorNone Method (ActiveX)

Returns the value specifying that there is no background color for the specified row type.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetBackgroundColorNone(rowType)
object

Type: Table, TableStyle

The objects this method applies to.

rowType

Access: Input-only

Type: AcRowType enum

The row type.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow

Return Value (RetVal)

Type: Boolean

  • True: Background color is applied to the row type.
  • False: Background color is not applied to the row type.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetBackgroundColorNone()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Get the current TableStyle object
    Dim tableStyle As AcadTableStyle
    Set tableStyle = dictObj.Item(ThisDrawing.GetVariable("CTABLESTYLE"))

    Dim colCurrent As AcadAcCmColor, colRowCurrent As AcadAcCmColor, colNoneCurrent As Boolean
    Set colCurrent = tableStyle.GetBackgroundColor(AcRowType.acDataRow + AcRowType.acTitleRow)
    Set colRowCurrent = tableStyle.GetColor(acDataRow)
    colNoneCurrent = tableStyle.GetBackgroundColorNone(AcRowType.acHeaderRow)

    MsgBox "Table colors " & vbLf & _
           "Background ACI value = " & colCurrent.ColorIndex & vbLf & _
           "Row Text ACI value = " & colRowCurrent.ColorIndex & vbLf & _
           "Background None = " & colNoneCurrent

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 0, 0, 255
    tableStyle.SetBackgroundColor AcRowType.acTitleRow, col
    col.SetRGB 255, 0, 0
    tableStyle.SetColor AcRowType.acDataRow, col
    If colNoneCurrent = False Then
        tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, True
    Else
        tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, False
    End If

    Dim colNew As AcadAcCmColor, colRowNew As AcadAcCmColor, colNoneNew As Boolean
    Set colNew = tableStyle.GetBackgroundColor(AcRowType.acTitleRow)
    Set colRowNew = tableStyle.GetColor(acDataRow)
    colNoneNew = tableStyle.GetBackgroundColorNone(acHeaderRow)

    MsgBox "Table colors " & vbLf & _
           "Background ACI value = " & colNew.ColorIndex & vbLf & _
           "Row Text ACI value = " & colRowNew.ColorIndex & vbLf & _
           "Background None = " & colNoneNew

    tableStyle.SetBackgroundColor AcRowType.acTitleRow, colCurrent
    tableStyle.SetColor AcRowType.acDataRow, colRowCurrent
    tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, colNoneCurrent

    MsgBox "Reset the table style back to its original values."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetBackgroundColorNone()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Get the current TableStyle object
    (setq tableStyle (vla-Item dictObj (vla-GetVariable doc "CTABLESTYLE")))

    (setq colCurrent (vla-GetBackgroundColor tableStyle (+ acDataRow acTitleRow)))
    (setq colRowCurrent (vla-GetColor tableStyle acDataRow))
    (setq colNoneCurrent (vla-GetBackgroundColorNone tableStyle acHeaderRow))

    (alert (strcat "Table colors \n"
                         "Background ACI value = " (itoa (vla-get-ColorIndex colCurrent)) "\n"
                         "Row Text ACI value = " (itoa (vla-get-ColorIndex colRowCurrent)) "\n"
                         "Background None = " (if (= colNoneCurrent :vlax-true) "True" "False")))

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 0 0 255)
    (vla-SetBackgroundColor tableStyle acTitleRow col)
    (vla-SetRGB col 255 0 0)
    (vla-SetColor tableStyle acDataRow col)
    (vla-SetBackgroundColorNone tableStyle acHeaderRow (if (= colNoneCurrent :vlax-true) :vlax-false :vlax-true))

    (setq colNew (vla-GetBackgroundColor tableStyle acTitleRow))
    (setq colRowNew (vla-GetColor tableStyle acDataRow))
    (setq colNoneNew (vla-GetBackgroundColorNone tableStyle acHeaderRow))
    (alert (strcat "Table colors \n"
                         "Background ACI value = " (itoa (vla-get-ColorIndex colNew)) "\n"
                         "Row Text ACI value = " (itoa (vla-get-ColorIndex colRowNew)) "\n"
                         "Background None = " (if (= colNoneNew :vlax-true) "True" "False")))

    (vla-SetBackgroundColor tableStyle acTitleRow colCurrent)
    (vla-SetColor tableStyle acDataRow colRowCurrent)
    (vla-SetBackgroundColorNone tableStyle acHeaderRow colNoneCurrent)

    (alert "Reset the table style back to its original values.")

    (vlax-release-object col)
)


GetBitmaps Method (ActiveX)

Gets the large and small bitmaps used as icons for the toolbar item.

Supported platforms: Windows only

Signature

VBA:

object.GetBitmaps SmallIconName, LargeIconName
object

Type: ToolbarItem

The object this method applies to.

SmallIconName

Access: Output-only

Type: String

The path and file name for the small bitmap.

LargeIconName

Access: Output-only

Type: String

The path and file name for the large bitmap.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetBitmaps()
    ' This example uses MenuGroups to obtain a reference to the AutoCAD main menu.
    ' It then creates a new Toolbar (TestMenu) and inserts a ToolBarButton
    ' with a custom icon into it. The menu is automatically shown.
    '
    ' * NOTE: The paths of the icons for the new toolbar should be updated
    ' before running this example.

    Dim currMenuGroup As acadMenuGroup
    Dim newToolBar As AcadToolbar, newToolBarButton As AcadToolbarItem
    Dim openMacro As String
    Dim SmallBitmapName  As String, LargeBitmapName  As String

    On Error GoTo ERRORTRAP

    ' Use MenuGroups property to obtain reference to main AutoCAD menu
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item("ACAD")

    ' Create the new Toolbar in this group
    Set newToolBar = currMenuGroup.Toolbars.Add("TestMenu")

    ' Add an item to the new Toolbar and assign an Open macro
    ' (VBA equivalent of: "ESC ESC _open ")
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)
    Set newToolBarButton = newToolBar.AddToolbarButton(newToolBar.count + 1, "Open", "Open Macro", openMacro, False)

    ' Read icon paths for this Toolbar button
    GoSub READPATHS

    ' Change the default icon (smile face) for the new toolbar button
    SmallBitmapName = "c:\AutoCAD\16x16.bmp"     ' Use a 16x16 pixel .BMP image
    LargeBitmapName = "c:\AutoCAD\32x32.bmp"     ' Use a 32x32 pixel .BMP image
    newToolBarButton.SetBitmaps SmallBitmapName, LargeBitmapName

    ' Read icon paths for this Toolbar button
    GoSub READPATHS

    Exit Sub

READPATHS:
    ' Read icon paths for this Toolbar button
    newToolBarButton.GetBitmaps SmallBitmapName, LargeBitmapName
    MsgBox "The new Toolbar uses the following icon files: " & _
           vbCrLf & vbCrLf & "Small Bitmap: " & SmallBitmapName & vbCrLf & _
           "Large Bitmap: " & LargeBitmapName

    Return

ERRORTRAP:
    MsgBox "The following error has occurred: " & Err.Description
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetBitmaps()
    ;; This example uses MenuGroups to obtain a reference to the AutoCAD main menu.
    ;; It then creates a new Toolbar (TestMenu) and inserts a ToolBarButton
    ;; with a custom icon into it. The menu is automatically shown.
    ;;
    ;; * NOTE: The paths of the icons for the new toolbar should be updated
    ;; before running this example.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new Toolbar in this group
    (setq newToolBar (vla-Add (vla-get-Toolbars currMenuGroup) "TestToolbar"))

    ;; Add an item to the new Toolbar and assign an Open macro
    ;; (VBA equivalent of: "ESC ESC _open ")
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))
    (setq newButton (vla-AddToolbarButton newToolBar "" "NewButton" "Open a file." openMacro))

    ;; Read icon paths for this Toolbar button
    (vla-GetBitmaps newButton 'SmallBitmapName 'LargeBitmapName)
    (alert (strcat "The new Toolbar uses the following icon files: \n"
                   "Small Bitmap: " SmallBitmapName "\n"
                   "Large Bitmap: " LargeBitmapName))

    ;; Change the default icon (smile face) for the new toolbar button
    (setq SmallBitmapName "C:\\AutoCAD\\16x16.bmp")     ;; Use a 16x16 pixel .BMP image
    (setq LargeBitmapName "C:\\AutoCAD\\32x32.bmp")     ;; Use a 32x32 pixel .BMP image
    (vla-SetBitmaps newButton SmallBitmapName LargeBitmapName)

    ;; Read icon paths for this Toolbar button
    (vla-GetBitmaps newButton 'SmallBitmapName 'LargeBitmapName)
    (alert (strcat "The new Toolbar uses the following icon files: \n"
                   "Small Bitmap: " SmallBitmapName "\n"
                   "Large Bitmap: " LargeBitmapName))
)


GetBlockAttributeValue Method (ActiveX)

Gets the attribute value in the block content with an attribute definition id.

Supported platforms: Windows only

Signature - MLeader

VBA:

RetVal = object.GetBlockAttributeValue(attdefId)
object

Type: MLeader

The object this method applies to.

attdefID

Access: Input-only

Type: Long_PTR

The attribute definition ID.

Signature - Table

VBA:

RetVal = object.GetBlockAttributeValue(row, col, attdefId)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row in the table.

col

Access: Input-only

Type: Long

The column in the table.

attdefId

Access: Input-only

Type: Long_PTR

The attribute definition ID.

Return Value (RetVal)

Type: String

The attribute value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Blockttribute()
    ' This example creates an MLeader object and gets and sets values for
    ' the block attribute type.

    Dim points(0 To 5) As Double

    points(0) = 0: points(1) = 4: points(2) = 0
    points(3) = 1.5: points(4) = 5: points(5) = 0

    Dim i As Long

    Dim oML As AcadMLeader
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    oML.ContentType = acBlockContent
    oML.ContentBlockType = acBlockBox

    Dim sBlock As String

    sBlock = oML.ContentBlockName

    Dim o As AcadEntity
    For Each o In ThisDrawing.Blocks(sBlock)
        If o.ObjectName = "AcDbAttributeDefinition" Then
            oML.SetBlockAttributeValue o.ObjectID, "123"
            MsgBox oML.GetBlockAttributeValue(o.ObjectID)
        End If
    Next o

    Update
    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_BlockAttribute()
    ;; This example creates an MLeader object and gets and sets values for
    ;; the block attribute type.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(0 4 0
                                  1.5 5 0
                                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (vla-put-ContentType oML acBlockContent)
    (vla-put-ContentBlockType oML acBlockBox)

    (setq sBlock (vla-get-ContentBlockName oML))

    (vlax-for o (vla-Item (vla-get-Blocks doc) sBlock)
        (if (= (vla-get-ObjectName o) "AcDbAttributeDefinition")
               (progn
                (vla-SetBlockAttributeValue oML (vla-get-ObjectID o) "123")
                (alert (vla-GetBlockAttributeValue oML (vla-get-ObjectID o)))
               )
        )
    )

    (vla-Update acadObj)
    (vla-ZoomExtents acadObj)
)


GetBlockAttributeValue2 Method (ActiveX)

Gets the attribute value associated to a specified block cell.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetBlockAttributeValue2(nRow, nCol, nContent, blkId)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value of the cell.

blkId

Access: Input-only

Type: Long_PTR

The block table record object id to check.

Return Value (RetVal)

Type: String

The returned block attribute value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetBlockRotation Method (ActiveX)

Returns the block rotation angle for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetBlockRotation(row, col)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

Return Value (RetVal)

Type: Double

The rotation angle of the block.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetBlockScale Method (ActiveX)

Returns the block scale value for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetBlockScale(row, col)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row in the table.

col

Access: Input-only

Type: Long

The column in the table.

Return Value (RetVal)

Type: Double

The scale of the block.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetBlockTableRecordId Method (ActiveX)

Returns the block table record ID of the cell.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetBlockTableRecordId(row, col)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Integer

The row in the table.

col

Access: Input-only

Type: Integer

The column in the table.

Return Value (RetVal)

Type: Long_PTR

The pointer to hold the block table record object id.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetBlockTableRecordId2 Method (ActiveX)

Gets the block table record object id associated to a specified cell.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetBlockTableRecordId2(nRow, nCol, nContent)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value of the cell.

Return Value (RetVal)

Type: Long_PTR

The pointer to hold the block table record object id.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetBoundingBox Method (ActiveX)

Gets two points of a box enclosing the specified object.

Supported platforms: Windows only

Signature

VBA:

object.GetBoundingBox MinPoint, MaxPoint
object

Type: All drawing objects, AttributeReference, Dimension

The objects this method applies to.

MinPoint

Access: Output-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the minimum point of the object's bounding box.

MaxPoint

Access: Output-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the maximum point of the object's bounding box.

Return Value (RetVal)

No return value.

Remarks

The corners are returned in WCS coordinates with the box edges parallel to the WCS X, Y, and Z axes.

Examples

VBA:

Sub Example_GetBoundingBox()
    ' This example creates a line in model space. It then finds the
    ' bounding box for the line and displays the corners of the box.

    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    Dim lineObj As AcadLine

    ' Create the Line object in model space
    startPoint(0) = 2#: startPoint(1) = 2#: startPoint(2) = 0#
    endPoint(0) = 4#: endPoint(1) = 4#: endPoint(2) = 0#
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    ZoomAll

    Dim minExt As Variant
    Dim maxExt As Variant

    ' Return the bounding box for the line and return the minimum
    ' and maximum extents of the box in the minExt and maxExt variables.
    lineObj.GetBoundingBox minExt, maxExt

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the line are:" & vbCrLf _
         & "Min Extent: " & minExt(0) & "," & minExt(1) & "," & minExt(2) _
         & vbCrLf & "Max Extent: " & maxExt(0) & "," & maxExt(1) & "," & maxExt(2), vbInformation, "GetBoundingBox Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetBoundingBox()
    ;; This example creates a line in model space. It then finds the
    ;; bounding box for the line and displays the corners of the box.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the Line object in model space
    (setq startPoint (vlax-3D-point 2 2 0))
    (setq endPoint (vlax-3D-point 4 4 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-ZoomAll acadObj)

    ;; Return the bounding box for the line and return the minimum
    ;; and maximum extents of the box in the minExt and maxExt variables.
    (vla-GetBoundingBox lineObj 'minExt 'maxExt)
    (setq minExt (vlax-safearray->list minExt)
             maxExt (vlax-safearray->list maxExt))

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the line are:"
                   "\nMin Extent: " (rtos (nth 0 minExt) 2) "," (rtos (nth 1 minExt) 2) "," (rtos (nth 2 minExt) 2)
                   "\nMax Extent: " (rtos (nth 0 maxExt) 2) "," (rtos (nth 1 maxExt) 2) "," (rtos (nth 2 maxExt) 2)))
)


GetBreakHeight Method (ActiveX)

Get the break height of the table.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetBreakHeight(nIndex)
object

Type: Table

The object this method applies to.

nIndex

Access: Input-only

Type: Long

The index of the table.

Return Value (RetVal)

Type: Double

The height value of the break.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_BreakHeight()
    ' This example creates a table object and then breaks it into
    ' two tables.

    ' Create a new table object in model space
    Dim pt(2) As Double

    Dim modelSpace As AcadModelSpace
    Set modelSpace = ThisDrawing.modelSpace

    Dim table As AcadTable
    Set table = modelSpace.AddTable(pt, 5, 5, 10, 30)

    table.EnableBreak = True
    table.BreakSpacing = 3.5
    table.TableBreakHeight = 35#
    table.AllowManualHeights = True
    table.SetBreakHeight 0, 20#
    table.SetBreakHeight 1, 35#

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_BreakHeight()
    ;; This example creates a table object and then breaks it into
    ;; two tables.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create a new table object in model space
    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq table (vla-Addtable modelSpace pt 5 5 10 30))

    (vla-put-EnableBreak table :vlax-true)
    (vla-put-BreakSpacing table 3.5)
    (vla-put-TableBreakHeight table 35.0)
    (vla-put-AllowManualHeights table :vlax-true)
    (vla-SetBreakHeight table 0 20.0)
    (vla-SetBreakHeight table 1 35.0)

    (vla-ZoomExtents acadObj)
)


GetBulge Method (ActiveX)

Gets the bulge value at a given index of the polyline.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetBulge(Index)
object

Type: LWPolyline, Polyline

The objects this method applies to.

Index

Access: Input-only

Type: Integer

The index location of the vertex you wish to query. The index must be a positive integer beginning with zero.

Return Value (RetVal)

Type: Double

The bulge value for the vertex at the given index.

Remarks

Polyline: this method will fail if the polyline Type property is not acSimplePoly.

The bulge is the tangent of 1/4 of the included angle for the arc between the selected vertex and the next vertex in the polyline's vertex list. A negative bulge value indicates that the arc goes clockwise from the selected vertex to the next vertex. A bulge of 0 indicates a straight segment, and a bulge of 1 is a semicircle.

Examples

VBA:

Sub Example_GetBulge()
    ' This example creates a lightweight polyline in model space.
    ' It then finds and changes the bulge for a given segment.

    Dim plineObj As AcadLWPolyline
    Dim points(0 To 11) As Double

    ' Define the 2D polyline points
    points(0) = 1: points(1) = 1
    points(2) = 1: points(3) = 2
    points(4) = 2: points(5) = 2
    points(6) = 3: points(7) = 2
    points(8) = 4: points(9) = 4
    points(10) = 4: points(11) = 1

    ' Create a lightweight Polyline object in model space
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    ZoomAll

    ' Find the bulge of the third segment
    Dim currentBulge As Double
    currentBulge = plineObj.GetBulge(3)
    MsgBox "The bulge for the third segment is " & plineObj.GetBulge(3), , "GetBulge Example"

    ' Change the bulge of the third segment
    plineObj.SetBulge 3, -0.5
    plineObj.Update
    MsgBox "The bulge for the third segment is now " & plineObj.GetBulge(3), , "GetBulge Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetBulge()
    ;; This example creates a lightweight polyline in model space.
    ;; It then finds and changes the bulge for a given segment.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the 2D polyline points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 11)))
    (vlax-safearray-fill points '(1 1
                                  1 2
                                  2 2
                                  3 2
                                  4 4
                                  4 1
                                 )
    )

    ;; Create a lightweight Polyline object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-ZoomAll acadObj)

    ;; Find the bulge of the third segment
    (setq currentBulge (vla-GetBulge plineObj 3))
    (alert (strcat "The bulge for the third segment is " (rtos (vla-GetBulge plineObj 3) 2)))

    ;; Change the bulge of the third segment
    (vla-SetBulge plineObj 3 -0.5)
    (vla-Update plineObj)
    (alert (strcat "The bulge for the third segment is now " (rtos (vla-GetBulge plineObj 3) 2)))
)


GetCanonicalMediaNames Method (ActiveX)

Gets all available canonical media names for the specified plot device.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetCanonicalMediaNames
object

Type: Layout, PlotConfiguration

The objects this method applies to.

Return Value (RetVal)

Type: Variant (array of strings)

The array of available media names for the specified plot device.

Remarks

You should call RefreshPlotDeviceInfo before the first time you use this method. Once you have called RefreshPlotDeviceInfo, you do not need to call it again unless your plot device information changes during the session.

Examples

VBA:

Sub Example_GetCanonicalMediaNames()
    ' This example gets the current plot device information
    ' and then displays the list of plot device names,
    ' media names, localized media names, and plot style
    ' table entries.
    Dim Layout As ACADLayout
    Set Layout = ThisDrawing.ModelSpace.Layout

    ' Refresh the current plot information for
    ' this session.
    Layout.RefreshPlotDeviceInfo

    ' List all the valid device names for the system
    Dim plotDevices As Variant
    plotDevices = Layout.GetPlotDeviceNames()

    Dim x As Integer
    For x = LBound(plotDevices) To UBound(plotDevices)
        MsgBox plotDevices(x)
    Next

    ' List all the media names, and their localized version
    Dim mediaNames As Variant
    mediaNames = Layout.GetCanonicalMediaNames()

    For x = LBound(mediaNames) To UBound(mediaNames)
        MsgBox mediaNames(x)
        MsgBox Layout.GetLocaleMediaName(mediaNames(x))
    Next

    ' List all the entries in the plot style table
    Dim styleNames As Variant
    styleNames = Layout.GetPlotStyleTableNames()

    For x = LBound(styleNames) To UBound(styleNames)
        MsgBox styleNames(x)
    Next

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetCanonicalMediaNames()
    ;; This example gets the current plot device information
    ;; and then displays the list of plot device names,
    ;; media names, localized media names, and plot style
    ;; table entries.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq Layout (vla-get-Layout (vla-get-ModelSpace doc)))

    ;; Refresh the current plot information for
    ;; this session.
    (vla-RefreshPlotDeviceInfo Layout)

    ;; List all the valid device names for the system
    (setq plotDevices (vlax-variant-value (vla-GetPlotDeviceNames Layout)))

    (setq x 0)
    (while (>= (vlax-safearray-get-u-bound plotDevices 1) x)
        (alert (vlax-safearray-get-element plotDevices x))
        (setq x (1+ x))
    )

    ;; List all the media names, and their localized version
    (setq mediaNames (vlax-variant-value (vla-GetCanonicalMediaNames Layout)))

    (setq x 0)
    (while (>= (vlax-safearray-get-u-bound mediaNames 1) x)
        (alert (vlax-safearray-get-element mediaNames x))
        (alert (vla-GetLocaleMediaName Layout (vlax-safearray-get-element mediaNames x)))
        (setq x (1+ x))
    )

    ;; List all the entries in the plot style table
    (setq styleNames (vlax-variant-value (vla-GetPlotStyleTableNames Layout)))

    (setq x 0)
    (while (>= (vlax-safearray-get-u-bound styleNames 1) x)
        (alert (vlax-safearray-get-element styleNames x))
        (setq x (1+ x))
    )
)


GetCellAlignment Method (ActiveX)

Returns the alignment for the cell in the specified row and column.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetCellAlignment(row, col)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

Return Value (RetVal)

Type: AcCellAlignment enum

  • acBottomCenter
  • acBottomLeft
  • acBottomRight
  • acMiddleCenter
  • acMiddleLeft
  • acMiddleRight
  • acTopCenter
  • acTopLeft
  • acTopRight

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetCellBackgroundColor Method (ActiveX)

Returns the background true color value of a cell in the specified row and column.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetCellBackgroundColor(row, col)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

Return Value (RetVal)

Type: AcCmColor

The AutoCAD true color object assigned to the cell's background color.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetCellBackgroundColorNone Method (ActiveX)

Returns the value specifying that there is no background color for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetCellBackgroundColorNone(row, col)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

Return Value (RetVal)

Type: Boolean

  • True: Background color is applied to the cell.
  • False: Background color is not applied to the cell.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetCellClass Method (ActiveX)

Gets the class of a cell style.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetCellClass(StringCellStyle)
object

Type: TableStyle

The object this method applies to.

StringCellStyle

Access: Input-only

Type: String

The table cell style name.

Return Value (RetVal)

Type: Integer

The cell style class.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellClass()
    ' This example creates a TableStyle object and sets values for
    ' the style classes and formatting.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As IAcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.CreateCellStyle ("NewTestStyle")
    Dim cellTestFormat As String

    customObj.SetCellClass "NewTestStyle", 4

    customObj.SetRotation "NewTestStyle", 8.4

    MsgBox "The cell class is " & customObj.GetCellClass("NewTestStyle") & _
           " the cell rotation is " & customObj.GetRotation("NewTestStyle")
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellClass()
    ;; This example creates a TableStyle object and sets values for
    ;; the style classes and formatting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))

    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")
    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-CreateCellStyle customObj "NewTestStyle")

    (vla-SetCellClass customObj "NewTestStyle" 4)
    (vla-SetRotation customObj "NewTestStyle" 8.4)

    (alert (strcat "The cell class is " (itoa (vla-GetCellClass customObj "NewTestStyle"))
                   " and the cell rotation is " (rtos (vla-GetRotation customObj "NewTestStyle") 2) "."
           )
    )
)


GetCellContentColor Method (ActiveX)

Returns the true color value for the content of the specified row and column.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetCellContentColor(row, col)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

Return Value (RetVal)

Type: AcCmColor

The AutoCAD true color object applied to the content.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetCellContentColor2 Method (ActiveX)

Gets the true color value for a cell.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetCellContentColor2(nRow, nCol, nContent)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Integer

The row number of the cell to set.

nCol

Access: Input-only

Type: Integer

The column number of the cell to set.

nContent

Access: Input-only

Type: Integer

The content value for the cell.

Return Value (RetVal)

Type: AcCmColor

The AutoCAD true color object applied to the content.

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetCellDataType Method (ActiveX)

Gets the cell data and unit type for the given row and column.

Supported platforms: Windows only

Signature

VBA:

object.GetCellDataType row, col, pDataType, pUnitType
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row number of the cell to set.

col

Access: Input-only

Type: Long

The column number of the cell to set.

pDataType

Access: Output-only

Type: AcValueDataType enum

The cell data type.

  • acBuffer
  • acDate
  • acDouble
  • acGeneral
  • acLong
  • acObjectId
  • acPoint2d
  • acPoint3d
  • acResbuf
  • acString
  • acUnknownDataType
pUnitType

Access: Output-only

Type: AcValueUnitType enum

The cell unit type.

  • acUnitAngle
  • acUnitArea
  • acUnitDistance
  • acUnitless
  • acUnitVolume

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellManipulation()
    ' This example adds a table in model space and sets and gets a column name

    Dim MyModelSpace As AcadModelSpace
    Set MyModelSpace = ThisDrawing.modelSpace
    Dim pt(2) As Double
    Dim MyTable As AcadTable
    Dim cName As String
    Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30)

    Call MyTable.SetCellDataType(2, 2, acLong, acUnitDistance)
    Call MyTable.SetCellFormat(1, 3, "testFormat")
    Call MyTable.SetCellState(4, 3, acCellStateContentLocked)
    Call MyTable.SetCellValue(1, 4, 5)

    MsgBox MyTable.GetCellValue(1, 4) & " is the test cell's value "

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellManipulation()
    ;; This example adds a table in model space and sets and gets a column name
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MyTable (vla-AddTable modelSpace pt 5 5 10 30))

    (vla-SetCellDataType MyTable 2 2 acLong acUnitDistance)
    (vla-SetCellFormat MyTable 1 3 "testFormat")
    (vla-SetCellState MyTable 4 3 acCellStateContentLocked)
    (vla-SetCellValue MyTable 1 4 5)

    (alert (strcat (itoa (vlax-variant-value (vla-GetCellValue MyTable 1 4))) " is the test cell's value."))

    (vla-ZoomExtents acadObj)
)


GetCellExtents Method (ActiveX)

Returns the cell extents for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

object.GetCellExtents row, col, bOuterCell
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

bOuterCell

Access: Input-only

Type: Boolean

  • True: The specified cell is an outer cell.
  • False: The specified cell is an inner cell.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetCellFormat Method (ActiveX)

Gets the cell format for the given row and column.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetCellFormat(row, col)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Integer

The row number of the cell to set.

col

Access: Input-only

Type: Integer

The column number of the cell to set.

Return Value (RetVal)

Type: String

The cell format.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellManipulation()
    ' This example adds a table in model space and sets and gets a column name

    Dim MyModelSpace As AcadModelSpace
    Set MyModelSpace = ThisDrawing.modelSpace
    Dim pt(2) As Double
    Dim MyTable As AcadTable
    Dim cName As String
    Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30)

    Call MyTable.SetCellDataType(2, 2, acLong, acUnitDistance)
    Call MyTable.SetCellFormat(1, 3, "testFormat")
    Call MyTable.SetCellState(4, 3, acCellStateContentLocked)
    Call MyTable.SetCellValue(1, 4, 5)

    MsgBox MyTable.GetCellValue(1, 4) & " is the test cell's value "

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellManipulation()
    ;; This example adds a table in model space and sets and gets a column name
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MyTable (vla-AddTable modelSpace pt 5 5 10 30))

    (vla-SetCellDataType MyTable 2 2 acLong acUnitDistance)
    (vla-SetCellFormat MyTable 1 3 "testFormat")
    (vla-SetCellState MyTable 4 3 acCellStateContentLocked)
    (vla-SetCellValue MyTable 1 4 5)

    (alert (strcat (itoa (vlax-variant-value (vla-GetCellValue MyTable 1 4))) " is the test cell's value."))

    (vla-ZoomExtents acadObj)
)


GetCellGridColor Method (ActiveX)

Returns the grid color value for an edge of the specified row and column.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetCellGridColor(row, col, edge)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row in the table.

col

Access: Input-only

Type: Long

The column in the table.

edge

Access: Input-only

Type: AcCellEdgeMask enum

  • acBottomMask: Bottom edge index of the cell.
  • acLeftMask: Left edge index of the cell.
  • acRightMask: Right edge index of the cell.
  • acTopMask: Top edge index of the cell.

Return Value (RetVal)

Type: AcCmColor

The AutoCAD true color object applied to the grid.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetCellGridLineWeight Method (ActiveX)

Returns the grid lineweight value for an edge of the specified row and column.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetCellGridLineWeight(row, col, edge)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row in the table.

col

Access: Input-only

Type: Long

The column in the table.

edge

Access: Input-only

Type: AcCellEdgeMask enum

  • acBottomMask: Bottom edge index of the cell.
  • acLeftMask: Left edge index of the cell.
  • acRightMask: Right edge index of the cell.
  • acTopMask: Top edge index of the cell.

Return Value (RetVal)

Type: ACAD_LWEIGHT enum

  • acLnWt000
  • acLnWt005
  • acLnWt009
  • acLnWt013
  • acLnWt015
  • acLnWt018
  • acLnWt020
  • acLnWt025
  • acLnWt030
  • acLnWt035
  • acLnWt040
  • acLnWt050
  • acLnWt053
  • acLnWt060
  • acLnWt070
  • acLnWt080
  • acLnWt090
  • acLnWt100
  • acLnWt106
  • acLnWt120
  • acLnWt140
  • acLnWt158
  • acLnWt200
  • acLnWt211
  • acLnWtByLayer
  • acLnWtByBlock
  • acLnWtByLwDefault

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetCellGridVisibility Method (ActiveX)

Returns the grid visibility value for an edge of the specified row and column.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetCellGridVisibility(row, col, edge)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row in the table.

col

Access: Input-only

Type: Long

The column in the table.

edge

Access: Input-only

Type: AcCellEdgeMask enum

  • acBottomMask: Bottom edge index of the cell.
  • acLeftMask: Left edge index of the cell.
  • acRightMask: Right edge index of the cell.
  • acTopMask: Top edge index of the cell.

Return Value (RetVal)

Type: Boolean

  • True: Grid line is visible.
  • False: Grid line is not visible.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetCellState Method (ActiveX)

Get a cell's state.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetCellState(nRow, nCol)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The value of the row.

nCol

Access: Input-only

Type: Long

The value of the column.

Return Value (RetVal)

Type: AcCellState enum

The cell state.

  • acCellStateContentLocked
  • acCellStateContentModified
  • acCellStateContentReadOnly
  • acCellStateFormatLocked
  • acCellStateFormatModified
  • acCellStateFormatReadOnly
  • acCellStateLinked
  • acCellStateNone

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellManipulation()
    ' This example adds a table in model space and sets and gets a column name

    Dim MyModelSpace As AcadModelSpace
    Set MyModelSpace = ThisDrawing.modelSpace
    Dim pt(2) As Double
    Dim MyTable As AcadTable
    Dim cName As String
    Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30)

    Call MyTable.SetCellDataType(2, 2, acLong, acUnitDistance)
    Call MyTable.SetCellFormat(1, 3, "testFormat")
    Call MyTable.SetCellState(4, 3, acCellStateContentLocked)
    Call MyTable.SetCellValue(1, 4, 5)

    MsgBox MyTable.GetCellValue(1, 4) & " is the test cell's value "

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellManipulation()
    ;; This example adds a table in model space and sets and gets a column name
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MyTable (vla-AddTable modelSpace pt 5 5 10 30))

    (vla-SetCellDataType MyTable 2 2 acLong acUnitDistance)
    (vla-SetCellFormat MyTable 1 3 "testFormat")
    (vla-SetCellState MyTable 4 3 acCellStateContentLocked)
    (vla-SetCellValue MyTable 1 4 5)

    (alert (strcat (itoa (vlax-variant-value (vla-GetCellValue MyTable 1 4))) " is the test cell's value."))

    (vla-ZoomExtents acadObj)
)


GetCellStyle Method (ActiveX)

Gets the cell style.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetCellStyle(nRow, nCol)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

Return Value (RetVal)

Type: String

The cell style.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellManipulation()
    ' This example adds a table in model space and sets and gets a column name

    Dim MyModelSpace As AcadModelSpace
    Set MyModelSpace = ThisDrawing.modelSpace
    Dim pt(2) As Double
    Dim MyTable As AcadTable
    Dim cName As String
    Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30)

    Call MyTable.SetCellDataType(2, 2, acLong, acUnitDistance)
    Call MyTable.SetCellFormat(1, 3, "testFormat")
    Call MyTable.SetCellState(4, 3, acCellStateContentLocked)
    Call MyTable.SetCellValue(1, 4, 5)

    MsgBox MyTable.GetCellValue(1, 4) & " is the test cell's value "

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellManipulation()
    ;; This example adds a table in model space and sets and gets a column name
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MyTable (vla-AddTable modelSpace pt 5 5 10 30))

    (vla-SetCellDataType MyTable 2 2 acLong acUnitDistance)
    (vla-SetCellFormat MyTable 1 3 "testFormat")
    (vla-SetCellState MyTable 4 3 acCellStateContentLocked)
    (vla-SetCellValue MyTable 1 4 5)

    (alert (strcat (itoa (vlax-variant-value (vla-GetCellValue MyTable 1 4))) " is the test cell's value."))

    (vla-ZoomExtents acadObj)
)


GetCellStyleOverrides Method (ActiveX)

Returns the cell style overrides.

Supported platforms: Windows only

Signature

VBA:

object.GetCellStyleOverrides row, col
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetCellStyles Method (ActiveX)

Gets an array of all the named cell styles associated with the table style.

Supported platforms: Windows only

Signature

VBA:

object.GetCellStyles cellStylesArray
object

Type: TableStyle

The object this method applies to.

cellStylesArray

Access: Output-only

Type: Variant

Array of named cell styles.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetCellTextHeight Method (ActiveX)

Returns the text height for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetCellTextHeight(row, col)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

Return Value (RetVal)

Type: Double

The text height of the table cell.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetCellTextStyle Method (ActiveX)

Returns the text style name for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetCellTextStyle(row, col)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

Return Value (RetVal)

Type: String

The text style assigned to the table cell.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetCellType Method (ActiveX)

Returns the cell type for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetCellType(row, col)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

Return Value (RetVal)

Type: AcCellType enum

  • acBlockCell
  • acTextCell
  • acUnknownCell

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetCellValue Method (ActiveX)

Gets the cell value for the given row and column.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetCellValue(row, col)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row number of the cell to set.

col

Access: Input-only

Type: Long

The column number of the cell to set.

Return Value (RetVal)

Type: Variant

The cell value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellManipulation()
    ' This example adds a table in model space and sets and gets a column name

    Dim MyModelSpace As AcadModelSpace
    Set MyModelSpace = ThisDrawing.modelSpace
    Dim pt(2) As Double
    Dim MyTable As AcadTable
    Dim cName As String
    Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30)

    Call MyTable.SetCellDataType(2, 2, acLong, acUnitDistance)
    Call MyTable.SetCellFormat(1, 3, "testFormat")
    Call MyTable.SetCellState(4, 3, acCellStateContentLocked)
    Call MyTable.SetCellValue(1, 4, 5)

    MsgBox MyTable.GetCellValue(1, 4) & " is the test cell's value "

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellManipulation()
    ;; This example adds a table in model space and sets and gets a column name
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MyTable (vla-AddTable modelSpace pt 5 5 10 30))

    (vla-SetCellDataType MyTable 2 2 acLong acUnitDistance)
    (vla-SetCellFormat MyTable 1 3 "testFormat")
    (vla-SetCellState MyTable 4 3 acCellStateContentLocked)
    (vla-SetCellValue MyTable 1 4 5)

    (alert (strcat (itoa (vlax-variant-value (vla-GetCellValue MyTable 1 4))) " is the test cell's value."))

    (vla-ZoomExtents acadObj)
)


GetColor Method (ActiveX)

Returns the true color value for the specified row type.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetColor(rowType)
object

Type: TableStyle

The object this method applies to.

rowType

Access: Input-only

Type: AcRowType enum

The row type.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow

Return Value (RetVal)

Type: AcCmColor

The AutoCAD true color object assigned to the row type.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetColor()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Get the current TableStyle object
    Dim tableStyle As AcadTableStyle
    Set tableStyle = dictObj.Item(ThisDrawing.GetVariable("CTABLESTYLE"))

    Dim colCurrent As AcadAcCmColor, colRowCurrent As AcadAcCmColor, colNoneCurrent As Boolean
    Set colCurrent = tableStyle.GetBackgroundColor(AcRowType.acDataRow + AcRowType.acTitleRow)
    Set colRowCurrent = tableStyle.GetColor(acDataRow)
    colNoneCurrent = tableStyle.GetBackgroundColorNone(AcRowType.acHeaderRow)

    MsgBox "Table colors " & vbLf & _
           "Background ACI value = " & colCurrent.ColorIndex & vbLf & _
           "Row Text ACI value = " & colRowCurrent.ColorIndex & vbLf & _
           "Background None = " & colNoneCurrent

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 0, 0, 255
    tableStyle.SetBackgroundColor AcRowType.acTitleRow, col
    col.SetRGB 255, 0, 0
    tableStyle.SetColor AcRowType.acDataRow, col
    If colNoneCurrent = False Then
        tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, True
    Else
        tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, False
    End If

    Dim colNew As AcadAcCmColor, colRowNew As AcadAcCmColor, colNoneNew As Boolean
    Set colNew = tableStyle.GetBackgroundColor(AcRowType.acTitleRow)
    Set colRowNew = tableStyle.GetColor(acDataRow)
    colNoneNew = tableStyle.GetBackgroundColorNone(acHeaderRow)

    MsgBox "Table colors " & vbLf & _
           "Background ACI value = " & colNew.ColorIndex & vbLf & _
           "Row Text ACI value = " & colRowNew.ColorIndex & vbLf & _
           "Background None = " & colNoneNew

    tableStyle.SetBackgroundColor AcRowType.acTitleRow, colCurrent
    tableStyle.SetColor AcRowType.acDataRow, colRowCurrent
    tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, colNoneCurrent

    MsgBox "Reset the table style back to its original values."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetColor()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Get the current TableStyle object
    (setq tableStyle (vla-Item dictObj (vla-GetVariable doc "CTABLESTYLE")))

    (setq colCurrent (vla-GetBackgroundColor tableStyle (+ acDataRow acTitleRow)))
    (setq colRowCurrent (vla-GetColor tableStyle acDataRow))
    (setq colNoneCurrent (vla-GetBackgroundColorNone tableStyle acHeaderRow))

    (alert (strcat "Table colors \n"
                         "Background ACI value = " (itoa (vla-get-ColorIndex colCurrent)) "\n"
                         "Row Text ACI value = " (itoa (vla-get-ColorIndex colRowCurrent)) "\n"
                         "Background None = " (if (= colNoneCurrent :vlax-true) "True" "False")))

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 0 0 255)
    (vla-SetBackgroundColor tableStyle acTitleRow col)
    (vla-SetRGB col 255 0 0)
    (vla-SetColor tableStyle acDataRow col)
    (vla-SetBackgroundColorNone tableStyle acHeaderRow (if (= colNoneCurrent :vlax-true) :vlax-false :vlax-true))

    (setq colNew (vla-GetBackgroundColor tableStyle acTitleRow))
    (setq colRowNew (vla-GetColor tableStyle acDataRow))
    (setq colNoneNew (vla-GetBackgroundColorNone tableStyle acHeaderRow))
    (alert (strcat "Table colors \n"
                         "Background ACI value = " (itoa (vla-get-ColorIndex colNew)) "\n"
                         "Row Text ACI value = " (itoa (vla-get-ColorIndex colRowNew)) "\n"
                         "Background None = " (if (= colNoneNew :vlax-true) "True" "False")))

    (vla-SetBackgroundColor tableStyle acTitleRow colCurrent)
    (vla-SetColor tableStyle acDataRow colRowCurrent)
    (vla-SetBackgroundColorNone tableStyle acHeaderRow colNoneCurrent)

    (alert "Reset the table style back to its original values.")

    (vlax-release-object col)
)


GetColor2 Method (ActiveX)

Returns the color value for the specified named cell style.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetColor2(bstrCellStyle)
object

Type: TableStyle

The object this method applies to.

bstrCellStyle

Access: Input-only

Type: String

The named cell style.

Return Value (RetVal)

Type: AcCmColor

The AutoCAD true color object assigned to the cell style.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetColor()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Get the current TableStyle object
    Dim tableStyle As AcadTableStyle
    Set tableStyle = dictObj.Item(ThisDrawing.GetVariable("CTABLESTYLE"))

    Dim colCurrent As AcadAcCmColor, colRowCurrent As AcadAcCmColor, colNoneCurrent As Boolean
    Set colCurrent = tableStyle.GetBackgroundColor(AcRowType.acDataRow + AcRowType.acTitleRow)
    Set colRowCurrent = tableStyle.GetColor(acDataRow)
    colNoneCurrent = tableStyle.GetBackgroundColorNone(AcRowType.acHeaderRow)

    MsgBox "Table colors " & vbLf & _
           "Background ACI value = " & colCurrent.ColorIndex & vbLf & _
           "Row Text ACI value = " & colRowCurrent.ColorIndex & vbLf & _
           "Background None = " & colNoneCurrent

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 0, 0, 255
    tableStyle.SetBackgroundColor AcRowType.acTitleRow, col
    col.SetRGB 255, 0, 0
    tableStyle.SetColor AcRowType.acDataRow, col
    If colNoneCurrent = False Then
        tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, True
    Else
        tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, False
    End If

    Dim colNew As AcadAcCmColor, colRowNew As AcadAcCmColor, colNoneNew As Boolean
    Set colNew = tableStyle.GetBackgroundColor(AcRowType.acTitleRow)
    Set colRowNew = tableStyle.GetColor(acDataRow)
    colNoneNew = tableStyle.GetBackgroundColorNone(acHeaderRow)

    MsgBox "Table colors " & vbLf & _
           "Background ACI value = " & colNew.ColorIndex & vbLf & _
           "Row Text ACI value = " & colRowNew.ColorIndex & vbLf & _
           "Background None = " & colNoneNew

    tableStyle.SetBackgroundColor AcRowType.acTitleRow, colCurrent
    tableStyle.SetColor AcRowType.acDataRow, colRowCurrent
    tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, colNoneCurrent

    MsgBox "Reset the table style back to its original values."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetColor()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Get the current TableStyle object
    (setq tableStyle (vla-Item dictObj (vla-GetVariable doc "CTABLESTYLE")))

    (setq colCurrent (vla-GetBackgroundColor tableStyle (+ acDataRow acTitleRow)))
    (setq colRowCurrent (vla-GetColor tableStyle acDataRow))
    (setq colNoneCurrent (vla-GetBackgroundColorNone tableStyle acHeaderRow))

    (alert (strcat "Table colors \n"
                         "Background ACI value = " (itoa (vla-get-ColorIndex colCurrent)) "\n"
                         "Row Text ACI value = " (itoa (vla-get-ColorIndex colRowCurrent)) "\n"
                         "Background None = " (if (= colNoneCurrent :vlax-true) "True" "False")))

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 0 0 255)
    (vla-SetBackgroundColor tableStyle acTitleRow col)
    (vla-SetRGB col 255 0 0)
    (vla-SetColor tableStyle acDataRow col)
    (vla-SetBackgroundColorNone tableStyle acHeaderRow (if (= colNoneCurrent :vlax-true) :vlax-false :vlax-true))

    (setq colNew (vla-GetBackgroundColor tableStyle acTitleRow))
    (setq colRowNew (vla-GetColor tableStyle acDataRow))
    (setq colNoneNew (vla-GetBackgroundColorNone tableStyle acHeaderRow))
    (alert (strcat "Table colors \n"
                         "Background ACI value = " (itoa (vla-get-ColorIndex colNew)) "\n"
                         "Row Text ACI value = " (itoa (vla-get-ColorIndex colRowNew)) "\n"
                         "Background None = " (if (= colNoneNew :vlax-true) "True" "False")))

    (vla-SetBackgroundColor tableStyle acTitleRow colCurrent)
    (vla-SetColor tableStyle acDataRow colRowCurrent)
    (vla-SetBackgroundColorNone tableStyle acHeaderRow colNoneCurrent)

    (alert "Reset the table style back to its original values.")

    (vlax-release-object col)
)


GetColumnName Method (ActiveX)

Gets a column's name.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetColumnName(nIndex)
object

Type: Table

The object this method applies to.

nIndex

Access: Input-only

Type: Long

The index of the column.

Return Value (RetVal)

Type: String

The name of the column.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ColumnName()
     ' This example adds a table in model space and sets and gets a column name

    Dim MyModelSpace As AcadModelSpace
    Set MyModelSpace = ThisDrawing.ModelSpace
    Dim pt(2) As Double
    Dim MyTable As AcadTable
    Dim cName As String
    Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30)

    Call MyTable.SetColumnName(2, "Test Name")
    MsgBox "The column name is: " & vbCrLf & _
           MyTable.GetColumnName(2)

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ColumnName()
    ;; This example adds a table in model space and sets and gets a column name
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MyTable (vla-AddTable modelSpace pt 5 5 10 30))

    (vla-SetColumnName MyTable 2 "Test Name")
    (alert (strcat "The column name is: \n"
                   (vla-GetColumnName MyTable 2)))

    (vla-ZoomExtents acadObj)
)


GetColumnWidth Method (ActiveX)

Returns the column width for the column at the specified column index in the table.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetColumnWidth(col)
object

Type: Table

The object this method applies to.

col

Access: Input-only

Type: Long

The column in the table.

Return Value (RetVal)

Type: Double

The width of the column.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetConstantAttributes Method (ActiveX)

Gets the constant attributes in the block or external reference.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetConstantAttributes
object

Type: BlockReference, ExternalReference, MInsertBlock

The objects this method applies to.

Return Value (RetVal)

Type: Variant (array of Attribute objects)

The array of Attribute objects that are constant for the block reference.

Remarks

This method returns an array of constant attributes attached to the block or external reference. The attributes returned are the constant attribute definitions, not attribute references.

Examples

VBA:

Sub Example_GetConstantAttributes()
    ' This example creates a constant attribute definition on a block.
    ' It then queries the block to return the attribute.

    ' Create the block to hold the attribute
    Dim blockObj As AcadBlock
    Dim insertionPnt(0 To 2) As Double
    insertionPnt(0) = 0#: insertionPnt(1) = 0#: insertionPnt(2) = 0#
    Set blockObj = ThisDrawing.Blocks.Add(insertionPnt, "New_Block")

    ' Define the attribute definition
    Dim attributeObj As AcadAttribute
    Dim height As Double
    Dim mode As Long
    Dim prompt As String
    Dim tag As String
    Dim value As String
    height = 1#
    mode = acAttributeModeConstant
    prompt = "Constant Prompt"
    insertionPnt(0) = 5#: insertionPnt(1) = 5#: insertionPnt(2) = 0#
    tag = "Constant_Tag"
    value = "Constant Value"

    ' Create the attribute definition object on the block
    Set attributeObj = blockObj.AddAttribute(height, mode, prompt, insertionPnt, tag, value)
    ZoomAll

    ' Insert the block into the drawing
    Dim blockRefObj As AcadBlockReference
    insertionPnt(0) = 2#: insertionPnt(1) = 2#: insertionPnt(2) = 0
    Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, "New_Block", 1#, 1#, 1#, 0)

    ' Get the constant attribute definition from the block
    Dim queryAttribute As Variant
    queryAttribute = blockRefObj.GetConstantAttributes

    Dim count As Integer
    count = UBound(queryAttribute) - LBound(queryAttribute)
    MsgBox "The block reference has " & count & " constant attributes."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetConstantAttributes()
    ;; This example creates a constant attribute definition on a block.
    ;; It then queries the block to return the attribute.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the block to hold the attribute
    (setq insertionPnt (vlax-3d-point 0 0 0))
    (setq blockObj (vla-Add (vla-get-Blocks doc) insertionPnt "New_Block"))

    ;; Define the attribute definition
    (setq insertionPnt (vlax-3d-point 5 5 0)
          attHeight 1
          attMode acAttributeModeConstant
          attPrompt "Constant Prompt"
          attTag "Constant_Tag"
          attValue "Constant Value")

    ;; Create the attribute definition object on the block
    (setq attributeObj (vla-AddAttribute blockObj attHeight attMode attPrompt insertionPnt attTag attValue))

    ;; Insert the block into the drawing
    (setq insertionPnt (vlax-3d-point 2 2 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq blockRefObj (vla-InsertBlock modelSpace insertionPnt "New_Block" 1 1 1 0))
    (vla-ZoomAll acadObj)

    ;; Get the constant attribute definition from the block
    (setq queryAttribute (vlax-variant-value (vla-GetConstantAttributes blockRefObj)))

    (setq count (1+ (vlax-safearray-get-u-bound queryAttribute 1)))
    (alert (strcat "The block reference has " (itoa count) " constant attributes."))
)


GetContentColor Method (ActiveX)

Returns the true color value for the specified row type.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetContentColor(rowType)
object

Type: Table

The object this method applies to.

rowType

Access: Input-only

Type: AcRowType enum

The row type.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow

Return Value (RetVal)

Type: AcCmColor

The AutoCAD true color object assigned to the content of the row type.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetContentColor2 Method (ActiveX)

Returns the color value for the specified content located at the provided row, column, and content index.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetContentColor2(row, column, content)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number in the table.

nColumn

Access: Input-only

Type: Long

The column number in the table.

nContent

Access: Input-only

Type: Long

The content index in the table cell.

Return Value (RetVal)

Type: AcCmColor

The AutoCAD true color object assigned to the content at the specified index in the table cell.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetContentLayout Method (ActiveX)

Get a cell's content layout.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetContentLayout(nRow, nCol)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The value of the row.

nCol

Access: Input-only

Type: Long

The value of the column.

Return Value (RetVal)

Type: AcCellContentLayout enum

The layout value.

  • acCellContentLayoutFlow
  • acCellContentLayoutStackedHorizontal
  • acCellContentLayoutStackedVertical

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetContentType Method (ActiveX)

Get a cell's content type.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetContentType(nRow, nCol)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The value of the row.

nCol

Access: Input-only

Type: Long

The value of the column.

Return Value (RetVal)

Type: AcCellContentType enum

The content type.

  • acCellContentTypeBlock
  • acCellContentTypeField
  • acCellContentTypeUnknown
  • acCellContentTypeValue

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetControlPoint Method (ActiveX)

Gets the coordinates of the control point at a given index.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetControlPoint(Index)
object

Type: Spline

The object this method applies to.

Index

Access: Input-only

Type: Integer

The index location of the control point you wish to query. The index must be a positive integer beginning with zero.

Return Value (RetVal)

Type: Variant (three-element array of doubles)

The 3D WCS coordinates of the control point at the given index location.

Remarks

Control points fine-tune a spline definition by adding weight to a portion of the spline curve.

You can query the total number of control points in a spline using the NumberOfControlPoints property. You can set a new coordinate location for a control point by using the SetControlPoint method. You can set a new weight for a control point by using the SetWeight method.

Examples

VBA:

Sub Example_GetControlPoint()
    ' This example creates a spline object in model space.
    ' It then finds the coordinates of the first control point
    ' and changes that value.

    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ZoomAll

    ' Display the coordinates of the first control point
    Dim controlPoint As Variant
    controlPoint = splineObj.GetControlPoint(0)
    MsgBox "Control point 1 is at " & controlPoint(0) & ", " & controlPoint(1) & ", " & controlPoint(2), , "GetControlPoint Example"

    ' Change the coordinate of the first fit point
    controlPoint(0) = 0: controlPoint(1) = 3: controlPoint(2) = 0
    splineObj.SetControlPoint 0, controlPoint
    splineObj.Update
    MsgBox "Control point 1 is now at " & controlPoint(0) & ", " & controlPoint(1) & ", " & controlPoint(2), , "GetControlPoint Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetControlPoint()
    ;; This example creates a spline object in model space.
    ;; It then finds the coordinates of the first control point
    ;; and changes that value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the spline
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(1 1 0
                                     5 5 0
                                     10 0 0
                                    )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)

    ;; Display the coordinates of the first control point
    (setq controlPoint (vlax-safearray->list (vlax-variant-value (vla-GetControlPoint splineObj 0))))
    (alert (strcat "Control point 1 is at " (rtos (nth 0 controlPoint) 2) ", " (rtos (nth 1 controlPoint) 2) ", " (rtos (nth 2 controlPoint) 2)))

    ;; Change the coordinate of the first fit point
    (setq controlPoint (vlax-3d-point 0 3 0))
    (vla-SetControlPoint splineObj 0 controlPoint)
    (vla-Update splineObj)
    (setq controlPoint (vlax-safearray->list (vlax-variant-value (vla-GetControlPoint splineObj 0))))
    (alert (strcat "Control point 1 is now at " (rtos (nth 0 controlPoint) 2) ", " (rtos (nth 1 controlPoint) 2) ", " (rtos (nth 2 controlPoint) 2)))
)


GetCorner Method (ActiveX)

Gets a corner of a rectangle.

Supported platforms: Windows only

Signature

VBA:

RetVal = GetCorner(Point [, Prompt])
object

Type: Utility

The object this method applies to.

Point

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the base point of the rectangle.

Prompt

Access: Input-only; optional

Type: Variant (string)

The text used to prompt the user for input.

Return Value (RetVal)

Type: Variant (three-element array of doubles)

The 3D WCS coordinates representing the corner of the rectangle.

Remarks

AutoCAD pauses for user input of the corner of a rectangle, and sets the return value to the value of the selected point. The Point parameter specifies the base point of the rectangle in the 3D WCS coordinates; this parameter is required. The Prompt parameter specifies a string that AutoCAD displays before it pauses. The prompt is optional.

The AutoCAD user can specify the corner by entering a point in the WCS coordinate format; GetCorner treats Point as a three-dimensional point. The user can specify the corner also by specifying a location on the graphics screen. AutoCAD draws a dynamically sized rectangle from Point to the current crosshair position to help the user visualize the location of the second corner. The rectangle is drawn in the XY plane of the WCS. When the pointing device is used, GetCorner ignores the Z field of Point and sets the Z field of result to the current elevation.

Examples

VBA:

Sub Example_GetCorner()
    ' This example provides a base point and prompts the user to
    ' input the second point to make a rectangle.

    AppActivate ThisDrawing.Application.Caption

    Dim returnPnt As Variant
    Dim basePnt(0 To 2) As Double
    basePnt(0) = 2#: basePnt(1) = 2#: basePnt(2) = 0#

    ' Prompt the user to pick second point and returns the point
    returnPnt = ThisDrawing.Utility.GetCorner(basePnt, "Enter Other corner: ")

    ' Display the point picked
    MsgBox "The point picked was " & returnPnt(0) & ", " & returnPnt(1) & ", " & returnPnt(2), , "GetCorner Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetCorner()
    ;; This example provides a base point and prompts the user to
    ;; input the second point to make a rectangle.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Prompt the user to pick second point and returns the point
    (setq basePnt (vlax-3d-point 2 2 0))
    (setq returnPnt (vla-GetCorner (vla-get-Utility doc) basePnt "Enter Other corner: "))

    ;; Display the point picked
    (setq returnPnt (vlax-safearray->list (vlax-variant-value returnPnt)))
    (alert (strcat "The point picked was " (rtos (nth 0 returnPnt) 2) ", " (rtos (nth 1 returnPnt) 2) ", " (rtos (nth 2 returnPnt) 2)))
)


GetCustomByIndex Method (ActiveX)

Returns the custom property name (key) and value that correspond to an index value.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetCustomByIndex(Index, pKey, pValue)
object

Type: SummaryInfo

The object this method applies to.

Index

Access: Input-only

Type: Long

The index value of the property. The index range is from zero to one less than the number of custom properties.

pKey

Access: Output-only

Type: String

The custom property name that corresponds to the index value.

pValue

Access: Output-only

Type: String

The custom property value that corresponds to the index value.

Return Value (RetVal)

Type: String

The custom property name (key) and value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetCustomByIndex()
    ' This example shows how to access drawing properties

    ' Add and display standard properties
    ThisDrawing.SummaryInfo.Author = "John Doe"
    ThisDrawing.SummaryInfo.Comments = "Includes all ten levels of Building Five"
    ThisDrawing.SummaryInfo.HyperlinkBase = "http://www.autodesk.com"
    ThisDrawing.SummaryInfo.Keywords = "Building Complex"
    ThisDrawing.SummaryInfo.LastSavedBy = "JD"
    ThisDrawing.SummaryInfo.RevisionNumber = "4"
    ThisDrawing.SummaryInfo.Subject = "Plan for Building Five"
    ThisDrawing.SummaryInfo.Title = "Building Five"

    Author = ThisDrawing.SummaryInfo.Author
    Comments = ThisDrawing.SummaryInfo.Comments
    HLB = ThisDrawing.SummaryInfo.HyperlinkBase
    KW = ThisDrawing.SummaryInfo.Keywords
    LSB = ThisDrawing.SummaryInfo.LastSavedBy
    RN = ThisDrawing.SummaryInfo.RevisionNumber
    Subject = ThisDrawing.SummaryInfo.Subject
    Title = ThisDrawing.SummaryInfo.Title
    MsgBox "The standard drawing properties are " & vbCrLf & _
           "Author = " & Author & vbCrLf & _
           "Comments = " & Comments & vbCrLf & _
           "HyperlinkBase = " & HLB & vbCrLf & _
           "Keywords = " & KW & vbCrLf & _
           "LastSavedBy = " & LSB & vbCrLf & _
           "RevisionNumber = " & RN & vbCrLf & _
           "Subject = " & Subject & vbCrLf & _
           "Title = " & Title & vbCrLf

    ' Add and display custom properties
    Dim Key0 As String
    Dim Value0 As String
    Dim Key1 As String
    Dim Value1 As String
    Dim CustomPropertyBranch As String
    Dim PropertyBranchValue As String
    Dim CustomPropertyZone As String
    Dim PropertyZoneValue As String

    CustomPropertyBranch = "Branch"
    PropertyBranchValue = "Main"
    CustomPropertyZone = "Zone"
    PropertyZoneValue = "Industrial"

    ' Add custom properties
    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 1) Then
        ThisDrawing.SummaryInfo.SetCustomByIndex 0, CustomPropertyBranch, PropertyBranchValue
    Else
        ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyBranch, PropertyBranchValue
    End If

    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 2) Then
         ThisDrawing.SummaryInfo.SetCustomByKey CustomPropertyBranch, "Satellite"
    Else
         ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyZone, PropertyZoneValue
    End If

    'Get custom properties
    ThisDrawing.SummaryInfo.GetCustomByIndex 0, Key0, Value0
    Key1 = CustomPropertyZone
    ThisDrawing.SummaryInfo.GetCustomByKey Key1, Value1

    MsgBox "The custom drawing properties are " & vbCrLf & _
           "First property name = " & Key0 & vbCrLf & _
           "First property value = " & Value0 & vbCrLf & _
           "Second property name = " & Key1 & vbCrLf & _
           "Second property value = " & Value1 & vbCrLf
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetCustomByIndex()
    ;; This example shows how to access drawing properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq summaryInfo (vla-get-SummaryInfo doc))

    ;; Add and display standard properties
    (vla-put-Author summaryInfo "John Doe")
    (vla-put-Comments summaryInfo "Includes all ten levels of Building Five")
    (vla-put-HyperlinkBase summaryInfo "http://www.autodesk.com")
    (vla-put-Keywords summaryInfo "Building Complex")
    (vla-put-LastSavedBy summaryInfo "JD")
    (vla-put-RevisionNumber summaryInfo "4")
    (vla-put-Subject summaryInfo "Plan for Building Five")
    (vla-put-Title summaryInfo "Building Five")

    (setq author (vla-get-Author summaryInfo))
    (setq comments (vla-get-Comments summaryInfo))
    (setq HLB (vla-get-HyperlinkBase summaryInfo))
    (setq KW (vla-get-Keywords summaryInfo))
    (setq LSB (vla-get-LastSavedBy summaryInfo))
    (setq RN (vla-get-RevisionNumber summaryInfo))
    (setq subject (vla-get-Subject summaryInfo))
    (setq Title (vla-get-Title summaryInfo))
    (alert (strcat "The standard drawing properties are "
                   "\nAuthor = " author
                   "\nComments = " comments
                   "\nHyperlinkBase = " HLB
                   "\nKeywords = " KW
                   "\nLastSavedBy = " LSB
                   "\nRevisionNumber = " RN
                   "\nSubject = " Subject
                   "\nTitle = " Title
           )
    )

    ;; Add and display custom properties
    (setq CustomPropertyBranch "Branch")
    (setq PropertyBranchValue "Main")
    (setq CustomPropertyZone "Zone")
    (setq PropertyZoneValue "Industrial")

    ;; Add custom properties
    (if (>= (vla-NumCustomInfo summaryInfo) 1)
        (vla-SetCustomByIndex summaryInfo 0 CustomPropertyBranch PropertyBranchValue)
        (vla-AddCustomInfo summaryInfo CustomPropertyBranch PropertyBranchValue)
    )

    (if (>= (vla-NumCustomInfo summaryInfo) 2)
        (vla-SetCustomByKey summaryInfo CustomPropertyBranch "Satellite")
        (vla-AddCustomInfo summaryInfo CustomPropertyZone PropertyZoneValue)
    )

    ;; Get custom properties
    (vla-GetCustomByIndex summaryInfo 0 'Key0 'Value0)
    (setq Key1 CustomPropertyZone)
    (vla-GetCustomByKey summaryInfo Key1 'Value1)

    (alert (strcat "The custom drawing properties are "
                   "\nFirst property name = " Key0
                   "\nFirst property value = " Value0
                   "\nSecond property name = " Key1
                   "\nSecond property value = " Value1
           )
    )
)


GetCustomByKey Method (ActiveX)

Returns the custom property value that corresponds to a name (key) value.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetCustomByKey(key, pValue)
object

Type: SummaryInfo

The object this method applies to.

key

Access: Input-only

Type: String

The name of the custom property.

pValue

Access: Output-only

Type: String

The custom property value that corresponds to the custom property name.

Return Value (RetVal)

Type: String

The custom property value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetCustomByKey()
    ' This example shows how to access drawing properties

    ' Add and display standard properties
    ThisDrawing.SummaryInfo.Author = "John Doe"
    ThisDrawing.SummaryInfo.Comments = "Includes all ten levels of Building Five"
    ThisDrawing.SummaryInfo.HyperlinkBase = "http://www.autodesk.com"
    ThisDrawing.SummaryInfo.Keywords = "Building Complex"
    ThisDrawing.SummaryInfo.LastSavedBy = "JD"
    ThisDrawing.SummaryInfo.RevisionNumber = "4"
    ThisDrawing.SummaryInfo.Subject = "Plan for Building Five"
    ThisDrawing.SummaryInfo.Title = "Building Five"

    Author = ThisDrawing.SummaryInfo.Author
    Comments = ThisDrawing.SummaryInfo.Comments
    HLB = ThisDrawing.SummaryInfo.HyperlinkBase
    KW = ThisDrawing.SummaryInfo.Keywords
    LSB = ThisDrawing.SummaryInfo.LastSavedBy
    RN = ThisDrawing.SummaryInfo.RevisionNumber
    Subject = ThisDrawing.SummaryInfo.Subject
    Title = ThisDrawing.SummaryInfo.Title
    MsgBox "The standard drawing properties are " & vbCrLf & _
           "Author = " & Author & vbCrLf & _
           "Comments = " & Comments & vbCrLf & _
           "HyperlinkBase = " & HLB & vbCrLf & _
           "Keywords = " & KW & vbCrLf & _
           "LastSavedBy = " & LSB & vbCrLf & _
           "RevisionNumber = " & RN & vbCrLf & _
           "Subject = " & Subject & vbCrLf & _
           "Title = " & Title & vbCrLf

    ' Add and display custom properties
    Dim Key0 As String
    Dim Value0 As String
    Dim Key1 As String
    Dim Value1 As String
    Dim CustomPropertyBranch As String
    Dim PropertyBranchValue As String
    Dim CustomPropertyZone As String
    Dim PropertyZoneValue As String

    CustomPropertyBranch = "Branch"
    PropertyBranchValue = "Main"
    CustomPropertyZone = "Zone"
    PropertyZoneValue = "Industrial"

    ' Add custom properties
    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 1) Then
        ThisDrawing.SummaryInfo.SetCustomByIndex 0, CustomPropertyBranch, PropertyBranchValue
    Else
        ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyBranch, PropertyBranchValue
    End If

    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 2) Then
         ThisDrawing.SummaryInfo.SetCustomByKey CustomPropertyBranch, "Satellite"
    Else
         ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyZone, PropertyZoneValue
    End If

    'Get custom properties
    ThisDrawing.SummaryInfo.GetCustomByIndex 0, Key0, Value0
    Key1 = CustomPropertyZone
    ThisDrawing.SummaryInfo.GetCustomByKey Key1, Value1

    MsgBox "The custom drawing properties are " & vbCrLf & _
           "First property name = " & Key0 & vbCrLf & _
           "First property value = " & Value0 & vbCrLf & _
           "Second property name = " & Key1 & vbCrLf & _
           "Second property value = " & Value1 & vbCrLf
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetCustomByKey()
    ;; This example shows how to access drawing properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq summaryInfo (vla-get-SummaryInfo doc))

    ;; Add and display standard properties
    (vla-put-Author summaryInfo "John Doe")
    (vla-put-Comments summaryInfo "Includes all ten levels of Building Five")
    (vla-put-HyperlinkBase summaryInfo "http://www.autodesk.com")
    (vla-put-Keywords summaryInfo "Building Complex")
    (vla-put-LastSavedBy summaryInfo "JD")
    (vla-put-RevisionNumber summaryInfo "4")
    (vla-put-Subject summaryInfo "Plan for Building Five")
    (vla-put-Title summaryInfo "Building Five")

    (setq author (vla-get-Author summaryInfo))
    (setq comments (vla-get-Comments summaryInfo))
    (setq HLB (vla-get-HyperlinkBase summaryInfo))
    (setq KW (vla-get-Keywords summaryInfo))
    (setq LSB (vla-get-LastSavedBy summaryInfo))
    (setq RN (vla-get-RevisionNumber summaryInfo))
    (setq subject (vla-get-Subject summaryInfo))
    (setq Title (vla-get-Title summaryInfo))
    (alert (strcat "The standard drawing properties are "
                   "\nAuthor = " author
                   "\nComments = " comments
                   "\nHyperlinkBase = " HLB
                   "\nKeywords = " KW
                   "\nLastSavedBy = " LSB
                   "\nRevisionNumber = " RN
                   "\nSubject = " Subject
                   "\nTitle = " Title
           )
    )

    ;; Add and display custom properties
    (setq CustomPropertyBranch "Branch")
    (setq PropertyBranchValue "Main")
    (setq CustomPropertyZone "Zone")
    (setq PropertyZoneValue "Industrial")

    ;; Add custom properties
    (if (>= (vla-NumCustomInfo summaryInfo) 1)
        (vla-SetCustomByIndex summaryInfo 0 CustomPropertyBranch PropertyBranchValue)
        (vla-AddCustomInfo summaryInfo CustomPropertyBranch PropertyBranchValue)
    )

    (if (>= (vla-NumCustomInfo summaryInfo) 2)
        (vla-SetCustomByKey summaryInfo CustomPropertyBranch "Satellite")
        (vla-AddCustomInfo summaryInfo CustomPropertyZone PropertyZoneValue)
    )

    ;; Get custom properties
    (vla-GetCustomByIndex summaryInfo 0 'Key0 'Value0)
    (setq Key1 CustomPropertyZone)
    (vla-GetCustomByKey summaryInfo Key1 'Value1)

    (alert (strcat "The custom drawing properties are "
                   "\nFirst property name = " Key0
                   "\nFirst property value = " Value0
                   "\nSecond property name = " Key1
                   "\nSecond property value = " Value1
           )
    )
)


GetCustomData Method (ActiveX)

Gets the custom data associated to a cell.

Supported platforms: Windows only

Signature

VBA:

object.GetCustomData nRow, nCol, szKey, pData
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

szKey

Access: Input-only

Type: String

The input key of the AcDbEvalContextPair.

pData

Access: Output-only

Type: Variant

The custom data.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetCustomScale Method (ActiveX)

Gets the custom scale for a layout or plot configuration.

Supported platforms: Windows only

Signature

VBA:

object.GetCustomScale Numerator, Denominator
object

Type: Layout, PlotConfiguration

The objects this method applies to.

Numerator

Access: Output-only

Type: Double

The numerator in the scale ratio. This value represents the number of inches or mm for the scale.

Denominator

Access: Output-only

Type: Double

The denominator in the scale ratio. This value represents the number of drawing units for the scale.

Return Value (RetVal)

No return value.

Remarks

The Numerator parameter depends upon the setting of the PaperUnits property.

Examples

VBA:

Sub Example_GetCustomScale()
    ' This example will access the Layouts collection for the current drawing
    ' and list basic information about the custom scale for each Layout.
    ' It will then change the custom scale information for model space and re-display
    ' the scale information.

    Dim Layouts As AcadLayouts, Layout As ACADLayout
    Dim msg As String
    Dim Numerator As Double, Denominator As Double
    Dim Measurement As String

    ' Display current scale information
    GoSub DISPLAY_SCALE_INFO

    ' Modify scale
    Numerator = 1
    Denominator = 1

    ThisDrawing.Layouts("Model").SetCustomScale Numerator, Denominator
    ThisDrawing.Regen acAllViewports

    ' Display new scale information
    GoSub DISPLAY_SCALE_INFO

    Exit Sub

DISPLAY_SCALE_INFO:
    ' Get layouts collection from document object
    Set Layouts = ThisDrawing.Layouts

    msg = vbCrLf & vbCrLf   ' Start with a space

    ' Get the scale information of every layout in this drawing
    For Each Layout In Layouts
        msg = msg & Layout.name & vbCrLf

        ' Get scale information
        Layout.GetCustomScale Numerator, Denominator

        ' Are we using inches or millimeters
        Measurement = IIf(Layout.PaperUnits = acInches, " inch(es)", " millimeter(s)")

        ' Format for display
        msg = msg & vbTab & "Contains " & Numerator & Measurement & vbCrLf
        msg = msg & vbTab & "Contains " & Denominator & " drawing units" & vbCrLf
        msg = msg & "_____________________" & vbCrLf

    Next

    ' Display custom scale information
    MsgBox "Custom scale information for the current drawing is: " & msg

    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetCustomScale()
    ;; This example will access the Layouts collection for the current drawing
    ;; and list basic information about the custom scale for each Layout.
    ;; It will then change the custom scale information for model space and re-display
    ;; the scale information.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Display current scale information
    (setq Layouts (vla-get-Layouts doc))

    (setq msg "")

    ;; Get the scale information of every layout in this drawing
    (vlax-for Layout Layouts
        (setq msg (strcat msg (vla-get-Name Layout) "\n"))

        ;; Get scale information
        (vla-GetCustomScale Layout 'Numerator 'Denominator)

        ;; Are we using inches or millimeters
        (setq Measurement (if (= (vla-get-PaperUnits Layout) acInches) " inch(es)\n" " millimeter(s)\n"))

        ;; Format for display
        (setq msg (strcat msg "  Contains " (rtos Numerator 2) Measurement
                              "  Contains " (rtos Denominator 2) " drawing units\n"
                              "_____________________\n"))
    )

    ;; Display custom scale information
    (alert (strcat "Custom scale information for the current drawing is: " msg))

    ;; Modify scale
    (setq Numerator 1
          Denominator 1)

    (vla-SetCustomScale (vla-Item (vla-get-Layouts doc) "Model") Numerator Denominator)
    (vla-Regen doc acAllViewports)

    ;; Display new scale information
    (setq Layouts (vla-get-Layouts doc))

    (setq msg "")

    ;; Get the scale information of every layout in this drawing
    (vlax-for Layout Layouts
        (setq msg (strcat msg (vla-get-Name Layout) "\n"))

        ;; Get scale information
        (vla-GetCustomScale Layout 'Numerator 'Denominator)

        ;; Are we using inches or millimeters
        (setq Measurement (if (= (vla-get-PaperUnits Layout) acInches) " inch(es)\n" " millimeter(s)\n"))

        ;; Format for display
        (setq msg (strcat msg "  Contains " (rtos Numerator 2) Measurement
                              "  Contains " (rtos Denominator 2) " drawing units\n"
                              "_____________________\n"))
    )

    ;; Display custom scale information
    (alert (strcat "Custom scale information for the current drawing is: " msg))
)


GetDataFormat Method (ActiveX)

Gets a cell's format.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetDataFormat(nRow, nCol, nContent)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value of the cell.

Return Value (RetVal)

Type: String

The format of the cell.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetDataType Method (ActiveX)

Returns the data type and unit type for the specified row type.

Supported platforms: Windows only

Signature

VBA:

object.GetDataType rowType, pDataType, pUnitType
object

Type: Table, TableStyle

The objects this method applies to.

rowType

Access: Input-only

Type: AcRowType enum

The row type.

  • acDataRow
  • acTitleRow
  • acHeaderRow
  • acUnknownRow
pDataType

Access: Output-only

Type: AcValueDataType enum

The data type of the row type.

  • acBuffer
  • acDate
  • acDouble
  • acGeneral
  • acLong
  • acObjectId
  • acPoint2d
  • acPoint3d
  • acResbuf
  • acString
  • acUnknownDataType
pUnitType

Access: Output-only

Type: AcValueUnitType enum

The unit type of the row type.

  • acUnitAngle
  • acUnitArea
  • acUnitDistance
  • acUnitless
  • acUnitVolume

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetDataType2 Method (ActiveX)

Gets the row data type and unit type for the specified row type and nContent.

Supported platforms: Windows only

Signature

VBA:

object.GetDataType2 nRow, nCol, nContent, pDataType, pUnitType
object

Type: Table, TableStyle

The objects this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value for the cell.

pDataType

Access: Output-only

Type: AcValueDataType enum

The data type of the content

  • acBuffer
  • acDate
  • acDouble
  • acGeneral
  • acLong
  • acObjectId
  • acPoint2d
  • acPoint3d
  • acResbuf
  • acString
  • acUnknownDataType
pUnitType

Access: Output-only

Type: AcValueUnitType enum

The unit type of the content.

  • acUnitAngle
  • acUnitArea
  • acUnitDistance
  • acUnitless
  • acUnitVolume

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetDistance Method (ActiveX)

Gets the distance from the prompt line or a selected set of points on the screen.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetDistance([Point [, Prompt]])
object

Type: Utility

The object this method applies to.

Point

Access: Input-only; optional

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the base point. If this point is not provided, the user must input two points.

Prompt

Access: Input-only; optional

Type: Variant (string)

The text to display to prompt the user for input.

Return Value (RetVal)

Type: Variant (double or array of doubles)

The distance from the prompt line or a selected set of points on the screen.

Remarks

AutoCAD pauses for user input of a linear distance and sets the return value to the value of the selected distance. The Point parameter specifies a base point in WCS coordinates. The Prompt parameter specifies a string that AutoCAD displays before it pauses. Both Point and Prompt are optional.

The AutoCAD user can specify the distance by entering a number in the current units format. The user can also set the distance by specifying two locations on the graphics screen. AutoCAD draws a rubber-band line from the first point to the current crosshair position to help the user visualize the distance. If the Point parameter is provided, AutoCAD uses this value as the first of the two points.

By default, GetDistance treats Point and the return value as three-dimensional points. A prior call to the InitializeUserInput method can force Point to be two-dimensional, ensuring that this method returns a planar distance.

Regardless of the method used to specify the distance or the current linear units (for example, feet and inches), this method always sets the return value to a double-precision floating-point value.

Examples

VBA:

Sub Example_GetDistance()
    ' This example returns the distance entered by the user.

    AppActivate ThisDrawing.Application.Caption

    Dim returnDist As Double
    Dim basePnt(0 To 2) As Double
    basePnt(0) = 0#: basePnt(1) = 0#: basePnt(2) = 0#

    ' Return the value entered by user. A prompt is provided.
    returnDist = ThisDrawing.Utility.GetDistance(, "Enter distance: ")
    MsgBox "The distance entered was " & returnDist & vbCrLf & _
            "(Enter the next value without prompting.)", , "GetDistance Example"

    ' Return the value entered by user. No prompt is provided.
    returnDist = ThisDrawing.Utility.GetDistance()
    MsgBox "The distance entered was " & returnDist, , "GetDistance Example"

    ' Return the value entered by user. A base point and prompt are provided.
    returnDist = ThisDrawing.Utility.GetDistance(basePnt, "Enter a distance: ")
    MsgBox "The distance entered was " & returnDist, , "GetDistance Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetDistance()
    ;; This example returns the distance entered by the user.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Return the value entered by user. A prompt is provided.
    (setq returnDist (vla-GetDistance (vla-get-Utility doc) nil "Enter distance: "))
    (alert (strcat "The distance entered was " (rtos returnDist 2) "\n"
            "(Enter the next value without prompting.)"))

    ;; Return the value entered by user. No prompt is provided.
    (setq returnDist (vla-GetDistance (vla-get-Utility doc)))
    (alert (strcat "The distance entered was " (rtos returnDist 2)))

    ;; Return the value entered by user. A base point and prompt are provided.
    (setq basePnt (vlax-3d-point 0 0 0))
    (setq returnDist (vla-GetDistance (vla-get-Utility doc) basePnt "Enter a distance: "))
    (alert (strcat "The distance entered was " (rtos returnDist 2)))
)


GetDoglegDirection Method (ActiveX)

Gets the dog leg direction of the specific leader.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetDoglegDirection(leaderIndex)
object

Type: MLeader

The object this method applies to.

leaderIndex

Access: Input-only

Type: Long

The index of the leader cluster where the new leader line is to be added.

Return Value (RetVal)

Type: Variant (three-element array of doubles)

The coordinate directions of the input leader vector.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetDynamicBlockProperties Method (ActiveX)

Gets the properties of the dynamic block.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetDynamicBlockProperties
object

Type: BlockReference, MInsertBlock

The objects this method applies to.

Return Value (RetVal)

Type: Variant (array of DynamicBlockReferenceProperty objects)

Array of dynamic properties assigned to the block.

Remarks

A collection of DynamicBlockReferenceProperty objects is returned only if the block reference is a dynamic block containing custom properties.

Examples

VBA:

Not available

Visual LISP:

Not available


GetEntity Method (ActiveX)

Gets an object interactively.

Supported platforms: Windows only

Signature

VBA:

object.GetEntity Object, PickedPoint [, Prompt]
object

Type: Utility

The object this method applies to.

Object

Access: Output-only

Type: Object

The picked object. Can be one of any of the drawing objects.

PickedPoint

Access: Output-only

Type: Variant (three-element array of doubles)

A 3D WCS coordinate specifying the point that was selected.

Prompt

Access: Input-only; optional

Type: Variant (string)

The text to display that prompts the user for input.

Return Value (RetVal)

No return value.

Remarks

This method requires the AutoCAD user to select an object by picking a point on the graphics screen. If an object is picked, it is returned in the first parameter and the second parameter will contain the point picked in WCS coordinates. If the pick point is not on an object the call will fail.

The pick point returned by GetEntity does not necessarily lie on the selected object. The returned point represents the location of the crosshairs at the time of selection. The relationship between this point and the object varies depending on the size of the pickbox and the current zoom scale.

This method can retrieve an object even if it is not visible on the screen or if it is on a frozen layer.

Examples

VBA:

Sub Example_GetEntity()
    ' This example creates several objects in model space. It then
    ' prompts the user to select an object. The example continues to
    ' have the user select objects until the user selects in empty space.

    AppActivate ThisDrawing.Application.Caption

    ' Create a Ray object in model space
    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)

    ' Create a polyline object in model space
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True

    ' Create a line object in model space
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ' Create a circle object in model space
    Dim circObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 20: centerPt(1) = 30: centerPt(2) = 0
    radius = 3
    Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)

    ' Create an ellipse object in model space
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    ZoomAll

    ' Begin the selection
    Dim returnObj As AcadObject
    Dim basePnt As Variant

    On Error Resume Next

    ' The following example waits for a selection from the user
RETRY:
    ThisDrawing.Utility.GetEntity returnObj, basePnt, "Select an object"

    If Err <> 0 Then
        Err.Clear
        MsgBox "Program ended.", , "GetEntity Example"
        Exit Sub
    Else
        returnObj.Update
        MsgBox "The object type is: " & returnObj.EntityName, , "GetEntity Example"
        returnObj.Update
    End If

    GoTo RETRY
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetEntity()
    ;; This example creates several objects in model space. It then
    ;; prompts the user to select an object. The example continues to
    ;; have the user select objects until the user selects in empty space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Create a Ray object in model space
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 1 3 0))
    (setq rayObj (vla-AddRay modelSpace basePoint SecondPoint))

    ;; Create a polyline object in model space
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
                                  9 2
                                  3 5
                                 )
    )
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)

    ;; Create a line object in model space
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 2 2 0))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    ;; Create a circle object in model space
    (setq centerPt (vlax-3d-point 20 30 0)
          radius 3)
    (setq circObj (vla-AddCircle modelSpace centerPt radius))

    ;; Create an ellipse object in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

    (vla-ZoomAll acadObj)

    ;; Begin the selection
    ;; The following example waits for a selection from the user
    (while (= (setq err (vl-catch-all-apply 'vla-GetEntity (list (vla-get-Utility doc) 'returnObj 'basePnt "Select an object"))) nil)
        (vla-Update returnObj)
           (alert (strcat "The object type is: " (vla-get-ObjectName returnObj)))
        (vla-Update returnObj)
    )

    (alert "Program ended.")
)


GetExtensionDictionary Method (ActiveX)

Gets the extension dictionary associated with an object.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetExtensionDictionary
object

Type: All drawing objects, AttributeReference, Block, Dictionary, Dimension, DimStyle, Group, Layer, Layout, Linetype, Material, MLeaderStyle, PlotConfiguration, RegisteredApplication, TableStyle, TextStyle, UCS, View, Viewport, XRecord

The objects this method applies to.

Return Value (RetVal)

Type: Dictionary

The extension dictionary for the object.

Remarks

If an object does not have an extension dictionary, this method will create a new extension dictionary for that object and return it in the return value.

You can query an object to see if it has an extension dictionary by using the HasExtensionDictionary property.

Examples

VBA:

Sub Example_GetExtensionDictionary()
    ' This example creates a Circle object in model space and
    ' adds a new Extension Dictionary to the Circle object

    Dim EDictionary As AcadDictionary
    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double

    ' Define the Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    radius = 5#

    ' Create the Circle object in model space
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)

    ThisDrawing.Application.ZoomAll

    MsgBox "Circle object Extension Dictionary state before: " & circleObj.HasExtensionDictionary

    ' Create an Extension Dictionary for the new Circle
    Set EDictionary = circleObj.GetExtensionDictionary

    MsgBox "Circle object Extension Dictionary state after: " & circleObj.HasExtensionDictionary
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetExtensionDictionary()
    ;; This example creates a Circle object in model space and
    ;; adds a new Extension Dictionary to the Circle object
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Circle object
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius 5)

    ;; Create the Circle object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))

    (vla-ZoomAll acadObj)

    (alert (strcat "Circle object Extension Dictionary state before: " (if (= (vla-get-HasExtensionDictionary circleObj) :vlax-true) "True" "False")))

    ;; Create an Extension Dictionary for the new Circle
    (setq EDictionary (vla-GetExtensionDictionary circleObj))

    (alert (strcat "Circle object Extension Dictionary state after: " (if (= (vla-get-HasExtensionDictionary circleObj) :vlax-true) "True" "False")))
)


GetFieldId Method (ActiveX)

Returns the field object ID of the specified cell.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetFieldId(row, col)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

Return Value (RetVal)

Type: Long_PTR

The field object id.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetFieldId2 Method (ActiveX)

Gets the field object id associated to the specified cell.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetFieldId2(nRow, nCol, nContent)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value of the cell.

Return Value (RetVal)

Type: Long_PTR

The field object id.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetFitPoint Method (ActiveX)

Gets the fit point of a spline at a given index.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetFitPoint(Index)
object

Type: Spline

The object this method applies to.

Index

Access: Input-only

Type: Long

The position in the fit point list at which to query the fit point. The index must be a positive integer beginning with 0.

Return Value (RetVal)

Type: Variant (three-element array of doubles)

The 3D WCS coordinates of the fit point at the given index location.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetFitPoint()
    ' This example creates a spline object in model space.
    ' It then finds the coordinates of the fit points.

    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ZoomAll

    ' Display the coordinates of the fit points
    Dim fitPoint As Variant
    Dim index As Integer
    For index = 0 To splineObj.NumberOfFitPoints - 1
        fitPoint = splineObj.GetFitPoint(index)
        MsgBox "Fit point " & index + 1 & " is at " & fitPoint(0) & ", " & fitPoint(1) & ", " & fitPoint(2), , "GetFitPoint Example"
    Next

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetFitPoint()
    ;; This example creates a spline object in model space.
    ;; It then finds the coordinates of the fit points.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the spline
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(1 1 0
                                     5 5 0
                                     10 0 0
                                    )
    )
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)

    ;; Display the coordinates of the fit points
    (setq index 0)
    (while (>= (1- (vla-get-NumberOfFitPoints splineObj)) 0)
        (setq fitPoint (vlax-safearray->list (vlax-variant-value (vla-GetFitPoint splineObj index))))
        (alert (strcat "Fit point " (itoa (1+ index)) " is at " (rtos (nth 0 fitPoint) 2) ", " (rtos (nth 1 fitPoint) 2) ", " (rtos (nth 2 fitPoint) 2)))
        (setq index (1+ index))
    )
)


GetFont Method (ActiveX)

Gets the definition data of the font for the TextStyle.

Supported platforms: Windows only

Signature

VBA:

object.GetFont Typeface, Bold, Italic, CharSet, PitchAndFamily
object

Type: TextStyle

The object this method applies to.

Typeface

Access: Output-only

Type: String

The typeface (font name) of the TextStyle you queried.

Bold

Access: Output-only

Type: Boolean

Specifies if the TextStyle is bold.

  • True: The TextStyle is bold.
  • False: The TextStyle is not bold.
Italic

Access: Output-only

Type: Boolean

Specifies if the TextStyle is italic.

  • True: The TextStyle is italic.
  • False: The TextStyle is not italic.
CharSet

Access: Output-only

Type: Long

The character set for the font. (See the available values in the Remarks section.)

PitchAndFamily

Access: Output-only

Type: Long

The pitch and family definitions for the font. (See the available values in the Remarks section.)

Return Value (RetVal)

No return value.

Remarks

This section provides definitions for constants to use with this method. To use these constants, copy the definitions you need and paste them into the Declarations section of your application. A complete list of the constants that are available from Microsoft can be found in the file win32api.txt, which is provided with the Visual Basic Development Environment.

The CharSet parameter specifies the character set for the font. To use the following constants in your VB or VBA application, copy the definitions into the Declaration section of your code.

Public Const ANSI_CHARSET = 0
Public Const DEFAULT_CHARSET = 1
Public Const SYMBOL_CHARSET = 2
Public Const SHIFTJIS_CHARSET = 128
Public Const OEM_CHARSET = 255

The PitchAndFamily parameter specifies the pitch and family values for the font. The value is determined by a combination of three different settings. By choosing a setting from each of the three categories and using the Boolean operator OR to combine them, you achieve the PitchAndFamily value. A setting is required from the first two categories: the pitch and the family. The third category, the TrueType Flag, is used only when you are specifying a TrueType font.

' Pitch Values
Public Const DEFAULT_PITCH = 0
Public Const FIXED_PITCH = 1
Public Const VARIABLE_PITCH = 2

' Family Values
Public Const FF_DONTCARE = 0    '  Don't care or don't know.
Public Const FF_ROMAN = 16      '  Variable stroke width, serifed.
Public Const FF_SWISS = 32      '  Variable stroke width, sans-serifed.
Public Const FF_MODERN = 48     '  Constant stroke width, serifed or sans-serifed.
Public Const FF_SCRIPT = 64     '  Cursive, etc.
Public Const FF_DECORATIVE = 80 '  Old English, etc.

' TrueType Flag
Public Const TMPF_TRUETYPE = &H4

Examples

VBA:

Sub Example_GetFont()
    ' This example find the font information for the active text style.

    Dim typeFace As String
    Dim Bold As Boolean
    Dim Italic As Boolean
    Dim charSet As Long
    Dim PitchandFamily As Long

    ThisDrawing.ActiveTextStyle.GetFont typeFace, Bold, Italic, charSet, PitchandFamily

    MsgBox "The current text style has the following font properties:" & vbCrLf _
            & "Typeface: " & typeFace & vbCrLf _
            & "Bold: " & Bold & vbCrLf _
            & "Italic: " & Italic & vbCrLf _
            & "Character set: " & charSet & vbCrLf _
            & "Pitch and Family: " & PitchandFamily

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetFont()
    ;; This example finds the font information for the active text style.
    ;; It then changes the font to bold.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (vla-GetFont (vla-get-ActiveTextStyle doc) 'typeFace 'Bold 'Italic 'charSet 'PitchandFamily)

    (alert (strcat "The current text style has the following font properties:"
                   "\nTypeface: " typeFace
                   "\nBold: " (if (= Bold :vlax-true) "True" "False")
                   "\nItalic: " (if (= Italic :vlax-true) "True" "False")
                   "\nCharacter set: " (itoa charSet)
                   "\nPitch and Family: " (itoa PitchandFamily)))

    ;; Change the bold property
    (setq Bold (if (= Bold :vlax-true) :vlax-false :vlax-true))

    (vla-SetFont (vla-get-ActiveTextStyle doc) typeFace Bold Italic charSet PitchandFamily)

    (alert (strcat "The current text style has the following font properties:"
                   "\nTypeface: " typeFace
                   "\nBold: " (if (= Bold :vlax-true) "True" "False")
                   "\nItalic: " (if (= Italic :vlax-true) "True" "False")
                   "\nCharacter set: " (itoa charSet)
                   "\nPitch and Family: " (itoa PitchandFamily)))

    ;; Reset the font
    (setq Bold (if (= Bold :vlax-true) :vlax-false :vlax-true))
    (vla-SetFont (vla-get-ActiveTextStyle doc) typeFace Bold Italic charSet PitchandFamily)
)


GetFormat Method (ActiveX)

Returns the format for the specified row type.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetFormat(rowType)
object

Type: Table, TableStyle

The objects this method applies to.

rowType

Access: Input-only

Type: AcRowType enum

The row type.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow

Return Value (RetVal)

Type: String

The format of the row type.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetFormat2 Method (ActiveX)

Gets the format of a cell style.

Supported platforms: Windows only

Signature

VBA:

object.GetFormat2 StringCellStyle, pbstrFormat
object

Type: TableStyle

The object this method applies to.

StringCellStyle

Access: Input-only

Type: String

The cell style name.

pbstrFormat

Access: Output-only

Type: String

The cell style format.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellStyle()
    ' This example creates a TableStyle object and sets values for
    ' the style name and formatting.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As IAcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.CreateCellStyle ("NewTestStyle")
    Dim cellTestFormat As String

    customObj.SetFormat2 "NewTestStyle", "test format"
    customObj.GetFormat2 "NewTestStyle", cellTestFormat

    MsgBox "Cell Style Name = " & cellTestFormat

    customObj.RenameCellStyle "NewTestStyle", "NewTestStyle2"
    customObj.GetFormat2 "NewTestStyle2", cellTestFormat

    MsgBox "Cell Style Name = " & cellTestFormat

    Dim uniqueStyleName As String

    uniqueStyleName = customObj.GetUniqueCellStyleName("testbase")

    MsgBox "Cell Style Name = " & uniqueStyleName

    If customObj.GetIsCellStyleInUse("testbase") = False Then
        MsgBox "That cell style is not being used!"
    End If

    customObj.CreateCellStyleFromStyle "TestStyleFromStyle", "NewTestStyle2"

    customObj.DeleteCellStyle "NewTestStyle2"

    Dim numOfStyles As Long
    numOfStyles = customObj.NumCellStyles
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellStyle()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and formatting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-CreateCellStyle customObj "NewTestStyle")

    (setq cellTestFormat "")
    (vla-SetFormat2 customObj "NewTestStyle" "test format")
    (vla-GetFormat2 customObj "NewTestStyle" 'cellTestFormat)

    (alert (strcat "Cell Style Name = " cellTestFormat))

    (vla-RenameCellStyle customObj "NewTestStyle" "NewTestStyle2")
    (vla-GetFormat2 customObj "NewTestStyle2" 'cellTestFormat)

    (alert (strcat "Cell Style Name = " cellTestFormat))

    (setq uniqueStyleName (vla-GetUniqueCellStyleName customObj "testbase"))

    (alert (strcat "Cell Style Name = " uniqueStyleName))

    (if (= (vla-GetIsCellStyleInUse customObj "testbase") :vlax-false)
        (alert "That cell style is not being used!")
    )

    (vla-CreateCellStyleFromStyle customObj "TestStyleFromStyle" "NewTestStyle2")

    (vla-DeleteCellStyle customObj "NewTestStyle2")

    (setq numOfStyles (vla-get-NumCellStyles customObj))
    (alert (strcat "Number of Cell Styles = " (itoa numOfStyles)))
)X


GetFormula Method (ActiveX)

Get a cell's formula.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetFormula(nRow, nCol, nContent)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The value of the row.

nCol

Access: Input-only

Type: Long

The value of the column.

nContent

Access: Input-only

Type: Long

The value of the content.

Return Value (RetVal)

Type: String

The formula within the cell.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetFullDrawOrder Method (ActiveX)

Returns all of the objects in a block, sorted by draw order with the bottom object first.

Supported platforms: Windows only

Signature

VBA:

object.GetFullDrawOrder Objects, honorSortentsSysvar
object

Type: SortentsTable

The object this method applies to.

Objects

Access: Output-only

Type: Variant (array of Objects)

The objects in the block.

honorSortentsSysvar

Access: Input-only

Type: Boolean

  • True: Uses the setting of the DRAWORDERCTL system variable.
  • False: Setting is ignored.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SortentsTable()
    ' This example creates a SortentsTable object and
    ' changes the draw order.

    ' Set drawing to display lineweights and create a True Color object
    Dim ACADPref As AcadDatabasePreferences
    Set ACADPref = ThisDrawing.preferences
    ACADPref.LineWeightDisplay = True
    Dim MyColorObjOne As AcadAcCmColor
    Set MyColorObjOne = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Call MyColorObjOne.SetRGB(80, 100, 244)

    ' Draw a polyline
    Dim plineObj As AcadPolyline
    Dim points(0 To 8) As Double
    points(0) = 4: points(1) = 4: points(2) = 0
    points(3) = 3: points(4) = 5: points(5) = 0
    points(6) = 6: points(7) = 20: points(8) = 0
    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
    plineObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(90, 110, 150)
    plineObj.TrueColor = MyColorObjOne

    ' Draw a line
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 5: startPoint(1) = 13: startPoint(2) = 0
    endPoint(0) = 5: endPoint(1) = 27: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    lineObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(50, 80, 230)
    lineObj.TrueColor = MyColorObjOne

    ' Draw a circle
    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    centerPoint(0) = 10: centerPoint(1) = 15: centerPoint(2) = 0#
    radius = 5#
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)
    circleObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(60, 200, 220)
    circleObj.TrueColor = MyColorObjOne
    ZoomAll
    AcadApplication.Update

    ' Get an extension dictionary and, if necessary, add a SortentsTable object
    Dim eDictionary As Object
    Set eDictionary = ThisDrawing.ModelSpace.GetExtensionDictionary
    ' Prevent failed GetObject calls from throwing an exception
    On Error Resume Next
    Dim sentityObj As Object
    Set sentityObj = eDictionary.GetObject("ACAD_SORTENTS")
    On Error GoTo 0
    If sentityObj Is Nothing Then
         ' No SortentsTable object, so add one
         Set sentityObj = eDictionary.AddObject("ACAD_SORTENTS", "AcDbSortentsTable")
    End If

    Dim ObjIds(2) As Long
    ObjIds(0) = plineObj.ObjectID
    ObjIds(1) = lineObj.ObjectID
    ObjIds(2) = circleObj.ObjectID

    Dim varObject As AcadObject
    Set varObject = ThisDrawing.ObjectIdToObject(ObjIds(2))
    Dim arr(0) As AcadObject
    Set arr(0) = varObject

    ' Move the circle object to the bottom
    sentityObj.MoveToBottom arr
    AcadApplication.Update

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SortentsTable()
    ;; This example creates a SortentsTable object and
    ;; changes the draw order.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Set drawing to display lineweights and create a True Color object
    (vla-put-LineWeightDisplay (vla-get-Preferences doc) :vlax-true)
    (setq MyColorObjOne (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB MyColorObjOne 80 100 244)

    ;; Draw a polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill points '(4 4 0
                                  3 5 0
                                  6 20 0
                                 )
    )

    (setq plineObj (vla-AddPolyline modelSpace points))

    (vla-put-Lineweight plineObj acLnWt211)
    (vla-SetRGB MyColorObjOne 90 110 150)
    (vla-put-TrueColor plineObj MyColorObjOne)

    ;; Draw a line
    (setq startPoint (vlax-3d-point 5 13 0)
          endPoint (vlax-3d-point 5 27 0))

    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-put-Lineweight lineObj acLnWt211)
    (vla-SetRGB MyColorObjOne 50 80 230)
    (vla-put-TrueColor lineObj MyColorObjOne)

    ;; Draw a circle
    (setq centerPoint (vlax-3d-point 10 15 0)
          radius 5)

    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))
    (vla-put-Lineweight circleObj acLnWt211)
    (vla-SetRGB MyColorObjOne 60 200 220)
    (vla-put-TrueColor circleObj MyColorObjOne)

    (vla-ZoomAll acadObj)
    (vla-Update acadObj)

    ;; Get an extension dictionary and, if necessary, add a SortentsTable object
    (setq eDictionary (vla-GetExtensionDictionary modelSpace))

    ;; Prevent failed GetObject calls from throwing an exception
    (setq sentityObj (vl-catch-all-apply 'vla-GetObject (list eDictionary "ACAD_SORTENTS")))

    (if (= (type sentityObj)'VL-CATCH-ALL-APPLY-ERROR)
         ;; No SortentsTable object, so add one
         (setq sentityObj (vla-AddObject eDictionary "ACAD_SORTENTS" "AcDbSortentsTable"))
    )

    (setq ObjIds (vlax-make-safearray vlax-vbLong '(0 . 2)))
    (vlax-safearray-put-element ObjIds 0 (vla-get-ObjectID plineObj))
    (vlax-safearray-put-element ObjIds 1 (vla-get-ObjectID lineObj))
    (vlax-safearray-put-element ObjIds 2 (vla-get-ObjectID circleObj))

    (setq varObject circleObj)
    (setq arr (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element arr 0 varObject)

    ;; Move the circle object to the bottom
    (vla-MoveToBottom sentityObj arr)
    (vla-Update acadObj)

    (vlax-release-object MyColorObjOne)
)


GetGridColor Method (ActiveX)

Returns the grid color value for a grid linetype and row type.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetGridColor(gridLineType, rowType)
object

Type: Table, TableStyle

The objects this method applies to.

gridLineType

Access: Input-only

Type: AcGridLineType enum

The type of the grid line.

  • acHorzBottom: Top or bottom horizontal grid line, based on the flow direction.
  • acHorzInside: All horizontal grid lines, excluding the top and bottom lines.
  • acHorzTop: Top or bottom horizontal grid line, based on the flow direction.
  • acInvalidGridLine: An invalid grid line.
  • acVertInside: All the vertical grid lines, excluding the farthest left and farthest right grid lines.
  • acVertLeft: Farthest left grid line.
  • acVertRight: Farthest right grid line.
rowType

Access: Input-only

Type: AcRowType enum

The row type.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow

Return Value (RetVal)

Type: AcCmColor

The AutoCAD true color object assigned to the grid color.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetGridColor()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Get the current TableStyle object
    Dim tableStyle As AcadTableStyle
    Set tableStyle = dictObj.Item(ThisDrawing.GetVariable("CTABLESTYLE"))

    Dim colGridCurrent As AcadAcCmColor, lwGridCurrent As ACAD_LWEIGHT, visGridCurrent As Boolean
    Set colGridCurrent = tableStyle.GetGridColor(acHorzBottom, acTitleRow)
    lwGridCurrent = tableStyle.GetGridLineWeight(acHorzBottom, acTitleRow)
    visGridCurrent = tableStyle.GetGridVisibility(acHorzTop, acTitleRow)

    MsgBox "Grid settings " & vbLf & _
           "nColor (Bottom) = " & colGridCurrent.ColorIndex & vbLf & _
           "nLineweight (Bottom) = " & lwGridCurrent & vbLf & _
           "Visibility (Top) =  " & visGridCurrent

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 0, 0, 255

    tableStyle.SetGridColor acHorzBottom, acTitleRow, col
    tableStyle.SetGridLineWeight acHorzBottom, acTitleRow, acLnWt025

    If visGridCurrent = False Then
        tableStyle.SetGridVisibility acHorzTop, acTitleRow, True
    Else
        tableStyle.SetGridVisibility acHorzTop, acTitleRow, False
    End If

    Dim colGridNew As AcadAcCmColor, lwGridNew As ACAD_LWEIGHT, visGridNew As Boolean
    Set colGridNew = tableStyle.GetGridColor(acHorzBottom, acTitleRow)
    lwGridNew = tableStyle.GetGridLineWeight(acHorzBottom, acTitleRow)
    visGridNew = tableStyle.GetGridVisibility(acHorzTop, acTitleRow)

    MsgBox "Grid settings " & vbLf & _
           "nColor (Bottom) = " & colGridNew.ColorIndex & vbLf & _
           "nLineweight (Bottom) = " & lwGridNew & vbLf & _
           "Visibility (Top) =  " & visGridNew

    tableStyle.SetGridColor acHorzBottom, acTitleRow, colGridCurrent
    tableStyle.SetGridLineWeight acHorzBottom, acTitleRow, lwGridCurrent
    tableStyle.SetGridVisibility acHorzTop, acTitleRow, visGridCurrent

    MsgBox "Reset the table style back to its original values."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetGridColor()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Get the current TableStyle object
    (setq tableStyle (vla-Item dictObj (vla-GetVariable doc "CTABLESTYLE")))

    (setq colGridCurrent (vla-GetGridColor tableStyle acHorzBottom acTitleRow))
    (setq lwGridCurrent (vla-GetGridLineWeight tableStyle acHorzBottom acTitleRow))
    (setq visGridCurrent (vla-GetGridVisibility tableStyle acHorzTop acTitleRow))

    (alert (strcat "Grid settings"
                         "\nColor (Bottom) = " (itoa (vla-get-ColorIndex colGridCurrent))
                         "\nLineweight (Bottom) = " (itoa lwGridCurrent)
                         "\nVisibility (Top) = " (if (= visGridCurrent :vlax-true) "True" "False")))

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 0 0 255)

    (vla-SetGridColor tableStyle acHorzBottom acTitleRow col)
    (vla-SetGridLineWeight tableStyle acHorzBottom acTitleRow acLnWt025)
    (vla-SetGridVisibility tableStyle acHorzTop acTitleRow (if (= visGridCurrent :vlax-true) :vlax-false :vlax-true))

    (setq colGridNew (vla-GetGridColor tableStyle acHorzBottom acTitleRow))
    (setq lwGridNew (vla-GetGridLineWeight tableStyle acHorzBottom acTitleRow))
    (setq visGridNew (vla-GetGridVisibility tableStyle acHorzTop acTitleRow))

    (alert (strcat "Grid settings"
                         "\nColor (Bottom) = " (itoa (vla-get-ColorIndex colGridNew))
                         "\nLineweight (Bottom) = " (itoa lwGridNew)
                         "\nVisibility (Top) = " (if (= visGridNew :vlax-true) "True" "False")))

    (vla-SetGridColor tableStyle acHorzBottom acTitleRow colGridCurrent)
    (vla-SetGridLineWeight tableStyle acHorzBottom acTitleRow lwGridCurrent)
    (vla-SetGridVisibility tableStyle acHorzTop acTitleRow visGridCurrent)

    (alert "Reset the table style back to its original values.")

    (vlax-release-object col)
)


GetGridColor2 Method (ActiveX)

Gets the gridColor for the specified cell.

Supported platforms: Windows only

Signature - Table

VBA:

RetVal = object.GetGridColor2(nRow, nCol, nGridLineType)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Integer

The row number of the cell to set.

nCol

Access: Input-only

Type: Integer

The column number of the cell to set.

nGridLineType

Access: Input-only

Type: AcGridLineType enum

The grid line type to check.

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight

Signature - TableStyle

VBA:

RetVal = object.GetGridColor2(bstrCellStyle, gridLineType)
object

Type: TableStyle

The object this method applies to.

bstrCellStyle

Access: Input-only

Type: String

A named cell style in the table style.

nGridLineType

Access: Input-only

Type: AcGridLineType enum

The grid line type to check.

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight

Return Value (RetVal)

Type: AcCmColor

The pointer which stores a reference to the color.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetGridDoubleLineSpacing Method (ActiveX)

Gets the lineSpacing value for the specified cell.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetGridDoubleLineSpacing(nRow, nCol, nGridLineType)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Integer

The row number of the cell to set.

nCol

Access: Input-only

Type: Integer

The column number of the cell to set.

nGridLineType

Access: Input-only

Type: AcGridLineType enum

The grid line type to check.

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight

Return Value (RetVal)

Type: Double

The line spacing value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetGridLineStyle Method (ActiveX)

Get a cell's gridLineStyle.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetGridLineStyle(nRow, nCol, nGridLineType)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Integer

The row number of the cell to set.

nCol

Access: Input-only

Type: Integer

The column number of the cell to set.

nGridLineType

Access: Input-only

Type: AcGridLineType enum

The grid line type to check.

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight

Return Value (RetVal)

Type: AcGridLineStyle enum

  • acGridLineStyleDouble
  • acGridLineStyleSingle

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetGridLinetype Method (ActiveX)

Gets the idLinetype with the gridLinetype value for the specified cell.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetGridLinetype(nRow, nCol, nGridLineType)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Integer

The row number of the cell to set.

nCol

Access: Input-only

Type: Integer

The column number of the cell to set.

nGridLineType

Access: Input-only

Type: AcGridLineType enum

The grid line type to check.

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight

Return Value (RetVal)

Type: Long_PTR

The object id of the Linetype from the cell.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetGridLineWeight Method (ActiveX)

Returns a grid lineweight value for a grid linetype and row type.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetGridLineWeight(gridLineType, rowType)
object

Type: Table, TableStyle

The objects this method applies to.

gridLineType

Access: Input-only

Type: AcGridLineType enum

The grid line type to check.

  • acHorzBottom: Top or bottom horizontal grid line, based on the flow direction.
  • acHorzInside: All horizontal grid lines, excluding the top and bottom lines.
  • acHorzTop: Top or bottom horizontal grid line, based on the flow direction.
  • acInvalidGridLine: An invalid grid line.
  • acVertInside: All the vertical grid lines, excluding the farthest left and farthest right grid lines.
  • acVertLeft: Farthest left grid line.
  • acVertRight: Farthest right grid line.
rowType

Access: Input-only

Type: AcRowType enum

The row type.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow

Return Value (RetVal)

Type: ACAD_LWEIGHT enum

  • acLnWt000
  • acLnWt005
  • acLnWt009
  • acLnWt013
  • acLnWt015
  • acLnWt018
  • acLnWt020
  • acLnWt025
  • acLnWt030
  • acLnWt035
  • acLnWt040
  • acLnWt050
  • acLnWt053
  • acLnWt060
  • acLnWt070
  • acLnWt080
  • acLnWt090
  • acLnWt100
  • acLnWt106
  • acLnWt120
  • acLnWt140
  • acLnWt158
  • acLnWt200
  • acLnWt211
  • acLnWtByLayer
  • acLnWtByBlock
  • acLnWtByLwDefault

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetGridColor()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Get the current TableStyle object
    Dim tableStyle As AcadTableStyle
    Set tableStyle = dictObj.Item(ThisDrawing.GetVariable("CTABLESTYLE"))

    Dim colGridCurrent As AcadAcCmColor, lwGridCurrent As ACAD_LWEIGHT, visGridCurrent As Boolean
    Set colGridCurrent = tableStyle.GetGridColor(acHorzBottom, acTitleRow)
    lwGridCurrent = tableStyle.GetGridLineWeight(acHorzBottom, acTitleRow)
    visGridCurrent = tableStyle.GetGridVisibility(acHorzTop, acTitleRow)

    MsgBox "Grid settings " & vbLf & _
           "nColor (Bottom) = " & colGridCurrent.ColorIndex & vbLf & _
           "nLineweight (Bottom) = " & lwGridCurrent & vbLf & _
           "Visibility (Top) =  " & visGridCurrent

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 0, 0, 255

    tableStyle.SetGridColor acHorzBottom, acTitleRow, col
    tableStyle.SetGridLineWeight acHorzBottom, acTitleRow, acLnWt025

    If visGridCurrent = False Then
        tableStyle.SetGridVisibility acHorzTop, acTitleRow, True
    Else
        tableStyle.SetGridVisibility acHorzTop, acTitleRow, False
    End If

    Dim colGridNew As AcadAcCmColor, lwGridNew As ACAD_LWEIGHT, visGridNew As Boolean
    Set colGridNew = tableStyle.GetGridColor(acHorzBottom, acTitleRow)
    lwGridNew = tableStyle.GetGridLineWeight(acHorzBottom, acTitleRow)
    visGridNew = tableStyle.GetGridVisibility(acHorzTop, acTitleRow)

    MsgBox "Grid settings " & vbLf & _
           "nColor (Bottom) = " & colGridNew.ColorIndex & vbLf & _
           "nLineweight (Bottom) = " & lwGridNew & vbLf & _
           "Visibility (Top) =  " & visGridNew

    tableStyle.SetGridColor acHorzBottom, acTitleRow, colGridCurrent
    tableStyle.SetGridLineWeight acHorzBottom, acTitleRow, lwGridCurrent
    tableStyle.SetGridVisibility acHorzTop, acTitleRow, visGridCurrent

    MsgBox "Reset the table style back to its original values."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetGridLineWeight()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Get the current TableStyle object
    (setq tableStyle (vla-Item dictObj (vla-GetVariable doc "CTABLESTYLE")))

    (setq colGridCurrent (vla-GetGridColor tableStyle acHorzBottom acTitleRow))
    (setq lwGridCurrent (vla-GetGridLineWeight tableStyle acHorzBottom acTitleRow))
    (setq visGridCurrent (vla-GetGridVisibility tableStyle acHorzTop acTitleRow))

    (alert (strcat "Grid settings"
                         "\nColor (Bottom) = " (itoa (vla-get-ColorIndex colGridCurrent))
                         "\nLineweight (Bottom) = " (itoa lwGridCurrent)
                         "\nVisibility (Top)= " (if (= visGridCurrent :vlax-true) "True" "False")))

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 0 0 255)

    (vla-SetGridColor tableStyle acHorzBottom acTitleRow col)
    (vla-SetGridLineWeight tableStyle acHorzBottom acTitleRow acLnWt025)
    (vla-SetGridVisibility tableStyle acHorzTop acTitleRow (if (= visGridCurrent :vlax-true) :vlax-false :vlax-true))

    (setq colGridNew (vla-GetGridColor tableStyle acHorzBottom acTitleRow))
    (setq lwGridNew (vla-GetGridLineWeight tableStyle acHorzBottom acTitleRow))
    (setq visGridNew (vla-GetGridVisibility tableStyle acHorzTop acTitleRow))

    (alert (strcat "Grid settings"
                         "\nColor (Bottom) = " (itoa (vla-get-ColorIndex colGridNew))
                         "\nLineweight (Bottom) = " (itoa lwGridNew)
                         "\nVisibility (Top)= " (if (= visGridNew :vlax-true) "True" "False")))

    (vla-SetGridColor tableStyle acHorzBottom acTitleRow colGridCurrent)
    (vla-SetGridLineWeight tableStyle acHorzBottom acTitleRow lwGridCurrent)
    (vla-SetGridVisibility tableStyle acHorzBottom acTitleRow visGridCurrent)

    (alert "Reset the table style back to its original values.")

    (vlax-release-object col)
)


GetGridLineWeight2 Method (ActiveX)

Gets the gridLineWeight value for the specified cell.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetGridLineWeight2(nRow, nCol, nGridLineType)
object

Type: Table, TableStyle

The objects this method applies to.

nRow

Access: Input-only

Type: Integer

The row number of the cell to set.

nCol

Access: Input-only

Type: Integer

The column number of the cell to set.

nGridLineType

Access: Input-only

Type: AcGridLineType enum

The grid line type to check.

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight

Return Value (RetVal)

Type: ACAD_LWEIGHT enum

  • acLnWt000
  • acLnWt005
  • acLnWt009
  • acLnWt013
  • acLnWt015
  • acLnWt018
  • acLnWt020
  • acLnWt025
  • acLnWt030
  • acLnWt035
  • acLnWt040
  • acLnWt050
  • acLnWt053
  • acLnWt060
  • acLnWt070
  • acLnWt080
  • acLnWt090
  • acLnWt100
  • acLnWt106
  • acLnWt120
  • acLnWt140
  • acLnWt158
  • acLnWt200
  • acLnWt211
  • acLnWtByLayer
  • acLnWtByBlock
  • acLnWtByLwDefault

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetGridSpacing Method (ActiveX)

Gets the grid spacing for the viewport.

Supported platforms: Windows only

Signature

VBA:

object.GetGridSpacing XSpacing, YSpacing
object

Type: PViewport, Viewport

The objects this method applies to.

XSpacing

Access: Output-only

Type: Double

The X spacing of the grid in the viewport.

YSpacing

Access: Output-only

Type: Double

The Y spacing of the grid in the viewport.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetGridSpacing()
    ' This example turns on the grid for the current viewport.
    ' It then finds the current grid spacing, and changes that spacing.

    ' Find the current active viewport
    Dim viewportObj As AcadViewport
    Set viewportObj = ThisDrawing.ActiveViewport

    ' Turn on the grid and reset the viewport to see it come on.
    viewportObj.GridOn = True
    ThisDrawing.ActiveViewport = viewportObj

    ' Find the current grid spacing
    Dim XSpacing As Double
    Dim YSpacing As Double

    viewportObj.GetGridSpacing XSpacing, YSpacing
    MsgBox "X =" & XSpacing & ", Y =" & YSpacing, , "GetGridSpacing Example"

    ' Change the grid spacing
    XSpacing = XSpacing * 0.5
    YSpacing = YSpacing * 0.5
    viewportObj.SetGridSpacing XSpacing, YSpacing
    ThisDrawing.ActiveViewport = viewportObj
    MsgBox "X =" & XSpacing & ", Y =" & YSpacing, , "GetGridSpacing Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetGridSpacing()
    ;; This example turns on the grid for the current viewport.
    ;; It then finds the current grid spacing, and changes that spacing.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Find the current active viewport
    (setq viewportObj (vla-get-ActiveViewport doc))

    ;; Turn on the grid and reset the viewport to see it come on.
    (vla-put-GridOn viewportObj :vlax-true)
    (vla-put-ActiveViewport doc viewportObj)

    ;; Find the current grid spacing
    (vla-GetGridSpacing viewportObj 'XSpacing 'YSpacing)
    (alert (strcat "X =" (rtos XSpacing 2) ", Y =" (rtos YSpacing 2)))

    ;; Change the grid spacing
    (vla-SetGridSpacing viewportObj (* XSpacing 0.5) (* YSpacing 0.5))
    (vla-put-ActiveViewport doc viewportObj)

    (vla-GetGridSpacing viewportObj 'XSpacing 'YSpacing)
    (alert (strcat "X =" (rtos XSpacing 2) ", Y =" (rtos YSpacing 2)))
)


GetGridVisibility Method (ActiveX)

Returns a grid visibility value for the specified grid linetype and row type.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetGridVisibility(gridLineType, rowType)
object

Type: Table, TableStyle

The objects this method applies to.

gridLineType

Access: Input-only

Type: AcGridLineType enum

The grid line type to check.

  • acHorzBottom: Top or bottom horizontal grid line, based on the flow direction.
  • acHorzInside: All horizontal grid lines, excluding the top and bottom lines.
  • acHorzTop: Top or bottom horizontal grid line, based on the flow direction.
  • acInvalidGridLine: An invalid grid line.
  • acVertInside: All the vertical grid lines, excluding the farthest left and farthest right grid lines.
  • acVertLeft: Farthest left grid line.
  • acVertRight: Farthest right grid line.
rowType

Access: Input-only

Type: AcRowType enum

The row type.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow

Return Value (RetVal)

Type: Boolean

  • True: Grid linetype is visible for the row type.
  • False: Grid linetype is not visible for the row type.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetGridVisibility()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Get the current TableStyle object
    Dim tableStyle As AcadTableStyle
    Set tableStyle = dictObj.Item(ThisDrawing.GetVariable("CTABLESTYLE"))

    Dim colGridCurrent As AcadAcCmColor, lwGridCurrent As ACAD_LWEIGHT, visGridCurrent As Boolean
    Set colGridCurrent = tableStyle.GetGridColor(acHorzBottom, acTitleRow)
    lwGridCurrent = tableStyle.GetGridLineWeight(acHorzBottom, acTitleRow)
    visGridCurrent = tableStyle.GetGridVisibility(acHorzTop, acTitleRow)

    MsgBox "Grid settings " & vbLf & _
           "nColor (Bottom) = " & colGridCurrent.ColorIndex & vbLf & _
           "nLineweight (Bottom) = " & lwGridCurrent & vbLf & _
           "Visibility (Top) =  " & visGridCurrent

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 0, 0, 255

    tableStyle.SetGridColor acHorzBottom, acTitleRow, col
    tableStyle.SetGridLineWeight acHorzBottom, acTitleRow, acLnWt025

    If visGridCurrent = False Then
        tableStyle.SetGridVisibility acHorzTop, acTitleRow, True
    Else
        tableStyle.SetGridVisibility acHorzTop, acTitleRow, False
    End If

    Dim colGridNew As AcadAcCmColor, lwGridNew As ACAD_LWEIGHT, visGridNew As Boolean
    Set colGridNew = tableStyle.GetGridColor(acHorzBottom, acTitleRow)
    lwGridNew = tableStyle.GetGridLineWeight(acHorzBottom, acTitleRow)
    visGridNew = tableStyle.GetGridVisibility(acHorzTop, acTitleRow)

    MsgBox "Grid settings " & vbLf & _
           "nColor (Bottom) = " & colGridNew.ColorIndex & vbLf & _
           "nLineweight (Bottom) = " & lwGridNew & vbLf & _
           "Visibility (Top) =  " & visGridNew

    tableStyle.SetGridColor acHorzBottom, acTitleRow, colGridCurrent
    tableStyle.SetGridLineWeight acHorzBottom, acTitleRow, lwGridCurrent
    tableStyle.SetGridVisibility acHorzTop, acTitleRow, visGridCurrent

    MsgBox "Reset the table style back to its original values."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetGridVisibility()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Get the current TableStyle object
    (setq tableStyle (vla-Item dictObj (vla-GetVariable doc "CTABLESTYLE")))

    (setq colGridCurrent (vla-GetGridColor tableStyle acHorzBottom acTitleRow))
    (setq lwGridCurrent (vla-GetGridLineWeight tableStyle acHorzBottom acTitleRow))
    (setq visGridCurrent (vla-GetGridVisibility tableStyle acHorzTop acTitleRow))

    (alert (strcat "Grid settings"
                         "\nColor (Bottom) = " (itoa (vla-get-ColorIndex colGridCurrent))
                         "\nLineweight (Bottom) = " (itoa lwGridCurrent)
                         "\nVisibility (Top)= " (if (= visGridCurrent :vlax-true) "True" "False")))

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 0 0 255)

    (vla-SetGridColor tableStyle acHorzBottom acTitleRow col)
    (vla-SetGridLineWeight tableStyle acHorzBottom acTitleRow acLnWt025)
    (vla-SetGridVisibility tableStyle acHorzTop acTitleRow (if (= visGridCurrent :vlax-true) :vlax-false :vlax-true))

    (setq colGridNew (vla-GetGridColor tableStyle acHorzBottom acTitleRow))
    (setq lwGridNew (vla-GetGridLineWeight tableStyle acHorzBottom acTitleRow))
    (setq visGridNew (vla-GetGridVisibility tableStyle acHorzTop acTitleRow))

    (alert (strcat "Grid settings"
                         "\nColor (Bottom) = " (itoa (vla-get-ColorIndex colGridNew))
                         "\nLineweight (Bottom) = " (itoa lwGridNew)
                         "\nVisibility (Top)= " (if (= visGridNew :vlax-true) "True" "False")))

    (vla-SetGridColor tableStyle acHorzBottom acTitleRow colGridCurrent)
    (vla-SetGridLineWeight tableStyle acHorzBottom acTitleRow lwGridCurrent)
    (vla-SetGridVisibility tableStyle acHorzBottom acTitleRow visGridCurrent)

    (alert "Reset the table style back to its original values.")

    (vlax-release-object col)
)


GetGridVisibility2 Method (ActiveX)

Returns the gridVisibility value for the specified cell.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetGridVisibility2(nRow, nCol, nGridLineType)
object

Type: Table, TableStyle

The objects this method applies to.

nRow

Access: Input-only

Type: Integer

The row number of the cell to set.

nCol

Access: Input-only

Type: Integer

The column number of the cell to set.

nGridLineType

Access: Input-only

Type: AcGridLineType enum

The grid line type to check.

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight

Return Value (RetVal)

Type: Boolean

  • True: Grid linetype is visible for the row type.
  • False: Grid linetype is not visible for the row type.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetHasFormula Method (ActiveX)

Check if a cell has a formula.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetHasFormula(nRow, nCol, nContent)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The value of the row.

nCol

Access: Input-only

Type: Long

The value of the column.

nContent

Access: Input-only

Type: Long

The value of the content.

Return Value (RetVal)

Type: Boolean

  • True: The table cell contains a formula.
  • False: The table cell does not contain a formula.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetInput Method (ActiveX)

Converts a user's input string into a keyword index.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetInput()
object

Type: Utility

The object this method applies to.

Return Value (RetVal)

Type: String

The index specifying which keyword was entered.

Remarks

This method retrieves a keyword entered by the AutoCAD user during a call to one of the user-input functions (Get* methods).

The maximum length of the keyword is 511 characters (with the 512th character reserved for the NULL character).

A call to GetInput is meaningless and will fail unless it immediately follows a call to one of the user-input functions. Even then, the call will be successful only if the user-input function has returned the error description "User input is a keyword."

It is not necessary to call GetInput after a call to the GetKeyword method.

The keywords recognized by the application are specified by a prior call to the InitializeUserInput method. The interpretation of the keywords is entirely up to the application. Keywords should not duplicate the names of AutoCAD commands.

The user can abbreviate a keyword, but GetInput always returns the full keyword as it was defined in the InitializeUserInput call with the original capitalization, so the application needs to do only one string comparison for each keyword it defines.

Examples

VBA:

Sub Example_GetInput()
    ' This example prompts for user input of a point. By using the
    ' InitializeUserInput method to define a keyword list, the example can also
    ' return keywords entered by the user.

    AppActivate ThisDrawing.Application.Caption

    On Error Resume Next

    ' Define the valid keywords
    Dim keywordList As String
    keywordList = "Line Circle"

    ' Call InitializeUserInput to set up the keywords
    ThisDrawing.Utility.InitializeUserInput 128, keywordList

    ' Get the user input
    Dim returnPnt As Variant
    returnPnt = ThisDrawing.Utility.GetPoint(, vbLf & "Enter a point [Line/Circle]: ")
    If Err Then
         If StrComp(Err.Description, "User input is a keyword", 1) = 0 Then
         ' One of the keywords was entered
             Dim inputString As String
             Err.Clear
             inputString = ThisDrawing.Utility.GetInput
             MsgBox "You entered the keyword: " & inputString
         Else
             MsgBox "Error selecting the point: " & Err.Description
             Err.Clear
         End If
    Else
        ' Display point coordinates
        MsgBox "The WCS of the point is: " & returnPnt(0) & ", " & returnPnt(1) & ", " & returnPnt(2), , "GetInput Example"
    End If

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetInput()
    ;; This example prompts for user input of a point. By using the
    ;; InitializeUserInput method to define a keyword list, the example can also
    ;; return keywords entered by the user.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the valid keywords
    (setq keywordList "Line Circle")

    ;; Call InitializeUserInput to set up the keywords
    (vla-InitializeUserInput (vla-get-Utility doc) 128 keywordList)

    ;; Get the user input
    (setq returnPntOrErr (vl-catch-all-apply 'vla-GetPoint (list (vla-get-Utility doc) nil "Enter a point [Line/Circle]: ")))

    (if (= (type returnPntOrErr)'VL-CATCH-ALL-APPLY-ERROR)
        (progn
            (if (= (vl-catch-all-error-message returnPntOrErr) "Automation Error. User input is a keyword")
                   (progn
                    (setq inputString (vla-GetInput (vla-get-Utility doc)))
                    (alert (strcat "You entered the keyword: " inputString))
                      )
                (alert "User pressed ESC or unknown input was provided.")
               )
        )
        ;; Display point coordinates
        (progn
               (setq returnPnt (vlax-safearray->list (vlax-variant-value returnPntOrErr)))
            (alert (strcat "The WCS of the point is: " (rtos (nth 0 returnPnt) 2) ", " (rtos (nth 1 returnPnt) 2) ", " (rtos (nth 2 returnPnt) 2)))
           )
    )
)


GetInteger Method (ActiveX)

Gets an integer value from the user.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetInteger([Prompt])
object

Type: Utility

The object this method applies to.

Prompt

Access: Input-only; optional

Type: Variant (string)

The text used to prompt the user for input.

Return Value (RetVal)

Type: Long

The integer value returned by the user.

Remarks

AutoCAD pauses for user input of an integer and sets the return value to the selected value. The Prompt parameter specifies a string that AutoCAD displays before it pauses. The Prompt is optional.

The AutoCAD user can enter any valid (short) integer in the range of -32,768 to +32,767.

If a keyword is returned instead of an integer, or if the user presses Enter without entering a value, AutoCAD generates error number -2145320928 (and the error message, "User input is a keyword"). Use the GetInput method to obtain the keyword from the return value.

Examples

VBA:

Sub Example_GetInteger()
    ' This example returns the integer entered by the user.

    AppActivate ThisDrawing.Application.Caption

    Dim returnInt As Integer

    ' Return the value entered by user. A prompt is provided.
    returnInt = ThisDrawing.Utility.GetInteger("Enter an integer: ")
    MsgBox "The integer entered was " & returnInt & vbCrLf & _
           "(Enter the next value without prompting.)", , "GetInteger Example"

    ' Return the value entered by user. No prompt is provided.
    returnInt = ThisDrawing.Utility.GetInteger()
    MsgBox "The integer entered was " & returnInt, , "GetInteger Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetInteger()
    ;; This example returns the integer entered by the user.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Return the value entered by user. A prompt is provided.
    (setq returnInt (vla-GetInteger (vla-get-Utility doc) "Enter an integer: "))
    (alert (strcat "The integer entered was " (itoa returnInt)
                   "\n(Enter the next value without prompting.)"))

    ;; Return the value entered by user. No prompt is provided.
    (setq returnInt (vla-GetInteger (vla-get-Utility doc)))
    (alert (strcat "The integer entered was " (itoa returnInt)))
)


GetInterfaceObject Method (ActiveX)

Accepts a program ID and attempts to load it into AutoCAD as an in-process server.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetInterfaceObject(ProgID)
object

Type: Application

The object this method applies to.

ProgID

Access: Input-only

Type: String

The program ID of the interface object to return.

Return Value (RetVal)

Type: Object

The interface object matching the program ID.

Remarks

Although the object will be loaded into AutoCAD, it will not show up in its type library. The object will have its own type library. This method lets you connect to an ActiveX Automation server.

If possible, use version-dependent ProgIDs. If a GetInterfaceObject method uses a version-independent ProgID, change the method to use a version-dependent ProgID. For example, you would change AcadLayerStateManager to AcadLayerStateManager.20.

Examples

VBA:

Sub Example_GetInterfaceObject()
    ' This example returns top level object of another application.
    On Error GoTo ERRORHANDLER

    Dim poly As Object
    Set poly = ThisDrawing.Application.GetInterfaceObject("Polycad.Application")

ERRORHANDLER:
    MsgBox Err.Description, , "GetInterfaceObject Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetInterfaceObject()
    ;; This example returns top level object of another application.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq poly (vl-catch-all-apply 'vla-GetInterfaceObject (list acadObj "Polycad.Application")))

    (if (= (type poly)'VL-CATCH-ALL-APPLY-ERROR)
        (alert (strcat "Error occured: \n" (vl-catch-all-error-message poly)))
    )
)


GetInvisibleEdge Method (ActiveX)

Gets the visibility setting for an edge of a 3DFace object at a given index.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetInvisibleEdge(Index)
object

Type: 3DFace

The object this method applies to.

Index

Access: Input-only

Type: Long

The index of the edge to query. The index must be between 0 and 3 inclusive.

Return Value (RetVal)

Type: Boolean

  • True: The edge is invisible.
  • False: The edge is visible.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetInvisibleEdge()
    ' This example creates a 3D face in model space.
    ' It then toggles the visibility of the  first edge.

    Dim faceObj As Acad3DFace
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    Dim point3(0 To 2) As Double
    Dim point4(0 To 2) As Double

    ' Define the four coordinates of the face
    point1(0) = 1#: point1(1) = 1#: point1(2) = 0#
    point2(0) = 5#: point2(1) = 1#: point2(2) = 1#
    point3(0) = 5#: point3(1) = 5#: point3(2) = 1#
    point4(0) = 1#: point4(1) = 10#: point4(2) = 0#

    ' Create the 3DFace object in model space
    Set faceObj = ThisDrawing.ModelSpace.Add3DFace(point1, point2, point3, point4)
    ZoomAll

    ' Find the current visibility status of the first edge of the face
    Dim visStatus As Boolean
    visStatus = faceObj.GetInvisibleEdge(0)
    MsgBox "The first face is currently " & IIf(faceObj.GetInvisibleEdge(0), "visible.", "invisible."), , "GetInvisibleEdge Example"

    ' Toggle the visibility of the first edge of the face
    faceObj.SetInvisibleEdge 0, Not (visStatus)
    ThisDrawing.Regen False
    MsgBox "The first face is now " & IIf(faceObj.GetInvisibleEdge(0), "visible.", "invisible."), , "GetInvisibleEdge Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetInvisibleEdge()
    ;; This example creates a 3D face in model space.
    ;; It then toggles the visibility of the  first edge.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the four coordinates of the face
    (setq point1 (vlax-3d-point 1 1 0)
          point2 (vlax-3d-point 5 1 1)
          point3 (vlax-3d-point 5 5 1)
          point4 (vlax-3d-point 1 10 0))

    ;; Create the 3DFace object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq faceObj (vla-Add3DFace modelSpace point1 point2 point3 point4))
    (vla-ZoomAll acadObj)

    ;; Find the current visibility status of the first edge of the face
    (setq visStatus (vla-GetInvisibleEdge faceObj 0))
    (alert (strcat "The first face is currently " (if (= visStatus :vlax-true) "visible." "invisible.")))

    ;; Toggle the visibility of the first edge of the face
    (vla-SetInvisibleEdge faceObj 0 (if (= visStatus :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc :vlax-false)
    (alert (strcat "The first face is now " (if (= (vla-GetInvisibleEdge faceObj 0) :vlax-true) "visible." "invisible.")))
)


GetIsCellStyleInUse Method (ActiveX)

Gets the usage status of a cell style.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetIsCellStyleInUse(pszCellStyle)
object

Type: TableStyle

The object this method applies to.

pszCellStyle

Access: Input-only

Type: String

The cell style name.

Return Value (RetVal)

Type: Boolean

Cell style status.

  • True: The cell is in use.
  • False: The cell is not being used.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellStyle()
    ' This example creates a TableStyle object and sets values for
    ' the style name and formatting.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As IAcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.CreateCellStyle ("NewTestStyle")
    Dim cellTestFormat As String

    customObj.SetFormat2 "NewTestStyle", "test format"
    customObj.GetFormat2 "NewTestStyle", cellTestFormat

    MsgBox "Cell Style Name = " & cellTestFormat

    customObj.RenameCellStyle "NewTestStyle", "NewTestStyle2"
    customObj.GetFormat2 "NewTestStyle2", cellTestFormat

    MsgBox "Cell Style Name = " & cellTestFormat

    Dim uniqueStyleName As String

    uniqueStyleName = customObj.GetUniqueCellStyleName("testbase")

    MsgBox "Cell Style Name = " & uniqueStyleName

    If customObj.GetIsCellStyleInUse("testbase") = False Then
        MsgBox "That cell style is not being used!"
    End If

    customObj.CreateCellStyleFromStyle "TestStyleFromStyle", "NewTestStyle2"

    customObj.DeleteCellStyle "NewTestStyle2"

    Dim numOfStyles As Long
    numOfStyles = customObj.NumCellStyles
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellStyle()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and formatting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-CreateCellStyle customObj "NewTestStyle")

    (setq cellTestFormat "")
    (vla-SetFormat2 customObj "NewTestStyle" "test format")
    (vla-GetFormat2 customObj "NewTestStyle" 'cellTestFormat)

    (alert (strcat "Cell Style Name = " cellTestFormat))

    (vla-RenameCellStyle customObj "NewTestStyle" "NewTestStyle2")
    (vla-GetFormat2 customObj "NewTestStyle2" 'cellTestFormat)

    (alert (strcat "Cell Style Name = " cellTestFormat))

    (setq uniqueStyleName (vla-GetUniqueCellStyleName customObj "testbase"))

    (alert (strcat "Cell Style Name = " uniqueStyleName))

    (if (= (vla-GetIsCellStyleInUse customObj "testbase") :vlax-false)
        (alert "That cell style is not being used!")
    )

    (vla-CreateCellStyleFromStyle customObj "TestStyleFromStyle" "NewTestStyle2")

    (vla-DeleteCellStyle customObj "NewTestStyle2")

    (setq numOfStyles (vla-get-NumCellStyles customObj))
    (alert (strcat "Number of Cell Styles = " (itoa numOfStyles)))
)


GetIsMergeAllEnabled Method (ActiveX)

Gets value of the "merge all" property.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetIsMergeAllEnabled(StringCellStyle)
object

Type: TableStyle

The object this method applies to.

StringCellStyle

Access: Input-only

Type: String

The cell style name.

Return Value (RetVal)

Type: Boolean

  • True: Cell style "merge all" property is enabled.
  • False: Cell style "merge all" property is not enabled.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_EnableMergeAll()
    ' This example creates a TableStyle object and sets values for
    ' the style cell merging.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As IAcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.CreateCellStyle "NewTestStyle2"
    customObj.EnableMergeAll "NewTestStyle2", False

    If customObj.GetIsMergeAllEnabled("NewTestStyle2") = False Then
        MsgBox "Merge all is not enabled!"
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_EnableMergeAll()
    ;; This example creates a TableStyle object and sets values for
    ;; the style cell merging.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")
    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-CreateCellStyle customObj "NewTestStyle2")
    (vla-EnableMergeAll customObj "NewTestStyle2" :vlax-false)

    (if (= (vla-GetIsMergeAllEnabled customObj "NewTestStyle2") :vlax-false)
        (alert "Merge all is not enabled!")
    )
)


GetKeyword Method (ActiveX)

Gets a keyword string from the user.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetKeyword([Prompt])
object

Type: Utility

The object this method applies to.

Prompt

Access: Input-only; optional

Type: Variant (string)

The text used to prompt the user for input.

Return Value (RetVal)

Type: String

The keyword returned from the user.

Remarks

AutoCAD pauses for user input of a keyword and sets the return value to the keyword that was entered. The Prompt parameter specifies a string that AutoCAD displays before it pauses. The Prompt is optional. The maximum length of the return value is 511 characters.

The AutoCAD user can enter the keyword from the keyboard. The list of keywords that this method will accept is set by a prior call to the InitializeUserInput method. If the user enters a string not specified in the call to InitializeUserInput, AutoCAD displays an error message and tries again (and redisplays the prompt, if one was specified). If the user doesn't enter anything but presses the Enter key, GetKeyword returns an empty string ("") unless the call to InitializeUserInput also disallowed NULL input.

Examples

VBA:

Sub Example_GetKeyword()
    ' This example uses Getkeyword to return a keyword entered by the user.
    ' InitializeUserInput establishes the valid keywords.

    AppActivate ThisDrawing.Application.Caption

    ' Define the list of valid keywords
    Dim kwordList As String
    kwordList = "Width Height Depth"
    ThisDrawing.Utility.InitializeUserInput 1, kwordList

    ' Prompt the user to input any of the keywords. Return "Width", "Height" or "Depth" in
    ' the returnString variable depending on whether the user input "W", "H" or "D".
    Dim returnString As String
    returnString = ThisDrawing.Utility.GetKeyword(vbLf & "Enter a keyword [Height/Width/Depth]: ")
    MsgBox "You entered " & returnString, , "GetKeyword Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetKeyword()
    ;; This example uses Getkeyword to return a keyword entered by the user.
    ;; InitializeUserInput establishes the valid keywords.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the list of valid keywords
    (setq kwordList "Width Height Depth")
    (vla-InitializeUserInput (vla-get-Utility doc) 1 kwordList)

    ;; Prompt the user to input any of the keywords. Return "Width", "Height" or "Depth" in
    ;; the returnString variable depending on whether the user input "W", "H" or "D".
    (setq returnString (vla-GetKeyword (vla-get-Utility doc) "\nEnter a keyword [Height/Width/Depth]: "))
    (alert (strcat "You entered " returnString))
)


GetLeaderIndex Method (ActiveX)

Gets the index of leader cluster which the specified leader line is in.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetLeaderIndex(leaderLineIndex)
object

Type: MLeader

The object this method applies to.

leaderLineIndex

Access: Input-only

Type: Long

The leader line index.

Return Value (RetVal)

Type: Long

The leader cluster index.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetLeaderLineIndexes Method (ActiveX)

Gets the indexes of leaderlines of the specific leader.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetLeaderLineIndexes(leaderIndex)
object

Type: MLeader

The object this method applies to.

leaderIndex

Access: Input-only

Type: Long

The leader line index.

Return Value (RetVal)

Type: Variant (three-element array of doubles)

The indexes of leaderlines owned by the input leader.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetLeaderLineVertices Method (ActiveX)

Gets the vertices of leaderLine with specified index.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetLeaderLineVertices(leaderLineIndex)
object

Type: MLeader

The object this method applies to.

leaderLineIndex

Access: Input-only

Type: Long

The leader line index.

Return Value (RetVal)

Type: Variant (three-element array of doubles)

The vertices of leaderlines owned by the input leader.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetLiveSection Method (ActiveX)

Gets the live section plane that is currently enabled in the database.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetLiveSection
object

Type: SectionManager

The object this method applies to.

Return Value (RetVal)

Type: Section

The current "live" Section object.

Remarks

Live sectioning is either enabled or disabled individually per section object. Live sectioning can be active for no more than one section object at a time.

NoteThe SectionManager object is not created until a section plane is created.

Examples

VBA:

Not available

Visual LISP:

Not available


GetLocaleMediaName Method (ActiveX)

Gets the localized version of the canonical media name.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetLocaleMediaName(Name)
object

Type: Layout, PlotConfiguration

The objects this method applies to.

Name

Access: Input-only

Type: String

The canonical media name to find the localized version of.

Return Value (RetVal)

Type: String

The localized version of the specified canonical media name.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetLocaleMediaName()
    ' This example gets the current plot device information
    ' and then displays the list of plot device names,
    ' media names, localized media names, and plot style
    ' table entries.
    Dim Layout As ACADLayout
    Set Layout = ThisDrawing.ModelSpace.Layout

    ' Refresh the current plot information for
    ' this session.
    Layout.RefreshPlotDeviceInfo

    ' List all the valid device names for the system
    Dim plotDevices As Variant
    plotDevices = Layout.GetPlotDeviceNames()

    Dim x As Integer
    For x = LBound(plotDevices) To UBound(plotDevices)
        MsgBox plotDevices(x)
    Next

    ' List all the media names, and their localized version
    Dim mediaNames As Variant
    mediaNames = Layout.GetCanonicalMediaNames()

    For x = LBound(mediaNames) To UBound(mediaNames)
        MsgBox mediaNames(x)
        MsgBox Layout.GetLocaleMediaName(mediaNames(x))
    Next

    ' List all the entries in the plot style table
    Dim styleNames As Variant
    styleNames = Layout.GetPlotStyleTableNames()

    For x = LBound(styleNames) To UBound(styleNames)
        MsgBox styleNames(x)
    Next

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetLocaleMediaName()
    ;; This example gets the current plot device information
    ;; and then displays the list of plot device names,
    ;; media names, localized media names, and plot style
    ;; table entries.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq Layout (vla-get-Layout (vla-get-ModelSpace doc)))

    ;; Refresh the current plot information for
    ;; this session.
    (vla-RefreshPlotDeviceInfo Layout)

    ;; List all the valid device names for the system
    (setq plotDevices (vlax-variant-value (vla-GetPlotDeviceNames Layout)))

    (setq x 0)
    (while (>= (vlax-safearray-get-u-bound plotDevices 1) x)
        (alert (vlax-safearray-get-element plotDevices x))
        (setq x (1+ x))
    )

    ;; List all the media names, and their localized version
    (setq mediaNames (vlax-variant-value (vla-GetCanonicalMediaNames Layout)))

    (setq x 0)
    (while (>= (vlax-safearray-get-u-bound mediaNames 1) x)
        (alert (vlax-safearray-get-element mediaNames x))
        (alert (vla-GetLocaleMediaName Layout (vlax-safearray-get-element mediaNames x)))
        (setq x (1+ x))
    )

    ;; List all the entries in the plot style table
    (setq styleNames (vlax-variant-value (vla-GetPlotStyleTableNames Layout)))

    (setq x 0)
    (while (>= (vlax-safearray-get-u-bound styleNames 1) x)
        (alert (vlax-safearray-get-element styleNames x))
        (setq x (1+ x))
    )
)


GetLoopAt Method (ActiveX)

Gets the hatch loop at a given index.

Supported platforms: Windows only

Signature

VBA:

object.GetLoopAt Index, Loop
object

Type: Hatch

The object this method applies to.

Index

Access: Input-only

Type: Integer

A positive integer beginning with 0.

Loop

Access: Output-only

Type: Variant (object or array of objects)

An object or array of objects that makes up the loop.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetLoopAt()
    ' This example creates an associative hatch in model space.
    ' It then finds the objects that make up the first loop of the hatch.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "ANSI31"
    PatternType = 0
    bAssociativity = True

    ' Create the associative Hatch object
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)

    ' Create the outer loop for the hatch.
    ' An arc and a line are used to create a closed loop.
    Dim outerLoop(0 To 1) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    center(0) = 5: center(1) = 3: center(2) = 0
    radius = 3
    startAngle = 0
    endAngle = 3.141592
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddArc(center, radius, startAngle, endAngle)
    Set outerLoop(1) = ThisDrawing.ModelSpace.AddLine(outerLoop(0).startPoint, outerLoop(0).endPoint)

    ' Append the outer loop to the hatch object
    hatchObj.AppendOuterLoop (outerLoop)

    ' Append the first circle as one inner loop
    Dim innerLoop1(0) As AcadEntity
    center(0) = 5: center(1) = 4.5: center(2) = 0
    radius = 1
    Set innerLoop1(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop1)

    ' Append the second circle as the other inner loop
    Dim innerLoop2(0) As AcadEntity
    radius = 0.5
    Set innerLoop2(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop2)

    ' Evaluate and display the hatch
    hatchObj.Evaluate
    ThisDrawing.Regen True

    ' Find the objects that make up the first loop
    Dim loopObjs As Variant
    hatchObj.GetLoopAt 0, loopObjs

    ' Find the types of the objects in the loop
    Dim I As Integer
    Dim objName As String
    objName = ""
    For I = LBound(loopObjs) To UBound(loopObjs)
        objName = objName & loopObjs(I).EntityName & ", "
    Next

    MsgBox "The objects in the first loop of the hatch are: " & objName, , "GetLoopAt Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetLoopAt()
    ;; This example creates an associative hatch in model space.
    ;; It then finds the objects that make up the first loop of the hatch.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Define the hatch
    (setq patternName "ANSI31"
          patternType acHatchPatternTypePreDefined
          bAssociativity :vlax-true)

    ;; Create the associative Hatch object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acHatchObject))

    ;; Create the outer loop for the hatch.
    ;; An arc and a line are used to create a closed loop.
    (setq center (vlax-3d-point 5 3 0)
          radius 3
          startAngle 0
          endAngle 3.141592)

    (setq arcObj (vla-AddArc modelSpace center radius startAngle endAngle))
    (setq lineObj (vla-AddLine modelSpace (vla-get-StartPoint arcObj) (vla-get-EndPoint arcObj)))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element outerLoop 0 arcObj)
    (vlax-safearray-put-element outerLoop 1 lineObj)

    ;; Append the outer loop to the hatch object
    (vla-AppendOuterLoop hatchObj outerLoop)

    ;; Append the first circle as one inner loop
    (setq center (vlax-3d-point 5 4.5 0)
          radius 1)

    (setq innerLoop1 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element innerLoop1 0 (vla-AddCircle modelSpace center radius))
    (vla-AppendInnerLoop hatchObj innerLoop1)

    ;; Append the second circle as the other inner loop
    (setq radius 0.5)
    (setq innerLoop2 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element innerLoop2 0 (vla-AddCircle modelSpace center radius))
    (vla-AppendInnerLoop hatchObj innerLoop2)

    ;; Evaluate and display the hatch
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)

    ;; Find the objects that make up the first loop
    (vla-GetLoopAt hatchObj 0 'loopObjs)

    ;; Find the types of the objects in the loop
    (setq I 0
          objName "")
    (while (>= (vlax-safearray-get-u-bound loopObjs 1) I)
        (setq objName (strcat objName (vla-get-ObjectName (vlax-safearray-get-element loopObjs I)) ", "))
        (setq I (1+ I))
    )

    (alert (strcat "The objects in the first loop of the hatch are: " objName))
)


GetMargin Method (ActiveX)

Get a cell's margin value.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetMargin(nRow, nCol, nMargin)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The value of the row.

nCol

Access: Input-only

Type: Long

The value of the column.

nMargins

Access: Input-only

Type: AcCellMargin enum

The value of the margins.

  • acCellMarginBottom
  • acCellMarginHorzSpacing
  • acCellMarginLeft
  • acCellMarginRight
  • acCellMarginTop
  • acCellMarginVertSpacing

Return Value (RetVal)

Type: Double

The cell's margin value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetMinimumColumnWidth Method (ActiveX)

Gets the minimum column width for the column at the specified column index in the table.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetMinimumColumnWidth(col)
object

Type: Table

The object this method applies to.

col

Access: Input-only

Type: Long

The column in the table.

Return Value (RetVal)

Type: Double

The minimum column width.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetMinimumRowHeight Method (ActiveX)

Returns the minimum row height for the specified row.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetMinimumRowHeight(row)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row in the table.

Return Value (RetVal)

Type: Double

The minimum row height.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetName Method (ActiveX)

Gets the name (keyword) of an object in a dictionary.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetName(Object)
object

Type: Dictionary

The object this method applies to.

Object

Access: Input-only

Type: Object

The object to query.

Return Value (RetVal)

Type: String

The name (keyword) of the object.

Remarks

For example, querying the object "Object2" in the following dictionary would return the name "SecondKeyword":

MyDictionary

Keyword - Object

FirstKeyword - Object1

SecondKeyword - Object2

Examples

VBA:

Sub Example_GetName()
    ' This example creates a dictionary and adds
    ' a custom object to that dictionary. It then
    ' finds the name of the object in the dictionary.

    Dim dictObj As AcadDictionary
    Set dictObj = ThisDrawing.Dictionaries.Add("TEST_DICTIONARY")

    ' Load the ObjectARX application that defines the custom object.
    ' Note: The application listed here does not exist and
    ' will cause an error when run. Change the application name
    ' to the path and name of your ObjectARX application.
    ThisDrawing.Application.LoadArx "MyARXApp.dll"

    ' Create the custom object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadObject

    keyName = "OBJ1"
    className = "CAsdkDictObject"

    Set customObj = dictObj.AddObject(keyName, className)

    ' Find the keyword name of an object in the dictionary
    keyName = dictObj.GetName(customObj)

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetName()
    ;; This example creates a dictionary and adds
    ;; a custom object to that dictionary.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq dictionaries (vla-get-Dictionaries doc))

    (setq dictObj (vla-Add dictionaries "TEST_DICTIONARY"))

    ;; Load the ObjectARX application that defines the custom object.
    ;; Note: The application listed here does not exist and
    ;; will cause an error when run. Change the application name
    ;; to the path and name of your ObjectARX application.
    (vla-LoadArx acadObj "MyARXApp.dll")

    ;; Create the custom object in the dictionary
    (setq keyName "OBJ1")
    (setq className "CAsdkDictObject")

    (setq customObj (vla-AddObject dictObj keyName className))

    ;; Find the keyword name of an object in the dictionary
    (setq keyName (vla-GetName dictObj customObj))
)


GetObject Method (ActiveX)

Gets the object in a dictionary, given the name (keyword) of the object.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetObject(Name)
object

Type: Dictionary

The object this method applies to.

Name

Access: Input-only

Type: String

The name (keyword) of the object in the dictionary.

Return Value (RetVal)

Type: Object

The object corresponding to the given name (keyword).

Remarks

For example, querying the name "SecondKeyword" in the following dictionary would return the object "Object2":

MyDictionary

Keyword - Object

FirstKeyword - Object1

SecondKeyword - Object2

Examples

VBA:

Sub Example_GetObject()
    ' This example creates a dictionary and adds
    ' a custom object to that dictionary. It then
    ' returns the object using GetObject.

    Dim dictObj As AcadDictionary
    Set dictObj = ThisDrawing.Dictionaries.Add("TEST_DICTIONARY")

    ' Load the ARX application that defines the custom object.
    ' Note: The application listed here does not exist and
    ' will cause an error when run. Change the application name
    ' to the path and name of your ARX Application.
    On Error GoTo ERRORHANDLER
    ThisDrawing.Application.LoadArx "MyARXApp.dll"

    ' Create the custom object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadObject

    keyName = "OBJ1"
    className = "CAsdkDictObject"

    Set customObj = dictObj.AddObject(keyName, className)

    ' Find the object
    Dim tempObj As Object
    Set tempObj = dictObj.GetObject(keyName)

ERRORHANDLER:
    MsgBox Err.Description, , "GetObject Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetObject()
    ;; This example creates a dictionary and adds
    ;; a custom object to that dictionary.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq dictionaries (vla-get-Dictionaries doc))

    (setq dictObj (vla-Add dictionaries "TEST_DICTIONARY"))

    ;; Load the ObjectARX application that defines the custom object.
    ;; Note: The application listed here does not exist and
    ;; will cause an error when run. Change the application name
    ;; to the path and name of your ObjectARX application.
    (vla-LoadArx acadObj "MyARXApp.dll")

    ;; Create the custom object in the dictionary
    (setq keyName "OBJ1")
    (setq className "CAsdkDictObject")

    (setq customObj (vla-AddObject dictObj keyName className))

    ;; Find the object
    (setq tempObj (vla-GetObject dictObj keyName))
)


GetObjectIdString Method (ActiveX)

Returns an object's ID as a string.

Supported platforms: Windows only

Signature

VBA:

RetVal = Object.GetObjectIdString(acadObject, bHex)
object

Type: Utility

The object this method applies to.

acadObject

Access: Input-only

Type: Object

AutoCAD object to return its object ID.

bHex

Access: Input-only

Type: Boolean

Determines if the object ID is returned as a whole number or a hexadecimal.

Return Value (RetVal)

Type: String

The object ID as a string.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetOrientation Method (ActiveX)

Gets the angle specified. Ignores the setting of the ANGBASE system variable.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetOrientation([Point [, Prompt]])
object

Type: Utility

The object this method applies to.

Point

Access: Input-only; optional

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the base point.

Prompt

Access: Input-only; optional

Type: Variant (string)

The text used to prompt the user for input.

Return Value (RetVal)

Type: Double

The specified angle.

Remarks

AutoCAD pauses for user input of an angle, and sets the return value to the value of the selected angle. The Point parameter specifies an angle base point in the WCS. The Prompt parameter specifies a string that AutoCAD displays before it pauses. Both Point and Prompt are optional.

The AutoCAD user can specify the angle by entering a number in the current angular units format. The user can also specify the angle by specifying two 2D locations on the graphics screen. AutoCAD draws a rubber-band line from the first point to the current crosshairs position to help the user visualize the angle. If the Point parameter is provided, AutoCAD uses this value as the first of the two points. The angle is measured in the XY plane of the WCS (this method ignores the Z field of Point). The direction of angular increase is always counterclockwise.

Regardless of the method used to specify the angle, GetOrientation always sets the return value to a value expressed in radians.

This method is similar to the GetAngle method, but it ignores the current direction of angle 0, which is stored in the ANGBASE system variable. The 0 angle employed by GetOrientation is always to the right: "east" or "three o'clock."

If a keyword is returned instead of an angle, AutoCAD will generate the error message "User input keyword." Use the GetInput method to obtain the keyword from the return value.

Examples

VBA:

Sub Example_GetOrientation()
    ' This example uses the GetOrientation method to demonstrate three different ways to retrieve
    ' an orientation from the user.

    AppActivate ThisDrawing.Application.Caption

    Dim retOrientation As Double

    ' Return the Orientation in radians with a prompt
    retOrientation = ThisDrawing.Utility.GetOrientation(, "Enter an Orientation: ")
    MsgBox "The Orientation entered was " & retOrientation & vbCrLf & _
            "(Enter the next value without prompting.)", , "GetOrientation Example"

    ' Return the Orientation in radians without any prompt
    retOrientation = ThisDrawing.Utility.GetOrientation()
    MsgBox "The Orientation entered was " & retOrientation, , "GetOrientation Example"

    ' Return the Orientation in radians with a prompt and an Orientation base point
    Dim basePnt(0 To 2) As Double
    basePnt(0) = 2#: basePnt(1) = 2#: basePnt(2) = 0#
    retOrientation = ThisDrawing.Utility.GetOrientation(basePnt, "Enter an Orientation: ")
    MsgBox "The Orientation entered was " & retOrientation, , "GetOrientation Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetOrientation()
    ;; This example uses the GetOrientation method to demonstrate three different ways to retrieve
    ;; an orientation from the user.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Return the Orientation in radians with a prompt
    (setq retOrientation (vla-GetOrientation (vla-get-Utility doc) nil "Enter an Orientation: "))
    (alert (strcat "The Orientation entered was " (rtos retOrientation 2) "\n"
                   "(Enter the next value without prompting.)"))

    ;; Return the Orientation in radians without any prompt
    (setq retOrientation (vla-GetOrientation (vla-get-Utility doc)))
    (alert (strcat "The Orientation entered was " (rtos retOrientation 2)))

    ;; Return the Orientation in radians with a prompt and an Orientation base point
    (setq basePnt (vlax-3d-point 2 2 0))
    (setq retOrientation (vla-GetOrientation (vla-get-Utility doc) basePnt "Enter an Orientation: "))
    (alert (strcat "The Orientation entered was " (rtos retOrientation 2)))
)


GetOverride Method (ActiveX)

Get a cell's overrides.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetOverride(nRow, nCol, nContent)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The value of the row.

nCol

Access: Input-only

Type: Long

The value of the column.

nContent

Access: Input-only

Type: Long

The value of the cell's content.

Return Value (RetVal)

Type: AcCellProperty enum

The cell's overrides.

  • acAlignmentProperty
  • acAllCellProperties
  • acAutoScale
  • acBackgroundColor
  • acBitProperties
  • acContentColor
  • acContentLayout
  • acContentProperties
  • acDataFormat
  • acDataType
  • acDataTypeAndFormat
  • acEnableBackgroundColor
  • acFlowDirBtoT
  • acInvalidCellProperty
  • acLock
  • acMarginBottom
  • acMarginLeft
  • acMarginRight
  • acMarginTop
  • acMergeAll
  • acRotation
  • acScale
  • acTextHeight
  • acTextStyle

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetPaperMargins Method (ActiveX)

Gets the margins for the layout or plot configuration.

Supported platforms: Windows only

Signature

VBA:

object.GetPaperMargins LowerLeft, UpperRight
object

Type: Layout, PlotConfiguration

The objects this method applies to.

LowerLeft

Access: Output-only

Type: Variant (two-element array of doubles)

The X and Y values for the lower-left margin.

UpperRight

Access: Output-only

Type: Variant (two-element array of doubles)

The X and Y values for the upper-right margin.

Return Value (RetVal)

No return value.

Remarks

The print origin is offset from the edge of the paper by the margin specified here.

The units for these values are specified by the PaperUnits property.

Examples

VBA:

Sub Example_GetPaperMargins()
    ' This example will access the Layouts collection for the current drawing
    ' and list the plot size based on the margins returned from the GetPaperMargins
    ' property for each Layout except model space.
    Dim Layouts As AcadLayouts, Layout As ACADLayout
    Dim msg As String
    Dim Measurement As String
    Dim MarginLowerLeft As Variant, MarginUpperRight As Variant

    Dim PaperHeight As Double, PaperWidth As Double
    Dim PlotHeight As Double, PlotWidth As Double

    ' Get layouts collection from document object
    Set Layouts = ThisDrawing.Layouts

    msg = vbCrLf & vbCrLf   ' Start with a space

    ' Get the margin information of every layout in this drawing

    For Each Layout In Layouts
        ' Skip model space
        If Layout.name = "Model" Then GoTo NEXT_LAYOUT
        ThisDrawing.ActiveLayout = Layout

        msg = msg & Layout.name & vbCrLf

        ' Get paper size and margin information
        Layout.GetPaperMargins MarginLowerLeft, MarginUpperRight
        Layout.GetPaperSize PaperWidth, PaperHeight

        ' Do plot area calculations

        PlotWidth = PaperWidth - (MarginUpperRight(0) - MarginLowerLeft(0))
        PlotHeight = PaperHeight - (MarginUpperRight(1) - MarginLowerLeft(1))

        ' Are we using inches or millimeters
        Measurement = " millimeter(s)"

        ' Format for display
        msg = msg & vbTab & "The paper size for this layout is: " & PaperWidth & " X " & PaperHeight & Measurement & vbCrLf & vbCrLf

        msg = msg & vbTab & "The paper margins are: " & vbCrLf & _
                            vbTab & vbTab & "Left" & vbTab & "(" & MarginLowerLeft(0) & ")" & Measurement & vbCrLf & _
                            vbTab & vbTab & "Right" & vbTab & "(" & MarginUpperRight(0) & ")" & Measurement & vbCrLf & _
                            vbTab & vbTab & "Top" & vbTab & "(" & MarginUpperRight(1) & ")" & Measurement & vbCrLf & _
                            vbTab & vbTab & "Bottom" & vbTab & "(" & MarginLowerLeft(1) & ")" & Measurement & vbCrLf & vbCrLf
        msg = msg & vbTab & "The paper plot area for this layout is: " & PlotWidth & " X " & PlotHeight & Measurement & vbCrLf

        msg = msg & "_____________________" & vbCrLf

NEXT_LAYOUT:
    Next

    ' Display paper size and margin information
    MsgBox "Paper plot information for the current drawing is: " & msg
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetPaperMargins()
    ;; This example will access the Layouts collection for the current drawing
    ;; and list the plot size based on the margins returned from the GetPaperMargins
    ;; property for each Layout except model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get layouts collection from document object
    (setq Layouts (vla-get-Layouts doc))

    (setq msg "")   ;; Start with a space

    ;; Get the margin information of every layout in this drawing
    (vlax-for Layout Layouts
        ;; Skip model space
        (if (/= (vla-get-Name Layout) "Model")
               (progn
                   (vla-put-ActiveLayout doc Layout)

                   (setq msg (strcat msg (vla-get-Name Layout) "\n"))

                   ;; Get paper size and margin information
                   (vla-GetPaperMargins Layout 'MarginLowerLeft 'MarginUpperRight)
                   (vla-GetPaperSize Layout 'PaperWidth 'PaperHeight)

                   ;; Do plot area calculations
                   (setq PlotWidth (- PaperWidth (- (vlax-safearray-get-element MarginUpperRight 0) (vlax-safearray-get-element MarginLowerLeft 0))))
                   (setq PlotHeight (- PaperHeight (- (vlax-safearray-get-element MarginUpperRight 1) (vlax-safearray-get-element MarginLowerLeft 1))))

                   ;; Are we using inches or millimeters
                   (setq Measurement " millimeter(s)")

                   ;; Format for display
                   (setq msg (strcat msg "The paper size for this layout is: " (rtos PaperWidth 2) " X " (rtos PaperHeight 2) Measurement "\n\n"))
                   (setq msg (strcat msg "  The paper margins are: \n"
                                              "  Left (" (rtos (vlax-safearray-get-element MarginLowerLeft 0) 2) ")" Measurement "\n"
                                              "  Right (" (rtos (vlax-safearray-get-element MarginUpperRight 0) 2) ")" Measurement "\n"
                                              "  Top (" (rtos (vlax-safearray-get-element MarginUpperRight 1) 2) ")" Measurement "\n"
                                              "  Bottom (" (rtos (vlax-safearray-get-element MarginLowerLeft 1) 2) ")" Measurement "\n\n"))

                   (setq msg (strcat msg "The paper plot area for this layout is: " (rtos PlotWidth 2) " X " (rtos PlotHeight 2) Measurement "\n"))
                   (setq msg (strcat msg "_____________________\n"))
               )
           )
    )

    ;; Display paper size and margin information
    (alert (strcat "Paper plot information for the current drawing is: " msg))
)


GetPaperSize Method (ActiveX)

Gets the width and height of the configured paper.

Supported platforms: Windows only

Signature

VBA:

object.GetPaperSize Width, Height
object

Type: Layout, PlotConfiguration

The objects this method applies to.

Width

Access: Output-only

Type: Double

The width of the paper.

Height

Access: Output-only

Type: Double

The height of the paper.

Return Value (RetVal)

No return value.

Remarks

The units for the width and height values are specified by the PaperUnits property.

To set the paper size, use the CanonicalMediaName property.

Examples

VBA:

Sub Example_GetPaperSize()
    ' This example gets the width and height of the default
    ' paper size for your system.

    Dim PaperWidth As Double
    Dim PaperHeight As Double

    ThisDrawing.ActiveLayout.GetPaperSize PaperWidth, PaperHeight

    MsgBox "The default paper size is " & vbCrLf & _
           "Width: " & PaperWidth & vbCrLf & _
           "Height: " & PaperHeight

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetPaperSize()
    ;; This example gets the width and height of the default
    ;; paper size for your system.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (vla-GetPaperSize (vla-get-ActiveLayout doc) 'PaperWidth 'PaperHeight)

    (alert (strcat "The default paper size is "
                   "\nWidth: " (rtos PaperWidth 2)
                   "\nHeight: " (rtos PaperHeight 2)))
)


GetPlotDeviceNames Method (ActiveX)

Gets all available plot device names.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetPlotDeviceNames()
object

Type: Layout, PlotConfiguration

The object this method applies to.

Return Value (RetVal)

Type: Variant (array of strings)

The array of available device names for the system.

Remarks

You should call RefreshPlotDeviceInfo before the first time you use this method. Once you have called RefreshPlotDeviceInfo, you do not need to call it again unless your plot device information changes during the session.

Examples

VBA:

Sub Example_GetPlotDeviceNames()
    ' This example gets the current plot device information
    ' and then displays the list of plot device names,
    ' media names, localized media names, and plot style
    ' table entries.
    Dim Layout As ACADLayout
    Set Layout = ThisDrawing.ModelSpace.Layout

    ' Refresh the current plot information for
    ' this session.
    Layout.RefreshPlotDeviceInfo

    ' List all the valid device names for the system
    Dim plotDevices As Variant
    plotDevices = Layout.GetPlotDeviceNames()

    Dim x As Integer
    For x = LBound(plotDevices) To UBound(plotDevices)
        MsgBox plotDevices(x)
    Next

    ' List all the media names, and their localized version
    Dim mediaNames As Variant
    mediaNames = Layout.GetCanonicalMediaNames()

    For x = LBound(mediaNames) To UBound(mediaNames)
        MsgBox mediaNames(x)
        MsgBox Layout.GetLocaleMediaName(mediaNames(x))
    Next

    ' List all the entries in the plot style table
    Dim styleNames As Variant
    styleNames = Layout.GetPlotStyleTableNames()

    For x = LBound(styleNames) To UBound(styleNames)
        MsgBox styleNames(x)
    Next

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetPlotDeviceNames()
    ;; This example gets the current plot device information
    ;; and then displays the list of plot device names,
    ;; media names, localized media names, and plot style
    ;; table entries.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq Layout (vla-get-Layout (vla-get-ModelSpace doc)))

    ;; Refresh the current plot information for
    ;; this session.
    (vla-RefreshPlotDeviceInfo Layout)

    ;; List all the valid device names for the system
    (setq plotDevices (vlax-variant-value (vla-GetPlotDeviceNames Layout)))

    (setq x 0)
    (while (>= (vlax-safearray-get-u-bound plotDevices 1) x)
        (alert (vlax-safearray-get-element plotDevices x))
        (setq x (1+ x))
    )

    ;; List all the media names, and their localized version
    (setq mediaNames (vlax-variant-value (vla-GetCanonicalMediaNames Layout)))

    (setq x 0)
    (while (>= (vlax-safearray-get-u-bound mediaNames 1) x)
        (alert (vlax-safearray-get-element mediaNames x))
        (alert (vla-GetLocaleMediaName Layout (vlax-safearray-get-element mediaNames x)))
        (setq x (1+ x))
    )

    ;; List all the entries in the plot style table
    (setq styleNames (vlax-variant-value (vla-GetPlotStyleTableNames Layout)))

    (setq x 0)
    (while (>= (vlax-safearray-get-u-bound styleNames 1) x)
        (alert (vlax-safearray-get-element styleNames x))
        (setq x (1+ x))
    )
)


GetPlotStyleTableNames Method (ActiveX)

Gets all available plot style table names.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetPlotStyleTableNames()
object

Type: Layout, PlotConfiguration

The objects this method applies to.

Return Value (RetVal)

Type: Variant (array of strings)

The array of available plot style table names for the system.

Remarks

You should call RefreshPlotDeviceInfo before the first time you use this method. Once you have called RefreshPlotDeviceInfo, you do not need to call it again unless your plot device information changes during the session.

GetPlotStyleTableNames returns all available plot style tables found on the system, including both CTB and STB files. To filter the results for one type of plot style table, use the PSTYLEMODE system variable.

Examples

VBA:

Sub Example_GetPlotStyleTableNames()
    ' This example gets the current plot device information
    ' and then displays the list of plot device names,
    ' media names, localized media names, and plot style
    ' table entries.
    Dim Layout As ACADLayout
    Set Layout = ThisDrawing.ModelSpace.Layout

    ' Refresh the current plot information for
    ' this session.
    Layout.RefreshPlotDeviceInfo

    ' List all the valid device names for the system
    Dim plotDevices As Variant
    plotDevices = Layout.GetPlotDeviceNames()

    Dim x As Integer
    For x = LBound(plotDevices) To UBound(plotDevices)
        MsgBox plotDevices(x)
    Next

    ' List all the media names, and their localized version
    Dim mediaNames As Variant
    mediaNames = Layout.GetCanonicalMediaNames()

    For x = LBound(mediaNames) To UBound(mediaNames)
        MsgBox mediaNames(x)
        MsgBox Layout.GetLocaleMediaName(mediaNames(x))
    Next

    ' List all the entries in the plot style table
    Dim styleNames As Variant
    styleNames = Layout.GetPlotStyleTableNames()

    For x = LBound(styleNames) To UBound(styleNames)
        MsgBox styleNames(x)
    Next

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetPlotStyleTableNames()
    ;; This example gets the current plot device information
    ;; and then displays the list of plot device names,
    ;; media names, localized media names, and plot style
    ;; table entries.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq Layout (vla-get-Layout (vla-get-ModelSpace doc)))

    ;; Refresh the current plot information for
    ;; this session.
    (vla-RefreshPlotDeviceInfo Layout)

    ;; List all the valid device names for the system
    (setq plotDevices (vlax-variant-value (vla-GetPlotDeviceNames Layout)))

    (setq x 0)
    (while (>= (vlax-safearray-get-u-bound plotDevices 1) x)
        (alert (vlax-safearray-get-element plotDevices x))
        (setq x (1+ x))
    )

    ;; List all the media names, and their localized version
    (setq mediaNames (vlax-variant-value (vla-GetCanonicalMediaNames Layout)))

    (setq x 0)
    (while (>= (vlax-safearray-get-u-bound mediaNames 1) x)
        (alert (vlax-safearray-get-element mediaNames x))
        (alert (vla-GetLocaleMediaName Layout (vlax-safearray-get-element mediaNames x)))
        (setq x (1+ x))
    )

    ;; List all the entries in the plot style table
    (setq styleNames (vlax-variant-value (vla-GetPlotStyleTableNames Layout)))

    (setq x 0)
    (while (>= (vlax-safearray-get-u-bound styleNames 1) x)
        (alert (vlax-safearray-get-element styleNames x))
        (setq x (1+ x))
    )
)


GetPoint Method (ActiveX)

Gets the point selected in AutoCAD.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetPoint([Point [, Prompt]])
object

Type: Utility

The object this method applies to.

Point

Access: Input-only; optional

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the relative base point.

Prompt

Access: Input-only; optional

Type: Variant (string)

The text used to prompt the user for input.

Return Value (RetVal)

Type: Variant (three-element array of doubles)

The 3D WCS coordinates of the point the AutoCAD user has selected.

Remarks

AutoCAD pauses for user input of a point, and sets the return value to the value of the selected point. The Point parameter specifies a relative base point in the WCS. The Prompt parameter specifies a string that AutoCAD displays before it pauses. Both Point and Prompt are optional.

The AutoCAD user can specify the point by entering a coordinate in the current units format; GetPoint treats the Point parameter and the return value as three-dimensional points. The user can specify the point also by specifying a location on the graphics screen. If the Point parameter is provided, AutoCAD draws a rubber-band line from Point to the current crosshair position.

The coordinates of the point stored in the return value are expressed in terms of the WCS.

If a keyword is returned instead of a point, AutoCAD will generate the error message "User input keyword." Use the GetInput method to obtain the keyword from the return value.

Examples

VBA:

Sub Example_GetPoint()
    ' This example returns a point entered by the user.

    AppActivate ThisDrawing.Application.Caption

    Dim returnPnt As Variant

    ' Return a point using a prompt
    returnPnt = ThisDrawing.Utility.GetPoint(, "Enter a point: ")
    MsgBox "The WCS of the point is: " & returnPnt(0) & ", " & returnPnt(1) & ", " & returnPnt(2) & vbCrLf & _
           "(Enter the next value without prompting.)", , "GetPoint Example"

    ' Return a point, no prompt
    returnPnt = ThisDrawing.Utility.GetPoint
    MsgBox "The WCS of the point is: " & returnPnt(0) & ", " & returnPnt(1) & ", " & returnPnt(2), , "GetPoint Example"

    ' Return a point using a base point and a prompt
    Dim basePnt(0 To 2) As Double
    basePnt(0) = 2#: basePnt(1) = 2#: basePnt(2) = 0#
    returnPnt = ThisDrawing.Utility.GetPoint(basePnt, "Enter a point: ")
    MsgBox "The WCS of the point is: " & returnPnt(0) & ", " & returnPnt(1) & ", " & returnPnt(2)

    ' Create a line from the base point and the last point entered
    Dim lineObj As AcadLine
    Set lineObj = ThisDrawing.ModelSpace.AddLine(basePnt, returnPnt)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetPoint()
    ;; This example returns a point entered by the user.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Return a point using a prompt
    (setq returnPnt (vlax-variant-value (vla-GetPoint (vla-get-Utility doc) nil "Enter a point: ")))
    (alert (strcat "The WCS of the point is: " (rtos (vlax-safearray-get-element returnPnt 0) 2) ", "
                                                     (rtos (vlax-safearray-get-element returnPnt 1) 2) ", "
                                                     (rtos (vlax-safearray-get-element returnPnt 2) 2) "\n"
                                               "(Enter the next value without prompting.)"))

    ;; Return a point, no prompt
    (setq returnPnt (vlax-variant-value (vla-GetPoint (vla-get-Utility doc))))
    (alert (strcat "The WCS of the point is: " (rtos (vlax-safearray-get-element returnPnt 0) 2) ", "
                                                     (rtos (vlax-safearray-get-element returnPnt 1) 2) ", "
                                                     (rtos (vlax-safearray-get-element returnPnt 2) 2)))

    ;; Return a point using a base point and a prompt
    (setq basePnt (vlax-3d-point 2 2 0))
    (setq returnPnt (vlax-variant-value (vla-GetPoint (vla-get-Utility doc) basePnt "Enter a point: ")))
    (alert (strcat "The WCS of the point is: " (rtos (vlax-safearray-get-element returnPnt 0) 2) ", "
                                                     (rtos (vlax-safearray-get-element returnPnt 1) 2) ", "
                                                     (rtos (vlax-safearray-get-element returnPnt 2) 2)))

    ;; Create a line from the base point and the last point entered
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace basePnt returnPnt))
    (vla-ZoomAll acadObj)
)


GetProjectFilePath Method (ActiveX)

Gets the directory in which AutoCAD looks for external reference files.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetProjectFilePath(ProjectName)
object

Type: PreferencesFiles

The object this method applies to.

ProjectName

Access: Input-only

Type: String

The name of the project. This name is also controlled by the PROJECTNAME system variable.

Return Value (RetVal)

Type: String

The directory in which AutoCAD looks for external reference files.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetProjectFilePath()
    ' This example finds the current project file information.

    Dim preferences As AcadPreferences
    Set preferences = ThisDrawing.Application.preferences

    ' Get the current project file information
    Dim currProjPath As String
    Dim currProjName As Variant
    currProjName = ThisDrawing.GetVariable("PROJECTNAME")
    If currProjName <> "" Then
        currProjPath = preferences.Files.GetProjectFilePath(currProjName)
    End If
    If currProjPath = "" Then
        MsgBox "There is no current project file or path. ", , "GetProjectFilePath Example"
    Else
        MsgBox "The current project file path is: " & currProjPath, , "GetProjectFilePath Example"
    End If

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetProjectFilePath()
    ;; This example finds the current project file information.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the current project file information
    (setq currProjName (vlax-variant-value (vla-GetVariable doc "PROJECTNAME")))
    (if (/= currProjName "")
        (progn
            (setq currProjPath (vla-GetProjectFilePath (vla-get-Files preferences) currProjName))
               (alert (strcat "The current project file path is: " currProjPath))
           )
        (alert "There is no current project file or path.")
    )
)


GetReal Method (ActiveX)

Gets a real (double) value from the user.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetReal([Prompt])
object

Type: Utility

The object this method applies to.

Prompt

Access: Input-only; optional

Type: Variant (string)

The text used to prompt the user for input.

Return Value (RetVal)

Type: Double

The value returned from the user.

Remarks

AutoCAD pauses for user input of a real value, and sets the return value to the value that the user enters. The Prompt parameter specifies a string that AutoCAD displays before it pauses. The Prompt is optional.

If a keyword is returned instead of a double, AutoCAD will generate the error message "User input keyword." Use the GetInput method to obtain the keyword from the return value.

Examples

VBA:

Sub Example_GetReal()
    ' This example returns the Real entered by the user.

    AppActivate ThisDrawing.Application.Caption

    Dim returnReal As Double

    ' Return the value entered by user. A prompt is provided.
    returnReal = ThisDrawing.Utility.GetReal("Enter an Real: ")
    MsgBox "The real entered was " & returnReal & vbCrLf & _
            "(Enter the next value without prompting.)", , "GetReal Example"

    ' Return the value entered by user. No prompt is provided.
    returnReal = ThisDrawing.Utility.GetReal()
    MsgBox "The real entered was " & returnReal, , "GetReal Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetReal()
    ;; This example returns the Real entered by the user.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Return the value entered by user. A prompt is provided.
    (setq returnReal (vla-GetReal (vla-get-Utility doc) "Enter an Real: "))
    (alert (strcat "The real entered was " (rtos returnReal 2) "\n"
                   "(Enter the next value without prompting.)"))

    ;; Return the value entered by user. No prompt is provided.
    (setq returnReal (vla-GetReal (vla-get-Utility doc)))
    (alert (strcat "The real entered was " (rtos returnReal 2)))
)


GetRelativeDrawOrder Method (ActiveX)

Returns the objects specified, sorted by the draw order, with the bottom object first.

Supported platforms: Windows only

Signature

VBA:

object.GetRelativeDrawOrder Objects, honorSortentsSysvar
object

Type: SortentsTable

The object this method applies to.

Objects

Access: Output-only

Type: Variant (array of Objects)

An array of objects sorted by draw order.

honorSortentsSysvar

Access: Input-only

Type: Boolean

  • True: Use the setting of the DRAWORDERCTL system variable.
  • False: Setting is ignored.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SortentsTable()
    ' This example creates a SortentsTable object and
    ' changes the draw order.

    ' Set drawing to display lineweights and create a True Color object
    Dim ACADPref As AcadDatabasePreferences
    Set ACADPref = ThisDrawing.preferences
    ACADPref.LineWeightDisplay = True
    Dim MyColorObjOne As AcadAcCmColor
    Set MyColorObjOne = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Call MyColorObjOne.SetRGB(80, 100, 244)

    ' Draw a polyline
    Dim plineObj As AcadPolyline
    Dim points(0 To 8) As Double
    points(0) = 4: points(1) = 4: points(2) = 0
    points(3) = 3: points(4) = 5: points(5) = 0
    points(6) = 6: points(7) = 20: points(8) = 0
    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
    plineObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(90, 110, 150)
    plineObj.TrueColor = MyColorObjOne

    ' Draw a line
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 5: startPoint(1) = 13: startPoint(2) = 0
    endPoint(0) = 5: endPoint(1) = 27: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    lineObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(50, 80, 230)
    lineObj.TrueColor = MyColorObjOne

    ' Draw a circle
    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    centerPoint(0) = 10: centerPoint(1) = 15: centerPoint(2) = 0#
    radius = 5#
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)
    circleObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(60, 200, 220)
    circleObj.TrueColor = MyColorObjOne
    ZoomAll
    AcadApplication.Update

    ' Get an extension dictionary and, if necessary, add a SortentsTable object
    Dim eDictionary As Object
    Set eDictionary = ThisDrawing.ModelSpace.GetExtensionDictionary
    ' Prevent failed GetObject calls from throwing an exception
    On Error Resume Next
    Dim sentityObj As Object
    Set sentityObj = eDictionary.GetObject("ACAD_SORTENTS")
    On Error GoTo 0
    If sentityObj Is Nothing Then
         ' No SortentsTable object, so add one
         Set sentityObj = eDictionary.AddObject("ACAD_SORTENTS", "AcDbSortentsTable")
    End If

    Dim ObjIds(2) As Long
    ObjIds(0) = plineObj.ObjectID
    ObjIds(1) = lineObj.ObjectID
    ObjIds(2) = circleObj.ObjectID

    Dim varObject As AcadObject
    Set varObject = ThisDrawing.ObjectIdToObject(ObjIds(2))
    Dim arr(0) As AcadObject
    Set arr(0) = varObject

    ' Move the circle object to the bottom
    sentityObj.MoveToBottom arr
    AcadApplication.Update

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SortentsTable()
    ;; This example creates a SortentsTable object and
    ;; changes the draw order.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Set drawing to display lineweights and create a True Color object
    (vla-put-LineWeightDisplay (vla-get-Preferences doc) :vlax-true)
    (setq MyColorObjOne (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB MyColorObjOne 80 100 244)

    ;; Draw a polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill points '(4 4 0
                                  3 5 0
                                  6 20 0
                                 )
    )

    (setq plineObj (vla-AddPolyline modelSpace points))

    (vla-put-Lineweight plineObj acLnWt211)
    (vla-SetRGB MyColorObjOne 90 110 150)
    (vla-put-TrueColor plineObj MyColorObjOne)

    ;; Draw a line
    (setq startPoint (vlax-3d-point 5 13 0)
          endPoint (vlax-3d-point 5 27 0))

    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-put-Lineweight lineObj acLnWt211)
    (vla-SetRGB MyColorObjOne 50 80 230)
    (vla-put-TrueColor lineObj MyColorObjOne)

    ;; Draw a circle
    (setq centerPoint (vlax-3d-point 10 15 0)
          radius 5)

    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))
    (vla-put-Lineweight circleObj acLnWt211)
    (vla-SetRGB MyColorObjOne 60 200 220)
    (vla-put-TrueColor circleObj MyColorObjOne)

    (vla-ZoomAll acadObj)
    (vla-Update acadObj)

    ;; Get an extension dictionary and, if necessary, add a SortentsTable object
    (setq eDictionary (vla-GetExtensionDictionary modelSpace))

    ;; Prevent failed GetObject calls from throwing an exception
    (setq sentityObj (vl-catch-all-apply 'vla-GetObject (list eDictionary "ACAD_SORTENTS")))

    (if (= (type sentityObj)'VL-CATCH-ALL-APPLY-ERROR)
         ;; No SortentsTable object, so add one
         (setq sentityObj (vla-AddObject eDictionary "ACAD_SORTENTS" "AcDbSortentsTable"))
    )

    (setq ObjIds (vlax-make-safearray vlax-vbLong '(0 . 2)))
    (vlax-safearray-put-element ObjIds 0 (vla-get-ObjectID plineObj))
    (vlax-safearray-put-element ObjIds 1 (vla-get-ObjectID lineObj))
    (vlax-safearray-put-element ObjIds 2 (vla-get-ObjectID circleObj))

    (setq varObject circleObj)
    (setq arr (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element arr 0 varObject)

    ;; Move the circle object to the bottom
    (vla-MoveToBottom sentityObj arr)
    (vla-Update acadObj)

    (vlax-release-object MyColorObjOne)
)


GetRemoteFile Method (ActiveX)

Downloads the file specified by a URL.

Supported platforms: Windows only

Signature

VBA:

object.GetRemoteFile URL, LocalFile, IgnoreCache
object

Type: Utility

The object this method applies to.

URL

Access: Input-only

Type:String

The URL of the file to download.

LocalFile

Access: Output-only

Type: String

The file at the specified URL.

IgnoreCache

Access: Input-only

Type: Boolean

  • True: Download even if the file has already been transferred in this session.
  • False: Do not download if the file has already been transferred in this session.

Return Value (RetVal)

No return value.

Remarks

If you maintain a list of files that have already been downloaded in the current or a previous session (a cache), it may be more efficient to avoid a duplicate transfer and make a copy of the locally available file instead. You can explicitly force a download by setting the IgnoreCache parameter to True, in which case the cache will be bypassed altogether.

When accessing a secure URL, a dialog box will be posted prompting the user for the necessary password information. Message boxes will also appear if the user has not suppressed this activity in the browser.

When downloading a file, AutoCAD creates a temporary file for internal processing. Do not attempt to access this temporary file. Information in this file is deleted at the end of the AutoCAD session.

Examples

VBA:

Sub Example_GetRemoteFile()
    ' This example will prompt the user for a URL to download and will verify that
    ' a proper URL was entered.  After downloading, the example will attempt to load
    ' the downloaded URL as a drawing.
    '
    ' * Note: Remember to delete the downloaded file from your disk drive when finished.

    Dim Utility As AcadUtility
    Dim URL As String, DestFile As String, FileURL As String

    Set Utility = ThisDrawing.Utility   ' Connect to Utility object

GETURL:
    ' Prompt user for a URL to download.  This should be a URL to an AutoCAD drawing file.
    URL = Utility.GetString(False, vbLf & "Enter the complete URL of the file you wish to download: ")

    URL = Trim(URL)                     ' Get rid of blank spaces

    If URL = "" Then Exit Sub           ' Did user cancel

    ' Determine if user entered a valid URL; if not, prompt again
    If Not (Utility.IsURL(URL)) Then
        MsgBox "The URL you entered is not valid.  Make sure the syntax is a valid URL."
        GoTo GETURL
    End If

    ' Download URL
    Utility.GetRemoteFile URL, DestFile, True

    ' Display downloaded file information
    MsgBox URL & " was downloaded to: " & DestFile

    ' Use IsRemoteFile to determine if this file was downloaded from a URL.
    ' If it was, display the URL it was downloaded from
    '
    ' * Note: Although the results that IsRemoteFile will return are already known
    ' since the file was just downloaded it is important to know how this
    ' method can be used.
    If Utility.IsRemoteFile(DestFile, FileURL) Then
        MsgBox "The file: " & DestFile & " is a downloaded file and was downloaded from: " & FileURL
    Else
        MsgBox "The file: " & DestFile & " is not a downloaded file."
    End If

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetRemoteFile()
    ;; This example will prompt the user for a URL to download and will verify that
    ;; a proper URL was entered.  After downloading, the example will provide information
    ;; about the downloaded drawing.
    ;;
    ;; * Note: Remember to delete the downloaded file from your disk drive when finished.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq Utility (vla-get-Utility doc))   ;; Connect to Utility object

    ;; Prompt user for a URL to download.  This should be a URL to an AutoCAD drawing file.
    (setq URL (vla-GetString Utility :vlax-false "\nEnter the complete URL of the file you wish to download: "))

    (if (/= URL "")
        (progn
               (if (= (vla-IsURL Utility URL) :vlax-false)
                   (alert "The URL you entered is not valid.  Make sure the syntax is a valid URL.")
                   (progn
                          ;; Download URL
                          (vla-GetRemoteFile Utility URL 'DestFile :vlax-true)

                          ;; Display downloaded file information
                          (alert (strcat URL " was downloaded to: " DestFile "\n"))

                          ;; Use IsRemoteFile to determine if this file was downloaded from a URL.
                          ;; If it was, display the URL it was downloaded from
                          ;;
                          ;; * Note: Although the results that IsRemoteFile will return are already known
                          ;; since the file was just downloaded it is important to know how this
                          ;; method can be used.
                          (if (= (vla-IsRemoteFile Utility DestFile URL) :vlax-true)
                              (alert (strcat "The file: " DestFile " is a downloaded file and was downloaded from: " URL))
                              (alert (strcat "The file: " DestFile " is not a downloaded file."))
                          )
                      )
               )
           )
    )
)


GetRotation Method (ActiveX)

Gets the rotation value for a cell or cell style.

Supported platforms: Windows only

Signature - Table

VBA:

RetVal = object.GetRotation(nRow, nCol, nContent)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value for the cell.

Signature - TableStyle

VBA:

RetVal = object.GetRotation(StringCellStyle)
object

Type: TableStyle

The object this method applies to.

StringCellStyle

Access: Input-only

Type: String

The cell style name.

Return Value (RetVal)

Type: Double

The rotation value for the cell or cell style.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellClass()
    ' This example creates a TableStyle object and sets values for
    ' the style classes and formatting.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As IAcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.CreateCellStyle ("NewTestStyle")
    Dim cellTestFormat As String

    customObj.SetCellClass "NewTestStyle", 4

    customObj.SetRotation "NewTestStyle", 8.4

    MsgBox "The cell class is " & customObj.GetCellClass("NewTestStyle") & _
           " the cell rotation is " & customObj.GetRotation("NewTestStyle")
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellClass()
    ;; This example creates a TableStyle object and sets values for
    ;; the style classes and formatting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))

    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")
    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-CreateCellStyle customObj "NewTestStyle")

    (vla-SetCellClass customObj "NewTestStyle" 4)
    (vla-SetRotation customObj "NewTestStyle" 8.4)

    (alert (strcat "The cell class is " (itoa (vla-GetCellClass customObj "NewTestStyle"))
                   " and the cell rotation is " (rtos (vla-GetRotation customObj "NewTestStyle") 2) "."
           )
    )
)


GetRowHeight Method (ActiveX)

Returns the row height for the row at the specified row index in the table.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetRowHeight(row)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row in the table.

Return Value (RetVal)

Type: Double

The height of the row.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetRowType Method (ActiveX)

Returns the row type for the specified row.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetRowType(row)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row in the table.

Return Value (RetVal)

Type: AcRowType enum

The row type.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetScale Method (ActiveX)

Gets the scale value for a cell.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetScale(nRow, nCol, nContent)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Integer

The row number of the cell to set.

nCol

Access: Input-only

Type: Integer

The column number of the cell to set.

nContent

Access: Input-only

Type: Integer

The content value for the cell.

Return Value (RetVal)

Type: Double

The scale value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetSectionTypeSettings Method (ActiveX)

Gets the section type settings object.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetSectionTypeSettings(secType)
object

Type: SectionSettings

The object this method applies to.

secType

Access: Input-only

Type: AcSectionType enum

  • acSectionType2dSection
  • acSectionType3dSection
  • acSectionTypeLiveSection

Return Value (RetVal)

Type: SectionTypeSettings

The SectionTypeSettings object that represents the settings for the section value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetSnapSpacing Method (ActiveX)

Gets the snap spacing for the viewport.

Supported platforms: Windows only

Signature

VBA:

object.GetSnapSpacing XSpacing, YSpacing
object

Type: PViewport, Viewport

The objects this method applies to.

XSpacing

Access: Output-only

Type: Double

The snap spacing for the X axis.

YSpacing

Access: Output-only

Type: Double

The snap spacing for the Y axis.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetSnapSpacing()
    ' This example finds the current Snap spacing, and changes that spacing.

    ' Find the current active Model space viewport
    Dim viewportObj As AcadViewport
    Set viewportObj = ThisDrawing.ActiveViewport

    ' Turn on Snap spacing and reset the viewport.
    viewportObj.SnapOn = True
    ThisDrawing.ActiveViewport = viewportObj

    ' Find the current Snap spacing
    Dim XSpacing As Double
    Dim YSpacing As Double

    viewportObj.GetSnapSpacing XSpacing, YSpacing
    MsgBox "X =" & XSpacing & ", Y =" & YSpacing, Title:="GetSnapSpacing Example"

    ' Change the Snap spacing
    XSpacing = XSpacing * 0.5
    YSpacing = YSpacing * 0.5
    viewportObj.SetSnapSpacing XSpacing, YSpacing
    ThisDrawing.ActiveViewport = viewportObj
    MsgBox "X =" & XSpacing & ", Y =" & YSpacing, Title:="GetSnapSpacing Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetSnapSpacing()
    ;; This example finds the current Snap spacing, and changes that spacing.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Find the current active Model space viewport
    (setq viewportObj (vla-get-ActiveViewport doc))

    ;; Turn on Snap spacing and reset the viewport.
    (vla-put-SnapOn viewportObj :vlax-true)
    (vla-put-ActiveViewport doc viewportObj)

    ;; Find the current Snap spacing
    (vla-GetSnapSpacing viewportObj 'XSpacing 'YSpacing)
    (alert (strcat "X =" (rtos XSpacing 2) ", Y =" (rtos YSpacing 2)))

    ;; Change the Snap spacing
    (vla-SetSnapSpacing viewportObj (* XSpacing 0.5) (* YSpacing 0.5))
    (vla-put-ActiveViewport doc viewportObj)

    (vla-GetSnapSpacing viewportObj 'XSpacing 'YSpacing)
    (alert (strcat "X =" (rtos XSpacing 2) ", Y =" (rtos YSpacing 2)))
)


GetString Method (ActiveX)

Gets a string from the user.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetString(HasSpaces [, Prompt])
object

Type: Utility

The object this method applies to.

HasSpaces

Access: Input-only

Type: Long

  • 0: The return string cannot contain spaces. It is terminated by a carriage return or space.
  • 1: The return string can contain spaces. It is terminated by a carriage return only.
Prompt

Access: Input-only; optional

Type: Variant (string)

The text used to prompt the user for input.

Return Value (RetVal)

Type: String

The string returned from the user.

Remarks

AutoCAD pauses for user input of the string, and sets the result to the string that the user enters. The HasSpaces parameter specifies whether the string can contain spaces. The Prompt parameter specifies a string that this method displays before AutoCAD pauses.

The AutoCAD user can enter the string from the keyboard. If the HasSpaces parameter is True, the string can contain blanks and the user must terminate it by entering [Return]. If HasSpaces is False, entering either a blank or [Return] terminates the string. If the user enters more than 132 characters, string entry continues until the user enters a blank or carriage return (according to HasSpaces), but GetString places only the first 132 characters into the return value.

Examples

VBA:

Sub Example_GetString()
    ' This example demonstrates different ways of returning a string
    ' entered by a user.

    AppActivate ThisDrawing.Application.Caption

    Dim returnString As String

    ' Prompt & Input cannot contain blanks
    returnString = ThisDrawing.Utility.GetString(False, "Enter text (a space or  terminates input): ")
    MsgBox "The string entered was '" & returnString & "'", , "GetString Example"

    ' Prompt & Input can contain blanks
    returnString = ThisDrawing.Utility.GetString(True, "Enter text ( terminates input):")
    MsgBox "The string entered was '" & returnString & "'", , "GetString Example"

    ' Prompt & Input can contain blanks, but not an empty string
    Dim NoNull As Integer
    NoNull = 1    ' Disallow null
    ThisDrawing.Utility.InitializeUserInput NoNull
    returnString = ThisDrawing.Utility.GetString(True, "Enter text ( terminates input): ")
    MsgBox "The string entered was '" & returnString & "'", , "GetString Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetString()
    ;; This example demonstrates different ways of returning a string
    ;; entered by a user.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Prompt & Input cannot contain blanks
    (setq returnString (vla-GetString (vla-get-Utility doc) :vlax-false "Enter text (a space or <enter> terminates input): "))
    (alert (strcat "The string entered was '" returnString "'"))

    ;; Prompt & Input can contain blanks
    (setq returnString (vla-GetString (vla-get-Utility doc) :vlax-true "Enter text (<enter> terminates input):"))
    (alert (strcat "The string entered was '" returnString "'"))

    ;; Prompt & Input can contain blanks, but not an empty string
    (setq NoNull 1)    ;; Disallow null
    (vla-InitializeUserInput (vla-get-Utility doc) NoNull)
    (setq returnString (vla-GetString (vla-get-Utility doc) :vlax-true "Enter text (<enter> terminates input): "))
    (alert (strcat "The string entered was '" returnString "'"))
)


GetSubEntity Method (ActiveX)

Gets an object or subentity interactively.

Supported platforms: Windows only

Signature

VBA:

object.GetSubEntity Object, PickedPoint, TransMatrix, ContextData [, Prompt]
object

Type: Utility

The object this method applies to.

Object

Access: Output-only

Type: Object

The picked object or subentity. Can be one of any of the drawing objects.

PickedPoint

Access: Output-only

Type: Variant (three-element array of doubles)

A 3D WCS coordinate specifying the point that was selected.

TransMatrix

Access: Output-only

Type: Variant (4x4 array of doubles)

The translation matrix applied to this entity.

ContextData

Access: Output-only

Type: Variant (array of longs)

An array of object IDs for any nested objects in the selected object.

Prompt

Access: Input-only; optional

Type: Variant (string)

The text to display to prompt the user for input.

Return Value (RetVal)

No return value.

Remarks

This method requires the AutoCAD user to select an object by picking a point on the graphics screen. If an object or subentity is picked, it is returned in the first parameter, and the second parameter will contain the point picked in WCS coordinates. If the pick point is not on an object the method will fail.

This method can retrieve an object even if it is not visible on the screen or if it is on a frozen layer.

Examples

VBA:

Sub Example_GetSubEntity()
    ' This example prompts the user to select on object on the screen with a mouse click,
    ' and returns some information about the selected object.

    AppActivate ThisDrawing.Application.Caption

    Dim Object As Object
    Dim PickedPoint As Variant, TransMatrix As Variant, ContextData As Variant
    Dim HasContextData As String

    On Error GoTo NOT_ENTITY

TRYAGAIN:

    MsgBox "Use the mouse to click on an object in the current drawing after dismissing this dialog box."

    ' Get information about selected object
    ThisDrawing.Utility.GetSubEntity Object, PickedPoint, TransMatrix, ContextData

    ' Process and display selected object properties
    HasContextData = IIf(VarType(ContextData) = vbEmpty, " does not ", " does ")

    MsgBox "The object you chose was an: " & TypeName(Object) & vbCrLf & _
            "Your point of selection was: " & PickedPoint(0) & ", " & _
                                              PickedPoint(1) & ", " & _
                                              PickedPoint(2) & vbCrLf & _
            "This object" & HasContextData & "have nested objects."

    Exit Sub

NOT_ENTITY:
    ' If you click on empty space or do not select an entity,
    ' this error will be generated
    If MsgBox("You have not selected an object.  Click OK to try again.", _
               vbOKCancel & vbInformation) = vbOK Then
        Resume TRYAGAIN
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetSubEntity()
    ;; This example prompts the user to select on object on the screen with a mouse click,
    ;; and returns some information about the selected object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get information about selected object
    (vla-GetSubEntity (vla-get-Utility doc) 'Object 'PickedPoint 'TransMatrix 'ContextData "Select a subentity: ")

    ;; Process and display selected object properties
    (if (/= ContextData nil)
        (setq HasContextData " does ")
        (setq HasContextData " does not ")
    )

    (alert (strcat "The object you chose was an: " (vla-get-ObjectName Object)
                   "\nYour point of selection was: " (rtos (vlax-safearray-get-element PickedPoint 0) 2) ", "
                                                           (rtos (vlax-safearray-get-element PickedPoint 1) 2) ", "
                                                           (rtos (vlax-safearray-get-element PickedPoint 2) 2)
                   "\nThis object" HasContextData "have nested objects."))
)


GetSubSelection Method (ActiveX)

Returns the row and column indexes of the cells in a subselection set.

Supported platforms: Windows only

Signature

VBA:

object.GetSubSelection rowMin, rowMax, colMin, colMax
object

Type: Table

The object this method applies to.

rowMin

Access: Output-only

Type: Long

The zero-based minimum row index for the subselection set of cells in the table.

rowMax

Access: Output-only

Type: Long

The zero-based maximum row index for the subselection set of cells in the table.

colMin

Access: Output-only

Type: Long

The zero-based minimum column index for the subselection set of cells in the table.

colMax

Access: Output-only

Type: Long

The zero-based maximum column index for the subselection set of cells in the table.

Return Value (RetVal)

No return value.

Remarks

This method gets the row and column indices of the cells in the subselection set. The total number of selected cells is equal to (rowMax - rowMin + 1) * (colMax - colMin + 1).

Examples

VBA:

Not available

Visual LISP:

Not available


GetText Method (ActiveX)

Returns the text value for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetText(row, col)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

Return Value (RetVal)

Type: String

The text value of the cell.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetTextHeight Method (ActiveX)

Returns the text height for the specified row type.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetTextHeight(rowType)
object

Type: Table, TableStyle

The objects this method applies to.

rowType

Access: Input-only

Type: AcRowType enum

The row type.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow

Return Value (RetVal)

Type: Double

The text height for the specified row type.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetTextHeight()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.FlowDirection = acTableBottomToTop
    customObj.HorzCellMargin = 0.22
    customObj.BitFlags = 1
    customObj.SetTextHeight AcRowType.acDataRow + AcRowType.acTitleRow, 1.3
    customObj.SetTextStyle AcRowType.acDataRow + AcRowType.acTitleRow, "Standard"

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 12, 23, 45
    customObj.SetBackgroundColor AcRowType.acDataRow + AcRowType.acTitleRow, col
    customObj.SetGridVisibility AcGridLineType.acHorzInside + AcGridLineType.acHorzTop _
                                , AcRowType.acDataRow + AcRowType.acTitleRow, True

    customObj.SetAlignment AcRowType.acDataRow + AcRowType.acTitleRow, acBottomRight
    col.SetRGB 244, 0, 0
    customObj.SetGridColor 3, 1, col

    MsgBox "Table Style Name = " & customObj.Name & vbCrLf & _
           "Style Description = " & customObj.Description & vbCrLf & _
           "Flow Direction = " & customObj.FlowDirection & vbCrLf & _
           "Horzontal Cell Margin = " & customObj.HorzCellMargin & vbCrLf & _
           "Bit Flags = " & customObj.BitFlags & vbCrLf & _
           "Title Row Text Height = " & customObj.GetTextHeight(acTitleRow) & vbCrLf & _
           "Title Row Text Style = " & customObj.GetTextStyle(acTitleRow) & vbCrLf & _
           "Grid Visibility for HorizontalBottom TitleRow  = " & customObj.GetGridVisibility(acHorzBottom, acTitleRow) & vbCrLf & _
           "Title Row Alignment = " & customObj.GetAlignment(acTitleRow) & vbCrLf & _
           "Header Suppression = " & customObj.HeaderSuppressed

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetTextHeight()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-put-FlowDirection customObj acTableBottomToTop)
    (vla-put-HorzCellMargin customObj 0.22)
    (vla-put-BitFlags customObj 1)
    (vla-SetTextHeight customObj (+ acDataRow acTitleRow) 1.3)
    (vla-SetTextStyle customObj (+ acDataRow acTitleRow) "Standard")

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 12 23 45)

    (vla-SetBackgroundColor customObj (+ acDataRow acTitleRow) col)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) (+ acDataRow acTitleRow) :vlax-true)
    (vla-SetAlignment customObj (+ acDataRow acTitleRow) acBottomRight)
    (vla-SetRGB col 244 0 0)
    (vla-SetGridColor customObj (+ acHorzTop acHorzInside) acDataRow col)

    (alert (strcat "Table Style Name = " (vla-get-Name customObj)
                   "\nStyle Description = " (vla-get-Description customObj)
                   "\nFlow Direction = " (itoa (vla-get-FlowDirection customObj))
                   "\nHorzontal Cell Margin = " (rtos (vla-get-HorzCellMargin customObj) 2)
                   "\nBit Flags = " (itoa (vla-get-BitFlags customObj))
                   "\nTitle Row Text Height = " (rtos (vla-GetTextHeight customObj acTitleRow) 2)
                   "\nTitle Row Text Style = " (vla-GetTextStyle customObj acTitleRow)
                   "\nGrid Visibility for HorizontalBottom TitleRow  = " (if (= (vla-GetGridVisibility customObj acHorzBottom acTitleRow) :vlax-true) "True" "False")
                   "\nTitle Row Alignment = " (itoa (vla-GetAlignment customObj acTitleRow))
                      "\nHeader Suppression = " (if (= (vla-get-HeaderSuppressed customObj) :vlax-true) "True" "False")
              )
    )
    (vlax-release-object col)
)


GetTextHeight2 Method (ActiveX)

Gets the text height for a cell.

Supported platforms: Windows only

Signature - Table

VBA:

RetVal = object.GetTextHeight2(nRow, nCol, nContent)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value for the cell.

Signature - TableStyle

VBA:

RetVal = object.GetTextHeight2(strCellStyle)
object

Type: TableStyle

The object this method applies to.

strCellStyle

Access: Input-only

Type: String

A named cell style in the table style.

Return Value (RetVal)

Type: Double

The text height value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetTextRotation Method (ActiveX)

Returns the text rotation for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetTextRotation(row, col)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row in the table.

col

Access: Input-only

Type: Long

The column in the table.

Return Value (RetVal)

Type: AcRotationAngle enum

  • acDegrees000
  • acDegrees090
  • acDegrees180
  • acDegrees270
  • acDegreesUnknown

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetTextString Method (ActiveX)

Gets the text value of a cell.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetTextString(nRow, nCol, nContent)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value of the cell.

Return Value (RetVal)

Type: String

The string value of the cell.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetTextStyle Method (ActiveX)

Gets the text style name for the specified row types.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetTextStyle(rowTypes)
object

Type: Table, TableStyle

The objects this method applies to.

rowTypes

Access: Input-only

Type: AcRowType enum

The row types to change.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow

Return Value (RetVal)

Type: String

The text style name to use for the specified row types.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetTextStyle()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.FlowDirection = acTableBottomToTop
    customObj.HorzCellMargin = 0.22
    customObj.BitFlags = 1
    customObj.SetTextHeight AcRowType.acDataRow + AcRowType.acTitleRow, 1.3
    customObj.SetTextStyle AcRowType.acDataRow + AcRowType.acTitleRow, "Standard"

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 12, 23, 45
    customObj.SetBackgroundColor AcRowType.acDataRow + AcRowType.acTitleRow, col
    customObj.SetGridVisibility AcGridLineType.acHorzInside + AcGridLineType.acHorzTop _
                                , AcRowType.acDataRow + AcRowType.acTitleRow, True

    customObj.SetAlignment AcRowType.acDataRow + AcRowType.acTitleRow, acBottomRight
    col.SetRGB 244, 0, 0
    customObj.SetGridColor 3, 1, col

    MsgBox "Table Style Name = " & customObj.Name & vbCrLf & _
           "Style Description = " & customObj.Description & vbCrLf & _
           "Flow Direction = " & customObj.FlowDirection & vbCrLf & _
           "Horzontal Cell Margin = " & customObj.HorzCellMargin & vbCrLf & _
           "Bit Flags = " & customObj.BitFlags & vbCrLf & _
           "Title Row Text Height = " & customObj.GetTextHeight(acTitleRow) & vbCrLf & _
           "Title Row Text Style = " & customObj.GetTextStyle(acTitleRow) & vbCrLf & _
           "Grid Visibility for HorizontalBottom TitleRow  = " & customObj.GetGridVisibility(acHorzBottom, acTitleRow) & vbCrLf & _
           "Title Row Alignment = " & customObj.GetAlignment(acTitleRow) & vbCrLf & _
           "Header Suppression = " & customObj.HeaderSuppressed

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetTextStyle()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-put-FlowDirection customObj acTableBottomToTop)
    (vla-put-HorzCellMargin customObj 0.22)
    (vla-put-BitFlags customObj 1)
    (vla-SetTextHeight customObj (+ acDataRow acTitleRow) 1.3)
    (vla-SetTextStyle customObj (+ acDataRow acTitleRow) "Standard")

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 12 23 45)

    (vla-SetBackgroundColor customObj (+ acDataRow acTitleRow) col)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) (+ acDataRow acTitleRow) :vlax-true)
    (vla-SetAlignment customObj (+ acDataRow acTitleRow) acBottomRight)
    (vla-SetRGB col 244 0 0)
    (vla-SetGridColor customObj (+ acHorzTop acHorzInside) acDataRow col)

    (alert (strcat "Table Style Name = " (vla-get-Name customObj)
                   "\nStyle Description = " (vla-get-Description customObj)
                   "\nFlow Direction = " (itoa (vla-get-FlowDirection customObj))
                   "\nHorzontal Cell Margin = " (rtos (vla-get-HorzCellMargin customObj) 2)
                   "\nBit Flags = " (itoa (vla-get-BitFlags customObj))
                   "\nTitle Row Text Height = " (rtos (vla-GetTextHeight customObj acTitleRow) 2)
                   "\nTitle Row Text Style = " (vla-GetTextStyle customObj acTitleRow)
                   "\nGrid Visibility for HorizontalBottom TitleRow  = " (if (= (vla-GetGridVisibility customObj acHorzBottom acTitleRow) :vlax-true) "True" "False")
                   "\nTitle Row Alignment = " (itoa (vla-GetAlignment customObj acTitleRow))
                     "\nHeader Suppression = " (if (= (vla-get-HeaderSuppressed customObj) :vlax-true) "True" "False")
              )
    )
    (vlax-release-object col)
)


GetTextStyle2 Method (ActiveX)

Gets the text style name for a cell.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetTextStyle2(nRow, nCol, nContent)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value for the cell.

Return Value (RetVal)

Type: String

The String value of the name.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetTextStyleId Method (ActiveX)

Gets the object id for a named cell style.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetTextStyleId(bstrCellStyle)
object

Type: TableStyle

The object this method applies to.

bstrCellStyle

Access: Input-only

Type: String

The named cell style.

Return Value (RetVal)

Type: Long_PTR

The object id of the named text style.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetUCSMatrix Method (ActiveX)

Gets the transformation matrix consisting of UCS coordinate system data.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetUCSMatrix()
object

Type: UCS

The object this method applies to.

Return Value (RetVal)

Type: Variant (4x4 array of doubles)

The UCS matrix.

Remarks

To transform an entity into a given UCS, use the TransformBy method, using the matrix returned by this method as the input for that method.

Examples

VBA:

Sub Example_GetUCSMatrix()
    ' This example creates a new UCS and finds the UCS matrix for it.
    ' It then creates a circle using WCS coordinates and
    ' transforms the circle for the UCS.

    ' Define a new UCS and turn on the UCS icon at the origin.
    Dim ucsObj As AcadUCS
    Dim origin(0 To 2) As Double
    Dim xAxisPoint(0 To 2) As Double
    Dim yAxisPoint(0 To 2) As Double

    origin(0) = 2: origin(1) = 2: origin(2) = 0
    xAxisPoint(0) = 3: xAxisPoint(1) = 2: xAxisPoint(2) = 0
    yAxisPoint(0) = 2: yAxisPoint(1) = 3: yAxisPoint(2) = 0

    Set ucsObj = ThisDrawing.UserCoordinateSystems.Add(origin, xAxisPoint, yAxisPoint, "UCS1")
    ThisDrawing.ActiveUCS = ucsObj
    ThisDrawing.ActiveViewport.UCSIconOn = True
    ThisDrawing.ActiveViewport.UCSIconAtOrigin = True
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport

    ' Create a circle using WCS coordinates
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 1: center(1) = 1: center(2) = 0
    radius = 0.5
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, radius)
    ZoomAll

    ' Get the UCS transformation matrix
    Dim TransMatrix As Variant
    TransMatrix = ucsObj.GetUCSMatrix()

    ' Transform the circle to the UCS coordinates
    MsgBox "Transform the circle.", , "GetUCSMatrix Example"
    circleObj.TransformBy (TransMatrix)
    circleObj.Update

    MsgBox "The circle is transformed.", , "GetUCSMatrix Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetUCSMatrix()
    ;; This example creates a new UCS and finds the UCS matrix for it.
    ;; It then creates a circle using WCS coordinates and
    ;; transforms the circle for the UCS.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define a new UCS and turn on the UCS icon at the origin.
    (setq origin (vlax-3d-point 2 2 0)
          xAxisPoint (vlax-3d-point 3 2 0)
          yAxisPoint (vlax-3d-point 2 3 0))

    (setq ucsObj (vla-Add (vla-get-UserCoordinateSystems doc) origin xAxisPoint yAxisPoint "UCS1"))
    (vla-put-ActiveUCS doc ucsObj)
    (vla-put-UCSIconOn (vla-get-ActiveViewport doc) :vlax-true)
    (vla-put-UCSIconAtOrigin (vla-get-ActiveViewport doc) :vlax-true)
    (vla-put-ActiveViewport doc (vla-get-ActiveViewport doc))

    ;; Create a circle using WCS coordinates
    (setq center (vlax-3d-point 1 1 0)
          radius 0.5)
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace center radius))
    (vla-ZoomAll acadObj)

    ;; Get the UCS transformation matrix
    (setq TransMatrix (vla-GetUCSMatrix ucsObj))

    ;; Transform the circle to the UCS coordinates
    (alert "Transform the circle.")
    (vla-TransformBy circleObj TransMatrix)
    (vla-Update circleObj)

    (alert "The circle is transformed.")
)


GetUniqueCellStyleName Method (ActiveX)

Gets a unique cell style name with the base name that is passed as the prefix.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetUniqueCellStyleName(pszBaseName)
object

Type: TableStyle

The object this method applies to.

pszBaseName

Access: Input-only

Type: String

The base cell style name.

Return Value (RetVal)

Type: String

The cell style name.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellStyle()
    ' This example creates a TableStyle object and sets values for
    ' the style name and formatting.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As IAcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.CreateCellStyle ("NewTestStyle")
    Dim cellTestFormat As String

    customObj.SetFormat2 "NewTestStyle", "test format"
    customObj.GetFormat2 "NewTestStyle", cellTestFormat

    MsgBox "Cell Style Name = " & cellTestFormat

    customObj.RenameCellStyle "NewTestStyle", "NewTestStyle2"
    customObj.GetFormat2 "NewTestStyle2", cellTestFormat

    MsgBox "Cell Style Name = " & cellTestFormat

    Dim uniqueStyleName As String

    uniqueStyleName = customObj.GetUniqueCellStyleName("testbase")

    MsgBox "Cell Style Name = " & uniqueStyleName

    If customObj.GetIsCellStyleInUse("testbase") = False Then
        MsgBox "That cell style is not being used!"
    End If

    customObj.CreateCellStyleFromStyle "TestStyleFromStyle", "NewTestStyle2"

    customObj.DeleteCellStyle "NewTestStyle2"

    Dim numOfStyles As Long
    numOfStyles = customObj.NumCellStyles
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellStyle()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and formatting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-CreateCellStyle customObj "NewTestStyle")

    (setq cellTestFormat "")
    (vla-SetFormat2 customObj "NewTestStyle" "test format")
    (vla-GetFormat2 customObj "NewTestStyle" 'cellTestFormat)

    (alert (strcat "Cell Style Name = " cellTestFormat))

    (vla-RenameCellStyle customObj "NewTestStyle" "NewTestStyle2")
    (vla-GetFormat2 customObj "NewTestStyle2" 'cellTestFormat)

    (alert (strcat "Cell Style Name = " cellTestFormat))

    (setq uniqueStyleName (vla-GetUniqueCellStyleName customObj "testbase"))

    (alert (strcat "Cell Style Name = " uniqueStyleName))

    (if (= (vla-GetIsCellStyleInUse customObj "testbase") :vlax-false)
        (alert "That cell style is not being used!")
    )

    (vla-CreateCellStyleFromStyle customObj "TestStyleFromStyle" "NewTestStyle2")

    (vla-DeleteCellStyle customObj "NewTestStyle2")

    (setq numOfStyles (vla-get-NumCellStyles customObj))
    (alert (strcat "Number of Cell Styles = " (itoa numOfStyles)))
)


GetUniqueSectionName Method (ActiveX)

Finds a unique section plane name.

Supported platforms: Windows only

Signature

VBA:

Retval = object.GetUniqueSectionName(pszBaseName)
object

Type: SectionManager

The object this method applies to.

pszBaseName

Access: Input-only

Type: String

The base name from which the unique section plane name is coined. The base name can be any arbitrary string.

Return Value (RetVal)

Type: String

The section plane name.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetValue Method (ActiveX)

Gets the value of a cell.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetValue(nRow, nCol, nContent)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to delete.

nCol

Access: Input-only

Type: Long

The column number of the cell to delete.

nContent

Access: Input-only

Type: Long

The content value of the cell.

Return Value (RetVal)

Type: Variant

The value of the cell.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetVariable Method (ActiveX)

Gets the current setting of an AutoCAD system variable.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetVariable(Name)
object

Type: Document

The object this method applies to.

Name

Access: Input-only

Type: String

The name of the variable to return. Must contain a valid system variable name (the case of the characters is not significant).

Return Value (RetVal)

Type: Variant

The value of the specified system variable.

Remarks

For a list of all the AutoCAD system variables and their types, please refer to "System Variables" in the AutoCAD Help system.

Examples

VBA:

Sub Example_GetVariable()
    ' This example finds the current setting of the
    ' system variable FILLMODE.

    Dim sysVarName As String
    Dim varData As Variant

    sysVarName = "FILLMODE"
    varData = ThisDrawing.GetVariable(sysVarName)
    MsgBox sysVarName & " = " & varData, , "GetVariable Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetVariable()
    ;; This example finds the current setting of the
    ;; system variable FILLMODE.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq sysVarName "FILLMODE")
    (setq varData (vlax-variant-value (vla-GetVariable doc sysVarName)))
    (alert (strcat sysVarName " = " (itoa varData)))
)


GetVertexCount Method (ActiveX)

Gets the number of vertices in the specified leaderline.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetVertexCount(leaderLineIndex)
object

Type: MLeader

The object this method applies to.

leaderLineIndex

Access: Input-only

Type: Long

The leader line index.

Return Value (RetVal)

Type: Long

The number of vertices.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetWeight Method (ActiveX)

Gets the weight of the control point at a given index.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetWeight(Index)
object

Type: Spline

The object this method applies to.

Index

Access: Input-only

Type: Integer

The index location in the array of points that make up the spline. A positive integer beginning with 0.

Return Value (RetVal)

Type: Double

The weight of the specified control point.

Remarks

Control points fine-tune a spline definition by adding weight to a portion of the spline curve.

Examples

VBA:

Sub Example_GetWeight()
    ' This example creates a spline object in model space.
    ' It then finds the weight of the first control point
    ' and changes that value.

    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ZoomAll

    ' Display the coordinates of the first fit point
    Dim weight As Double
    weight = splineObj.GetWeight(0)
    MsgBox "The weight of control point 1 is " & weight, , "GetWeight Example"

    ' Change the weight of the first control point
    weight = 5
    splineObj.SetWeight 0, weight
    splineObj.Update
    MsgBox "The weight of control point 1 is now " & weight, , "GetWeight Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetWeight()
    ;; This example creates a spline object in model space.
    ;; It then finds the weight of the first control point
    ;; and changes that value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the spline
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(1 1 0
                                     5 5 0
                                     10 0 0
                                    )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)

    ;; Display the coordinates of the first fit point
    (setq weight (vla-GetWeight splineObj 0))
    (alert (strcat "The weight of control point 1 is " (rtos weight 2)))

    ;; Change the weight of the first control point
    (setq weight 5)
    (vla-SetWeight splineObj 0 weight)
    (vla-Update splineObj)
    (alert (strcat "The weight of control point 1 is now " (rtos weight 2)))
)


GetWidth Method (ActiveX)

Gets the start and end width for a polyline.

Supported platforms: Windows only

Signature

VBA:

object.GetWidth Index, StartWidth, EndWidth
object

Type: LWPolyline, Polyline

The objects this method applies to.

Index

Access: Input-only

Type: Integer

The index location of the polyline for which the width is returned. The index must be a positive integer beginning with 0.

StartWidth

Access: Output-only

Type: Double

The start width of the polyline at the given index.

EndWidth

Access: Output-only

Type: Double

The end width of the polyline at the given index.

Return Value (RetVal)

No return value.

Remarks

Polyline: this method will fail if the polyline Type property is acCubicSplinePoly or acQuadSplinePoly.

Examples

VBA:

Sub Example_GetWidth()
    ' The following code prompts you to select a lightweight
    ' polyline, then displays the width of each segment of the
    ' selected polyline.

    AppActivate ThisDrawing.Application.Caption

    Dim returnObj As AcadObject
    Dim basePnt As Variant
    Dim retCoord As Variant
    Dim StartWidth As Double
    Dim EndWidth As Double
    Dim i, j As Long
    Dim nbr_of_segments As Long
    Dim nbr_of_vertices As Long
    Dim segment As Long
    Dim message_string

    On Error Resume Next

    ThisDrawing.Utility.GetEntity returnObj, basePnt, "Select a polyline"

    ' Make sure the user selected a polyline.
    If Err <> 0 Then
        If returnObj.EntityName <> "AcDbPolyline" Then
            MsgBox "You did not select a polyline"
        End If
        Exit Sub
    End If

    ' Obtain the coordinates of each vertex of the selected polyline.
    ' The coordinates are returned in an array of points.
    retCoord = returnObj.Coordinates

    segment = 0
    i = LBound(retCoord)                 ' Start index of coordinates array
    j = UBound(retCoord)                 ' End index of coordinates array
    nbr_of_vertices = ((j - i) \ 2) + 1  ' Number of vertices in the polyline

    ' Determine the number of segments in the polyline.
    ' A closed polyline has as many segments as it has vertices.
    ' An open polyline has one fewer segment than it has vertices.
    ' Check the Closed property to determine if the polyline is closed.

    If returnObj.Closed Then
        nbr_of_segments = nbr_of_vertices
    Else
        nbr_of_segments = nbr_of_vertices - 1
    End If

    ' Get the width of each segment of the polyline
    Do While nbr_of_segments > 0

        ' Get the width of the current segment
        returnObj.GetWidth segment, StartWidth, EndWidth

        message_string = "The segment that begins at " & retCoord(i) & "," & retCoord(i + 1) _
            & " has a start width of " & StartWidth & " and an end width of " & EndWidth
        MsgBox message_string, , "GetWidth Example"

        ' Prepare to obtain width of next segment, if any
        i = i + 2
        segment = segment + 1
        nbr_of_segments = nbr_of_segments - 1
    Loop

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetWidth()
    ;; The following code prompts you to select a lightweight
    ;; polyline, then displays the width of each segment of the
    ;; selected polyline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (vla-GetEntity (vla-get-Utility doc) 'returnObj 'basePnt "Select a polyline: ")

    ;; Make sure the user selected a polyline.
    (if (/= returnObj nil)
        (progn
            (if (= (vla-get-ObjectName returnObj) "AcDbPolyline")
                   (progn
                          ;; Obtain the coordinates of each vertex of the selected polyline.
                          ;; The coordinates are returned in an array of points.
                          (setq retCoord (vlax-variant-value (vla-get-Coordinates returnObj)))

                          (setq segment 0
                                i (vlax-safearray-get-l-bound retCoord 1)                 ;; Start index of coordinates array
                                j (vlax-safearray-get-u-bound retCoord 1)                 ;; End index of coordinates array
                                nbr_of_vertices (+ (/ (- j i) 2) 1))                      ;; Number of vertices in the polyline

                          ;; Determine the number of segments in the polyline.
                          ;; A closed polyline has as many segments as it has vertices.
                          ;; An open polyline has one fewer segment than it has vertices.
                          ;; Check the Closed property to determine if the polyline is closed.
                          (if (= (vla-get-Closed returnObj) :vlax-true)
                              (setq nbr_of_segments nbr_of_vertices)
                              (setq nbr_of_segments (1- nbr_of_vertices))
                          )

                          ;; Get the width of each segment of the polyline
                          (while (>= nbr_of_segments 0)
                              ;; Get the width of the current segment
                              (vla-GetWidth returnObj segment 'StartWidth 'EndWidth)

                              (setq message_string (strcat "The segment that begins at " (rtos (vlax-safearray-get-element retCoord i) 2) ","
                                                                                (rtos (vlax-safearray-get-element retCoord (1+ i)) 2)
                                                           " has a start width of " (rtos StartWidth 2) " and an end width of " (rtos EndWidth 2)))
                        (alert message_string)

                        ;; Prepare to obtain width of next segment, if any
                        (setq i (+ i 2))
                        (setq segment (1+ segment))
                        (setq nbr_of_segments (1- nbr_of_segments))
                          )
                )
                (alert "Object selected was not a polyline")
            )
        )
        (alert "No object was selected.")
    )
)


GetWindowToPlot Method (ActiveX)

Gets the coordinates that define the portion of the layout to plot.

Supported platforms: Windows only

Signature

VBA:

object.GetWindowToPlot LowerLeft, UpperRight
object

Type: Layout, PlotConfiguration

The object this method applies to.

LowerLeft

Access: Output-only

Type: Variant (two-element array of doubles)

The X and Y values for the lower-left window.

UpperRight

Access: Output-only

Type: Variant (two-element array of doubles)

The X and Y values for the upper-right window.

Return Value (RetVal)

No return value.

Remarks

The window coordinates are taken from the origin.

The units for these values are specified by the PaperUnits property.

The PlotType property must be set to acWindow for these coordinates to be used for the plot.

Examples

VBA:

Sub Example_GetWindowToPlot()
    ' This example allows the user to define an area in the current layout to plot
    ' and displays a plot preview of the defined area.
    '
    ' * Note: You will have to exit the plot preview
    '  before the VBA example will stop and control will be returned

    AppActivate ThisDrawing.Application.Caption

    Dim point1 As Variant, point2 As Variant

    ' Get first point in window
    point1 = ThisDrawing.Utility.GetPoint(, "Click the lower-left of the window to plot.")
    ReDim Preserve point1(0 To 1)   ' Change this to a 2D array by removing the Z position

    ' Get second point in window
    point2 = ThisDrawing.Utility.GetPoint(, "Click the upper-right of the window to plot.")
    ReDim Preserve point2(0 To 1)   ' Change this to a 2D array by removing the Z position

    ' Send information about window to current layout
    ThisDrawing.ActiveLayout.SetWindowToPlot point1, point2

    ' Read back window information
    ThisDrawing.ActiveLayout.GetWindowToPlot point1, point2

    MsgBox "Press any key to plot the following window:" & vbCrLf & vbCrLf & _
           "Lower Left: " & point1(0) & ", " & point1(1) & vbCrLf & _
           "Upper Right: " & point2(0) & ", " & point2(1)

    ' Make sure the instruction is to plot a view, not some other plot style
    ThisDrawing.ActiveLayout.PlotType = acWindow

    ' Send Plot To Window
    ThisDrawing.ActiveLayout.ConfigName = "DWG to PDF.pc3"
    ThisDrawing.Plot.DisplayPlotPreview acFullPreview
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetWindowToPlot()
    ;; This example allows the user to define an area in the current layout to plot
    ;; and displays a plot preview of the defined area.
    ;;
    ;; * Note: You will have to exit the plot preview
    ;;  before the VBA example will stop and control will be returned
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get first point in window
    (setq point1 (vlax-variant-value (vla-GetPoint (vla-get-Utility doc) nil "Click the lower-left of the window to plot.")))

    ;; Change this to a 2D array by removing the Z position
    (setq pointTemp1 (vlax-make-safearray vlax-vbDouble '(0 . 1)))
    (vlax-safearray-put-element pointTemp1 0 (vlax-safearray-get-element point1 0))
    (vlax-safearray-put-element pointTemp1 1 (vlax-safearray-get-element point1 1))

    ;; Get second point in window
    (setq point2 (vlax-variant-value (vla-GetCorner (vla-get-Utility doc) point1 "Click the upper-right of the window to plot.")))

    ;; Change this to a 2D array by removing the Z position
    (setq pointTemp2 (vlax-make-safearray vlax-vbDouble '(0 . 1)))
    (vlax-safearray-put-element pointTemp2 0 (vlax-safearray-get-element point2 0))
    (vlax-safearray-put-element pointTemp2 1 (vlax-safearray-get-element point2 1))

    ;; Send information about window to current layout
    (vla-SetWindowToPlot (vla-get-ActiveLayout doc) pointTemp1 pointTemp2)

    ;; Read back window information
    (vla-GetWindowToPlot (vla-get-ActiveLayout doc) 'point1 'point2)

    (setq point1 (vlax-safearray->list point1)
             point2 (vlax-safearray->list point2))

    (alert (strcat "Press any key to plot the following window:"
                   "\nLower Left: " (rtos (nth 0 point1) 2) ", " (rtos (nth 1 point1) 2)
                   "\nUpper Right: " (rtos (nth 0 point2) 2) ", " (rtos (nth 1 point2) 2)))

    ;; Make sure the instruction is to plot a view, not some other plot style
    (vla-put-PlotType (vla-get-ActiveLayout doc) acWindow)

    ;; Send Plot To Window - A plot device must be set before a preview can be created
    (vla-DisplayPlotPreview (vla-get-Plot doc) acFullPreview)
)


GetXData Method (ActiveX)

Gets the extended data (XData) associated with an object.

Supported platforms: Windows only

Signature

VBA:

object.GetXData AppName, XDataType, XDataValue
object

Type: All drawing objects, AttributeReference, Block, Dictionary, Dimension, DimStyle, Group, Layer, Layout, Linetype, Material, MLeaderStyle, PlotConfiguration, RegisteredApplication, TableStyle, TextStyle, UCS, View, Viewport, XRecord

The objects this method applies to.

AppName

Access: Input-only

Type: String

A NULL string will return all the data attached to the object, regardless of the application that created it. Supplying an application name will return only the data that was created by the specified application.

XDataType

Access: Output-only

Type: Variant (array of shorts)

An array of short integer values that represent the DXF group code values for each value in the extended data (XData).

XDataValue

Access: Output-only

Type: Variant (array of variants)

An array of values that make up the extended data (XData).

Return Value (RetVal)

No return value.

Remarks

Extended data is an example of instance-specific data created by applications written with ObjectARX or AutoLISP. This data can be added to any object. This data follows the object's definition data, and is maintained in the order that it was saved into the document. (AutoCAD maintains this information, but does not use it.)

Examples

VBA:

Sub Example_GetXData()
    ' This example creates a line and attaches extended data to that line.

    ' Create the line
    Dim lineObj As AcadLine
    Dim startPt(0 To 2) As Double, endPt(0 To 2) As Double
    startPt(0) = 1#: startPt(1) = 1#: startPt(2) = 0#
    endPt(0) = 5#: endPt(1) = 5#: endPt(2) = 0#
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPt, endPt)
    ZoomAll

    ' Initialize all the xdata values. Note that first data in the list should be
    ' application name and first datatype code should be 1001
    Dim DataType(0 To 9) As Integer
    Dim Data(0 To 9) As Variant
    Dim reals3(0 To 2) As Double
    Dim worldPos(0 To 2) As Double

    DataType(0) = 1001: Data(0) = "Test_Application"
    DataType(1) = 1000: Data(1) = "This is a test for xdata"

    DataType(2) = 1003: Data(2) = "0"                   ' layer
    DataType(3) = 1040: Data(3) = 1.23479137438413E+40  ' real
    DataType(4) = 1041: Data(4) = 1237324938            ' distance
    DataType(5) = 1070: Data(5) = 32767                 ' 16 bit Integer
    DataType(6) = 1071: Data(6) = 32767                 ' 32 bit Integer
    DataType(7) = 1042: Data(7) = 10                    ' scaleFactor

    reals3(0) = -2.95: reals3(1) = 100: reals3(2) = -20
    DataType(8) = 1010: Data(8) = reals3                ' real

    worldPos(0) = 4: worldPos(1) = 400.99999999: worldPos(2) = 2.798989
    DataType(9) = 1011: Data(9) = worldPos              ' world space position

    ' Attach the xdata to the line
    lineObj.SetXData DataType, Data

    ' Return the xdata for the line
    Dim xdataOut As Variant
    Dim xtypeOut As Variant
    lineObj.GetXData "", xtypeOut, xdataOut

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetXData()
    ;; This example creates a line and attaches extended data to that line.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the line
    (setq startPt (vlax-3d-point 1 1 0)
          endPt (vlax-3d-point 5 5 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPt endPt))
    (vla-ZoomAll acadObj)

    ;; Initialize all the xdata values. Note that first data in the list should be
    ;; application name and first datatype code should be 1001
    (setq DataType (vlax-make-safearray vlax-vbInteger '(0 . 9)))
    (setq Data (vlax-make-safearray vlax-vbVariant '(0 . 9)))

    (vlax-safearray-put-element DataType 0 1001)
    (vlax-safearray-put-element Data 0 "Test_Application")

    (vlax-safearray-put-element DataType 1 1000)
    (vlax-safearray-put-element Data 1 "This is a test for xdata")

    ;; layer
    (vlax-safearray-put-element DataType 2 1003)
    (vlax-safearray-put-element Data 2 "0")

    ;; real
    (vlax-safearray-put-element DataType 3 1040)
    (vlax-safearray-put-element Data 3 1.23479137438413E+40)

    ;; distance
    (vlax-safearray-put-element DataType 4 1041)
    (vlax-safearray-put-element Data 4 1237324938)

    ;; 16 bit Integer
    (vlax-safearray-put-element DataType 5 1070)
    (vlax-safearray-put-element Data 5 32767)

    ;; 32 bit Integer
    (vlax-safearray-put-element DataType 6 1071)
    (vlax-safearray-put-element Data 6 32767)

    ;; scaleFactor
    (vlax-safearray-put-element DataType 7 1042)
    (vlax-safearray-put-element Data 7 10)

    ;; 3D point
    (setq reals3 (vlax-3d-point -2.95 100 -20))
    (vlax-safearray-put-element DataType 8 1010)
    (vlax-safearray-put-element Data 8 reals3)

    ;; world space position
    (setq worldPos (vlax-3d-point 4 400.99999999 2.798989))
    (vlax-safearray-put-element DataType 9 1011)
    (vlax-safearray-put-element Data 9 worldPos)

    ;; Attach the xdata to the line
    (vla-SetXData lineObj DataType Data)

    ;; Return the xdata for the line
    (vla-GetXData lineObj "" 'xtypeOut 'xdataOut)
)


GetXRecordData Method (ActiveX)

Gets the extended record data (XRecordData) associated with a dictionary.

Supported platforms: Windows only

Signature

VBA:

object.GetXRecordData XRecordDataType, XRecordDataValue
object

Type: XRecord

The object this method applies to.

XRecordDataType

Access: Output-only

Type: Variant (array of shorts)

An array of short integer values that represent the DXF group code values for each value in the extended record (XRecord) data.

XRecordDataValue

Access: Output-only

Type: Variant (array of variants)

An array of values that make up the extended record (XRecord) data.

Return Value (RetVal)

No return value.

Remarks

XRecord objects are used to store and manage arbitrary data. This object is similar in concept to XData but is not limited by size or order.

Unlike XData, XRecords work with the standard AutoCAD group codes which are all below 1000 in value. All the standard AutoCAD group codes are supported. This means that, in addition to all the normally used data types, an XRecord is capable of storing object IDs, which allows XRecords to own other objects including other XRecords.

The following group codes are common to all XRecord objects:

Group codes | Description
100 | Subclass marker (AcDbXrecord)
1-369 (except 5 and 105) | These values can be used by an application in any way.

Examples

VBA:

Sub Example_SetXRecordData()
    ' This example creates a new XRecord if one doesn't exist,
    ' appends data to the XRecord, and reads it back.  To see data being added,
    ' run the example more than once.

    Dim TrackingDictionary As AcadDictionary, TrackingXRecord As AcadXRecord
    Dim XRecordDataType As Variant, XRecordData As Variant
    Dim ArraySize As Long, iCount As Long
    Dim DataType As Integer, Data As String, msg As String

    ' Unique identifiers to distinguish our XRecordData from other XRecordData
    Const TYPE_STRING = 1
    Const TAG_DICTIONARY_NAME = "ObjectTrackerDictionary"
    Const TAG_XRECORD_NAME = "ObjectTrackerXRecord"

    ' Connect to the dictionary in which the XRecord is stored
    On Error GoTo CREATE
    Set TrackingDictionary = ThisDrawing.Dictionaries(TAG_DICTIONARY_NAME)
    Set TrackingXRecord = TrackingDictionary.GetObject(TAG_XRECORD_NAME)
    On Error GoTo 0

    ' Get current XRecordData
    TrackingXRecord.GetXRecordData XRecordDataType, XRecordData

    ' If there is no array already, create one
    If VarType(XRecordDataType) And vbArray = vbArray Then
        ArraySize = UBound(XRecordDataType) + 1       ' Get the size of the data elements returned
        ArraySize = ArraySize + 1                        ' Increase to hold new data

        ReDim Preserve XRecordDataType(0 To ArraySize)
        ReDim Preserve XRecordData(0 To ArraySize)
    Else
        ArraySize = 0
        ReDim XRecordDataType(0 To ArraySize) As Integer
        ReDim XRecordData(0 To ArraySize) As Variant
    End If

    ' Append new XRecord Data
    '
    ' For this sample, we only append the current time to the XRecord
    XRecordDataType(ArraySize) = TYPE_STRING: XRecordData(ArraySize) = CStr(Now)
    TrackingXRecord.SetXRecordData XRecordDataType, XRecordData

    ' Read back all XRecordData entries
    TrackingXRecord.GetXRecordData XRecordDataType, XRecordData
    ArraySize = UBound(XRecordDataType)

    ' Retrieve and display stored XRecordData
    For iCount = 0 To ArraySize
        ' Get information for this element
        DataType = XRecordDataType(iCount)
        Data = XRecordData(iCount)

        If DataType = TYPE_STRING Then
            msg = msg & Data & vbCrLf
        End If
    Next

    MsgBox "The data in the XRecord is: " & vbCrLf & vbCrLf & msg, vbInformation

    Exit Sub

CREATE:
    ' Create the objects that hold the XRecordData
    If TrackingDictionary Is Nothing Then  ' Make sure the tracking object is there
        Set TrackingDictionary = ThisDrawing.Dictionaries.Add(TAG_DICTIONARY_NAME)
        Set TrackingXRecord = TrackingDictionary.AddXRecord(TAG_XRECORD_NAME)
    End If

    Resume
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetXRecordData()
    ;; This example creates a new XRecord if one doesn't exist,
    ;; appends data to the XRecord, and then reads it back.  To see data being added,
    ;; run the example more than once.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Unique identifiers to distinguish this XRecordData from other XRecordData
    (setq TYPE_STRING 1
          TAG_DICTIONARY_NAME "ObjectTrackerDictionary"
          TAG_XRECORD_NAME "ObjectTrackerXRecord")

    ;; Connect to the dictionary in which to store the XRecord
    (setq dictionaries (vla-get-Dictionaries doc))
    (setq TrackingDictionary (vl-catch-all-apply 'vla-Item (list dictionaries TAG_DICTIONARY_NAME)))

    ;; (= (vl-catch-all-error-message TrackingDictionary) "Automation Error. Key not found")

    (if (= (type TrackingDictionary) 'VLA-OBJECT)
        (setq TrackingXRecord (vla-GetObject TrackingDictionary TAG_XRECORD_NAME))
        (progn
            ;; Create the objects that hold this XRecordData
            (setq TrackingDictionary (vla-Add dictionaries TAG_DICTIONARY_NAME))
            (setq TrackingXRecord  (vla-AddXRecord TrackingDictionary TAG_XRECORD_NAME))
           )
    )

    ;; Get current XRecordData
    (vla-GetXRecordData TrackingXRecord 'temp-XRecordDataType 'temp-XRecordData)

    ;; If there is no array yet then create one
    (setq ArraySize 0)
    (if (/= temp-XRecordDataType nil)
        (progn
               (setq ArraySize (vlax-safearray-get-u-bound temp-XRecordDataType 1))
            (setq XRecordDataType (vlax-make-safearray vlax-vbInteger (cons 0 (1+ ArraySize))))
            (setq XRecordData (vlax-make-safearray vlax-vbVariant (cons 0 (1+ ArraySize))))

            (setq iCount 0)
            (while (>= ArraySize iCount)
                ;; Get information for this element
                (setq DataType (vlax-safearray-get-element temp-XRecordDataType iCount))
                (setq Data (vlax-variant-value (vlax-safearray-get-element temp-XRecordData iCount)))

                (vlax-safearray-put-element XRecordDataType iCount DataType)
                (vlax-safearray-put-element XRecordData iCount Data)

                (setq iCount (1+ iCount))
            )
           )
        (progn
            (setq XRecordDataType (vlax-make-safearray vlax-vbInteger '(0 . 0)))
            (setq XRecordData (vlax-make-safearray vlax-vbVariant '(0 . 0)))
           )
    )

    ;; Append new XRecord Data
    ;;
    ;; For this sample we only append the current time to the XRecord
    (vlax-safearray-put-element XRecordDataType ArraySize TYPE_STRING)
    (setq cdate (rtos (vlax-variant-value (vla-GetVariable doc "CDATE")) 2 6))
    (vlax-safearray-put-element XRecordData ArraySize (strcat (substr cdate 5 2) "/"
                                                                                (substr cdate 7 2) "/"
                                                                                (substr cdate 1 4) "-"
                                                                                (substr cdate 10 2) ":"
                                                                                (substr cdate 12 2) ":"
                                                                                (substr cdate 14)))
    (vla-SetXRecordData TrackingXRecord XRecordDataType XRecordData)

    ;; Read back all XRecordData entries
    (vla-GetXRecordData TrackingXRecord XRecordDataType XRecordData)
    (setq ArraySize (vlax-safearray-get-u-bound XRecordDataType 1))

    ;; Retrieve and display stored XRecordData
    (setq iCount 0
             msg "")
    (while (>= ArraySize iCount)
        ;; Get information for this element
        (setq DataType (vlax-safearray-get-element XRecordDataType iCount))
        (setq Data (vlax-variant-value (vlax-safearray-get-element XRecordData iCount)))

        (if (= DataType TYPE_STRING)
            (setq msg (strcat msg Data "\n"))
        )

        (setq iCount (1+ iCount))
    )

    (alert (strcat "The data in the XRecord is: \n\n" msg))
)


HandleToObject Method (ActiveX)

Gets the object that corresponds to the given handle.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.HandleToObject(Handle)
object

Type: Document

The object this method applies to.

Handle

Access: Input-only

Type: String

The handle of the object to return.

Return Value (RetVal)

Type: Object

The object that corresponds to the given handle.

Remarks

This method can return only objects in the current document.

Examples

VBA:

Sub Example_HandleToObject()
    ' This example creates a spline in model space, and returns the
    ' handle for the spline. Then the spline is returned from the handle and colored.

    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)

    ZoomAll

    ' Find the handle of the spline
    Dim handle As String
    handle = splineObj.handle
    MsgBox "The handle of the Spline is: " & splineObj.handle, , "HandleToObject Example"

    ' Find an object from a given handle
    Dim tempObj As AcadObject
    Set tempObj = ThisDrawing.HandleToObject(handle)

    ' Now use the newly initialized object variable to color the object
    Dim color As AcadAcCmColor
    Set color = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Call color.SetRGB(80, 100, 244)

    tempObj.TrueColor = color

    ThisDrawing.Regen True
    MsgBox "The Spline is now blue.", , "ObjectIDToObject Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_HandleToObject()
    ;; This example creates a spline in model space, and returns the
    ;; handle for the spline. Then the spline is returned from the handle and colored.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the spline
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(1 1 0
                                     5 5 0
                                                 10 0 0
                                                )
    )
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)

    ;; Find the handle of the spline
    (setq handle (vla-get-Handle splineObj))
    (alert (strcat "The handle of the Spline is: " handle))

    ;; Find an object from a given handle
    (setq tempObj (vla-HandleToObject doc handle))

    ;; Now use the newly initialized object variable to color the object
    (setq color (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB color 80 100 244)
    (vla-put-TrueColor tempObj color)

    (vla-Regen doc :vlax-true)
    (alert "The Spline is now blue.")
    (vlax-release-object color)
)


Highlight Method (ActiveX)

Sets the highlight status for the given object, or for all objects in a given selection set.

Supported platforms: Windows only

Signature

VBA:

object.Highlight HighlightFlag
object

Type: All drawing objects, AttributeReference, Dimension, Group, SelectionSet

The objects this method applies to.

HighlightFlag

Access: Input-only

Type: Boolean

  • True: The object is highlighted.
  • False: The existing highlight is removed from the object.

Return Value (RetVal)

No return value.

Remarks

Once the highlight flag for an object has been set, a call to the Update or Regen method is required to view the change.

NoteThis function does not return the current highlight status of an object.

Examples

VBA:

Sub Example_Highlight()
    ' This example creates several objects in model space.
    ' It then iterates through model space, highlights each
    ' object, and displays its Entity Name.

    ' Create a Ray object in model space
    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)

    ' Create a polyline object in model space
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True

    ' Create a line object in model space
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ' Create a circle object in model space
    Dim circObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 20: centerPt(1) = 30: centerPt(2) = 0
    radius = 3
    Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)

    ' Create an ellipse object in model space
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    ZoomAll

    ' Iterate through the model space collection and
    ' highlight each object.

    Dim entName As String
    Dim entry As AcadEntity
    For Each entry In ThisDrawing.ModelSpace
        entName = entry.ObjectName
        entry.Highlight (True)
        MsgBox "The name of this object is " & entName, vbInformation, "Highlight Example"
        entry.Highlight (False)
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Highlight()
    ;; This example creates several objects in model space.
    ;; It then iterates through the objects in model space and displays the
    ;; Handle for each object found.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Create a Ray object in model space
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 1 3 0))
    (setq rayObj (vla-AddRay modelSpace basePoint SecondPoint))

    ;; Create a polyline object in model space
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
                                  9 2
                                              3 5
                                             )
    )
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)

    ;; Create a line object in model space
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 2 2 0))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    ;; Create a circle object in model space
    (setq centerPt (vlax-3d-point 20 30 0)
          radius 3)
    (setq circObj (vla-AddCircle modelSpace centerPt radius))

    ;; Create an ellipse object in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

    (vla-ZoomAll acadObj)

    ;; Iterate through the model space collection and display
    ;; the object name of each object found.
    (vlax-for entry (vla-get-ModelSpace doc)
        (setq entName (vla-get-ObjectName entry))
        (vla-Highlight entry :vlax-true)
        (alert (strcat "The name of this object is " entName))
        (vla-Highlight entry :vlax-false)
    )
)


HitTest Method (ActiveX)

Performs a hit test on the section plane or table cell at the specified location.

Supported platforms: Windows only

Signature - Section

VBA:

object.HitTest varPtHit, pHit, pSegmentIndex, pPtOnSegment, pSubItem
Object
object

Type: Section

The object this method applies to.

varPtHit

Access: Input-only

Type: Variant

Point at which to perform the hit test.

pHit

Access: Output-only

Type: Boolean

True if the given point lies on the section plane.

pSegmentIndex

Access: Output-only

Type: Integer

Index of segment on the section line that passes near or through the hit point.

pPtOnSegment

Access: Output-only

Type: Variant

The actual point on the section plane geometry. This parameter may return nothing if this data is not required.

pSubItem

Access: Output-only

Type: AcSectionSubItem enum

One or more of the values. This parameter may return nothing if this data is not required.

  • acSectionSubItemBackLine
  • acSectionSubItemBackLineBottom
  • acSectionSubItemBackLineTop
  • acSectionSubItemkNone
  • acSectionSubItemSectionLine
  • acSectionSubItemSectionLineBottom
  • acSectionSubItemSectionLineTop
  • acSectionSubItemVerticalLineBottom
  • acSectionSubItemVerticalLineTop

Signature - Table

VBA:

RetVal = object.HitTest(wpt, wviewVec, resultRowIndex, resultColumnIndex)
object

Type: Table

The object this method applies to.

wpt

Access: Input-only

Type: Variant

3D point in WCS specifying the input pick point.

wviewVec

Access: Input-only

Type: Variant

3D vector in WCS specifying the view direction for the hit test.

resultRowIndex

Access: Output-only

Type: Long

Row index of the selected cell.

resultColumnIndex

Access: Output-only

Type: Long

Column index of the selected cell.

Return Value (RetVal) - Section

No return value.

Return Value (RetVal) - Table

Type: Boolean

True if the hit test is in a table cell.

Remarks

Table: This function performs a hit test by specifying a point and viewing direction. The cell hit by the ray is returned.

Examples

VBA:

Not available

Visual LISP:

Not available


Import Method (ActiveX)

Imports a drawing or a group of saved layer settings from a file.

Supported platforms: Windows only

Signature - Document

VBA:

RetVal = object.Import(FileName, InsertionPoint, ScaleFactor)
object

Type: Document

The object this method applies to.

FileName

Access: Input-only

Type: String

The name of the file to be imported.

InsertionPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates location in the current drawing where the imported file is placed.

ScaleFactor

Access: Input-only

Type: Double

The scale used to place the imported file.

Signature - LayerStateManager

VBA:

object.Import FileName
object

Type: LayerStateManager

The object this method applies to.

FileName

Access: Input-only

Type: String

The name of the file you are importing layer settings from.

Return Value (RetVal) - Document

Type: Object

In the case of importing a WMF file, a BlockReference object is returned. In all other cases, the return value is NULL.

Return Value (RetVal) - LayerStateManager

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Import()
    ' This example will create a new drawing. Be sure to save
    ' your work and start a new drawing before running this example.
    ' This example creates a circle. It then exports the drawing
    ' to a file called DXFExport.DXF. It then opens a new drawing
    ' and imports the file.

    ' Create the circle for visual representation
    Dim circleObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 2: centerPt(1) = 2: centerPt(2) = 0
    radius = 1
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)
    ZoomAll

    ' Create an empty selection set
    Dim sset As AcadSelectionSet
    Set sset = ThisDrawing.SelectionSets.Add("TEST")

    ' Export the current drawing to the file specified above.
    Dim exportFile As String
    exportFile = "C:\AutoCAD\DXFExport"    ' Adjust path for your system
    ThisDrawing.Export exportFile, "DXF", sset

    ' Open a new drawing
    Dim Acad As AcadApplication
    Dim newdoc As AcadDocument
    Set Acad = ThisDrawing.Application
    Set newdoc = Acad.Documents.Add("acad.dwt")

    ' Define the import
    Dim importFile As String
    Dim InsertPoint(0 To 2) As Double
    Dim scalefactor As Double
    importFile = "C:\AutoCAD\DXFExport.dxf"  ' Adjust path for your system
    InsertPoint(0) = 0#: InsertPoint(1) = 0#: InsertPoint(2) = 0#
    scalefactor = 2#

    ' Import the file
    ThisDrawing.Import importFile, InsertPoint, scalefactor
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Import()
    ;; This example will create a new drawing. Be sure to save
    ;; your work and start a new drawing before running this example.
    ;; This example creates a circle. It then exports the drawing
    ;; to a file called DXFExport.DXF. It then opens a new drawing
    ;; and imports the file.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the circle for visual representation
    (setq centerPt (vlax-3d-point 2 2 0))
    (setq radius 1)
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace centerPt radius))
    (vla-ZoomAll acadObj)

    ;; Create an empty selection set
    (setq sset (vla-Add (vla-get-SelectionSets doc) "TEST"))

    ;; Export the current drawing to the file specified above.
    (setq exportFile "C:\\AutoCAD\\DXFExport")    ;; Adjust path for your system
    (vla-Export doc exportFile "DXF" sset)

    ;; Define the import
    (setq insertPoint (vlax-3d-point 0 0 0))
    (setq importFile "C:\\AutoCAD\\DXFExport.dxf"  ;; Adjust path for your system
          scalefactor 2)

    ;; Import the file
    (vla-Import doc importFile insertPoint scalefactor)
    (vla-ZoomAll acadObj)

    (vla-Delete sset)
)


ImportProfile Method (ActiveX)

Imports a profile created by another user.

Supported platforms: Windows only

Signature

VBA:

object.ImportProfile Profile, RegFile, IncludePathInfo
object

Type: PreferencesProfiles

The object this method applies to.

Profile

Access: Input-only

Type: String

The name of the profile to import.

RegFile

Access: Input-only

Type: String

The registry file that the profile should be imported from. The file should have an .arg extension.

IncludePathInfo

Access: Input-only

Type: Boolean

  • True: The path information in the registry file will be preserved.
  • False: The path information in the registry file will not be preserved.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ImportProfile()
    ' This example imports a profile.
    ' NOTE: A dummy profile name is used so that your existing
    ' profiles are not changed.

    Dim preferences As AcadPreferences
    Dim strProfileToImport As String

    Set preferences = ThisDrawing.Application.preferences

    ' Specify the profile to delete.
    strProfileToImport = "TestProfile"

    ' Delete the profile
    ' The call will fail if "TestProfile" does not exist
    On Error GoTo Error
    preferences.Profiles.ImportProfile strProfileToImport, "TESTPROFILE.ARG", True

    Exit Sub

Error:
    MsgBox "ImportProfile of " & strProfileToImport & " failed. " & Err.Description, , "ImportProfile Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ImportProfile()
    ;; This example imports a profile.
    ;; NOTE: A dummy profile name is used so that your existing
    ;; profiles are not changed.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Specify the profile to import.
    (setq strProfileToImport "TestProfile")
    (vla-ImportProfile (vla-get-Profiles preferences) strProfileToImport (findfile "TESTPROFILE.ARG") :vlax-true)
)


IndexOf Method (ActiveX)

Provides the index of an entry in the File Dependency List.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.IndexOf(Feature, FullFileName)
object

Type: FileDependencies

The object this method applies to.

Feature

Access: Input-only

Type: String

The feature name of the entry.

FullFileName

Access: Input-only

Type: String

The full path of the entry.

Return Value (RetVal)

Type: Long

Index of the entry.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_IndexOf()
    'This example adds an entry to the File Dependency List, returns its Index, updates
    'the entry, and then removes the entry.

    ThisDrawing.Application.Documents.Open ("c:\program files\autocad\sample\city map.dwg")
    ThisDrawing.Application.ZoomAll

    Dim objFDLCol As AutoCAD.AcadFileDependencies
    Dim objFDL As AutoCAD.AcadFileDependency

    Set objFDLCol = ThisDrawing.FileDependencies
    MsgBox ("The number of entries in the File Dependency List is " & objFDLCol.Count & ".")

    Dim FDLIndex As Long
    FDLIndex = objFDLCol.CreateEntry("acad:xref", "c:\referenced.dwg", True, True)
    MsgBox ("The number of entries in the File Dependency List is " & objFDLCol.Count & ".")

    Dim IndexNumber As Long
    IndexNumber = objFDLCol.IndexOf("acad:xref", "c:\referenced.dwg")
    Dim IndexString As String
    IndexString = CStr(IndexNumber)
    MsgBox ("The index of the new entry is " & IndexString & ".")

    objFDLCol.UpdateEntry (FDLIndex)

    objFDLCol.RemoveEntry FDLIndex, True
    MsgBox ("The number of entries in the File Dependency List is " & objFDLCol.Count & ".")
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_IndexOf()
    ;; This example adds an entry to the File Dependency List, returns its Index, updates
    ;; the entry, and then removes the entry.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq objFDLCol (vla-get-FileDependencies doc))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))

    (setq FDLIndex (vla-CreateEntry objFDLCol "acad:xref"
                                   (findfile ".\\Sample\\Sheet Sets\\Architectural\\Res\\Exterior Elevations.dwg") :vlax-true :vlax-true))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))

    (setq IndexNumber (vla-IndexOf objFDLCol "acad:xref" (findfile ".\\Sample\\Sheet Sets\\Architectural\\Res\\Exterior Elevations.dwg")))
    (alert (strcat "The index of the new entry is " (itoa IndexNumber) "."))

    (vla-UpdateEntry objFDLCol FDLIndex)

    (vla-RemoveEntry objFDLCol FDLIndex :vlax-true)
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))
)


InitializeUserInput Method (ActiveX)

Initializes the GetKeyword method.

Supported platforms: Windows only

Signature

VBA:

object.InitializeUserInput Bits [, Keyword]
object

Type: Utility

The object this method applies to.

Bits

Access: Input-only

Type: Integer

To set more than one condition at a time, add the values together in any combination. If this value is not included or is set to 0, none of the control conditions apply.

  • 1: Disallows NULL input. This prevents the user from responding to the request by entering only [Return] or a space.
  • 2: Disallows input of zero (0). This prevents the user from responding to the request by entering 0.
  • 4: Disallows negative values. This prevents the user from responding to the request by entering a negative value.
  • 8: Does not check drawing limits, even if the LIMCHECK system variable is on. This enables the user to enter a point outside the current drawing limits. This condition applies to the next user-input function even if the AutoCAD LIMCHECK system variable is currently set.
  • 16: Not currently used.
  • 32: Uses dashed lines when drawing rubber-band lines or boxes. This causes the rubber-band line or box that AutoCAD displays to be dashed instead of solid, for those methods that let the user specify a point by selecting a location on the graphics screen. (Some display drivers use a distinctive color instead of dashed lines.) If the AutoCAD POPUPS system variable is 0, AutoCAD ignores this bit.
  • 64: Ignores Z coordinate of 3D points (GetDistance method only). This option ignores the Z coordinate of 3D points returned by the GetDistance method, so an application can ensure this function returns a 2D distance.
  • 128: Allows arbitrary input—whatever the user types.
Keyword

Access: Input-only; optional

Type: Variant (array of strings)

The keywords that the following user-input method will recognize.

Return Value (RetVal)

No return value.

Remarks

Keywords must be defined with this method before the call to GetKeyword. Certain user-input methods can accept keyword values in addition to the values they normally return, provided that this method has been called to define the keyword. The user-input methods that can accept keywords are: GetKeyword, GetInteger, GetReal, GetDistance, GetAngle, GetOrientation, GetPoint, and GetCorner.

Examples

VBA:

Sub Example_InitializeUserInput()
    ' This example prompts for user input of a point. By using the
    ' InitializeUserInput method to define a keyword list, the example can also
    ' return keywords entered by the user.

    AppActivate ThisDrawing.Application.Caption

    On Error Resume Next

    ' Define the valid keywords
    Dim keywordList As String
    keywordList = "Line Circle"

    ' Call InitializeUserInput to set up the keywords
    ThisDrawing.Utility.InitializeUserInput 128, keywordList

    ' Get the user input
    Dim returnPnt As Variant
    returnPnt = ThisDrawing.Utility.GetPoint(, vbLf & "Enter a point [Line/Circle]: ")
    If Err Then
         If StrComp(Err.Description, "User input is a keyword", 1) = 0 Then
         ' One of the keywords was entered
             Dim inputString As String
             Err.Clear
             inputString = ThisDrawing.Utility.GetInput
             MsgBox "You entered the keyword: " & inputString
         Else
             MsgBox "Error selecting the point: " & Err.Description
             Err.Clear
         End If
    Else
        ' Display point coordinates
        MsgBox "The WCS of the point is: " & returnPnt(0) & ", " & returnPnt(1) & ", " & returnPnt(2), , "GetInput Example"
    End If

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_InitializeUserInput()
    ;; This example prompts for user input of a point. By using the
    ;; InitializeUserInput method to define a keyword list, it can also
    ;; return keywords entered by the user.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the valid keywords
    (setq keywordList "Line Circle")

    ;; Call InitializeUserInput to set up the keywords
    (vla-InitializeUserInput (vla-get-Utility doc) 128 keywordList)

    ;; Get the user input
    (setq returnPntOrErr (vl-catch-all-apply 'vla-GetPoint (list (vla-get-Utility doc) nil "Enter a point [Line/Circle]: ")))

    (if (= (type returnPntOrErr)'VL-CATCH-ALL-APPLY-ERROR)
        (progn
            (if (= (vl-catch-all-error-message returnPntOrErr) "Automation Error. User input is a keyword")
            (progn
                    (setq inputString (vla-GetInput (vla-get-Utility doc)))
                    (alert (strcat "You entered the keyword: " inputString))
        )
                (alert "User pressed ESC or unknown input was provided.")
        )
        )
        ;; Display point coordinates
        (progn
        (setq returnPnt (vlax-safearray->list (vlax-variant-value returnPntOrErr)))
            (alert (strcat "The WCS of the point is: " (rtos (nth 0 returnPnt) 2) ", " (rtos (nth 1 returnPnt) 2) ", " (rtos (nth 2 returnPnt) 2)))
    )
    )
)


InsertBlock Method (ActiveX)

Inserts a drawing file or a named block that has been defined in the current drawing.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.InsertBlock(InsertionPoint, Name [, Xscale [, Yscale [, ZScale [, Rotation [, Password]]]]])
object

Type: Block, ModelSpace, PaperSpace

The objects this method applies to.

InsertionPoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the location in the drawing to insert the block.

Name

Access: Input-only

Type: String

The name of the AutoCAD drawing file or the name of the block to insert. If it is a file name, include the .dwg extension and any path information necessary for AutoCAD to find the file.

Xscale

Access: Input-only; optional

Type: Double

The default equals 1.0. Must be a positive number.

Yscale

Access: Input-only; optional

Type: Double

The default equals 1.0. Must be a positive number.

Zscale

Access: Input-only; optional

Type: Double

The default equals 1.0. Must be a positive number.

Rotation

Access: Input-only; optional

Type: Double

The default equals 0.0 radians.

Password

Access: Input-only; optional

Type: Variant

The password that was applied to the drawing file when it was saved.

Return Value (RetVal)

Type: BlockReference

The placed block as a Block Reference object.

Remarks

Inserting a block into another block will create nested blocks.

Attempting to call the InsertBlock method with an uninitialized Name parameter results in unexpected behavior.

Examples

VBA:

Sub Example_InsertBlock()
    ' This example creates a block containing a circle.
    ' It then inserts the block.

    ' Create the block
    Dim blockObj As AcadBlock
    Dim insertionPnt(0 To 2) As Double
    insertionPnt(0) = 0#: insertionPnt(1) = 0#: insertionPnt(2) = 0#
    Set blockObj = ThisDrawing.Blocks.Add(insertionPnt, "CircleBlock")

    ' Add a circle to the block
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 0: center(1) = 0: center(2) = 0
    radius = 1
    Set circleObj = blockObj.AddCircle(center, radius)

    ' Insert the block
    Dim blockRefObj As AcadBlockReference
    insertionPnt(0) = 2#: insertionPnt(1) = 2#: insertionPnt(2) = 0
    Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, "CircleBlock", 1#, 1#, 1#, 0)

    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_InsertBlock()
    ;; This example creates a block containing a circle.
    ;; It then inserts the block.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the block
    (setq insertionPnt (vlax-3d-point 0 0 0))
    (setq blockObj (vla-Add (vla-get-Blocks doc) insertionPnt "CircleBlock"))

    ;; Add a circle to the block
    (setq center (vlax-3d-point 0 0 0)
          radius 1)
    (setq circleObj (vla-AddCircle blockObj center radius))

    ;; Insert the block
    (setq insertionPnt (vlax-3d-point 2 2 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq blockRefObj (vla-InsertBlock modelSpace insertionPnt "CircleBlock" 1 1 1 0))

    (vla-ZoomAll acadObj)
)


InsertColumns Method (ActiveX)

Inserts columns in a table.

Supported platforms: Windows only

Signature

VBA:

object.InsertColumns col, Width, cols
object

Type: Table

The object this method applies to.

col

Access: Input-only

Type: Long

The zero-based column index.

Width

Access: Input-only

Type: Double

The width of the column.

cols

Access: Input-only

Type: Long

The number of columns to insert.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


InsertColumnsAndInherit Method (ActiveX)

Insert columns into a table from another table.

Supported platforms: Windows only

Signature

VBA:

object.InsertColumnsAndInherit col, nInheritFrom, nNumCols
object

Type: Table

The object this method applies to.

col

Access: Input-only

Type: Long

The col index to insert to.

nInheritFrom

Access: Input-only

Type: Long

The table index to grab from.

nNumCols

Access: Input-only

Type: Long

The number of columns to grab.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


InsertInMenuBar Method (ActiveX)

Inserts the popup menu into the AutoCAD menu bar at a specified location.

Supported platforms: Windows only

Signature

VBA:

object.InsertInMenuBar Index
object

Type: PopupMenu

The object this method applies to.

Index

Access: Input-only

Type: Variant

The index location in the menu bar where the popup menu is to be added.

The index must be either an integer or a string. If an integer, the index must be between 0 and N-1, where N is the number of objects in the menu bar. The new item will be added immediately before the specified index location.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_InsertInMenuBar()
    ' This example creates a new menu called TestMenu and inserts a menu item
    ' into it. The menu is then displayed on the menu bar.
    ' To remove the menu after execution of this macro, use the Customize Menu
    ' option from the Tools menu.

    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    ' Create the new menu
    Dim newMenu As AcadPopupMenu
    Set newMenu = currMenuGroup.Menus.Add("TestMenu")

    ' Add a menu item to the new menu
    Dim newMenuItem As AcadPopupMenuItem
    Dim openMacro As String
    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set newMenuItem = newMenu.AddMenuItem(newMenu.count + 1, "Open", openMacro)

    ' Display the menu on the menu bar
    newMenu.InsertInMenuBar ThisDrawing.Application.MenuBar.count + 1

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_InsertInMenuBar()
    ;; This example creates a new menu called TestMenu and inserts a menu item
    ;; into it. The menu is then displayed on the menu bar.
    ;; To remove the menu after execution of this macro, use the Customize Menu
    ;; option from the Tools menu.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new menu
    (setq newMenu (vla-Add (vla-get-Menus currMenuGroup) "TestMenu"))

    ;; Add a menu item to the new menu
    ;; Assign the macro string the VB equivalent of "ESC ESC _open "
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))
    (setq newMenuItem (vla-AddMenuItem newMenu (1+ (vla-get-Count newMenu)) "Open" openMacro))

    ;; Display the menu on the menu bar
    (vla-InsertInMenuBar newMenu (1+ (vla-get-Count (vla-get-MenuBar acadObj))))

    ;; Display the menu bar
    (vla-SetVariable doc "MENUBAR" 1)
)


InsertLoopAt Method (ActiveX)

Inserts a loop at a given index of a hatch.

Supported platforms: Windows only

Signature

VBA:

object.InsertLoopAt Index, LoopType, Loop
object

Type: Hatch

The object this method applies to.

Index

Access: Input-only

Type: Long

The index location in the array of vertices that make up the hatch boundary. The index must be a positive integer beginning with 0.

LoopType

Access: Input-only

Type: AcLoopType enum

  • acHatchLoopTypeDefault
  • acHatchLoopTypeExternal
  • acHatchLoopTypePolyline
  • acHatchLoopTypeDerived
  • acHatchLoopTypeTextbox
Loop

Access: Input-only

Type: Variant (object or array of objects)

An object or array of objects forming a closed boundary. If an array of objects is used, their endpoints must coincide for the loop to be created properly. The loop, or the array defining the loop, can consist of the following types of objects: Arc, Circle, Ellipse, Line, Polyline, Region, Spline

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_InsertLoopAt()
    ' This example creates an associative hatch in model space.
    ' A Loop is then inserted into the hatch.
    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "ANSI31"
    PatternType = 0
    bAssociativity = True

    ' Create the associative Hatch object
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)

    ' Create the outer loop for the hatch.
    ' An arc and a line are used to create a closed loop.
    Dim outerLoop(0 To 1) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    center(0) = 5: center(1) = 3: center(2) = 0
    radius = 3
    startAngle = 0
    endAngle = 3.141592
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddArc(center, radius, startAngle, endAngle)
    Set outerLoop(1) = ThisDrawing.ModelSpace.AddLine(outerLoop(0).startPoint, outerLoop(0).endPoint)

    ' Append the outer loop to the hatch object
    hatchObj.AppendOuterLoop (outerLoop)

    ' Append the first circle as one inner loop
    Dim innerLoop1(0) As AcadEntity
    center(0) = 5: center(1) = 4.5: center(2) = 0
    radius = 1
    Set innerLoop1(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop1)

    ' Evaluate and display the hatch
    hatchObj.Evaluate
    ThisDrawing.Regen True

    MsgBox "Insert another loop.", , "InsertLoopAt Example"

    ' Insert the second circle as the other inner loop
    Dim LoopObj(0) As AcadEntity
    radius = 0.5
    Set LoopObj(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.InsertLoopAt hatchObj.NumberOfLoops, acHatchLoopTypeDefault, LoopObj

    ' Evaluate and display the hatch
    hatchObj.Evaluate
    ThisDrawing.Regen True

    MsgBox "Loop inserted.", , "InsertLoopAt Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_InsertLoopAt()
    ;; This example creates an associative hatch in model space.
    ;; A Loop is then inserted into the hatch.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "ANSI31"
          patternType 0
          bAssociativity :vlax-true)

    ;; Create the associative Hatch object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acHatchObject))

    ;; Create the outer loop for the hatch.
    ;; An arc and a line are used to create a closed loop.
    (setq center (vlax-3d-point 5 3 0)
          radius 3
          startAngle 0
          endAngle 3.141592)

    (setq arc (vla-AddArc modelSpace center radius startAngle endAngle))
    (setq line (vla-AddLine modelSpace (vla-get-StartPoint arc) (vla-get-EndPoint arc)))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element outerLoop 0 arc)
    (vlax-safearray-put-element outerLoop 1 line)

    ;; Append the outer loop to the hatch object
    (vla-AppendOuterLoop hatchObj outerLoop)

    ;; Append the first circle as one inner loop
    (setq center (vlax-3d-point 5 4.5 0)
          radius 1)
    (setq circle1 (vla-AddCircle modelSpace center radius))

    (setq innerLoop1 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element innerLoop1 0 circle1)

    (vla-AppendInnerLoop hatchObj innerLoop1)

    ;; Evaluate and display the hatch
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)

    (alert "Insert another loop.")

    ;; Insert the second circle as the other inner loop
    (setq radius 0.5)
    (setq LoopObj (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (setq circle2 (vla-AddCircle modelSpace center radius))
    (vlax-safearray-put-element LoopObj 0 circle2)

    (vla-InsertLoopAt hatchObj (vla-get-NumberOfLoops hatchObj) acHatchLoopTypeDefault LoopObj)

    ;; Evaluate and display the hatch
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)

    (alert "Loop inserted.")
)


InsertMenuInMenuBar Method (ActiveX)

Inserts a menu into the AutoCAD menu bar.

Supported platforms: Windows only

Signature

VBA:

object.InsertMenuInMenuBar MenuName, Index
object

Type: PopupMenus

The object this method applies to.

MenuName

Access: Input-only

Type: String

The name of the popup menu to insert into the menu bar.

Index

Access: Input-only

Type: Variant

The index in the menu bar to place the popup menu. The index must be either an integer or a string.

If an integer, the index must be between 0 and N-1, where N is the number of popup menus in the menu bar.

If a string, the name of the popup menu must contain any underscore that appears in the menu.

Return Value (RetVal)

No return value.

Remarks

The menu is inserted immediately before the index position specified.

Examples

VBA:

Sub Example_InsertMenuInMenuBar()
    ' This example creates a new menu called TestMenu and inserts a menu item
    ' into it. The menu is then displayed on the menu bar.

    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    ' Create the new menu
    Dim newMenu As AcadPopupMenu
    Set newMenu = currMenuGroup.Menus.Add("TestMenu")

    ' Add a menu item to the new menu
    Dim newMenuItem As AcadPopupMenuItem
    Dim openMacro As String
    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set newMenuItem = newMenu.AddMenuItem(newMenu.count + 1, "Open", openMacro)

    ' Display the menu on the menu bar
    currMenuGroup.Menus.InsertMenuInMenuBar "TestMenu", ""

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_InsertMenuInMenuBar()
    ;; This example creates a new menu called TestMenu and inserts a menu item
    ;; into it. The menu is then displayed on the menu bar.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new menu
    (setq newMenu (vla-Add (vla-get-Menus currMenuGroup) "TestMenu"))

    ;; Add a menu item to the new menu
    ;; Assign the macro string the VB equivalent of "ESC ESC _open "
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))
    (setq newMenuItem (vla-AddMenuItem newMenu (1+ (vla-get-Count newMenu)) "Open" openMacro))

    ;; Display the menu on the menu bar
    (vla-InsertMenuInMenuBar (vla-get-Menus currMenuGroup) "TestMenu" "")

    ;; Display the menu bar
    (vla-SetVariable doc "MENUBAR" 1)
)


InsertRows Method (ActiveX)

Inserts rows in a table.

Supported platforms: Windows only

Signature

VBA:

object.InsertRows row, Height, Rows
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index.

Height

Access: Input-only

Type: Double

The height of the rows.

Rows

Access: Input-only

Type: Long

The number of rows to insert.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


InsertRowsAndInherit Method (ActiveX)

Insert rows into a table from another table.

Supported platforms: Windows only

Signature

VBA:

object.InsertRowsAndInherit nIndex, nInheritFrom, nNumRows
object

Type: Table

The object this method applies to.

nIndex

Access: Input-only

Type: Long

The row index to insert to.

nInheritFrom

Access: Input-only

Type: Long

The table index to grab from.

nNumRows

Access: Input-only

Type: Long

The number of rows to grab.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectWith Method (ActiveX)

Gets the points where one object intersects another object in the drawing.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.IntersectWith(IntersectObject, ExtendOption)
object

Type: All drawing objects (except PViewport and PolygonMesh), AttributeReference

The objects this method applies to.

IntersectObject

Access: Input-only

Type: Object

The object can be one of the supported drawing objects or an AttributeReference.

ExtendOption

Access: Input-only

Type: AcExtendOption enum

This option specifies if none, one or both, of the objects are to be extended in order to attempt an intersection.

  • acExtendNone: Does not extend either object.
  • acExtendThisEntity: Extends the base object.
  • acExtendOtherEntity: Extends the object passed as an argument.
  • acExtendBoth: Extends both objects.

Return Value (RetVal)

Type: Variant (array of doubles)

The array of points where one object intersects another object in the drawing.

Remarks

If the two objects do not intersect, no data is returned. You can request the point of intersection that would occur if one or both of the objects were extended to meet the other. For example, in the following illustration, Line1 is the base object from which this method was called and line3 is the object passed as a parameter. If the ExtendOption passed is acExtendThisEntity, point A is returned as the point where line1 would intersect line3 if line1 were extended. If the ExtendOption is acExtendOtherEntity, no data is returned because even if line3 were extended, it would not intersect line1.

If the intersection type is acExtendBothEntities and line2 is passed as the parameter entity, point B is returned. If the ExtendOption is acExtendNone and line2 is the parameter entity, no data is returned.

Examples

VBA:

Sub Example_IntersectWith()
    ' This example creates a line and circle and finds the points at
    ' which they intersect.

    ' Create the line
    Dim lineObj As AcadLine
    Dim startPt(0 To 2) As Double
    Dim endPt(0 To 2) As Double
    startPt(0) = 1: startPt(1) = 1: startPt(2) = 0
    endPt(0) = 5: endPt(1) = 5: endPt(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPt, endPt)

    ' Create the circle
    Dim circleObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 3: centerPt(1) = 3: centerPt(2) = 0
    radius = 1
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)
    ZoomAll

    ' Find the intersection points between the line and the circle
    Dim intPoints As Variant
    intPoints = lineObj.IntersectWith(circleObj, acExtendNone)

    ' Print all the intersection points
    Dim I As Integer, j As Integer, k As Integer
    Dim str As String
    If VarType(intPoints) <> vbEmpty Then
        For I = LBound(intPoints) To UBound(intPoints)
            str = "Intersection Point[" & k & "] is: " & intPoints(j) & "," & intPoints(j + 1) & "," & intPoints(j + 2)
            MsgBox str, , "IntersectWith Example"
            str = ""
            I = I + 2
            j = j + 3
            k = k + 1
        Next
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_IntersectWith()
    ;; This example creates a line and circle and finds the points at
    ;; which they intersect.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the line
    (setq startPt (vlax-3d-point 1 1 0)
          endPt (vlax-3d-point 5 5 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPt endPt))

    ;; Create the circle
    (setq centerPt (vlax-3d-point 1 1 0)
          radius 1)
    (setq circleObj (vla-AddCircle modelSpace centerPt radius))
    (vla-ZoomAll acadObj)

    ;; Find the intersection points between the line and the circle
    (setq intPoints (vla-IntersectWith lineObj circleObj acExtendNone))

    ;; Print all the intersection points
    (setq I 0
          j 0
          k 0)
    (if (/= (type intPoints) vlax-vbEmpty)
        (while (>= (vlax-safearray-get-u-bound (vlax-variant-value intPoints) 1) I)
            (setq tempPoint (vlax-safearray->list (vlax-variant-value intPoints)))
            (setq str (strcat "Intersection Point[" (itoa k) "] is: " (rtos (nth j tempPoint) 2) ","
                                                                      (rtos (nth (1+ j) tempPoint) 2) ","
                                                                      (rtos (nth (+ j 2) tempPoint) 2)))
            (alert str)
            (setq str ""
                  I (+ I 2)
                  j (+ j 3)
                  k (1+ k))
        )
    )
)


IsContentEditable Method (ActiveX)

Check if a cell has editable content.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.IsContentEditable(nRow, nCol)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The value of the row.

nCol

Access: Input-only

Type: Long

The value of the column.

Return Value (RetVal)

Type: Boolean

  • True: Content is editable.
  • False: Content is not editable.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IsEmpty Method (ActiveX)

Determines if a cell is empty based on its row and column position.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.IsEmpty(nRow, nCol)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to check.

nCol

Access: Input-only

Type: Long

The column number of the cell to check.

Return Value (RetVal)

Type: Boolean

  • True: Table cell is empty.
  • False: Table cell is not empty.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IsFormatEditable Method (ActiveX)

Check if a cell has editable format.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.IsFormatEditable(nRow, nCol)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The value of the row.

nCol

Access: Input-only

Type: Long

The value of the column.

Return Value (RetVal)

Type: Boolean

  • True: Format of the table cell can be modified.
  • False: Format of the table cell cannot be modified.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IsMergeAllEnabled Method (ActiveX)

Checks if cell merging is on.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.IsMergeAllEnabled(nRow, nCol)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The value of the row.

nCol

Access: Input-only

Type: Long

The value of the column.

Return Value (RetVal)

Type: Boolean

  • True: Cells can be merged.
  • False: Cell cannot be merged.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IsMergedCell Method (ActiveX)

Returns the merge status of a cell.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.IsMergedCell(row, col, minRow, maxRow, minCol, maxCol)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row number.

col

Access: Input-only

Type: Long

The column number.

minRow

Access: Input-only

Type: Long

Zero-based lower bound of a row index.

maxRow

Access: Input-only

Type: Long

Zero-based upper bound of a row index.

minCol

Access: Input-only

Type: Long

Zero-based lower bound of a column index.

maxCol

Access: Input-only

Type: Long

Zero-based upper bound of a column index.

Return Value (RetVal)

Type: Boolean

  • True: Cell is merged with one or more cells.
  • False: Cell is not merged with one or more cells.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IsRemoteFile Method (ActiveX)

Returns the URL from which a remote file was downloaded.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.IsRemoteFile(LocalFile, URL)
object

Type: Utility

The object this method applies to.

LocalFile

Access: Input-only

Type: String

The downloaded file.

URL

Access: Output-only

Type: String

The URL from which the file was downloaded, if any.

Return Value (RetVal)

Type: Boolean

  • True: The file was downloaded from a remote location.
  • False: The file was not downloaded from a remote location.

Remarks

This method is the inverse of the IsURL method and provides a mapping from a local file to the corresponding URL from which the file was downloaded.

Examples

VBA:

Sub Example_IsRemoteFile()
    ' This example will prompt the user for a URL to download and will verify that
    ' a proper URL was entered.  After downloading, the example will attempt to load
    ' the downloaded URL as a drawing.
    '
    ' * Note: Remember to delete the downloaded file from your disk drive when finished.

    Dim Utility As AcadUtility
    Dim URL As String, DestFile As String, FileURL As String

    Set Utility = ThisDrawing.Utility   ' Connect to Utility object

GETURL:
    ' Prompt user for a URL to download.  This should be a URL to an AutoCAD drawing file.
    URL = Utility.GetString(False, vbLf & "Enter the complete URL of the file you wish to download: ")

    URL = Trim(URL)                     ' Get rid of blank spaces

    If URL = "" Then Exit Sub           ' Did user cancel

    ' Determine if user entered a valid URL; if not, prompt again
    If Not (Utility.IsURL(URL)) Then
        MsgBox "The URL you entered is not valid.  Make sure the syntax is a valid URL."
        GoTo GETURL
    End If

    ' Download URL
    Utility.GetRemoteFile URL, DestFile, True

    ' Display downloaded file information
    MsgBox URL & " was downloaded to: " & DestFile

    ' Use IsRemoteFile to determine if this file was downloaded from a URL.
    ' If it was, display the URL it was downloaded from
    '
    ' * Note: Although the results that IsRemoteFile will return are already known
    ' since the file was just downloaded it is important to know how this
    ' method can be used.
    If Utility.IsRemoteFile(DestFile, FileURL) Then
        MsgBox "The file: " & DestFile & " is a downloaded file and was downloaded from: " & FileURL
    Else
        MsgBox "The file: " & DestFile & " is not a downloaded file."
    End If

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_IsRemoteFile()
    ;; This example will prompt the user for a URL to download and will verify that
    ;; a proper URL was entered.  After downloading, the example will provide information
    ;; about the downloaded drawing.
    ;;
    ;; * Note: Remember to delete the downloaded file from your disk drive when finished.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq Utility (vla-get-Utility doc))   ;; Connect to Utility object

    ;; Prompt user for a URL to download.  This should be a URL to an AutoCAD drawing file.
    (setq URL (vla-GetString Utility :vlax-false "Enter the complete URL of the file you wish to download: "))

    (if (/= URL "")
        (progn
               (if (= (vla-IsURL Utility URL) :vlax-false)
                   (alert "The URL you entered is not valid.  Make sure the syntax is a valid URL.")
                   (progn
                       ;; Download URL
                       (vla-GetRemoteFile Utility URL 'DestFile :vlax-true)

                       ;; Display downloaded file information
                       (alert (strcat URL " was downloaded to: " DestFile "\n"))

                       ;; Use IsRemoteFile to determine if this file was downloaded from a URL.
                       ;; If it was, display the URL it was downloaded from
                       ;;
                       ;; * Note: Although the results that IsRemoteFile will return are already known
                       ;; since the file was just downloaded it is important to know how this
                       ;; method can be used.
                       (if (= (vla-IsRemoteFile Utility DestFile URL) :vlax-true)
                           (alert (strcat "The file: " DestFile " is a downloaded file and was downloaded from: " URL))
                           (alert (strcat "The file: " DestFile " is not a downloaded file."))
                       )
                   )
               )
           )
    )
)


IsURL Method (ActiveX)

Validates a given URL.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.IsURL(URL)
object

Type: Utility

The object this method applies to.

LocalFile

Access: Input-only

Type: String

The URL to validate.

Return Value (RetVal)

Type: Boolean

  • True: The string represents a valid URL.
  • False: The string is not a valid URL.

Remarks

The definition of a "valid" URL is application-dependent, in that a given third-party application may not be interested in supporting all Internet protocols. For instance, an application that attempts to connect users to websites would probably not need to provide access to FTP sites. In this hypothetical application, a False value would be returned if a URL that begins with something other than "http://" was entered.

The default functionality of this method for AutoCAD supports FTP, HTTP, HTTPS, and FILE protocols.

Examples

VBA:

Sub Example_IsRemoteFile()
    ' This example will prompt the user for a URL to download and will verify that
    ' a proper URL was entered.  After downloading, the example will attempt to load
    ' the downloaded URL as a drawing.
    '
    ' * Note: Remember to delete the downloaded file from your disk drive when finished.

    Dim Utility As AcadUtility
    Dim URL As String, DestFile As String, FileURL As String

    Set Utility = ThisDrawing.Utility   ' Connect to Utility object

GETURL:
    ' Prompt user for a URL to download.  This should be a URL to an AutoCAD drawing file.
    URL = Utility.GetString(False, vbLf & "Enter the complete URL of the file you wish to download: ")

    URL = Trim(URL)                     ' Get rid of blank spaces

    If URL = "" Then Exit Sub           ' Did user cancel

    ' Determine if user entered a valid URL; if not, prompt again
    If Not (Utility.IsURL(URL)) Then
        MsgBox "The URL you entered is not valid.  Make sure the syntax is a valid URL."
        GoTo GETURL
    End If

    ' Download URL
    Utility.GetRemoteFile URL, DestFile, True

    ' Display downloaded file information
    MsgBox URL & " was downloaded to: " & DestFile

    ' Use IsRemoteFile to determine if this file was downloaded from a URL.
    ' If it was, display the URL it was downloaded from
    '
    ' * Note: Although the results that IsRemoteFile will return are already known
    ' since the file was just downloaded it is important to know how this
    ' method can be used.
    If Utility.IsRemoteFile(DestFile, FileURL) Then
        MsgBox "The file: " & DestFile & " is a downloaded file and was downloaded from: " & FileURL
    Else
        MsgBox "The file: " & DestFile & " is not a downloaded file."
    End If

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_IsRemoteFile()
    ;; This example will prompt the user for a URL to download and will verify that
    ;; a proper URL was entered.  After downloading, the example will provide information
    ;; about the downloaded drawing.
    ;;
    ;; * Note: Remember to delete the downloaded file from your disk drive when finished.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq Utility (vla-get-Utility doc))   ;; Connect to Utility object

    ;; Prompt user for a URL to download.  This should be a URL to an AutoCAD drawing file.
    (setq URL (vla-GetString Utility :vlax-false "Enter the complete URL of the file you wish to download: "))

    (if (/= URL "")
        (progn
               (if (= (vla-IsURL Utility URL) :vlax-false)
                   (alert "The URL you entered is not valid.  Make sure the syntax is a valid URL.")
                   (progn
                       ;; Download URL
                       (vla-GetRemoteFile Utility URL 'DestFile :vlax-true)

                       ;; Display downloaded file information
                       (alert (strcat URL " was downloaded to: " DestFile "\n"))

                       ;; Use IsRemoteFile to determine if this file was downloaded from a URL.
                       ;; If it was, display the URL it was downloaded from
                       ;;
                       ;; * Note: Although the results that IsRemoteFile will return are already known
                       ;; since the file was just downloaded it is important to know how this
                       ;; method can be used.
                       (if (= (vla-IsRemoteFile Utility DestFile URL) :vlax-true)
                           (alert (strcat "The file: " DestFile " is a downloaded file and was downloaded from: " URL))
                           (alert (strcat "The file: " DestFile " is not a downloaded file."))
                       )
                   )
               )
           )
    )
)


Item Method (ActiveX)

Gets the member object at a given index in a collection, group, or selection set.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.Item(Index)
object

Type: All collections, Group, SelectionSet

The objects this method applies to.

Index

Access: Input-only

Type: Variant

The index location in the collection for the member item to query.

The index must be either an integer or a string. If an integer, the index must be between 0 and N-1, where N is the number of objects in the collection or selection set.

Return Value (RetVal)

Type: Object

The object at the given index location in the collection or selection set.

Remarks

This method supports string-based iteration. For example, if a block named BLOCK1 was created with the following statement:

Set block1 = Blocks.Add("BLOCK1")

you could reference the object through the following statement:

Set whichblock = Blocks.Item("BLOCK1")
NoteThe Item method is case-sensitive when used with the SelectionSets collection; it is not case-sensitive for other collections.

Dictionaries: The return value type for this method is IAcadObject. This allows you to retrieve named objects from the dictionaries collection that are not of the type Dictionary.

Examples

VBA:

Sub Example_Item()
    ' This example shows two uses of the Item method.
    ' The first uses Item with an index counter to return an item in a collection.
    ' The second uses Item with a string to return an item in a collection.

    ' Iterate thru the model space collection,
    ' get all the items in the collection
    ' and store them in an array called newObjs
    Dim count As Integer
    count = ThisDrawing.ModelSpace.count

    ReDim newObjs(count) As AcadEntity
    Dim index As Integer
    For index = 0 To count - 1
        Set newObjs(index) = ThisDrawing.ModelSpace.Item(index)
    Next

    ' Get a particular item, in this case a layer, based on name "0"
    Dim layerObj As AcadLayer
    Set layerObj = ThisDrawing.Layers.Item("0")

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Item()
    ;; This example shows two uses of the Item method.
    ;; The first uses Item with an index counter to return an item in a collection.
    ;; The second uses Item with a string to return an item in a collection.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Iterate thru the model space collection,
    ;; get all the items in the collection
    ;; and store them in an array called newObjs
    (setq count (vla-get-Count (vla-get-ModelSpace doc))
          index 0)

    (setq newObjs (vlax-make-safearray vlax-vbObject (cons 0 count)))

    (while (>= (1- count) index)
        (vlax-safearray-put-element newObjs index (vla-Item (vla-get-ModelSpace doc) index))
        (setq index (1+ index))
    )

    ;; Get a particular item, in this case a layer, based on name "0"
    (setq layerObj (vla-Item (vla-get-Layers doc) "0"))
)


LaunchBrowserDialog Method (ActiveX)

Launches a dialog box in which a user can enter a URL.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.LaunchBrowserDialog(SelectedURL, DialogTitle, OpenButtonCaption, StartPageURL, RegistryRootKey, OpenButtonAlwaysEnabled)
object

Type: Utility

The object this method applies to.

SelectedURL

Access: Output-only

Type: String

The URL selected.

DialogTitle

Access: Input-only

Type: String

The title to be displayed in the dialog box.

OpenButtonCaption

Access: Input-only

Type: String

The caption for the OK/Open button.

StartPageURL

Access: Input-only

Type: String

An initial URL to be displayed.

ReigstryRootKey

Access: Input-only

Type: String

Product root key for storing persistent dialog box information. This key specifies where information about the size, position, and other preferences information of the dialog box can be stored across sessions. Input an empty string to disregard this functionality.

OpenButtonAlwaysEnabled

Access: Input-only

Type: Boolean

  • True: The Open button is enabled, allowing a file or link to be selected.
  • False: The Open button is disabled and is only enabled when the user selects a file for download.

Return Value (RetVal)

Type: Boolean

  • True: The dialog box was opened successfully.
  • False: The dialog box did not open successfully.

Remarks

The last parameter, OpenButtonAlwaysEnabled, determines whether the user can select HTML links in addition to files that can be downloaded.

Examples

VBA:

Sub Example_LaunchBrowserDialog()
    ' This example will prompt the user for a URL to download and will verify that
    ' a proper URL was entered.  After downloading, the example will attempt to load
    ' the downloaded URL as a drawing.
    '
    ' * Note: Remember to delete the downloaded file from your disk drive when finished.

    Dim Utility As AcadUtility
    Dim URL As String, DestFile As String, FileURL As String

    Set Utility = ThisDrawing.Utility   ' Connect to Utility object

GETURL:
    ' Prompt user for a URL to download.  This should be a URL to an AutoCAD drawing file.
    URL = InputBox("Enter the complete URL of the file you wish to download. " & _
                    "Enter BROWSER to select the URL from a web browser", _
                    "Enter URL To Download", URL)

    URL = Trim(URL)                     ' Get rid of blank spaces

    If URL = "" Then Exit Sub           ' Did user cancel

    ' Does the user want to select from a browser?
    If StrComp(URL, "BROWSER", vbTextCompare) = 0 Then
        Utility.LaunchBrowserDialog _
        URL, "AutoCAD Browser", "Open", "http://www.autodesk.com", "ACADBROWSER", True

        GoTo GETURL     ' Return to display chosen URL and allow modifications
    End If

    ' Determine if user entered a valid URL; if not, prompt again
    If Not (Utility.IsURL(URL)) Then
        MsgBox "The URL you entered is not valid.  Make sure the syntax is a valid URL."
        GoTo GETURL
    End If

    ' Download URL
    Utility.GetRemoteFile URL, DestFile, True

    ' Display downloaded file information
    MsgBox URL & " was downloaded to: " & DestFile & vbCrLf & vbCrLf & _
           "Press any key to attempt to load the new file as a drawing."

    ' Attempt to load file as drawing; if an error occurs, this was probably not a drawing
    ' file, but rather the text from a web page.
    ' Try loading the downloaded file into a text editor to view the contents.
    On Error Resume Next
    ThisDrawing.Application.Documents.Open DestFile
    If Err.Number <> 0 Then
        MsgBox "Error loading downloaded file as a drawing: " & Err.Description & vbCrLf & vbCrLf & _
               "This is probably not a valid drawing file!"
    End If
    On Error GoTo 0

    ' Use IsRemoteFile to determine if this file was downloaded from a URL.
    ' If it was, display the URL it was downloaded from
    '
    ' * Note: Although the results IsRemoteFile will return are already known because
    ' the file was just downloaded, it is important to know how this
    ' method can be used.
    If Utility.IsRemoteFile(DestFile, FileURL) Then
        MsgBox "The file: " & DestFile & " is a downloaded file and was downloaded from: " & FileURL
    Else
        MsgBox "The file: " & DestFile & " is not a downloaded file."
    End If

End Sub

Visual LISP:

Not available


ListARX Method (ActiveX)

Gets the currently loaded ObjectARX applications.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.ListArx
object

Type: Application

The object this method applies to.

Return Value (RetVal)

Type: Variant

An array of ObjectARX applications currently loaded. Returns empty if no applications are currently loaded.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ListARX()
    ' This example gets all the loaded ObjectARX applications

    ' Get the list of applications
    Dim appList As Variant
    appList = ThisDrawing.Application.ListArx

    ' Iterate through the list, and display the names, if any.
    If VarType(appList) <> vbEmpty Then
        Dim I As Integer
        For I = LBound(appList) To UBound(appList)
            MsgBox "ObjectARX application name: " & appList(I)
        Next
    Else
        MsgBox "No ObjectARX applications present."
    End If

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ListARX()
    ;; This example gets all the loaded ObjectARX applications
    (setq acadObj (vlax-get-acad-object))

    ;; Get the list of applications
    (setq appList (vla-ListArx acadObj))

    ;; Iterate through the list, and display the names, if any.
    (if (/= (vlax-variant-value appList) vlax-vbEmpty)
        (progn
            (setq I 0
                  appList (vlax-variant-value appList))
            (while (>= (vlax-safearray-get-u-bound appList 1) I)
                (alert (strcat "ObjectARX application name: " (vlax-safearray-get-element appList I)))
                (setq I (1+ I))
            )
        )
        (alert "No ObjectARX applications present.")
    )
)


Load Method (ActiveX)

Loads a menu group from a customization (CUIx) file or the definition of a linetype from a library (LIN) file.

Supported platforms: Windows only

Signature - Linetypes

VBA:

object.Load LineTypeName, FileName
object

Type: Linetypes

The object this method applies to.

LineTypeName

Access: Input-only

Type: String

The name of the linetype to load.

FileName

Access: Input-only

Type: String

The name of the file the linetype is in.

Signature - MenuGroups

VBA:

RetVal = object.Load(MenuFileName [,BaseMenu])
object

Type: MenuGroups

The object this method applies to.

MenuFileName

Access: Input-only

Type: String

The name of the customization (CUIx) file to load.

BaseMenu

Access: Input-only; optional

Type: Variant

If this parameter is set to True, then the menu group will be loaded as a base menu (similar to the AutoCAD MENU command). If this parameter is omitted, the menu group will be loaded as a partial menu (similar to the AutoCAD CUILOAD command).

Return Value (RetVal) - Linetypes

No return value.

Return Value (RetVal) - MenuGroups

Type: MenuGroup

The MenuGroup object that is created as a result of loading the customization (CUIx) file.

Remarks

Linetypes: Although you can create a linetype and add it to the Linetypes collection object using the Add method, it will be created with the default properties only. Because you cannot edit linetype properties with this release of ActiveX Automation, use this method to load existing linetypes into your drawing.

MenuGroups: AutoCAD searches for customization files with the specified MenuFileName and a .cuix extension.

Examples

VBA:

Sub Example_Load()
    ' This example attempts to load the linetype "CENTER" from
    ' the acad.lin file. If the linetype already exists, then
    ' a message is displayed.

    Dim linetypeName As String
    linetypeName = "CENTER"

    ' Load "CENTER" line type from acad.lin file
    On Error Resume Next    ' trap any load errors
    ThisDrawing.Linetypes.Load linetypeName, "acad.lin"

    ' If the name already exists, then notify user
    If Err.Description = "Duplicate record name" Then
        MsgBox "A line type named '" & linetypeName & "' already exists.", , "Load Example"
    End If

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Load()
    ;; This example attempts to load the linetype "CENTER" from
    ;; the acad.lin file. If the linetype already exists, then
    ;; a message is displayed.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq linetypeName "CENTER")

    ;; Load "CENTER" line type from acad.lin file
    (setq err (vl-catch-all-apply 'vla-Load (list (vla-get-Linetypes doc) linetypeName "acad.lin")))

    ;; If the name already exists, then notify user
    (if (vl-catch-all-error-p err)
        (if (= (vl-catch-all-error-message err) "Automation Error. Duplicate record name")
            (alert (strcat "A line type named '" linetypeName "' already exists."))
        )
    )
)


LoadARX Method (ActiveX)

Loads the specified ObjectARX application.

Supported platforms: Windows only

Signature

VBA:

object.LoadARX Name
object

Type: Application

The object this method applies to.

Name

Access: Input-only

Type: String

The full path name of the .arx application to load.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_LoadARX()
    ' This example loads an ObjectARX application.

    ' Note: The application listed here does not exist and
    ' will cause an error when run. Change the application name
    ' to the path and name of your ObjectARX application.
    ThisDrawing.Application.LoadArx "MyARXApp.arx"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LoadARX()
    ;; This example loads an ObjectARX application.
    (setq acadObj (vlax-get-acad-object))

    ;; Note: The application listed here does not exist and
    ;; will cause an error when run. Change the application name
    ;; to the path and name of your ObjectARX application.
    (vla-LoadArx acadObj "MyARXApp.arx")
)


LoadDVB Method (ActiveX)

Loads the specified AutoCAD VBA project file.

Supported platforms: Windows only

Signature

VBA:

object.LoadDVB Name
object

Type: Application

The object this method applies to.

Name

Access: Input-only

Type: String

The full path name of the .dvb project to load.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_LoadDVB()
    ' This example loads a DVB file and runs a macro
    ' contained in the file using the RunMacro method.
    '
    ' This example uses a DVB file named drawline.dvb.
    ' You should change the example to use a file on your computer.
    '
    ' * Note: If you open a DVB file and then run the example to load it, there will be an error
    ' when the DVB file is unloaded.

    Dim FileName As String

    FileName = "c:\drawline.dvb"

    ' Load a sample VBA project DVB file
    LoadDVB FileName

    ' Run the drawline sample macro
    RunMacro "Module1.Drawline"

    ' Unload the drawline VBA project DVB file now.
    UnloadDVB FileName

    MsgBox "The DVB file has been run!"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LoadDVB()
    ;; This example loads a DVB file and runs a macro
    ;; contained in the file using the RunMacro method.
    ;;
    ;; This example uses a DVB file named drawline.dvb.
    ;; You should change the example to use a file on your computer.
    ;;
    ;; * Note: If you open a DVB file and then run the example to load it, there will be an error
    ;; when the DVB file is unloaded.

    (setq FileName (findfile ".\\Sample\\VBA\\drawline.dvb"))

    ;; Load a sample VBA project DVB file
    (vla-LoadDVB acadObj FileName)

    ;; Run the drawline sample macro
    (vla-RunMacro acadObj "Module1.Drawline")

    ;; Unload the drawline VBA project DVB file now.
    (vla-UnloadDVB acadObj FileName)

    (alert "The DVB file has been run!")
)


LoadShapeFile Method (ActiveX)

Loads a shape file (SHX).

Supported platforms: Windows only

Signature

VBA:

object.LoadShapeFile FullName
object

Type: Document

The object this method applies to.

FullName

Access: Input-only

Type: String

The full path and name of the shape file to load.

Return Value (RetVal)

No return value.

Remarks

This method makes all the shapes in the shape file available to the current drawing. To add a shape into the drawing, use the AddShape method.

You must load a shape file the first time you need it. AutoCAD loads it thereafter. The shape file must be available each time you edit the drawing.

Examples

VBA:

Sub Example_LoadShapeFile()
    ' This example loads a shape file

    Dim shapeFileToLoad As String
    shapeFileToLoad = "C:/AutoCAD/Support/ltypeshp.shx"

    ' Load the shape file
    On Error GoTo ERRORHANDLE
    ThisDrawing.LoadShapeFile shapeFileToLoad
    Exit Sub
ERRORHANDLE:
    MsgBox Err.Description, Title:="LoadShapeFile"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LoadShapeFile()
    ;; This example loads a shape file
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq shapeFileToLoad (findfile "ltypeshp.shx"))

    ;; Load the shape file
    (vla-LoadShapeFile doc shapeFileToLoad)
)


MergeCells Method (ActiveX)

Merges cells in a table.

Supported platforms: Windows only

Signature

VBA:

object.MergeCells minRow, maxRow, minCol, maxCol
object

Type: Table

The object this method applies to.

minRow

Access: Input-only

Type: Long

The zero-based lower bound of a row index.

maxRow

Access: Input-only

Type: Long

The zero-based upper bound of a row index.

minCol

Access: Input-only

Type: Long

The zero-based lower bound of a column index.

maxCol

Access: Input-only

Type: Long

The zero-based upper bound of a column index.

Return Value (RetVal)

No return value.

Remarks

This method merges a rectangular region of cells. The total number of cells to be merged is equal to (maxRow - minRow + 1) * (maxCol - minCol + 1).

Examples

VBA:

Sub Example_MergeCells()

    Dim MyModelSpace As AcadModelSpace
    Set MyModelSpace = ThisDrawing.ModelSpace
    Dim pt(2) As Double
    Dim MyTable As AcadTable
    Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30)
    Call MyTable.MergeCells(2, 3, 2, 3)

    MsgBox "The cells have been merged appropriately."

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MergeCells()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MyTable (vla-AddTable modelSpace pt 5 5 10 30))

    (vla-MergeCells MyTable 2 3 2 3)

    (alert "The cells have been merged appropriately.")

    (vla-ZoomExtents acadObj)
)


Mirror Method (ActiveX)

Creates a mirror-image copy of a planar object around an axis.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.Mirror(Point1, Point2)
object

Type: All drawing objects, AttributeReference, Dimension

The objects this method applies to.

Point1

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the first point of the mirror axis.

Point2

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the second point of the mirror axis.

Return Value (RetVal)

Type: Object

This object can be one of any drawing object and is the result of mirroring the original object.

Remarks

The two points specified as parameters become the endpoints of a line around which the base object is reflected.

Selected object

Point1 and Point2 specifying the mirror axis

Mirrored object

This method places the reflected image into the drawing and retains the original object. To remove the original object, use the Delete method.

You can mirror a Viewport object in paper space, although doing so has no effect on its model space view or on model space objects.

AutoCAD checks to see if the object to be copied owns any other object. If it does, it performs a copy on those objects as well. The process continues until all owned objects have been copied.

NoteYou cannot execute this method while simultaneously iterating through a collection. An iteration will open the work space for a read-only operation, while this method attempts to perform a read-write operation. Complete any iteration before you call this method.

AttributeReference: You should not attempt to use this method on AttributeReference objects. AttributeReference objects inherit this method because they are one of the drawing objects, however, it is not feasible to perform this operation on an attribute reference.

NoteTo manage the reflection properties of text objects, use the MIRRTEXT system variable. The default setting of MIRRTEXT is On (1), which causes text objects to be mirrored just like any other object. When MIRRTEXT is off (0), text is not mirrored.

Before mirroring

After mirroring (MIRRTEXT = 1)

After mirroring (MIRRTEXT = 0)

Examples

VBA:

Sub Example_Mirror()
    ' This example creates a lightweight polyline
    ' and then mirrors that polyline.

    ' Create the polyline
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 11) As Double
    points(0) = 1: points(1) = 1
    points(2) = 1: points(3) = 2
    points(4) = 2: points(5) = 2
    points(6) = 3: points(7) = 2
    points(8) = 4: points(9) = 4
    points(10) = 4: points(11) = 1
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True
    ZoomAll

    ' Define the mirror axis
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    point1(0) = 0: point1(1) = 4.25: point1(2) = 0
    point2(0) = 4: point2(1) = 4.25: point2(2) = 0

    MsgBox "Mirror the polyline.", , "Mirror Example"

    ' Mirror the polyline
    Dim mirrorObj As AcadLWPolyline
    Set mirrorObj = plineObj.Mirror(point1, point2)

    ZoomAll
    MsgBox "Mirror completed.", , "Mirror Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Mirror()
    ;; This example creates a lightweight polyline
    ;; and then mirrors that polyline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 11)))
    (vlax-safearray-fill points '(1 1
                                  1 2
                                  2 2
                                  3 2
                                  4 4
                                  4 1
                                 )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)
    (vla-ZoomAll acadObj)

    ;; Define the mirror axis
    (setq point1 (vlax-3d-point 0 4.25 0)
          point2 (vlax-3d-point 4 4.25 0))

    (alert "Mirror the polyline.")

    ;; Mirror the polyline
    (setq mirrorObj (vla-Mirror plineObj point1 point2))

    (vla-ZoomAll acadObj)
    (alert "Mirror completed.")
)


Mirror3D Method (ActiveX)

Creates a mirror image of the given object about a plane.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.Mirror3D(Point1, Point2, Point3)
object

Type: All drawing objects, AttributeReference, Dimension

The objects this method applies to.

Point1

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the first point of the mirror plane.

Point2

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the second point of the mirror plane.

Point3

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the third point of the mirror plane.

Return Value (RetVal)

Type: Object

This object can be one of any drawing object and is the result of mirroring the original object.

Remarks

Object mirrored about a plane defined by three points

AutoCAD checks to see if the object to be copied owns any other object. If it does, it performs a copy on those objects as well. The process continues until all owned objects have been copied.

NoteYou cannot execute this method while simultaneously iterating through a collection. An iteration will open the work space for a read-only operation, while this method attempts to perform a read-write operation. Complete any iteration before you call this method.

AttributeReference: You should not attempt to use this method on AttributeReference objects. AttributeReference objects inherit this method because they are one of the drawing objects, however, it is not feasible to perform this operation on an attribute reference.

Examples

VBA:

Sub Example_Mirror3D()
    ' This example creates a box in model space, and mirrors the box about a plane.

    Dim boxObj As Acad3DSolid
    Dim length As Double, width As Double, height As Double
    Dim center(0 To 2) As Double

    ' Define the box
    center(0) = 5#: center(1) = 5#: center(2) = 0
    length = 5#: width = 7: height = 10#

    ' Create the box (3DSolid) object in model space
    Set boxObj = ThisDrawing.ModelSpace.AddBox(center, length, width, height)

    ' Define the mirroring plane with three points
    Dim mirrorPt1(0 To 2) As Double
    Dim mirrorPt2(0 To 2) As Double
    Dim mirrorPt3(0 To 2) As Double

    mirrorPt1(0) = 1.25: mirrorPt1(1) = 0: mirrorPt1(2) = 0
    mirrorPt2(0) = 1.25: mirrorPt2(1) = 2: mirrorPt2(2) = 0
    mirrorPt3(0) = 1.25: mirrorPt3(1) = 2: mirrorPt3(2) = 2

    ' Mirror the box
    Dim mirrorBoxObj As Acad3DSolid
    Set mirrorBoxObj = boxObj.Mirror3D(mirrorPt1, mirrorPt2, mirrorPt3)

    ' Change the viewing direction of the viewport
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Mirror3D()
    ;; This example creates a box in model space, and mirrors the box about a plane.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the box
    (setq center (vlax-3d-point 5 5 0)
          boxLength 5
             boxWidth 7
             boxHeight 10)

    ;; Create the box (3DSolid) object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq boxObj (vla-AddBox modelSpace center boxLength boxWidth boxHeight))

    ;; Define the mirroring plane with three points
    (setq mirrorPt1 (vlax-3d-point 1.25 0 0)
          mirrorPt2 (vlax-3d-point 1.25 2 0)
          mirrorPt3 (vlax-3d-point 1.25 2 2))

    ;; Mirror the box
    (setq mirrorBoxObj (vla-Mirror3D boxObj mirrorPt1 mirrorPt2 mirrorPt3))

    ;; Change the viewing direction of the viewport
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)
)


Move Method (ActiveX)

Moves an object along a vector.

Supported platforms: Windows only

Signature

VBA:

object.Move Point1, Point2
object

Type: All drawing objects, AttributeReference, Dimension

The objects this method applies to.

Point1

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the first point of the move vector.

Point2

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the second point of the move vector.

Return Value (RetVal)

No return value.

Remarks

The two points you specify define a displacement vector indicating how far the given object is to be moved and in what direction.

Given object with two points indicated

Moved object

Examples

VBA:

Sub Example_Move()
    ' This example creates a circle and then performs
    ' a move on that circle.

    ' Create the circle
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 2#: center(1) = 2#: center(2) = 0#
    radius = 0.5
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, radius)
    ZoomAll

    ' Define the points that make up the move vector
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    point1(0) = 0: point1(1) = 0: point1(2) = 0
    point2(0) = 2: point2(1) = 0: point2(2) = 0

    MsgBox "Move the circle 2 units in the X direction.", , "Move Example"

    ' Move the circle
    circleObj.Move point1, point2

    ZoomAll
    MsgBox "Move completed.", , "Move Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Move()
    ;; This example creates a circle and then performs
    ;; a move on that circle.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the circle
    (setq center (vlax-3d-point 2 2 0)
          radius 0.5)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace center radius))
    (vla-ZoomAll acadObj)

    ;; Define the points that make up the move vector
    (setq point1 (vlax-3d-point 0 0 0)
          point2 (vlax-3d-point 2 0 0))

    (alert "Move the circle 2 units in the X direction.")

    ;; Move the circle
    (vla-Move circleObj point1 point2)

    (vla-ZoomAll acadObj)
    (alert "Move completed.")
)


MoveAbove Method (ActiveX)

Moves objects above the target in the draw order.

Supported platforms: Windows only

Signature

VBA:

object.MoveAbove Objects, Target
object

Type: SortentsTable

The object this method applies to.

Objects

Access: Input-only

Type: Variant

The objects to move.

Target

Access: Input-only

Type: AcadEntity

The target of the draw order.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SortentsTable()
    ' This example creates a SortentsTable object and
    ' changes the draw order.

    ' Set drawing to display lineweights and create a True Color object
    Dim ACADPref As AcadDatabasePreferences
    Set ACADPref = ThisDrawing.preferences
    ACADPref.LineWeightDisplay = True
    Dim MyColorObjOne As AcadAcCmColor
    Set MyColorObjOne = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Call MyColorObjOne.SetRGB(80, 100, 244)

    ' Draw a polyline
    Dim plineObj As AcadPolyline
    Dim points(0 To 8) As Double
    points(0) = 4: points(1) = 4: points(2) = 0
    points(3) = 3: points(4) = 5: points(5) = 0
    points(6) = 6: points(7) = 20: points(8) = 0
    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
    plineObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(90, 110, 150)
    plineObj.TrueColor = MyColorObjOne

    ' Draw a line
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 5: startPoint(1) = 13: startPoint(2) = 0
    endPoint(0) = 5: endPoint(1) = 27: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    lineObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(50, 80, 230)
    lineObj.TrueColor = MyColorObjOne

    ' Draw a circle
    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    centerPoint(0) = 10: centerPoint(1) = 15: centerPoint(2) = 0#
    radius = 5#
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)
    circleObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(60, 200, 220)
    circleObj.TrueColor = MyColorObjOne
    ZoomAll
    AcadApplication.Update

    ' Get an extension dictionary and, if necessary, add a SortentsTable object
    Dim eDictionary As Object
    Set eDictionary = ThisDrawing.ModelSpace.GetExtensionDictionary
    ' Prevent failed GetObject calls from throwing an exception
    On Error Resume Next
    Dim sentityObj As Object
    Set sentityObj = eDictionary.GetObject("ACAD_SORTENTS")
    On Error GoTo 0
    If sentityObj Is Nothing Then
         ' No SortentsTable object, so add one
         Set sentityObj = eDictionary.AddObject("ACAD_SORTENTS", "AcDbSortentsTable")
    End If

    Dim ObjIds(2) As Long
    ObjIds(0) = plineObj.ObjectID
    ObjIds(1) = lineObj.ObjectID
    ObjIds(2) = circleObj.ObjectID

    Dim varObject As AcadObject
    Set varObject = ThisDrawing.ObjectIdToObject(ObjIds(2))
    Dim arr(0) As AcadObject
    Set arr(0) = varObject

    ' Move the circle object to the bottom
    sentityObj.MoveToBottom arr
    AcadApplication.Update

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SortentsTable()
    ;; This example creates a SortentsTable object and
    ;; changes the draw order.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Set drawing to display lineweights and create a True Color object
    (vla-put-LineWeightDisplay (vla-get-Preferences doc) :vlax-true)
    (setq MyColorObjOne (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB MyColorObjOne 80 100 244)

    ;; Draw a polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill points '(4 4 0
                                  3 5 0
                                  6 20 0
                                 )
    )

    (setq plineObj (vla-AddPolyline modelSpace points))

    (vla-put-Lineweight plineObj acLnWt211)
    (vla-SetRGB MyColorObjOne 90 110 150)
    (vla-put-TrueColor plineObj MyColorObjOne)

    ;; Draw a line
    (setq startPoint (vlax-3d-point 5 13 0)
          endPoint (vlax-3d-point 5 27 0))

    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-put-Lineweight lineObj acLnWt211)
    (vla-SetRGB MyColorObjOne 50 80 230)
    (vla-put-TrueColor lineObj MyColorObjOne)

    ;; Draw a circle
    (setq centerPoint (vlax-3d-point 10 15 0)
          radius 5)

    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))
    (vla-put-Lineweight circleObj acLnWt211)
    (vla-SetRGB MyColorObjOne 60 200 220)
    (vla-put-TrueColor circleObj MyColorObjOne)

    (vla-ZoomAll acadObj)
    (vla-Update acadObj)

    ;; Get an extension dictionary and, if necessary, add a SortentsTable object
    (setq eDictionary (vla-GetExtensionDictionary modelSpace))

    ;; Prevent failed GetObject calls from throwing an exception
    (setq sentityObj (vl-catch-all-apply 'vla-GetObject (list eDictionary "ACAD_SORTENTS")))

    (if (= (type sentityObj)'VL-CATCH-ALL-APPLY-ERROR)
         ;; No SortentsTable object, so add one
         (setq sentityObj (vla-AddObject eDictionary "ACAD_SORTENTS" "AcDbSortentsTable"))
    )

    (setq ObjIds (vlax-make-safearray vlax-vbLong '(0 . 2)))
    (vlax-safearray-put-element ObjIds 0 (vla-get-ObjectID plineObj))
    (vlax-safearray-put-element ObjIds 1 (vla-get-ObjectID lineObj))
    (vlax-safearray-put-element ObjIds 2 (vla-get-ObjectID circleObj))

    (setq varObject circleObj)
    (setq arr (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element arr 0 varObject)

    ;; Move the circle object to the bottom
    (vla-MoveToBottom sentityObj arr)
    (vla-Update acadObj)

    (vlax-release-object MyColorObjOne)
)


MoveBelow Method (ActiveX)

Moves objects below the target in the draw order.

Supported platforms: Windows only

Signature

VBA:

object.MoveBelow Objects, Target
object

Type: SortentsTable

The object this method applies to.

Objects

Access: Input-only

Type: Variant

The objects to move.

Target

Access: Input-only

Type: AcadEntity

The target of the draw order.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SortentsTable()
    ' This example creates a SortentsTable object and
    ' changes the draw order.

    ' Set drawing to display lineweights and create a True Color object
    Dim ACADPref As AcadDatabasePreferences
    Set ACADPref = ThisDrawing.preferences
    ACADPref.LineWeightDisplay = True
    Dim MyColorObjOne As AcadAcCmColor
    Set MyColorObjOne = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Call MyColorObjOne.SetRGB(80, 100, 244)

    ' Draw a polyline
    Dim plineObj As AcadPolyline
    Dim points(0 To 8) As Double
    points(0) = 4: points(1) = 4: points(2) = 0
    points(3) = 3: points(4) = 5: points(5) = 0
    points(6) = 6: points(7) = 20: points(8) = 0
    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
    plineObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(90, 110, 150)
    plineObj.TrueColor = MyColorObjOne

    ' Draw a line
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 5: startPoint(1) = 13: startPoint(2) = 0
    endPoint(0) = 5: endPoint(1) = 27: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    lineObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(50, 80, 230)
    lineObj.TrueColor = MyColorObjOne

    ' Draw a circle
    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    centerPoint(0) = 10: centerPoint(1) = 15: centerPoint(2) = 0#
    radius = 5#
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)
    circleObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(60, 200, 220)
    circleObj.TrueColor = MyColorObjOne
    ZoomAll
    AcadApplication.Update

    ' Get an extension dictionary and, if necessary, add a SortentsTable object
    Dim eDictionary As Object
    Set eDictionary = ThisDrawing.ModelSpace.GetExtensionDictionary
    ' Prevent failed GetObject calls from throwing an exception
    On Error Resume Next
    Dim sentityObj As Object
    Set sentityObj = eDictionary.GetObject("ACAD_SORTENTS")
    On Error GoTo 0
    If sentityObj Is Nothing Then
         ' No SortentsTable object, so add one
         Set sentityObj = eDictionary.AddObject("ACAD_SORTENTS", "AcDbSortentsTable")
    End If

    Dim ObjIds(2) As Long
    ObjIds(0) = plineObj.ObjectID
    ObjIds(1) = lineObj.ObjectID
    ObjIds(2) = circleObj.ObjectID

    Dim varObject As AcadObject
    Set varObject = ThisDrawing.ObjectIdToObject(ObjIds(2))
    Dim arr(0) As AcadObject
    Set arr(0) = varObject

    ' Move the circle object to the bottom
    sentityObj.MoveToBottom arr
    AcadApplication.Update

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SortentsTable()
    ;; This example creates a SortentsTable object and
    ;; changes the draw order.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Set drawing to display lineweights and create a True Color object
    (vla-put-LineWeightDisplay (vla-get-Preferences doc) :vlax-true)
    (setq MyColorObjOne (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB MyColorObjOne 80 100 244)

    ;; Draw a polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill points '(4 4 0
                                  3 5 0
                                  6 20 0
                                 )
    )

    (setq plineObj (vla-AddPolyline modelSpace points))

    (vla-put-Lineweight plineObj acLnWt211)
    (vla-SetRGB MyColorObjOne 90 110 150)
    (vla-put-TrueColor plineObj MyColorObjOne)

    ;; Draw a line
    (setq startPoint (vlax-3d-point 5 13 0)
          endPoint (vlax-3d-point 5 27 0))

    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-put-Lineweight lineObj acLnWt211)
    (vla-SetRGB MyColorObjOne 50 80 230)
    (vla-put-TrueColor lineObj MyColorObjOne)

    ;; Draw a circle
    (setq centerPoint (vlax-3d-point 10 15 0)
          radius 5)

    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))
    (vla-put-Lineweight circleObj acLnWt211)
    (vla-SetRGB MyColorObjOne 60 200 220)
    (vla-put-TrueColor circleObj MyColorObjOne)

    (vla-ZoomAll acadObj)
    (vla-Update acadObj)

    ;; Get an extension dictionary and, if necessary, add a SortentsTable object
    (setq eDictionary (vla-GetExtensionDictionary modelSpace))

    ;; Prevent failed GetObject calls from throwing an exception
    (setq sentityObj (vl-catch-all-apply 'vla-GetObject (list eDictionary "ACAD_SORTENTS")))

    (if (= (type sentityObj)'VL-CATCH-ALL-APPLY-ERROR)
         ;; No SortentsTable object, so add one
         (setq sentityObj (vla-AddObject eDictionary "ACAD_SORTENTS" "AcDbSortentsTable"))
    )

    (setq ObjIds (vlax-make-safearray vlax-vbLong '(0 . 2)))
    (vlax-safearray-put-element ObjIds 0 (vla-get-ObjectID plineObj))
    (vlax-safearray-put-element ObjIds 1 (vla-get-ObjectID lineObj))
    (vlax-safearray-put-element ObjIds 2 (vla-get-ObjectID circleObj))

    (setq varObject circleObj)
    (setq arr (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element arr 0 varObject)

    ;; Move the circle object to the bottom
    (vla-MoveToBottom sentityObj arr)
    (vla-Update acadObj)

    (vlax-release-object MyColorObjOne)
)


MoveContent Method (ActiveX)

Moves the index content of a cell.

Supported platforms: Windows only

Signature

VBA:

object.MoveContent nRow, nCol, nFromIndex, nToIndex
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to check.

nCol

Access: Input-only

Type: Long

The column number of the cell to check.

nFromIndex

Access: Input-only

Type: Long

The index of the content to be moved.

nToindex

Access: Input-only

Type: Long

The index of the content to be placed at.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ContentChange()
    ' This example adds a table in model space
    ' and manipulates its contents

    ' Note: One content is created for each cell by default;
    ' this function need to be called only to create additional contents.

    Dim MyModelSpace As AcadModelSpace
    Set MyModelSpace = ThisDrawing.modelSpace
    Dim pt(2) As Double
    Dim MyTable As IAcadTable
    Dim sID As Long
    Dim newSID As Long
    Dim row As Long
    Dim col As Long

    ' Creates arbitrary cell points to check
    row = 2
    col = 2

    ' Creates the table with an arbitrary number of cells
    Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30)

    If MyTable.IsEmpty(row, col) Then
        If MyTable.IsContentEditable(row, col) Then
            MsgBox "There is no content in the cell, but it is editable"
        End If
    End If

    ' Create some content in an arbitrary cell
    sID = MyTable.CreateContent(row, col, 8)

    MsgBox "The content ID is " & sID

    ' Move the content to another index
    MyTable.MoveContent row, col, sID, 4

    ' Check that the content has been deleted
    MyTable.DeleteContent row, col

    If MyTable.IsEmpty(row, col) Then
        If MyTable.IsContentEditable(row, col) Then
            MsgBox "There is no content in the cell, but it is editable"
        End If
    End If

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ContentChange()
    ;; This example adds a table in model space
    ;; and manipulates its contents
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Note: One content is created for each cell by default;
    ;; this function need to be called only to create additional contents.

    (setq pt (vlax-3d-point 0 0 0))

    ;; Creates arbitrary cell points to check
    (setq row 2
          col 2)

    ;; Creates the table with an arbitrary number of cells
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MyTable (vla-AddTable modelSpace pt 5 5 10 30))
    (vla-SetTextHeight MyTable (+ acDataRow acHeaderRow acTitleRow) 1)

    (vla-Regen doc :vlax-true)
    (vla-ZoomExtents acadObj)

    (if (= (vla-IsEmpty MyTable row col) :vlax-true)
        (if (= (vla-IsContentEditable MyTable row col) :vlax-true)
            (alert "There is no content in the cell, but it is editable")
        )
    )

    ;; Create some content in an arbitrary cell
    (setq sID1 (vla-CreateContent MyTable row col 0))
    (setq sID2 (vla-CreateContent MyTable row col 1))
    (vla-SetTextString MyTable row col sID1 "Value1")
    (vla-SetTextString MyTable row col sID2 "Value2")
    (vla-Regen doc :vlax-true)

    (alert (strcat "The content IDs are "
                         "\nValue1: " (itoa sID1)
                         "\nValue2: " (itoa sID2)))

    ;; Move the content to another index
    (vla-MoveContent MyTable row col sID2 sID1)
    (vla-Regen doc :vlax-true)
    (alert "Content order changed")

    ;  Check that the content has been deleted
    (vla-DeleteContent MyTable row col)
    (vla-Regen doc :vlax-true)

    (if (= (vla-IsEmpty MyTable row col) :vlax-true)
        (if (= (vla-IsContentEditable MyTable row col) :vlax-true)
            (alert "There is no content in the cell, but it is editable")
        )
    )
)


MoveToBottom Method (ActiveX)

Moves objects to the bottom of the draw order.

Supported platforms: Windows only

Signature

VBA:

object.MoveToBottom Objects
object

Type: SortentsTable

The object this method applies to.

Objects

Access: Input-only

Type: Variant

The objects to move.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SortentsTable()
    ' This example creates a SortentsTable object and
    ' changes the draw order.

    ' Set drawing to display lineweights and create a True Color object
    Dim ACADPref As AcadDatabasePreferences
    Set ACADPref = ThisDrawing.preferences
    ACADPref.LineWeightDisplay = True
    Dim MyColorObjOne As AcadAcCmColor
    Set MyColorObjOne = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Call MyColorObjOne.SetRGB(80, 100, 244)

    ' Draw a polyline
    Dim plineObj As AcadPolyline
    Dim points(0 To 8) As Double
    points(0) = 4: points(1) = 4: points(2) = 0
    points(3) = 3: points(4) = 5: points(5) = 0
    points(6) = 6: points(7) = 20: points(8) = 0
    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
    plineObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(90, 110, 150)
    plineObj.TrueColor = MyColorObjOne

    ' Draw a line
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 5: startPoint(1) = 13: startPoint(2) = 0
    endPoint(0) = 5: endPoint(1) = 27: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    lineObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(50, 80, 230)
    lineObj.TrueColor = MyColorObjOne

    ' Draw a circle
    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    centerPoint(0) = 10: centerPoint(1) = 15: centerPoint(2) = 0#
    radius = 5#
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)
    circleObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(60, 200, 220)
    circleObj.TrueColor = MyColorObjOne
    ZoomAll
    AcadApplication.Update

    ' Get an extension dictionary and, if necessary, add a SortentsTable object
    Dim eDictionary As Object
    Set eDictionary = ThisDrawing.ModelSpace.GetExtensionDictionary
    ' Prevent failed GetObject calls from throwing an exception
    On Error Resume Next
    Dim sentityObj As Object
    Set sentityObj = eDictionary.GetObject("ACAD_SORTENTS")
    On Error GoTo 0
    If sentityObj Is Nothing Then
         ' No SortentsTable object, so add one
         Set sentityObj = eDictionary.AddObject("ACAD_SORTENTS", "AcDbSortentsTable")
    End If

    Dim ObjIds(2) As Long
    ObjIds(0) = plineObj.ObjectID
    ObjIds(1) = lineObj.ObjectID
    ObjIds(2) = circleObj.ObjectID

    Dim varObject As AcadObject
    Set varObject = ThisDrawing.ObjectIdToObject(ObjIds(2))
    Dim arr(0) As AcadObject
    Set arr(0) = varObject

    ' Move the circle object to the bottom
    sentityObj.MoveToBottom arr
    AcadApplication.Update

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SortentsTable()
    ;; This example creates a SortentsTable object and
    ;; changes the draw order.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Set drawing to display lineweights and create a True Color object
    (vla-put-LineWeightDisplay (vla-get-Preferences doc) :vlax-true)
    (setq MyColorObjOne (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB MyColorObjOne 80 100 244)

    ;; Draw a polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill points '(4 4 0
                                  3 5 0
                                  6 20 0
                                 )
    )

    (setq plineObj (vla-AddPolyline modelSpace points))

    (vla-put-Lineweight plineObj acLnWt211)
    (vla-SetRGB MyColorObjOne 90 110 150)
    (vla-put-TrueColor plineObj MyColorObjOne)

    ;; Draw a line
    (setq startPoint (vlax-3d-point 5 13 0)
          endPoint (vlax-3d-point 5 27 0))

    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-put-Lineweight lineObj acLnWt211)
    (vla-SetRGB MyColorObjOne 50 80 230)
    (vla-put-TrueColor lineObj MyColorObjOne)

    ;; Draw a circle
    (setq centerPoint (vlax-3d-point 10 15 0)
          radius 5)

    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))
    (vla-put-Lineweight circleObj acLnWt211)
    (vla-SetRGB MyColorObjOne 60 200 220)
    (vla-put-TrueColor circleObj MyColorObjOne)

    (vla-ZoomAll acadObj)
    (vla-Update acadObj)

    ;; Get an extension dictionary and, if necessary, add a SortentsTable object
    (setq eDictionary (vla-GetExtensionDictionary modelSpace))

    ;; Prevent failed GetObject calls from throwing an exception
    (setq sentityObj (vl-catch-all-apply 'vla-GetObject (list eDictionary "ACAD_SORTENTS")))

    (if (= (type sentityObj)'VL-CATCH-ALL-APPLY-ERROR)
         ;; No SortentsTable object, so add one
         (setq sentityObj (vla-AddObject eDictionary "ACAD_SORTENTS" "AcDbSortentsTable"))
    )

    (setq ObjIds (vlax-make-safearray vlax-vbLong '(0 . 2)))
    (vlax-safearray-put-element ObjIds 0 (vla-get-ObjectID plineObj))
    (vlax-safearray-put-element ObjIds 1 (vla-get-ObjectID lineObj))
    (vlax-safearray-put-element ObjIds 2 (vla-get-ObjectID circleObj))

    (setq varObject circleObj)
    (setq arr (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element arr 0 varObject)

    ;; Move the circle object to the bottom
    (vla-MoveToBottom sentityObj arr)
    (vla-Update acadObj)

    (vlax-release-object MyColorObjOne)
)


MoveToTop Method (ActiveX)

Moves objects to the top of the draw order.

Supported platforms: Windows only

Signature

VBA:

object.MoveToTop Objects
object

Type: SortentsTable

The object this method applies to.

Objects

Access: Input-only

Type: Variant

The objects to move.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SortentsTable()
    ' This example creates a SortentsTable object and
    ' changes the draw order.

    ' Set drawing to display lineweights and create a True Color object
    Dim ACADPref As AcadDatabasePreferences
    Set ACADPref = ThisDrawing.preferences
    ACADPref.LineWeightDisplay = True
    Dim MyColorObjOne As AcadAcCmColor
    Set MyColorObjOne = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Call MyColorObjOne.SetRGB(80, 100, 244)

    ' Draw a polyline
    Dim plineObj As AcadPolyline
    Dim points(0 To 8) As Double
    points(0) = 4: points(1) = 4: points(2) = 0
    points(3) = 3: points(4) = 5: points(5) = 0
    points(6) = 6: points(7) = 20: points(8) = 0
    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
    plineObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(90, 110, 150)
    plineObj.TrueColor = MyColorObjOne

    ' Draw a line
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 5: startPoint(1) = 13: startPoint(2) = 0
    endPoint(0) = 5: endPoint(1) = 27: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    lineObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(50, 80, 230)
    lineObj.TrueColor = MyColorObjOne

    ' Draw a circle
    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    centerPoint(0) = 10: centerPoint(1) = 15: centerPoint(2) = 0#
    radius = 5#
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)
    circleObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(60, 200, 220)
    circleObj.TrueColor = MyColorObjOne
    ZoomAll
    AcadApplication.Update

    ' Get an extension dictionary and, if necessary, add a SortentsTable object
    Dim eDictionary As Object
    Set eDictionary = ThisDrawing.ModelSpace.GetExtensionDictionary
    ' Prevent failed GetObject calls from throwing an exception
    On Error Resume Next
    Dim sentityObj As Object
    Set sentityObj = eDictionary.GetObject("ACAD_SORTENTS")
    On Error GoTo 0
    If sentityObj Is Nothing Then
         ' No SortentsTable object, so add one
         Set sentityObj = eDictionary.AddObject("ACAD_SORTENTS", "AcDbSortentsTable")
    End If

    Dim ObjIds(2) As Long
    ObjIds(0) = plineObj.ObjectID
    ObjIds(1) = lineObj.ObjectID
    ObjIds(2) = circleObj.ObjectID

    Dim varObject As AcadObject
    Set varObject = ThisDrawing.ObjectIdToObject(ObjIds(2))
    Dim arr(0) As AcadObject
    Set arr(0) = varObject

    ' Move the circle object to the bottom
    sentityObj.MoveToBottom arr
    AcadApplication.Update

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SortentsTable()
    ;; This example creates a SortentsTable object and
    ;; changes the draw order.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Set drawing to display lineweights and create a True Color object
    (vla-put-LineWeightDisplay (vla-get-Preferences doc) :vlax-true)
    (setq MyColorObjOne (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB MyColorObjOne 80 100 244)

    ;; Draw a polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill points '(4 4 0
                                  3 5 0
                                  6 20 0
                                 )
    )

    (setq plineObj (vla-AddPolyline modelSpace points))

    (vla-put-Lineweight plineObj acLnWt211)
    (vla-SetRGB MyColorObjOne 90 110 150)
    (vla-put-TrueColor plineObj MyColorObjOne)

    ;; Draw a line
    (setq startPoint (vlax-3d-point 5 13 0)
          endPoint (vlax-3d-point 5 27 0))

    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-put-Lineweight lineObj acLnWt211)
    (vla-SetRGB MyColorObjOne 50 80 230)
    (vla-put-TrueColor lineObj MyColorObjOne)

    ;; Draw a circle
    (setq centerPoint (vlax-3d-point 10 15 0)
          radius 5)

    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))
    (vla-put-Lineweight circleObj acLnWt211)
    (vla-SetRGB MyColorObjOne 60 200 220)
    (vla-put-TrueColor circleObj MyColorObjOne)

    (vla-ZoomAll acadObj)
    (vla-Update acadObj)

    ;; Get an extension dictionary and, if necessary, add a SortentsTable object
    (setq eDictionary (vla-GetExtensionDictionary modelSpace))

    ;; Prevent failed GetObject calls from throwing an exception
    (setq sentityObj (vl-catch-all-apply 'vla-GetObject (list eDictionary "ACAD_SORTENTS")))

    (if (= (type sentityObj)'VL-CATCH-ALL-APPLY-ERROR)
         ;; No SortentsTable object, so add one
         (setq sentityObj (vla-AddObject eDictionary "ACAD_SORTENTS" "AcDbSortentsTable"))
    )

    (setq ObjIds (vlax-make-safearray vlax-vbLong '(0 . 2)))
    (vlax-safearray-put-element ObjIds 0 (vla-get-ObjectID plineObj))
    (vlax-safearray-put-element ObjIds 1 (vla-get-ObjectID lineObj))
    (vlax-safearray-put-element ObjIds 2 (vla-get-ObjectID circleObj))

    (setq varObject circleObj)
    (setq arr (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element arr 0 varObject)

    ;; Move the circle object to the top
    (vla-MoveToTop sentityObj arr)
    (vla-Update acadObj)

    (vlax-release-object MyColorObjOne)
)


New Method (ActiveX)

Creates a new document in SDI mode.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.New(TemplateFileName)
object

Type: Document

The object this method applies to.

TemplateFileName

Access: Input-only

Type: String

The full path and file name of the template file.

Return Value (RetVal)

Type: Document

The newly created Document object.

Remarks

You should call the New method from the Document object only when working in SDI mode. When working in MDI mode, use the Add method on the Documents collection to create a new drawing.

Examples

VBA:

Sub Example_New()
    ' This example creates a new drawing based on the template ansi-a.dwt.
    ' Note: The path to the template file is included with its name. Adjust
    ' this path for your installation location before running this example.

    Dim templateFileName As String
    templateFileName = "c:\AutoCAD\template\ansi-a.dwt"

    If AcadApplication.preferences.System.SingleDocumentMode = True Then
        ThisDrawing.New templateFileName
    Else
        ThisDrawing.Application.Documents.Add templateFileName
    End If

End Sub

Visual LISP:

Not available


NumCustomInfo Method (ActiveX)

Returns the number of custom property fields that have been set.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.NumCustomInfo
object

Type: SummaryInfo

The object this method applies to.

Return Value (RetVal)

Type: Long

The number of custom property fields that have been set for the drawing.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_NumCustomInfo()
    ' This example shows how to access drawing properties

    ' Add and display standard properties
    ThisDrawing.SummaryInfo.Author = "John Doe"
    ThisDrawing.SummaryInfo.Comments = "Includes all ten levels of Building Five"
    ThisDrawing.SummaryInfo.HyperlinkBase = "http://www.autodesk.com"
    ThisDrawing.SummaryInfo.Keywords = "Building Complex"
    ThisDrawing.SummaryInfo.LastSavedBy = "JD"
    ThisDrawing.SummaryInfo.RevisionNumber = "4"
    ThisDrawing.SummaryInfo.Subject = "Plan for Building Five"
    ThisDrawing.SummaryInfo.Title = "Building Five"

    Author = ThisDrawing.SummaryInfo.Author
    Comments = ThisDrawing.SummaryInfo.Comments
    HLB = ThisDrawing.SummaryInfo.HyperlinkBase
    KW = ThisDrawing.SummaryInfo.Keywords
    LSB = ThisDrawing.SummaryInfo.LastSavedBy
    RN = ThisDrawing.SummaryInfo.RevisionNumber
    Subject = ThisDrawing.SummaryInfo.Subject
    Title = ThisDrawing.SummaryInfo.Title
    MsgBox "The standard drawing properties are " & vbCrLf & _
           "Author = " & Author & vbCrLf & _
           "Comments = " & Comments & vbCrLf & _
           "HyperlinkBase = " & HLB & vbCrLf & _
           "Keywords = " & KW & vbCrLf & _
           "LastSavedBy = " & LSB & vbCrLf & _
           "RevisionNumber = " & RN & vbCrLf & _
           "Subject = " & Subject & vbCrLf & _
           "Title = " & Title & vbCrLf

    ' Add and display custom properties
    Dim Key0 As String
    Dim Value0 As String
    Dim Key1 As String
    Dim Value1 As String
    Dim CustomPropertyBranch As String
    Dim PropertyBranchValue As String
    Dim CustomPropertyZone As String
    Dim PropertyZoneValue As String

    CustomPropertyBranch = "Branch"
    PropertyBranchValue = "Main"
    CustomPropertyZone = "Zone"
    PropertyZoneValue = "Industrial"

    ' Add custom properties
    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 1) Then
        ThisDrawing.SummaryInfo.SetCustomByIndex 0, CustomPropertyBranch, PropertyBranchValue
    Else
        ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyBranch, PropertyBranchValue
    End If

    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 2) Then
         ThisDrawing.SummaryInfo.SetCustomByKey CustomPropertyBranch, "Satellite"
    Else
         ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyZone, PropertyZoneValue
    End If

    'Get custom properties
    ThisDrawing.SummaryInfo.GetCustomByIndex 0, Key0, Value0
    Key1 = CustomPropertyZone
    ThisDrawing.SummaryInfo.GetCustomByKey Key1, Value1

    MsgBox "The custom drawing properties are " & vbCrLf & _
           "First property name = " & Key0 & vbCrLf & _
           "First property value = " & Value0 & vbCrLf & _
           "Second property name = " & Key1 & vbCrLf & _
           "Second property value = " & Value1 & vbCrLf
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_NumCustomInfo()
    ;; This example shows how to access drawing properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq summaryInfo (vla-get-SummaryInfo doc))

    ;; Add and display standard properties
    (vla-put-Author summaryInfo "John Doe")
    (vla-put-Comments summaryInfo "Includes all ten levels of Building Five")
    (vla-put-HyperlinkBase summaryInfo "http://www.autodesk.com")
    (vla-put-Keywords summaryInfo "Building Complex")
    (vla-put-LastSavedBy summaryInfo "JD")
    (vla-put-RevisionNumber summaryInfo "4")
    (vla-put-Subject summaryInfo "Plan for Building Five")
    (vla-put-Title summaryInfo "Building Five")

    (setq author (vla-get-Author summaryInfo))
    (setq comments (vla-get-Comments summaryInfo))
    (setq HLB (vla-get-HyperlinkBase summaryInfo))
    (setq KW (vla-get-Keywords summaryInfo))
    (setq LSB (vla-get-LastSavedBy summaryInfo))
    (setq RN (vla-get-RevisionNumber summaryInfo))
    (setq subject (vla-get-Subject summaryInfo))
    (setq Title (vla-get-Title summaryInfo))
    (alert (strcat "The standard drawing properties are "
                   "\nAuthor = " author
                   "\nComments = " comments
                   "\nHyperlinkBase = " HLB
                   "\nKeywords = " KW
                   "\nLastSavedBy = " LSB
                   "\nRevisionNumber = " RN
                   "\nSubject = " Subject
                   "\nTitle = " Title
           )
    )

    ;; Add and display custom properties
    (setq CustomPropertyBranch "Branch")
    (setq PropertyBranchValue "Main")
    (setq CustomPropertyZone "Zone")
    (setq PropertyZoneValue "Industrial")

    ;; Add custom properties
    (if (>= (vla-NumCustomInfo summaryInfo) 1)
        (vla-SetCustomByIndex summaryInfo 0 CustomPropertyBranch PropertyBranchValue)
        (vla-AddCustomInfo summaryInfo CustomPropertyBranch PropertyBranchValue)
    )

    (if (>= (vla-NumCustomInfo summaryInfo) 2)
        (vla-SetCustomByKey summaryInfo CustomPropertyBranch "Satellite")
        (vla-AddCustomInfo summaryInfo CustomPropertyZone PropertyZoneValue)
    )

    ;; Get custom properties
    (vla-GetCustomByIndex summaryInfo 0 'Key0 'Value0)
    (setq Key1 CustomPropertyZone)
    (vla-GetCustomByKey summaryInfo Key1 'Value1)

    (alert (strcat "The custom drawing properties are "
                   "\nFirst property name = " Key0
                   "\nFirst property value = " Value0
                   "\nSecond property name = " Key1
                   "\nSecond property value = " Value1
           )
    )
)


ObjectIDToObject Method (ActiveX)

Gets the object that corresponds to the given object ID.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.ObjectIDToObject(ID)
object

Type: Database, Document

The objects this method applies to.

ID

Access: Input-only

Type: Long_PTR

The object ID of the object to return.

Return Value (RetVal)

Type: Object

The object that corresponds to the given object ID.

Remarks

This method can return only objects that are in the current document.

Examples

VBA:

Sub Example_ObjectIDToObject()
    ' This example creates a spline in model space, and returns the
    ' handle for the spline. Then the spline is returned from the handle and colored.

    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)

    ZoomAll

    Dim objectID As Long
    objectID = splineObj.ObjectID
    MsgBox "The objectID of the Spline is: " & objectID, , "ObjectIDToObject Example"

    ' Find an object from a given objectID
    Dim tempObj As AcadObject
    Set tempObj = ThisDrawing.ObjectIdToObject(objectID)

    ' Now use the newly initialized object variable to color the object
    Dim color As AcadAcCmColor
    Set color = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    color.SetRGB 80, 100, 244

    tempObj.TrueColor = color

    ThisDrawing.Regen True
    MsgBox "The Spline is now blue.", , "ObjectIDToObject Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ObjectIDToObject()
    ;; This example creates a spline in model space, and returns the
    ;; handle for the spline. Then the spline is returned from the handle and colored.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the spline
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(1 1 0
                                     5 5 0
                     10 0 0
                    )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)

    ;; Find the objectID of the spline
    (setq objectID (vla-get-objectID splineObj))
    (alert (strcat "The objectID of the Spline is: " (itoa objectID)))

    ;; Find an object from a given objectID
    (setq tempObj (vla-ObjectIDToObject doc objectID))

    ;; Now use the newly initialized object variable to color the object
    (setq color (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB color 80 100 244)

    (vla-put-TrueColor tempObj color)

    (vla-Regen doc :vlax-true)
    (alert "The Spline is now blue.")
    (vlax-release-object color)
)


Offset Method (ActiveX)

Creates a new object at a specified offset distance from an existing object.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.Offset(Distance)
object

Type: Arc, Circle, Ellipse, Line, LWPolyline, Polyline, Spline, XLine

The objects this method applies to.

Distance

Access: Input-only

Type: Double

The distance to offset the object. The offset can be a positive or negative number, but it cannot equal zero. If the offset is negative, this is interpreted as being an offset to make a "smaller" curve (that is, for an arc it would offset to a radius that is "Distance less" than the starting curve's radius). If "smaller" has no meaning, then it would offset in the direction of smaller X, Y, and Z WCS coordinates.

Return Value (RetVal)

Type: Variant (array of objects)

An array of the newly created objects resulting from the offset.

Remarks

For many curves, the result of this operation will be a single new curve (which may not be of the same type as the original curve). For example, offsetting an ellipse will result in a spline because the result does not fit the equation of an ellipse. In some cases it may be necessary for the offset result to be several curves.

An original object and the object with an offset in red.

Examples

VBA:

Sub Example_Offset()
    ' This example creates a lightweight polyline
    ' and then offsets the polyline.

    ' Create the polyline
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 11) As Double
    points(0) = 1: points(1) = 1
    points(2) = 1: points(3) = 2
    points(4) = 2: points(5) = 2
    points(6) = 3: points(7) = 2
    points(8) = 4: points(9) = 4
    points(10) = 4: points(11) = 1
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True
    ZoomAll

    MsgBox "Offset the polyline by 0.25.", , "Offset Example"

    ' Offset the polyline
    Dim offsetObj As Variant
    offsetObj = plineObj.offset(0.25)

    ZoomAll
    MsgBox "Offset completed.", , "Offset Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Offset()
    ;; This example creates a lightweight polyline
    ;; and then offsets the polyline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 11)))
    (vlax-safearray-fill points '(1 1
                                  1 2
                                  2 2
                                  3 2
                                  4 4
                                  4 1
                                 )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)
    (vla-ZoomAll acadObj)

    (alert "Offset the polyline by 0.25.")

    ;; Offset the polyline
    (setq offsetObj (vla-Offset plineObj 0.25))

    (vla-ZoomAll acadObj)
    (alert "Offset completed.")
)


Open Method (ActiveX)

Opens an existing drawing file (DWG) and makes it the active document.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.Open(Name [, ReadOnly] [, Password])
object

Type: Document, Documents

The objects this method applies to.

Name

Access: Input-only

Type: String

The full path and file name, or a valid URL address, of the drawing file to open. If the drawing is in the folder specified by the SupportPath property, then the path is not needed and the file name is sufficient.

ReadOnly (Documents only)

Access: Input-only; optional

Type: Variant

The default setting is False.

  • True: Opens the drawing as a read-only drawing.
  • False: Opens the drawing as a read-write drawing.
Password

Access: Input-only; optional

Type: Variant

Password to open an encrypted drawing.

Return Value (RetVal)

Type: Document

The Document object that represents the opened drawing file.

Remarks

It is recommended that you save the current drawing before calling this method.

This method opens AutoCAD drawing files only. Use the Import method to open SAT, EPS, DXF, WMF, or BMP format files.

When working in MDI mode, you should always use the Open method from the Documents collection.

When accessing a secure URL, a dialog box prompts the user for the necessary password information. Message boxes appear if the user has not suppressed this activity in the browser.

When downloading a file, AutoCAD creates a temporary file for internal processing. Do not attempt to access this temporary file. Information in this file is deleted at the end of the AutoCAD session.

Examples

VBA:

Sub Example_Open()
    ' The following example opens "C:\AutoCAD\Sample\city map.dwg" file.
    ' This drawing may not exist on your system. Change the drawing
    ' path and name to reflect a valid AutoCAD drawing on your system.

    If AcadApplication.Preferences.System.SingleDocumentMode = True Then
        ThisDrawing.Open "C:\AutoCAD\Sample\city map.dwg"
    Else
        ThisDrawing.Application.Documents.Open "C:\AutoCAD\Sample\city map.dwg"
    End If
End Sub

Visual LISP:

Not available


PlotToDevice Method (ActiveX)

Plots a layout to a device.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.PlotToDevice([plotConfig])
object

Type: Plot

The object this method applies to.

plotConfig

Access: Input-only; optional

Type: String

The full path and file name of the PC3 file to use instead of the current configuration. If this parameter is not provided, the current configuration will be used. If the configuration file is not found at the specified path, AutoCAD will search the printer configuration path for the file before it defaults to the current configuration.

Return Value (RetVal)

Type: Boolean

  • True: The plot was successfully sent to the device.
  • False: The plot was not sent to the device. There was either a plot process failure or the plot was cancelled.

Remarks

The drawing from which the plot is initiated must be active for the plot to succeed.

To plot in the foreground, you must set the AutoCAD BACKGROUNDPLOT system variable to 0. Otherwise, plotting occurs in the background.

The plot device is specified using the ConfigName property for the layout or plot configuration.

If the PC3 file specified or the current plot configuration contains plot-to-file information, this method may actually send the plot to a file instead of to a device. Be careful to review all current plot configuration information for the specified layout. To plot several layouts, you can use the SetLayoutsToPlot method before invoking the PlotToDevice method.

To create a new configured plotter (PC3) file, use the Add-a-Plotter wizard in AutoCAD. For more information about PC3 files, see the AutoCAD Online Help system.

Examples

VBA:

Sub Example_PlotToDevice()
    ' This example sends a plot of the current drawing
    ' to the default device for your system.

    ThisDrawing.ActiveLayout.ConfigName = "DWF6 ePlot.pc3"

    ThisDrawing.Plot.PlotToDevice

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PlotToDevice()
    ;; This example sends a plot of the current drawing
    ;; to the current device.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (vla-put-ConfigName (vla-get-ActiveLayout doc) "DWF6 ePlot.pc3")

    (vla-PlotToDevice (vla-get-Plot doc))
)


PlotToFile Method (ActiveX)

Plots a layout to the specified file.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.PlotToFile(plotFile [, plotConfig])
object

Type: Plot

The object this method applies to.

plotFile

Access: Input-only

Type: String

The name of the file to plot the active layout to. If you plot multiple layouts, the file name for each plot will be generated from the drawing and layout names.

plotConfig

Access: Input-only; optional

Type: String

The full path and file name of the PC3 file to use instead of the current configuration. If this parameter is not provided, the current configuration will be used.

Return Value (RetVal)

Type: Boolean

  • True: The plot was successfully sent to the file.
  • False: The plot was not sent to the file. There was either a plot process failure or the plot was cancelled.

Remarks

The drawing from which the plot is initiated must be active for the plot to succeed.

To plot in the foreground, you must set the AutoCAD BACKGROUNDPLOT system variable to 0. Otherwise, plotting occurs in the background.

If you plot the active layout (that is, you have not called SetLayoutsToPlot before this method), the plotFile parameter specifies the name for the output plot file. If you plot multiple layouts using the SetLayoutsToPlot method, the output plot files are automatically named using the drawing name, layout name, and any path information provided in the plotFile parameter.

If a file extension is provided in the plotFile parameter, that extension will almost always be used for the output plot file. The specified extension will be overwritten only for certain raster output drivers that replace user-provided extensions with .gif.

If a file extension is not provided in the plotFile parameter, an extension is automatically generated for the output plot file based on the default extension for the specified driver or device.

For some plotters, the output format you choose determines the file extension and whether the plot is written to a file. Also, some plotters might not be able to plot to a file. For further information, see the AutoCAD Online Help system or the plotter's manual from the manufacturer.

Examples

VBA:

Sub Example_PlotToFile()
    ' This example sends a plot of the current drawing
    ' to a file.

    ThisDrawing.ActiveLayout.ConfigName = "DWF6 ePlot.pc3"

    ' Define the output file name.
    ' Use "" to use the drawing name as the file name.
    Dim plotFileName As String
    plotFileName = "MyPlot"

    Dim result As Boolean

    result = ThisDrawing.Plot.PlotToFile(plotFileName)

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PlotToFile()
    ;; This example sends a plot of the current drawing
    ;; to a file.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Set a device current that outputs to a file
    (vla-put-ConfigName (vla-get-ActiveLayout doc) "DWF6 ePlot.pc3")

    ;; Define the plot variable
    (setq currentPlot (vla-get-Plot doc))

    ;; Define the output file name.
    ;; Use "" to use the drawing name as the file name.
    ;; Note: if the file name exists an error will be generated.
    (setq plotFileName "MyPlot")

    (vla-PlotToFile currentPlot plotFileName)
)


PolarPoint Method (ActiveX)

Gets the point at a specified angle and distance from a given point.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.PolarPoint(Point, Angle, Distance)
object

Type: Utility

The object this method applies to.

Point

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the start point.

Angle

Access: Input-only

Type: Double

The angle in radians.

Distance

Access: Input-only

Type: Double

The distance in current units.

Return Value (RetVal)

Type: Variant (three-element array of doubles)

The 3D WCS coordinates at the specified angle and distance from a given point.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_PolarPoint()
    ' This example finds the coordinate of a point that is a given
    ' distance and angle from a base point.

    Dim polarPnt As Variant
    Dim basePnt(0 To 2) As Double
    Dim angle As Double
    Dim distance As Double

    basePnt(0) = 2#: basePnt(1) = 2#: basePnt(2) = 0#
    angle = 0.1744444   ' 45 degrees
    distance = 5
    polarPnt = ThisDrawing.Utility.PolarPoint(basePnt, angle, distance)

    ' Create a line from the base point to the polar point
    Dim lineObj As AcadLine
    Set lineObj = ThisDrawing.ModelSpace.AddLine(basePnt, polarPnt)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PolarPoint()
    ;; This example finds the coordinate of a point that is a given
    ;; distance and angle from a base point.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq basePnt (vlax-3d-point 2 2 0)
          ang 0.1744444   ;; 45 degrees
          dist 5)

    (setq polarPnt (vla-PolarPoint (vla-get-Utility doc) basePnt ang dist))

    ;; Create a line from the base point to the polar point
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace basePnt polarPnt))
    (vla-ZoomAll acadObj)
)


Prompt Method (ActiveX)

Displays a prompt on the command line.

Supported platforms: Windows only

Signature

VBA:

object.Prompt Message
object

Type: Utility

The object this method applies to.

Message

Access: Input-only

Type: String

The prompt to display.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Prompt()
    ' This example will use the Utility object to display a prompt to the
    ' AutoCAD command line.  To see the results after running the example,
    ' switch to AutoCAD and look at the command line.

    ThisDrawing.Utility.Prompt "Press any key..."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Prompt()
    ;; This example will use the Utility object to display a prompt to the
    ;; AutoCAD command line.  To see the results after running the example,
    ;; switch to AutoCAD and look at the command line.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (vla-Prompt (vla-get-Utility doc) "Press any key...")
)


PurgeAll Method (ActiveX)

Removes unused named references such as unused blocks or layers from the document.

Supported platforms: Windows only

Signature

VBA:

object.PurgeAll
object

Type: Document

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

This method is the equivalent of entering purge at the Command prompt, selecting the All option, and then choosing Yes to the "Purge Everything?" prompt.

Deleted objects remain in the document until they are purged using this method.

Examples

VBA:

Sub Example_PurgeAll()
    ' This example removes all unused named references from the database

    ThisDrawing.PurgeAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PurgeAll()
    ;; This example removes all unused named references from the database
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (vla-PurgeAll doc)
)


PurgeFitData Method (ActiveX)

Purges the fit data of a spline.

Supported platforms: Windows only

Signature

VBA:

object.PurgeFitData
object

Type: Spline

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

Removes the fit data of a spline.

Examples

VBA:

Sub Example_PurgeFitData()
    ' This example creates a spline object in model space.
    ' It then returns the current number of fit points,
    ' and then purges the fit data.

    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 0: fitPoints(1) = 0: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ZoomAll

    MsgBox "Before the purge there are " & splineObj.NumberOfFitPoints & " fit points.", , "PurgeFitData Example"

    ' Purge the fit data
    splineObj.PurgeFitData

    ThisDrawing.Regen True
    MsgBox "After the purge there are " & splineObj.NumberOfFitPoints & " fit points.", , "PurgeFitData Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PurgeFitData()
    ;; This example creates a spline object in model space.
    ;; It then returns the current number of fit points,
    ;; and then purges the fit data.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the spline
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(0 0 0
                     5 5 0
                     10 0 0
                    )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)

    (alert (strcat "Before the purge there are " (itoa (vla-get-NumberOfFitPoints splineObj)) " fit points."))

    ;; Purge the fit data
    (vla-PurgeFitData splineObj)

    (vla-Regen doc :vlax-true)
    (alert (strcat "After the purge there are " (itoa (vla-get-NumberOfFitPoints splineObj)) " fit points."))
)


PutRemoteFile Method (ActiveX)

Uploads a file to a remote FTP location specified by a URL known to AutoCAD.

Supported platforms: Windows only

Signature

VBA:

object.PutRemoteFile URL, LocalFile
object

Type: Utility

The object this method applies to.

URL

Access: Input-only

Type: String

The URL location to upload the file to.

LocalFile

Access: Input-only

Type: String

The file to upload.

Return Value (RetVal)

No return value.

Remarks

This method is designed to complement the GetRemoteFile method.

When a secure URL is accessed, a dialog box prompts the user for the necessary password information. Message boxes appear if the user has not suppressed this activity in their browser.

Examples

VBA:

Sub Example_PutRemoteFile()
    ' This example transfers a local file to a remote URL.  Since this example
    ' relies on both a remote server name and a local file, you will have to
    ' modify both the DestURL and LocalFile variables below to run this example.

    Dim DestURL As String, LocalFile As String

    ' Define source and destination
    DestURL = "ftp://www.myserver.com/autocadfiles/"
    LocalFile = "c:\program files\autocad\sample\city map.dwg"

    ' Transfer local file to remote location
    ThisDrawing.Utility.PutRemoteFile DestURL, LocalFile

    MsgBox LocalFile & " was just transfered to: " & DestURL
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PutRemoteFile()
    ;; This example transfers a local file to a remote URL.  Since this example
    ;; relies on both a remote server name and a local file, you will have to
    ;; modify both the DestURL and LocalFile variables below to run this example.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define source and destination
    (setq DestURL "ftp://www.myserver.com/autocadfiles/")
    (setq LocalFile "C:\\autocad\\samples\\city map.dwg")

    ;; Transfer local file to remote location
    (vla-PutRemoteFile (vla-get-Utility doc) DestURL LocalFile)

    (alert (strcat LocalFile " was just transfered to: " DestURL))
)


Quit Method (ActiveX)

Closes the drawing file and exits the AutoCAD application.

Supported platforms: Windows only

Signature

VBA:

object.Quit
object

Type: Application

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

If AutoCAD is in the middle of a command, an "AutoCAD unable to service automation request" error message will be generated. If the document has not been saved, you will be prompted to save the drawing.

Examples

VBA:

Sub Example_Quit()
    ' Warning: This example will quit AutoCAD and VBA.

    ThisDrawing.Application.Quit

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Quit()
    ;; Warning: This example will quit AutoCAD.
    (setq acadObj (vlax-get-acad-object))
    (vla-Quit acadObj)
)


RealToString Method (ActiveX)

Converts a real (double) value to a string.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.RealToString(Value, Unit, Precision)
object

Type: Utility

The object this method applies to.

Value

Access: Input-only

Type: Double

The value to be converted.

Unit

Access: Input-only

Type: AcUnits enum

  • acDefaultUnits
  • acScientific
  • acDecimal
  • acEngineering
  • acArchitectural
  • acFractional
Precision

Access: Input-only

Type: Long

The precision of the value. An integer between 0 and 8.

Return Value (RetVal)

Type: String

The value as a properly formatted string.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_RealToString()
    ' This example converts values in a given format to their string equivalents.

    Dim unit As Long
    Dim valueAsStr As String
    Dim precision As Integer
    Dim valueAsReal As Double
    precision = 6

    ' Convert a real value 17.5 using Scientific mode to a String
    unit = acScientific
    valueAsStr = ThisDrawing.Utility.RealToString(17.5, unit, precision)
    MsgBox "17.5 in scientific format is " & valueAsStr, , "RealToString Example"

    ' Convert a real value 17.5 using Decimal mode to a String
    unit = acDecimal
    valueAsStr = ThisDrawing.Utility.RealToString(17.5, unit, precision)
    MsgBox "17.5 in decimal format is " & valueAsStr, , "RealToString Example"

    ' Convert a real value 17.5 using Engineering mode to a String
    unit = acEngineering
    valueAsStr = ThisDrawing.Utility.RealToString(17.5, unit, precision)
    MsgBox "17.5 in engineering format is " & valueAsStr, , "RealToString Example"

    ' Convert a real value 17.5 using Architectural mode to a String
    unit = acArchitectural
    valueAsStr = ThisDrawing.Utility.RealToString(17.5, unit, precision)
    MsgBox "17.5 in architectural format is " & valueAsStr, , "RealToString Example"

    ' Converts a real value 17.5 using fractional mode to a String
    unit = acFractional
    valueAsStr = ThisDrawing.Utility.RealToString(17.5, unit, precision)
    MsgBox "17.5 in fractional format is " & valueAsStr, , "RealToString Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_RealToString()
    ;; This example converts values in a given format to their string equivalents.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq precision 6)

    ;; Convert a real value 17.5 using Scientific mode to a String
    (setq valueAsStr (vla-RealToString (vla-get-Utility doc) 17.5 acScientific precision))
    (alert (strcat "17.5 in scientific format is " valueAsStr))

    ;; Convert a real value 17.5 using Decimal mode to a String
    (setq valueAsStr (vla-RealToString (vla-get-Utility doc) 17.5 acDecimal precision))
    (alert (strcat "17.5 in decimal format is " valueAsStr))

    ;; Convert a real value 17.5 using Engineering mode to a String
    (setq valueAsStr (vla-RealToString (vla-get-Utility doc) 17.5 acEngineering precision))
    (alert (strcat "17.5 in engineering format is " valueAsStr))

    ;; Convert a real value 17.5 using Architectural mode to a String
    (setq valueAsStr (vla-RealToString (vla-get-Utility doc) 17.5 acArchitectural precision))
    (alert (strcat "17.5 in architectural format is " valueAsStr))

    ;; Converts a real value 17.5 using fractional mode to a String
    (setq valueAsStr (vla-RealToString (vla-get-Utility doc) 17.5 acFractional precision))
    (alert (strcat "17.5 in fractional format is " valueAsStr))
)


RecomputeTableBlock Method (ActiveX)

Updates a table block.

Supported platforms: Windows only

Signature

VBA:

object.RecomputeTableBlock bForceUpdate
object

Type: Table

The object this method applies to.

bForceUpdate

Access: Input-only

Type: Boolean

  • True: Table block is updated.
  • False: Table block is not updated.

Return Value (RetVal)

No return value.

Remarks

This function updates the table block record that the Table object references to match changes made to the Table object since the most recent update of the table block record.

Examples

VBA:

Not available

Visual LISP:

Not available


RefreshPlotDeviceInfo Method (ActiveX)

Updates the plot, canonical media, and plot style table information to reflect the current system state.

Supported platforms: Windows only

Signature

VBA:

object.RefreshPlotDeviceInfo
object

Type: Layout, PlotConfiguration

The objects this method applies to.

Return Value (RetVal)

No return value.

Remarks

It is recommended that you refresh your plot device information before you use GetCanonicalMediaNames, GetPlotDeviceNames, or GetPlotStyleTableNames methods for a given AutoCAD session. After that, you need only refresh the information if some part of the device setup changes during the course of the session.

Examples

VBA:

Sub Example_RefreshPlotDeviceInfo()
    ' This example gets the current plot device information,
    ' and then displays the list of plot device names,
    ' media names, localized media names, and plot style
    ' table entries.
    Dim Layout As ACADLayout
    Set Layout = ThisDrawing.ModelSpace.Layout

    ' Refresh the current plot information for
    ' this session.
    Layout.RefreshPlotDeviceInfo

    ' List all the valid device names for the system
    Dim plotDevices As Variant
    plotDevices = Layout.GetPlotDeviceNames()

    Dim x As Integer
    For x = LBound(plotDevices) To UBound(plotDevices)
        MsgBox plotDevices(x)
    Next

    ' List all the media names and their localized version
    Dim mediaNames As Variant
    mediaNames = Layout.GetCanonicalMediaNames()

    For x = LBound(mediaNames) To UBound(mediaNames)
        MsgBox mediaNames(x)
        MsgBox Layout.GetLocaleMediaName(mediaNames(x))
    Next

    ' List all the entries in the plot style table
    Dim styleNames As Variant
    styleNames = Layout.GetPlotStyleTableNames()

    For x = LBound(styleNames) To UBound(styleNames)
        MsgBox styleNames(x)
    Next

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_RefreshPlotDeviceInfo()
    ;; This example gets the current plot device information
    ;; and then displays the list of plot device names,
    ;; media names, localized media names, and plot style
    ;; table entries.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq Layout (vla-get-Layout (vla-get-ModelSpace doc)))

    ;; Refresh the current plot information for
    ;; this session.
    (vla-RefreshPlotDeviceInfo Layout)

    ;; List all the valid device names for the system
    (setq plotDevices (vlax-variant-value (vla-GetPlotDeviceNames Layout)))

    (setq x 0)
    (while (>= (vlax-safearray-get-u-bound plotDevices 1) x)
        (alert (vlax-safearray-get-element plotDevices x))
        (setq x (1+ x))
    )

    ;; List all the media names, and their localized version
    (setq mediaNames (vlax-variant-value (vla-GetCanonicalMediaNames Layout)))

    (setq x 0)
    (while (>= (vlax-safearray-get-u-bound mediaNames 1) x)
        (alert (vlax-safearray-get-element mediaNames x))
        (alert (vla-GetLocaleMediaName Layout (vlax-safearray-get-element mediaNames x)))
        (setq x (1+ x))
    )

    ;; List all the entries in the plot style table
    (setq styleNames (vlax-variant-value (vla-GetPlotStyleTableNames Layout)))

    (setq x 0)
    (while (>= (vlax-safearray-get-u-bound styleNames 1) x)
        (alert (vlax-safearray-get-element styleNames x))
        (setq x (1+ x))
    )
)


Regen Method (ActiveX)

Regenerates the entire drawing and recomputes the screen coordinates and view resolution for all objects.

Supported platforms: Windows only

Signature

VBA:

object.Regen WhichViewports
object

Type: Document

The object this method applies to.

WhichViewports

Access: Input-only

Type: AcRegenType enum

  • acActiveViewport: Regenerates only the active viewport.
  • acAllViewports: Regenerates all viewports on the document.

Return Value (RetVal)

No return value.

Remarks

Regen also reindexes the drawing database for optimum display and better object selection performance.

Examples

VBA:

Sub Example_Regen()
    ' The following example regenerates the complete drawing
    ThisDrawing.Regen acAllViewports

    ' The following example regenerates the active viewport in the current drawing
    ThisDrawing.Regen acActiveViewport

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Regen()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; The following example regenerates the complete drawing
    (vla-Regen doc acAllViewports)

    ;; The following example regenerates the active viewport in the current drawing
    (vla-Regen doc acActiveViewport)
)


Reload Method (ActiveX)

Reloads the external reference (xref).

Supported platforms: Windows only

Signature

VBA:

object.Reload
object

Type: ExternalReference

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

When you reload an xref, the most recently saved version of the referenced drawing is loaded into the current drawing.

Examples

VBA:

Sub Example_Reload()
    On Error GoTo ERRORHANDLER

    ' Define external reference to be inserted
    Dim xrefHome As AcadBlock
    Dim xrefInserted As AcadExternalReference
    Dim insertionPnt(0 To 2) As Double
    Dim PathName As String
    insertionPnt(0) = 1
    insertionPnt(1) = 1
    insertionPnt(2) = 0
    PathName = "c:/AutoCAD/sample/City map.dwg"

    ' Add the external reference to the block
    Set xrefInserted = ThisDrawing.ModelSpace. _
            AttachExternalReference(PathName, "XREF_IMAGE", _
            insertionPnt, 1, 1, 1, 0, False)
    ZoomAll
    MsgBox "The external reference is attached."

    ' Reload the external reference definition
    ThisDrawing.Blocks.Item(xrefInserted.name).Reload
    MsgBox "The external reference is reloaded."
    Exit Sub
ERRORHANDLER:
    MsgBox Err.Description
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Reload()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define external reference to be inserted
    (setq insertionPnt (vlax-3d-point 1 1 0)
          pathName (findfile ".\\Sample\\Sheet Sets\\Architectural\\Res\\STAIR1.dwg"))

    ;; Add the external reference to the block
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq xrefInserted (vla-AttachExternalReference modelSpace pathName "XREF_IMAGE" insertionPnt 1 1 1 0 :vlax-false))
    (vla-ZoomAll acadObj)
    (alert "The external reference is attached.")

    ;; Unload the external reference definition
    (vla-Unload (vla-Item (vla-get-Blocks doc) "XREF_IMAGE"))
    (vla-Regen doc :vlax-true)
    (alert "The external reference is unloaded.")

    ;; Reload the external reference definition
    (vla-Reload (vla-Item (vla-get-Blocks doc) "XREF_IMAGE"))
    (alert "The external reference is reloaded.")
)


Remove Method (ActiveX)

Removes a named object from the dictionary.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.Remove(Name)
object

Type: Dictionary

The object this method applies to.

Name

Access: Input-only

Type: String

The name (keyword) of the object to be removed from the dictionary.

Return Value (RetVal)

Type: Object

The object being removed from the dictionary.

Remarks

For example, removing the object with the name "FirstKeyword" from the following dictionary:

  • MyDictionary
  • Keyword Object
  • FirstKeyword Object1
  • SecondKeyword Object2

Results in the following dictionary:

  • MyDictionary
  • Keyword Object
  • SecondKeyword Object2

Examples

VBA:

Sub Example_Remove()
    ' This example creates a dictionary and adds
    ' a custom object to that dictionary. It then
    ' removes the object from the dictionary.

    Dim dictObj As AcadDictionary
    Set dictObj = ThisDrawing.Dictionaries.Add("TEST_DICTIONARY")

    ' Load the ObjectARX application that defines the custom object.
    ' Note: The application listed here does not exist and
    ' will cause an error when run. Change the application name
    ' to the path and name of your ObjectARX Application.
    ThisDrawing.Application.LoadArx "MyARXApp.arx"

    ' Create the custom object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadObject

    keyName = "OBJ1"
    className = "CAsdkDictObject"

    Set customObj = dictObj.AddObject(keyName, className)

    ' Remove the object from the dictionary using the keyName
    dictObj.Remove keyName

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Remove()
    ;; This example creates a dictionary and adds
    ;; a custom object to that dictionary. It then
    ;; removes the object from the dictionary.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq dictionaries (vla-get-Dictionaries doc))

    (setq dictObj (vla-Add dictionaries "TEST_DICTIONARY"))

    ;; Load the ObjectARX application that defines the custom object.
    ;; Note: The application listed here does not exist and
    ;; will cause an error when run. Change the application name
    ;; to the path and name of your ObjectARX Application.
    (vla-LoadArx acadObj "MyARXApp.arx")

    ;; Create the custom object in the dictionary
    (setq keyName "OBJ1")
    (setq className "CAsdkDictObject")

    (setq customObj (vla-AddObject dictObj keyName className))

    ;; Remove the object from the dictionary using the keyName
    (vla-Remove dictObj keyName)
)


RemoveAllOverrides Method (ActiveX)

Removes all the overrides for a cell.

Supported platforms: Windows only

Signature

VBA:

object.RemoveAllOverrides nRow, nCol
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Integer

The row number of the cell to set.

nCol

Access: Input-only

Type: Integer

The column number of the cell to set.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


RemoveCustomByIndex Method (ActiveX)

Deletes the custom property name (key) and value that correspond to an index value.

Supported platforms: Windows only

Signature

VBA:

object.RemoveCustomByIndex Index
object

Type: SummaryInfo

The object this method applies to.

Index

Access: Input-only

Type: Long

The index value of the property you want to delete. The index range is from zero to one less than the number of custom properties.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_RemoveCustomByIndex()
    ' This example shows how to access drawing properties

    ' Add and display standard properties
    ThisDrawing.SummaryInfo.Author = "John Doe"
    ThisDrawing.SummaryInfo.Comments = "Includes all ten levels of Building Five"
    ThisDrawing.SummaryInfo.HyperlinkBase = "http://www.autodesk.com"
    ThisDrawing.SummaryInfo.Keywords = "Building Complex"
    ThisDrawing.SummaryInfo.LastSavedBy = "JD"
    ThisDrawing.SummaryInfo.RevisionNumber = "4"
    ThisDrawing.SummaryInfo.Subject = "Plan for Building Five"
    ThisDrawing.SummaryInfo.Title = "Building Five"

    Author = ThisDrawing.SummaryInfo.Author
    Comments = ThisDrawing.SummaryInfo.Comments
    HLB = ThisDrawing.SummaryInfo.HyperlinkBase
    KW = ThisDrawing.SummaryInfo.Keywords
    LSB = ThisDrawing.SummaryInfo.LastSavedBy
    RN = ThisDrawing.SummaryInfo.RevisionNumber
    Subject = ThisDrawing.SummaryInfo.Subject
    Title = ThisDrawing.SummaryInfo.Title
    MsgBox "The standard drawing properties are " & vbCrLf & _
           "Author = " & Author & vbCrLf & _
           "Comments = " & Comments & vbCrLf & _
           "HyperlinkBase = " & HLB & vbCrLf & _
           "Keywords = " & KW & vbCrLf & _
           "LastSavedBy = " & LSB & vbCrLf & _
           "RevisionNumber = " & RN & vbCrLf & _
           "Subject = " & Subject & vbCrLf & _
           "Title = " & Title & vbCrLf

    ' Add and display custom properties
    Dim Key0 As String
    Dim Value0 As String
    Dim Key1 As String
    Dim Value1 As String
    Dim CustomPropertyBranch As String
    Dim PropertyBranchValue As String
    Dim CustomPropertyZone As String
    Dim PropertyZoneValue As String

    CustomPropertyBranch = "Branch"
    PropertyBranchValue = "Main"
    CustomPropertyZone = "Zone"
    PropertyZoneValue = "Industrial"

    ' Add custom properties
    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 1) Then
        ThisDrawing.SummaryInfo.SetCustomByIndex 0, CustomPropertyBranch, PropertyBranchValue
    Else
        ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyBranch, PropertyBranchValue
    End If

    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 2) Then
         ThisDrawing.SummaryInfo.SetCustomByKey CustomPropertyBranch, "Satellite"
    Else
         ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyZone, PropertyZoneValue
    End If

    'Get custom properties
    ThisDrawing.SummaryInfo.GetCustomByIndex 0, Key0, Value0
    Key1 = CustomPropertyZone
    ThisDrawing.SummaryInfo.GetCustomByKey Key1, Value1

    MsgBox "The custom drawing properties are " & vbCrLf & _
           "First property name = " & Key0 & vbCrLf & _
           "First property value = " & Value0 & vbCrLf & _
           "Second property name = " & Key1 & vbCrLf & _
           "Second property value = " & Value1 & vbCrLf
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_RemoveCustomByIndex()
    ;; This example shows how to access drawing properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq summaryInfo (vla-get-SummaryInfo doc))

    ;; Add and display standard properties
    (vla-put-Author summaryInfo "John Doe")
    (vla-put-Comments summaryInfo "Includes all ten levels of Building Five")
    (vla-put-HyperlinkBase summaryInfo "http://www.autodesk.com")
    (vla-put-Keywords summaryInfo "Building Complex")
    (vla-put-LastSavedBy summaryInfo "JD")
    (vla-put-RevisionNumber summaryInfo "4")
    (vla-put-Subject summaryInfo "Plan for Building Five")
    (vla-put-Title summaryInfo "Building Five")

    (setq author (vla-get-Author summaryInfo))
    (setq comments (vla-get-Comments summaryInfo))
    (setq HLB (vla-get-HyperlinkBase summaryInfo))
    (setq KW (vla-get-Keywords summaryInfo))
    (setq LSB (vla-get-LastSavedBy summaryInfo))
    (setq RN (vla-get-RevisionNumber summaryInfo))
    (setq subject (vla-get-Subject summaryInfo))
    (setq Title (vla-get-Title summaryInfo))
    (alert (strcat "The standard drawing properties are "
                   "\nAuthor = " author
                   "\nComments = " comments
                   "\nHyperlinkBase = " HLB
                   "\nKeywords = " KW
                   "\nLastSavedBy = " LSB
                   "\nRevisionNumber = " RN
                   "\nSubject = " Subject
                   "\nTitle = " Title
           )
    )

    ;; Add and display custom properties
    (setq CustomPropertyBranch "Branch")
    (setq PropertyBranchValue "Main")
    (setq CustomPropertyZone "Zone")
    (setq PropertyZoneValue "Industrial")

    ;; Add custom properties
    (if (>= (vla-NumCustomInfo summaryInfo) 1)
        (vla-SetCustomByIndex summaryInfo 0 CustomPropertyBranch PropertyBranchValue)
        (vla-AddCustomInfo summaryInfo CustomPropertyBranch PropertyBranchValue)
    )

    (if (>= (vla-NumCustomInfo summaryInfo) 2)
        (vla-SetCustomByKey summaryInfo CustomPropertyBranch "Satellite")
        (vla-AddCustomInfo summaryInfo CustomPropertyZone PropertyZoneValue)
    )

    ;; Get custom properties
    (vla-GetCustomByIndex summaryInfo 0 'Key0 'Value0)
    (setq Key1 CustomPropertyZone)
    (vla-GetCustomByKey summaryInfo Key1 'Value1)

    (alert (strcat "The custom drawing properties are "
                   "\nFirst property name = " Key0
                   "\nFirst property value = " Value0
                   "\nSecond property name = " Key1
                   "\nSecond property value = " Value1
           )
    )

    ;; Remove custom properties
    (vla-RemoveCustomByIndex summaryInfo 0)
    (vla-RemoveCustomByKey summaryInfo Key1)
)


RemoveCustomByKey Method (ActiveX)

Deletes the custom property value that corresponds to a name (key) value.

Supported platforms: Windows only

Signature

VBA:

object.RemoveCustomByKey key
object

Type: SummaryInfo

The object this method applies to.

key

Access: Input-only

Type: String

The name of the custom property that you want to delete.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_RemoveCustomByKey()
    ' This example shows how to access drawing properties

    ' Add and display standard properties
    ThisDrawing.SummaryInfo.Author = "John Doe"
    ThisDrawing.SummaryInfo.Comments = "Includes all ten levels of Building Five"
    ThisDrawing.SummaryInfo.HyperlinkBase = "http://www.autodesk.com"
    ThisDrawing.SummaryInfo.Keywords = "Building Complex"
    ThisDrawing.SummaryInfo.LastSavedBy = "JD"
    ThisDrawing.SummaryInfo.RevisionNumber = "4"
    ThisDrawing.SummaryInfo.Subject = "Plan for Building Five"
    ThisDrawing.SummaryInfo.Title = "Building Five"

    Author = ThisDrawing.SummaryInfo.Author
    Comments = ThisDrawing.SummaryInfo.Comments
    HLB = ThisDrawing.SummaryInfo.HyperlinkBase
    KW = ThisDrawing.SummaryInfo.Keywords
    LSB = ThisDrawing.SummaryInfo.LastSavedBy
    RN = ThisDrawing.SummaryInfo.RevisionNumber
    Subject = ThisDrawing.SummaryInfo.Subject
    Title = ThisDrawing.SummaryInfo.Title
    MsgBox "The standard drawing properties are " & vbCrLf & _
           "Author = " & Author & vbCrLf & _
           "Comments = " & Comments & vbCrLf & _
           "HyperlinkBase = " & HLB & vbCrLf & _
           "Keywords = " & KW & vbCrLf & _
           "LastSavedBy = " & LSB & vbCrLf & _
           "RevisionNumber = " & RN & vbCrLf & _
           "Subject = " & Subject & vbCrLf & _
           "Title = " & Title & vbCrLf

    ' Add and display custom properties
    Dim Key0 As String
    Dim Value0 As String
    Dim Key1 As String
    Dim Value1 As String
    Dim CustomPropertyBranch As String
    Dim PropertyBranchValue As String
    Dim CustomPropertyZone As String
    Dim PropertyZoneValue As String

    CustomPropertyBranch = "Branch"
    PropertyBranchValue = "Main"
    CustomPropertyZone = "Zone"
    PropertyZoneValue = "Industrial"

    ' Add custom properties
    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 1) Then
        ThisDrawing.SummaryInfo.SetCustomByIndex 0, CustomPropertyBranch, PropertyBranchValue
    Else
        ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyBranch, PropertyBranchValue
    End If

    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 2) Then
         ThisDrawing.SummaryInfo.SetCustomByKey CustomPropertyBranch, "Satellite"
    Else
         ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyZone, PropertyZoneValue
    End If

    'Get custom properties
    ThisDrawing.SummaryInfo.GetCustomByIndex 0, Key0, Value0
    Key1 = CustomPropertyZone
    ThisDrawing.SummaryInfo.GetCustomByKey Key1, Value1

    MsgBox "The custom drawing properties are " & vbCrLf & _
           "First property name = " & Key0 & vbCrLf & _
           "First property value = " & Value0 & vbCrLf & _
           "Second property name = " & Key1 & vbCrLf & _
           "Second property value = " & Value1 & vbCrLf
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_RemoveCustomByKey()
    ;; This example shows how to access drawing properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq summaryInfo (vla-get-SummaryInfo doc))

    ;; Add and display standard properties
    (vla-put-Author summaryInfo "John Doe")
    (vla-put-Comments summaryInfo "Includes all ten levels of Building Five")
    (vla-put-HyperlinkBase summaryInfo "http://www.autodesk.com")
    (vla-put-Keywords summaryInfo "Building Complex")
    (vla-put-LastSavedBy summaryInfo "JD")
    (vla-put-RevisionNumber summaryInfo "4")
    (vla-put-Subject summaryInfo "Plan for Building Five")
    (vla-put-Title summaryInfo "Building Five")

    (setq author (vla-get-Author summaryInfo))
    (setq comments (vla-get-Comments summaryInfo))
    (setq HLB (vla-get-HyperlinkBase summaryInfo))
    (setq KW (vla-get-Keywords summaryInfo))
    (setq LSB (vla-get-LastSavedBy summaryInfo))
    (setq RN (vla-get-RevisionNumber summaryInfo))
    (setq subject (vla-get-Subject summaryInfo))
    (setq Title (vla-get-Title summaryInfo))
    (alert (strcat "The standard drawing properties are "
                   "\nAuthor = " author
                   "\nComments = " comments
                   "\nHyperlinkBase = " HLB
                   "\nKeywords = " KW
                   "\nLastSavedBy = " LSB
                   "\nRevisionNumber = " RN
                   "\nSubject = " Subject
                   "\nTitle = " Title
           )
    )

    ;; Add and display custom properties
    (setq CustomPropertyBranch "Branch")
    (setq PropertyBranchValue "Main")
    (setq CustomPropertyZone "Zone")
    (setq PropertyZoneValue "Industrial")

    ;; Add custom properties
    (if (>= (vla-NumCustomInfo summaryInfo) 1)
        (vla-SetCustomByIndex summaryInfo 0 CustomPropertyBranch PropertyBranchValue)
        (vla-AddCustomInfo summaryInfo CustomPropertyBranch PropertyBranchValue)
    )

    (if (>= (vla-NumCustomInfo summaryInfo) 2)
        (vla-SetCustomByKey summaryInfo CustomPropertyBranch "Satellite")
        (vla-AddCustomInfo summaryInfo CustomPropertyZone PropertyZoneValue)
    )

    ;; Get custom properties
    (vla-GetCustomByIndex summaryInfo 0 'Key0 'Value0)
    (setq Key1 CustomPropertyZone)
    (vla-GetCustomByKey summaryInfo Key1 'Value1)

    (alert (strcat "The custom drawing properties are "
                   "\nFirst property name = " Key0
                   "\nFirst property value = " Value0
                   "\nSecond property name = " Key1
                   "\nSecond property value = " Value1
           )
    )

    ;; Remove custom properties
    (vla-RemoveCustomByIndex summaryInfo 0)
    (vla-RemoveCustomByKey summaryInfo Key1)
)


RemoveEntry Method (ActiveX)

Removes an identified entry from the File Dependency List.

Supported platforms: Windows only

Signature

VBA:

object.RemoveEntry Index, forceRemove
object

Type: FileDependencies

The object this method applies to.

Index

Access: Input-only

Type: Long

The index of the entry to remove.

forceRemove

Access: Input-only

Type: Boolean

  • True: Removes an entry with multiple references regardless of its reference count.
  • False: Removes it only if the reference count is zero.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_RemoveEntry()
    ' This example adds an entry to the File Dependency List, returns its Index, updates
    ' the entry, and then removes the entry.

    Dim objFDLCol As AutoCAD.AcadFileDependencies
    Dim objFDL As AutoCAD.AcadFileDependency

    Set objFDLCol = ThisDrawing.FileDependencies
    MsgBox "The number of entries in the File Dependency List is " & objFDLCol.Count & "."

    Dim FDLIndex As Long
    FDLIndex = objFDLCol.CreateEntry("acad:xref", "c:\referenced.dwg", True, True)
    MsgBox "The number of entries in the File Dependency List is " & objFDLCol.Count & "."

    Dim IndexNumber As Long
    IndexNumber = objFDLCol.IndexOf("acad:xref", "c:\referenced.dwg")
    Dim IndexString As String
    IndexString = CStr(IndexNumber)
    MsgBox "The index of the new entry is " & IndexString & "."

    objFDLCol.UpdateEntry FDLIndex

    objFDLCol.RemoveEntry FDLIndex, True
    MsgBox "The number of entries in the File Dependency List is " & objFDLCol.Count & "."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_RemoveEntry()
    ;; This example adds an entry to the File Dependency List, returns its Index, updates
    ;; the entry, and then removes the entry.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq objFDLCol (vla-get-FileDependencies doc))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))

    (setq FDLIndex (vla-CreateEntry objFDLCol "acad:xref"
                                   (findfile ".\\Sample\\Sheet Sets\\Architectural\\Res\\Exterior Elevations.dwg") :vlax-true :vlax-true))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))

    (setq IndexNumber (vla-IndexOf objFDLCol "acad:xref" (findfile ".\\Sample\\Sheet Sets\\Architectural\\Res\\Exterior Elevations.dwg")))
    (alert (strcat "The index of the new entry is " (itoa IndexNumber) "."))

    (vla-UpdateEntry objFDLCol FDLIndex)

    (vla-RemoveEntry objFDLCol FDLIndex :vlax-true)
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))
)


RemoveFromMenuBar Method (ActiveX)

Removes the popup menu from the AutoCAD menu bar.

Supported platforms: Windows only

Signature

VBA:

object.RemoveFromMenuBar
object

Type: PopupMenu

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_RemoveFromMenuBar()
    ' This example creates a new menu called TestMenu and inserts a menu item
    ' into it. The menu is then displayed on the menu bar, and then
    ' removed from the menu bar.

    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    ' Create the new menu
    Dim newMenu As AcadPopupMenu
    Set newMenu = currMenuGroup.Menus.Add("TestMenu")

    ' Add a menu item to the new menu
    Dim newMenuItem As AcadPopupMenuItem
    Dim openMacro As String
    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set newMenuItem = newMenu.AddMenuItem(newMenu.count + 1, "Open", openMacro)

    ' Display the menu on the menu bar
    newMenu.InsertInMenuBar ThisDrawing.Application.MenuBar.count + 1
    GoSub QUERYMENU

    ' Remove the menu from the menu bar
    newMenu.RemoveFromMenuBar
    GoSub QUERYMENU
    Exit Sub

QUERYMENU:
    If newMenu.OnMenuBar Then
        MsgBox "The menu called " & newMenu.name & " is on the menu bar."
    Else
        MsgBox "The menu called " & newMenu.name & " is not on the menu bar."
    End If
    Return

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_RemoveFromMenuBar()
    ;; This example creates a new menu called TestMenu and inserts a menu item
    ;; into it. The menu is then displayed on the menu bar, and then
    ;; removed from the menu bar.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new menu
    (setq newMenu (vla-Add (vla-get-Menus currMenuGroup) "TestMenu"))

    ;; Add a menu item to the new menu
    ;; Assign the macro string the VB equivalent of "ESC ESC _open "
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))
    (setq newMenuItem (vla-AddMenuItem newMenu (1+ (vla-get-Count newMenu)) "Open" openMacro))

    ;; Display the menu on the menu bar
    (vla-InsertInMenuBar newMenu (1+ (vla-get-Count (vla-get-MenuBar acadObj))))

    (if (= (vla-get-OnMenuBar newMenu) :vlax-true)
        (alert (strcat "The menu called " (vla-get-Name newMenu) " is on the menu bar."))
        (alert (strcat "The menu called " (vla-get-Name newMenu) " is not on the menu bar."))
    )

    ;; Remove the menu from the menu bar
    (vla-RemoveFromMenuBar newMenu)

    (if (= (vla-get-OnMenuBar newMenu) :vlax-true)
        (alert (strcat "The menu called " (vla-get-Name newMenu) " is on the menu bar."))
        (alert (strcat "The menu called " (vla-get-Name newMenu) " is not on the menu bar."))
    )
)


RemoveItems Method (ActiveX)

Removes specified items from the group or selection set.

Supported platforms: Windows only

Signature

VBA:

object.RemoveItems Objects
object

Type: Group, SelectionSet

The objects this method applies to.

Objects

Access: Input-only

Type: Variant (array of objects)

An array of objects to be removed.

Return Value (RetVal)

No return value.

Remarks

Items removed from a group or selection set remain in the drawing; they are simply no longer associated to the group or selection set. This functionality mimics the functionality found in the Clear method, except that RemoveItems allows you to specify individual items to be removed instead of the entire selection set.

This method differs from the Delete and Erase methods in that it does not remove objects from the drawing.

Examples

VBA:

Sub Example_RemoveItems()
    ' This example creates a selection set and several objects.
    ' It adds the objects to the selection set, and then
    ' removes two of the objects from the selection set.

    ' Create the new selection set
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_SELECTIONSET")

    ' Create a Ray object in model space
    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)

    ' Create a polyline object in model space
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True

    ' Create a line object in model space
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ' Create a circle object in model space
    Dim circObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 20: centerPt(1) = 30: centerPt(2) = 0
    radius = 3
    Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)

    ' Create an ellipse object in model space
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    ZoomAll

    ' Iterate through the model space collection.
    ' Collect the objects found into an array of objects
    ' to be added to the selection set.
    ReDim ssobjs(0 To ThisDrawing.ModelSpace.Count - 1) As AcadEntity
    Dim I As Integer
    For I = 0 To ThisDrawing.ModelSpace.Count - 1
        Set ssobjs(I) = ThisDrawing.ModelSpace.Item(I)
    Next

    ' Add the array of objects to the selection set
    ssetObj.AddItems ssobjs
    GoSub LISTOBJS

    ' Remove two of the objects from the selection set
    Dim removeObjects(0 To 1) As AcadEntity
    Set removeObjects(0) = ellObj
    Set removeObjects(1) = circObj
    ssetObj.RemoveItems removeObjects
    MsgBox "The ellipse and circle have been removed from the selection set."
    GoSub LISTOBJS

    Exit Sub

LISTOBJS:

    ' List all the objects in the selection set
    If ssetObj.Count = 0 Then
        MsgBox "The selection set is empty"
    Else
        For I = 0 To ssetObj.Count - 1
            MsgBox "The selection set contains: " & ssetObj.Item(I).ObjectName
        Next
    End If
    Return

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_RemoveItems()
    ;; This example creates a selection set and several objects.
    ;; It adds the objects to the selection set, and then
    ;; removes two of the objects from the selection set.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Create the new selection set
    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_SELECTIONSET"))

    ;; Create a Ray object in model space
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 1 3 0))
    (setq rayObj (vla-AddRay modelSpace basePoint SecondPoint))

    ;; Create a polyline object in model space
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
                                  9 2
                  3 5
                 )
    )
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)

    ;; Create a line object in model space
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 2 2 0))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    ;; Create a circle object in model space
    (setq centerPt (vlax-3d-point 20 30 0)
          radius 3)
    (setq circObj (vla-AddCircle modelSpace centerPt radius))

    ;; Create an ellipse object in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

    (vla-ZoomAll acadObj)

    ;; Iterate through the model space collection.
    ;; Collect the objects found into an array of objects
    ;; to be added to the selection set.
    (setq ssobjs (vlax-make-safearray vlax-vbObject (cons 0 (- (vla-get-Count modelSpace) 1))))

    (setq cnt 0)
    (vlax-for each-item modelSpace
        (vlax-safearray-put-element ssobjs cnt each-item)
        (setq cnt (1+ cnt))
    )

    ;; Add the array of objects to the selection set
    (vla-AddItems ssetObj ssobjs)

    ;; List all the objects in the selection set
    (setq I 0)
    (if (= (vla-get-Count ssetObj) 0)
        (alert "The selection set is empty")
        (while (>= (1- (vla-get-Count ssetObj)) I)
            (alert (strcat "The selection set contains: " (vla-get-ObjectName (vla-Item ssetObj I))))

            (setq I (1+ I))
        )
    )

    ;; Remove two of the objects from the selection set
    (setq removeObjects (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element removeObjects 0 ellObj)
    (vlax-safearray-put-element removeObjects 1 circObj)

    (vla-RemoveItems ssetObj removeObjects)
    (alert "The ellipse and circle have been removed from the selection set.")

    ;; List all the objects in the selection set
    (setq I 0)
    (if (= (vla-get-Count ssetObj) 0)
        (alert "The selection set is empty")
        (while (>= (1- (vla-get-Count ssetObj)) I)
            (alert (strcat "The selection set contains: " (vla-get-ObjectName (vla-Item ssetObj I))))

            (setq I (1+ I))
        )
    )

    (vla-Delete ssetObj)
)


RemoveLeader Method (ActiveX)

Removes the leader cluster with specified index.

Supported platforms: Windows only

Signature

VBA:

object.RemoveLeader leaderIndex
object

Type: MLeader

The object this method applies to.

leaderIndex

Access: Input-only

Type: Long

The leader index.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


RemoveLeaderLine Method (ActiveX)

Removes the leaderLine with specified index.

Supported platforms: Windows only

Signature

VBA:

object.RemoveLeaderLine leaderLineIndex
object

Type: MLeader

The object this method applies to.

leaderLineIndex

Access: Input-only

Type: Long

The leader line index.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


RemoveMenuFromMenuBar Method (ActiveX)

Removes the popup menu, as specified from the collection, from the AutoCAD menu bar.

Supported platforms: Windows only

Signature

VBA:

object.RemoveMenuFromMenuBar Index
object

Type: PopupMenus

The object this method applies to.

Index

Access: Input-only

Type: Variant

The index in the menu bar of the popup menu to remove. The index must be either an integer or a string. If an integer, the index must be between 0 and N-1, where N is the number of popup menus in the menu bar. If a string, the name of the popup menu must contain any underscore that appears in the menu.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_RemoveMenuFromMenuBar()
    ' This example creates a new menu called TestMenu and inserts a menu item
    ' into it. The menu is displayed on the menu bar, and then
    ' removed from the menu bar.

    Dim currMenuGroup As AcadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    ' Create the new menu
    Dim newMenu As AcadPopupMenu
    Set newMenu = currMenuGroup.Menus.Add("TestMenu3")

    ' Add a menu item to the new menu
    Dim newMenuItem As AcadPopupMenuItem
    Dim openMacro As String
    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set newMenuItem = newMenu.AddMenuItem(newMenu.Count + 1, "Open", openMacro)

    ' Display the menu on the menu bar
    newMenu.InsertInMenuBar ThisDrawing.Application.MenuBar.Count + 1
    GoSub QUERYMENU

    ' Remove the menu from the menu bar
    currMenuGroup.Menus.RemoveMenuFromMenuBar "TestMenu3"
    GoSub QUERYMENU
    Exit Sub

QUERYMENU:
    If newMenu.OnMenuBar Then
        MsgBox "The menu called " & newMenu.Name & " is on the menu bar."
    Else
        MsgBox "The menu called " & newMenu.Name & " is not on the menu bar."
    End If
    Return

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_RemoveMenuFromMenuBar()
    ;; This example creates a new menu called TestMenu and inserts a menu item
    ;; into it. The menu is displayed on the menu bar, and then
    ;; removed from the menu bar.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new menu
    (setq newMenu (vla-Add (vla-get-Menus currMenuGroup) "TestMenu"))

    ;; Add a menu item to the new menu
    ;; Assign the macro string the VB equivalent of "ESC ESC _open "
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))
    (setq newMenuItem (vla-AddMenuItem newMenu (1+ (vla-get-Count newMenu)) "Open" openMacro))

    ;; Display the menu on the menu bar
    (vla-InsertInMenuBar newMenu (1+ (vla-get-Count (vla-get-MenuBar acadObj))))

    (if (= (vla-get-OnMenuBar newMenu) :vlax-true)
        (alert (strcat "The menu called " (vla-get-Name newMenu) " is on the menu bar."))
        (alert (strcat "The menu called " (vla-get-Name newMenu) " is not on the menu bar."))
    )

    ;; Remove the menu from the menu bar
    (vla-RemoveMenuFromMenuBar (vla-get-Menus currMenuGroup) "TestMenu")

    (if (= (vla-get-OnMenuBar newMenu) :vlax-true)
        (alert (strcat "The menu called " (vla-get-Name newMenu) " is on the menu bar."))
        (alert (strcat "The menu called " (vla-get-Name newMenu) " is not on the menu bar."))
    )
)


RemoveVertex method (ActiveX)

Removes a vertex in the section line.

Supported platforms: Windows only

Signature

VBA:

object.RemoveVertex nIndex
object

Type: Section

The object this method applies to.

nIndex

Access: Input-only

Type: Long

The index of the vertex to be removed.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Rename Method (ActiveX)

Renames an item in a dictionary or a set of saved layer settings.

Supported platforms: Windows only

Signature

VBA:

object.Rename OldName, NewName
object

Type: Dictionary, LayerStateManager

The objects this method applies to.

OldName

Access: Input-only

Type: String

The current name (keyword) of the object in the dictionary, or the name of a set of saved layer settings.

NewName

Access: Input-only

Type: String

The new name (keyword) for the object in the dictionary, or the new name of the saved layer settings.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Rename()
    ' This example creates a dictionary and adds
    ' a custom object to that dictionary. It then
    ' renames the object in the dictionary.

    Dim dictObj As AcadDictionary
    Set dictObj = ThisDrawing.Dictionaries.Add("TEST_DICTIONARY")

    ' Load the ObjectARX application that defines the custom object.
    ' Note: The application listed here does not exist and
    ' will cause an error when run. Change the application name
    ' to the path and name of your ObjectARX application.
    ThisDrawing.Application.LoadArx "MyARXApp.dll"

    ' Create the custom object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadObject

    keyName = "OBJ1"
    className = "CAsdkDictObject"

    Set customObj = dictObj.AddObject(keyName, className)

    ' Rename the object
    dictObj.Rename keyName, "NewKeyName"

End Sub

Public Sub Example_RenameLayerSettings()
    ' This example renames a set of saved layer settings from
    ' "ColorLinetype" to "OldColorLinetype."

    Dim oLSM As AcadLayerStateManager

    ' Access the LayerStateManager object.
    Set oLSM = ThisDrawing.Application. _
       GetInterfaceObject("AutoCAD.AcadLayerStateManager.19")

    ' Associate the current drawing database with the
    ' LayerStateManager object.
    oLSM.SetDatabase ThisDrawing.Database

    ' Rename the saved layer settings.
    oLSM.Rename "ColorLinetype", "OldColorLinetype"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Rename()
    ;; This example creates a dictionary and adds
    ;; a custom object to that dictionary. It then
    ;; renames the object in the dictionary.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq dictionaries (vla-get-Dictionaries doc))

    (setq dictObj (vla-Add dictionaries "TEST_DICTIONARY"))

    ;; Load the ObjectARX application that defines the custom object.
    ;; Note: The application listed here does not exist and
    ;; will cause an error when run. Change the application name
    ;; to the path and name of your ObjectARX application.
    (vla-LoadArx acadObj "MyARXApp.dll")

    ;; Create the custom object in the dictionary
    (setq keyName "OBJ1")
    (setq className "CAsdkDictObject")

    (setq customObj (vla-AddObject dictObj keyName className))

    ;; Rename the object
    (vla-Rename dictObj keyName "NewKeyName")
)

(defun c:Example_RenameLayerSettings()
    ;; This example renames a set of saved layer settings from
    ;; "ColorLinetype" to "OldColorLinetype."
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Access the LayerStateManager object.
    (setq oLSM (vla-GetInterfaceObject acadObj "AutoCAD.AcadLayerStateManager.19"))

    ;; Associate the current drawing database with the
    ;; LayerStateManager object.
    (vla-SetDatabase oLSM (vla-get-Database doc))

    (vla-Save oLSM "ColorLinetype" (+ acLsColor acLsLineType))

    ;; Rename the saved layer settings.
    (vla-Rename oLSM "ColorLinetype" "OldColorLinetype")
)


RenameCellStyle Method (ActiveX)

Renames a cell style.

Supported platforms: Windows only

Signature

VBA:

object.RenameCellStyle StringOldName, StringNewName
object

Type: TableStyle

The object this method applies to.

StringOldName

Access: Input-only

Type: String

The old cell style name.

StringNewName

Access: Input-only

Type: String

The new cell style name.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellStyle()
    ' This example creates a TableStyle object and sets values for
    ' the style name and formatting.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As IAcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.CreateCellStyle ("NewTestStyle")
    Dim cellTestFormat As String

    customObj.SetFormat2 "NewTestStyle", "test format"
    customObj.GetFormat2 "NewTestStyle", cellTestFormat

    MsgBox "Cell Style Name = " & cellTestFormat

    customObj.RenameCellStyle "NewTestStyle", "NewTestStyle2"
    customObj.GetFormat2 "NewTestStyle2", cellTestFormat

    MsgBox "Cell Style Name = " & cellTestFormat

    Dim uniqueStyleName As String

    uniqueStyleName = customObj.GetUniqueCellStyleName("testbase")

    MsgBox "Cell Style Name = " & uniqueStyleName

    If customObj.GetIsCellStyleInUse("testbase") = False Then
        MsgBox "That cell style is not being used!"
    End If

    customObj.CreateCellStyleFromStyle "TestStyleFromStyle", "NewTestStyle2"

    customObj.DeleteCellStyle "NewTestStyle2"

    Dim numOfStyles As Long
    numOfStyles = customObj.NumCellStyles
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellStyle()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and formatting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-CreateCellStyle customObj "NewTestStyle")

    (setq cellTestFormat "")
    (vla-SetFormat2 customObj "NewTestStyle" "test format")
    (vla-GetFormat2 customObj "NewTestStyle" 'cellTestFormat)

    (alert (strcat "Cell Style Name = " cellTestFormat))

    (vla-RenameCellStyle customObj "NewTestStyle" "NewTestStyle2")
    (vla-GetFormat2 customObj "NewTestStyle2" 'cellTestFormat)

    (alert (strcat "Cell Style Name = " cellTestFormat))

    (setq uniqueStyleName (vla-GetUniqueCellStyleName customObj "testbase"))

    (alert (strcat "Cell Style Name = " uniqueStyleName))

    (if (= (vla-GetIsCellStyleInUse customObj "testbase") :vlax-false)
        (alert "That cell style is not being used!")
    )

    (vla-CreateCellStyleFromStyle customObj "TestStyleFromStyle" "NewTestStyle2")

    (vla-DeleteCellStyle customObj "NewTestStyle2")

    (setq numOfStyles (vla-get-NumCellStyles customObj))
    (alert (strcat "Number of Cell Styles = " (itoa numOfStyles)))
)


RenameProfile Method (ActiveX)

Renames the specified profile.

Supported platforms: Windows only

Signature

VBA:

object.RenameProfile origProfileName, newProfileName
object

Type: PreferencesProfiles

The object this method applies to.

origProfileName

Access: Input-only

Type: String

The current profile name.

newProfileName

Access: Input-only

Type: String

The new name for the profile.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_RenameProfile()
    ' This example renames an existing profile.
    ' You can see the renamed profile under Options/Profiles
    '
    ' *Note: This example relies on the default profile "<<Unnamed Profile>>".
    ' If this profile has already been renamed or removed, be sure to change the
    ' name of the SourceProfile to one that currently exists.

    Dim ACADPref As AcadPreferencesProfiles
    Dim SourceProfile As String, DestinationProfile As String

    ' Get the profiles preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Profiles

    ' Rename the default profile
    On Error GoTo ERRORTRAP

    SourceProfile = "<<Unnamed Profile>>"
    DestinationProfile = "NEW_PROFILE_NAME"

    ACADPref.RenameProfile SourceProfile, DestinationProfile

    MsgBox "We have just renamed the profile " & SourceProfile & " to " & DestinationProfile

    Exit Sub

ERRORTRAP:
    If Err.Description <> "" Then
        MsgBox "The default profile '" & SourceProfile & "' cannot be found, please use a different source profile."
    End If

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_RenameProfile()
    ;; This example renames an existing profile.
    ;; You can see the renamed profile under Options/Profiles
    ;;
    ;; *Note: This example relies on the default profile "<<Unnamed Profile>>".
    ;; If this profile has already been renamed or removed, be sure to change the
    ;; name of the SourceProfile to one that currently exists.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Rename the default profile
    (setq sourceProfile "<<Unnamed Profile>>"
          destinationProfile "NEW_PROFILE_NAME")

    (setq err (vl-catch-all-apply 'vla-RenameProfile (list (vla-get-Profiles preferences) sourceProfile destinationProfile)))

    (if (= (type err) 'VL-CATCH-ALL-APPLY-ERROR)
        (alert (strcat "The default profile '" SourceProfile "' cannot be found, please use a different source profile."))
        (alert (strcat "We have just renamed the profile " SourceProfile " to " DestinationProfile))
    )
)


Replace Method (ActiveX)

Replaces an item in the dictionary by a given item.

Supported platforms: Windows only

Signature

VBA:

object.Replace Name, NewObject
object

Type: Dictionary

The object this method applies to.

Name

Access: Input-only

Type: String

The name (keyword) of the object to be replaced.

NewObject

Access: Input-only

Type: Object

The new object.

Return Value (RetVal)

No return value.

Remarks

For example, "FirstKeyword," in the following dictionary:

  • MyDictionary
  • Keyword Object
  • FirstKeyword Object1
  • SecondKeyword Object2

has a new object, "NewObject," attached to it:

  • MyDictionary
  • Keyword Object
  • FirstKeyword NewObject
  • SecondKeyword Object2

Examples

VBA:

Sub Example_Replace()
    ' This example creates a dictionary and adds
    ' a custom object to that dictionary. It then
    ' replaces the object in the dictionary.

    Dim dictObj As AcadDictionary
    Set dictObj = ThisDrawing.Dictionaries.Add("TEST_DICTIONARY")

    ' Load the ObjectARX application that defines the custom object.
    ' Note: The application listed here does not exist and
    ' will cause an error when run. Change the application name
    ' to the path and name of your ObjectARX application.
    ThisDrawing.Application.LoadArx "MyARXApp.dll"

    ' Create the custom object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadObject

    keyName = "OBJ1"
    className = "CAsdkDictObject"

    Set customObj = dictObj.AddObject(keyName, className)

    ' Replace the object from the dictionary with a different object
    Dim newCustomObject As AcadObject
    dictObj.Replace keyName, newCustomObject

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Replace()
    ;; This example creates a dictionary and adds
    ;; a custom object to that dictionary. It then
    ;; replaces the object in the dictionary.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq dictionaries (vla-get-Dictionaries doc))

    (setq dictObj (vla-Add dictionaries "TEST_DICTIONARY"))

    ;; Load the ObjectARX application that defines the custom object.
    ;; Note: The application listed here does not exist and
    ;; will cause an error when run. Change the application name
    ;; to the path and name of your ObjectARX application.
    (vla-LoadArx acadObj "MyARXApp.dll")

    ;; Create the custom object in the dictionary
    (setq keyName "OBJ1")
    (setq className "CAsdkDictObject")

    (setq customObj (vla-AddObject dictObj keyName className))

    ;; Replace the object from the dictionary with a different object
    (setq newCustomObject (vlax-make-variant))
    (vlax-variant-type newCustomObject vlax-vbObject)
    (vla-Replace dictObj keyName newCustomObject)
)


ReselectSubRegion Method (ActiveX)

Returns subentities of a selection set in a table.

Supported platforms: Windows only

Signature

VBA:

object.ReselectSubRegion
object

Type: Table

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

This method reselects the current subselection (if any).

Examples

VBA:

Not available

Visual LISP:

Not available


ResetBlock Method (ActiveX)

Resets the dynamic block to the default state.

Supported platforms: Windows only

Signature

VBA:

object.ResetBlock
object

Type: BlockReference, MInsertBlock

The objects this method applies to.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ResetCellValue Method (ActiveX)

Reset the cell value for the given row and column.

Supported platforms: Windows only

Signature

VBA:

object.ResetCellValue row, col
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row number of the cell to set.

col

Access: Input-only

Type: Long

The column number of the cell to set.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ResetProfile Method (ActiveX)

Resets the value in the specified profile to its default values.

Supported platforms: Windows only

Signature

VBA:

object.ResetProfile Profile
object

Type: PreferencesProfiles

The object this method applies to.

Profile

Access: Input-only

Type: String

The profile to reset.

Return Value (RetVal)

No return value.

Remarks

The specified profile must be the current active profile. To set a profile as the current active profile, use the ActiveProfile property.

Examples

VBA:

Sub Example_ResetProfile()
    ' This example resets a profile to the default values.
    ' NOTE: A dummy profile name is used so that your existing
    ' profiles are not changed.

    Dim preferences As AcadPreferences
    Dim strProfileToReset As String

    Set preferences = ThisDrawing.Application.preferences

    ' Specify the profile to delete.
    strProfileToReset = "TestProfile"

    ' Delete the profile
    ' The call will fail if "TestProfile" does not exist
    On Error GoTo Error
    preferences.Profiles.ResetProfile strProfileToReset
    Exit Sub

Error:
    MsgBox "ResetProfile of " & strProfileToReset & " failed. " & Err.Description, , "ResetProfile Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ResetProfile()
    ;; This example resets a profile to the default values.
    ;; NOTE: A dummy profile name is used so that your existing
    ;; profiles are not changed.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Specify the profile to delete.
    (setq strProfileToReset "TestProfile")

    ;; Reset the profile
    ;; The call will fail if "TestProfile" does not exist
    (setq err (vl-catch-all-apply 'vla-ResetProfile (list (vla-get-Profiles preferences) strProfileToReset)))

    (if (= (type err) 'VL-CATCH-ALL-APPLY-ERROR)
        (alert (strcat "ResetProfile of " strProfileToReset " failed. "))
        (alert (strcat "We have just reset the profile " strProfileToReset))
    )
)


Restore Method (ActiveX)

Restores a group of layer property settings.

Supported platforms: Windows only

Signature

VBA:

object.Restore Name
object

Type: LayerStateManager

The object this method applies to.

Name

Access: Input-only

Type: String

The name of the saved layer settings to be restored.

Return Value (RetVal)

No return value.

Remarks

The Restore method uses the Mask property associated with the saved settings to identify which layer properties are to be restored.

Examples

VBA:

Sub Example_RestoreLayerSettings()
    ' The following code restores color and linetype settings
    ' that were saved as "ColorLineType".

    Dim oLSM As AcadLayerStateManager

    Set oLSM = ThisDrawing.Application. _
       GetInterfaceObject("AutoCAD.AcadLayerStateManager.20")

    oLSM.SetDatabase ThisDrawing.Database
    oLSM.Restore "ColorLinetype"

End Sub

Visual LISP:

(defun c:Example_Restore()
    ;; The following code restores color and linetype settings
    ;; that were saved as "ColorLineType."
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Access the LayerStateManager object.
    (setq oLSM (vla-GetInterfaceObject acadObj "AutoCAD.AcadLayerStateManager.20"))

    (vla-SetDatabase oLSM (vla-get-Database doc))

    (vla-Restore oLSM "ColorLinetype")
)


Reverse Method (ActiveX)

Reverses the direction of a spline.

Supported platforms: Windows only

Signature

VBA:

object.Reverse
object

Type: Spline

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Reverse()
    ' This example creates a spline in model space.
    ' It then reverses the spline and therefore the
    ' control point data.

    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double
    Dim msg As String

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 0: fitPoints(1) = 0: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)

    ZoomAll
    GoSub GETPOINTS
    MsgBox "Before the reverse the first control point is " & msg

    ' Reverse the Spline and therefore control point data
    splineObj.Reverse

    ThisDrawing.Regen True
    GoSub GETPOINTS
    MsgBox "After the reverse the first control point is " & msg

    Exit Sub
GETPOINTS:
    msg = ""
    ' Get the coordinates from the first control point again
    Dim count As Integer
    For count = 0 To 2
        msg = msg & splineObj.GetControlPoint(0)(count) & ", "
    Next
    msg = VBA.Left(msg, Len(msg) - 2)
    Return

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Reverse()
    ;; This example creates a spline in model space.
    ;; It then reverses the spline and therefore the
    ;; control point data.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the spline
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(0 0 0
                                                 5 5 0
                                                 10 0 0
                                                )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))

    (vla-ZoomAll acadObj)

    ;; Get the coordinates from the first control point again
    (setq msg ""
          count 0)
    (while (>= 2 count)
        (setq msg (strcat msg (rtos (vlax-safearray-get-element (vlax-variant-value (vla-GetControlPoint splineObj 0)) count) 2) ", ")
              count (1+ count)
        )
    )
    (setq msg (vl-string-right-trim ", " msg))

    (alert (strcat "Before the reverse the first control point is " msg))

    ;; Reverse the Spline and therefore control point data
    (vla-Reverse splineObj)

    (vla-Regen doc :vlax-true)

    ;; Get the coordinates from the first control point again
    (setq msg ""
          count 0)
    (while (>= 2 count)
        (setq msg (strcat msg (rtos (vlax-safearray-get-element (vlax-variant-value (vla-GetControlPoint splineObj 0)) count) 2) ", ")
              count (1+ count)
        )
    )
    (setq msg (vl-string-right-trim ", " msg))

    (alert (strcat "After the reverse the first control point is " msg))
)


Rotate Method (ActiveX)

Rotates an object around a base point.

Supported platforms: Windows only

Signature

VBA:

object.Rotate BasePoint, RotationAngle
object

Type: All drawing objects, AttributeReference, Dimension

The objects this method applies to.

BasePoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the point through which the axis of rotation is defined as parallel to the Z axis of the UCS.

RotationAngle

Access: Input-only

Type: Double

The angle in radians to rotate the object. This angle determines how far an object rotates around the base point relative to its current location.

Return Value (RetVal)

No return value.

Remarks

Examples

VBA:

Sub Example_Rotate()
    ' This example creates a lightweight polyline
    ' and then rotates that polyline.

    ' Create the polyline
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 11) As Double
    points(0) = 1: points(1) = 2
    points(2) = 1: points(3) = 3
    points(4) = 2: points(5) = 3
    points(6) = 3: points(7) = 3
    points(8) = 4: points(9) = 4
    points(10) = 4: points(11) = 2
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True
    ZoomAll

    MsgBox "Rotate the polyline by 45 degrees.", , "Rotate Example"

    ' Define the rotation
    Dim basePoint(0 To 2) As Double
    Dim rotationAngle As Double
    basePoint(0) = 4: basePoint(1) = 4.25: basePoint(2) = 0
    rotationAngle = 0.7853981   ' 45 degrees

    ' Rotate the polyline
    plineObj.Rotate basePoint, rotationAngle

    ZoomAll
    MsgBox "Rotation completed.", , "Rotate Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Rotate()
    ;; This example creates a lightweight polyline
    ;; and then rotates that polyline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 11)))
    (vlax-safearray-fill points '(1 1
                                  1 3
                                  2 3
                                  3 3
                                  4 4
                                  4 2
                                 )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)
    (vla-ZoomAll acadObj)

    (alert "Rotate the polyline by 45 degrees.")

    ;; Define the rotation
    (setq basePoint (vlax-3d-point 4 4.25 0)
          rotationAngle 0.7853981)   ;; 45 degrees

    ;; Rotate the polyline
    (vla-Rotate plineObj basePoint rotationAngle)

    (vla-ZoomAll acadObj)
    (alert "Rotation completed.")
)


Rotate3D Method (ActiveX)

Rotates an object around a 3D axis. Point1 and Point2 define the line that becomes the axis of rotation.

Supported platforms: Windows only

Signature

VBA:

object.Rotate3D Point1, Point2, RotationAngle
object

Type: All drawing objects, AttributeReference, Dimension

The object this method applies to.

Point1

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the first point of the axis line.

Point2

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the second point of the axis line.

RotationAngle

Access: Input-only

Type: Double

The angle in radians to rotate the object about the selected axis.

Return Value (RetVal)

No return value.

Remarks

Examples

VBA:

Sub Example_Rotate3D()
    ' This example creates a box in model space.
    ' It then rotates the box about an axis.

    Dim boxObj As Acad3DSolid
    Dim length As Double, width As Double, height As Double
    Dim center(0 To 2) As Double

    ' Define the box
    center(0) = 5#: center(1) = 5#: center(2) = 0
    length = 5#: width = 7: height = 10#

    ' Create the box (3DSolid) object in model space
    Set boxObj = ThisDrawing.ModelSpace.AddBox(center, length, width, height)

    ' Change the viewing direction of the viewport
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ThisDrawing.Regen True

    ' Define the rotation axis with two points
    Dim rotatePt1(0 To 2) As Double
    Dim rotatePt2(0 To 2) As Double
    Dim rotateAngle As Double

    rotatePt1(0) = -3: rotatePt1(1) = 4: rotatePt1(2) = 0
    rotatePt2(0) = -3: rotatePt2(1) = -4: rotatePt2(2) = 0
    rotateAngle = 30
    rotateAngle = rotateAngle * 3.141592 / 180#

    ' Draw a line between the two axis points so that it is visible.
    ' This is optional. It is not required for the rotation.
    Dim axisLine As AcadLine
    Set axisLine = ThisDrawing.ModelSpace.AddLine(rotatePt1, rotatePt2)
    axisLine.Update
    MsgBox "Rotate the box 30 degrees about the axis shown.", , "Rotate3D Example"

    ' Rotate the box
    boxObj.Rotate3D rotatePt1, rotatePt2, rotateAngle
    ThisDrawing.Regen True
    MsgBox "The box is rotated 30 degrees.", , "Rotate3D Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Rotate3D()
    ;; This example creates a box in model space.
    ;; It then rotates the box about an axis.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the box
    (setq center (vlax-3d-point 5 5 0)
          boxLength 5
             boxWidth 7
             boxHeight 10)

    ;; Create the box (3DSolid) object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq boxObj (vla-AddBox modelSpace center boxLength boxWidth boxHeight))

    ;; Change the viewing direction of the viewport
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)

    ;; Define the rotation axis with two points
    (setq rotatePt1 (vlax-3d-point -3 4 0)
          rotatePt2 (vlax-3d-point -3 -4 0)
          rotateAngle (/ (* 30 3.141592) 180))

    ;; Draw a line between the two axis points so that it is visible.
    ;; This is optional. It is not required for the rotation.
    (setq axisLine (vla-AddLine modelSpace rotatePt1 rotatePt2))
    (vla-Update axisLine)
    (alert "Rotate the box 30 degrees about the axis shown.")

    ;; Rotate the box
    (vla-Rotate3D boxObj rotatePt1 rotatePt2 rotateAngle)
    (vla-Regen doc :vlax-true)
    (alert "The box is rotated 30 degrees.")
)


RunMacro Method (ActiveX)

Runs a VBA macro from the Application object.

Supported platforms: Windows only

Signature

VBA:

object.RunMacro MacroPath
object

Type: Application

The object this method applies to.

MacroPath

Access: Input-only

Type: String

A string representing the calling sequence of the macro to run. The calling sequence must have the following syntax, where [] represent optional parameters:

[Filename.dvb.][ProjectName.][ModuleName.]MacroName
NoteIf Filename.dvb is followed by ProjectName, separate the names with an exclamation point instead of a period, as in the following example:
Filename.dvb!ProjectName

The Filename.dvb specified will be loaded if it is not already loaded. If the path to the Filename.dvb is not specified, the AutoCAD search path is searched to locate the file. If ProjectName is not specified, all currently loaded projects are searched to locate the macro.

Return Value (RetVal)

No return value.

Remarks

To associate a macro with a popup menu or toolbar item, use the Macro property.

Examples

VBA:

Sub Example_RunMacro()
    ' This example loads a DVB file and runs a macro
    ' contained in the file using the RunMacro method.
    '
    ' This example uses a DVB file named drawline.dvb.
    ' You should change the example to use a file on your computer.
    '
    ' * Note: If you open a DVB file and then run the example to load it, there will be an error
    ' when the DVB file is unloaded.

    Dim FileName As String

    FileName = "c:\drawline.dvb"

    ' Load a sample VBA project DVB file
    LoadDVB FileName

    ' Run the drawline sample macro
    RunMacro "Module1.Drawline"

    ' Unload the drawline VBA project DVB file now that we are done
    UnloadDVB FileName

    MsgBox "The DVB file has been run!"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_RunMacro()
    ;; This example loads a DVB file and runs a macro
    ;; contained in the file using the RunMacro method.
    ;;
    ;; This example uses a DVB file named drawline.dvb.
    ;; You should change the example to use a file on your computer.
    ;;
    ;; * Note: If you open a DVB file and then run the example to load it, there will be an error
    ;; when the DVB file is unloaded.
    (setq acadObj (vlax-get-acad-object))

    (setq fileName (findfile ".\\Sample\\VBA\\drawline.dvb"))

    ;; Load a sample VBA project DVB file
    (vla-LoadDVB acadObj fileName)

    ;; Run the drawline sample macro
    (vla-RunMacro acadObj "Module1.Drawline")

    ;; Unload the drawline VBA project DVB file now that we are done
    (vla-UnloadDVB acadObj fileName)

    (alert "The DVB file has been run!")
)


Save Method (ActiveX)

Saves a document or group of layer property settings; no longer supported for menu groups.

Supported platforms: Windows only

Signature - Document

VBA:

object.Save
object

Type: Document

The object this method applies to.

Signature - LayerStateManager

VBA:

object.Save Name, Mask
object

Type: LayerStateManager

The object this method applies to.

Name

Access: Input-only

Type: String

The name to be assigned to the saved layer settings.

Mask

Access: Input-only

Type: AcLayerStateMask enum

A number representing the layer properties to be saved and restored. Use the following constants to identify layer properties:

  • acLsAll: All layer properties
  • acLsColor: Color
  • acLsFrozen: Frozen or thawed
  • acLsLineType: Linetype
  • acLsLineWeight: Lineweight
  • acLsLocked: Locked or unlocked
  • acLsNewViewport: New viewport layers frozen or thawed
  • acLsNone: None
  • acLsOn: On or off
  • acLsPlot: Plotting on or off
  • acLsPlotStyle: Plot style

Signature - MenuGroup

VBA:

object.Save MenuFileType
object

Type: MenuGroup

The object this method applies to.

MenuFileType

Access: Input-only

Type: AcMenuFileType enum

  • acMenuFileCompiled
  • acMenuFileSource

Return Value (RetVal)

No return value.

Remarks

Document: When you save a document to a secure URL, a dialog box prompts the user for the necessary password information.

Menugroup: This method has no effect for menu groups in AutoCAD 2006 or later. This method will be removed from the MenuGroup object in a future release.

Examples

VBA:

Sub Example_Save()
    ' The following example saves current drawing

    ThisDrawing.Save

End Sub

Sub Example_Save_LayerSettings()
    ' The following code saves the color and linetype settings
    ' of the current layer.

    Dim oLSM As AcadLayerStateManager

    ' Access the LayerStateManager object
    Set oLSM = ThisDrawing.Application. _
       GetInterfaceObject("AutoCAD.AcadLayerStateManager.19")

    ' Associate the current drawing database with LayerStateManager
    oLSM.SetDatabase ThisDrawing.Database
    oLSM.Save "ColorLinetype", acLsColor + acLsLineType

End Sub

Visual LISP:

(defun c:Example_Save()
    ;; The following example saves current drawing
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (vla-Save doc)
)

(defun c:Example_Save_LayerSettings()
    ;; The following code saves the color and linetype settings
    ;; of the current layer.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Access the LayerStateManager object
    (setq oLSM (vla-GetInterfaceObject acadObj "AutoCAD.AcadLayerStateManager.19"))

    ;; Associate the current drawing database with LayerStateManager
    (vla-SetDatabase oLSM (vla-get-Database doc))

    (vla-Save oLSM "ColorLinetype" (+ acLsColor acLsLineType))
)


SaveAs Method (ActiveX)

Saves the document to a specified file; no longer supported for menu groups.

Supported platforms: Windows only

Signature - Document

VBA:

object.SaveAs FileName, FileType [, SecurityParams]
object

Type: Document

The object this method applies to.

FileName

Access: Input-only

Type: String

The full path and file name, or valid URL address, for the file. The active document takes on the new name.

FileType

Access: Input-only; optional

Type: AcSaveAsType enum

  • acR12_dxf: AutoCAD R12 DXF (*.dxf)
  • acR14_dwg: AutoCAD R14 DWG (*.dwg)
  • ac2000_dwg: AutoCAD 2000 DWG (*.dwg)
  • ac2000_dxf: AutoCAD 2000 DXF (*.dxf)
  • ac2000_Template: AutoCAD 2000 Drawing Template File (*.dwt)
  • ac2004_dwg: AutoCAD 2004 DWG (*.dwg)
  • ac2004_dxf: AutoCAD 2004 DXF (*.dxf)
  • ac2004_Template: AutoCAD 2004 Drawing Template File (*.dwt)
  • ac2007_dwg: AutoCAD 2007 DWG (*.dwg)
  • ac2007_dxf: AutoCAD 2007 DXF (*.dxf)
  • ac2007_Template: AutoCAD 2007 Drawing Template File (*.dwt)
  • ac2010_dwg: AutoCAD 2010 DWG (*.dwg)
  • ac2010_dxf: AutoCAD 2010 DXF (*.dxf)
  • ac2010_Template: AutoCAD 2010 Drawing Template File (*.dwt)
  • ac2013_dwg: AutoCAD 2013 DWG (*.dwg)
  • ac2013_dxf: AutoCAD 2013 DXF (*.dxf)
  • ac2013_Template: AutoCAD 2013 Drawing Template File (*.dwt)
  • acNative: A synonym for the latest drawing release. In this release, this value equals ac2013_dwg.
SecurityParams

Access: Input-only; optional

Type: Variant (a SecurityParams object)

Security settings for an encrypted drawing

Signature - MenuGroup

VBA:

object.SaveAs MenuFileName, MenuFileType
object

Type: MenuGroup

The object this method applies to.

MenuFileName

Access: Input-only

Type: String

The full path and file name for the menugroup to be saved to.

MenuFileType

Access: Input-only

Type: AcMenuFileType enum

  • acMenuFileCompiled
  • acMenuFileSource

Return Value (RetVal)

No return value.

Remarks

The default file type for documents is ac2013_dwg. The value acR14_dxf is obsolete.

Documents can be saved only as files with the extensions indicated above. To save a document in a different file type, use the Export method.

When saving to a secure URL, a dialog box prompts the user for the necessary password information. Message boxes appear if the user has not suppressed this activity in the browser.

Menu groups cannot be saved in AutoCAD 2006 and later releases. This method will be removed from the MenuGroup object in a future release.

Examples

VBA:

Sub Example_SaveAs()
    ' The following example saves current drawing as "test.dwg"

    ThisDrawing.SaveAs "test.dwg"

End Sub

Visual LISP:

(defun c:Example_SaveAs()
    ;; The following example saves current drawing as "test.dwg"
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (vla-SaveAs doc "test.dwg")
)


ScaleEntity Method (ActiveX)

Scales an object equally in the X, Y, and Z directions.

Supported platforms: Windows only

Signature

VBA:

object.ScaleEntity BasePoint, ScaleFactor
object

Type: All drawing objects, AttributeReference, Dimension

The objects this method applies to.

BasePoint

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the base point.

ScaleFactor

Access: Input-only

Type: Double

The factor by which to scale the object. The dimensions of the object are multiplied by the scale factor. A scale factor greater than 1 enlarges the object. A scale factor between 0 and 1 reduces the object. The scale factor must be greater than 0.0.

Return Value (RetVal)

No return value.

Remarks

ScaleFactor = 0.5 and ScaleFactor = 2

Examples

VBA:

Sub Example_ScaleEntity()
    ' This example creates a lightweight polyline
    ' and then scales that polyline.

    ' Create the polyline
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 11) As Double
    points(0) = 1: points(1) = 2
    points(2) = 1: points(3) = 3
    points(4) = 2: points(5) = 3
    points(6) = 3: points(7) = 3
    points(8) = 4: points(9) = 4
    points(10) = 4: points(11) = 2
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True
    ZoomAll

    MsgBox "Scale the polyline by 0.5", , "ScaleEntity Example"

    ' Define the scale
    Dim basePoint(0 To 2) As Double
    Dim scalefactor As Double
    basePoint(0) = 4: basePoint(1) = 4.25: basePoint(2) = 0
    scalefactor = 0.5

    ' Scale the polyline
    plineObj.ScaleEntity basePoint, scalefactor

    ZoomAll
    MsgBox "Scale completed.", , "ScaleEntity Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ScaleEntity()
    ;; This example creates a lightweight polyline
    ;; and then scales that polyline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 11)))
    (vlax-safearray-fill points '(1 2
                                  1 3
                                  2 3
                                  3 3
                                  4 4
                                  4 2
                                 )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)
    (vla-ZoomAll acadObj)

    (alert "Scale the polyline by 0.5")

    ;; Define the scale
    (setq basePoint (vlax-3d-point 4 4.25 0)
          scalefactor 0.5)

    ;; Scale the polyline
    (vla-ScaleEntity plineObj basePoint scalefactor)

    (vla-ZoomAll acadObj)
    (alert "Scale completed.")
)


SectionSolid Method (ActiveX)

Creates a region that represents the intersection of a plane defined by three points and the solid.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.SectionSolid(Point1, Point2, Point3)
object

Type: 3DSolid

The object this method applies to.

Point1

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the first point.

Point2

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the second point.

Point3

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the third point.

Return Value (RetVal)

Type: Region

The resulting section as a region.

Remarks

Examples

VBA:

Sub Example_SectionSolid()
    ' This example creates a box in model space.
    ' It then sections the box based on a plane
    ' defined by three points. The section is returned
    ' as a region.

    Dim boxObj As Acad3DSolid
    Dim length As Double, width As Double, height As Double
    Dim center(0 To 2) As Double

    ' Define the box
    center(0) = 5#: center(1) = 5#: center(2) = 0
    length = 5#: width = 7: height = 10#

    ' Create the box (3DSolid) object in model space
    Set boxObj = ThisDrawing.ModelSpace.AddBox(center, length, width, height)

    ' Define the section plane with three points
    Dim sectionPt1(0 To 2) As Double
    Dim sectionPt2(0 To 2) As Double
    Dim sectionPt3(0 To 2) As Double

    sectionPt1(0) = 1.5: sectionPt1(1) = 7.5: sectionPt1(2) = 0
    sectionPt2(0) = 1.5: sectionPt2(1) = 7.5: sectionPt2(2) = 10
    sectionPt3(0) = 8.5: sectionPt3(1) = 2.5: sectionPt3(2) = 10

    ' Section the box
    Dim sectionObj As AcadRegion
    Set sectionObj = boxObj.SectionSolid(sectionPt1, sectionPt2, sectionPt3)

    ' Change the viewing direction of the viewport
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SectionSolid()
    ;; This example creates a box in model space.
    ;; It then sections the box based on a plane
    ;; defined by three points. The section is returned
    ;; as a region.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the box
    (setq center (vlax-3d-point 5 5 0)
          boxLength 5
             boxWidth 7
             boxHeight 10)

    ;; Create the box (3DSolid) object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq boxObj (vla-AddBox modelSpace center boxLength boxWidth boxHeight))

    ;; Define the section plane with three points
    (setq sectionPt1 (vlax-3d-point 1.5 7.5 0)
          sectionPt2 (vlax-3d-point 1.5 7.5 10)
          sectionPt3 (vlax-3d-point 8.5 2.5 10))

    ;; Section the box
    (setq sectionObj (vla-SectionSolid boxObj sectionPt1 sectionPt2 sectionPt3))

    ;; Change the viewing direction of the viewport
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)
)


Select Method (ActiveX)

Selects objects and places them into a selection set, or selects a cell in a table.

Supported platforms: Windows only

Signature - SelectionSet

VBA:

object.Select Mode [, Point1] [, Point2] [, FilterType, FilterData]
object

Type: SelectionSet

The object this method applies to.

Mode

Access: Input-only

Type: AcSelect enum

  • acSelectionSetWindow
  • acSelectionSetCrossing
  • acSelectionSetPrevious
  • acSelectionSetLast
  • acSelectionSetAll
Point1

Access: Input-only; optional

Type: Variant (three-element array of doubles)

The 3D WCS coordinates, or array of coordinates, specifying Point1. See the mode definitions for the proper use of Point1.

Point2

Access: Input-only; optional

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying Point2. See the mode definitions for the proper use of Point2.

FilterType

Access: Input-only; optional

Type: Variant

A DXF group code specifying the type of filter to use.

FilterData

Access: Input-only; optional

Type: Variant

The value to filter on.

Signature - Table

VBA:

object.Select wpt, wvwVec, wvwxvec, wxaper, wyaper, allowOutside, resultRowIndex, resultColumnIndex
object

Type: Table

The object this method applies to.

wpt

Access: Input-only

Type: Variant

3D point in WCS specifying the input pick point.

wvwVec

Access: Input-only

Type: Variant

3D vector in WCS specifying the view direction for the hit test.

wvwxvec

Access: Input-only

Type: Variant

3D vector in WCS specifying the view orientation for the hit test.

wxaper

Access: Output-only

Type: Double

Width of aperture box centered at the hit point for the hit test; reserved for future use.

wyaper

Access: Output-only

Type: Double

Height of aperture box centered at the hit point for the hit test; reserved for future use.

allowOutside

Access: Input-only

Type: Boolean

  • True: Pick point outside the table will select a cell.
  • False: Pick point outside the table will not select a cell.
resultRowIndex

Access: Output-only

Type: Long

Row index of the selected cell.

resultColumnIndex

Access: Output-only

Type: Long

Column index of the selected cell.

Return Value (RetVal)

No return value.

Remarks - SelectionSet

This method supports the filtering mechanism.

The following selection modes are available:

  • Window: Selects all objects completely inside a rectangular area whose corners are defined by Point1 and Point2.
  • Crossing: Selects objects within and crossing a rectangular area whose corners are defined by Point1 and Point2.
  • Previous: Selects the most recent selection set. This mode is ignored if you switch between paper space and model space and attempt to use the selection set.
  • Last: Selects the most recently created visible objects.
  • All: Selects all objects.

For more selection mode options, see the SelectByPolygon, SelectAtPoint, and SelectOnScreen methods.

Remarks - Table

This function selects a cell in the table by specifying a point, viewing direction, and orientation. The row and column index of the selected cell are returned in resultRowIndex and resultColumnIndex.

Examples

VBA:

Sub Example_Select()
    ' This example adds members to a selection set, first by crossing and
    ' then by filtering for circles.

    ' Create the selection set
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SSET")

    ' Add all object to the selection set that lie within a crossing of (28,17,0) and
    ' (-3.3, -3.6,0)
    Dim mode As Integer
    Dim corner1(0 To 2) As Double
    Dim corner2(0 To 2) As Double

    mode = acSelectionSetCrossing
    corner1(0) = 28: corner1(1) = 17: corner1(2) = 0
    corner2(0) = -3.3: corner2(1) = -3.6: corner2(2) = 0
    ssetObj.Select mode, corner1, corner2

    ' Add all the Circles to the selection set that lie within the crossing of (28,17,0) and
    ' (-3.3, -3.6,0) by filtering from the current drawing
    Dim gpCode(0) As Integer
    Dim dataValue(0) As Variant
    gpCode(0) = 0
    dataValue(0) = "Circle"

    Dim groupCode As Variant, dataCode As Variant
    groupCode = gpCode
    dataCode = dataValue

    ssetObj.Select mode, corner1, corner2, groupCode, dataCode

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Select()
    ;; This example adds members to a selection set, first by crossing and
    ;; then by filtering for circles.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the selection set
    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SSET"))

    ;; Add all object to the selection set that lie within a crossing of (28,17,0) and
    ;; (-3.3, -3.6,0)
    (setq mode acSelectionSetCrossing
          corner1 (vlax-3d-point 28 17 0)
          corner2 (vlax-3d-point -3.3 -3.6 0))

    (vla-Select ssetObj mode corner1 corner2)
    (alert (strcat "Objects selected: " (itoa (vla-get-Count ssetObj))))
    (vla-Clear ssetObj)

    ;; Add all the Circles to the selection set that lie within the crossing of (28,17,0) and
    ;; (-3.3, -3.6,0) by filtering from the current drawing
    (setq gpCode (vlax-make-safearray vlax-vbInteger '(0 . 0)))
    (vlax-safearray-put-element gpCode 0 0)
    (setq dataValue (vlax-make-safearray vlax-vbVariant '(0 . 0)))
    (vlax-safearray-put-element dataValue 0 "Circle")

    (vla-Select ssetObj mode corner1 corner2 gpCode dataValue)
    (alert (strcat "Objects selected: " (itoa (vla-get-Count ssetObj))))

    (vla-Delete ssetObj)
)


SelectAtPoint Method (ActiveX)

Selects an object passing through a given point and places it into a selection set.

Supported platforms: Windows only

Signature

VBA:

object.SelectAtPoint Point, FilterType, FilterData
object

Type: SelectionSet

The object this method applies to.

Point

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D UCS coordinates specifying the point to use for the selection.

FilterType

Access: Input-only; optional

Type: Variant

A DXF group code specifying the type of filter to use.

FilterData

Access: Input-only; optional

Type: Variant

The value to filter on.

Return Value (RetVal)

No return value.

Remarks

This method supports the filtering mechanism.

The PICKBOX system variable affects object selection.

For more selection mode options, see the Select, SelectByPolygon, and SelectOnScreen methods.

Examples

VBA:

Sub Example_SelectAtPoint()
    ' This example adds objects to a selection set by identifying a point.
    ' At first all objects at the point are added to the selection set. Then
    ' only circle objects at the point are added to the selection set.

    ' Create the selection set
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_SSET1")

    ' Add to the selection set all the objects that lie at point(6.8,9.4,0)
    Dim point(0 To 2) As Double
    point(0) = 6.8: point(1) = 9.4: point(2) = 0
    ssetObj.SelectAtPoint point

    ' Add to the selection set all the Circles that lie at point (6.8,9.4,0)
    Dim gpCode(0) As Integer
    Dim dataValue(0) As Variant
    gpCode(0) = 0
    dataValue(0) = "Circle"

    Dim groupCode As Variant, dataCode As Variant
    groupCode = gpCode
    dataCode = dataValue

    ssetObj.SelectAtPoint point, groupCode, dataCode

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SelectAtPoint()
    ;; This example adds objects to a selection set by identifying a point.
    ;; At first all objects at the point are added to the selection set. Then
    ;; only circle objects at the point are added to the selection set.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the selection set
    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_SSET1"))

    ;; Add to the selection set all the objects that lie at point(6.8,9.4,0)
    (setq point (vlax-3d-point 6.8 9.4 0))
    (vla-SelectAtPoint ssetObj point)

    (alert (strcat "Objects selected: " (itoa (vla-get-Count ssetObj))))
    (vla-Clear ssetObj)

    ;; Add to the selection set all the Circles that lie at point (6.8,9.4,0)
    (setq gpCode (vlax-make-safearray vlax-vbInteger '(0 . 0)))
    (vlax-safearray-put-element gpCode 0 0)
    (setq dataValue (vlax-make-safearray vlax-vbVariant '(0 . 0)))
    (vlax-safearray-put-element dataValue 0 "Circle")

    (vla-SelectAtPoint ssetObj point gpCode dataValue)
    (alert (strcat "Objects selected: " (itoa (vla-get-Count ssetObj))))

    (vla-Delete ssetObj)
)


SelectByPolygon Method (ActiveX)

Selects objects within a fence and adds them to the selection set.

Supported platforms: Windows only

Signature

VBA:

object.SelectByPolygon Mode, PointsList [, FilterType, FilterData]
object

Type: SelectionSet

The object this method applies to.

Mode

Access: Input-only

Type: AcSelect enum

  • acSelectionSetFence
  • acSelectionSetWindowPolygon
  • acSelectionSetCrossingPolygon
PointsList

Access: Input-only

Type: Variant (three-element array of doubles)

An array of 3D WCS coordinates specifying the selection fence.

FilterType

Access: Input-only; optional

Type: Variant

A DXF group code specifying the type of filter to use.

FilterData

Access: Input-only; optional

Type: Variant

The value to filter on.

Return Value (RetVal)

No return value.

Remarks

The following selection modes are available:

  • Fence: Selects all objects crossing a selection fence. The fence is defined by coordinates in PointsList.
  • WindowPolygon: Selects objects within a polygon defined by PointsList.
  • CrossingPolygon: Selects objects within and crossing an area defined by a polygon. Use PointsList to define the coordinates of the polygon. AutoCAD will close the last vector of the polygon. A polygon definition cannot cross itself.

This method supports the filtering mechanism.

For more selection mode options, see the Select, SelectAtPoint, and SelectOnScreen methods.

Examples

VBA:

Sub Example_SelectByPolygon()
    ' This example adds objects to a selection set by defining a polygon.

    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_SSET2")

    ' Add to the selection set all the objects that lie within a fence
    Dim mode As Integer
    Dim pointsArray(0 To 11) As Double
    mode = acSelectionSetFence
    pointsArray(0) = 28.2: pointsArray(1) = 17.2: pointsArray(2) = 0
    pointsArray(3) = -5: pointsArray(4) = 13: pointsArray(5) = 0
    pointsArray(6) = -3.3: pointsArray(7) = -3.6: pointsArray(8) = 0
    pointsArray(9) = 28: pointsArray(10) = -3: pointsArray(11) = 0

    ssetObj.SelectByPolygon mode, pointsArray

    ' Add to the selection set all the Circles that lie within fence
    ReDim gpCode(0 To 1) As Integer
    gpCode(0) = 0
    gpCode(1) = 10

    Dim pnt(0 To 2) As Double
    pnt(0) = 3: pnt(1) = 6: pnt(2) = 0

    ReDim dataValue(0 To 1) As Variant
    dataValue(0) = "Circle"
    dataValue(1) = pnt

    Dim groupCode As Variant, dataCode As Variant
    groupCode = gpCode
    dataCode = dataValue

    ssetObj.SelectByPolygon mode, pointsArray, groupCode, dataCode

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SelectByPolygon()
    ;; This example adds objects to a selection set by defining a polygon.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_SSET2"))

    ;; Add to the selection set all the objects that lie within a fence
    (setq mode acSelectionSetFence)
    (setq pointsArray (vlax-make-safearray vlax-vbDouble '(0 . 11)))
    (vlax-safearray-fill pointsArray '(28.2 17.2 0
                                       -5 13 0
                                       -3.3 -3.6 0
                                       28 -3 0
                                      )
    )

    (vla-SelectByPolygon ssetObj mode pointsArray)

    (alert (strcat "Objects selected: " (itoa (vla-get-Count ssetObj))))
    (vla-Clear ssetObj)

    ;; Add to the selection set all the Circles that lie within fence and at point 3,6
    (setq gpCode (vlax-make-safearray vlax-vbInteger '(0 . 1)))
    (vlax-safearray-put-element gpCode 0 0)
    (vlax-safearray-put-element gpCode 1 10)

    (setq pnt (vlax-3d-point 3 6 0))

    (setq dataValue (vlax-make-safearray vlax-vbVariant '(0 . 1)))
    (vlax-safearray-put-element dataValue 0 "Circle")
    (vlax-safearray-put-element dataValue 1 pnt)

    (vla-SelectByPolygon ssetObj mode pointsArray gpCode dataValue)
    (alert (strcat "Objects selected: " (itoa (vla-get-Count ssetObj))))

    (vla-Delete ssetObj)
)


SelectOnScreen Method (ActiveX)

Prompts the user to pick an object from the screen.

Supported platforms: Windows only

Signature

VBA:

object.SelectOnScreen [FilterType, FilterData]
object

Type: SelectionSet

The object this method applies to.

FilterType

Access: Input-only; optional

Type: Variant

A DXF group code specifying the type of filter to use.

FilterData

Access: Input-only; optional

Type: Variant

The value to filter on.

Return Value (RetVal)

No return value.

Remarks

This method supports the filtering mechanism.

AutoCAD's default prompt for picking an object will be used automatically.

For more selection mode options, see the Select, SelectByPolygon, and SelectAtPoint methods.

Examples

VBA:

Sub Example_SelectOnScreen()
    ' This example adds objects to a selection set by prompting the user
    ' to select ones to add.

    AppActivate ThisDrawing.Application.Caption

    ' Create the selection set
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_SSET")

    ' Add objects to a selection set by prompting user to select on the screen
    ssetObj.SelectOnScreen

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SelectOnScreen()
    ;; This example adds objects to a selection set by prompting the user
    ;; to select ones to add.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the selection set
    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_SSET"))

    ;; Add objects to a selection set by prompting user to select on the screen
    (vla-SelectOnScreen ssetObj)

    (alert (strcat "Objects selected: " (itoa (vla-get-Count ssetObj))))
    (vla-Delete ssetObj)
)


SelectSubRegion Method (ActiveX)

Selects a set of cells in a table.

Supported platforms: Windows only

Signature

VBA:

object.SelectSubRegion wpt1, wpt2, wvwVec, wvwxVec, seltype, bIncludeCurrentSelection, rowMin, rowMax, colMin, colMax
object

Type: Table

The object this method applies to.

wpt1

Access: Input-only

Type: Variant

3D point in WCS specifying the first corner point of the window box selection.

wpt2

Access: Input-only

Type: Variant

3D point in WCS specifying the second corner point of the window box selection.

wvwvec

Access: Input-only

Type: Variant

3D vector in WCS specifying the view direction of the selection.

wvwxvec

Access: Input-only

Type: Variant

3D vector in WCS specifying the view orientation of the hit test.

seltype

Access: Input-only

Type: AcSelectType enum

The selection type.

  • acCrossing: Cross-selection type
  • acWindow: Window-selection type
bincludecurrentselection

Access: Input-only

Type: Boolean

  • True: Selected cells returned will include currently selected cells and newly selected cells.
  • False: Only newly selected cells are returned.
rowMin

Access: Output-only

Type: Long

The zero-based lower bound of row index.

rowMax

Access: Output-only

Type: Long

The zero-based upper bound of row index.

colMin

Access: Output-only

Type: Long

The zero-based lower bound of column index.

colMax

Access: Output-only

Type: Long

The zero-based upper bound of column index.

Return Value (RetVal)

No return value.

Remarks

The row and column index of the upper and lower bounds of the selected region are returned in rowMin, rowMax, colMin, and colMax.

Examples

VBA:

Not available

Visual LISP:

Not available


SendCommand Method (ActiveX)

Sends a command string from a VB or VBA application to the document for processing.

Supported platforms: Windows only

Signature

VBA:

object.SendCommand Command
object

Type: Document

The object this method applies to.

Command

Access: Input-only

Type: String

The command to send to the document.

Return Value (RetVal)

No return value.

Remarks

Use a space or the ASCII carriage return character (vbCr) at the end of the command string to end the command; this is equivalent to pressing Enter on the keyboard.

This method processes any AutoCAD command-line function, including AutoLISP expressions.

If the drawing specified is not active, it will be made active.

This method is generally synchronous. However, if the command sent with this method requires any user interaction (such as picking a point on the screen) then this method will continue as soon as the user input begins. The command will then continue to be processed asynchronously.

When this method is called from an event handler it is processed asynchronously.

You should never use this method to issue a command for which there is an ActiveX method available. For example, do not use SendCommand "VBALOAD ". Instead, use the LoadDVB method.

Examples

VBA:

Sub Example_SendCommand()
   ' This example sends a command for evaluation to the AutoCAD command line
   ' of a particular drawing

   ' Create a Circle in the active drawing and
   ' zoom to display the entire circle
   ThisDrawing.SendCommand "_Circle" & vbCr & "2,2,0" & vbCr & "4" & vbCr
   ThisDrawing.SendCommand "_zoom" & vbCr & "a" & vbCr

   ' Refresh view
   ThisDrawing.Regen acAllViewports

   MsgBox "A circle command has been sent to the command line of the current drawing."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SendCommand()
    ;; This example sends a command for evaluation to the AutoCAD command line
    ;; of a particular drawing
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create a Circle in the active drawing and
    ;; zoom to display the entire circle
    (vla-SendCommand doc (strcat "_circle 2,2,0 4 "))
    (vla-SendCommand doc (strcat "_zoom a "))

    ;; Refresh view
    (vla-Regen doc acAllViewports)

    (alert "A circle command has been sent to the command line of the current drawing.")
)


SendModelessOperationEnded Method (ActiveX)

Indicates a modeless operation has ended.

Supported platforms: Windows only

Signature

VBA:

object.SendModelessOperationEnded Context
object

Type: Utility

The object this method applies to.

Context

Access: Output-only

Type: String

A text value passed to the SendModelessOperationStart method.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SendModelessOperationStart Method (ActiveX)

Indicates a modeless operation will start.

Supported platforms: Windows only

Signature

VBA:

object.SendModelessOperationStart Context
object

Type: Utility

The object this method applies to.

Context

Access: Input-only

Type: String

The text value for the SendModelessOperationEnded method to return after the modeless operation has ended.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetAlignment Method (ActiveX)

Sets a cell alignment for the specified row types.

Supported platforms: Windows only

Signature

VBA:

object.SetAlignment rowTypes, cellAlignment
object

Type: Table, TableStyle

The objects this method applies to.

rowTypes

Access: Input-only

Type: AcRowType enum

The row types to change.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow
cellAlignment

Access: Input-only

Type: AcCellAlignment enum

The alignment to use for the row types.

  • acBottomCenter: Centers text at a point based on the bottom of the text.
  • acBottomLeft: Left-justifies text at a point based on the bottom of the text.
  • acBottomRight: Right-justifies text at a point based on the bottom of the text.
  • acMiddleCenter: Centers text at a point based on the middle of the text.
  • acMiddleLeft: Left-justifies text at a point based on the middle of the text.
  • acMiddleRight: Right-justifies text at a point based on the middle of the text.
  • acTopCenter: Centers text at a point based on the top of the text.
  • acTopLeft: Left-justifies text at a point based on the top of the text.
  • acTopRight: Right-justifies text at a point based on the top of the text.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetAlignment()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.FlowDirection = acTableBottomToTop
    customObj.HorzCellMargin = 0.22
    customObj.BitFlags = 1
    customObj.SetTextHeight AcRowType.acDataRow + AcRowType.acTitleRow, 1.3
    customObj.SetTextStyle AcRowType.acDataRow + AcRowType.acTitleRow, "Standard"

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 12, 23, 45
    customObj.SetBackgroundColor AcRowType.acDataRow + AcRowType.acTitleRow, col
    customObj.SetGridVisibility AcGridLineType.acHorzInside + AcGridLineType.acHorzTop _
                                , AcRowType.acDataRow + AcRowType.acTitleRow, True

    customObj.SetAlignment AcRowType.acDataRow + AcRowType.acTitleRow, acBottomRight
    col.SetRGB 244, 0, 0
    customObj.SetGridColor 3, 1, col

    MsgBox "Table Style Name = " & customObj.Name & vbCrLf & _
           "Style Description = " & customObj.Description & vbCrLf & _
           "Flow Direction = " & customObj.FlowDirection & vbCrLf & _
           "Horzontal Cell Margin = " & customObj.HorzCellMargin & vbCrLf & _
           "Bit Flags = " & customObj.BitFlags & vbCrLf & _
           "Title Row Text Height = " & customObj.GetTextHeight(acTitleRow) & vbCrLf & _
           "Title Row Text Style = " & customObj.GetTextStyle(acTitleRow) & vbCrLf & _
           "Grid Visibility for HorizontalBottom TitleRow  = " & customObj.GetGridVisibility(acHorzBottom, acTitleRow) & vbCrLf & _
           "Title Row Alignment = " & customObj.GetAlignment(acTitleRow) & vbCrLf & _
           "Header Suppression = " & customObj.HeaderSuppressed

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetAlignment()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-put-FlowDirection customObj acTableBottomToTop)
    (vla-put-HorzCellMargin customObj 0.22)
    (vla-put-BitFlags customObj 1)
    (vla-SetTextHeight customObj (+ acDataRow acTitleRow) 1.3)
    (vla-SetTextStyle customObj (+ acDataRow acTitleRow) "Standard")

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 12 23 45)

    (vla-SetBackgroundColor customObj (+ acDataRow acTitleRow) col)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) (+ acDataRow acTitleRow) :vlax-true)
    (vla-SetAlignment customObj (+ acDataRow acTitleRow) acBottomRight)
    (vla-SetRGB col 244 0 0)
    (vla-SetGridColor customObj (+ acHorzTop acHorzInside) acDataRow col)

    (alert (strcat "Table Style Name = " (vla-get-Name customObj)
                   "\nStyle Description = " (vla-get-Description customObj)
                   "\nFlow Direction = " (itoa (vla-get-FlowDirection customObj))
                   "\nHorzontal Cell Margin = " (rtos (vla-get-HorzCellMargin customObj) 2)
                   "\nBit Flags = " (itoa (vla-get-BitFlags customObj))
                   "\nTitle Row Text Height = " (rtos (vla-GetTextHeight customObj acTitleRow) 2)
                   "\nTitle Row Text Style = " (vla-GetTextStyle customObj acTitleRow)
                   "\nGrid Visibility for HorizontalBottom TitleRow  = " (if (= (vla-GetGridVisibility customObj acHorzBottom acTitleRow) :vlax-true) "True" "False")
                   "\nTitle Row Alignment = " (itoa (vla-GetAlignment customObj acTitleRow))
                      "\nHeader Suppression = " (if (= (vla-get-HeaderSuppressed customObj) :vlax-true) "True" "False")
              )
    )
    (vlax-release-object col)
)


SetAlignment2 Method (ActiveX)

Sets the cell alignment.

Supported platforms: Windows only

Signature

VBA:

object.SetAlignment2 bstrCellStyle, cellAlignment
object

Type: TableStyle

The object this method applies to.

bstrCellStyle

Access: Input-only

Type: String

The cell style which needs an alignment change.

cellAlignment

Access: Input-only

Type: AcCellAlignment enum

The new cell alignment.

  • acBottomCenter: Centers text at a point based on the bottom of the text.
  • acBottomLeft: Left-justifies text at a point based on the bottom of the text.
  • acBottomRight: Right-justifies text at a point based on the bottom of the text.
  • acMiddleCenter: Centers text at a point based on the middle of the text.
  • acMiddleLeft: Left-justifies text at a point based on the middle of the text.
  • acMiddleRight: Right-justifies text at a point based on the middle of the text.
  • acTopCenter: Centers text at a point based on the top of the text.
  • acTopLeft: Left-justifies text at a point based on the top of the text.
  • acTopRight: Right-justifies text at a point based on the top of the text.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetAlignment2()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As IAcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.FlowDirection = acTableBottomToTop
    customObj.HorzCellMargin = 0.22
    customObj.BitFlags = 1
    customObj.SetTextHeight AcRowType.acDataRow + AcRowType.acTitleRow, 1.3
    customObj.SetTextStyle AcRowType.acDataRow + AcRowType.acTitleRow, "Standard"

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 12, 23, 45
    customObj.SetBackgroundColor AcRowType.acDataRow + AcRowType.acTitleRow, col
    customObj.SetGridVisibility AcGridLineType.acHorzInside + AcGridLineType.acHorzTop _
                                , AcRowType.acDataRow + AcRowType.acTitleRow, True

    customObj.SetAlignment2 "Title", acBottomRight

    col.SetRGB 244, 0, 0
    customObj.SetGridColor 3, 1, col

    MsgBox "Table Style Name = " & customObj.Name & vbCrLf & _
           "Style Description = " & customObj.Description & vbCrLf & _
           "Flow Direction = " & customObj.FlowDirection & vbCrLf & _
           "Horzontal Cell Margin = " & customObj.HorzCellMargin & vbCrLf & _
           "Bit Flags = " & customObj.BitFlags & vbCrLf & _
           "Title Row Text Height = " & customObj.GetTextHeight(acTitleRow) & vbCrLf & _
           "Title Row Text Style = " & customObj.GetTextStyle(acTitleRow) & vbCrLf & _
           "Grid Visibility for HorizontalBottom TitleRow  = " & customObj.GetGridVisibility(acHorzBottom, acTitleRow) & vbCrLf & _
           "Title Row Alignment = " & customObj.GetAlignment(acTitleRow) & vbCrLf & _
           "Header Suppression = " & customObj.HeaderSuppressed

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetAlignment2()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-put-FlowDirection customObj acTableBottomToTop)
    (vla-put-HorzCellMargin customObj 0.22)
    (vla-put-BitFlags customObj 1)
    (vla-SetTextHeight customObj (+ acDataRow acTitleRow) 1.3)
    (vla-SetTextStyle customObj (+ acDataRow acTitleRow) "Standard")

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 12 23 45)

    (vla-SetBackgroundColor customObj (+ acDataRow acTitleRow) col)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) (+ acDataRow acTitleRow) :vlax-true)
    (vla-SetAlignment2 customObj "Title" acBottomRight)
    (vla-SetRGB col 244 0 0)
    (vla-SetGridColor customObj (+ acHorzTop acHorzInside) acDataRow col)

    (alert (strcat "Table Style Name = " (vla-get-Name customObj)
                   "\nStyle Description = " (vla-get-Description customObj)
                   "\nFlow Direction = " (itoa (vla-get-FlowDirection customObj))
                   "\nHorzontal Cell Margin = " (rtos (vla-get-HorzCellMargin customObj) 2)
                   "\nBit Flags = " (itoa (vla-get-BitFlags customObj))
                   "\nTitle Row Text Height = " (rtos (vla-GetTextHeight customObj acTitleRow) 2)
                   "\nTitle Row Text Style = " (vla-GetTextStyle customObj acTitleRow)
                   "\nGrid Visibility for HorizontalBottom TitleRow  = " (if (= (vla-GetGridVisibility customObj acHorzBottom acTitleRow) :vlax-true) "True" "False")
                   "\nTitle Row Alignment = " (itoa (vla-GetAlignment customObj acTitleRow))
                      "\nHeader Suppression = " (if (= (vla-get-HeaderSuppressed customObj) :vlax-true) "True" "False")
              )
    )
    (vlax-release-object col)
)


SetAutoScale Method (ActiveX)

Sets the value specifying whether auto scale is used in the specified row and column.

Supported platforms: Windows only

Signature

VBA:

object.SetAutoScale row, col, bValue
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

bValue

Access: Input-only

Type: Boolean

  • True: Auto scale is used for the cell.
  • False: Auto scale is not used for the cell.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetAutoScale2 Method (ActiveX)

Sets the auto-scale flag value for a cell.

Supported platforms: Windows only

Signature

VBA:

object.SetAutoScale2 nRow, nCol, nContent, bAutoFit
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value for the cell.

bAutoFit

Access: Input-only

Type: Boolean

  • True: Auto scale is used for the cell.
  • False: Auto scale is not used for the cell.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetBackgroundColor Method (ActiveX)

Sets a background color value for the specified row types.

Supported platforms: Windows only

Signature

VBA:

object.SetBackgroundColor rowTypes, pColor
object

Type: Table, TableStyle

The objects this method applies to.

rowTypes

Access: Input-only

Type: AcRowType enum

The row types to change.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow
pColor

Access: Input-only

Type: AcCmColor

The AutoCAD true color object to apply to the specified row type.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetBackgroundColor()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Get the current TableStyle object
    Dim tableStyle As AcadTableStyle
    Set tableStyle = dictObj.Item(ThisDrawing.GetVariable("CTABLESTYLE"))

    Dim colCurrent As AcadAcCmColor, colRowCurrent As AcadAcCmColor, colNoneCurrent As Boolean
    Set colCurrent = tableStyle.GetBackgroundColor(AcRowType.acDataRow + AcRowType.acTitleRow)
    Set colRowCurrent = tableStyle.GetColor(acDataRow)
    colNoneCurrent = tableStyle.GetBackgroundColorNone(AcRowType.acHeaderRow)

    MsgBox "Table colors " & vbLf & _
           "Background ACI value = " & colCurrent.ColorIndex & vbLf & _
           "Row Text ACI value = " & colRowCurrent.ColorIndex & vbLf & _
           "Background None = " & colNoneCurrent

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 0, 0, 255
    tableStyle.SetBackgroundColor AcRowType.acTitleRow, col
    col.SetRGB 255, 0, 0
    tableStyle.SetColor AcRowType.acDataRow, col
    If colNoneCurrent = False Then
        tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, True
    Else
        tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, False
    End If

    Dim colNew As AcadAcCmColor, colRowNew As AcadAcCmColor, colNoneNew As Boolean
    Set colNew = tableStyle.GetBackgroundColor(AcRowType.acTitleRow)
    Set colRowNew = tableStyle.GetColor(acDataRow)
    colNoneNew = tableStyle.GetBackgroundColorNone(acHeaderRow)

    MsgBox "Table colors " & vbLf & _
           "Background ACI value = " & colNew.ColorIndex & vbLf & _
           "Row Text ACI value = " & colRowNew.ColorIndex & vbLf & _
           "Background None = " & colNoneNew

    tableStyle.SetBackgroundColor AcRowType.acTitleRow, colCurrent
    tableStyle.SetColor AcRowType.acDataRow, colRowCurrent
    tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, colNoneCurrent

    MsgBox "Reset the table style back to its original values."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetBackgroundColor()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-put-FlowDirection customObj acTableBottomToTop)
    (vla-put-HorzCellMargin customObj 0.22)
    (vla-put-BitFlags customObj 1)
    (vla-SetTextHeight customObj (+ acDataRow acTitleRow) 1.3)
    (vla-SetTextStyle customObj (+ acDataRow acTitleRow) "Standard")

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 12 23 45)

    (vla-SetBackgroundColor customObj (+ acDataRow acTitleRow) col)
    (vla-SetBackgroundColorNone customObj acHeaderRow :vlax-false)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) (+ acDataRow acTitleRow) :vlax-true)
    (vla-SetAlignment customObj (+ acDataRow acTitleRow) acBottomRight)
    (vla-SetRGB col 244 0 0)
    (vla-SetGridColor customObj (+ acHorzTop acHorzInside) acDataRow col)

    (alert (strcat "Table Style Name = " (vla-get-Name customObj)
                   "\nStyle Description = " (vla-get-Description customObj)
                   "\nFlow Direction = " (itoa (vla-get-FlowDirection customObj))
                   "\nHorzontal Cell Margin = " (rtos (vla-get-HorzCellMargin customObj) 2)
                   "\nBit Flags = " (itoa (vla-get-BitFlags customObj))
                   "\nTitle Row Text Height = " (rtos (vla-GetTextHeight customObj acTitleRow) 2)
                   "\nTitle Row Text Style = " (vla-GetTextStyle customObj acTitleRow)
                   "\nGrid Visibility for HorizontalBottom TitleRow  = " (if (= (vla-GetGridVisibility customObj acHorzBottom acTitleRow) :vlax-true) "True" "False")
                   "\nTitle Row Alignment = " (itoa (vla-GetAlignment customObj acTitleRow))
                      "\nHeader Suppression = " (if (= (vla-get-HeaderSuppressed customObj) :vlax-true) "True" "False")
             )
    )
    (vlax-release-object col)
)


SetBackgroundColor2 Method (ActiveX)

Sets a background color value for the specified named cell style.

Supported platforms: Windows only

Signature

VBA:

object.SetBackgroundColor2 bstrCellStyle, color
object

Type: TableStyle

The object this method applies to.

bstrCellStyle

Access: Input-only

Type: String

The named cell style.

color

Access: Input-only

Type: AcCmColor

The AutoCAD true color object to apply to the specified cell style.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetBackgroundColorNone Method (ActiveX)

Sets the value specifying whether there is no background color for the specified row types.

Supported platforms: Windows only

Signature

VBA:

object.SetBackgroundColorNone rowTypes, bValue
object

Type: Table, TableStyle

The object this method applies to.

rowTypes

Access: Input-only

Type: AcRowType enum

The row types to change.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow
bValue

Access: Input-only

Type: Boolean

  • True: Background color is applied.
  • False: Background color is not applied.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetBitmaps Method (ActiveX)

Sets the large and small bitmaps used as icons for the toolbar item.

Supported platforms: Windows only

Signature

VBA:

object.SetBitmaps SmallIconName, LargeIconName
object

Type: ToolbarItem

The object this method applies to.

SmallIconName

Access: Input-only

Type: String

The path and file name for the small bitmap.

LargeIconName

Access: Input-only

Type: String

The path and file name for the large bitmap.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetBitmaps()
    ' This example uses MenuGroups to obtain a reference to the AutoCAD main menu.
    ' It then creates a new Toolbar (TestMenu) and inserts a ToolBarButton
    ' with a custom icon. The menu is automatically shown.
    '
    ' * NOTE: The paths of the icons for the new toolbar should be updated
    ' before running this example.

    Dim currMenuGroup As AcadMenuGroup
    Dim newToolBar As AcadToolbar, newToolBarButton As AcadToolbarItem
    Dim openMacro As String
    Dim SmallBitmapName  As String, LargeBitmapName  As String

    On Error GoTo ERRORTRAP

    ' Use MenuGroups property to obtain reference to main AutoCAD menu
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item("ACAD")

    ' Create the new Toolbar in this group
    Set newToolBar = currMenuGroup.Toolbars.Add("TestMenu")

    ' Add an item to the new Toolbar and assign an Open macro
    ' (VBA equivalent of: "ESC ESC _open ")
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)
    Set newToolBarButton = newToolBar.AddToolbarButton(newToolBar.count + 1, "Open", "Open Macro", openMacro, False)

    ' Read icon paths for this Toolbar button
    GoSub READPATHS

    ' Change the default icon (smile face) for the new toolbar button
    SmallBitmapName = "C:\AutoCAD\16x16.bmp"     ' Use a 16x16 pixel .BMP image
    LargeBitmapName = "C:\AutoCAD\32x32.bmp"     ' Use a 32x32 pixel .BMP image
    newToolBarButton.SetBitmaps SmallBitmapName, LargeBitmapName

    ' Read icon paths for this Toolbar button
    GoSub READPATHS

    Exit Sub

READPATHS:
    ' Read icon paths for this Toolbar button
    newToolBarButton.GetBitmaps SmallBitmapName, LargeBitmapName
    MsgBox "The new Toolbar uses the following icon files: " & _
           vbCrLf & vbCrLf & "Small Bitmap: " & SmallBitmapName & vbCrLf & _
           "Large Bitmap: " & LargeBitmapName
    Return

ERRORTRAP:
    MsgBox "The following error has occurred: " & Err.Description
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetBitmaps()
    ;; This example uses MenuGroups to obtain a reference to the AutoCAD main menu.
    ;; It then creates a new Toolbar (TestMenu) and inserts a ToolBarButton
    ;; with a custom icon into it. The menu is automatically shown.
    ;;
    ;; * NOTE: The paths of the icons for the new toolbar should be updated
    ;; before running this example.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new Toolbar in this group
    (setq newToolBar (vla-Add (vla-get-Toolbars currMenuGroup) "TestToolbar"))

    ;; Add an item to the new Toolbar and assign an Open macro
    ;; (VBA equivalent of: "ESC ESC _open ")
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))
    (setq newButton (vla-AddToolbarButton newToolBar "" "NewButton" "Open a file." openMacro))

    ;; Read icon paths for this Toolbar button
    (vla-GetBitmaps newButton 'SmallBitmapName 'LargeBitmapName)
    (alert (strcat "The new Toolbar uses the following icon files: \n"
                   "Small Bitmap: " SmallBitmapName "\n"
                   "Large Bitmap: " LargeBitmapName))

    ;; Change the default icon (smile face) for the new toolbar button
    (setq SmallBitmapName "C:\\AutoCAD\\16x16.bmp")     ;; Use a 16x16 pixel .BMP image
    (setq LargeBitmapName "C:\\AutoCAD\\32x32.bmp")     ;; Use a 32x32 pixel .BMP image
    (vla-SetBitmaps newButton SmallBitmapName LargeBitmapName)

    ;; Read icon paths for this Toolbar button
    (vla-GetBitmaps newButton 'SmallBitmapName 'LargeBitmapName)
    (alert (strcat "The new Toolbar uses the following icon files: \n"
                   "Small Bitmap: " SmallBitmapName "\n"
                   "Large Bitmap: " LargeBitmapName))
)


SetBlockAttributeValue Method (ActiveX)

Sets the attribute value for an attribute in a block contained within a MLeader or Table object.

Supported platforms: Windows only

Signature - MLeader

VBA:

object.SetBlockAttributeValue attdefId, value
object

Type: MLeader

The object this method applies to.

attdefID

Access: Input-only

Type: Long_PTR

The attribute definition ID.

value

Access: Input-only

Type: String

The new attribute value.

Signature - Table

VBA:

object.SetBlockAttributeValue row, col, attdefId, StringValue
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row in the table.

col

Access: Input-only

Type: Long

The column in the table.

attdefId

Access: Input-only

Type: Long_PTR

The object ID of the attribute definition.

StringValue

Access: Input-only

Type: String

The attribute value.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Blockttribute()
    ' This example creates an MLeader object and gets and sets values for
    ' the block attribute type.

    Dim points(0 To 5) As Double

    points(0) = 0: points(1) = 4: points(2) = 0
    points(3) = 1.5: points(4) = 5: points(5) = 0

    Dim i As Long

    Dim oML As AcadMLeader
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    oML.ContentType = acBlockContent
    oML.ContentBlockType = acBlockBox

    Dim sBlock As String

    sBlock = oML.ContentBlockName

    Dim o As AcadEntity
    For Each o In ThisDrawing.Blocks(sBlock)
        If o.ObjectName = "AcDbAttributeDefinition" Then
            oML.SetBlockAttributeValue o.ObjectID, "123"
            MsgBox oML.GetBlockAttributeValue(o.ObjectID)
        End If
    Next o

    Update
    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_BlockAttribute()
    ;; This example creates an MLeader object and gets and sets values for
    ;; the block attribute type.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(0 4 0
                                  1.5 5 0
                                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (vla-put-ContentType oML acBlockContent)
    (vla-put-ContentBlockType oML acBlockBox)

    (setq sBlock (vla-get-ContentBlockName oML))

    (vlax-for o (vla-Item (vla-get-Blocks doc) sBlock)
        (if (= (vla-get-ObjectName o) "AcDbAttributeDefinition")
               (progn
                (vla-SetBlockAttributeValue oML (vla-get-ObjectID o) "123")
                (alert (vla-GetBlockAttributeValue oML (vla-get-ObjectID o)))
               )
        )
    )

    (vla-Update acadObj)
    (vla-ZoomExtents acadObj)
)


SetBlockAttributeValue2 Method (ActiveX)

Sets the attribute value associated to a specified block cell.

Supported platforms: Windows only

Signature

VBA:

object.SetBlockAttributeValue2 nRow, nCol, nContent, blkId, value
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value of the cell.

blkId

Access: Input-only

Type: Long_PTR

The block table record object id to check.

value

Access: Input-only

Type: String

The attribute value to set.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetBlockRotation Method (ActiveX)

Sets the block rotation angle for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

object.SetBlockRotation row, col, blkRotation
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

blkRotation

Access: Input-only

Type: Double

The block rotation angle.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetBlockScale Method (ActiveX)

Sets the block scale value for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

object.SetBlockScale row, col, blkScale
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

blkScale

Access: Input-only

Type: Double

The scale of the block.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetBlockTableRecordId Method (ActiveX)

Sets the block table record ID of the cell.

Supported platforms: Windows only

Signature

VBA:

object.SetBlockTableRecordId row, col, blkId, bAutoFit
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

blkId

Access: Input-only

Type: Long_PTR

The block table record object id to set in the cell.

bAutoFit

Access: Input-only

Type: Boolean

  • True: The block is set to auto fit the cell.
  • False: The block is not set to auto fit the cell.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetBlockTableRecordId2 Method (ActiveX)

Sets the block table record object id associated to a specified cell.

Supported platforms: Windows only

Signature

VBA:

object.SetBlockTableRecordId2 nRow, nCol, nContent, blkId, autoFit
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value of the cell.

blkId

Access: Input-only

Type: Long_PTR

The block table record object id to set.

autoFit

Access: Input-only

Type: Boolean

  • True: The block is set to auto fit the cell.
  • False: The block is not set to auto fit the cell.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetBreakHeight Method (ActiveX)

Sets the break height for the table.

Supported platforms: Windows only

Signature

VBA:

object.SetBreakHeight nIndex, dHeight
object

Type: Table

The object this method applies to.

nIndex

Access: Input-only

Type: Long

The index of the table.

dHeight

Access: Input-only

Type: Double

The new height value.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_BreakHeight()
    ' This example creates a table object and then breaks it into
    ' two tables.

    ' Create a new table objetc in model space
    Dim pt(2) As Double

    Dim modelSpace As AcadModelSpace
    Set modelSpace = ThisDrawing.modelSpace

    Dim table As AcadTable
    Set table = modelSpace.AddTable(pt, 5, 5, 10, 30)

    table.EnableBreak = True
    table.BreakSpacing = 3.5
    table.TableBreakHeight = 35#
    table.AllowManualHeights = True
    table.SetBreakHeight 0, 20#
    table.SetBreakHeight 1, 35#

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_BreakHeight()
    ;; This example creates a table object and then breaks it into
    ;; two tables.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create a new table objetc in model space
    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq table (vla-Addtable modelSpace pt 5 5 10 30))

    (vla-put-EnableBreak table :vlax-true)
    (vla-put-BreakSpacing table 3.5)
    (vla-put-TableBreakHeight table 35.0)
    (vla-put-AllowManualHeights table :vlax-true)
    (vla-SetBreakHeight table 0 20.0)
    (vla-SetBreakHeight table 1 35.0)

    (vla-ZoomExtents acadObj)
)


SetBulge Method (ActiveX)

Sets the bulge for the polyline at the given index.

Supported platforms: Windows only

Signature

VBA:

object.SetBulge Index, Value
object

Type: LWPolyline, Polyline

The objects this method applies to.

Index

Access: Input-only

Type: Long

The index location of the vertex you wish to set. The first vertex is index 0.

Value

Access: Input-only

Type: Double

The bulge value for the vertex at the given index.

Return Value (RetVal)

No return value.

Remarks

Polyline: this method will fail if the polyline Type property is not acSimplePoly.

The bulge is the tangent of 1/4 of the included angle for the arc between the selected vertex and the next vertex in the polyline's vertex list. A negative bulge value indicates that the arc goes clockwise from the selected vertex to the next vertex. A bulge of 0 indicates a straight segment, and a bulge of 1 is a semicircle.

Examples

VBA:

Sub Example_SetBulge()
    ' This example creates a lightweight polyline in model space.
    ' It then finds and changes the bulge for a given segment.

    Dim plineObj As AcadLWPolyline
    Dim points(0 To 11) As Double

    ' Define the 2D polyline points
    points(0) = 1: points(1) = 1
    points(2) = 1: points(3) = 2
    points(4) = 2: points(5) = 2
    points(6) = 3: points(7) = 2
    points(8) = 4: points(9) = 4
    points(10) = 4: points(11) = 1

    ' Create a lightweight Polyline object in model space
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    ZoomAll

    ' Find the bulge of the third segment
    Dim currentBulge As Double
    currentBulge = plineObj.GetBulge(3)
    MsgBox "The bulge for the third segment is " & plineObj.GetBulge(3), , "SetBulge Example"

    ' Change the bulge of the third segment
    plineObj.SetBulge 3, -0.5
    plineObj.Update
    MsgBox "The bulge for the third segment is now " & plineObj.GetBulge(3), , "SetBulge Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetBulge()
    ;; This example creates a lightweight polyline in model space.
    ;; It then finds and changes the bulge for a given segment.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the 2D polyline points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 11)))
    (vlax-safearray-fill points '(1 1
                                  1 2
                                  2 2
                                  3 2
                                  4 4
                                  4 1
                                 )
    )

    ;; Create a lightweight Polyline object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-ZoomAll acadObj)

    ;; Find the bulge of the third segment
    (setq currentBulge (vla-GetBulge plineObj 3))
    (alert (strcat "The bulge for the third segment is " (rtos (vla-GetBulge plineObj 3) 2)))

    ;; Change the bulge of the third segment
    (vla-SetBulge plineObj 3 -0.5)
    (vla-Update plineObj)
    (alert (strcat "The bulge for the third segment is now " (rtos (vla-GetBulge plineObj 3) 2)))
)


SetCellAlignment Method (ActiveX)

Sets the cell alignment for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

object.SetCellAlignment row, col, cellAlignment
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

cellAlignment

Access: Input-only

Type: AcCellAlignment enum

The cell alignment.

  • acBottomCenter
  • acBottomLeft
  • acBottomRight
  • acMiddleCenter
  • acMiddleLeft
  • acMiddleRight
  • acTopCenter
  • acTopLeft
  • acTopRight

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetCellBackgroundColor Method (ActiveX)

Sets the background true color value for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

object.SetCellBackgroundColor row, col, pColor
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

pColor

Access: Input-only

Type: AcCmColor

The AutoCAD true color object to assign to the background color of the cell.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetCellBackgroundColorNone Method (ActiveX)

Sets the value specifying that there is no background color for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

object.SetCellBackgroundColorNone row, col, bValue
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

bValue

Access: Input-only

Type: Boolean

  • True: Background color is enabled for the cell.
  • False: Background color is not enabled for the cell.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetCellClass Method (ActiveX)

Sets the class of a cell style.

Supported platforms: Windows only

Signature

VBA:

object.SetCellClass StringCellStyle, cellClass
object

Type: TableStyle

The object this method applies to.

StringCellStyle

Access: Input-only

Type: String

The cell style name.

cellClass

Access: Input-only

Type: Integer

The cell style class.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellClass()
    ' This example creates a TableStyle object and sets values for
    ' the style classes and formatting.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As IAcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.CreateCellStyle ("NewTestStyle")
    Dim cellTestFormat As String

    customObj.SetCellClass "NewTestStyle", 4

    customObj.SetRotation "NewTestStyle", 8.4

    MsgBox "The cell class is " & customObj.GetCellClass("NewTestStyle") & _
           " the cell rotation is " & customObj.GetRotation("NewTestStyle")
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellClass()
    ;; This example creates a TableStyle object and sets values for
    ;; the style classes and formatting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))

    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")
    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-CreateCellStyle customObj "NewTestStyle")

    (vla-SetCellClass customObj "NewTestStyle" 4)
    (vla-SetRotation customObj "NewTestStyle" 8.4)

    (alert (strcat "The cell class is " (itoa (vla-GetCellClass customObj "NewTestStyle"))
                   " and the cell rotation is " (rtos (vla-GetRotation customObj "NewTestStyle") 2) "."
           )
    )
)


SetCellContentColor Method (ActiveX)

Sets the true color value for the content of the specified row and column.

Supported platforms: Windows only

Signature

VBA:

object.SetCellContentColor row, col, pColor
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

pColor

Access: Input-only

Type: AcCmColor

The AutoCAD true color object to assign to the content of the cell.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetCellDataType Method (ActiveX)

Sets the cell data and unit type for the given row and column.

Supported platforms: Windows only

Signature

VBA:

object.SetCellDataType row, col, dataType, unitType
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row number of the cell to set.

col

Access: Input-only

Type: Long

The column number of the cell to set.

pDataType

Access: Input-only

Type: AcValueDataType enum

The new cell data type.

  • acBuffer
  • acDate
  • acDouble
  • acGeneral
  • acLong
  • acObjectId
  • acPoint2d
  • acPoint3d
  • acResbuf
  • acString
  • acUnknownDataType
pUnitType

Access: Input-only

Type: AcValueUnitType enum

The new cell unit type.

  • acUnitAngle
  • acUnitArea
  • acUnitDistance
  • acUnitless
  • acUnitVolume

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellManipulation()
    ' This example adds a table in model space and sets and gets a column name

    Dim MyModelSpace As AcadModelSpace
    Set MyModelSpace = ThisDrawing.modelSpace
    Dim pt(2) As Double
    Dim MyTable As AcadTable
    Dim cName As String
    Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30)

    Call MyTable.SetCellDataType(2, 2, acLong, acUnitDistance)
    Call MyTable.SetCellFormat(1, 3, "testFormat")
    Call MyTable.SetCellState(4, 3, acCellStateContentLocked)
    Call MyTable.SetCellValue(1, 4, 5)

    MsgBox MyTable.GetCellValue(1, 4) & " is the test cell's value "

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellManipulation()
    ;; This example adds a table in model space and sets and gets a column name
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MyTable (vla-AddTable modelSpace pt 5 5 10 30))

    (vla-SetCellDataType MyTable 2 2 acLong acUnitDistance)
    (vla-SetCellFormat MyTable 1 3 "testFormat")
    (vla-SetCellState MyTable 4 3 acCellStateContentLocked)
    (vla-SetCellValue MyTable 1 4 5)

    (alert (strcat (itoa (vlax-variant-value (vla-GetCellValue MyTable 1 4))) " is the test cell's value."))

    (vla-ZoomExtents acadObj)
)


SetCellFormat Method (ActiveX)

Sets the cell format for the given row and column.

Supported platforms: Windows only

Signature

VBA:

object.SetCellFormat row, col, pFormat
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row number of the cell to set.

col

Access: Input-only

Type: Long

The column number of the cell to set.

pFormat

Access: Input-only

Type: String

The new cell format.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellManipulation()
    ' This example adds a table in model space and sets and gets a column name

    Dim MyModelSpace As AcadModelSpace
    Set MyModelSpace = ThisDrawing.modelSpace
    Dim pt(2) As Double
    Dim MyTable As AcadTable
    Dim cName As String
    Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30)

    Call MyTable.SetCellDataType(2, 2, acLong, acUnitDistance)
    Call MyTable.SetCellFormat(1, 3, "testFormat")
    Call MyTable.SetCellState(4, 3, acCellStateContentLocked)
    Call MyTable.SetCellValue(1, 4, 5)

    MsgBox MyTable.GetCellValue(1, 4) & " is the test cell's value "

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellManipulation()
    ;; This example adds a table in model space and sets and gets a column name
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MyTable (vla-AddTable modelSpace pt 5 5 10 30))

    (vla-SetCellDataType MyTable 2 2 acLong acUnitDistance)
    (vla-SetCellFormat MyTable 1 3 "testFormat")
    (vla-SetCellState MyTable 4 3 acCellStateContentLocked)
    (vla-SetCellValue MyTable 1 4 5)

    (alert (strcat (itoa (vlax-variant-value (vla-GetCellValue MyTable 1 4))) " is the test cell's value."))

    (vla-ZoomExtents acadObj)
)


SetCellGridColor Method (ActiveX)

Sets the grid color value for an edge of the specified row and column.

Supported platforms: Windows only

Signature

VBA:

object.SetCellGridColor row, col, edges, pColor
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row number of the cell to set.

col

Access: Input-only

Type: Long

The column number of the cell to set.

edges

Access: Input-only

Type: AcCellEdgeMask enum

The cell edges.

  • acBottomMask
  • acLeftMask
  • acRightMask
  • acTopMask
pColor

Access: Input-only

Type: AcCmColor

The AutoCAD true color object to assign to the cell grid.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetCellGridLineWeight Method (ActiveX)

Sets the grid lineweight value for an edge of the specified row and column.

Supported platforms: Windows only

Signature

VBA:

object.SetCellGridLineWeight row, col, edges, Lineweight
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row number of the cell to set.

col

Access: Input-only

Type: Long

The column number of the cell to set.

edges

Access: Input-only

Type: AcCellEdgeMask enum

The cell edges.

  • acBottomMask
  • acLeftMask
  • acRightMask
  • acTopMask
Lineweight

Access: Input-only

Type: ACAD_LWEIGHT enum

The lineweight to apply to the cell grid.

  • acLnWt000
  • acLnWt005
  • acLnWt009
  • acLnWt013
  • acLnWt015
  • acLnWt018
  • acLnWt020
  • acLnWt025
  • acLnWt030
  • acLnWt035
  • acLnWt040
  • acLnWt050
  • acLnWt053
  • acLnWt060
  • acLnWt070
  • acLnWt080
  • acLnWt090
  • acLnWt100
  • acLnWt106
  • acLnWt120
  • acLnWt140
  • acLnWt158
  • acLnWt200
  • acLnWt211
  • acLnWtByLayer
  • acLnWtByBlock
  • acLnWtByLwDefault

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetCellGridVisibility Method (ActiveX)

Sets the grid visibility value for an edge of the specified row and column.

Supported platforms: Windows only

Signature

VBA:

object.SetCellGridVisibility row, col, edges, bValue
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row number of the cell to set.

col

Access: Input-only

Type: Long

The column number of the cell to set.

edges

Access: Input-only

Type: AcCellEdgeMask enum

The cell edges.

  • acBottomMask
  • acLeftMask
  • acRightMask
  • acTopMask
bValue

Access: Input-only

Type: Boolean

The visibility of the grid for the cell.

  • True: Grid is visible for the cell.
  • False: Grid is not visible for the cell.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetCellState Method (ActiveX)

Sets the state for a cell.

Supported platforms: Windows only

Signature

VBA:

object.SetCellState nRow, nCol, nLock
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The value of the row.

nCol

Access: Input-only

Type: Long

The value of the column.

nLock

Access: Input-only

Type: AcCellState enum

The new cell state.

  • acCellStateContentLocked
  • acCellStateContentModified
  • acCellStateContentReadOnly
  • acCellStateFormatLocked
  • acCellStateFormatModified
  • acCellStateFormatReadOnly
  • acCellStateLinked
  • acCellStateNone

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellManipulation()
    ' This example adds a table in model space and sets and gets a column name

    Dim MyModelSpace As AcadModelSpace
    Set MyModelSpace = ThisDrawing.modelSpace
    Dim pt(2) As Double
    Dim MyTable As AcadTable
    Dim cName As String
    Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30)

    Call MyTable.SetCellDataType(2, 2, acLong, acUnitDistance)
    Call MyTable.SetCellFormat(1, 3, "testFormat")
    Call MyTable.SetCellState(4, 3, acCellStateContentLocked)
    Call MyTable.SetCellValue(1, 4, 5)

    MsgBox MyTable.GetCellValue(1, 4) & " is the test cell's value "

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellManipulation()
    ;; This example adds a table in model space and sets and gets a column name
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MyTable (vla-AddTable modelSpace pt 5 5 10 30))

    (vla-SetCellDataType MyTable 2 2 acLong acUnitDistance)
    (vla-SetCellFormat MyTable 1 3 "testFormat")
    (vla-SetCellState MyTable 4 3 acCellStateContentLocked)
    (vla-SetCellValue MyTable 1 4 5)

    (alert (strcat (itoa (vlax-variant-value (vla-GetCellValue MyTable 1 4))) " is the test cell's value."))

    (vla-ZoomExtents acadObj)
)


SetCellStyle Method (ActiveX)

Sets a cell style to the cell.

Supported platforms: Windows only

Signature

VBA:

object.SetCellStyle nRow, nCol, szCellStyle
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

szCellStyle

Access: Input-only

Type: String

The cell style to set.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellManipulation()
    ' This example adds a table in model space and sets and gets a column name

    Dim MyModelSpace As AcadModelSpace
    Set MyModelSpace = ThisDrawing.modelSpace
    Dim pt(2) As Double
    Dim MyTable As AcadTable
    Dim cName As String
    Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30)

    Call MyTable.SetCellDataType(2, 2, acLong, acUnitDistance)
    Call MyTable.SetCellFormat(1, 3, "testFormat")
    Call MyTable.SetCellState(4, 3, acCellStateContentLocked)
    Call MyTable.SetCellValue(1, 4, 5)

    MsgBox MyTable.GetCellValue(1, 4) & " is the test cell's value "

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellManipulation()
    ;; This example adds a table in model space and sets and gets a column name
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MyTable (vla-AddTable modelSpace pt 5 5 10 30))

    (vla-SetCellDataType MyTable 2 2 acLong acUnitDistance)
    (vla-SetCellFormat MyTable 1 3 "testFormat")
    (vla-SetCellState MyTable 4 3 acCellStateContentLocked)
    (vla-SetCellValue MyTable 1 4 5)

    (alert (strcat (itoa (vlax-variant-value (vla-GetCellValue MyTable 1 4))) " is the test cell's value."))

    (vla-ZoomExtents acadObj)
)


SetCellTextHeight Method (ActiveX)

Sets the text height for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

object.SetCellTextHeight row, col, TextHeight
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

TextHeight

Access: Input-only

Type: Double

The text height for the cell.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetCellTextStyle Method (ActiveX)

Sets the text style name for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

object.SetCellTextStyle row, col, bstrName
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

bstrName

Access: Input-only

Type: String

The text style for the cell.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetCellType Method (ActiveX)

Sets the cell type for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

object.SetCellType row, col, CellType
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

CellType

Access: Input-only

Type: AcCellType enum

The cell type for the cell.

  • acBlockCell
  • acTextCell
  • acUnknownCell

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetCellValue Method (ActiveX)

Sets the cell value for the given row and column.

Supported platforms: Windows only

Signature

VBA:

object.SetCellValue row, col, val
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row number of the cell to set.

col

Access: Input-only

Type: Long

The column number of the cell to set.

val

Access: Output-only

Type: Variant

The new cell value.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellManipulation()
    ' This example adds a table in model space and sets and gets a column name

    Dim MyModelSpace As AcadModelSpace
    Set MyModelSpace = ThisDrawing.modelSpace
    Dim pt(2) As Double
    Dim MyTable As AcadTable
    Dim cName As String
    Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30)

    Call MyTable.SetCellDataType(2, 2, acLong, acUnitDistance)
    Call MyTable.SetCellFormat(1, 3, "testFormat")
    Call MyTable.SetCellState(4, 3, acCellStateContentLocked)
    Call MyTable.SetCellValue(1, 4, 5)

    MsgBox MyTable.GetCellValue(1, 4) & " is the test cell's value "

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellManipulation()
    ;; This example adds a table in model space and sets and gets a column name
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MyTable (vla-AddTable modelSpace pt 5 5 10 30))

    (vla-SetCellDataType MyTable 2 2 acLong acUnitDistance)
    (vla-SetCellFormat MyTable 1 3 "testFormat")
    (vla-SetCellState MyTable 4 3 acCellStateContentLocked)
    (vla-SetCellValue MyTable 1 4 5)

    (alert (strcat (itoa (vlax-variant-value (vla-GetCellValue MyTable 1 4))) " is the test cell's value."))

    (vla-ZoomExtents acadObj)
)


SetCellValueFromText Method (ActiveX)

Sets the cell value for the given row and column.

Supported platforms: Windows only

Signature

VBA:

object.SetCellValueFromText row, col, val, nOption
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row number of the cell to set.

col

Access: Input-only

Type: Long

The column number of the cell to set.

val

Access: Input-only

Type: String

The new cell value.

nOption

Access: Input-only

Type: AcParseOption enum

The type of content parsing to use.

  • acParseOptionNone
  • acPreserveMtextFormat
  • acSetDefaultFormat

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetColor Method (ActiveX)

Sets the true color value for the specified row types.

Supported platforms: Windows only

Signature

VBA:

object.SetColor rowTypes, pColor
object

Type: TableStyle

The object this method applies to.

rowTypes

Access: Input-only

Type: AcRowType enum

The row types to change.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow
pColor

Access: Input-only

Type: AcCmColor

The AutoCAD true color object to assign to the row types.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetColor()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Get the current TableStyle object
    Dim tableStyle As AcadTableStyle
    Set tableStyle = dictObj.Item(ThisDrawing.GetVariable("CTABLESTYLE"))

    Dim colCurrent As AcadAcCmColor, colRowCurrent As AcadAcCmColor, colNoneCurrent As Boolean
    Set colCurrent = tableStyle.GetBackgroundColor(AcRowType.acDataRow + AcRowType.acTitleRow)
    Set colRowCurrent = tableStyle.GetColor(acDataRow)
    colNoneCurrent = tableStyle.GetBackgroundColorNone(AcRowType.acHeaderRow)

    MsgBox "Table colors " & vbLf & _
           "Background ACI value = " & colCurrent.ColorIndex & vbLf & _
           "Row Text ACI value = " & colRowCurrent.ColorIndex & vbLf & _
           "Background None = " & colNoneCurrent

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 0, 0, 255
    tableStyle.SetBackgroundColor AcRowType.acTitleRow, col
    col.SetRGB 255, 0, 0
    tableStyle.SetColor AcRowType.acDataRow, col
    If colNoneCurrent = False Then
        tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, True
    Else
        tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, False
    End If

    Dim colNew As AcadAcCmColor, colRowNew As AcadAcCmColor, colNoneNew As Boolean
    Set colNew = tableStyle.GetBackgroundColor(AcRowType.acTitleRow)
    Set colRowNew = tableStyle.GetColor(acDataRow)
    colNoneNew = tableStyle.GetBackgroundColorNone(acHeaderRow)

    MsgBox "Table colors " & vbLf & _
           "Background ACI value = " & colNew.ColorIndex & vbLf & _
           "Row Text ACI value = " & colRowNew.ColorIndex & vbLf & _
           "Background None = " & colNoneNew

    tableStyle.SetBackgroundColor AcRowType.acTitleRow, colCurrent
    tableStyle.SetColor AcRowType.acDataRow, colRowCurrent
    tableStyle.SetBackgroundColorNone AcRowType.acHeaderRow, colNoneCurrent

    MsgBox "Reset the table style back to its original values."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetColor()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Get the current TableStyle object
    (setq tableStyle (vla-Item dictObj (vla-GetVariable doc "CTABLESTYLE")))

    (setq colCurrent (vla-GetBackgroundColor tableStyle (+ acDataRow acTitleRow)))
    (setq colRowCurrent (vla-GetColor tableStyle acDataRow))
    (setq colNoneCurrent (vla-GetBackgroundColorNone tableStyle acHeaderRow))

    (alert (strcat "Table colors \n"
                         "Background ACI value = " (itoa (vla-get-ColorIndex colCurrent)) "\n"
                         "Row Text ACI value = " (itoa (vla-get-ColorIndex colRowCurrent)) "\n"
                         "Background None = " (if (= colNoneCurrent :vlax-true) "True" "False")))

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 0 0 255)
    (vla-SetBackgroundColor tableStyle acTitleRow col)
    (vla-SetRGB col 255 0 0)
    (vla-SetColor tableStyle acDataRow col)
    (vla-SetBackgroundColorNone tableStyle acHeaderRow (if (= colNoneCurrent :vlax-true) :vlax-false :vlax-true))

    (setq colNew (vla-GetBackgroundColor tableStyle acTitleRow))
    (setq colRowNew (vla-GetColor tableStyle acDataRow))
    (setq colNoneNew (vla-GetBackgroundColorNone tableStyle acHeaderRow))
    (alert (strcat "Table colors \n"
                         "Background ACI value = " (itoa (vla-get-ColorIndex colNew)) "\n"
                         "Row Text ACI value = " (itoa (vla-get-ColorIndex colRowNew)) "\n"
                         "Background None = " (if (= colNoneNew :vlax-true) "True" "False")))

    (vla-SetBackgroundColor tableStyle acTitleRow colCurrent)
    (vla-SetColor tableStyle acDataRow colRowCurrent)
    (vla-SetBackgroundColorNone tableStyle acHeaderRow colNoneCurrent)

    (alert "Reset the table style back to its original values.")

    (vlax-release-object col)
)


SetColor2 Method (ActiveX)

Sets the color value for the specified named cell style.

Supported platforms: Windows only

Signature

VBA:

object.SetColor2 bstrCellStyle, color
object

Type: TableStyle

The object this method applies to.

bstrCellStyle

Access: Input-only

Type: String

The named cell style.

color

Access: Input-only

Type: AcCmColor

The AutoCAD color object to assign to the cell style.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetColorBookColor Method (ActiveX)

Specifies the color name from an existing color book.

Supported platforms: Windows only

Signature

VBA:

object.SetColorBookColor BookName, ColorName
object

Type: AcCmColor

The object this method applies to.

BookName

Access: Input-only

Type: String

The file name of the color book.

ColorName

Access: Input-only

Type: String

The name of the color.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetColorBookColor()
    ' This example draws a line and specifies a color name
    ' from an existing color book.

    Dim FirstColor As AcadAcCmColor
    Set FirstColor = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    FirstColor.SetRGB 80, 100, 244

    Dim line As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double

    startPoint(0) = 1#: startPoint(1) = 1#: startPoint(2) = 0#
    endPoint(0) = 5#: endPoint(1) = 5#: endPoint(2) = 0#

    Set line = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    ZoomAll

    FirstColor.SetColorBookColor "PANTONE+ Solid Uncoated", "PANTONE Yellow 012 U"
    line.TrueColor = FirstColor
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetColorBookColor()
    ;; This example draws a line and specifies a color name
    ;; from an existing color book.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq FirstColor (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB FirstColor 80 100 244)

    (setq startPoint (vlax-3d-point 1 1 0)
          endPoint (vlax-3d-point 5 5 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-ZoomAll acadObj)

    (vla-SetColorBookColor FirstColor "PANTONE+ Solid Uncoated" "PANTONE Yellow 012 U")
    (vla-put-TrueColor lineObj FirstColor)

    (vlax-release-object FirstColor)
)


SetColumnName Method (ActiveX)

Sets a name to a column.

Supported platforms: Windows only

Signature

VBA:

object.SetColumnName nIndex, name
object

Type: Table

The object this method applies to.

nIndex

Access: Input-only

Type: Long

The index of the column.

name

Access: Input-only

Type: String

The new name.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ColumnName()
     ' This example adds a table in model space and sets and gets a column name

    Dim MyModelSpace As AcadModelSpace
    Set MyModelSpace = ThisDrawing.ModelSpace
    Dim pt(2) As Double
    Dim MyTable As AcadTable
    Dim cName As String
    Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30)

    Call MyTable.SetColumnName(2, "Test Name")
    MsgBox "The column name is: " & vbCrLf & _
           MyTable.GetColumnName(2)

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ColumnName()
    ;; This example adds a table in model space and sets and gets a column name
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MyTable (vla-AddTable modelSpace pt 5 5 10 30))

    (vla-SetColumnName MyTable 2 "Test Name")
    (alert (strcat "The column name is: \n"
                   (vla-GetColumnName MyTable 2)))

    (vla-ZoomExtents acadObj)
)


SetColumnWidth Method (ActiveX)

Sets the column width for the column at the specified column index in the table.

Supported platforms: Windows only

Signature

VBA:

object.SetColumnWidth col, Width
object

Type: Table

The object this method applies to.

col

Access: Input-only

Type: Long

The column in the table.

Width

Access: Input-only

Type: Double

The width to assign to the column.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetContentColor Method (ActiveX)

Sets the true color value for the specified row types.

Supported platforms: Windows only

Signature

VBA:

object.SetContentColor rowTypes, pColor
object

Type: Table

The object this method applies to.

rowTypes

Access: Input-only

Type: AcRowType enum

The row types to change.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow
pColor

Access: Input-only

Type: AcCmColor

The AutoCAD true color object to assign to the row types.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetContentColor2 Method (ActiveX)

Sets the color value for the cell content based on the row, column, and content location.

Supported platforms: Windows only

Signature

VBA:

object.SetContentColor2 nRow, nCol, nContent, pColor
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row in the table.

nCol

Access: Input-only

Type: Long

The column in the table.

nContent

Access: Input-only

Type: Long

The content location in a cell.

pColor

Access:

Type: AcCmColor

The AutoCAD true color object to assign to the specified content in the cell.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetContentLayout Method (ActiveX)

Sets the content layout for a cell.

Supported platforms: Windows only

Signature

VBA:

object.SetContentLayout nRow, nCol, nLayout
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The value of the row.

nCol

Access: Input-only

Type: Long

The value of the column.

nLayout

Access: Input-only

Type: AcCellContentLayout enum

The new layout value.

  • acCellContentLayoutFlow
  • acCellContentLayoutStackedHorizontal
  • acCellContentLayoutStackedVertical

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetControlPoint Method (ActiveX)

Sets the control point of the spline at a given index.

Supported platforms: Windows only

Signature

VBA:

object.SetControlPoint Index, Value
object

Type: Spline

The object this method applies to.

Index

Access: Input-only

Type: Long

The index location of the control point you wish to set. The first control point is index 0.

Value

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the control point for the spline at the given index location.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetControlPoint()
    ' This example creates a spline object in model space.
    ' It then finds the coordinates of the first control point
    ' and changes that value.

    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ZoomAll

    ' Display the coordinates of the first control point
    Dim controlPoint As Variant
    controlPoint = splineObj.GetControlPoint(0)
    MsgBox "Control point 1 is at " & controlPoint(0) & ", " & controlPoint(1) & ", " & controlPoint(2), , "SetControlPoint Example"

    ' Change the coordinates of the first fit point
    controlPoint(0) = 0: controlPoint(1) = 3: controlPoint(2) = 0
    splineObj.SetControlPoint 0, controlPoint
    splineObj.Update
    MsgBox "Control point 1 is now at " & controlPoint(0) & ", " & controlPoint(1) & ", " & controlPoint(2), , "SetControlPoint Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetControlPoint()
    ;; This example creates a spline object in model space.
    ;; It then finds the coordinates of the first control point
    ;; and changes that value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the spline
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(1 1 0
                                     5 5 0
                                     10 0 0
                                    )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)

    ;; Display the coordinates of the first control point
    (setq controlPoint (vlax-safearray->list (vlax-variant-value (vla-GetControlPoint splineObj 0))))
    (alert (strcat "Control point 1 is at " (rtos (nth 0 controlPoint) 2) ", " (rtos (nth 1 controlPoint) 2) ", " (rtos (nth 2 controlPoint) 2)))

    ;; Change the coordinate of the first fit point
    (setq controlPoint (vlax-3d-point 0 3 0))
    (vla-SetControlPoint splineObj 0 controlPoint)
    (vla-Update splineObj)
    (setq controlPoint (vlax-safearray->list (vlax-variant-value (vla-GetControlPoint splineObj 0))))
    (alert (strcat "Control point 1 is now at " (rtos (nth 0 controlPoint) 2) ", " (rtos (nth 1 controlPoint) 2) ", " (rtos (nth 2 controlPoint) 2)))
)


SetCustomByIndex Method (ActiveX)

Sets the custom property name (key) and value that correspond to an index value.

Supported platforms: Windows only

Signature

VBA:

object.SetCustomByIndex Index, key, Value
object

Type: SummaryInfo

The object this method applies to.

Index

Access: Input-only

Type: Long

The index value of the property. The index range is from zero to one less than the number of custom properties.

key

Access: Input-only

Type: String

The custom property name for the index value.

Value

Access: Input-only

Type: String

The custom property value for the index value.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetCustomByIndex()
    ' This example shows how to access drawing properties

    ' Add and display standard properties
    ThisDrawing.SummaryInfo.Author = "John Doe"
    ThisDrawing.SummaryInfo.Comments = "Includes all ten levels of Building Five"
    ThisDrawing.SummaryInfo.HyperlinkBase = "http://www.autodesk.com"
    ThisDrawing.SummaryInfo.Keywords = "Building Complex"
    ThisDrawing.SummaryInfo.LastSavedBy = "JD"
    ThisDrawing.SummaryInfo.RevisionNumber = "4"
    ThisDrawing.SummaryInfo.Subject = "Plan for Building Five"
    ThisDrawing.SummaryInfo.Title = "Building Five"

    Author = ThisDrawing.SummaryInfo.Author
    Comments = ThisDrawing.SummaryInfo.Comments
    HLB = ThisDrawing.SummaryInfo.HyperlinkBase
    KW = ThisDrawing.SummaryInfo.Keywords
    LSB = ThisDrawing.SummaryInfo.LastSavedBy
    RN = ThisDrawing.SummaryInfo.RevisionNumber
    Subject = ThisDrawing.SummaryInfo.Subject
    Title = ThisDrawing.SummaryInfo.Title
    MsgBox "The standard drawing properties are " & vbCrLf & _
           "Author = " & Author & vbCrLf & _
           "Comments = " & Comments & vbCrLf & _
           "HyperlinkBase = " & HLB & vbCrLf & _
           "Keywords = " & KW & vbCrLf & _
           "LastSavedBy = " & LSB & vbCrLf & _
           "RevisionNumber = " & RN & vbCrLf & _
           "Subject = " & Subject & vbCrLf & _
           "Title = " & Title & vbCrLf

    ' Add and display custom properties
    Dim Key0 As String
    Dim Value0 As String
    Dim Key1 As String
    Dim Value1 As String
    Dim CustomPropertyBranch As String
    Dim PropertyBranchValue As String
    Dim CustomPropertyZone As String
    Dim PropertyZoneValue As String

    CustomPropertyBranch = "Branch"
    PropertyBranchValue = "Main"
    CustomPropertyZone = "Zone"
    PropertyZoneValue = "Industrial"

    ' Add custom properties
    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 1) Then
        ThisDrawing.SummaryInfo.SetCustomByIndex 0, CustomPropertyBranch, PropertyBranchValue
    Else
        ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyBranch, PropertyBranchValue
    End If

    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 2) Then
         ThisDrawing.SummaryInfo.SetCustomByKey CustomPropertyBranch, "Satellite"
    Else
         ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyZone, PropertyZoneValue
    End If

    'Get custom properties
    ThisDrawing.SummaryInfo.GetCustomByIndex 0, Key0, Value0
    Key1 = CustomPropertyZone
    ThisDrawing.SummaryInfo.GetCustomByKey Key1, Value1

    MsgBox "The custom drawing properties are " & vbCrLf & _
           "First property name = " & Key0 & vbCrLf & _
           "First property value = " & Value0 & vbCrLf & _
           "Second property name = " & Key1 & vbCrLf & _
           "Second property value = " & Value1 & vbCrLf
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetCustomByIndex()
    ;; This example shows how to access drawing properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq summaryInfo (vla-get-SummaryInfo doc))

    ;; Add and display standard properties
    (vla-put-Author summaryInfo "John Doe")
    (vla-put-Comments summaryInfo "Includes all ten levels of Building Five")
    (vla-put-HyperlinkBase summaryInfo "http://www.autodesk.com")
    (vla-put-Keywords summaryInfo "Building Complex")
    (vla-put-LastSavedBy summaryInfo "JD")
    (vla-put-RevisionNumber summaryInfo "4")
    (vla-put-Subject summaryInfo "Plan for Building Five")
    (vla-put-Title summaryInfo "Building Five")

    (setq author (vla-get-Author summaryInfo))
    (setq comments (vla-get-Comments summaryInfo))
    (setq HLB (vla-get-HyperlinkBase summaryInfo))
    (setq KW (vla-get-Keywords summaryInfo))
    (setq LSB (vla-get-LastSavedBy summaryInfo))
    (setq RN (vla-get-RevisionNumber summaryInfo))
    (setq subject (vla-get-Subject summaryInfo))
    (setq Title (vla-get-Title summaryInfo))
    (alert (strcat "The standard drawing properties are "
                   "\nAuthor = " author
                   "\nComments = " comments
                   "\nHyperlinkBase = " HLB
                   "\nKeywords = " KW
                   "\nLastSavedBy = " LSB
                   "\nRevisionNumber = " RN
                   "\nSubject = " Subject
                   "\nTitle = " Title
           )
    )

    ;; Add and display custom properties
    (setq CustomPropertyBranch "Branch")
    (setq PropertyBranchValue "Main")
    (setq CustomPropertyZone "Zone")
    (setq PropertyZoneValue "Industrial")

    ;; Add custom properties
    (if (>= (vla-NumCustomInfo summaryInfo) 1)
        (vla-SetCustomByIndex summaryInfo 0 CustomPropertyBranch PropertyBranchValue)
        (vla-AddCustomInfo summaryInfo CustomPropertyBranch PropertyBranchValue)
    )

    (if (>= (vla-NumCustomInfo summaryInfo) 2)
        (vla-SetCustomByKey summaryInfo CustomPropertyBranch "Satellite")
        (vla-AddCustomInfo summaryInfo CustomPropertyZone PropertyZoneValue)
    )

    ;; Get custom properties
    (vla-GetCustomByIndex summaryInfo 0 'Key0 'Value0)
    (setq Key1 CustomPropertyZone)
    (vla-GetCustomByKey summaryInfo Key1 'Value1)

    (alert (strcat "The custom drawing properties are "
                   "\nFirst property name = " Key0
                   "\nFirst property value = " Value0
                   "\nSecond property name = " Key1
                   "\nSecond property value = " Value1
           )
    )
)


SetCustomByKey Method (ActiveX)

Sets the custom property value that corresponds to a name (key) value.

Supported platforms: Windows only

Signature

VBA:

object.SetCustomByKey key, pValue
object

Type: SummaryInfo

The object this method applies to.

key

Access: Input-only

Type: String

The name of the custom property.

pValue

Access: Input-only

Type: String

The value for the custom property name.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetCustomByKey()
    ' This example shows how to access drawing properties

    ' Add and display standard properties
    ThisDrawing.SummaryInfo.Author = "John Doe"
    ThisDrawing.SummaryInfo.Comments = "Includes all ten levels of Building Five"
    ThisDrawing.SummaryInfo.HyperlinkBase = "http://www.autodesk.com"
    ThisDrawing.SummaryInfo.Keywords = "Building Complex"
    ThisDrawing.SummaryInfo.LastSavedBy = "JD"
    ThisDrawing.SummaryInfo.RevisionNumber = "4"
    ThisDrawing.SummaryInfo.Subject = "Plan for Building Five"
    ThisDrawing.SummaryInfo.Title = "Building Five"

    Author = ThisDrawing.SummaryInfo.Author
    Comments = ThisDrawing.SummaryInfo.Comments
    HLB = ThisDrawing.SummaryInfo.HyperlinkBase
    KW = ThisDrawing.SummaryInfo.Keywords
    LSB = ThisDrawing.SummaryInfo.LastSavedBy
    RN = ThisDrawing.SummaryInfo.RevisionNumber
    Subject = ThisDrawing.SummaryInfo.Subject
    Title = ThisDrawing.SummaryInfo.Title
    MsgBox "The standard drawing properties are " & vbCrLf & _
           "Author = " & Author & vbCrLf & _
           "Comments = " & Comments & vbCrLf & _
           "HyperlinkBase = " & HLB & vbCrLf & _
           "Keywords = " & KW & vbCrLf & _
           "LastSavedBy = " & LSB & vbCrLf & _
           "RevisionNumber = " & RN & vbCrLf & _
           "Subject = " & Subject & vbCrLf & _
           "Title = " & Title & vbCrLf

    ' Add and display custom properties
    Dim Key0 As String
    Dim Value0 As String
    Dim Key1 As String
    Dim Value1 As String
    Dim CustomPropertyBranch As String
    Dim PropertyBranchValue As String
    Dim CustomPropertyZone As String
    Dim PropertyZoneValue As String

    CustomPropertyBranch = "Branch"
    PropertyBranchValue = "Main"
    CustomPropertyZone = "Zone"
    PropertyZoneValue = "Industrial"

    ' Add custom properties
    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 1) Then
        ThisDrawing.SummaryInfo.SetCustomByIndex 0, CustomPropertyBranch, PropertyBranchValue
    Else
        ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyBranch, PropertyBranchValue
    End If

    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 2) Then
         ThisDrawing.SummaryInfo.SetCustomByKey CustomPropertyBranch, "Satellite"
    Else
         ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyZone, PropertyZoneValue
    End If

    'Get custom properties
    ThisDrawing.SummaryInfo.GetCustomByIndex 0, Key0, Value0
    Key1 = CustomPropertyZone
    ThisDrawing.SummaryInfo.GetCustomByKey Key1, Value1

    MsgBox "The custom drawing properties are " & vbCrLf & _
           "First property name = " & Key0 & vbCrLf & _
           "First property value = " & Value0 & vbCrLf & _
           "Second property name = " & Key1 & vbCrLf & _
           "Second property value = " & Value1 & vbCrLf
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetCustomByKey()
    ;; This example shows how to access drawing properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq summaryInfo (vla-get-SummaryInfo doc))

    ;; Add and display standard properties
    (vla-put-Author summaryInfo "John Doe")
    (vla-put-Comments summaryInfo "Includes all ten levels of Building Five")
    (vla-put-HyperlinkBase summaryInfo "http://www.autodesk.com")
    (vla-put-Keywords summaryInfo "Building Complex")
    (vla-put-LastSavedBy summaryInfo "JD")
    (vla-put-RevisionNumber summaryInfo "4")
    (vla-put-Subject summaryInfo "Plan for Building Five")
    (vla-put-Title summaryInfo "Building Five")

    (setq author (vla-get-Author summaryInfo))
    (setq comments (vla-get-Comments summaryInfo))
    (setq HLB (vla-get-HyperlinkBase summaryInfo))
    (setq KW (vla-get-Keywords summaryInfo))
    (setq LSB (vla-get-LastSavedBy summaryInfo))
    (setq RN (vla-get-RevisionNumber summaryInfo))
    (setq subject (vla-get-Subject summaryInfo))
    (setq Title (vla-get-Title summaryInfo))
    (alert (strcat "The standard drawing properties are "
                   "\nAuthor = " author
                   "\nComments = " comments
                   "\nHyperlinkBase = " HLB
                   "\nKeywords = " KW
                   "\nLastSavedBy = " LSB
                   "\nRevisionNumber = " RN
                   "\nSubject = " Subject
                   "\nTitle = " Title
           )
    )

    ;; Add and display custom properties
    (setq CustomPropertyBranch "Branch")
    (setq PropertyBranchValue "Main")
    (setq CustomPropertyZone "Zone")
    (setq PropertyZoneValue "Industrial")

    ;; Add custom properties
    (if (>= (vla-NumCustomInfo summaryInfo) 1)
        (vla-SetCustomByIndex summaryInfo 0 CustomPropertyBranch PropertyBranchValue)
        (vla-AddCustomInfo summaryInfo CustomPropertyBranch PropertyBranchValue)
    )

    (if (>= (vla-NumCustomInfo summaryInfo) 2)
        (vla-SetCustomByKey summaryInfo CustomPropertyBranch "Satellite")
        (vla-AddCustomInfo summaryInfo CustomPropertyZone PropertyZoneValue)
    )

    ;; Get custom properties
    (vla-GetCustomByIndex summaryInfo 0 'Key0 'Value0)
    (setq Key1 CustomPropertyZone)
    (vla-GetCustomByKey summaryInfo Key1 'Value1)

    (alert (strcat "The custom drawing properties are "
                   "\nFirst property name = " Key0
                   "\nFirst property value = " Value0
                   "\nSecond property name = " Key1
                   "\nSecond property value = " Value1
           )
    )
)


SetCustomData Method (ActiveX)

Sets the custom data associated to a cell.

Supported platforms: Windows only

Signature

VBA:

object.SetCustomData nRow, nCol, szKey, data
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

szKey

Access: Input-only

Type: String

The input key of the AcDbEvalContextPair.

data

Access: Input-only

Type: Variant

The custom data to store.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetCustomScale Method (ActiveX)

Sets the custom scale for a layout or plot configuration.

Supported platforms: Windows only

Signature

VBA:

object.SetCustomScale Numerator, Denominator
object

Type: Layout, PlotConfiguration

The objects this method applies to.

Numerator

Access: Input-only

Type: Double

A positive number representing the numerator in the scale ratio. This value represents the number of inches or mm for the scale.

Denominator

Access: Input-only

Type: Double

A positive number representing the denominator in the scale ratio. This value represents the number of drawing units for the scale.

Return Value (RetVal)

No return value.

Remarks

The units for the Numerator parameter can be found in the PaperUnits property.

The Numerator and Denominator parameters must be greater than zero.

Changes made by this method will not be visible until after a regeneration of the drawing. Use the Regen method to regenerate the drawing.

Examples

VBA:

Sub Example_SetCustomScale()
    ' This example will access the Layouts collection for the current drawing
    ' and list basic information about the custom scale for each Layout.
    ' It will then change the custom scale information for model space and re-display
    ' the scale information.

    Dim Layouts As AcadLayouts, Layout As ACADLayout
    Dim msg As String
    Dim Numerator As Double, Denominator As Double
    Dim Measurement As String

    ' Display current scale information
    GoSub DISPLAY_SCALE_INFO

    ' Modify scale
    Numerator = 1
    Denominator = 1

    ThisDrawing.Layouts("Model").SetCustomScale Numerator, Denominator
    ThisDrawing.Regen acAllViewports

    ' Display new scale information
    GoSub DISPLAY_SCALE_INFO

    Exit Sub

DISPLAY_SCALE_INFO:
    ' Get layouts collection from document object
    Set Layouts = ThisDrawing.Layouts

    msg = vbCrLf & vbCrLf   ' Start with a space

    ' Get the scale information of every layout in this drawing
    For Each Layout In Layouts
        msg = msg & Layout.name & vbCrLf

        ' Get scale information
        Layout.GetCustomScale Numerator, Denominator

        ' Identify whether inches or millimeters are being used.
        Measurement = IIf(Layout.PaperUnits = acInches, " inch(es)", " millimeter(s)")

        ' Format for display
        msg = msg & vbTab & "Contains " & Numerator & Measurement & vbCrLf
        msg = msg & vbTab & "Contains " & Denominator & " drawing units" & vbCrLf
        msg = msg & "_____________________" & vbCrLf

    Next

    ' Display custom scale information
    MsgBox "Custom scale information for the current drawing is: " & msg

    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetCustomScale()
    ;; This example will access the Layouts collection for the current drawing
    ;; and list basic information about the custom scale for each Layout.
    ;; It will then change the custom scale information for model space and re-display
    ;; the scale information.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Display current scale information
    (setq Layouts (vla-get-Layouts doc))

    (setq msg "")

    ;; Get the scale information of every layout in this drawing
    (vlax-for Layout Layouts
        (setq msg (strcat msg (vla-get-Name Layout) "\n"))

        ;; Get scale information
        (vla-GetCustomScale Layout 'Numerator 'Denominator)

        ;; Are we using inches or millimeters
        (setq Measurement (if (= (vla-get-PaperUnits Layout) acInches) " inch(es)\n" " millimeter(s)\n"))

        ;; Format for display
        (setq msg (strcat msg "  Contains " (rtos Numerator 2) Measurement
                              "  Contains " (rtos Denominator 2) " drawing units\n"
                              "_____________________\n"))
    )

    ;; Display custom scale information
    (alert (strcat "Custom scale information for the current drawing is: " msg))

    ;; Modify scale
    (setq Numerator 1
          Denominator 1)

    (vla-SetCustomScale (vla-Item (vla-get-Layouts doc) "Model") Numerator Denominator)
    (vla-Regen doc acAllViewports)

    ;; Display new scale information
    (setq Layouts (vla-get-Layouts doc))

    (setq msg "")

    ;; Get the scale information of every layout in this drawing
    (vlax-for Layout Layouts
        (setq msg (strcat msg (vla-get-Name Layout) "\n"))

        ;; Get scale information
        (vla-GetCustomScale Layout 'Numerator 'Denominator)

        ;; Are we using inches or millimeters
        (setq Measurement (if (= (vla-get-PaperUnits Layout) acInches) " inch(es)\n" " millimeter(s)\n"))

        ;; Format for display
        (setq msg (strcat msg "  Contains " (rtos Numerator 2) Measurement
                              "  Contains " (rtos Denominator 2) " drawing units\n"
                              "_____________________\n"))
    )

    ;; Display custom scale information
    (alert (strcat "Custom scale information for the current drawing is: " msg))
)


SetDatabase Method (ActiveX)

Associates an AutoCAD database with the LayerStateManager object.

Supported platforms: Windows only

Signature

VBA:

object.SetDatabase Database
object

Type: LayerStateManager

The object this method applies to.

Database

Access: Input-only

Type: Database

The Database object to be associated with the LayerStateManager object.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetDatabase()
    ' The following code saves the color and linetype settings
    ' of the current layer. It uses the SetDatabase method to
    ' associate the current drawing database with the
    ' LayerStateManager object.

    Dim oLSM As AcadLayerStateManager

    ' Access the LayerStateManager object
    Set oLSM = ThisDrawing.Application. _
       GetInterfaceObject("AutoCAD.AcadLayerStateManager.20")

    ' Associate the current drawing database with LayerStateManager
    oLSM.SetDatabase ThisDrawing.Database

    oLSM.Save "ColorLinetype", acLsColor + acLsLineType

End Sub

Visual LISP:

(defun c:Example_SetDatabase()
    ;; The following code saves the color and linetype settings
    ;; of the current layer. It uses the SetDatabase method to
    ;; associate the current drawing database with the
    ;; LayerStateManager object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Access the LayerStateManager object
    (setq oLSM (vla-GetInterfaceObject acadObj "AutoCAD.AcadLayerStateManager.20"))

    ;; Associate the current drawing database with LayerStateManager
    (vla-SetDatabase oLSM (vla-get-Database doc))

    (vla-Save oLSM "ColorLinetype" (+ acLsColor acLsLineType))
)


SetDataFormat Method (ActiveX)

Sets the format for the cell.

Supported platforms: Windows only

Signature

VBA:

object.SetDataFormat nRow, nCol, nContent, szFormat
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value of the cell.

szFormat

Access: Input-only

Type: String

A string holding the value.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetDataType Method (ActiveX)

Sets the data type and unit type for the specified row type.

Supported platforms: Windows only

Signature

VBA:

object.SetDataType rowTypes, nDataType, nUnitType
object

Type: Table, TableStyle

The objects this method applies to.

rowTypes

Access: Input-only

Type: AcRowType enum

The row types to change.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow
nDataType

Access: Input-only

Type: AcValueDataType enum

The new data type.

  • acBuffer
  • acDate
  • acDouble
  • acGeneral
  • acLong
  • acObjectId
  • acPoint2d
  • acPoint3d
  • acResbuf
  • acString
  • acUnknownDataType
nUnitType

Access: Input-only

Type: AcValueUnitType enum

The new unit type.

  • acUnitAngle
  • acUnitArea
  • acUnitDistance
  • acUnitless
  • acUnitVolume

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetDataType2 Method (ActiveX)

Sets the row data type and unit type for the specified row type and nContent.

Supported platforms: Windows only

Signature

VBA:

object.SetDataType2 nRow, nCol, nContent, dataType, unitType
object

Type: Table, TableStyle

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value for the cell.

dataType

Access: Input-only

Type: AcValueDataType enum

The new data type.

  • acBuffer
  • acDate
  • acDouble
  • acGeneral
  • acLong
  • acObjectId
  • acPoint2d
  • acPoint3d
  • acResbuf
  • acString
  • acUnknownDataType
unitType

Access: Input-only

Type: AcValueUnitType enum

The new unit type.

  • acUnitAngle
  • acUnitArea
  • acUnitDistance
  • acUnitless
  • acUnitVolume

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetDoglegDirection Method (ActiveX)

Sets the dog leg direction of the specific leader.

Supported platforms: Windows only

Signature

VBA:

object.SetDoglegDirection leaderIndex, dirVec
object

Type: MLeader

The object this method applies to.

leaderIndex

Access: Input-only

Type: Integer

The index of the leader cluster where the new leader line is to be added.

dirVec

Access: Input-only

Type: Variant (three-element array of doubles)

The indexes of leaderlines owned by the input leader.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetFieldId Method (ActiveX)

Sets the field object ID of the specified cell.

Supported platforms: Windows only

Signature

VBA:

object.SetFieldId row, col, fieldId
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

fieldId

Access: Input-only

Type: Long_PTR

The field object ID.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetFieldId2 Method (ActiveX)

Sets the field object id associated to a specified cell.

Supported platforms: Windows only

Signature

VBA:

object.SetFieldId2 nRow, nCol, nContent, acDbObjectId, nflag
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value of the cell.

acDbObjectId

Access: Input-only

Type: Long_PTR

The field object id to set.

nflag

Access: Input-only

Type: AcCellOption enum

The cell inheritance flag.

  • kCellOptionNone
  • kInheritCellFormat

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetFitPoint Method (ActiveX)

Sets a fit point for the spline.

Supported platforms: Windows only

Signature

VBA:

object.SetFitPoint Index, Value
object

Type: Spline

The object this method applies to.

Index

Access: Input-only

Type: Long

The index location of the fit point you wish to set. The first fit point is index 0.

Value

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the fit point for the spline at the given index location.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetFitPoint()
    ' This example creates a spline object in model space.
    ' It then finds the coordinates of the first fit point
    ' and changes that value.

    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ZoomAll

    ' Display the coordinates of the first fit point
    Dim fitPoint As Variant
    fitPoint = splineObj.GetFitPoint(0)
    MsgBox "Fit point 1 is at " & fitPoint(0) & ", " & fitPoint(1) & ", " & fitPoint(2), , "SetFitPoint Example"

    ' Change the coordinates of the first fit point
    fitPoint(0) = 0: fitPoint(1) = 3: fitPoint(2) = 0
    splineObj.SetFitPoint 0, fitPoint
    splineObj.Update
    MsgBox "Fit point 1 is now at " & fitPoint(0) & ", " & fitPoint(1) & ", " & fitPoint(2), , "SetFitPoint Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetFitPoint()
    ;; This example creates a spline object in model space.
    ;; It then finds the coordinates of the first fit point
    ;; and changes that value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the spline
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(1 1 0
                                     5 5 0
                                                 10 0 0
                                                )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)

    ;; Display the coordinates of the first fit point
    (setq fitPoint (vlax-variant-value (vla-GetFitPoint splineObj 0)))
    (alert (strcat "Fit point 1 is at " (rtos (vlax-safearray-get-element fitPoint 0) 2) ", "
                                        (rtos (vlax-safearray-get-element fitPoint 1) 2) ", "
                                        (rtos (vlax-safearray-get-element fitPoint 2) 2)))

    ;; Change the coordinates of the first fit point
    (setq fitPoint (vlax-3d-point 0 3 0))
    (vla-SetFitPoint splineObj 0 fitPoint)
    (vla-Update splineObj)
    (setq fitPoint (vlax-variant-value fitPoint))
    (alert (strcat "Fit point 1 is now at " (rtos (vlax-safearray-get-element fitPoint 0) 2) ", "
                                            (rtos (vlax-safearray-get-element fitPoint 1) 2) ", "
                                            (rtos (vlax-safearray-get-element fitPoint 2) 2)))
)


SetFont Method (ActiveX)

Sets the definition data of the font for the TextStyle.

Supported platforms: Windows only

Signature

VBA:

object.SetFont Typeface, Bold, Italic, CharSet, PitchAndFamily
object

Type: TextStyle

The object this method applies to.

Typeface

Access: Input-only

Type: String

The typeface (font name).

Bold

Access: Input-only

Type: Boolean

Sets the TextStyle to bold.

  • True: The TextStyle is bold.
  • False: The TextStyle is not bold.
Italic

Access: Input-only

Type: Boolean

Sets the TextStyle to italic.

  • True: The TextStyle is italic.
  • False: The TextStyle is not italic.
CharSet

Access: Input-only

Type: Long

The character set for the font. (See the available values in the Remarks section.)

PitchAndFamily

Access: Input-only

Type: Long

The pitch and family definitions for the font. (See the available values in the Remarks section.)

Return Value (RetVal)

No return value.

Remarks

The following section provides definitions for constants to use with this method. To use these constants, copy the definitions you need and paste them into the Declarations section of your application. A complete list of the constants that are available from Microsoft can be found in the file win32api.txt, which is provided with the Visual Basic Development Environment.

The CharSet parameter specifies the character set for the font. To use the following constants in your VB or VBA application, copy the definitions into the Declaration section of your code.

Public Const ANSI_CHARSET = 0
Public Const DEFAULT_CHARSET = 1
Public Const SYMBOL_CHARSET = 2
Public Const SHIFTJIS_CHARSET = 128
Public Const OEM_CHARSET = 255

The PitchAndFamily parameter specifies the pitch and family values for the font. The value is determined by a combination of three different settings. To provide the PitchAndFamily value, choose a setting from each of the categories, and then use the OR operator to combine them. A setting is required from the first two categories; the pitch and the family. The third category, the TrueType Flag, is only used when you are specifying a TrueType font.

To use the following constants in your VB or VBA application, copy the definitions into the Declaration section of your code.

' Pitch Values
Public Const DEFAULT_PITCH = 0
Public Const FIXED_PITCH = 1
Public Const VARIABLE_PITCH = 2
' Family Values
Public Const FF_DONTCARE = 0    '  Don't care or don't know.
Public Const FF_ROMAN = 16      '  Variable stroke width, serifed.
Public Const FF_SWISS = 32      '  Variable stroke width, sans-serifed.
Public Const FF_MODERN = 48     '  Constant stroke width, serifed or sans-serifed.
Public Const FF_SCRIPT = 64     '  Cursive, etc.
Public Const FF_DECORATIVE = 80 '  Old English, etc.
' TrueType Flag
Public Const TMPF_TRUETYPE = &H4

Examples

VBA:

Sub Example_SetFont()
    ' This example finds the font information for the active text style.
    ' It then changes the font to bold.

    Dim typeFace As String
    Dim Bold As Boolean
    Dim Italic As Boolean
    Dim charSet As Long
    Dim PitchandFamily As Long

    ThisDrawing.ActiveTextStyle.GetFont typeFace, Bold, Italic, charSet, PitchandFamily

    MsgBox "The current text style has the following font properties:" & vbCrLf _
           & "Typeface: " & typeFace & vbCrLf _
           & "Bold: " & Bold & vbCrLf _
           & "Italic: " & Italic & vbCrLf _
           & "Character set: " & charSet & vbCrLf _
           & "Pitch and Family: " & PitchandFamily

    ' Change the bold property
    Bold = Not Bold

    ThisDrawing.ActiveTextStyle.SetFont typeFace, Bold, Italic, charSet, PitchandFamily
    MsgBox "The current text style has the following font properties:" & vbCrLf _
           & "Typeface: " & typeFace & vbCrLf _
           & "Bold: " & Bold & vbCrLf _
           & "Italic: " & Italic & vbCrLf _
           & "Character set: " & charSet & vbCrLf _
           & "Pitch and Family: " & PitchandFamily

    ' Reset the font
    Bold = Not Bold
    ThisDrawing.ActiveTextStyle.SetFont typeFace, Bold, Italic, charSet, PitchandFamily

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetFont()
    ;; This example finds the font information for the active text style.
    ;; It then changes the font to bold.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (vla-GetFont (vla-get-ActiveTextStyle doc) 'typeFace 'Bold 'Italic 'charSet 'PitchandFamily)

    (alert (strcat "The current text style has the following font properties:"
                   "\nTypeface: " typeFace
                   "\nBold: " (if (= Bold :vlax-true) "True" "False")
                   "\nItalic: " (if (= Italic :vlax-true) "True" "False")
                   "\nCharacter set: " (itoa charSet)
                   "\nPitch and Family: " (itoa PitchandFamily)))

    ;; Change the bold property
    (setq Bold (if (= Bold :vlax-true) :vlax-false :vlax-true))

    (vla-SetFont (vla-get-ActiveTextStyle doc) typeFace Bold Italic charSet PitchandFamily)

    (alert (strcat "The current text style has the following font properties:"
                   "\nTypeface: " typeFace
                   "\nBold: " (if (= Bold :vlax-true) "True" "False")
                   "\nItalic: " (if (= Italic :vlax-true) "True" "False")
                   "\nCharacter set: " (itoa charSet)
                   "\nPitch and Family: " (itoa PitchandFamily)))

    ;; Reset the font
    (setq Bold (if (= Bold :vlax-true) :vlax-false :vlax-true))
    (vla-SetFont (vla-get-ActiveTextStyle doc) typeFace Bold Italic charSet PitchandFamily)
)


SetFormat Method (ActiveX)

Sets the format for the specified row type.

Supported platforms: Windows only

Signature

VBA:

object.SetFormat rowTypes, pFormat
object

Type: Table, TableStyle

The object this method applies to.

rowType

Access: Input-only

Type: AcRowType enum

The row type to check.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow
pFormat

Access: Input-only

Type: String

The format for the row.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetFormat2 Method (ActiveX)

Sets the format of a cell style.

Supported platforms: Windows only

Signature

VBA:

object.SetFormat2 bstrCellStyle, bstrFormat
object

Type: TableStyle

The object this method applies to.

bstrCellStyle

Access: Input-only

Type: String

The cell style name.

bstrFormat

Access: Input-only

Type: String

The cell style format.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellStyle()
    ' This example creates a TableStyle object and sets values for
    ' the style name and formatting.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As IAcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.CreateCellStyle ("NewTestStyle")
    Dim cellTestFormat As String

    customObj.SetFormat2 "NewTestStyle", "test format"
    customObj.GetFormat2 "NewTestStyle", cellTestFormat

    MsgBox "Cell Style Name = " & cellTestFormat

    customObj.RenameCellStyle "NewTestStyle", "NewTestStyle2"
    customObj.GetFormat2 "NewTestStyle2", cellTestFormat

    MsgBox "Cell Style Name = " & cellTestFormat

    Dim uniqueStyleName As String

    uniqueStyleName = customObj.GetUniqueCellStyleName("testbase")

    MsgBox "Cell Style Name = " & uniqueStyleName

    If customObj.GetIsCellStyleInUse("testbase") = False Then
        MsgBox "That cell style is not being used!"
    End If

    customObj.CreateCellStyleFromStyle "TestStyleFromStyle", "NewTestStyle2"

    customObj.DeleteCellStyle "NewTestStyle2"

    Dim numOfStyles As Long
    numOfStyles = customObj.NumCellStyles
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellStyle()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and formatting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-CreateCellStyle customObj "NewTestStyle")

    (setq cellTestFormat "")
    (vla-SetFormat2 customObj "NewTestStyle" "test format")
    (vla-GetFormat2 customObj "NewTestStyle" 'cellTestFormat)

    (alert (strcat "Cell Style Name = " cellTestFormat))

    (vla-RenameCellStyle customObj "NewTestStyle" "NewTestStyle2")
    (vla-GetFormat2 customObj "NewTestStyle2" 'cellTestFormat)

    (alert (strcat "Cell Style Name = " cellTestFormat))

    (setq uniqueStyleName (vla-GetUniqueCellStyleName customObj "testbase"))

    (alert (strcat "Cell Style Name = " uniqueStyleName))

    (if (= (vla-GetIsCellStyleInUse customObj "testbase") :vlax-false)
        (alert "That cell style is not being used!")
    )

    (vla-CreateCellStyleFromStyle customObj "TestStyleFromStyle" "NewTestStyle2")

    (vla-DeleteCellStyle customObj "NewTestStyle2")

    (setq numOfStyles (vla-get-NumCellStyles customObj))
    (alert (strcat "Number of Cell Styles = " (itoa numOfStyles)))
)


SetFormula Method (ActiveX)

Sets the formula for a cell.

Supported platforms: Windows only

Signature

VBA:

object.SetFormula nRow, nCol, nContent, pszFormula
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The value of the row.

nCol

Access: Input-only

Type: Long

The value of the column.

nContent

Access: Input-only

Type: Long

The value of the content.

pszFormula

Access: Input-only

Type: String

The new formula.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetGridColor Method (ActiveX)

Sets the grid color value for the specified grid linetypes and row types.

Supported platforms: Windows only

Signature

VBA:

object.SetGridColor gridLineTypes, rowTypes, pColor
object

Type: Table, TableStyle

The objects this method applies to.

gridLineTypes

Access: Input-only

Type: AcGridLineType enum

The grid linetypes to change.

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight
rowTypes

Access: Input-only

Type: AcRowType enum

The row types to change.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow
pColor

Access: Input-only

Type: AcCmColor

The AutoCAD true color object to assign to the grid lines.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetGridColor()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.FlowDirection = acTableBottomToTop
    customObj.HorzCellMargin = 0.22
    customObj.BitFlags = 1
    customObj.SetTextHeight AcRowType.acDataRow + AcRowType.acTitleRow, 1.3
    customObj.SetTextStyle AcRowType.acDataRow + AcRowType.acTitleRow, "Standard"

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 12, 23, 45
    customObj.SetBackgroundColor AcRowType.acDataRow + AcRowType.acTitleRow, col
    customObj.SetGridVisibility AcGridLineType.acHorzInside + AcGridLineType.acHorzTop _
                                , AcRowType.acDataRow + AcRowType.acTitleRow, True

    customObj.SetAlignment AcRowType.acDataRow + AcRowType.acTitleRow, acBottomRight
    col.SetRGB 244, 0, 0
    customObj.SetGridColor 3, 1, col

    MsgBox "Table Style Name = " & customObj.Name & vbCrLf & _
           "Style Description = " & customObj.Description & vbCrLf & _
           "Flow Direction = " & customObj.FlowDirection & vbCrLf & _
           "Horzontal Cell Margin = " & customObj.HorzCellMargin & vbCrLf & _
           "Bit Flags = " & customObj.BitFlags & vbCrLf & _
           "Title Row Text Height = " & customObj.GetTextHeight(acTitleRow) & vbCrLf & _
           "Title Row Text Style = " & customObj.GetTextStyle(acTitleRow) & vbCrLf & _
           "Grid Visibility for HorizontalBottom TitleRow  = " & customObj.GetGridVisibility(acHorzBottom, acTitleRow) & vbCrLf & _
           "Title Row Alignment = " & customObj.GetAlignment(acTitleRow) & vbCrLf & _
           "Header Suppression = " & customObj.HeaderSuppressed

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetGridColor()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-put-FlowDirection customObj acTableBottomToTop)
    (vla-put-HorzCellMargin customObj 0.22)
    (vla-put-BitFlags customObj 1)
    (vla-SetTextHeight customObj (+ acDataRow acTitleRow) 1.3)
    (vla-SetTextStyle customObj (+ acDataRow acTitleRow) "Standard")

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 12 23 45)

    (vla-SetBackgroundColor customObj (+ acDataRow acTitleRow) col)
    (vla-SetBackgroundColorNone customObj acHeaderRow :vlax-false)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) (+ acDataRow acTitleRow) :vlax-true)
    (vla-SetAlignment customObj (+ acDataRow acTitleRow) acBottomRight)
    (vla-SetRGB col 244 0 0)
    (vla-SetGridColor customObj (+ acHorzTop acHorzInside) acDataRow col)

    (alert (strcat "Table Style Name = " (vla-get-Name customObj)
                   "\nStyle Description = " (vla-get-Description customObj)
                   "\nFlow Direction = " (itoa (vla-get-FlowDirection customObj))
                   "\nHorzontal Cell Margin = " (rtos (vla-get-HorzCellMargin customObj) 2)
                   "\nBit Flags = " (itoa (vla-get-BitFlags customObj))
                   "\nTitle Row Text Height = " (rtos (vla-GetTextHeight customObj acTitleRow) 2)
                   "\nTitle Row Text Style = " (vla-GetTextStyle customObj acTitleRow)
                   "\nGrid Visibility for HorizontalBottom TitleRow  = " (if (= (vla-GetGridVisibility customObj acHorzBottom acTitleRow) :vlax-true) "True" "False")
                   "\nTitle Row Alignment = " (itoa (vla-GetAlignment customObj acTitleRow))
                      "\nHeader Suppression = " (if (= (vla-get-HeaderSuppressed customObj) :vlax-true) "True" "False")
              )
    )
    (vlax-release-object col)
)


SetGridColor2 Method (ActiveX)

Sets the gridColor for the specified cell.

Supported platforms: Windows only

Signature

VBA:

object.SetGridColor2 nRow, nCol, nGridLineType, pColor
object

Type: Table, TableStyle

The objects this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set

nGridLineType

Access: Input-only

Type: AcGridLineType enum

The grid linetypes to change.

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight
pColor

Access: Input-only

Type: AcCmColor

The AutoCAD true color object to assign to the grid.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetGridDoubleLineSpacing Method (ActiveX)

Sets the lineSpacing value for the specified cell.

Supported platforms: Windows only

Signature

VBA:

object.SetGridDoubleLineSpacing nRow, nCol, nGridLineType, fSpacing
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nGridLineType

Access: Input-only

Type: AcGridLineType enum

The grid linetypes to change.

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight
fSpacing

Access: Input-only

Type: Double

The new spacing value.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetGridLineStyle Method (ActiveX)

Sets the gridLineStyle for a cell.

Supported platforms: Windows only

Signature

VBA:

object.SetGridLineStyle nRow, nCol, nGridLineTypes, nLineStyle
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The value of the row.

nCol

Access: Input-only

Type: Long

The value of the column.

nGridLineType

Access: Input-only

Type: AcGridLineType enum

The grid linetypes to change.

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight
nLineStyle

Access: Input-only

Type: AcGridLineStyle enum

The new gridLineStyle.

  • acGridLineStyleDouble
  • acGridLineStyleSingle

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetGridLinetype Method (ActiveX)

Sets the object with the gridLinetype value for the specified cell.

Supported platforms: Windows only

Signature

VBA:

object.SetGridLinetype nRow, nCol, nGridLineType, idLinetype
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nGridLineType

Access: Input-only

Type: AcGridLineType enum

The grid linetypes to change.

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight
idLinetype

Access: Input-only

Type: Long_PTR

The point which references the new linetype.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetGridLineWeight Method (ActiveX)

Sets the grid lineweight value for the specified grid linetypes and row types.

Supported platforms: Windows only

Signature

VBA:

object.SetGridLineWeight gridLineTypes, rowTypes, Lineweight
object

Type: Table, TableStyle

The objects this method applies to.

gridLineTypes

Access: Input-only

Type: AcGridLineType enum

The grid linetypes to change.

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight
rowTypes

Access: Input-only

Type: AcRowType enum

The row types to change.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow
Lineweight

Access: Input-only

Type: ACAD_LWEIGHT enum

The lineweight to assign to the grid.

  • acLnWt000
  • acLnWt005
  • acLnWt009
  • acLnWt013
  • acLnWt015
  • acLnWt018
  • acLnWt020
  • acLnWt025
  • acLnWt030
  • acLnWt035
  • acLnWt040
  • acLnWt050
  • acLnWt053
  • acLnWt060
  • acLnWt070
  • acLnWt080
  • acLnWt090
  • acLnWt100
  • acLnWt106
  • acLnWt120
  • acLnWt140
  • acLnWt158
  • acLnWt200
  • acLnWt211
  • acLnWtByLayer
  • acLnWtByBlock
  • acLnWtByLwDefault

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetGridLineWeight()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Get the current TableStyle object
    Dim tableStyle As AcadTableStyle
    Set tableStyle = dictObj.Item(ThisDrawing.GetVariable("CTABLESTYLE"))

    Dim colGridCurrent As AcadAcCmColor, lwGridCurrent As ACAD_LWEIGHT, visGridCurrent As Boolean
    Set colGridCurrent = tableStyle.GetGridColor(acHorzBottom, acTitleRow)
    lwGridCurrent = tableStyle.GetGridLineWeight(acHorzBottom, acTitleRow)
    visGridCurrent = tableStyle.GetGridVisibility(acHorzTop, acTitleRow)

    MsgBox "Grid settings " & vbLf & _
           "nColor (Bottom) = " & colGridCurrent.ColorIndex & vbLf & _
           "nLineweight (Bottom) = " & lwGridCurrent & vbLf & _
           "Visibility (Top) =  " & visGridCurrent

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 0, 0, 255

    tableStyle.SetGridColor acHorzBottom, acTitleRow, col
    tableStyle.SetGridLineWeight acHorzBottom, acTitleRow, acLnWt025

    If visGridCurrent = False Then
        tableStyle.SetGridVisibility acHorzTop, acTitleRow, True
    Else
        tableStyle.SetGridVisibility acHorzTop, acTitleRow, False
    End If

    Dim colGridNew As AcadAcCmColor, lwGridNew As ACAD_LWEIGHT, visGridNew As Boolean
    Set colGridNew = tableStyle.GetGridColor(acHorzBottom, acTitleRow)
    lwGridNew = tableStyle.GetGridLineWeight(acHorzBottom, acTitleRow)
    visGridNew = tableStyle.GetGridVisibility(acHorzTop, acTitleRow)

    MsgBox "Grid settings " & vbLf & _
           "nColor (Bottom) = " & colGridNew.ColorIndex & vbLf & _
           "nLineweight (Bottom) = " & lwGridNew & vbLf & _
           "Visibility (Top) =  " & visGridNew

    tableStyle.SetGridColor acHorzBottom, acTitleRow, colGridCurrent
    tableStyle.SetGridLineWeight acHorzBottom, acTitleRow, lwGridCurrent
    tableStyle.SetGridVisibility acHorzTop, acTitleRow, visGridCurrent

    MsgBox "Reset the table style back to its original values."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetGridLineWeight()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Get the current TableStyle object
    (setq tableStyle (vla-Item dictObj (vla-GetVariable doc "CTABLESTYLE")))

    (setq colGridCurrent (vla-GetGridColor tableStyle acHorzBottom acTitleRow))
    (setq lwGridCurrent (vla-GetGridLineWeight tableStyle acHorzBottom acTitleRow))
    (setq visGridCurrent (vla-GetGridVisibility tableStyle acHorzTop acTitleRow))

    (alert (strcat "Grid settings"
                         "\nColor (Bottom) = " (itoa (vla-get-ColorIndex colGridCurrent))
                         "\nLineweight (Bottom) = " (itoa lwGridCurrent)
                         "\nVisibility (Top)= " (if (= visGridCurrent :vlax-true) "True" "False")))

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 0 0 255)

    (vla-SetGridColor tableStyle acHorzBottom acTitleRow col)
    (vla-SetGridLineWeight tableStyle acHorzBottom acTitleRow acLnWt025)
    (vla-SetGridVisibility tableStyle acHorzTop acTitleRow (if (= visGridCurrent :vlax-true) :vlax-false :vlax-true))

    (setq colGridNew (vla-GetGridColor tableStyle acHorzBottom acTitleRow))
    (setq lwGridNew (vla-GetGridLineWeight tableStyle acHorzBottom acTitleRow))
    (setq visGridNew (vla-GetGridVisibility tableStyle acHorzTop acTitleRow))

    (alert (strcat "Grid settings"
                         "\nColor (Bottom) = " (itoa (vla-get-ColorIndex colGridNew))
                         "\nLineweight (Bottom) = " (itoa lwGridNew)
                         "\nVisibility (Top)= " (if (= visGridNew :vlax-true) "True" "False")))

    (vla-SetGridColor tableStyle acHorzBottom acTitleRow colGridCurrent)
    (vla-SetGridLineWeight tableStyle acHorzBottom acTitleRow lwGridCurrent)
    (vla-SetGridVisibility tableStyle acHorzBottom acTitleRow visGridCurrent)

    (alert "Reset the table style back to its original values.")

    (vlax-release-object col)
)


SetGridLineWeight2 Method (ActiveX)

Sets the gridLineWeight value for the specified cell.

Supported platforms: Windows only

Signatures - Table

VBA:

object.SetGridLineWeight2 nRow, nCol, nGridLineType, lineWeight
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nGridLineType

Access: Input-only

Type: AcGridLineType enum

The grid linetypes to change.

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight
lineWeight

Access: Input-only

Type: ACAD_LWEIGHT enum

The new line weight.

  • acLnWt000
  • acLnWt005
  • acLnWt009
  • acLnWt013
  • acLnWt015
  • acLnWt018
  • acLnWt020
  • acLnWt025
  • acLnWt030
  • acLnWt035
  • acLnWt040
  • acLnWt050
  • acLnWt053
  • acLnWt060
  • acLnWt070
  • acLnWt080
  • acLnWt090
  • acLnWt100
  • acLnWt106
  • acLnWt120
  • acLnWt140
  • acLnWt158
  • acLnWt200
  • acLnWt211
  • acLnWtByLayer
  • acLnWtByBlock
  • acLnWtByLwDefault

Signatures - TableStyle

VBA:

object.SetGridLineWeight2 bstrCellStyle, gridLineType, Lineweight
object

Type: TableStyle

object this method applies to.

bstrCellStyle

Access: Input-only

Type: String

A named cell style in the table style.

gridLineType

Access: Input-only

Type: AcGridLineType enum

The grid linetypes to change.

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight
Lineweight

Access: Input-only

Type: ACAD_LWEIGHT enum

The new line weight.

  • acLnWt000
  • acLnWt005
  • acLnWt009
  • acLnWt013
  • acLnWt015
  • acLnWt018
  • acLnWt020
  • acLnWt025
  • acLnWt030
  • acLnWt035
  • acLnWt040
  • acLnWt050
  • acLnWt053
  • acLnWt060
  • acLnWt070
  • acLnWt080
  • acLnWt090
  • acLnWt100
  • acLnWt106
  • acLnWt120
  • acLnWt140
  • acLnWt158
  • acLnWt200
  • acLnWt211
  • acLnWtByLayer
  • acLnWtByBlock
  • acLnWtByLwDefault

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetGridSpacing Method (ActiveX)

Sets the grid spacing for the viewport.

Supported platforms: Windows only

Signature

VBA:

object.SetGridSpacing XSpacing, YSpacing
object

Type: PViewport, Viewport

The objects this method applies to.

XSpacing

Access: Input-only

Type: Double

The X spacing of the grid in the viewport.

YSpacing

Access: Input-only

Type: Double

The Y spacing of the grid in the viewport.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetGridSpacing()
    ' This example turns on the grid for the current viewport.
    ' It then finds the current grid spacing, and changes that spacing.

    ' Find the current active viewport
    Dim viewportObj As AcadViewport
    Set viewportObj = ThisDrawing.ActiveViewport

    ' Turn on the grid and reset the viewport to see it come on.
    viewportObj.GridOn = True
    ThisDrawing.ActiveViewport = viewportObj

    ' Find the current grid spacing
    Dim XSpacing As Double
    Dim YSpacing As Double

    viewportObj.GetGridSpacing XSpacing, YSpacing
    MsgBox "X =" & XSpacing & ", Y =" & YSpacing, , "SetGridSpacing Example"

    ' Change the grid spacing
    XSpacing = XSpacing * 0.5
    YSpacing = YSpacing * 0.5
    viewportObj.SetGridSpacing XSpacing, YSpacing
    ThisDrawing.ActiveViewport = viewportObj
    MsgBox "X =" & XSpacing & ", Y =" & YSpacing, , "SetGridSpacing Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetGridSpacing()
    ;; This example turns on the grid for the current viewport.
    ;; It then finds the current grid spacing, and changes that spacing.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Find the current active viewport
    (setq viewportObj (vla-get-ActiveViewport doc))

    ;; Turn on the grid and reset the viewport to see it come on.
    (vla-put-GridOn viewportObj :vlax-true)
    (vla-put-ActiveViewport doc viewportObj)

    ;; Find the current grid spacing
    (vla-GetGridSpacing viewportObj 'XSpacing 'YSpacing)
    (alert (strcat "X =" (rtos XSpacing 2) ", Y =" (rtos YSpacing 2)))

    ;; Change the grid spacing
    (vla-SetGridSpacing viewportObj (* XSpacing 0.5) (* YSpacing 0.5))
    (vla-put-ActiveViewport doc viewportObj)

    (vla-GetGridSpacing viewportObj 'XSpacing 'YSpacing)
    (alert (strcat "X =" (rtos XSpacing 2) ", Y =" (rtos YSpacing 2)))
)


SetGridVisibility Method (ActiveX)

Sets the grid visibility value for the specified grid linetype and row types.

Supported platforms: Windows only

Signature

VBA:

object.SetGridVisibility gridLineTypes, rowTypes, bValue
object

Type: Table, TableStyle

The objects this method applies to.

gridLineTypes

Access: Input-only

Type: AcGridLineType enum

The grid linetypes to change.

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight
rowTypes

Access: Input-only

Type: AcRowType enum

The row types to change.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow
bValue

Access: Input-only

Type: Boolean

  • True: The grid is visible for the specified row type.
  • False: The grid is not visible for the specified row type.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetGridVisibility()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Get the current TableStyle object
    Dim tableStyle As AcadTableStyle
    Set tableStyle = dictObj.Item(ThisDrawing.GetVariable("CTABLESTYLE"))

    Dim colGridCurrent As AcadAcCmColor, lwGridCurrent As ACAD_LWEIGHT, visGridCurrent As Boolean
    Set colGridCurrent = tableStyle.GetGridColor(acHorzBottom, acTitleRow)
    lwGridCurrent = tableStyle.GetGridLineWeight(acHorzBottom, acTitleRow)
    visGridCurrent = tableStyle.GetGridVisibility(acHorzTop, acTitleRow)

    MsgBox "Grid settings " & vbLf & _
           "nColor (Bottom) = " & colGridCurrent.ColorIndex & vbLf & _
           "nLineweight (Bottom) = " & lwGridCurrent & vbLf & _
           "Visibility (Top) =  " & visGridCurrent

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 0, 0, 255

    tableStyle.SetGridColor acHorzBottom, acTitleRow, col
    tableStyle.SetGridLineWeight acHorzBottom, acTitleRow, acLnWt025

    If visGridCurrent = False Then
        tableStyle.SetGridVisibility acHorzTop, acTitleRow, True
    Else
        tableStyle.SetGridVisibility acHorzTop, acTitleRow, False
    End If

    Dim colGridNew As AcadAcCmColor, lwGridNew As ACAD_LWEIGHT, visGridNew As Boolean
    Set colGridNew = tableStyle.GetGridColor(acHorzBottom, acTitleRow)
    lwGridNew = tableStyle.GetGridLineWeight(acHorzBottom, acTitleRow)
    visGridNew = tableStyle.GetGridVisibility(acHorzTop, acTitleRow)

    MsgBox "Grid settings " & vbLf & _
           "nColor (Bottom) = " & colGridNew.ColorIndex & vbLf & _
           "nLineweight (Bottom) = " & lwGridNew & vbLf & _
           "Visibility (Top) =  " & visGridNew

    tableStyle.SetGridColor acHorzBottom, acTitleRow, colGridCurrent
    tableStyle.SetGridLineWeight acHorzBottom, acTitleRow, lwGridCurrent
    tableStyle.SetGridVisibility acHorzTop, acTitleRow, visGridCurrent

    MsgBox "Reset the table style back to its original values."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetGridVisibility()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-put-FlowDirection customObj acTableBottomToTop)
    (vla-put-HorzCellMargin customObj 0.22)
    (vla-put-BitFlags customObj 1)
    (vla-SetTextHeight customObj (+ acDataRow acTitleRow) 1.3)
    (vla-SetTextStyle customObj (+ acDataRow acTitleRow) "Standard")

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 12 23 45)

    (vla-SetBackgroundColor customObj (+ acDataRow acTitleRow) col)
    (vla-SetBackgroundColorNone customObj acHeaderRow :vlax-false)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) (+ acDataRow acTitleRow) :vlax-true)
    (vla-SetAlignment customObj (+ acDataRow acTitleRow) acBottomRight)
    (vla-SetRGB col 244 0 0)
    (vla-SetGridColor customObj (+ acHorzTop acHorzInside) acDataRow col)

    (alert (strcat "Table Style Name = " (vla-get-Name customObj)
                   "\nStyle Description = " (vla-get-Description customObj)
                   "\nFlow Direction = " (itoa (vla-get-FlowDirection customObj))
                   "\nHorzontal Cell Margin = " (rtos (vla-get-HorzCellMargin customObj) 2)
                   "\nBit Flags = " (itoa (vla-get-BitFlags customObj))
                   "\nTitle Row Text Height = " (rtos (vla-GetTextHeight customObj acTitleRow) 2)
                   "\nTitle Row Text Style = " (vla-GetTextStyle customObj acTitleRow)
                   "\nGrid Visibility for HorizontalBottom TitleRow  = " (if (= (vla-GetGridVisibility customObj acHorzBottom acTitleRow) :vlax-true) "True" "False")
                   "\nTitle Row Alignment = " (itoa (vla-GetAlignment customObj acTitleRow))
                      "\nHeader Suppression = " (if (= (vla-get-HeaderSuppressed customObj) :vlax-true) "True" "False")
              )
    )
    (vlax-release-object col)
)


SetGridVisibility2 Method (ActiveX)

Sets the gridVisibility value for the specified cell or cell style.

Supported platforms: Windows only

Signature - Table

VBA:

object.SetGridVisibility2 nRow, nCol, nGridLineType, bVisible
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nGridLineType

Access: Input-only

Type: AcGridLineType enum

The grid linetypes to change.

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight
bVisible

Access: Input-only

Type: Boolean

  • True: The grid is visible for the specified cell.
  • False: The grid is not visible for the specified cell.

Signature - TableStyle

VBA:

object.SetGridVisibility2 bstrCellStyle, gridLineType, bValue
object

Type: TableStyle

The object this method applies to.

bstrCellStyle

Access: Input-only

Type: String

A named cell style in the table style.

gridLineType

Access: Input-only

Type: AcGridLineType enum

The grid linetypes to change.

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight
bValue

Access: Input-only

Type: Boolean

  • True: The grid is visible for the specified cell style.
  • False: The grid is not visible for the specified cell style.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetInvisibleEdge Method (ActiveX)

Sets the visibility state of an edge at a given index.

Supported platforms: Windows only

Signature

VBA:

object.SetInvisibleEdge Index, State
object

Type: 3DFace

The object this method applies to.

Index

Access: Input-only

Type: Long

An index specifying the edge to set. The index must be between 0 and 3 inclusive.

State

Access: Input-only

Type: Boolean

  • True: Sets the edge to invisible.
  • False: Sets the edge to visible.

Return Value (RetVal)

No return value.

Remarks

You can create a 3DFace object in which all edges are invisible. It does not appear in wireframe presentations, but can hide material in line drawings. It does not appear in shaded renderings.

The Regen method must be called for any visibility changes to appear in the drawing.

Examples

VBA:

Sub Example_SetInvisibleEdge()
    ' This example creates a 3D face in model space.
    ' It then toggles the visibility of the  first edge.

    Dim faceObj As Acad3DFace
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    Dim point3(0 To 2) As Double
    Dim point4(0 To 2) As Double

    ' Define the four coordinates of the face
    point1(0) = 1#: point1(1) = 1#: point1(2) = 0#
    point2(0) = 5#: point2(1) = 1#: point2(2) = 1#
    point3(0) = 1#: point3(1) = 10#: point3(2) = 0#
    point4(0) = 5#: point4(1) = 5#: point4(2) = 1#

    ' Create the 3DFace object in model space
    Set faceObj = ThisDrawing.ModelSpace.Add3DFace(point1, point2, point3, point4)
    ZoomAll

    ' Find the current visibility status of the first edge of the face
    Dim visStatus As Boolean
    visStatus = faceObj.GetInvisibleEdge(0)
    MsgBox "The first face is currently " & IIf(faceObj.GetInvisibleEdge(0), "visible.", "invisible."), , "GetInvisibleEdge Example"

    ' Toggle the visibility of the first edge of the face
    faceObj.SetInvisibleEdge 0, Not (visStatus)
    ThisDrawing.Regen False
    MsgBox "The first face is now " & IIf(faceObj.GetInvisibleEdge(0), "visible.", "invisible."), , "GetInvisibleEdge Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetInvisibleEdge()
    ;; This example creates a 3D face in model space.
    ;; It then toggles the visibility of the  first edge.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the four coordinates of the face
    (setq point1 (vlax-3d-point 1 1 0)
          point2 (vlax-3d-point 5 1 1)
          point3 (vlax-3d-point 5 5 1)
          point4 (vlax-3d-point 1 10 0))

    ;; Create the 3DFace object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq faceObj (vla-Add3DFace modelSpace point1 point2 point3 point4))
    (vla-ZoomAll acadObj)

    ;; Find the current visibility status of the first edge of the face
    (setq visStatus (vla-GetInvisibleEdge faceObj 0))
    (alert (strcat "The first face is currently " (if (= visStatus :vlax-true) "visible." "invisible.")))

    ;; Toggle the visibility of the first edge of the face
    (vla-SetInvisibleEdge faceObj 0 (if (= visStatus :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc :vlax-false)
    (alert (strcat "The first face is now " (if (= (vla-GetInvisibleEdge faceObj 0) :vlax-true) "visible." "invisible.")))
)


SetLayoutsToPlot Method (ActiveX)

Specifies the layout or layouts to plot.

Supported platforms: Windows only

Signature

VBA:

object.SetLayoutsToPlot layoutList
object

Type: Plot

The object this method applies to.

layoutList

Access: Input-only

Type: Variant

An array of layout names representing the layouts to plot.

Return Value (RetVal)

No return value.

Remarks

This method may become obsolete and may be removed in a future version of AutoCAD.

If the layoutList parameter is NULL or this method is not called at all, the active layout is sent to the plot.

After each call to the PlotToFile or PlotToDevice method, the default layout to plot is reset to the active layout. To specify any layout other than the active layout, you must call the SetLayoutsToPlot method before each plot.

Examples

VBA:

Sub Example_SetLayoutsToPlot()
    ' This example plots the layouts of a drawing.

    Dim oPlot As AcadPlot
    Dim AddedLayouts() As String
    Dim LayoutList As Variant
    Dim oLayout As AcadLayout
    Dim ArraySize As Integer, BatchCount As Integer

    For Each oLayout In ThisDrawing.Layouts
        ArraySize = ArraySize + 1
        ReDim Preserve AddedLayouts(1 To ArraySize)
        AddedLayouts(ArraySize) = oLayout.Name
    Next

    LayoutList = AddedLayouts
    Set oPlot = ThisDrawing.Plot
    oPlot.SetLayoutsToPlot LayoutList
    oPlot.PlotToDevice "DWF6 ePlot.pc3"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetLayoutsToPlot()
    ;; This example plots the layouts of a drawing.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq AddedLayouts (vlax-make-safearray vlax-vbString (cons 0 (1- (vla-get-Count (vla-get-Layouts doc)))))
          ArraySize 0)

    (vlax-for oLayout (vla-get-Layouts doc)
        (vlax-safearray-put-element AddedLayouts ArraySize (vla-get-Name oLayout))
        (setq ArraySize (1+ ArraySize))
    )

    (setq oPlot (vla-get-Plot doc))
    (vla-SetLayoutsToPlot oPlot AddedLayouts)
    (vla-PlotToDevice oPlot "DWF6 ePlot.pc3")
)


SetLeaderLineVertices Method (ActiveX)

Sets the vertices of leaderLine with specified index.

Supported platforms: Windows only

Signature

VBA:

object.SetLeaderLineVertices leaderLineIndex, pointArray
object

Type: MLeader

The object this method applies to.

leaderLineIndex

Access: Input-only

Type: Long

The leader line index.

pointArray

Access: Input-only

Type: Variant (three-element array of doubles)

The vertices of leaderlines owned by the input leader.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetMargin Method (ActiveX)

Sets the margin for a cell.

Supported platforms: Windows only

Signature

VBA:

object.SetMargin nRow, nCol, nMargins, fMargin
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The value of the row.

nCol

Access: Input-only

Type: Long

The value of the column.

nMargins

Access: Input-only

Type: AcCellMargin enum

The value of the margins.

  • acCellMarginBottom
  • acCellMarginHorzSpacing
  • acCellMarginLeft
  • acCellMarginRight
  • acCellMarginTop
  • acCellMarginVertSpacing
pValue

Access: Input-only

Type: Double

The new margin value.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetNames Method (ActiveX)

Specifies the color name and book name of the color.

Supported platforms: Windows only

Signature

VBA:

object.SetNames ColorName, ColorBook
object

Type: AcCmColor

The object this method applies to.

ColorName

Access: Input-only

Type: String

The name of the color.

BookName

Access: Input-only

Type: String

The color book name of the color.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetNames()
    'This example draws a circle and
    'returns the color name and color book name of the color.

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 125, 175, 235
    col.SetNames "MyColor", "MyColorBook"

    Dim cir As AcadCircle
    Dim pt(0 To 2) As Double
    Set cir = ThisDrawing.ModelSpace.AddCircle(pt, 2)
    cir.TrueColor = col
    ZoomAll

    Dim retCol As AcadAcCmColor
    Set retCol = cir.TrueColor
    MsgBox "BookName=" & col.BookName & vbLf & _
           "ColorName=" & col.ColorName
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetNames()
    ;; This example draws a circle and
    ;; returns the color name and color book name of the color.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 125 175 235)
    (vla-SetNames col "MyColor" "MyColorBook")

    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq cir (vla-AddCircle modelSpace pt 2))
    (vla-put-TrueColor cir col)
    (vla-ZoomAll acadObj)

    (setq retCol (vla-get-TrueColor cir))
    (alert (strcat "BookName=" (vla-get-BookName col)
                   "\nColorName=" (vla-get-ColorName col)
              )
    )

    (vlax-release-object col)
)


SetOverride Method (ActiveX)

Sets the overrides for a cell.

Supported platforms: Windows only

Signature

VBA:

object.SetOverride nRow, nCol, nContent, nProp
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The value of the row.

nCol

Access: Input-only

Type:Long

The value of the column.

nContent

Access: Input-only

Type: Long

The value of the cell's content.

nProp

Access:Input-only

Type: AcCellProperty enum

The new cell override.

  • acAlignmentProperty
  • acAllCellProperties
  • acAutoScale
  • acBackgroundColor
  • acBitProperties
  • acContentColor
  • acContentLayout
  • acContentProperties
  • acDataFormat
  • acDataType
  • acDataTypeAndFormat
  • acEnableBackgroundColor
  • acFlowDirBtoT
  • acInvalidCellProperty
  • acLock
  • acMarginBottom
  • acMarginLeft
  • acMarginRight
  • acMarginTop
  • acMergeAll
  • acRotation
  • acScale
  • acTextHeight
  • acTextStyle

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetPattern Method (ActiveX)

Sets the pattern name and pattern type for the hatch.

Supported platforms: Windows only

Signature

VBA:

object.SetPattern PatternType, PatternName
object

Type: Hatch

The object this method applies to.

PatternType

Access: Input-only

Type: AcPatternType enum

  • acHatchPatternTypePreDefined: Selects the pattern name from those defined in the acad.pat file.
  • acHatchPatternTypeUserDefined: Defines a pattern of lines using the current linetype.
  • acHatchPatternTypeCustomDefined: Selects the pattern name from a PAT file other than the acad.pat file.
PatternName

Access: Input-only

Type: String

The name of the pattern. Sets a default hatch pattern name of up to 34 characters, no spaces allowed. Returns "" if there is no default. Enter a period (.) to set no default.

Return Value (RetVal)

No return value.

Remarks

The hatch pattern can be defined by one of the following options:

PreDefined: Selects the pattern name from those defined in the acad.pat file.

UserDefined: Defines a pattern of lines using the current linetype.

CustomDefined: Selects the pattern name from a PAT file other than the acad.pat file.

NoteThe SetPattern method should only be used for the active document.

Examples

VBA:

Sub Example_SetPattern()
    ' This example creates an associative hatch in model space.
    ' The hatch pattern is then changed.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "ANSI31"
    PatternType = 0
    bAssociativity = True

    ' Create the associative Hatch object
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)

    ' Create the outer loop for the hatch.
    ' An arc and a line are used to create a closed loop.

    Dim outerLoop(0 To 1) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    center(0) = 5: center(1) = 3: center(2) = 0
    radius = 3
    startAngle = 0
    endAngle = 3.141592
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddArc(center, radius, startAngle, endAngle)
    Set outerLoop(1) = ThisDrawing.ModelSpace.AddLine(outerLoop(0).startPoint, outerLoop(0).endPoint)

    ' Append the outer loop to the hatch object
    hatchObj.AppendOuterLoop (outerLoop)

    ' Append the first circle as one inner loop
    Dim innerLoop1(0) As AcadEntity
    center(0) = 5: center(1) = 4.5: center(2) = 0
    radius = 1
    Set innerLoop1(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop1)

    ' Append the second circle as the other inner loop
    Dim innerLoop2(0) As AcadEntity
    radius = 0.5
    Set innerLoop2(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop2)

    ' Evaluate and display the hatch
    hatchObj.Evaluate
    ZoomAll

    ' Find the name of the hatch pattern
    patternName = hatchObj.patternName
    MsgBox "The hatch pattern is " & hatchObj.patternName, , "SetPattern Example"

    ' Change the hatch pattern
    hatchObj.SetPattern acHatchPatternTypePreDefined, "BRICK"
    hatchObj.Evaluate
    ThisDrawing.Regen True
    MsgBox "The hatch pattern is now " & hatchObj.patternName, , "SetPattern Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetPattern()
    ;; This example creates an associative hatch in model space.
    ;; The hatch pattern is then changed.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "ANSI31"
          patternType 0
          bAssociativity :vlax-true)

    ;; Create the associative Hatch object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acHatchObject))

    ;; Create the outer loop for the hatch.
    ;; An arc and a line are used to create a closed loop.
    (setq center (vlax-3d-point 5 3 0)
          radius 3
          startAngle 0
          endAngle 3.141592)

    (setq arc (vla-AddArc modelSpace center radius startAngle endAngle))
    (setq line (vla-AddLine modelSpace (vla-get-StartPoint arc) (vla-get-EndPoint arc)))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element outerLoop 0 arc)
    (vlax-safearray-put-element outerLoop 1 line)

    ;; Append the outer loop to the hatch object
    (vla-AppendOuterLoop hatchObj outerLoop)

    ;; Append the first circle as one inner loop
    (setq center (vlax-3d-point 5 4.5 0)
          radius 1)
    (setq circle1 (vla-AddCircle modelSpace center radius))

    (setq innerLoop1 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element innerLoop1 0 circle1)

    (vla-AppendInnerLoop hatchObj innerLoop1)

    ;; Append the second circle as the other inner loop
    (setq radius 0.5)
    (setq innerLoop2 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (setq circle2 (vla-AddCircle modelSpace center radius))
    (vlax-safearray-put-element innerLoop2 0 circle2)

    (vla-AppendInnerLoop hatchObj innerLoop2)

    ;; Evaluate and display the hatch
    (vla-Evaluate hatchObj)
    (vla-ZoomAll acadObj)

    ;; Find the name of the hatch pattern
    (setq patternName (vla-get-patternName hatchObj))
    (alert (strcat "The hatch pattern is " patternName))

    ;; Change the hatch pattern
    (vla-SetPattern hatchObj acHatchPatternTypePreDefined "BRICK")
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)
    (alert (strcat "The hatch pattern is now " (vla-get-patternName hatchObj)))
)


SetProjectFilePath Method (ActiveX)

Sets the directory in which AutoCAD looks for external reference files.

Supported platforms: Windows only

Signature

VBA:

object.SetProjectFilePath ProjectName, ProjectFilePath
object

Type: PreferencesFiles

The object this method applies to.

ProjectName

Access: Input-only

Type: String

The name of the project. This name is also controlled by the PROJECTNAME system variable.

ProjectFilePath

Access: Input-only

Type: String

The directory in which AutoCAD looks for external reference files.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetProjectFilePath()
    ' This example finds the current project file information, changes
    ' that information, and finally resets the information back to the
    ' original values.

    Dim preferences As AcadPreferences
    Set preferences = ThisDrawing.Application.preferences

    ' Get the current project file information
    Dim currProjPath As String
    Dim currProjName As Variant
    currProjName = ThisDrawing.GetVariable("PROJECTNAME")
    If currProjName <> "" Then
        currProjPath = preferences.GetProjectFilePath(currProjName)
    End If
    If currProjPath = "" Then
        MsgBox "There is no current project file or path. ", , "SetProjectFilePath Example"
    Else
        MsgBox "The current project file path is: " & currProjPath, , "SetProjectFilePath Example"
        ' Set new project file information.
        ' Change drive/path as necessary to match your system
        Dim newProjPath As String
        newProjPath = "C:/AutoCAD/"

        preferences.SetProjectFilePath currProjName, newProjPath
        MsgBox "The new project file path is: " & newProjPath, , "GetProjectFilePath Example"

        ' Reset the project file information
        preferences.SetProjectFilePath currProjName, currProjPath
        MsgBox "The project file path has been reset to: " & currProjPath, , "GetProjectFilePath Example"
    End If

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetProjectFilePath()
    ;; This example finds the current project file information, changes
    ;; that information, and finally resets the information back to the
    ;; original values.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the current project file information
    (setq currProjName (vlax-variant-value (vla-GetVariable doc "PROJECTNAME")))
    (if (/= currProjName "")
        (setq currProjPath (vla-GetProjectFilePath (vla-get-Files preferences) currProjName))
        (setq currProjPath "")
    )
    (if (= currProjPath "")
        (alert "There is no current project file or path. ")
        (progn
               (alert (strcat "The current project file path is: " currProjPath))

            ;; Set new project file information.
            ;; Change drive/path as necessary to match your system
            (setq newProjPath "C:/AutoCAD/")

            (vla-SetProjectFilePath (vla-get-Files preferences) currProjName newProjPath)
            (alert (strcat "The new project file path is: " newProjPath))

            ;; Reset the project file information
            (vla-SetProjectFilePath (vla-get-Files preferences) currProjName currProjPath)
            (alert (strcat "The project file path has been reset to: " currProjPath))
        )
    )
)


SetRelativeDrawOrder Method (ActiveX)

Sets the relative draw order specified, with the bottom objects first.

Supported platforms: Windows only

Signature

VBA:

object.SetRelativeDrawOrder Objects
object

Type: SortentsTable

The object this method applies to.

Objects

Access: Input-only

Type: Variant

The objects for which to set the draw order.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SortentsTable()
    ' This example creates a SortentsTable object and
    ' changes the draw order.

    ' Set drawing to display lineweights and create a True Color object
    Dim ACADPref As AcadDatabasePreferences
    Set ACADPref = ThisDrawing.preferences
    ACADPref.LineWeightDisplay = True
    Dim MyColorObjOne As AcadAcCmColor
    Set MyColorObjOne = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Call MyColorObjOne.SetRGB(80, 100, 244)

    ' Draw a polyline
    Dim plineObj As AcadPolyline
    Dim points(0 To 8) As Double
    points(0) = 4: points(1) = 4: points(2) = 0
    points(3) = 3: points(4) = 5: points(5) = 0
    points(6) = 6: points(7) = 20: points(8) = 0
    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
    plineObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(90, 110, 150)
    plineObj.TrueColor = MyColorObjOne

    ' Draw a line
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 5: startPoint(1) = 13: startPoint(2) = 0
    endPoint(0) = 5: endPoint(1) = 27: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    lineObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(50, 80, 230)
    lineObj.TrueColor = MyColorObjOne

    ' Draw a circle
    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    centerPoint(0) = 10: centerPoint(1) = 15: centerPoint(2) = 0#
    radius = 5#
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)
    circleObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(60, 200, 220)
    circleObj.TrueColor = MyColorObjOne
    ZoomAll
    AcadApplication.Update

    ' Get an extension dictionary and, if necessary, add a SortentsTable object
    Dim eDictionary As Object
    Set eDictionary = ThisDrawing.ModelSpace.GetExtensionDictionary
    ' Prevent failed GetObject calls from throwing an exception
    On Error Resume Next
    Dim sentityObj As Object
    Set sentityObj = eDictionary.GetObject("ACAD_SORTENTS")
    On Error GoTo 0
    If sentityObj Is Nothing Then
         ' No SortentsTable object, so add one
         Set sentityObj = eDictionary.AddObject("ACAD_SORTENTS", "AcDbSortentsTable")
    End If

    Dim ObjIds(2) As Long
    ObjIds(0) = plineObj.ObjectID
    ObjIds(1) = lineObj.ObjectID
    ObjIds(2) = circleObj.ObjectID

    Dim varObject As AcadObject
    Set varObject = ThisDrawing.ObjectIdToObject(ObjIds(2))
    Dim arr(0) As AcadObject
    Set arr(0) = varObject

    ' Move the circle object to the bottom
    sentityObj.MoveToBottom arr
    AcadApplication.Update

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SortentsTable()
    ;; This example creates a SortentsTable object and
    ;; changes the draw order.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Set drawing to display lineweights and create a True Color object
    (vla-put-LineWeightDisplay (vla-get-Preferences doc) :vlax-true)
    (setq MyColorObjOne (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB MyColorObjOne 80 100 244)

    ;; Draw a polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill points '(4 4 0
                                  3 5 0
                  6 20 0
                 )
    )

    (setq plineObj (vla-AddPolyline modelSpace points))

    (vla-put-Lineweight plineObj acLnWt211)
    (vla-SetRGB MyColorObjOne 90 110 150)
    (vla-put-TrueColor plineObj MyColorObjOne)

    ;; Draw a line
    (setq startPoint (vlax-3d-point 5 13 0)
          endPoint (vlax-3d-point 5 27 0))

    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-put-Lineweight lineObj acLnWt211)
    (vla-SetRGB MyColorObjOne 50 80 230)
    (vla-put-TrueColor lineObj MyColorObjOne)

    ;; Draw a circle
    (setq centerPoint (vlax-3d-point 10 15 0)
          radius 5)

    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))
    (vla-put-Lineweight circleObj acLnWt211)
    (vla-SetRGB MyColorObjOne 60 200 220)
    (vla-put-TrueColor circleObj MyColorObjOne)

    (vla-ZoomAll acadObj)
    (vla-Update acadObj)

    ;; Get an extension dictionary and, if necessary, add a SortentsTable object
    (setq eDictionary (vla-GetExtensionDictionary modelSpace))

    ;; Prevent failed GetObject calls from throwing an exception
    (setq sentityObj (vl-catch-all-apply 'vla-GetObject (list eDictionary "ACAD_SORTENTS")))

    (if (= (type sentityObj)'VL-CATCH-ALL-APPLY-ERROR)
         ;; No SortentsTable object, so add one
         (setq sentityObj (vla-AddObject eDictionary "ACAD_SORTENTS" "AcDbSortentsTable"))
    )

    (setq ObjIds (vlax-make-safearray vlax-vbLong '(0 . 2)))
    (vlax-safearray-put-element ObjIds 0 (vla-get-ObjectID plineObj))
    (vlax-safearray-put-element ObjIds 1 (vla-get-ObjectID lineObj))
    (vlax-safearray-put-element ObjIds 2 (vla-get-ObjectID circleObj))

    (setq varObject circleObj)
    (setq arr (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element arr 0 varObject)

    ;; Move the circle object to the bottom
    (vla-MoveToBottom sentityObj arr)
    (vla-Update acadObj)

    (vlax-release-object MyColorObjOne)
)


SetRGB Method (ActiveX)

Specifies the RGB values of the True Color.

Supported platforms: Windows only

Signature

VBA:

object.SetRGB Red, Green, Blue
object

Type: AcCmColor

The object this method applies to.

Red

Access: Input-only

Type: Long

The red value of the color.

Green

Access: Input-only

Type: Long

The green value of the color.

Blue

Access: Input-only

Type: Long

The blue value of the color.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetRGB()
    ' This example draws a line and returns the RGB values
    Dim color As AcadAcCmColor
    Set color = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    color.SetRGB 80, 100, 244

    Dim line As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double

    startPoint(0) = 1#: startPoint(1) = 1#: startPoint(2) = 0#
    endPoint(0) = 5#: endPoint(1) = 5#: endPoint(2) = 0#

    Set line = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    ZoomAll

    line.TrueColor = color
    Dim retcolor As AcadAcCmColor
    Set retcolor = line.TrueColor

    MsgBox "Red = " & retcolor.Red & vbLf & _
           "Green = " & retcolor.Green & vbLf & _
           "Blue = " & retcolor.Blue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetRGB()
    ;; This example draws a line and returns the RGB values
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq color (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB color 80 100 244)

    (setq startPoint (vlax-3d-point 1 1 0)
          endPoint (vlax-3d-point 5 5 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-ZoomAll acadObj)

    (vla-put-TrueColor lineObj color)
    (setq retcolor (vla-get-TrueColor lineObj))

    (alert (strcat "Red = " (itoa (vla-get-Red retcolor))
                   "\nGreen = " (itoa (vla-get-Green retcolor))
                   "\nBlue = " (itoa (vla-get-Blue retcolor))))
)


SetRotation Method (ActiveX)

Sets the rotation value for a cell.

Supported platforms: Windows only

Signature - Table

VBA:

object.SetRotation nRow, nCol, nContent, pValue
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Integer

The row number of the cell to set.

nCol

Access: Input-only

Type: Integer

The column number of the cell to set.

nContent

Access: Input-only

Type: Integer

The content value for the cell.

value

Access: Input-only

Type: Double

The new value for the rotation.

Signature - TableStyle

VBA:

object.SetRotation bstrCellStyle, Rotation
object

Type: TableStyle

The object this method applies to.

bstrCellStyle

Access: Input-only

Type: String

A named cell style in the table style.

Rotation

Access: Input-only

Type: Double

The new value for the rotation.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetRowHeight Method (ActiveX)

Sets the height for the row at the specified row index in the table.

Supported platforms: Windows only

Signature

VBA:

object.SetRowHeight row, Height
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row index of the table.

Height

Access: Input-only

Type: Double

The height for the row.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetScale Method (ActiveX)

Sets the scale value for a cell.

Supported platforms: Windows only

Signature

VBA:

object.SetScale nRow, nCol, nContent, scale
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value for the cell.

scale

Access: Input-only

Type: Double

The new scale value.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetSnapSpacing Method (ActiveX)

Sets the snap spacing for the viewport.

Supported platforms: Windows only

Signature

VBA:

object.SetSnapSpacing XSpacing, YSpacing
object

Type: PViewport, Viewport

The object this method applies to.

XSpacing

Access: Input-only

Type: Double

The snap spacing for the X axis.

YSpacing

Access: Input-only

Type: Double

The snap spacing for the Y axis.

Return Value (RetVal)

No return value.

Remarks

The initial value for the X and Y spacing is 1.0000.

This value is also controlled by the SNAPUNIT system variable.

Examples

VBA:

Sub Example_SetSnapSpacing()
    ' This example finds the current Snap spacing and changes it.

    ' Find the current active viewport
    Dim viewportObj As AcadViewport
    Set viewportObj = ThisDrawing.ActiveViewport

    ' Turn on Snap mode and reset the viewport.
    viewportObj.SnapOn = True
    ThisDrawing.ActiveViewport = viewportObj

    ' Find the current Snap spacing
    Dim XSpacing As Double
    Dim YSpacing As Double

    viewportObj.GetSnapSpacing XSpacing, YSpacing
    MsgBox "X =" & XSpacing & ", Y =" & YSpacing, Title:="SetSnapSpacing Example"

    ' Change the Snap spacing
    XSpacing = XSpacing * 0.5
    YSpacing = YSpacing * 0.5
    viewportObj.SetSnapSpacing XSpacing, YSpacing
    ThisDrawing.ActiveViewport = viewportObj
    MsgBox "X =" & XSpacing & ", Y =" & YSpacing, Title:="SetSnapSpacing Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetSnapSpacing()
    ;; This example finds the current Snap spacing, and changes that spacing.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Find the current active viewport
    (setq viewportObj (vla-get-ActiveViewport doc))

    ;; Turn on Snap spacing and reset the viewport.
    (vla-put-SnapOn viewportObj :vlax-true)
    (vla-put-ActiveViewport doc viewportObj)

    ;; Find the current Snap spacing
    (vla-GetSnapSpacing viewportObj 'XSpacing 'YSpacing)
    (alert (strcat "X =" (rtos XSpacing 2) ", Y =" (rtos YSpacing 2)))

    ;; Change the Snap spacing
    (vla-SetSnapSpacing viewportObj (* XSpacing 0.5) (* YSpacing 0.5))
    (vla-put-ActiveViewport doc viewportObj)

    (vla-GetSnapSpacing viewportObj 'XSpacing 'YSpacing)
    (alert (strcat "X =" (rtos XSpacing 2) ", Y =" (rtos YSpacing 2)))
)


SetSubSelection Method (ActiveX)

Sets the row and column indices of the cells in a subselection set.

Supported platforms: Windows only

Signature

VBA:

object.SetSubSelection rowMin, rowMax, colMin, colMax
object

Type: Table

The object this method applies to.

rowMin

Access: Input-only

Type: Long

The zero-based lower bound of row index.

rowMax

Access: Input-only

Type: Long

The zero-based upper bound of row index.

colMin

Access: Input-only

Type: Long

The zero-based lower bound of column index.

colMax

Access: Input-only

Type: Long

The zero-based upper bound of column index.

Return Value (RetVal)

No return value.

Remarks

This method sets the row and column indices of the cells in the subselection set. The total number of selected cells is equal to (rowMax - rowMin + 1) * (colMax - colMin + 1).

Examples

VBA:

Not available

Visual LISP:

Not available


SetTemplateId Method (ActiveX)

Sets a template using an object ID to the table style.

Supported platforms: Windows only

Signature

VBA:

object.SetTemplateId val, option
object

Type: TableStyle

The object this method applies to.

val

Access: Input-only

Type: Long_PTR

The object ID to a template.

option

Access: Input-only

Type: AcMergeCellStyleOption enum

The merge cell style to use when applying the template.

  • acMergeCellStyleCopyDuplicates
  • acMergeCellStyleConvertDuplicatesToOverrides
  • acMergeCellStyleIgnoreNewStyles
  • acMergeCellStyleNone
  • acMergeCellStyleOverwriteDuplicates

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetText Method (ActiveX)

Sets the text value for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

object.SetText row, col, pStr
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

pStr

Access: Input-only

Type: String

The text value.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetTextHeight Method (ActiveX)

Sets the text height for the specified row types.

Supported platforms: Windows only

Signature

VBA:

object.SetTextHeight rowTypes, TextHeight
object

Type: Table, TableStyle

The object this method applies to.

rowTypes

Access: Input-only

Type: AcRowType enum

The row types to change.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow
TextHeight

Access: Input-only

Type: Double

The text height to use for the specified row types.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetTextHeight()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.FlowDirection = acTableBottomToTop
    customObj.HorzCellMargin = 0.22
    customObj.BitFlags = 1
    customObj.SetTextHeight AcRowType.acDataRow + AcRowType.acTitleRow, 1.3
    customObj.SetTextStyle AcRowType.acDataRow + AcRowType.acTitleRow, "Standard"

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 12, 23, 45
    customObj.SetBackgroundColor AcRowType.acDataRow + AcRowType.acTitleRow, col
    customObj.SetGridVisibility AcGridLineType.acHorzInside + AcGridLineType.acHorzTop _
                                , AcRowType.acDataRow + AcRowType.acTitleRow, True

    customObj.SetAlignment AcRowType.acDataRow + AcRowType.acTitleRow, acBottomRight
    col.SetRGB 244, 0, 0
    customObj.SetGridColor 3, 1, col

    MsgBox "Table Style Name = " & customObj.Name & vbCrLf & _
           "Style Description = " & customObj.Description & vbCrLf & _
           "Flow Direction = " & customObj.FlowDirection & vbCrLf & _
           "Horzontal Cell Margin = " & customObj.HorzCellMargin & vbCrLf & _
           "Bit Flags = " & customObj.BitFlags & vbCrLf & _
           "Title Row Text Height = " & customObj.GetTextHeight(acTitleRow) & vbCrLf & _
           "Title Row Text Style = " & customObj.GetTextStyle(acTitleRow) & vbCrLf & _
           "Grid Visibility for HorizontalBottom TitleRow  = " & customObj.GetGridVisibility(acHorzBottom, acTitleRow) & vbCrLf & _
           "Title Row Alignment = " & customObj.GetAlignment(acTitleRow) & vbCrLf & _
           "Header Suppression = " & customObj.HeaderSuppressed

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetTextHeight()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-put-FlowDirection customObj acTableBottomToTop)
    (vla-put-HorzCellMargin customObj 0.22)
    (vla-put-BitFlags customObj 1)
    (vla-SetTextHeight customObj (+ acDataRow acTitleRow) 1.3)
    (vla-SetTextStyle customObj (+ acDataRow acTitleRow) "Standard")

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 12 23 45)

    (vla-SetBackgroundColor customObj (+ acDataRow acTitleRow) col)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) (+ acDataRow acTitleRow) :vlax-true)
    (vla-SetAlignment customObj (+ acDataRow acTitleRow) acBottomRight)
    (vla-SetRGB col 244 0 0)
    (vla-SetGridColor customObj (+ acHorzTop acHorzInside) acDataRow col)

    (alert (strcat "Table Style Name = " (vla-get-Name customObj)
                   "\nStyle Description = " (vla-get-Description customObj)
                   "\nFlow Direction = " (itoa (vla-get-FlowDirection customObj))
                   "\nHorzontal Cell Margin = " (rtos (vla-get-HorzCellMargin customObj) 2)
                   "\nBit Flags = " (itoa (vla-get-BitFlags customObj))
                   "\nTitle Row Text Height = " (rtos (vla-GetTextHeight customObj acTitleRow) 2)
                   "\nTitle Row Text Style = " (vla-GetTextStyle customObj acTitleRow)
                   "\nGrid Visibility for HorizontalBottom TitleRow  = " (if (= (vla-GetGridVisibility customObj acHorzBottom acTitleRow) :vlax-true) "True" "False")
                   "\nTitle Row Alignment = " (itoa (vla-GetAlignment customObj acTitleRow))
                      "\nHeader Suppression = " (if (= (vla-get-HeaderSuppressed customObj) :vlax-true) "True" "False")
              )
    )
    (vlax-release-object col)
)


SetTextHeight2 Method (ActiveX)

Sets the text height for a cell.

Supported platforms: Windows only

Signature - Table

VBA:

object.SetTextHeight2 nRow, nCol, nContent, height
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value for the cell.

height

Access: Input-only

Type: Double

The new height value.

Signature - TableStyle

VBA:

object.SetTextHeight2 bstrCellStyle, Height
object

Type: TableStyle

The object this method applies to.

bstrCellStyle

Access: Input-only

Type: String

The name of a cell style associated with the table style.

Height

Access: Input-only

Type: Double

The new height value.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetTextRotation Method (ActiveX)

Sets the text rotation for the specified row and column.

Supported platforms: Windows only

Signature

VBA:

object.SetTextRotation row, col, TextRotation
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row number of the cell.

col

Access: Input-only

Type: Long

The column number of the cell.

TextRotation

Access: Input-only

Type: AcRotationAngle enum

The text rotation.

  • acDegrees000
  • acDegrees090
  • acDegrees180
  • acDegrees270
  • acDegreesUnknown

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetTextString Method (ActiveX)

Sets the text value of a cell.

Supported platforms: Windows only

Signature

VBA:

object.SetTextString nRow, nCol, nContent, text
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value of the cell.

text

Access: Input-only

Type: String

The string value to store.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetTextStyle Method (ActiveX)

Sets the text style name for the specified row types.

Supported platforms: Windows only

Signature

VBA:

object.SetTextStyle rowTypes, bstrName
object

Type: Table, TableStyle

The object this method applies to.

rowTypes

Access: Input-only

Type: AcRowType enum

The row types to change.

  • acDataRow
  • acHeaderRow
  • acTitleRow
  • acUnknownRow
bstrName

Access: Input-only

Type: String

The text style name to use for the specified row types.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetTextStyle()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.FlowDirection = acTableBottomToTop
    customObj.HorzCellMargin = 0.22
    customObj.BitFlags = 1
    customObj.SetTextHeight AcRowType.acDataRow + AcRowType.acTitleRow, 1.3
    customObj.SetTextStyle AcRowType.acDataRow + AcRowType.acTitleRow, "Standard"

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 12, 23, 45
    customObj.SetBackgroundColor AcRowType.acDataRow + AcRowType.acTitleRow, col
    customObj.SetGridVisibility AcGridLineType.acHorzInside + AcGridLineType.acHorzTop _
                                , AcRowType.acDataRow + AcRowType.acTitleRow, True

    customObj.SetAlignment AcRowType.acDataRow + AcRowType.acTitleRow, acBottomRight
    col.SetRGB 244, 0, 0
    customObj.SetGridColor 3, 1, col

    MsgBox "Table Style Name = " & customObj.Name & vbCrLf & _
           "Style Description = " & customObj.Description & vbCrLf & _
           "Flow Direction = " & customObj.FlowDirection & vbCrLf & _
           "Horzontal Cell Margin = " & customObj.HorzCellMargin & vbCrLf & _
           "Bit Flags = " & customObj.BitFlags & vbCrLf & _
           "Title Row Text Height = " & customObj.GetTextHeight(acTitleRow) & vbCrLf & _
           "Title Row Text Style = " & customObj.GetTextStyle(acTitleRow) & vbCrLf & _
           "Grid Visibility for HorizontalBottom TitleRow  = " & customObj.GetGridVisibility(acHorzBottom, acTitleRow) & vbCrLf & _
           "Title Row Alignment = " & customObj.GetAlignment(acTitleRow) & vbCrLf & _
           "Header Suppression = " & customObj.HeaderSuppressed

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetTextStyle()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-put-FlowDirection customObj acTableBottomToTop)
    (vla-put-HorzCellMargin customObj 0.22)
    (vla-put-BitFlags customObj 1)
    (vla-SetTextHeight customObj (+ acDataRow acTitleRow) 1.3)
    (vla-SetTextStyle customObj (+ acDataRow acTitleRow) "Standard")

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 12 23 45)

    (vla-SetBackgroundColor customObj (+ acDataRow acTitleRow) col)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) (+ acDataRow acTitleRow) :vlax-true)
    (vla-SetAlignment customObj (+ acDataRow acTitleRow) acBottomRight)
    (vla-SetRGB col 244 0 0)
    (vla-SetGridColor customObj (+ acHorzTop acHorzInside) acDataRow col)

    (alert (strcat "Table Style Name = " (vla-get-Name customObj)
                   "\nStyle Description = " (vla-get-Description customObj)
                   "\nFlow Direction = " (itoa (vla-get-FlowDirection customObj))
                   "\nHorzontal Cell Margin = " (rtos (vla-get-HorzCellMargin customObj) 2)
                   "\nBit Flags = " (itoa (vla-get-BitFlags customObj))
                   "\nTitle Row Text Height = " (rtos (vla-GetTextHeight customObj acTitleRow) 2)
                   "\nTitle Row Text Style = " (vla-GetTextStyle customObj acTitleRow)
                   "\nGrid Visibility for HorizontalBottom TitleRow  = " (if (= (vla-GetGridVisibility customObj acHorzBottom acTitleRow) :vlax-true) "True" "False")
                   "\nTitle Row Alignment = " (itoa (vla-GetAlignment customObj acTitleRow))
                      "\nHeader Suppression = " (if (= (vla-get-HeaderSuppressed customObj) :vlax-true) "True" "False")
              )
    )
    (vlax-release-object col)
)


SetTextStyle2 Method (ActiveX)

Sets the text style name for a cell.

Supported platforms: Windows only

Signature

VBA:

object.SetTextStyle2 nRow, nCol, nContent, StringStyleName
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value for the cell.

StringStyleName

Access: Input-only

Type: String

The new style name to set.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetTextStyleId Method (ActiveX)

Sets a text style using an object ID to a named cell style.

Supported platforms: Windows only

Signature

VBA:

object.SetTextStyleId bstrCellStyle, val
object

Type: TableStyle

The object this method applies to.

bstrCellStyle

Access: Input-only

Type: String

The named cell style to modify.

val

Access: Input-only

Type: Long_PTR

The object ID of the text style being to assign to the named cell style.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetToolTip Method (ActiveX)

Sets the tooltip for a cell.

Supported platforms: Windows only

Signature

VBA:

object.SetToolTip nRow, nCol, tip
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The index of the row.

nCol

Access: Input-only

Type: Long

The index of the column.

tip

Access: Input-only

Type: String

The new tooltip text.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetValue Method (ActiveX)

Sets the value of a cell.

Supported platforms: Windows only

Signature

VBA:

object.SetValue nRow, nCol, nContent, acValue
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value of the cell.

acValue

Access: Input-only

Type: Variant

The cell value to set.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetValueFromText Method (ActiveX)

Sets the value of a cell by parsing the text.

Supported platforms: Windows only

Signature

VBA:

object.SetValueFromText nRow, nCol, nContent, szText, nOption
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value of the cell.

szText

Access: Input-only

Type: String

The text string to set as a value.

nOption

Access: Input-only

Type: AcParseOption enum

Special input option flags.

  • acParseOptionNone
  • acPreserveMtextFormat
  • acSetDefaultFormat

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetVariable Method (ActiveX)

Sets the value of an AutoCAD system variable.

Supported platforms: Windows only

Signature

VBA:

object.SetVariable Name, Value
object

Type: Document

The object this method applies to.

Name

Access: Input-only

Type: String

The name of the system variable to set.

Value

Access: Input-only

Type: Variant

The new value for the specified system variable.

Return Value (RetVal)

No return value.

Remarks

When setting system variables, AutoCAD may require integers, text, or double values. Passing the wrong data type (for example, passing a variant of type double when an integer is required) will generate an error. The easiest way to avoid this is to use one of the Cxxx functions, such as CInt(), to explicitly type your data before passing it.

For a list of all AutoCAD system variables and their types, please refer to "System Variables" in the AutoCAD Help system.

Examples

VBA:

Sub Example_SetVariable()
    ' This example sets various system variables, each of
    ' a different data type.

    Dim sysVarName As String
    Dim sysVarData As Variant
    Dim DataType As Integer

    ' Set FILEDIA system variable (data type Integer) to 1. NOTE that
    ' you need to declare a variable as the data type of system variable,
    ' assign data to that variable and then make it variant type
    Dim intData As Integer
    sysVarName = "FILEDIA"
    intData = 1
    sysVarData = intData    ' Integer data
    ThisDrawing.SetVariable sysVarName, sysVarData

    ' Check the variable using GetVariable
    sysVarData = ThisDrawing.GetVariable(sysVarName)
    MsgBox sysVarName & " = " & sysVarData, , "SetVariable Example"

    ' Set DCTCUST system variable (data type String) to "My Custom Dictionary"
    Dim strData As String
    sysVarName = "DCTCUST"
    strData = "My Custom Dictionary"
    sysVarData = strData        ' String data
    ThisDrawing.SetVariable sysVarName, sysVarData

    ' Check the variable using GetVariable
    sysVarData = ThisDrawing.GetVariable(sysVarName)
    MsgBox sysVarName & " = " & sysVarData, , "SetVariable Example"

    ' Set CHAMFERA system variable (data type Double) to 1.5
    Dim dataDouble As Double
    sysVarName = "CHAMFERA"
    dataDouble = 1.5
    sysVarData = dataDouble ' Double data
    ThisDrawing.SetVariable sysVarName, sysVarData
    ' Check the variable using GetVariable
    sysVarData = ThisDrawing.GetVariable(sysVarName)
    MsgBox sysVarName & " = " & sysVarData, , "SetVariable Example"

    ' Set INSBASE system variable (data type array) to (1.0,1.0,0)
    Dim arrayData3D(0 To 2) As Double
    sysVarName = "INSBASE"
    arrayData3D(0) = 1#: arrayData3D(1) = 1#: arrayData3D(2) = 0
    sysVarData = arrayData3D    ' 3D array data
    ThisDrawing.SetVariable sysVarName, sysVarData
    ' Check the variable using GetVariable
    sysVarData = ThisDrawing.GetVariable(sysVarName)
    MsgBox sysVarName & " = " & sysVarData(0) & ", " & sysVarData(1) & ", " & sysVarData(2), , "SetVariable Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetVariable()
    ;; This example sets various system variables, each of
    ;; a different data type.

    ;; Set FILEDIA system variable (data type Integer) to 1. NOTE that
    ;; you need to declare a variable as the data type of system variable,
    ;; assign data to that variable and then make it variant type
    (setq sysVarName "FILEDIA"
          intData 1
          sysVarData intData)    ;; Integer data
    (vla-SetVariable doc sysVarName sysVarData)

    ;; Check the variable using GetVariable
    (setq sysVarData (vlax-variant-value (vla-GetVariable doc sysVarName)))
    (alert (strcat sysVarName " = " (itoa sysVarData)))

    ;; Set DCTCUST system variable (data type String) to "My Custom Dictionary"
    (setq sysVarName "DCTCUST"
           strData "My Custom Dictionary"
           sysVarData strData)        ;; String data
    (vla-SetVariable doc sysVarName sysVarData)

    ;; Check the variable using GetVariable
    (setq sysVarData (vlax-variant-value (vla-GetVariable doc sysVarName)))
    (alert (strcat sysVarName " = " sysVarData))

    ;; Set CHAMFERA system variable (data type Double) to 1.5
    (setq sysVarName "CHAMFERA"
          dataDouble 1.5
          sysVarData dataDouble)      ;; Double data
    (vla-SetVariable doc sysVarName sysVarData)

    ;; Check the variable using GetVariable
    (setq sysVarData (vlax-variant-value (vla-GetVariable doc sysVarName)))
    (alert (strcat sysVarName " = " (rtos sysVarData 2)))

    ;; Set INSBASE system variable (data type array) to (1.0,1.0,0)
    (setq sysVarName "INSBASE"
          arrayData3D (vlax-3d-point 1 1 0)
          sysVarData arrayData3D)      ;; 3D array data
    (vla-SetVariable doc sysVarName sysVarData)

    ;; Check the variable using GetVariable
    (setq sysVarData (vlax-variant-value (vla-GetVariable doc sysVarName)))
    (alert (strcat sysVarName " = " (rtos (vlax-safearray-get-element sysVarData 0) 2) ", "
                                    (rtos (vlax-safearray-get-element sysVarData 1) 2) ", "
                                    (rtos (vlax-safearray-get-element sysVarData 2) 2)))
)


SetView Method (ActiveX)

Sets the view in a viewport to a saved view in the Views collection object.

Supported platforms: Windows only

Signature

VBA:

object.SetView View
object

Type: Viewport

The object this method applies to.

View

Access: Input-only

Type: View

The view to set.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetView()
    ' This example creates a new view.
    ' It then changes the active viewport to
    ' the newly created view.

    ' Create a new view
    Dim viewObj As AcadView
    Set viewObj = ThisDrawing.Views.Add("TESTVIEW")

    ' Set the view characteristics
    viewObj.center(0) = 374: viewObj.center(1) = 313
    viewObj.Width = 450
    viewObj.Height = 354

    ' Get the current active viewport
    Dim viewportObj As AcadViewport
    Set viewportObj = ThisDrawing.ActiveViewport
    MsgBox "Change to the saved view.", , "SetView Example"

    ' Set the view in the viewport
    viewportObj.SetView viewObj
    ThisDrawing.ActiveViewport = viewportObj

    ThisDrawing.Regen True

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetView()
    ;; This example creates a new view.
    ;; It then changes the active viewport to
    ;; the newly created view.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create a new view
    (setq viewObj (vla-Add (vla-get-Views doc) "TESTVIEW"))

    ;; Set the view characteristics
    (setq centerPoint (vlax-make-safearray vlax-vbDouble '(0 . 1)))
    (vlax-safearray-fill centerPoint '(374 313))
    (vla-put-Center viewObj centerPoint)
    (vla-put-Width viewObj 450)
    (vla-put-height viewObj 354)

    ; Get the current active viewport
    (setq viewportObj (vla-get-ActiveViewport doc))
    (alert "Change to the saved view.")

    ;; Set the view in the viewport
    (vla-SetView viewportObj viewObj)
    (vla-put-ActiveViewport doc viewportObj)

    (vla-Regen doc :vlax-true)
)


SetWeight Method (ActiveX)

Sets the weight of the control point at a given index.

Supported platforms: Windows only

Signature

VBA:

object.SetWeight Index, Weight
object

Type: Spline

The object this method applies to.

Index

Access: Input-only

Type: Long

The position in the control point list to set the weight. The first control point is index 0.

Weight

Access: Input-only

Type: Double

The new weight of the point.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SetWeight()
    ' This example creates a spline object in model space.
    ' It then finds the weight of the first control point
    ' and changes that value.

    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ZoomAll

    ' Display the coordinates of the first fit point
    Dim weight As Double
    weight = splineObj.GetWeight(0)
    MsgBox "The weight of control point 1 is " & weight, , "SetWeight Example"

    ' Change the weight of the first control point
    weight = 5
    splineObj.SetWeight 0, weight
    splineObj.Update
    MsgBox "The weight of control point 1 is now " & weight, , "SetWeight Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetWeight()
    ;; This example creates a spline object in model space.
    ;; It then finds the weight of the first control point
    ;; and changes that value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the spline
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(1 1 0
                                     5 5 0
                                     10 0 0
                                    )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)

    ;; Display the coordinates of the first fit point
    (setq weight (vla-GetWeight splineObj 0))
    (alert (strcat "The weight of control point 1 is " (rtos weight 2)))

    ;; Change the weight of the first control point
    (setq weight 5)
    (vla-SetWeight splineObj 0 weight)
    (vla-Update splineObj)
    (alert (strcat "The weight of control point 1 is now " (rtos weight 2)))
)


SetWidth Method (ActiveX)

Sets the start and end width of a polyline, given the segment index.

Supported platforms: Windows only

Signature

VBA:

object.SetWidth SegmentIndex, StartWidth, EndWidth
object

Type: LWPolyline, Polyline

The objects this method applies to.

SegmentIndex

Access: Input-only

Type: Long

An index specifying the segment whose width is to be set. The first segment is index 0.

StartWidth

Access: Input-only

Type: Double

The start width for the specified segment.

EndWidth

Access: Input-only

Type: Double

The end width for the specified segment.

Return Value (RetVal)

No return value.

Remarks

The segment index is the index of a particular segment of the polyline. For example, a polyline with three segments has segment indexes 0, 1, and 2.

Polyline: this method will fail if the polyline Type property is acCubicSplinePoly or acQuadSplinePoly.

Examples

VBA:

Sub Example_SetWidth()
    ' The following code prompts you to select a lightweight
    ' polyline, and then prompts you for the width to set each
    ' segment of the polyline.
    ' Pressing ENTER without specifying a width is equivalent to
    ' entering 0.

    AppActivate ThisDrawing.Application.Caption

    Dim returnObj As AcadObject
    Dim basePnt As Variant
    Dim retCoord As Variant
    Dim StartWidth As Double
    Dim EndWidth As Double
    Dim i, j As Long
    Dim nbr_of_segments As Long
    Dim nbr_of_vertices As Long
    Dim segment As Long
    Dim promptStart As String
    Dim promptEnd As String

    On Error Resume Next

    ThisDrawing.Utility.GetEntity returnObj, basePnt, "Select a polyline"

    ' Make sure the user selected a polyline.
    If Err <> 0 Then
        If returnObj.EntityName <> "AcDbPolyline" Then
            MsgBox "You did not select a polyline"
        End If
        Exit Sub
    End If

    ' Obtain the coordinates of each vertex of the selected polyline.
    ' The coordinates are returned in an array of points.
    retCoord = returnObj.Coordinates

    segment = 0
    i = LBound(retCoord)                 ' Start index of coordinates array
    j = UBound(retCoord)                 ' End index of coordinates array
    nbr_of_vertices = ((j - i) \ 2) + 1  ' Number of vertices in the polyline

    ' Determine the number of segments in the polyline.
    ' A closed polyline has as many segments as it has vertices.
    ' An open polyline has one fewer segment than it has vertices.
    ' Check the Closed property to determine if the polyline is closed.

    If returnObj.Closed Then
        nbr_of_segments = nbr_of_vertices
    Else
        nbr_of_segments = nbr_of_vertices - 1
    End If

    ' Have user set the width for each segment of the polygon
    Do While nbr_of_segments > 0

        ' Get width values from the user
        promptStart = vbCrLf & "Specify the width at the beginning of the segment at " & retCoord(i) & "," & retCoord(i + 1) & " ==> "
        promptEnd = vbCrLf & "Now specify the width at the end of that segment ==> "

        StartWidth = ThisDrawing.Utility.GetReal(promptStart)
        EndWidth = ThisDrawing.Utility.GetReal(promptEnd)

        ' Set the width of the current segment
        returnObj.SetWidth segment, StartWidth, EndWidth

        ' Prepare to obtain width of next segment, if any
        i = i + 2
        segment = segment + 1
        nbr_of_segments = nbr_of_segments - 1
    Loop

    MsgBox "Segment widths have been set", , "SetWidth Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetWidth()
    ;; The following code prompts you to select a lightweight
    ;; polyline, then displays the width of each segment of the
    ;; selected polyline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (vla-GetEntity (vla-get-Utility doc) 'returnObj 'basePnt "Select a polyline: ")

    ;; Make sure the user selected a polyline.
    (if (/= returnObj nil)
        (progn
            (if (= (vla-get-ObjectName returnObj) "AcDbPolyline")
                   (progn
                          ;; Obtain the coordinates of each vertex of the selected polyline.
                          ;; The coordinates are returned in an array of points.
                          (setq retCoord (vlax-variant-value (vla-get-Coordinates returnObj)))

                          (setq segment 0
                                i (vlax-safearray-get-l-bound retCoord 1)                 ;; Start index of coordinates array
                                j (vlax-safearray-get-u-bound retCoord 1)                 ;; End index of coordinates array
                                nbr_of_vertices (+ (/ (- j i) 2) 1))                      ;; Number of vertices in the polyline

                          ;; Determine the number of segments in the polyline.
                          ;; A closed polyline has as many segments as it has vertices.
                          ;; An open polyline has one fewer segment than it has vertices.
                          ;; Check the Closed property to determine if the polyline is closed.
                          (if (= (vla-get-Closed returnObj) :vlax-true)
                              (setq nbr_of_segments nbr_of_vertices)
                              (setq nbr_of_segments (1- nbr_of_vertices))
                          )

                          ;; Get the width of each segment of the polyline
                          (while (>= nbr_of_segments 0)
                              ;; Get width values from the user
                              (setq promptStart (strcat "\nSpecify the width at the beginning of the segment at " (rtos (vlax-safearray-get-element retCoord i) 2) ","
                                                                                (rtos (vlax-safearray-get-element retCoord (1+ i)) 2) " ==> "))
                              (setq promptEnd (strcat "\nNow specify the width at the end of that segment ==> "))

                              (setq StartWidth (vla-GetReal (vla-get-Utility doc) promptStart))
                              (setq EndWidth (vla-GetReal (vla-get-Utility doc) promptEnd))

                              ;; Set the width of the current segment
                              (vla-SetWidth returnObj segment StartWidth EndWidth)

                              ;; Prepare to obtain width of next segment, if any
                              (setq i (+ i 2)
                                    segment (1+ segment)
                                    nbr_of_segments (1- nbr_of_segments))
                          )
                      )
                (alert "Object selected was not a polyline")
            )
           )
        (alert "No object was selected.")
    )
)


SetWindowToPlot Method (ActiveX)

Sets the coordinates that define the portion of the layout to plot.

Supported platforms: Windows only

Signature

VBA:

object.SetWindowToPlot LowerLeft, UpperRight
object

Type: Layout, PlotConfiguration

The objects this method applies to.

LowerLeft

Access: Input-only

Type: Variant (two-element array of doubles)

The X and Y values for the lower-left window.

UpperRight

Access: Input-only

Type: Variant (two-element array of doubles)

The X and Y values for the upper-right window.

Return Value (RetVal)

No return value.

Remarks

The window coordinates are taken from the origin.

The units for these values are specified by the PaperUnits property.

The PlotType property must be set to acWindow for these coordinates to be used for the plot.

Examples

VBA:

Sub Example_SetWindowToPlot()
    ' This example allows the user to define an area in the current layout
    ' and displays a plot preview of the defined area.
    '
    ' * Note: You have to exit the
    ' plot preview before the VBA example will stop and control will be returned

    AppActivate ThisDrawing.Application.Caption

    Dim point1 As Variant, point2 As Variant

    ' Get first point in window
    point1 = ThisDrawing.Utility.GetPoint(, "Click the lower-left of the window to plot.")
    ReDim Preserve point1(0 To 1)   ' Change this to a 2D array by removing the Z position

    ' Get second point in window
    point2 = ThisDrawing.Utility.GetPoint(, "Click the upper-right of the window to plot.")
    ReDim Preserve point2(0 To 1)   ' Change this to a 2D array by removing the Z position

    ' Send information about window to current layout
    ThisDrawing.ActiveLayout.SetWindowToPlot point1, point2

    ' Read back window information
    ThisDrawing.ActiveLayout.GetWindowToPlot point1, point2

    MsgBox "Press any key to plot the following window:" & vbCrLf & vbCrLf & _
           "Lower Left: " & point1(0) & ", " & point1(1) & vbCrLf & _
           "Upper Right: " & point2(0) & ", " & point2(1)

    ' Be sure to plot a view, not some other plot style
    ThisDrawing.ActiveLayout.PlotType = acWindow

    ' Send Plot To Window
    ThisDrawing.ActiveLayout.ConfigName = "DWG to PDF.pc3"
    ThisDrawing.Plot.DisplayPlotPreview acFullPreview
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetWindowToPlot()
    ;; This example allows the user to define an area in the current layout to plot
    ;; and displays a plot preview of the defined area.
    ;;
    ;; * Note: You will have to exit the plot preview
    ;;  before the VBA example will stop and control will be returned
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get first point in window
    (setq point1 (vlax-variant-value (vla-GetPoint (vla-get-Utility doc) nil "Click the lower-left of the window to plot.")))

    ;; Change this to a 2D array by removing the Z position
    (setq pointTemp1 (vlax-make-safearray vlax-vbDouble '(0 . 1)))
    (vlax-safearray-put-element pointTemp1 0 (vlax-safearray-get-element point1 0))
    (vlax-safearray-put-element pointTemp1 1 (vlax-safearray-get-element point1 1))

    ;; Get second point in window
    (setq point2 (vlax-variant-value (vla-GetCorner (vla-get-Utility doc) point1 "Click the upper-right of the window to plot.")))

    ;; Change this to a 2D array by removing the Z position
    (setq pointTemp2 (vlax-make-safearray vlax-vbDouble '(0 . 1)))
    (vlax-safearray-put-element pointTemp2 0 (vlax-safearray-get-element point2 0))
    (vlax-safearray-put-element pointTemp2 1 (vlax-safearray-get-element point2 1))

    ;; Send information about window to current layout
    (vla-SetWindowToPlot (vla-get-ActiveLayout doc) pointTemp1 pointTemp2)

    ;; Read back window information
    (vla-GetWindowToPlot (vla-get-ActiveLayout doc) 'point1 'point2)

    (setq point1 (vlax-safearray->list point1)
             point2 (vlax-safearray->list point2))

    (alert (strcat "Press any key to plot the following window:"
                   "\nLower Left: " (rtos (nth 0 point1) 2) ", " (rtos (nth 1 point1) 2)
                   "\nUpper Right: " (rtos (nth 0 point2) 2) ", " (rtos (nth 1 point2) 2)))

    ;; Make sure the instruction is to plot a view, not some other plot style
    (vla-put-PlotType (vla-get-ActiveLayout doc) acWindow)

    ;; Send Plot To Window - A plot device must be set before a preview can be created
    (vla-put-ConfigName (vla-get-ActiveLayout doc) "DWG to PDF.pc3")
    (vla-DisplayPlotPreview (vla-get-Plot doc) acFullPreview)
)


SetXData Method (ActiveX)

Sets the extended data (XData) associated with an object.

Supported platforms: Windows only

Signature

VBA:

object.SetXData XDataType, XDataValue
object

Type: All drawing objects, AttributeReference, Block, Dictionary, Dimension, DimStyle, Group, Layer, Layout, Linetype, Material, MLeaderStyle, PlotConfiguration, RegisteredApplication, TableStyle, TextStyle, UCS, View, Viewport, XRecord

The object this method applies to.

XDataType

Access: Input-only

Type: Variant (array of short)

An array of short integer values that represent the DXF group code values for each value in the extended data (XData).

XDataValue

Access: Input-only

Type: Variant (array of variants)

An array of values that make up the extended data (XData).

Return Value (RetVal)

No return value.

Remarks

Extended data is an example of instance-specific data created by applications written with ObjectARX or AutoLISP. This data can be added to any entity. This data follows the entity's definition data and is maintained in the order in which it was saved into the document. (AutoCAD maintains this information but does not use it.)

Examples

VBA:

Sub Example_SetXdata()
    ' This example creates a line and attaches extended data to that line.

    ' Create the line
    Dim lineObj As AcadLine
    Dim startPt(0 To 2) As Double, endPt(0 To 2) As Double
    startPt(0) = 1#: startPt(1) = 1#: startPt(2) = 0#
    endPt(0) = 5#: endPt(1) = 5#: endPt(2) = 0#
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPt, endPt)
    ZoomAll

    ' Initialize all the xdata values. Note that first data in the list should be
    ' application name and first datatype code should be 1001
    Dim DataType(0 To 9) As Integer
    Dim Data(0 To 9) As Variant
    Dim reals3(0 To 2) As Double
    Dim worldPos(0 To 2) As Double

    DataType(0) = 1001: Data(0) = "Test_Application"
    DataType(1) = 1000: Data(1) = "This is a test for xdata"

    DataType(2) = 1003: Data(2) = "0"                   ' layer
    DataType(3) = 1040: Data(3) = 1.23479137438413E+40  ' real
    DataType(4) = 1041: Data(4) = 1237324938            ' distance
    DataType(5) = 1070: Data(5) = 32767                 ' 16 bit Integer
    DataType(6) = 1071: Data(6) = 32767                 ' 32 bit Integer
    DataType(7) = 1042: Data(7) = 10                    ' scaleFactor

    reals3(0) = -2.95: reals3(1) = 100: reals3(2) = -20
    DataType(8) = 1010: Data(8) = reals3                ' real

    worldPos(0) = 4: worldPos(1) = 400.99999999: worldPos(2) = 2.798989
    DataType(9) = 1011: Data(9) = worldPos              ' world space position

    ' Attach the xdata to the line
    lineObj.SetXData DataType, Data

    ' Return the xdata for the line
    Dim xdataOut As Variant
    Dim xtypeOut As Variant
    lineObj.GetXData "", xtypeOut, xdataOut

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetXData()
    ;; This example creates a line and attaches extended data to that line.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the line
    (setq startPt (vlax-3d-point 1 1 0)
          endPt (vlax-3d-point 5 5 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPt endPt))
    (vla-ZoomAll acadObj)

    ;; Initialize all the xdata values. Note that first data in the list should be
    ;; application name and first datatype code should be 1001
    (setq DataType (vlax-make-safearray vlax-vbInteger '(0 . 9)))
    (setq Data (vlax-make-safearray vlax-vbVariant '(0 . 9)))

    (vlax-safearray-put-element DataType 0 1001)
    (vlax-safearray-put-element Data 0 "Test_Application")

    (vlax-safearray-put-element DataType 1 1000)
    (vlax-safearray-put-element Data 1 "This is a test for xdata")

    ;; layer
    (vlax-safearray-put-element DataType 2 1003)
    (vlax-safearray-put-element Data 2 "0")

    ;; real
    (vlax-safearray-put-element DataType 3 1040)
    (vlax-safearray-put-element Data 3 1.23479137438413E+40)

    ;; distance
    (vlax-safearray-put-element DataType 4 1041)
    (vlax-safearray-put-element Data 4 1237324938)

    ;; 16 bit Integer
    (vlax-safearray-put-element DataType 5 1070)
    (vlax-safearray-put-element Data 5 32767)

    ;; 32 bit Integer
    (vlax-safearray-put-element DataType 6 1071)
    (vlax-safearray-put-element Data 6 32767)

    ;; scaleFactor
    (vlax-safearray-put-element DataType 7 1042)
    (vlax-safearray-put-element Data 7 10)

    ;; 3D point
    (setq reals3 (vlax-3d-point -2.95 100 -20))
    (vlax-safearray-put-element DataType 8 1010)
    (vlax-safearray-put-element Data 8 reals3)

    ;; world space position
    (setq worldPos (vlax-3d-point 4 400.99999999 2.798989))
    (vlax-safearray-put-element DataType 9 1011)
    (vlax-safearray-put-element Data 9 worldPos)

    ;; Attach the xdata to the line
    (vla-SetXData lineObj DataType Data)

    ;; Return the xdata for the line
    (vla-GetXData lineObj "" 'xtypeOut 'xdataOut)
)


SetXRecordData Method (ActiveX)

Sets the extended record data (XRecordData) associated with a dictionary.

Supported platforms: Windows only

Signature

VBA:

object.SetXRecordData XRecordDataType, XRecordData
object

Type: XRecord

The object this method applies to.

XRecordDataType

Access: Input-only

Type: Variant (array of short)

An array of short integer values that represent the DXF group code values for each value in the extended record (XRecord) data.

XRecordData

Access: Input-only

Type: Variant (array of variants)

An array of values that make up the extended record (XRecord) data.

Return Value (RetVal)

No return value.

Remarks

XRecord objects are used to store and manage arbitrary data. This object is similar in concept to XData, but is not limited by size or order.

Unlike XData, XRecords work with the standard AutoCAD group codes, which are all below 1000 in value. All the standard AutoCAD group codes are supported. This means that, in addition to all the normally used data types, an XRecord is capable of storing object IDs, which allows XRecords to own other objects including other XRecords.

The following group codes are common to all XRecord objects:

Group codes | Description
100 | Subclass marker (AcDbXrecord)
1-369 (except 5 and 105) | These values can be used by an application in any way.

Examples

VBA:

Sub Example_SetXRecordData()
    ' This example creates a new XRecord if one doesn't exist,
    ' appends data to the XRecord, and reads it back.  To see data being added,
    ' run the example more than once.

    Dim TrackingDictionary As AcadDictionary, TrackingXRecord As AcadXRecord
    Dim XRecordDataType As Variant, XRecordData As Variant
    Dim ArraySize As Long, iCount As Long
    Dim DataType As Integer, Data As String, msg As String

    ' Unique identifiers to distinguish our XRecordData from other XRecordData
    Const TYPE_STRING = 1
    Const TAG_DICTIONARY_NAME = "ObjectTrackerDictionary"
    Const TAG_XRECORD_NAME = "ObjectTrackerXRecord"

    ' Connect to the dictionary in which the XRecord is stored
    On Error GoTo CREATE
    Set TrackingDictionary = ThisDrawing.Dictionaries(TAG_DICTIONARY_NAME)
    Set TrackingXRecord = TrackingDictionary.GetObject(TAG_XRECORD_NAME)
    On Error GoTo 0

    ' Get current XRecordData
    TrackingXRecord.GetXRecordData XRecordDataType, XRecordData

    ' If there is no array already, create one
    If VarType(XRecordDataType) And vbArray = vbArray Then
        ArraySize = UBound(XRecordDataType) + 1       ' Get the size of the data elements returned
        ArraySize = ArraySize + 1                        ' Increase to hold new data

        ReDim Preserve XRecordDataType(0 To ArraySize)
        ReDim Preserve XRecordData(0 To ArraySize)
    Else
        ArraySize = 0
        ReDim XRecordDataType(0 To ArraySize) As Integer
        ReDim XRecordData(0 To ArraySize) As Variant
    End If

    ' Append new XRecord Data
    '
    ' For this sample, we only append the current time to the XRecord
    XRecordDataType(ArraySize) = TYPE_STRING: XRecordData(ArraySize) = CStr(Now)
    TrackingXRecord.SetXRecordData XRecordDataType, XRecordData

    ' Read back all XRecordData entries
    TrackingXRecord.GetXRecordData XRecordDataType, XRecordData
    ArraySize = UBound(XRecordDataType)

    ' Retrieve and display stored XRecordData
    For iCount = 0 To ArraySize
        ' Get information for this element
        DataType = XRecordDataType(iCount)
        Data = XRecordData(iCount)

        If DataType = TYPE_STRING Then
            msg = msg & Data & vbCrLf
        End If
    Next

    MsgBox "The data in the XRecord is: " & vbCrLf & vbCrLf & msg, vbInformation

    Exit Sub

CREATE:
    ' Create the objects that hold the XRecordData
    If TrackingDictionary Is Nothing Then  ' Make sure the tracking object is there
        Set TrackingDictionary = ThisDrawing.Dictionaries.Add(TAG_DICTIONARY_NAME)
        Set TrackingXRecord = TrackingDictionary.AddXRecord(TAG_XRECORD_NAME)
    End If

    Resume
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetXRecordData()
    ;; This example creates a new XRecord if one doesn't exist,
    ;; appends data to the XRecord, and then reads it back.  To see data being added,
    ;; run the example more than once.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Unique identifiers to distinguish this XRecordData from other XRecordData
    (setq TYPE_STRING 1
          TAG_DICTIONARY_NAME "ObjectTrackerDictionary"
          TAG_XRECORD_NAME "ObjectTrackerXRecord")

    ;; Connect to the dictionary in which to store the XRecord
    (setq dictionaries (vla-get-Dictionaries doc))
    (setq TrackingDictionary (vl-catch-all-apply 'vla-Item (list dictionaries TAG_DICTIONARY_NAME)))

    ;; (= (vl-catch-all-error-message TrackingDictionary) "Automation Error. Key not found")

    (if (= (type TrackingDictionary) 'VLA-OBJECT)
        (setq TrackingXRecord (vla-GetObject TrackingDictionary TAG_XRECORD_NAME))
        (progn
            ;; Create the objects that hold this XRecordData
            (setq TrackingDictionary (vla-Add dictionaries TAG_DICTIONARY_NAME))
            (setq TrackingXRecord  (vla-AddXRecord TrackingDictionary TAG_XRECORD_NAME))
           )
    )

    ;; Get current XRecordData
    (vla-GetXRecordData TrackingXRecord 'temp-XRecordDataType 'temp-XRecordData)

    ;; If there is no array yet then create one
    (setq ArraySize 0)
    (if (/= temp-XRecordDataType nil)
        (progn
               (setq ArraySize (vlax-safearray-get-u-bound temp-XRecordDataType 1))
            (setq XRecordDataType (vlax-make-safearray vlax-vbInteger (cons 0 (1+ ArraySize))))
            (setq XRecordData (vlax-make-safearray vlax-vbVariant (cons 0 (1+ ArraySize))))

            (setq iCount 0)
            (while (>= ArraySize iCount)
                ;; Get information for this element
                (setq DataType (vlax-safearray-get-element temp-XRecordDataType iCount))
                (setq Data (vlax-variant-value (vlax-safearray-get-element temp-XRecordData iCount)))

                (vlax-safearray-put-element XRecordDataType iCount DataType)
                (vlax-safearray-put-element XRecordData iCount Data)

                (setq iCount (1+ iCount))
            )
           )
        (progn
            (setq XRecordDataType (vlax-make-safearray vlax-vbInteger '(0 . 0)))
            (setq XRecordData (vlax-make-safearray vlax-vbVariant '(0 . 0)))
           )
    )

    ;; Append new XRecord Data
    ;;
    ;; For this sample we only append the current time to the XRecord
    (vlax-safearray-put-element XRecordDataType ArraySize TYPE_STRING)
    (setq cdate (rtos (vlax-variant-value (vla-GetVariable doc "CDATE")) 2 6))
    (vlax-safearray-put-element XRecordData ArraySize (strcat (substr cdate 5 2) "/"
                                  (substr cdate 7 2) "/"
                                  (substr cdate 1 4) "-"
                                  (substr cdate 10 2) ":"
                                  (substr cdate 12 2) ":"
                                  (substr cdate 14)))
    (vla-SetXRecordData TrackingXRecord XRecordDataType XRecordData)

    ;; Read back all XRecordData entries
    (vla-GetXRecordData TrackingXRecord XRecordDataType XRecordData)
    (setq ArraySize (vlax-safearray-get-u-bound XRecordDataType 1))

    ;; Retrieve and display stored XRecordData
    (setq iCount 0
             msg "")
    (while (>= ArraySize iCount)
        ;; Get information for this element
        (setq DataType (vlax-safearray-get-element XRecordDataType iCount))
        (setq Data (vlax-variant-value (vlax-safearray-get-element XRecordData iCount)))

        (if (= DataType TYPE_STRING)
            (setq msg (strcat msg Data "\n"))
        )

        (setq iCount (1+ iCount))
    )

    (alert (strcat "The data in the XRecord is: \n\n" msg))
)


SliceSolid Method (ActiveX)

Creates a slice of the 3DSolid object given three points that define the plane.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.SliceSolid(Point1, Point2, Point3, Negative)
object

Type: 3DSolid

The object this method applies to.

Point1

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the first point.

Point2

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the second point.

Point3

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the third point.

Negative

Access: Input-only

Type: Boolean

This specifies whether to return the part of the solid that is on the negative side of the plane. If True, then AutoCAD creates a new 3DSolid object that contains the portion of the original solid that is on the negative normal side of the plane.

Return Value (RetVal)

Type: 3DSolid

The resulting slice as a 3DSolid object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SliceSolid()
    ' This example creates a box in model space.
    ' It then slices the box based on a plane
    ' defined by three points. The slice is returned
    ' as a 3Dsolid.

    Dim boxObj As Acad3DSolid
    Dim length As Double, width As Double, height As Double
    Dim center(0 To 2) As Double

    ' Define the box
    center(0) = 5#: center(1) = 5#: center(2) = 0
    length = 5#: width = 7: height = 10#

    ' Create the box (3DSolid) object in model space
    Set boxObj = ThisDrawing.ModelSpace.AddBox(center, length, width, height)

    ' Define the section plane with three points
    Dim slicePt1(0 To 2) As Double
    Dim slicePt2(0 To 2) As Double
    Dim slicePt3(0 To 2) As Double

    slicePt1(0) = 1.5: slicePt1(1) = 7.5: slicePt1(2) = 0
    slicePt2(0) = 1.5: slicePt2(1) = 7.5: slicePt2(2) = 10
    slicePt3(0) = 8.5: slicePt3(1) = 2.5: slicePt3(2) = 10

    ' slice the box
    Dim sliceObj As Acad3DSolid
    Set sliceObj = boxObj.SliceSolid(slicePt1, slicePt2, slicePt3, True)

    ' Change the viewing direction of the viewport
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SliceSolid()
    ;; This example creates a box in model space.
    ;; It then slices the box based on a plane
    ;; defined by three points. The slice is returned
    ;; as a 3Dsolid.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the box
    (setq center (vlax-3d-point 5 5 0)
          boxLength 5
             boxWidth 7
             boxHeight 10)

    ;; Create the box (3DSolid) object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq boxObj (vla-AddBox modelSpace center boxLength boxWidth boxHeight))

    ;; Define the section plane with three points
    (setq slicePt1 (vlax-3d-point 1.5 7.5 0)
          slicePt2 (vlax-3d-point 1.5 7.5 10)
          slicePt3 (vlax-3d-point 8.5 2.5 10))

    ;; slice the box
    (setq sliceObj (vla-SliceSolid boxObj slicePt1 slicePt2 slicePt3 :vlax-true))

    ;; Change the viewing direction of the viewport
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)
)


Split Method (ActiveX)

Splits a viewport into the given number of views.

Supported platforms: Windows only

Signature

VBA:

object.Split NumWins
object

Type: Viewport

The object this method applies to.

NumWins

Access: Input-only

Type: AcViewportSplitType enum

  • acViewport2Horizontal
  • acViewport2Vertical
  • acViewport3Above
  • acViewport3Below
  • acViewport3Horizontal
  • acViewport3Left
  • acViewport3Right
  • acViewport3Vertical
  • acViewport4

Return Value (RetVal)

No return value.

Remarks

Although the Split method has been called, the changes will not appear until the ActiveViewport property has been used to make the viewport active. This is required even if the viewport was active before the call to Split.

A viewport does not have to be active for this method to work, however, it must be reset to active to see the results of this method.

Examples

VBA:

Sub Example_Split()
    ' This example creates a new viewport and makes it active.
    ' Then it splits the viewport into four windows.
    ' It then takes one of the four windows, and splits that
    ' window horizontally in half.
    Dim newViewport As AcadViewport

    ' Create a new viewport and make it active
    Set newViewport = ThisDrawing.Viewports.Add("TESTVIEWPORT")
    ThisDrawing.ActiveViewport = newViewport

    ' Split the viewport in four windows
    newViewport.Split acViewport4

    ' Make the newly split viewport active
    ThisDrawing.ActiveViewport = newViewport

    ' Note that current drawing layout will show four windows.
    ' However, only one of the windows will be active.
    ' The following code sets the lower-left corner window
    ' to be the active window and then splits that
    ' window into two horizontal windows.
    Dim entry
    For Each entry In ThisDrawing.Viewports
        If entry.name = "TESTVIEWPORT" Then
            Dim lowerLeft
            lowerLeft = entry.LowerLeftCorner
            If lowerLeft(0) = 0 And lowerLeft(1) = 0 Then
                Set newViewport = entry
                Exit For
            End If
        End If
    Next
    newViewport.Split acViewport2Horizontal
    ThisDrawing.ActiveViewport = newViewport
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Split()
    ;; This example creates a new viewport and makes it active.
    ;; Then it splits the viewport into four windows.
    ;; It then takes one of the four windows, and splits that
    ;; window horizontally in half.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create a new viewport and make it active
    (setq newViewport (vla-Add (vla-get-Viewports doc) "TESTVIEWPORT"))
    (vla-put-ActiveViewport doc newViewport)

    ;; Split the viewport in four windows
    (vla-Split newViewport acViewport4)

    ;; Make the newly split viewport active
    (vla-put-ActiveViewport doc newViewport)

    ;; Note that current drawing layout will show four windows.
    ;; However, only one of the windows will be active.
    ;; The following code sets the lower-left corner window
    ;; to be the active window and then splits that
    ;; window into two horizontal windows.
    (vlax-for entry (vla-get-Viewports doc)
        (if (= (vla-get-Name entry) "TESTVIEWPORT")
            (progn
                (setq lowerLeft (vlax-variant-value (vla-get-LowerLeftCorner entry)))

                (if (and (= (vlax-safearray-get-element lowerLeft 0) 0)
                         (= (vlax-safearray-get-element lowerLeft 1) 0))
                    (setq newViewport entry)
                )
            )
        )
    )

    (vla-Split newViewport acViewport2Horizontal)
    (vla-put-ActiveViewport doc newViewport)
)


StartBatchMode Method (ActiveX)

Starts printing in batch mode. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.StartBatchMode entryCount
object

Type: Plot

The object this method applies to.

entryCount

Access: Input-only

Type: Long

The number of entries to plot in the batch.

Return Value (RetVal)

No return value.

Remarks

This method is obsolete and may be removed in a future version of AutoCAD.

Examples

VBA:

Sub Example_StartBatchMode()
    'This method may become obsolete and may be removed
    'in a future (post-AutoCAD 2005) version.
End Sub

Visual LISP:

Not available


StartUndoMark Method (ActiveX)

Marks the beginning of a block of operations.

Supported platforms: Windows only

Signature

VBA:

object.StartUndoMark
object

Type: Document

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

This method allows AutoCAD to set up the necessary environment so operations done between this call and a call to EndUndoMark can be treated as a group of operations.

Examples

VBA:

Sub Example_StartUndoMark()
    ' This example creates a series of lines, each with an undo marker
    ' defined for it. After lines are created, you can switch to AutoCAD and type
    ' the Undo command, and only one line at a time will be undone. If StartUndoMark
    ' call is not made, an undo in AutoCAD will undo all the lines at once.

    Dim line As AcadLine
    Dim stPnt(0 To 2) As Double
    Dim endPnt(0 To 2) As Double
    stPnt(0) = 1: stPnt(1) = 2: stPnt(2) = 0
    endPnt(0) = 2: stPnt(1) = 1: stPnt(2) = 0

    ' Create the lines
    Dim j As Integer
    For j = 0 To 3
        ThisDrawing.StartUndoMark
        Set line = ThisDrawing.ModelSpace.AddLine(stPnt, endPnt)
        stPnt(0) = stPnt(0) + 3
        endPnt(0) = endPnt(0) + 3
        ThisDrawing.EndUndoMark
    Next
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_StartUndoMark()
    ;; This example creates a series of lines, each one with an undo marker
    ;; defined for it. After lines are created you can switch to AutoCAD and type
    ;; the Undo command, and only one line at a time will be undone. If StartUndoMark
    ;; call is not made, an undo in AutoCAD will undo all the lines at once.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    (setq stPnt (vlax-3d-point 1 2 0)
          endPnt (vlax-3d-point 2 1 0))

    ;; Create the lines
    (setq j 0)
    (while (>= 3 j)
        (vla-StartUndoMark doc)
        (setq line (vla-AddLine modelSpace stPnt endPnt))
        (vlax-safearray-put-element (vlax-variant-value stPnt) 0 (+ (vlax-safearray-get-element (vlax-variant-value stPnt) 0) 3))
        (vlax-safearray-put-element (vlax-variant-value endPnt) 0 (+ (vlax-safearray-get-element (vlax-variant-value endPnt) 0) 3))
        (setq j (1+ j))
        (vla-EndUndoMark doc)
    )
    (vla-ZoomAll acadObj)
)


SwapOrder Method (ActiveX)

Swaps the draw order positions of two objects.

Supported platforms: Windows only

Signature

VBA:

object.SwapOrder Object1, Object2
object

Type: SortentsTable

The object this method applies to.

Object1

Access: Input-only

Type: Entity

The first object.

Object2

Access: Input-only

Type: Entity

The second object.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SortentsTable()
    ' This example creates a SortentsTable object and
    ' changes the draw order.

    ' Set drawing to display lineweights and create a True Color object
    Dim ACADPref As AcadDatabasePreferences
    Set ACADPref = ThisDrawing.preferences
    ACADPref.LineWeightDisplay = True
    Dim MyColorObjOne As AcadAcCmColor
    Set MyColorObjOne = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Call MyColorObjOne.SetRGB(80, 100, 244)

    ' Draw a polyline
    Dim plineObj As AcadPolyline
    Dim points(0 To 8) As Double
    points(0) = 4: points(1) = 4: points(2) = 0
    points(3) = 3: points(4) = 5: points(5) = 0
    points(6) = 6: points(7) = 20: points(8) = 0
    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
    plineObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(90, 110, 150)
    plineObj.TrueColor = MyColorObjOne

    ' Draw a line
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 5: startPoint(1) = 13: startPoint(2) = 0
    endPoint(0) = 5: endPoint(1) = 27: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    lineObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(50, 80, 230)
    lineObj.TrueColor = MyColorObjOne

    ' Draw a circle
    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    centerPoint(0) = 10: centerPoint(1) = 15: centerPoint(2) = 0#
    radius = 5#
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)
    circleObj.Lineweight = acLnWt211
    Call MyColorObjOne.SetRGB(60, 200, 220)
    circleObj.TrueColor = MyColorObjOne
    ZoomAll
    AcadApplication.Update

    ' Get an extension dictionary and, if necessary, add a SortentsTable object
    Dim eDictionary As Object
    Set eDictionary = ThisDrawing.ModelSpace.GetExtensionDictionary
    ' Prevent failed GetObject calls from throwing an exception
    On Error Resume Next
    Dim sentityObj As Object
    Set sentityObj = eDictionary.GetObject("ACAD_SORTENTS")
    On Error GoTo 0
    If sentityObj Is Nothing Then
         ' No SortentsTable object, so add one
         Set sentityObj = eDictionary.AddObject("ACAD_SORTENTS", "AcDbSortentsTable")
    End If

    Dim ObjIds(2) As Long
    ObjIds(0) = plineObj.ObjectID
    ObjIds(1) = lineObj.ObjectID
    ObjIds(2) = circleObj.ObjectID

    Dim varObject As AcadObject
    Set varObject = ThisDrawing.ObjectIdToObject(ObjIds(2))
    Dim arr(0) As AcadObject
    Set arr(0) = varObject

    ' Move the circle object to the bottom
    sentityObj.MoveToBottom arr
    AcadApplication.Update

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SortentsTable()
    ;; This example creates a SortentsTable object and
    ;; changes the draw order.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Set drawing to display lineweights and create a True Color object
    (vla-put-LineWeightDisplay (vla-get-Preferences doc) :vlax-true)
    (setq MyColorObjOne (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB MyColorObjOne 80 100 244)

    ;; Draw a polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill points '(4 4 0
                                  3 5 0
                                  6 20 0
                                 )
    )

    (setq plineObj (vla-AddPolyline modelSpace points))

    (vla-put-Lineweight plineObj acLnWt211)
    (vla-SetRGB MyColorObjOne 90 110 150)
    (vla-put-TrueColor plineObj MyColorObjOne)

    ;; Draw a line
    (setq startPoint (vlax-3d-point 5 13 0)
          endPoint (vlax-3d-point 5 27 0))

    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-put-Lineweight lineObj acLnWt211)
    (vla-SetRGB MyColorObjOne 50 80 230)
    (vla-put-TrueColor lineObj MyColorObjOne)

    ;; Draw a circle
    (setq centerPoint (vlax-3d-point 10 15 0)
          radius 5)

    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))
    (vla-put-Lineweight circleObj acLnWt211)
    (vla-SetRGB MyColorObjOne 60 200 220)
    (vla-put-TrueColor circleObj MyColorObjOne)

    (vla-ZoomAll acadObj)
    (vla-Update acadObj)

    ;; Get an extension dictionary and, if necessary, add a SortentsTable object
    (setq eDictionary (vla-GetExtensionDictionary modelSpace))

    ;; Prevent failed GetObject calls from throwing an exception
    (setq sentityObj (vl-catch-all-apply 'vla-GetObject (list eDictionary "ACAD_SORTENTS")))

    (if (= (type sentityObj)'VL-CATCH-ALL-APPLY-ERROR)
         ;; No SortentsTable object, so add one
         (setq sentityObj (vla-AddObject eDictionary "ACAD_SORTENTS" "AcDbSortentsTable"))
    )

    (setq ObjIds (vlax-make-safearray vlax-vbLong '(0 . 2)))
    (vlax-safearray-put-element ObjIds 0 (vla-get-ObjectID plineObj))
    (vlax-safearray-put-element ObjIds 1 (vla-get-ObjectID lineObj))
    (vlax-safearray-put-element ObjIds 2 (vla-get-ObjectID circleObj))

    (setq varObject circleObj)
    (setq arr (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element arr 0 varObject)

    ;; Move the circle object to the bottom
    (vla-MoveToBottom sentityObj arr)
    (vla-Update acadObj)

    (vlax-release-object MyColorObjOne)
)


SyncModelView Method (ActiveX)

Updates the viewport parameters with the parameters in the associated model view.

Supported platforms: Windows only

Signature

VBA:

object.SyncModelView
object

Type: PViewport

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


TransformBy Method (ActiveX)

Moves, scales, or rotates an object given a 4x4 transformation matrix.

Supported platforms: Windows only

Signature

VBA:

object.TransformBy TransformationMatrix
object

Type: All drawing objects, AttributeReference

The object this method applies to.

TransformationMatrix

Access: Input-only

Type: Variant (4x4 array of doubles)

A 4x4 matrix specifying the transformation to perform.

Return Value (RetVal)

No return value.

Remarks

The following table demonstrates the transformation matrix configuration, where R = Rotation, and T = Translation: R00

R00 | R01 | R02 | T0
R10 | R11 | R12 | T1
R20 | R21 | R22 | T2
0 | 0 | 0 | 1

This method will return an error if the transformation matrix is not correct.

Sample transformation matrices are provided in the example code for this method.

Examples

VBA:

Sub Example_TransformBy()
    ' This example creates a line and rotates it 90 degrees
    ' using a transformation matrix.

    ' Create a line
    Dim lineObj As AcadLine
    Dim startPt(0 To 2) As Double
    Dim endPt(0 To 2) As Double
    startPt(0) = 2: startPt(1) = 1: startPt(2) = 0
    endPt(0) = 5: endPt(1) = 1: endPt(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPt, endPt)
    lineObj.Update

    ' Initialize the transMat variable with a transformation matrix
    ' that will rotate an object by 90 degrees about the point(0,0,0)
    ' (More examples of transformation matrices are listed below)
    Dim transMat(0 To 3, 0 To 3) As Double
    transMat(0, 0) = 0#: transMat(0, 1) = -1#: transMat(0, 2) = 0#: transMat(0, 3) = 0#
    transMat(1, 0) = 1#: transMat(1, 1) = 0#: transMat(1, 2) = 0#: transMat(1, 3) = 0#
    transMat(2, 0) = 0#: transMat(2, 1) = 0#: transMat(2, 2) = 1#: transMat(2, 3) = 0#
    transMat(3, 0) = 0#: transMat(3, 1) = 0#: transMat(3, 2) = 0#: transMat(3, 3) = 1#

    ' Transform the line using the defined transformation matrix
    MsgBox "Transform the line.", , "TransformBy Example"
    lineObj.TransformBy (transMat)
    ZoomAll
    MsgBox "The line is transformed.", , "TransformBy Example"

' More examples of transformation matrices:

' Rotation Matrix: 90 Degrees about point 0,0,0
        ' 0.000000  -1.000000  0.000000  0.000000
        ' 1.000000  0.000000  0.000000  0.000000
        ' 0.000000  0.000000  1.000000  0.000000
        ' 0.000000  0.000000  0.000000  1.000000

' Rotation Matrix: 45 Degrees about point 5,5,0
        ' 0.70710678118654  -0.70710678118654  0.000000  5.000000
        ' 0.70710678118654  0.70710678118654  0.000000  -2.071068
        ' 0.000000  0.000000  1.000000  0.000000
        ' 0.000000  0.000000  0.000000  1.000000

' Translation Matrix: move an object by 10,10,0
        ' 1.000000  0.000000  0.000000  10.000000
        ' 0.000000  1.000000  0.000000  10.000000
        ' 0.000000  0.000000  1.000000  0.000000
        ' 0.000000  0.000000  0.000000  1.000000

' Scaling Matrix: scale by 10,10 at point 0,0,0
        ' 10.000000  0.000000  0.000000  0.000000
        ' 0.000000  10.000000  0.000000  0.000000
        ' 0.000000  0.000000  10.000000  0.000000
        ' 0.000000  0.000000  0.000000  1.000000

' Scaling Matrix: scale by 10 at point 2,2
        ' 10.000000  0.000000  0.000000  -18.000000
        ' 0.000000  10.000000  0.000000  -18.000000
        ' 0.000000  0.000000  10.000000  0.000000
        ' 0.000000  0.000000  0.000000  1.000000
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TransformBy()
    ;; This example creates a line and rotates it 90 degrees
    ;; using a transformation matrix.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create a line
    (setq startPt (vlax-3d-point 2 1 0)
          endPt (vlax-3d-point 5 1 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPt endPt))
    (vla-Update lineObj)

    ;; Initialize the transMat variable with a transformation matrix
    ;; that will rotate an object by 90 degrees about the point(0,0,0)
    ;; (More examples of transformation matrices are listed below)
    (setq transMat (vlax-tmatrix '((0 -1 0 0)
                                   (1 0 0 0)
                                   (0 0 1 0)
                                   (0 0 0 1))))

    ;; Transform the line using the defined transformation matrix
    (alert "Transform the line.")
    (vla-TransformBy lineObj transMat)
    (vla-ZoomAll acadObj)
    (vla-Regen doc acAllViewports)
    (alert "The line is transformed.")

;; More examples of transformation matrices:
;; Rotation Matrix: 90 Degrees about point 0,0,0
;    (setq transMat (vlax-tmatrix '((0 -1 0 0)
;                                   (1 0 0 0)
;                                   (0 0 1 0)
;                                   (0 0 0 1))))

;; Rotation Matrix: 45 Degrees about point 5,5,0
;    (setq transMat (vlax-tmatrix '((0.70710678118654 -0.70710678118654 0 5)
;                                   (0.70710678118654 0.70710678118654 0 -2.071068)
;                                   (0 0 1 0)
;                                   (0 0 0 1))))

;; Translation Matrix: move an object by 10,10,0
;    (setq transMat (vlax-tmatrix '((1 0 0 10)
;                                   (0 1 0 10)
;                                   (0 0 1 0)
;                                   (0 0 0 1))))

;; Scaling Matrix: scale by 10,10 at point 0,0,0
;    (setq transMat (vlax-tmatrix '((10 0 0 0)
;                                   (0 10 0 0)
;                                   (0 0 10 0)
;                                   (0 0 0 1))))

;; Scaling Matrix: scale by 10 at point 2,2
;    (setq transMat (vlax-tmatrix '((10 0 0 -18)
;                                   (0 10 0 -18)
;                                   (0 0 10 0)
;                                   (0 0 0 1))))
)


TranslateCoordinates Method (ActiveX)

Translates a point from one coordinate system to another.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.TranslateCoordinates(Point, FromCoordSystem, ToCoordSystem, Displacement, [OCSNormal])
object

Type: Utility

The object this method applies to.

Point

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the original coordinates to be translated. This parameter can be treated as a point or a displacement vector depending on the value of Displacement.

FromCoordSystem

Access: Input-only

Type: AcCoordinateSystem enum

The coordinate system from which the point originates.

  • acWorld
  • acUCS
  • acOCS
  • acDisplayDCS
  • acPaperSpaceDCS
ToCoordSystem

Access: Input-only

Type: AcCoordinateSystem enum

The coordinate system to which the point will be converted.

  • acWorld
  • acUCS
  • acOCS
  • acDisplayDCS
  • acPaperSpaceDCS
Displacement

Access: Input-only

Type: Long

A displacement vector flag.

  • True: Point is treated as a displacement vector.
  • False: Point is treated as a point.
OCSNormal

Access: Input-only; optional

Type: Variant (three-element array of doubles)

The normal for the OCS.

Return Value (RetVal)

Type: Variant (three-element array of doubles)

The translated 3D coordinate.

Remarks

You cannot directly translate a coordinate from one OCS to another OCS. To do this, first translate the coordinate from one OCS to an intermediary coordinate system such as the WCS. Then translate that coordinate into the second OCS.

To translate a point on a Polyline or LWPolyline object from OCS to WCS:

  1. Get the X and Y coordinates of the OCS point from the Coordinate or Coordinates property.
  2. Get the Z coordinate of the OCS point from the Elevation property.
  3. Get the Normal for the polyline from the Normal property.
  4. Call TranslateCoordinates using the X, Y, Z coordinates and the Normal.

Examples

VBA:

Sub Example_TranslateCoordinates()
    ' This example creates a UCS with an origin at 2, 2, 2.
    ' Next, a point is entered by the user. The WCS and UCS
    ' coordinates of that point are output in a Msgbox.

    AppActivate ThisDrawing.Application.Caption

    ' Create a UCS named "New_UCS" in current drawing
    Dim ucsObj As AcadUCS
    Dim origin(0 To 2) As Double
    Dim xAxisPnt(0 To 2) As Double
    Dim yAxisPnt(0 To 2) As Double

    ' Define the UCS
    origin(0) = 2#: origin(1) = 2#: origin(2) = 2#
    xAxisPnt(0) = 5#: xAxisPnt(1) = 2#: xAxisPnt(2) = 2#
    yAxisPnt(0) = 2#: yAxisPnt(1) = 6#: yAxisPnt(2) = 2#

    ' Add the UCS to the UserCoordinatesSystems collection
    Set ucsObj = ThisDrawing.UserCoordinateSystems.Add(origin, xAxisPnt, yAxisPnt, "New_UCS")
    ThisDrawing.ActiveUCS = ucsObj

    ' Get the active viewport and make sure the UCS icon is on
    Dim viewportObj As AcadViewport
    Set viewportObj = ThisDrawing.ActiveViewport
    viewportObj.UCSIconOn = True
    viewportObj.UCSIconAtOrigin = True
    ThisDrawing.ActiveViewport = viewportObj

    ' Have the user enter a point
    Dim pointWCS As Variant
    pointWCS = ThisDrawing.Utility.GetPoint(, "Enter a point to translate:")

    ' Translate the point into UCS coordinates
    Dim pointUCS As Variant
    pointUCS = ThisDrawing.Utility.TranslateCoordinates(pointWCS, acWorld, acUCS, False)

    ' Display the coordinates of the point
    MsgBox "The point has the following coordinates:" & vbCrLf & _
           "WCS: " & pointWCS(0) & ", " & pointWCS(1) & ", " & pointWCS(2) & vbCrLf & _
           "UCS: " & pointUCS(0) & ", " & pointUCS(1) & ", " & pointUCS(2), , "TranslateCoordinates Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TranslateCoordinates()
    ;; This example creates a UCS with an origin at 2, 2, 2.
    ;; Next, a point is entered by the user. The WCS and UCS
    ;; coordinates of that point are output in a Msgbox.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create a UCS named "New_UCS" in current drawing
    ;; Define the UCS
    (setq origin (vlax-3d-point 2 2 2)
          xAxisPnt (vlax-3d-point 5 2 2)
          yAxisPnt (vlax-3d-point 2 6 2))

    ;; Add the UCS to the UserCoordinatesSystems collection
    (setq ucsObj (vla-Add (vla-get-UserCoordinateSystems doc) origin xAxisPnt yAxisPnt "New_UCS"))
    (vla-put-ActiveUCS doc ucsObj)

    ;; Get the active viewport and make sure the UCS icon is on
    (setq viewportObj (vla-get-ActiveViewport doc))
    (vla-put-UCSIconOn viewportObj :vlax-true)
    (vla-put-UCSIconAtOrigin viewportObj :vlax-true)
    (vla-put-ActiveViewport doc viewportObj)

    ;; Have the user enter a point
    (setq pointWCS (vlax-variant-value (vla-GetPoint (vla-get-Utility doc) nil "\nEnter a point to translate:")))

    ;; Translate the point into UCS coordinates
    (setq pointUCS (vlax-variant-value (vla-TranslateCoordinates (vla-get-Utility doc) pointWCS acWorld acUCS :vlax-false)))

    ;; Display the coordinates of the point
    (alert (strcat "The point has the following coordinates:"
                   "\nWCS: " (rtos (vlax-safearray-get-element pointWCS 0) 2) ", "
                             (rtos (vlax-safearray-get-element pointWCS 1) 2) ", "
                             (rtos (vlax-safearray-get-element pointWCS 2) 2)
                   "\nUCS: " (rtos (vlax-safearray-get-element pointUCS 0) 2) ", "
                             (rtos (vlax-safearray-get-element pointUCS 1) 2) ", "
                             (rtos (vlax-safearray-get-element pointUCS 2) 2)))
)


Unload Method (ActiveX)

Unloads the menu group or external reference.

Supported platforms: Windows only

Signature

VBA:

object.Unload
object

Type: ExternalReference, MenuGroup

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

ExternalReference: When an ExternalReference object (xref) is unloaded from the drawing, the drawing opens faster and uses less memory. An unloaded xref is not displayed and the xref-dependent symbol table information does not appear in the drawing. However, all the information can be restored by reloading the xref using the Reload method.

To unload an external reference, you must unload the block that defines the external reference. For example, the following line of VBA code unloads an external reference that is stored in the xrefInserted variable:

ThisDrawing.Blocks.Item(xrefInserted.name).Unload

MenuGroup: When a menu group is unloaded from the drawing, any references to the menus and toolbars within that group become invalid. Always delete or set to NULL any references to toolbars and menus that are in the menu group to be unloaded before you unload the menu group.

Examples

VBA:

Sub Example_Unload()
    On Error GoTo ERRORHANDLER

    ' Define external reference to be inserted
    Dim xrefHome As AcadBlock
    Dim xrefInserted As AcadExternalReference
    Dim insertionPnt(0 To 2) As Double
    Dim PathName As String
    insertionPnt(0) = 1
    insertionPnt(1) = 1
    insertionPnt(2) = 0
    PathName = "c:/AutoCAD/sample/City map.dwg"

    ' Add the external reference
    Set xrefInserted = ThisDrawing.ModelSpace. _
            AttachExternalReference(PathName, "XREF_IMAGE", _
            insertionPnt, 1, 1, 1, 0, False)
    ZoomAll
    MsgBox "The external reference is attached."

    ' Unload the external reference definition
    ThisDrawing.Blocks.Item(xrefInserted.name).Unload
    MsgBox "The external reference is unloaded."
    Exit Sub
ERRORHANDLER:
    MsgBox Err.Description
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Unload()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define external reference to be inserted
    (setq insertionPnt (vlax-3d-point 1 1 0)
          pathName (findfile ".\\Sample\\Sheet Sets\\Architectural\\Res\\STAIR1.dwg"))

    ;; Add the external reference to the block
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq xrefInserted (vla-AttachExternalReference modelSpace pathName "XREF_IMAGE" insertionPnt 1 1 1 0 :vlax-false))
    (vla-ZoomAll acadObj)
    (alert "The external reference is attached.")

    ;; Unload the external reference definition
    (vla-Unload (vla-Item (vla-get-Blocks doc) "XREF_IMAGE"))
    (vla-Regen doc :vlax-true)
    (alert "The external reference is unloaded.")

    ;; Reload the external reference definition
    (vla-Reload (vla-Item (vla-get-Blocks doc) "XREF_IMAGE"))
    (alert "The external reference is reloaded.")
)


UnloadARX Method (ActiveX)

Unloads the specified AutoCAD ARX application.

Supported platforms: Windows only

Signature

VBA:

object.UnloadARX Name
object

Type: Application

The object this method applies to.

Name

Access: Input-only

Type: String

The name of the application to unload.

Return Value (RetVal)

No return value.

Remarks

If the specified application is locked when this method is called, the method will fail.

NoteDo not attempt to unload the file acvba.arx.

Examples

VBA:

Sub Example_UnLoadARX()
    ' This example unloads an ObjectARX application from the AutoCAD session.

    ' Note: The application listed here does not exist and
    ' will cause an error when run. Change the application name
    ' to the name of your ObjectARX application.
    On Error GoTo ERRORHANDLER
    ThisDrawing.Application.UnloadArx "MyARXApp.arx"

ERRORHANDLER:
    MsgBox Err.Description, , "UnloadARX"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_UnloadARX()
    ;; This example unloads an ObjectARX application from the AutoCAD session.
    (setq acadObj (vlax-get-acad-object))

    ;; Note: The application listed here does not exist and
    ;; will cause an error when run. Change the application name
    ;; to the name of your ObjectARX application.
    (vla-UnloadArx acadObj "MyARXApp.arx")
)


UnloadDVB Method (ActiveX)

Unloads the specified AutoCAD VBA project file.

Supported platforms: Windows only

Signature

VBA:

object.UnloadDVB Name
object

Type: Application

The object this method applies to.

Name

Access: Input-only

Type: String

The name of the .dvb project to unload.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_LoadDVB()
    ' This example loads a DVB file and runs a macro
    ' contained in the file using the RunMacro method.
    '
    ' This example uses a DVB file named drawline.dvb.
    ' You should change the example to use a file on your computer.
    '
    ' * Note: If you open a DVB file and then run the example to load it, there will be an error
    ' when the DVB file is unloaded.

    Dim FileName As String

    FileName = "c:\drawline.dvb"

    ' Load a sample VBA project DVB file
    LoadDVB FileName

    ' Run the drawline sample macro
    RunMacro "Module1.Drawline"

    ' Unload the drawline VBA project DVB file now.
    UnloadDVB FileName

    MsgBox "The DVB file has been run!"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LoadDVB()
    ;; This example loads a DVB file and runs a macro
    ;; contained in the file using the RunMacro method.
    ;;
    ;; This example uses a DVB file named drawline.dvb.
    ;; You should change the example to use a file on your computer.
    ;;
    ;; * Note: If you open a DVB file and then run the example to load it, there will be an error
    ;; when the DVB file is unloaded.

    (setq FileName (findfile ".\\Sample\\VBA\\drawline.dvb"))

    ;; Load a sample VBA project DVB file
    (vla-LoadDVB acadObj FileName)

    ;; Run the drawline sample macro
    (vla-RunMacro acadObj "Module1.Drawline")

    ;; Unload the drawline VBA project DVB file now.
    (vla-UnloadDVB acadObj FileName)

    (alert "The DVB file has been run!")
)


UnmergeCells Method (ActiveX)

Splits merged cells in a table.

Supported platforms: Windows only

Signature

VBA:

object.UnmergeCells minRow, maxRow, minCol, maxCol
object

Type: Table

The object this method applies to.

minRow

Access: Input-only

Type: Long

The zero-based lower bound of a row index.

maxRow

Access: Input-only

Type: Long

The zero-based upper bound of a row index.

minCol

Access: Input-only

Type: Long

The zero-based lower bound of a column index.

maxCol

Access: Input-only

Type: Long

The zero-based upper bound of a column index.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_MergeCells()

    Dim MyModelSpace As AcadModelSpace
    Set MyModelSpace = ThisDrawing.ModelSpace
    Dim pt(2) As Double
    Dim MyTable As AcadTable
    Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30)
    Call MyTable.MergeCells(2, 3, 2, 3)

    MsgBox "The cells have been merged appropriately."

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MergeCells()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MyTable (vla-AddTable modelSpace pt 5 5 10 30))

    (vla-MergeCells MyTable 2 3 2 3)

    (alert "The cells have been merged appropriately.")

    (vla-ZoomExtents acadObj)
)


Update Method (ActiveX)

Updates the object to the drawing screen.

Supported platforms: Windows only

Signature

VBA:

object.Update
object

Type: All drawing objects, Application, AttributeReference, Dimension, SelectionSet

The objects this method applies to.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Update()
    ' This example creates a line in model space. It displays a
    ' Msgbox immediately before the call to update the line and
    ' again after the call.
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double

    ' Create a Line object in model space
    startPoint(0) = 2#: startPoint(1) = 2#: startPoint(2) = 0#
    endPoint(0) = 4#: endPoint(1) = 4#: endPoint(2) = 0#
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    MsgBox "Before the update.", , "Update Example"
    ' The following code draws an object in AutoCAD window
    lineObj.Update
    MsgBox "After the update.", , "Update Example"

    ' The following call updates the entire drawing
    ThisDrawing.Application.Update

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Update()
    ;; This example creates a line in model space. It displays a
    ;; Msgbox immediately before the call to update the line and
    ;; again after the call.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create a Line object in model space
    (setq startPoint (vlax-3d-point 2 2 0)
          endPoint (vlax-3d-point 4 4 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-ZoomAll acadObj)

    (alert "Before the update.")

    ;; The following code draws an object in AutoCAD window
    (vla-Update lineObj)
    (alert "After the update.")

    ;; The following call updates the entire drawing
    (vla-Update acadObj)
)


UpdateEntry Method (ActiveX)

Erases and then recreates an identified entry in the File Dependency List.

Supported platforms: Windows only

Signature

VBA:

object.UpdateEntry Index
object

Type: FileDependencies

The object this method applies to.

Index

Access: Input-only

Type: Long

Index of the entry in the File Dependency List.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_UpdateEntry()
    ' This example adds an entry to the File Dependency List, returns its Index, updates
    ' the entry, and then removes the entry.

    Dim objFDLCol As AutoCAD.AcadFileDependencies
    Dim objFDL As AutoCAD.AcadFileDependency

    Set objFDLCol = ThisDrawing.FileDependencies
    MsgBox "The number of entries in the File Dependency List is " & objFDLCol.Count & "."

    Dim FDLIndex As Long
    FDLIndex = objFDLCol.CreateEntry("acad:xref", "c:\referenced.dwg", True, True)
    MsgBox "The number of entries in the File Dependency List is " & objFDLCol.Count & "."

    Dim IndexNumber As Long
    IndexNumber = objFDLCol.IndexOf("acad:xref", "c:\referenced.dwg")
    Dim IndexString As String
    IndexString = CStr(IndexNumber)
    MsgBox "The index of the new entry is " & IndexString & "."

    objFDLCol.UpdateEntry FDLIndex

    objFDLCol.RemoveEntry FDLIndex, True
    MsgBox "The number of entries in the File Dependency List is " & objFDLCol.Count & "."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_UpdateEntry()
    ;; This example adds an entry to the File Dependency List, returns its Index, updates
    ;; the entry, and then removes the entry.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq objFDLCol (vla-get-FileDependencies doc))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))

    (setq FDLIndex (vla-CreateEntry objFDLCol "acad:xref" (findfile ".\\Sample\\Sheet Sets\\Architectural\\Res\\Wall Base.dwg") :vlax-true :vlax-true))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))

    (setq IndexNumber (vla-IndexOf objFDLCol "acad:xref" (findfile ".\\Sample\\Sheet Sets\\Architectural\\Res\\Wall Base.dwg")))
    (setq IndexString (itoa IndexNumber))
    (alert (strcat "The index of the new entry is " IndexString "."))

    (vla-UpdateEntry objFDLCol FDLIndex)

    (vla-RemoveEntry objFDLCol FDLIndex :vlax-true)
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))
)


UpdateMTextAttribute Method (ActiveX)

Updates attribute from the multiline text and multiline text from an attribute.

Supported platforms: Windows only

Signature

VBA:

object.UpdateMTextAttribute
object

Type: Attribute

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_MTextAttribute()
    ' This example creates an attribute definition in model space.
    ' It then manipulates its MText properties

    Dim attributeObj As IAcadAttribute
    Dim height As Double
    Dim mode As Long
    Dim prompt As String
    Dim insertionPoint(0 To 2) As Double
    Dim tag As String
    Dim value As String

    ' Define the attribute definition
    height = 1.4
    mode = acAttributeModeVerify
    prompt = "New Prompt"
    insertionPoint(0) = 5.2: insertionPoint(1) = 5.7: insertionPoint(2) = 0
    tag = "NEW_TAG"
    value = "New Value"

    ' Create the attribute definition object in model space
    Set attributeObj = ThisDrawing.ModelSpace.AddAttribute(height, mode, prompt, insertionPoint, tag, value)

    attributeObj.MTextAttribute = True
    attributeObj.MTextAttributeContent = "test content"
    attributeObj.MTextBoundaryWidth = 4.2
    attributeObj.UpdateMTextAttribute
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MTextAttribute()
    ;; This example creates an attribute definition in model space.
    ;; It then manipulates its MText properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the attribute definition
    (setq insertionPoint (vlax-3d-point 5.2 5.7 0)
          attHeight 1.4
          attMode (+ acAttributeModeVerify acAttributeModeMultipleLine)
          attPrompt "New Prompt"
          attTag "NEW_TAG"
          attValue "New Value")

    ;; Create the attribute definition object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq attributeObj (vla-AddAttribute modelSpace attHeight attMode attPrompt insertionPoint attTag attValue))

    (vla-put-MTextAttributeContent attributeObj "test content")
    (vla-put-MTextBoundaryWidth attributeObj 4.2)
    (vla-UpdateMTextAttribute attributeObj)
    (vla-ZoomAll acadObj)
)


WBlock Method (ActiveX)

Writes out the given selection set as a new drawing file.

Supported platforms: Windows only

Signature

VBA:

object.WBlock FileName, SelectionSet
object

Type: Document

The object this method applies to.

FileName

Access: Input-only

Type: String

The file name to write the selection set to.

SelectionSet

Access: Input-only

Type: SelectionSet

The name of the selection set.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_WBlock()
    ' This example creates several objects in model space and
    ' adds them to a selection set. This selection set is then
    ' output as a new drawing file.

    ' Create a Ray object in model space
    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)

    ' Create a polyline object in model space
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True

    ' Create a line object in model space
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ' Create a circle object in model space
    Dim circObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 20: centerPt(1) = 30: centerPt(2) = 0
    radius = 3
    Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)

    ' Create an ellipse object in model space
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    ZoomAll

    ' Create a selection set
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("WBLOCKSET")

    ' Iterate through the model space collection and add
    ' each item found to an array of objects
    ReDim objsInModelSpace(0 To ThisDrawing.ModelSpace.count - 1) As AcadEntity
    Dim I As Integer
    For I = 0 To ThisDrawing.ModelSpace.count - 1
        Set objsInModelSpace(I) = ThisDrawing.ModelSpace.Item(I)
    Next

    ' Add the array of objects into the selection set
    ssetObj.AddItems objsInModelSpace

    ' Output the selection set to a new file
    ThisDrawing.Wblock "C:\AutoCAD\WBlock_example.dwg", ssetObj

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_WBlock()
    ;; This example creates several objects in model space and
    ;; adds them to a selection set. This selection set is then
    ;; output as a new drawing file.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Create a Ray object in model space
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 1 3 0))
    (setq rayObj (vla-AddRay modelSpace basePoint secondPoint))

    ;; Create a polyline object in model space
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
                                  9 2
                                  3 5
                                 )
    )
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)

    ;; Create a line object in model space
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 2 2 0))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    ;; Create a circle object in model space
    (setq centerPt (vlax-3d-point 20 30 0)
          radius 3)
    (setq circObj (vla-AddCircle modelSpace centerPt radius))

    ;; Create an ellipse object in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

    (vla-ZoomAll acadObj)

    ;; Create a selection set
    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "WBLOCKSET"))

    ;; Iterate through the model space collection and add
    ;; each item found to an array of objects
    (setq objsInModelSpace (vlax-make-safearray vlax-vbObject (cons 0 (1- (vla-get-Count (vla-get-ModelSpace doc)))))
          cnt 0)
    (vlax-for entry (vla-get-ModelSpace doc)
        (vlax-safearray-put-element objsInModelSpace cnt entry)
        (setq cnt (1+ cnt))
    )

    ;; Add the array of objects into the selection set
    (vla-AddItems ssetObj objsInModelSpace)

    ;; Output the selection set to a new file
    (vla-Wblock doc "C:\\AutoCAD\\WBlock_example.dwg" ssetObj)

    (vla-Delete ssetObj)
)


ZoomAll Method (ActiveX)

Zooms the current viewport to display the entire drawing.

Supported platforms: Windows only

Signature

VBA:

object.ZoomAll
object

Type: Application

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

In a plan view, AutoCAD zooms to the drawing limits or current extents, whichever is greater. In a 3D view, ZoomAll is equivalent to the ZoomExtents method. The display shows all objects even if the drawing extends outside the drawing limits.

This method applies only to the current active viewport (paper space viewport or model space viewport).

Examples

VBA:

Sub Example_ZoomAll()
    ' This example creates several objects in model space and
    ' then performs a variety of zooms on the drawing.

    AppActivate ThisDrawing.Application.Caption

    ' Create a Ray object in model space
    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)

    ' Create a polyline object in model space
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True

    ' Create a line object in model space
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ' Create a circle object in model space
    Dim circObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 20: centerPt(1) = 30: centerPt(2) = 0
    radius = 3
    Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)

    ' Create an ellipse object in model space
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

' ZoomAll
    MsgBox "Perform a ZoomAll", , "ZoomWindow Example"
    ZoomAll

' ZoomWindow
    MsgBox "Perform a ZoomWindow using the following coordinates:" & vbCrLf & _
           "1.3, 7.8, 0" & vbCrLf & _
           "13.7, -2.6, 0", , "ZoomWindow Example"

    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    point1(0) = 1.3: point1(1) = 7.8: point1(2) = 0
    point2(0) = 13.7: point2(1) = -2.6: point2(2) = 0
    ZoomWindow point1, point2

' ZoomScaled
    MsgBox "Perform a ZoomScaled using:" & vbCrLf & _
           "Scale Type: acZoomScaledRelative" & vbCrLf & _
           "Scale Factor: 2", , "ZoomWindow Example"
    Dim scalefactor As Double
    Dim scaletype As Integer
    scalefactor = 2
    scaletype = acZoomScaledRelative
    ZoomScaled scalefactor, scaletype

' ZoomExtents
    MsgBox "Perform a ZoomExtents", , "ZoomWindow Example"
    ZoomExtents

' ZoomPickWindow
    MsgBox "Perform a ZoomPickWindow", , "ZoomWindow Example"
    ZoomPickWindow

' ZoomCenter
    MsgBox "Perform a ZoomCenter using:" & vbCrLf & _
           "Center 3, 3, 0" & vbCrLf & _
           "Magnification: 10", , "ZoomWindow Example"
    Dim zcenter(0 To 2) As Double
    Dim magnification As Double
    zcenter(0) = 3: zcenter(1) = 3: zcenter(2) = 0
    magnification = 10
    zoomcenter zcenter, magnification

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ZoomAll()
    ;; This example creates several objects in model space and
    ;; then performs a variety of zooms on the drawing.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Create a Ray object in model space
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 1 3 0))
    (setq rayObj (vla-AddRay modelSpace basePoint secondPoint))

    ;; Create a polyline object in model space
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
                                  9 2
                                  3 5
                                 )
    )
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)

    ;; Create a line object in model space
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 2 2 0))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    ;; Create a circle object in model space
    (setq centerPt (vlax-3d-point 20 30 0)
          radius 3)
    (setq circObj (vla-AddCircle modelSpace centerPt radius))

    ;; Create an ellipse object in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

;; ZoomAll
    (alert "Perform a ZoomAll")
    (vla-ZoomAll acadObj)

;; ZoomWindow
    (alert (Strcat "Perform a ZoomWindow using the following coordinates:"
                   "\n1.3, 7.8, 0"
                   "\n13.7, -2.6, 0"))

    (setq point1 (vlax-3d-point 1.3 7.8 0)
          point2 (vlax-3d-point 13.7 -2.6 0))
    (vla-ZoomWindow acadObj point1 point2)

;; ZoomScaled
    (alert (strcat "Perform a ZoomScaled using:"
                   "\nScale Type: acZoomScaledRelative"
                   "\nScale Factor: 2"))
    (setq scalefactor 2
          scaletype acZoomScaledRelative)
    (vla-ZoomScaled acadObj scalefactor scaletype)

;; ZoomExtents
    (alert "Perform a ZoomExtents")
    (vla-ZoomExtents acadObj)

;; ZoomPickWindow
    (alert "Perform a ZoomPickWindow")
    (vla-ZoomPickWindow acadObj)

;; ZoomPrevious
    (alert "Perform a ZoomPrevious")
    (vla-ZoomPrevious acadObj)

;; ZoomCenter
    (alert (strcat "Perform a ZoomCenter using:"
                   "\nCenter 3, 3, 0"
                   "\nMagnification: 10"))

    (setq zcenter (vlax-3d-point 3 3 0)
          magnification 10)
    (vla-ZoomCenter acadObj zcenter magnification)
)


ZoomCenter Method (ActiveX)

Zooms the current viewport to a specified center point and magnification.

Supported platforms: Windows only

Signature

VBA:

object.ZoomCenter Center, Magnify
object

Type: Application

The object this method applies to.

Center

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the center of the zoom.

Magnify

Access: Input-only

Type: Double

The magnification level of the window. A value smaller than the current value increases the magnification. A larger value decreases the magnification.

Return Value (RetVal)

No return value.

Remarks

This method applies only to the current active viewport (paper space viewport or model space viewport).

Examples

VBA:

Sub Example_ZoomAll()
    ' This example creates several objects in model space and
    ' then performs a variety of zooms on the drawing.

    AppActivate ThisDrawing.Application.Caption

    ' Create a Ray object in model space
    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)

    ' Create a polyline object in model space
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True

    ' Create a line object in model space
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ' Create a circle object in model space
    Dim circObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 20: centerPt(1) = 30: centerPt(2) = 0
    radius = 3
    Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)

    ' Create an ellipse object in model space
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

' ZoomAll
    MsgBox "Perform a ZoomAll", , "ZoomWindow Example"
    ZoomAll

' ZoomWindow
    MsgBox "Perform a ZoomWindow using the following coordinates:" & vbCrLf & _
           "1.3, 7.8, 0" & vbCrLf & _
           "13.7, -2.6, 0", , "ZoomWindow Example"

    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    point1(0) = 1.3: point1(1) = 7.8: point1(2) = 0
    point2(0) = 13.7: point2(1) = -2.6: point2(2) = 0
    ZoomWindow point1, point2

' ZoomScaled
    MsgBox "Perform a ZoomScaled using:" & vbCrLf & _
           "Scale Type: acZoomScaledRelative" & vbCrLf & _
           "Scale Factor: 2", , "ZoomWindow Example"
    Dim scalefactor As Double
    Dim scaletype As Integer
    scalefactor = 2
    scaletype = acZoomScaledRelative
    ZoomScaled scalefactor, scaletype

' ZoomExtents
    MsgBox "Perform a ZoomExtents", , "ZoomWindow Example"
    ZoomExtents

' ZoomPickWindow
    MsgBox "Perform a ZoomPickWindow", , "ZoomWindow Example"
    ZoomPickWindow

' ZoomCenter
    MsgBox "Perform a ZoomCenter using:" & vbCrLf & _
           "Center 3, 3, 0" & vbCrLf & _
           "Magnification: 10", , "ZoomWindow Example"
    Dim zcenter(0 To 2) As Double
    Dim magnification As Double
    zcenter(0) = 3: zcenter(1) = 3: zcenter(2) = 0
    magnification = 10
    zoomcenter zcenter, magnification

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ZoomAll()
    ;; This example creates several objects in model space and
    ;; then performs a variety of zooms on the drawing.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Create a Ray object in model space
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 1 3 0))
    (setq rayObj (vla-AddRay modelSpace basePoint secondPoint))

    ;; Create a polyline object in model space
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
                                  9 2
                                  3 5
                                 )
    )
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)

    ;; Create a line object in model space
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 2 2 0))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    ;; Create a circle object in model space
    (setq centerPt (vlax-3d-point 20 30 0)
          radius 3)
    (setq circObj (vla-AddCircle modelSpace centerPt radius))

    ;; Create an ellipse object in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

;; ZoomAll
    (alert "Perform a ZoomAll")
    (vla-ZoomAll acadObj)

;; ZoomWindow
    (alert (Strcat "Perform a ZoomWindow using the following coordinates:"
                   "\n1.3, 7.8, 0"
                   "\n13.7, -2.6, 0"))

    (setq point1 (vlax-3d-point 1.3 7.8 0)
          point2 (vlax-3d-point 13.7 -2.6 0))
    (vla-ZoomWindow acadObj point1 point2)

;; ZoomScaled
    (alert (strcat "Perform a ZoomScaled using:"
                   "\nScale Type: acZoomScaledRelative"
                   "\nScale Factor: 2"))
    (setq scalefactor 2
          scaletype acZoomScaledRelative)
    (vla-ZoomScaled acadObj scalefactor scaletype)

;; ZoomExtents
    (alert "Perform a ZoomExtents")
    (vla-ZoomExtents acadObj)

;; ZoomPickWindow
    (alert "Perform a ZoomPickWindow")
    (vla-ZoomPickWindow acadObj)

;; ZoomPrevious
    (alert "Perform a ZoomPrevious")
    (vla-ZoomPrevious acadObj)

;; ZoomCenter
    (alert (strcat "Perform a ZoomCenter using:"
                   "\nCenter 3, 3, 0"
                   "\nMagnification: 10"))

    (setq zcenter (vlax-3d-point 3 3 0)
          magnification 10)
    (vla-ZoomCenter acadObj zcenter magnification)
)


ZoomExtents Method (ActiveX)

Zooms the current viewport to the drawing extents.

Supported platforms: Windows only

Signature

VBA:

object.ZoomExtents
object

Type: Application

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

This method applies only to the current active viewport (paper space viewport or model space viewport).

Examples

VBA:

Sub Example_ZoomAll()
    ' This example creates several objects in model space and
    ' then performs a variety of zooms on the drawing.

    AppActivate ThisDrawing.Application.Caption

    ' Create a Ray object in model space
    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)

    ' Create a polyline object in model space
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True

    ' Create a line object in model space
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ' Create a circle object in model space
    Dim circObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 20: centerPt(1) = 30: centerPt(2) = 0
    radius = 3
    Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)

    ' Create an ellipse object in model space
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

' ZoomAll
    MsgBox "Perform a ZoomAll", , "ZoomWindow Example"
    ZoomAll

' ZoomWindow
    MsgBox "Perform a ZoomWindow using the following coordinates:" & vbCrLf & _
           "1.3, 7.8, 0" & vbCrLf & _
           "13.7, -2.6, 0", , "ZoomWindow Example"

    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    point1(0) = 1.3: point1(1) = 7.8: point1(2) = 0
    point2(0) = 13.7: point2(1) = -2.6: point2(2) = 0
    ZoomWindow point1, point2

' ZoomScaled
    MsgBox "Perform a ZoomScaled using:" & vbCrLf & _
           "Scale Type: acZoomScaledRelative" & vbCrLf & _
           "Scale Factor: 2", , "ZoomWindow Example"
    Dim scalefactor As Double
    Dim scaletype As Integer
    scalefactor = 2
    scaletype = acZoomScaledRelative
    ZoomScaled scalefactor, scaletype

' ZoomExtents
    MsgBox "Perform a ZoomExtents", , "ZoomWindow Example"
    ZoomExtents

' ZoomPickWindow
    MsgBox "Perform a ZoomPickWindow", , "ZoomWindow Example"
    ZoomPickWindow

' ZoomCenter
    MsgBox "Perform a ZoomCenter using:" & vbCrLf & _
           "Center 3, 3, 0" & vbCrLf & _
           "Magnification: 10", , "ZoomWindow Example"
    Dim zcenter(0 To 2) As Double
    Dim magnification As Double
    zcenter(0) = 3: zcenter(1) = 3: zcenter(2) = 0
    magnification = 10
    zoomcenter zcenter, magnification

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ZoomAll()
    ;; This example creates several objects in model space and
    ;; then performs a variety of zooms on the drawing.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Create a Ray object in model space
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 1 3 0))
    (setq rayObj (vla-AddRay modelSpace basePoint secondPoint))

    ;; Create a polyline object in model space
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
                                  9 2
                                  3 5
                                 )
    )
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)

    ;; Create a line object in model space
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 2 2 0))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    ;; Create a circle object in model space
    (setq centerPt (vlax-3d-point 20 30 0)
          radius 3)
    (setq circObj (vla-AddCircle modelSpace centerPt radius))

    ;; Create an ellipse object in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

;; ZoomAll
    (alert "Perform a ZoomAll")
    (vla-ZoomAll acadObj)

;; ZoomWindow
    (alert (Strcat "Perform a ZoomWindow using the following coordinates:"
                   "\n1.3, 7.8, 0"
                   "\n13.7, -2.6, 0"))

    (setq point1 (vlax-3d-point 1.3 7.8 0)
          point2 (vlax-3d-point 13.7 -2.6 0))
    (vla-ZoomWindow acadObj point1 point2)

;; ZoomScaled
    (alert (strcat "Perform a ZoomScaled using:"
                   "\nScale Type: acZoomScaledRelative"
                   "\nScale Factor: 2"))
    (setq scalefactor 2
          scaletype acZoomScaledRelative)
    (vla-ZoomScaled acadObj scalefactor scaletype)

;; ZoomExtents
    (alert "Perform a ZoomExtents")
    (vla-ZoomExtents acadObj)

;; ZoomPickWindow
    (alert "Perform a ZoomPickWindow")
    (vla-ZoomPickWindow acadObj)

;; ZoomPrevious
    (alert "Perform a ZoomPrevious")
    (vla-ZoomPrevious acadObj)

;; ZoomCenter
    (alert (strcat "Perform a ZoomCenter using:"
                   "\nCenter 3, 3, 0"
                   "\nMagnification: 10"))

    (setq zcenter (vlax-3d-point 3 3 0)
          magnification 10)
    (vla-ZoomCenter acadObj zcenter magnification)
)


ZoomPickWindow Method (ActiveX)

Zooms the current viewport to a window defined by points picked on the screen.

Supported platforms: Windows only

Signature

VBA:

object.ZoomPickWindow
object

Type: Application

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

This method applies only to the current active viewport (paper space viewport or model space viewport).

Examples

VBA:

Sub Example_ZoomAll()
    ' This example creates several objects in model space and
    ' then performs a variety of zooms on the drawing.

    AppActivate ThisDrawing.Application.Caption

    ' Create a Ray object in model space
    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)

    ' Create a polyline object in model space
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True

    ' Create a line object in model space
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ' Create a circle object in model space
    Dim circObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 20: centerPt(1) = 30: centerPt(2) = 0
    radius = 3
    Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)

    ' Create an ellipse object in model space
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

' ZoomAll
    MsgBox "Perform a ZoomAll", , "ZoomWindow Example"
    ZoomAll

' ZoomWindow
    MsgBox "Perform a ZoomWindow using the following coordinates:" & vbCrLf & _
           "1.3, 7.8, 0" & vbCrLf & _
           "13.7, -2.6, 0", , "ZoomWindow Example"

    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    point1(0) = 1.3: point1(1) = 7.8: point1(2) = 0
    point2(0) = 13.7: point2(1) = -2.6: point2(2) = 0
    ZoomWindow point1, point2

' ZoomScaled
    MsgBox "Perform a ZoomScaled using:" & vbCrLf & _
           "Scale Type: acZoomScaledRelative" & vbCrLf & _
           "Scale Factor: 2", , "ZoomWindow Example"
    Dim scalefactor As Double
    Dim scaletype As Integer
    scalefactor = 2
    scaletype = acZoomScaledRelative
    ZoomScaled scalefactor, scaletype

' ZoomExtents
    MsgBox "Perform a ZoomExtents", , "ZoomWindow Example"
    ZoomExtents

' ZoomPickWindow
    MsgBox "Perform a ZoomPickWindow", , "ZoomWindow Example"
    ZoomPickWindow

' ZoomCenter
    MsgBox "Perform a ZoomCenter using:" & vbCrLf & _
           "Center 3, 3, 0" & vbCrLf & _
           "Magnification: 10", , "ZoomWindow Example"
    Dim zcenter(0 To 2) As Double
    Dim magnification As Double
    zcenter(0) = 3: zcenter(1) = 3: zcenter(2) = 0
    magnification = 10
    zoomcenter zcenter, magnification

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ZoomAll()
    ;; This example creates several objects in model space and
    ;; then performs a variety of zooms on the drawing.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Create a Ray object in model space
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 1 3 0))
    (setq rayObj (vla-AddRay modelSpace basePoint secondPoint))

    ;; Create a polyline object in model space
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
                                  9 2
                                  3 5
                                 )
    )
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)

    ;; Create a line object in model space
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 2 2 0))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    ;; Create a circle object in model space
    (setq centerPt (vlax-3d-point 20 30 0)
          radius 3)
    (setq circObj (vla-AddCircle modelSpace centerPt radius))

    ;; Create an ellipse object in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

;; ZoomAll
    (alert "Perform a ZoomAll")
    (vla-ZoomAll acadObj)

;; ZoomWindow
    (alert (Strcat "Perform a ZoomWindow using the following coordinates:"
                   "\n1.3, 7.8, 0"
                   "\n13.7, -2.6, 0"))

    (setq point1 (vlax-3d-point 1.3 7.8 0)
          point2 (vlax-3d-point 13.7 -2.6 0))
    (vla-ZoomWindow acadObj point1 point2)

;; ZoomScaled
    (alert (strcat "Perform a ZoomScaled using:"
                   "\nScale Type: acZoomScaledRelative"
                   "\nScale Factor: 2"))
    (setq scalefactor 2
          scaletype acZoomScaledRelative)
    (vla-ZoomScaled acadObj scalefactor scaletype)

;; ZoomExtents
    (alert "Perform a ZoomExtents")
    (vla-ZoomExtents acadObj)

;; ZoomPickWindow
    (alert "Perform a ZoomPickWindow")
    (vla-ZoomPickWindow acadObj)

;; ZoomPrevious
    (alert "Perform a ZoomPrevious")
    (vla-ZoomPrevious acadObj)

;; ZoomCenter
    (alert (strcat "Perform a ZoomCenter using:"
                   "\nCenter 3, 3, 0"
                   "\nMagnification: 10"))

    (setq zcenter (vlax-3d-point 3 3 0)
          magnification 10)
    (vla-ZoomCenter acadObj zcenter magnification)
)


ZoomPrevious Method (ActiveX)

Zooms the current viewport to its previous extents.

Supported platforms: Windows only

Signature

VBA:

object.ZoomPrevious
object

Type: Application

The object this method applies to.

Return Value (RetVal)

No return value.

Remarks

This method applies only to the current active viewport (paper space viewport or model space viewport).

This method zooms to display the previous view. You can restore up to 10 previous views.

NoteIf you change the shading with the AutoCAD SHADEMODE command, the view is changed. If you perform a ZoomPrevious after changing the shading, it restores the previous view, which is shaded differently, but not zoomed differently.

Examples

VBA:

Sub Example_ZoomAll()
    ' This example creates several objects in model space and
    ' then performs a variety of zooms on the drawing.

    AppActivate ThisDrawing.Application.Caption

    ' Create a Ray object in model space
    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)

    ' Create a polyline object in model space
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True

    ' Create a line object in model space
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ' Create a circle object in model space
    Dim circObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 20: centerPt(1) = 30: centerPt(2) = 0
    radius = 3
    Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)

    ' Create an ellipse object in model space
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

' ZoomAll
    MsgBox "Perform a ZoomAll", , "ZoomWindow Example"
    ZoomAll

' ZoomWindow
    MsgBox "Perform a ZoomWindow using the following coordinates:" & vbCrLf & _
           "1.3, 7.8, 0" & vbCrLf & _
           "13.7, -2.6, 0", , "ZoomWindow Example"

    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    point1(0) = 1.3: point1(1) = 7.8: point1(2) = 0
    point2(0) = 13.7: point2(1) = -2.6: point2(2) = 0
    ZoomWindow point1, point2

' ZoomScaled
    MsgBox "Perform a ZoomScaled using:" & vbCrLf & _
           "Scale Type: acZoomScaledRelative" & vbCrLf & _
           "Scale Factor: 2", , "ZoomWindow Example"
    Dim scalefactor As Double
    Dim scaletype As Integer
    scalefactor = 2
    scaletype = acZoomScaledRelative
    ZoomScaled scalefactor, scaletype

' ZoomExtents
    MsgBox "Perform a ZoomExtents", , "ZoomWindow Example"
    ZoomExtents

' ZoomPickWindow
    MsgBox "Perform a ZoomPickWindow", , "ZoomWindow Example"
    ZoomPickWindow

' ZoomCenter
    MsgBox "Perform a ZoomCenter using:" & vbCrLf & _
           "Center 3, 3, 0" & vbCrLf & _
           "Magnification: 10", , "ZoomWindow Example"
    Dim zcenter(0 To 2) As Double
    Dim magnification As Double
    zcenter(0) = 3: zcenter(1) = 3: zcenter(2) = 0
    magnification = 10
    zoomcenter zcenter, magnification

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ZoomAll()
    ;; This example creates several objects in model space and
    ;; then performs a variety of zooms on the drawing.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Create a Ray object in model space
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 1 3 0))
    (setq rayObj (vla-AddRay modelSpace basePoint secondPoint))

    ;; Create a polyline object in model space
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
                                  9 2
                                  3 5
                                 )
    )
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)

    ;; Create a line object in model space
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 2 2 0))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    ;; Create a circle object in model space
    (setq centerPt (vlax-3d-point 20 30 0)
          radius 3)
    (setq circObj (vla-AddCircle modelSpace centerPt radius))

    ;; Create an ellipse object in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

;; ZoomAll
    (alert "Perform a ZoomAll")
    (vla-ZoomAll acadObj)

;; ZoomWindow
    (alert (Strcat "Perform a ZoomWindow using the following coordinates:"
                   "\n1.3, 7.8, 0"
                   "\n13.7, -2.6, 0"))

    (setq point1 (vlax-3d-point 1.3 7.8 0)
          point2 (vlax-3d-point 13.7 -2.6 0))
    (vla-ZoomWindow acadObj point1 point2)

;; ZoomScaled
    (alert (strcat "Perform a ZoomScaled using:"
                   "\nScale Type: acZoomScaledRelative"
                   "\nScale Factor: 2"))
    (setq scalefactor 2
          scaletype acZoomScaledRelative)
    (vla-ZoomScaled acadObj scalefactor scaletype)

;; ZoomExtents
    (alert "Perform a ZoomExtents")
    (vla-ZoomExtents acadObj)

;; ZoomPickWindow
    (alert "Perform a ZoomPickWindow")
    (vla-ZoomPickWindow acadObj)

;; ZoomPrevious
    (alert "Perform a ZoomPrevious")
    (vla-ZoomPrevious acadObj)

;; ZoomCenter
    (alert (strcat "Perform a ZoomCenter using:"
                   "\nCenter 3, 3, 0"
                   "\nMagnification: 10"))

    (setq zcenter (vlax-3d-point 3 3 0)
          magnification 10)
    (vla-ZoomCenter acadObj zcenter magnification)
)


ZoomScaled Method (ActiveX)

Zooms the current viewport to given scale factor.

Supported platforms: Windows only

Signature

VBA:

object.ZoomScaled Scale, ScaleType
object

Type: Application

The object this method applies to.

Scale

Access: Input-only

Type: Double

The zoom factor for the zoom.

ScaleType

Access: Input-only; optional

Type: AcZoomScaleType enum

  • acZoomScaledAbsolute: Relative to the drawing limits.
  • acZoomScaledRelative: Relative to the current view.
  • acZoomScaledRelativePSpace: Relative to paper space units.

Return Value (RetVal)

No return value.

Remarks

This method applies to the current active viewport (paper space viewport or model space viewport).

Examples

VBA:

Sub Example_ZoomAll()
    ' This example creates several objects in model space and
    ' then performs a variety of zooms on the drawing.

    AppActivate ThisDrawing.Application.Caption

    ' Create a Ray object in model space
    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)

    ' Create a polyline object in model space
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True

    ' Create a line object in model space
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ' Create a circle object in model space
    Dim circObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 20: centerPt(1) = 30: centerPt(2) = 0
    radius = 3
    Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)

    ' Create an ellipse object in model space
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

' ZoomAll
    MsgBox "Perform a ZoomAll", , "ZoomWindow Example"
    ZoomAll

' ZoomWindow
    MsgBox "Perform a ZoomWindow using the following coordinates:" & vbCrLf & _
           "1.3, 7.8, 0" & vbCrLf & _
           "13.7, -2.6, 0", , "ZoomWindow Example"

    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    point1(0) = 1.3: point1(1) = 7.8: point1(2) = 0
    point2(0) = 13.7: point2(1) = -2.6: point2(2) = 0
    ZoomWindow point1, point2

' ZoomScaled
    MsgBox "Perform a ZoomScaled using:" & vbCrLf & _
           "Scale Type: acZoomScaledRelative" & vbCrLf & _
           "Scale Factor: 2", , "ZoomWindow Example"
    Dim scalefactor As Double
    Dim scaletype As Integer
    scalefactor = 2
    scaletype = acZoomScaledRelative
    ZoomScaled scalefactor, scaletype

' ZoomExtents
    MsgBox "Perform a ZoomExtents", , "ZoomWindow Example"
    ZoomExtents

' ZoomPickWindow
    MsgBox "Perform a ZoomPickWindow", , "ZoomWindow Example"
    ZoomPickWindow

' ZoomCenter
    MsgBox "Perform a ZoomCenter using:" & vbCrLf & _
           "Center 3, 3, 0" & vbCrLf & _
           "Magnification: 10", , "ZoomWindow Example"
    Dim zcenter(0 To 2) As Double
    Dim magnification As Double
    zcenter(0) = 3: zcenter(1) = 3: zcenter(2) = 0
    magnification = 10
    zoomcenter zcenter, magnification

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ZoomAll()
    ;; This example creates several objects in model space and
    ;; then performs a variety of zooms on the drawing.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Create a Ray object in model space
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 1 3 0))
    (setq rayObj (vla-AddRay modelSpace basePoint secondPoint))

    ;; Create a polyline object in model space
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
                                  9 2
                                  3 5
                                 )
    )
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)

    ;; Create a line object in model space
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 2 2 0))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    ;; Create a circle object in model space
    (setq centerPt (vlax-3d-point 20 30 0)
          radius 3)
    (setq circObj (vla-AddCircle modelSpace centerPt radius))

    ;; Create an ellipse object in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

;; ZoomAll
    (alert "Perform a ZoomAll")
    (vla-ZoomAll acadObj)

;; ZoomWindow
    (alert (Strcat "Perform a ZoomWindow using the following coordinates:"
                   "\n1.3, 7.8, 0"
                   "\n13.7, -2.6, 0"))

    (setq point1 (vlax-3d-point 1.3 7.8 0)
          point2 (vlax-3d-point 13.7 -2.6 0))
    (vla-ZoomWindow acadObj point1 point2)

;; ZoomScaled
    (alert (strcat "Perform a ZoomScaled using:"
                   "\nScale Type: acZoomScaledRelative"
                   "\nScale Factor: 2"))
    (setq scalefactor 2
          scaletype acZoomScaledRelative)
    (vla-ZoomScaled acadObj scalefactor scaletype)

;; ZoomExtents
    (alert "Perform a ZoomExtents")
    (vla-ZoomExtents acadObj)

;; ZoomPickWindow
    (alert "Perform a ZoomPickWindow")
    (vla-ZoomPickWindow acadObj)

;; ZoomPrevious
    (alert "Perform a ZoomPrevious")
    (vla-ZoomPrevious acadObj)

;; ZoomCenter
    (alert (strcat "Perform a ZoomCenter using:"
                   "\nCenter 3, 3, 0"
                   "\nMagnification: 10"))

    (setq zcenter (vlax-3d-point 3 3 0)
          magnification 10)
    (vla-ZoomCenter acadObj zcenter magnification)
)


ZoomWindow Method (ActiveX)

Zooms the current viewport to the area specified by two opposite corners of a rectangle.

Supported platforms: Windows only

Signature

VBA:

object.ZoomWindow LowerLeft, UpperRight
object

Type: Application

The object this method applies to.

LowerLeft

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the lower-left corner of the window to display.

UpperRight

Access: Input-only

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying the upper-right corner of the window to display.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ZoomAll()
    ' This example creates several objects in model space and
    ' then performs a variety of zooms on the drawing.

    AppActivate ThisDrawing.Application.Caption

    ' Create a Ray object in model space
    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)

    ' Create a polyline object in model space
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True

    ' Create a line object in model space
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ' Create a circle object in model space
    Dim circObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 20: centerPt(1) = 30: centerPt(2) = 0
    radius = 3
    Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)

    ' Create an ellipse object in model space
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

' ZoomAll
    MsgBox "Perform a ZoomAll", , "ZoomWindow Example"
    ZoomAll

' ZoomWindow
    MsgBox "Perform a ZoomWindow using the following coordinates:" & vbCrLf & _
           "1.3, 7.8, 0" & vbCrLf & _
           "13.7, -2.6, 0", , "ZoomWindow Example"

    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    point1(0) = 1.3: point1(1) = 7.8: point1(2) = 0
    point2(0) = 13.7: point2(1) = -2.6: point2(2) = 0
    ZoomWindow point1, point2

' ZoomScaled
    MsgBox "Perform a ZoomScaled using:" & vbCrLf & _
           "Scale Type: acZoomScaledRelative" & vbCrLf & _
           "Scale Factor: 2", , "ZoomWindow Example"
    Dim scalefactor As Double
    Dim scaletype As Integer
    scalefactor = 2
    scaletype = acZoomScaledRelative
    ZoomScaled scalefactor, scaletype

' ZoomExtents
    MsgBox "Perform a ZoomExtents", , "ZoomWindow Example"
    ZoomExtents

' ZoomPickWindow
    MsgBox "Perform a ZoomPickWindow", , "ZoomWindow Example"
    ZoomPickWindow

' ZoomCenter
    MsgBox "Perform a ZoomCenter using:" & vbCrLf & _
           "Center 3, 3, 0" & vbCrLf & _
           "Magnification: 10", , "ZoomWindow Example"
    Dim zcenter(0 To 2) As Double
    Dim magnification As Double
    zcenter(0) = 3: zcenter(1) = 3: zcenter(2) = 0
    magnification = 10
    zoomcenter zcenter, magnification

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ZoomAll()
    ;; This example creates several objects in model space and
    ;; then performs a variety of zooms on the drawing.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Create a Ray object in model space
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 1 3 0))
    (setq rayObj (vla-AddRay modelSpace basePoint secondPoint))

    ;; Create a polyline object in model space
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
                                  9 2
                                  3 5
                                 )
    )
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)

    ;; Create a line object in model space
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 2 2 0))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    ;; Create a circle object in model space
    (setq centerPt (vlax-3d-point 20 30 0)
          radius 3)
    (setq circObj (vla-AddCircle modelSpace centerPt radius))

    ;; Create an ellipse object in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

;; ZoomAll
    (alert "Perform a ZoomAll")
    (vla-ZoomAll acadObj)

;; ZoomWindow
    (alert (Strcat "Perform a ZoomWindow using the following coordinates:"
                   "\n1.3, 7.8, 0"
                   "\n13.7, -2.6, 0"))

    (setq point1 (vlax-3d-point 1.3 7.8 0)
          point2 (vlax-3d-point 13.7 -2.6 0))
    (vla-ZoomWindow acadObj point1 point2)

;; ZoomScaled
    (alert (strcat "Perform a ZoomScaled using:"
                   "\nScale Type: acZoomScaledRelative"
                   "\nScale Factor: 2"))
    (setq scalefactor 2
          scaletype acZoomScaledRelative)
    (vla-ZoomScaled acadObj scalefactor scaletype)

;; ZoomExtents
    (alert "Perform a ZoomExtents")
    (vla-ZoomExtents acadObj)

;; ZoomPickWindow
    (alert "Perform a ZoomPickWindow")
    (vla-ZoomPickWindow acadObj)

;; ZoomPrevious
    (alert "Perform a ZoomPrevious")
    (vla-ZoomPrevious acadObj)

;; ZoomCenter
    (alert (strcat "Perform a ZoomCenter using:"
                   "\nCenter 3, 3, 0"
                   "\nMagnification: 10"))

    (setq zcenter (vlax-3d-point 3 3 0)
          magnification 10)
    (vla-ZoomCenter acadObj zcenter magnification)
)


Properties

Topics in this section

  • Action

    Specifies the security-related operations to be performed on a drawing.

  • Active

    Determines if the document is the active document for the session.

  • ActiveDimStyle

    Specifies the active dimension style.

  • ActiveDocument

    Specifies the active document (drawing file).

  • ActiveInvProject

    Specifies the active Inventor project being used by the Model Documentation feature. (Internal Use Only)

  • ActiveLayer

    Specifies the active layer.

  • ActiveLayout

    Specifies the active layout.

  • ActiveLinetype

    Specifies the active linetype for the drawing.

  • ActiveMaterial

    Specifies the current default material for this document.

  • ActiveProfile

    Specifies the active profile for the AutoCAD session.

  • ActivePViewport

    Specifies the active paper space viewport for the drawing.

  • ActiveSelectionSet

    Gets the active selection set for the drawing.

  • ActiveSpace

    Toggles the active space between paper space and model space.

  • ActiveTextStyle

    Specifies the active text style for the drawing.

  • ActiveUCS

    Specifies the active UCS for the drawing.

  • ActiveViewport

    Specifies the active viewport for the drawing.

  • ADCInsertUnitsDefaultSource

    Determines the units to use automatically for objects in DesignCenter for a source drawing that does not have assigned insert units.

  • ADCInsertUnitsDefaultTarget

    Determines the units to use automatically for objects in DesignCenter for a target drawing that does not have assigned insert units.

  • AdjustForBackground

    Determines whether the underlay colors are adjusted for the current background color.

  • AffectsGraphics

    Specifies that the entry in the File Dependency List affects graphics.

  • Algorithm

    Specifies the identifier of the encryption algorithm.

  • Alignment

    Specifies both the vertical and horizontal alignments for the attribute, attribute reference, or text.

  • AlignmentPointAcquisition

    Specifies how AutoAlignment points are acquired.

  • AlignSpace

    Specifies the AlignSpace of the mleaderstyle.

  • AllowedValues

    Specifies the allowed values for the property.

  • AllowLongSymbolNames

    Determines if symbol names may include extended character sets, or more than 31 characters.

  • AllowManualHeights

    Toggles the manual heights in a table.

  • AllowManualPositions

    Toggles the manual positions in a table.

  • AltFontFile

    Specifies the location of the font file to use if AutoCAD cannot locate the original font and an alternate font is not specified in the font mapping file.

  • Altitude

    Specifies the elevation of the position marker.

  • AltRoundDistance

    Specifies the rounding of alternate units.

  • AltSubUnitsFactor

    Specifies the scale factor for the alternate dimension when unit changes to sub-unit.

  • AltSubUnitsSuffix

    Specifies the text suffix for the alternate dimension when unit changes to sub-unit.

  • AltSuppressLeadingZeros

    Specifies the suppression of leading zeros in alternate dimension values.

  • AltSuppressTrailingZeros

    Specifies the suppression of trailing zeros in alternate dimension values.

  • AltSuppressZeroFeet

    Specifies the suppression of a zero foot measurement in alternate dimension values.

  • AltSuppressZeroInches

    Specifies the suppression of a zero inch measurement in alternate dimension values.

  • AltTabletMenuFile

    Specifies the path for an alternate menu to swap with the standard AutoCAD tablet menu.

  • AltTextPrefix

    Specifies a prefix for the alternate dimension measurement for all dimension types except angular.

  • AltTextSuffix

    Specifies a suffix for the alternate dimension measurement for all dimension types except angular.

  • AltTolerancePrecision

    Specifies the precision of tolerance values in alternate dimensions.

  • AltToleranceSuppressLeadingZeros

    Specifies the suppression of leading zeros in alternate dimension values.

  • AltToleranceSuppressTrailingZeros

    Specifies the suppression of trailing zeros in alternate tolerance values.

  • AltToleranceSuppressZeroFeet

    Specifies the suppression of a zero foot measurement in alternate tolerance values.

  • AltToleranceSuppressZeroInches

    Specifies the suppression of a zero inch measurement in alternate tolerance values.

  • AltUnits

    Enables dimensioning in alternate units.

  • AltUnitsFormat

    Specifies the units format for alternate units of all dimensions except angular.

  • AltUnitsPrecision

    Specifies the number of decimal places in alternate units.

  • AltUnitsScale

    Specifies the scale factor for alternate units.

  • Angle

    Gets the angle of a line.

  • AngleFormat

    Specifies the unit format for angular dimensions.

  • AngleVertex

    Specifies the angle vertex for the three-point angular dimension.

  • Annotation

    Specifies the annotation object for a leader.

  • Annotative

    Specifies the Annotative of the mleaderstyle.

  • Application

    Gets the Application object.

  • ArcEndParam

    Specifies the end parameter of the arc.

  • ArcLength

    Gets the length of the arc.

  • ArcPoint

    Specifies a point on the arc.

  • ArcSmoothness

    Specifies the smoothness of circles, arcs, and ellipses.

  • ArcStartParam

    Specifies the start parameter of the arc.

  • Area

    Specifies the enclosed area of an arc, circle, ellipse, hatch, lightweight polyline, polyline, region, or planar-closed spline.

  • Arrowhead1Block

    Specifies the block to use as the custom arrowhead for the first end of the dimension line.

  • Arrowhead1Type

    Specifies the type of arrowhead for the first end of the dimension line.

  • Arrowhead2Block

    Specifies the block to use as the custom arrowhead for the second end of the dimension line.

  • Arrowhead2Type

    Specifies the type of arrowhead for the second end of the dimension line.

  • ArrowheadBlock

    Specifies the block to use as the custom arrowhead for a radial dimension or leader line.

  • ArrowheadSize

    Specifies the size of dimension line arrowheads, leader and mleader line arrowheads, and hook lines.

  • ArrowheadType

    Specifies the type of arrowhead for the radial dimension, leader, or mleader.

  • ArrowSize

    Specifies the arrow size of the mleaderstyle.

  • ArrowSymbol

    Specifies the arrow symbol of the mleaderstyle.

  • AssociativeHatch

    Specifies whether the hatch is associative.

  • AttachmentPoint

    Specifies the attachment point for an MText object.

  • Author

    Specifies the author of the drawing.

  • AutoAudit

    Specifies whether AutoCAD should perform an audit after you render a DXFIN or DXBIN interchange command.

  • AutomaticPlotLog

    Specifies whether to automatically save a Plot or Publish log.

  • AutoSaveInterval

    Specifies an automatic save interval in minutes.

  • AutoSavePath

    Specifies the path for the file that is created if you enable automatic save using the AutoSaveInterval property.

  • AutoSnapAperture

    Toggles the display of the AutoSnap aperture.

  • AutoSnapApertureSize

    Specifies the size of the AutoSnap aperture.

  • AutoSnapMagnet

    Toggles the AutoSnap magnet.

  • AutoSnapMarker

    Toggles the AutoSnap marker.

  • AutoSnapMarkerColor

    Specifies the color of the AutoSnap marker.

  • AutoSnapMarkerSize

    Specifies the size of the AutoSnap marker.

  • AutoSnapToolTip

    Toggles the AutoSnap tooltips.

  • AutoTrackingVecColor

    Specifies the color of the auto tracking vector.

  • AutoTrackTooltip

    Toggles the display of the AutoTrack tooltips.

  • AxisDirection

    Displays the direction of the axis of revolution.

  • AxisPosition

    Specifies the start point of the axis of revolution.

  • BackgroundColor

    Specifies the background color of the hatch object.

  • BackgroundFill

    Specifies whether multiline text has a background fill.

  • BackgroundLinesColor

    Specifies the color of background lines.

  • BackgroundLinesHiddenLine

    Specifies the hidden line visibility of background lines.

  • BackgroundLinesLayer

    Specifies the layer of background lines.

  • BackgroundLinesLinetype

    Specifies the linetype of background lines.

  • BackgroundLinesLinetypeScale

    Specifies the linetype scale of background lines.

  • BackgroundLinesLineweight

    Specifies the line weight of background lines.

  • BackgroundLinesPlotStyleName

    Specifies the plot style name of background lines.

  • BackgroundLinesVisible

    Specifies the visibility of background lines.

  • Backward

    Specifies the direction of text.

  • Bank

    Specifies whether or not the profile curve twists and rotates along a 3D path.

  • BasePoint

    Specifies the point through which the ray or construction line passes.

  • BaseRadius

    Specifies the base radius of the helix.

  • BatchPlotProgress

    Gets the current status of the batch plot, or terminates the batch plot.

  • BeepOnError

    Specifies if AutoCAD should sound an alarm beep when it detects an invalid entry.

  • BigFontFile

    Specifies the name of the Big Font file associated with the text or attribute.

  • BitFlags

    Specifies the bit flag values of a style.

  • Block

    Specifies the block associated with the layout or multileader style.

  • BlockColor

    Specifies the block color of the mleaderstyle.

  • BlockConnectionType

    The types of block connection a multileader can have.

  • BlockRotation

    Specifies the block rotation value of an mleader style.

  • Blocks

    Gets the Blocks collection for the drawing.

  • BlockScale

    Specifies the BlockScale of the mleader style.

  • BlockScaling

    Specifies the scaling allowed for the block.

  • Blue

    Specifies the blue component of the True Color.

  • BookName

    Specifies the book name (if any) of the color.

  • BottomHeight

    Specifies elevation of section plane bottom extents relative to the object’s elevation.

  • BreaksEnabled

    Specifies if table breaks are enabled.

  • BreakSize

    Specifies the BreakSize of the mleader style.

  • BreakSpacing

    Specifies the break spacing for a table.

  • Brightness

    Specifies the current brightness value of an image.

  • CanonicalMediaName

    Specifies the paper size by name.

  • Caption

    Gets the text that the user sees displayed for the application or a menu item.

  • CategoryName

    Specifies the category name of a view.

  • Center

    Specifies the center of an arc, circle, ellipse, view, or viewport.

  • CenterMarkSize

    Specifies the size of the center mark for radial and diameter dimensions.

  • CenterPlot

    Specifies the centering of the plot on the media.

  • CenterPoint

    Specifies the center of the arc.

  • CenterType

    Specifies the type of center mark for radial and diameter dimensions.

  • Centroid

    Gets the center of area or mass for a region or solid.

  • Check

    Specifies the check status for the popup menu item.

  • ChordPoint

    Specifies the chord point for the arc.

  • Circumference

    Specifies the circumference of a circle.

  • Clipped

    Determines if the viewport has been clipped.

  • ClippingEnabled

    Enables or disables the clipping boundary.

  • Closed

    Specifies whether the 3D polyline, lightweight polyline, lofted surface, polyline, or spline is open or closed.

  • Closed2

    Specifies whether the spline is open or closed.

  • Color

    Specifies the color of an object or layer.

  • ColorBookPath

    Sets the color book path.

  • ColorIndex

    Specifies the color index.

  • ColorMethod

    Specifies the color method.

  • ColorName

    Specifies the name (if any) of the color.

  • ColorScheme

    Specifies the color scheme to display point cloud.

  • Columns

    Specifies the number of columns in a block array or table.

  • ColumnSpacing

    Specifies the spacing of the columns in a block array.

  • ColumnWidth

    Specifies the uniform width of all columns in the table.

  • CommandDisplayName

    Specifies the displayed command name for a button on the toolbar.

  • Comment

    Specifies the comment to be included with a digital signature.

  • Comments

    Specifies the comments for the block or drawing.

  • ConfigFile

    Gets the location of the configuration file used to store hardware device driver information.

  • ConfigName

    Specifies the plotter configuration name.

  • Constant

    Specifies whether the attribute or attribute reference is constant or not.

  • ConstantWidth

    Specifies a global width for all segments in a polyline.

  • Constrain

    Controls which property is constrained when editing other property values.

  • ContentBlockName

    The name of the content block.

  • ContentBlockType

    The type of the content block.

  • ContentType

    Specifies the content type.

  • ContinuousPlotLog

    Specifies whether to save a continuous Plot log.

  • ContourLinesPerSurface

    Specifies the number of contour lines (isolines) per surface on objects.

  • Contrast

    Specifies the current contrast value of an image or underlay.

  • ControlPoints

    Specifies the control points of a spline.

  • Coordinate

    Specifies the coordinate of a single vertex in the object.

  • Coordinates

    Specifies the coordinates for each vertex in the object.

  • Count

    Gets the number of items in the object.

  • CreaseLevel

    Specifies the crease level for the subentity of the SubD mesh.

  • CreaseType

    Specifies the crease type to apply to the subentity of a SubD mesh.

  • CreateBackup

    Specifies the use of a backup file.

  • CurrentSectionType

    Specifies the current section type.

  • CursorSize

    Specifies the crosshairs size as a percentage of the screen size.

  • CurveTangencyLinesColor

    Specifies the color of curve tangency lines.

  • CurveTangencyLinesLayer

    Specifies the layer of curve tangency lines.

  • CurveTangencyLinesLinetype

    Specifies the linetype of curve tangency lines.

  • CurveTangencyLinesLinetypeScale

    Specifies the linetype scale of curve tangency lines.

  • CurveTangencyLinesLineweight

    Specifies the lineweight of curve tangency lines.

  • CurveTangencyLinesPlotStyleName

    Specifies the plot style name of curve tangency lines.

  • CurveTangencyLinesVisible

    Specifies the visibility of curve tangency lines.

  • CustomDictionary

    Specifies a custom dictionary to use if you have one.

  • CustomIconPath

    Specifies the search path for custom icons.

  • CustomScale

    Specifies the custom scale factor for the viewport.

  • CvHullDisplay

    Specifies if the control vertices (CV) Hull is displayed for the NURBS surface.

  • Database

    Gets the database in which the object belongs.

  • DecimalSeparator

    Specifies the character to be used as the decimal separator in decimal dimension and tolerance values.

  • DefaultInternetURL

    Specifies the default Internet address.

  • DefaultOutputDevice

    Specifies the default output device for new layouts and model space.

  • DefaultPlotStyleForLayer

    Specifies the default plot style for Layer 0 for new drawings or drawings created with earlier releases of AutoCAD that have never been saved in AutoCAD 2000 or later format.

  • DefaultPlotStyleForObjects

    Specifies the default plot style name for newly created objects.

  • DefaultPlotStyleTable

    Specifies the default plot style table to attach to new drawings.

  • DefaultPlotToFilePath

    Specifies the default path for plotting to a file.

  • Degree

    Gets the degree of the spline's polynomial representation.

  • Degree2

    Specifies the degree of the spline's polynomial representation.

  • Delta

    Gets the delta of a line.

  • DemandLoadARXApp

    Specifies whether AutoCAD demand-loads a third-party application if a drawing contains custom objects.

  • Description

    Specifies the description of an object.

  • DestinationBlock

    Specifies the destination block for section generation.

  • DestinationFile

    Specifies the destination file for section generation.

  • Diameter

    Specifies the diameter of a circle.

  • Dictionaries

    Gets the Dictionaries collection for the document.

  • DimConstrDesc

    Specifies a description for the constraint.

  • DimConstrExpression

    Specifies the expression or value of the constraint.

  • DimConstrForm

    Specifies the type of constraint.

  • DimConstrName

    Specifies a name for the constraint.

  • DimConstrReference

    Specifies the parameter is a reference constraint.

  • DimConstrValue

    Specifies the value of the constraint.

  • DimensionLineColor

    Specifies the color of the dimension line for a dimension, leader, or tolerance object.

  • DimensionLineExtend

    Specifies the distance the dimension line extends beyond the extension line when oblique strokes are drawn instead of arrowheads.

  • DimensionLinetype

    Specifies the linetype of the dimension line.

  • DimensionLineWeight

    Specifies the lineweight for the dimension lines.

  • DimLine1Suppress

    Specifies the suppression of the first dimension line.

  • DimLine2Suppress

    Specifies the suppression of the second dimension line.

  • DimLineInside

    Specifies the display of dimension lines inside the extension lines only.

  • DimLineSuppress

    Specifies the suppression of the dimension line for radial dimensions.

  • DimStyles

    Gets the DimStyles collection for the document.

  • DimTxtDirection

    Specifies the direction of the dimension text.

  • Direction

    Specifies the viewing direction for a 3D visualization of the drawing, or the direction vector of the table.

  • DirectionVector

    Specifies the direction for the ray, tolerance, or xline through a vector.

  • Display

    Gets the PreferencesDisplay object.

  • DisplayGrips

    Controls the display of selection set grips for the Stretch, Move, Rotate, Scale, and Mirror grip modes.

  • DisplayGripsWithinBlocks

    Controls the assignment of grips within blocks.

  • DisplayLayoutTabs

    Specifies whether to display the Model and layout tabs in the drawing editor.

  • DisplayLocked

    Specifies whether the viewport is locked.

  • DisplayOLEScale

    Determines whether the OLE scaling dialog is displayed when OLE objects are inserted into a drawing.

  • DisplayScreenMenu

    Specifies whether to display the screen menu on the right side of the drawing window. (Obsolete)

  • DisplayScrollBars

    Specifies whether to display scroll bars at the bottom and right sides of the drawing window.

  • DisplaySilhouette

    Controls whether silhouette curves of solid objects are displayed in Wireframe mode.

  • DockedVisibleLines

    Specifies the number of lines of text to display in the command window. (Obsolete)

  • DockStatus

    Specifies whether the toolbar is docked or floating.

  • Document

    Gets the document (drawing) in which the object belongs.

  • Documents

    Gets the Documents collection.

  • DogLegged

    The status of the dog-leg.

  • DoglegLength

    The length of the dog-leg.

  • Drafting

    Gets the PreferencesDrafting object.

  • DrawingDirection

    Specifies the direction in which the mtext paragraph is to be read.

  • DrawLeaderOrderType

    Specifies the drawLeaderOrderType of the mleaderstyle.

  • DrawMLeaderOrderType

    Specifies the drawMLeaderOrderType of the mleaderstyle.

  • DriversPath

    Specifies the directory in which AutoCAD looks for ADI device drivers for the video display, pointing devices, printers, and plotters.

  • DWFFormat

    Specifies the format of the DWF file.

  • EdgeExtensionDistances

    Specifies the distance by which the edges of surface are extended to merge to an existing surface.

  • EffectiveName

    Specifies the original block name.

  • Elevation

    Specifies the current elevation of the hatch, polyline, or section.

  • ElevationModelSpace

    Specifies the elevation setting in model space.

  • ElevationPaperSpace

    Specifies the elevation setting in paper space.

  • Enable

    Enables the popup menu item. Specifies the name of the object.

  • EnableBlockRotation

    Specifies the EnableBlockRotation of the mleaderstyle.

  • EnableBlockScale

    Specifies the EnableBlockScale of the mleaderstyle.

  • EnableBreak

    Toggles table breaking.

  • EnableDogleg

    Specifies the enableDogleg of the mleaderstyle.

  • EnableFrameText

    Specifies the EnableFrameText of the mleaderstyle.

  • EnableLanding

    Specifies the enableLanding of the mleaderstyle.

  • EnableShadowDisplay

    Specifies whether the shadow display property is enabled for the object.

  • EnableStartupDialog

    Specifies whether a startup dialog box is displayed when AutoCAD is launched or a new drawing is created.

  • EndAngle

    Specifies the end angle of an arc or ellipse.

  • EndDraftAngle

    Specifies the draft angle of the surface for the last cross section.

  • EndDraftMagnitude

    Specifies the draft magnitude of the surface for the last cross section.

  • EndParameter

    Specifies the end parameter for an ellipse.

  • EndPoint

    Specifies the endpoint for the arc, line, or ellipse.

  • EndSmoothContinuity

    Specifies the tangency and curvature of the last cross section.

  • EndSmoothMagnitude

    Specifies the size of the curve of the last cross section.

  • EndSubMenuLevel

    Specifies the last item in a submenu.

  • EndTangent

    Specifies the end tangent of the spline as a directional vector.

  • EnterpriseMenuFile

    Specifies the location of the enterprise customization (CUIx) file.

  • EntityColor

    Specifies the color value of the true color.

  • EntityTransparency

    Specifies the transparency value for the entity.

  • Explodable

    Specifies whether the block can be exploded.

  • ExtensionLineColor

    Specifies the color for dimension extension lines.

  • ExtensionLineExtend

    Specifies the distance the extension line extends beyond the dimension line.

  • ExtensionLineOffset

    Specifies the distance the extension lines are offset from the origin points.

  • ExtensionLineWeight

    Specifies the lineweight for the extension lines.

  • ExtLine1EndPoint

    Specifies the endpoint of the first extension line.

  • ExtLine1Linetype

    Specifies the linetype of the first extension line.

  • ExtLine1Point

    Specifies the origin of extension line 1.

  • ExtLine1StartPoint

    Specifies the start point of the first extension line.

  • ExtLine1Suppress

    Specifies the suppression of the first extension line.

  • ExtLine2EndPoint

    Specifies the endpoint of the second extension line.

  • ExtLine2Linetype

    Specifies the linetype of the second extension line.

  • ExtLine2Point

    Specifies the origin of extension line 2.

  • ExtLine2StartPoint

    Specifies the start point of the second extension line.

  • ExtLine2Suppress

    Specifies the suppression of the second extension line.

  • ExtLineFixedLen

    Set extension line fixed length.

  • ExtLineFixedLenSuppress

    Sets suppression of extension line fixed length On or Off.

  • FaceCount

    Returns the number of faces in the SubD mesh.

  • Fade

    Specifies the current fade value of a raster or underlay image.

  • Feature

    Specifies the feature name of an entry in the File Dependency List.

  • FieldLength

    Specifies the field length of the attribute.

  • File

    Specifies the path to the underlay file.

  • FileDependencies

    Returns the file dependency manager object.

  • FileName

    Specifies the file name of an entry in the File Dependency List.

  • Files

    Gets the PreferencesFiles object.

  • FileSize

    Specifies the file size of an entry in the File Dependency List.

  • FingerprintGUID

    Specifies the Fingerprint GUID of an entry in the File Dependency List.

  • FirstSegmentAngleConstraint

    Specifies the FirstSegmentAngleConstraint of the mleaderstyle.

  • Fit

    Specifies the placement of text and arrowheads inside or outside extension lines, based on the available space between the extension lines.

  • FitPoints

    Specifies the fit points of a spline.

  • FitTolerance

    Refits the spline to the existing points with new tolerance values.

  • FloatingRows

    Specifies the number of rows for a floating toolbar.

  • FlowDirection

    Specifies whether the title and header rows are at the bottom or the top of the table.

  • Flyout

    Gets the toolbar associated with a flyout toolbar item.

  • FontFile

    Specifies the primary font file name and the path.

  • FontFileMap

    Specifies the location of the file that defines how AutoCAD should convert unfound fonts.

  • ForceLineInside

    Specifies whether a dimension line is drawn between the extension lines even when the text is placed outside the extension lines.

  • ForegroundLinesColor

    Specifies the color of foreground lines.

  • ForegroundLinesEdgeTransparency

    Specifies the edge transparency of foreground lines.

  • ForegroundLinesFaceTransparency

    Specifies the face transparency of foreground lines.

  • ForegroundLinesHiddenLine

    Specifies the hidden line visibility of foreground lines.

  • ForegroundLinesLayer

    Specifies the layer of foreground lines.

  • ForegroundLinesLinetype

    Specifies the linetype of foreground lines.

  • ForegroundLinesLinetypeScale

    Specifies the linetype scale of foreground lines.

  • ForegroundLinesLineweight

    Specifies the lineweight of foreground lines.

  • ForegroundLinesPlotStyleName

    Specifies the plot style name of foreground lines.

  • ForegroundLinesVisible

    Specifies the visibility of foreground lines.

  • FoundPath

    Specifies an alternate path of an entry in the File Dependency List.

  • FractionFormat

    Specifies the format of fractional values in dimensions and tolerances.

  • Freeze

    Specifies the freeze status of a layer.

  • FullCRCValidation

    Specifies whether a cyclic redundancy check (CRC) should be performed each time an object is read into the drawing.

  • FullFileName

    Specifies the saved full path name of an entry in the File Dependency List.

  • FullName

    Gets the name of the application or document, including the path.

  • FullScreenTrackingVector

    Toggles the display of full-screen tracking vectors.

  • GenerationOptions

    Specifies the section generation options.

  • GeoImageBrightness

    Specifies the brightness value of the embedded image.

  • GeoImageContrast

    Specifies the contrast value of the embedded image.

  • GeoImageFade

    Specifies the current fade value of the embedded image.

  • GeoImageHeight

    Specifies the height of the embedded image.

  • GeoImagePosition

    Specifies the bottom left corner of the embedded image.

  • GeoImageWidth

    Specifies the width of the embedded image.

  • Geolocate

    Specifies whether the point cloud is geographically located.

  • GradientAngle

    Specifies the gradient angle.

  • GradientCentered

    Specifies whether the gradient is centered.

  • GradientColor1

    Specifies the start color of the gradient.

  • GradientColor2

    Specifies the end color of the gradient.

  • GradientName

    Specifies the pattern name of the gradient.

  • GraphicsWinLayoutBackgrndColor

    Specifies the background color for the paper space layouts.

  • GraphicsWinModelBackgrndColor

    Specifies the background color for the model space window.

  • Green

    Specifies the green component of the True Color.

  • GridOn

    Specifies the status of the viewport grid.

  • GripColorSelected

    Specifies the color of selected grips.

  • GripColorUnselected

    Specifies the color of unselected grips.

  • GripSize

    Specifies the size of grips.

  • Groups

    Gets the Groups collection for the document.

  • Handle

    Gets the handle of an object.

  • HasAttributes

    Specifies whether the block has any attributes in it.

  • HasExtensionDictionary

    Determines whether the object has an extension dictionary associated with it.

  • HasLeader

    Specifies whether the dimension has a leader.

  • HasSheetView

    Specifies whether the viewport is linked to a corresponding sheet view.

  • HasSubSelection

    Specifies whether the table contains a subselection set.

  • HasVpAssociation

    Specifies whether the view is associated with a paper space viewport.

  • HatchObjectType

    Specifies the type of the hatch, classic or gradient.

  • HatchStyle

    Specifies the hatch style.

  • HeaderSuppressed

    Specifies whether the header of the table is suppressed.

  • Height

    Changes the height of the object.

  • HelpFilePath

    Specifies the location of the AutoCAD Help file.

  • HelpString

    Specifies the Help string for the toolbar, toolbar item, or menu item.

  • History

    Specifies whether history is saved.

  • HistoryLines

    Specifies the number of lines of text in the text window to keep in memory.

  • HorizontalTextPosition

    Specifies the horizontal justification for dimension text.

  • HorzCellMargin

    Specifies the value of the horizontal margin of cells.

  • HWND

    Gets the window handle of the window frame.

  • HyperlinkBase

    Specifies the base address used for all relative links inserted within the drawing.

  • HyperlinkDisplayCursor

    Toggles the display of the hyperlink cursor and shortcut menu.

  • Hyperlinks

    Gets the Hyperlinks collection for an entity.

  • ImageFile

    Specifies the full path and file name of the raster image file.

  • ImageFrameHighlight

    Controls the display of raster images during selection.

  • ImageHeight

    Specifies the height of the raster image.

  • ImageVisibility

    Specifies whether image visibility is on or off.

  • ImageWidth

    Specifies the width of the raster image.

  • IncrementalSavePercent

    Specifies the percentage of wasted space allowed in a drawing file.

  • Index

    Specifies the index of the menu, toolbar item, or an entry in the File Dependency List.

  • IndicatorFillColor

    Specifies color of section plane when shading is turned on.

  • IndicatorTransparency

    Specifies transparency of section plane when shading is turned on.

  • InsertionPoint

    Insertion point for a tolerance, text, block, or shape, and the origin (upper-left corner) of an OLE object.

  • InsUnits

    Specifies the insert units saved with the block.

  • InsUnitsFactor

    Specifies the conversion factor between block units and drawing units.

  • IntensityColorScheme

    Specifies the color scheme to use for displaying intensity values.

  • IntersectionBoundaryColor

    Specifies the color of intersection boundary.

  • IntersectionBoundaryDivisionLines

    Specifies whether division lines are shown in intersection boundary.

  • IntersectionBoundaryLayer

    Specifies the layer of intersection boundary.

  • IntersectionBoundaryLinetype

    Specifies the linetype of intersection boundary.

  • IntersectionBoundaryLinetypeScale

    Specifies the linetype scale of intersection boundary.

  • IntersectionBoundaryLineweight

    Specifies the lineweight of intersection boundary.

  • IntersectionBoundaryPlotStyleName

    Specifies the plot style name of intersection boundary.

  • IntersectionBoundaryVisible

    Specifies the visibility of intersection boundary.

  • IntersectionFillColor

    Specifies the color of intersection fill.

  • IntersectionFillFaceTransparency

    Specifies the face transparency of intersection fill.

  • IntersectionFillHatchAngle

    Specifies the hatch angle for intersection fill.

  • IntersectionFillHatchPatternName

    Specifies the hatch pattern name for intersection fill.

  • IntersectionFillHatchPatternType

    Specifies the hatch pattern type for intersection fill.

  • IntersectionFillHatchScale

    Specifies the hatch scale for intersection fill.

  • IntersectionFillHatchSpacing

    Specifies the hatch spacing for intersection fill.

  • IntersectionFillLayer

    Specifies the layer of intersection fill.

  • IntersectionFillLinetype

    Specifies the linetype of intersection fill.

  • IntersectionFillLinetypeScale

    Specifies the linetype scale of intersection fill.

  • IntersectionFillLineweight

    Specifies the lineweight of intersection fill.

  • IntersectionFillPlotStyleName

    Specifies the plot style name of intersection fill.

  • IntersectionFillVisible

    Specifies the visibility of intersection fill.

  • Invisible

    Specifies whether the attribute or attribute reference is invisible.

  • IsCloned

    Determines whether the source object in a CopyObjects operation has been cloned.

  • IsDynamicBlock

    Specifies whether this is a dynamic block.

  • IsLayout

    Determines whether the given block is a layout block.

  • IsModified

    Specifies whether an entry in the File Dependency List was modified.

  • ISOPenWidth

    Specifies the ISO pen width of an ISO hatch pattern.

  • IsOwnerXlated

    Determines whether the owning object in a CopyObjects operation has been translated.

  • IsPartial

    Specifies whether the dimension is for a partial arc.

  • IsPeriodic

    Determines whether the given spline is periodic.

  • IsPlanar

    Determines whether the given spline is planar.

  • IsPrimary

    Determines whether the source object in a CopyObjects operation was part of the primary set of objects being copied, or if it was simply owned by a member in the primary set.

  • IsQuiescent

    Checks whether AutoCAD is idle and ready to accept automation calls from out-of-process applications.

  • IsRational

    Determines whether the given spline is rational.

  • Issuer

    Specifies the issuer name of the digital certificate.

  • IsXRef

    Determines whether the given block is an XRef block.

  • ItemName

    Specifies the item of the underlay file.

  • JogAngle

    Specifies the jog angle.

  • JogLocation

    Specifies the jog location.

  • Justification

    Specifies the justification of the MLine.

  • Key

    The object ID of the source object in the CopyObjects operation.

  • KeyboardAccelerator

    Specifies the Windows standard or AutoCAD classic keyboard.

  • KeyboardPriority

    Controls how AutoCAD responds to the input of coordinate data.

  • KeyLength

    Specifies the length of the encryption key.

  • Keywords

    Specifies the keywords you want to use to locate the drawing.

  • KnotParameterization

    Specifies the knot parameterization for a spline created by fit points.

  • Knots

    Gets the knot vector for a spline.

  • Label

    Specifies the content and formatting of menu items as they appear to the user.

  • LabelBlockId

    Returns and sets the label block ID associated with the viewport.

  • LandingGap

    Specifies the text landing gap.

  • LargeButtons

    Specifies whether the toolbar button is large or small.

  • LastHeight

    Specifies the last text height used.

  • LastSavedBy

    Specifies the name of the last person who modified the file.

  • Latitude

    Specifies the latitude of the position marker.

  • Layer

    Specifies the layer for an object.

  • LayerOn

    Specifies the state of a layer.

  • LayerPropertyOverrides

    Specifies whether the viewport has layer property overrides.

  • Layers

    Gets the Layers collection for the document.

  • LayerState

    Specifies the name of the layer state of the view.

  • Layout

    Specifies the layout associated with the model space, paper space, or block object.

  • LayoutCreateViewport

    Toggles the automatic creation of a viewport for new layouts.

  • LayoutCrosshairColor

    Specifies the color of the crosshairs and text for paper space layouts.

  • LayoutDisplayMargins

    Toggles the display of margins in layouts.

  • LayoutDisplayPaper

    Toggles the display of the paper background in layouts.

  • LayoutDisplayPaperShadow

    Toggles the display of the paper background shadow in layouts.

  • LayoutID

    Specifies the layout of the view.

  • Layouts

    Gets the Layouts collection for the document.

  • LayoutShowPlotSetup

    Toggles the display of the Plot Setup dialog when a new layout is created.

  • Leader1Point

    Specifies the origin of leader 1.

  • Leader2Point

    Specifies the origin of leader 2.

  • LeaderCount

    Gets the number of leaderLine clusters in this Mleader object.

  • LeaderLength

    Specifies the length of the leader on the diameter or radius dimension.

  • LeaderLineColor

    Specifies the color of the leader lines.

  • LeaderLinetype

    Specifies the type of the leader lines.

  • LeaderLineTypeId

    Specifies the linetype of leader lines of the mleaderstyle.

  • LeaderLineWeight

    Specifies the lineweight of the leader lines.

  • LeaderType

    Specifies the type of the leader.

  • Left

    Specifies the left edge of a toolbar.

  • Length

    Gets the length of an object.

  • LensLength

    Specifies the lens length used in perspective viewing.

  • Limits

    Specifies the drawing limits.

  • LinearScaleFactor

    Specifies a global scale factor for linear dimensioning measurements.

  • LineSpacingDistance

    Specifies the spacing of multiline text.

  • LineSpacingFactor

    Specifies the relative line spacing factor for the MText object.

  • LineSpacingStyle

    Specifies the line spacing style for the MText object.

  • Linetype

    Specifies the linetype of an object.

  • LinetypeGeneration

    Specifies the linetype generation of a 2D polyline or a lightweight polyline.

  • Linetypes

    Gets the Linetypes collection for the document.

  • LinetypeScale

    Specifies the linetype scale of an object.

  • Lineweight

    Specifies the lineweight of an individual object or the default lineweight for the drawing.

  • LineweightDisplay

    Specifies whether lineweights are displayed in model space for the drawing.

  • LiveSectionEnabled

    Turns live section on or off for this section object.

  • LoadAcadLspInAllDocuments

    Specifies whether acad.lsp is loaded at startup or with each drawing.

  • LocaleID

    Gets the locale ID of the current AutoCAD session.

  • Lock

    Locks or unlocks a layer.

  • LockAspectRatio

    Ensures that the width and height of the object stay in proportion.

  • Locked

    Specifies if the point cloud is locked.

  • LockPosition

    Specifies whether the attribute or attribute reference may be moved relative to the geometry in the block.

  • LogFileOn

    Specifies whether the contents of the text window are written to a log file.

  • LogFilePath

    Specifies the location for the log file.

  • Longitude

    Specifies the longitude of the position marker.

  • LowerLeftCorner

    Gets the lower-left corner of the current active viewport.

  • Macro

    Specifies the macro for the menu or toolbar item.

  • MainDictionary

    Specifies the current dictionary to use for spell checking.

  • MaintainAssociativity

    Specifies if a surface maintains its associativity with another surface.

  • MajorAxis

    Specifies the direction of the major axis of the ellipse.

  • MajorRadius

    Specifies the length of the major axis of the ellipse.

  • Mask

    Specifies the layer properties to be restored.

  • Material

    Specifies the name of the material.

  • Materials

    Returns the materials collection for the database.

  • MaxActiveViewports

    Specifies the maximum number of active viewports.

  • MaxAutoCADWindow

    Specifies whether the AutoCAD window should fill the entire screen area when you start.

  • MaxLeaderSegmentsPoints

    Specifies the maxLeaderSegmentsPoints of the mleaderstyle.

  • MClose

    Specifies whether the PolygonMesh is closed in the M direction.

  • MDensity

    Specifies the surface density of a PolygonMesh in the M direction.

  • Measurement

    Gets the measurement for the dimension.

  • MenuBar

    Gets the MenuBar object for the session.

  • MenuFile

    Specifies the location of the AutoCAD customization file for the session.

  • MenuFileName

    Gets the customization file name where the menu group is located.

  • MenuGroups

    Gets the MenuGroups collection for the session.

  • Menus

    Gets the PopupMenus collection.

  • MinimumTableHeight

    Specifies the minimum height of the table.

  • MinimumTableWidth

    Specifies the minimum width of the table.

  • MinorAxis

    Specifies the direction of the minor axis of an ellipse.

  • MinorRadius

    Specifies the length of the minor axis of the ellipse.

  • MLineScale

    Specifies the scale of the MLine.

  • Mode

    Specifies the mode of the attribute definition.

  • ModelCrosshairColor

    Specifies the color of the crosshairs and text for model space.

  • ModelSpace

    Gets the ModelSpace collection for the document.

  • ModelType

    Specifies whether a plot configuration applies to model space or to all layouts.

  • ModelView

    Returns and sets the model view associated with the viewport.

  • MomentOfInertia

    Gets the moment of inertia for the solid.

  • Monochrome

    Determines whether underlay is monochrome.

  • MRUNumber

    Specifies the number of most recently used files that is shown in the File menu.

  • MSpace

    Allows editing of the model from floating paper space viewports.

  • MTextAttribute

    Determines if the attribute is multiline.

  • MTextAttributeContent

    Gets the multiline attribute content.

  • MTextBoundaryWidth

    Determines the width of the text boundary for the multiline attribute.

  • MTextDrawingDirection

    Determines the drawing direction for the multiline attribute.

  • MVertexCount

    Gets the vertex count in the M direction for a PolygonMesh.

  • Name

    Specifies the name of the object.

  • NameNoMnemonic

    Specifies the name of the popup menu without the underscore mnemonic.

  • NClose

    Specifies whether the PolygonMesh is closed in the N direction.

  • NDensity

    Specifies the smooth surface density of a PolygonMesh in the N direction.

  • Normal

    Specifies the three-dimensional normal unit vector for the object.

  • Notes

    Specifies the notes for the position marker.

  • NumberOfControlPoints

    Gets the number of control points of the spline.

  • NumberOfCopies

    Specifies the number of copies to plot.

  • NumberOfFaces

    Gets the number of faces for the PolyfaceMesh.

  • NumberOfFitPoints

    Gets the number of fit points of the spline.

  • NumberOfLoops

    Gets the number of loops in the hatch boundary.

  • NumberOfVertices

    Gets the number of vertices for the PolyfaceMesh.

  • NumCellStyles

    Gets the number of cell styles a table has.

  • NumCrossSections

    Gets the number of cross-section curves used.

  • NumGuidePaths

    Gets the number of guide paths used.

  • NumVertices

    Gets the number of vertices in the section line.

  • NVertexCount

    Gets the vertex count in the N direction for a PolygonMesh.

  • ObjectID

    Gets the object ID.

  • ObjectName

    Gets the AutoCAD class name of the object.

  • ObjectSnapMode

    Specifies the setting of the object snap mode.

  • ObjectSortByPlotting

    Toggles sorting of drawing objects by plotting order.

  • ObjectSortByPSOutput

    Toggles sorting of drawing objects by PostScript output order.

  • ObjectSortByRedraws

    Toggles sorting of drawing objects by redraw order.

  • ObjectSortByRegens

    Toggles sorting of drawing objects by regeneration order.

  • ObjectSortBySelection

    Toggles sorting of drawing objects by object selection.

  • ObjectSortBySnap

    Toggles sorting of drawing objects by object snap.

  • ObliqueAngle

    Specifies the oblique angle of the object.

  • OleItemType

    Specifies whether the OLE object is linked to the original pasted file when opening the object for editing.

  • OLELaunch

    Determines whether to launch the parent application when plotting OLE objects.

  • OlePlotQuality

    Controls the plot quality of an OLE object based on the file type selected from the list.

  • OLEQuality

    Specifies the plot quality of OLE objects.

  • OleSourceApp

    Specifies the application for editing the OLE object.

  • OnMenuBar

    Determines if the specified popup menu is on the menu bar.

  • OpenSave

    Gets the PreferencesOpenSave object.

  • Origin

    Specifies the origin of the UCS, block, hatch, or raster image in WCS coordinates.

  • OrthoOn

    Specifies the status of the Isometric snap mode for the viewport.

  • Output

    Gets the PreferencesOutput object.

  • OverrideCenter

    Specifies the override center location.

  • OverwritePropChanged

    Indicates whether properties were changed.

  • OwnerID

    Gets the object ID of the owner (parent) object.

  • PageSetupOverridesTemplateFile

    Specifies the default template for Page Setup overrides.

  • PaperSpace

    Gets the PaperSpace collection for the document.

  • PaperUnits

    Specifies the units for the display of layout or plot configuration properties.

  • Parent

    Gets the parent of the object.

  • Password

    Specifies the encryption password.

  • Path

    Gets the path of the block, document, application, or external reference.

  • PatternAngle

    Specifies the angle of the hatch pattern.

  • PatternDouble

    Specifies if the user-defined hatch is double-hatched.

  • PatternName

    Specifies the hatch pattern name.

  • PatternScale

    Specifies the hatch pattern scale.

  • PatternSpace

    Specifies the user-defined hatch pattern spacing.

  • PatternType

    Gets the pattern type used for the hatch.

  • Perimeter

    Gets the total length of the inner and outer region loops.

  • Periodic

    Specifies that a smooth and closed surface is created without a kink if it is reshaped.

  • PickAdd

    Determines if objects are added to the selection set using the Shift key.

  • PickAuto

    Controls automatic windowing at the Select Objects prompt.

  • PickBoxSize

    Specifies the size of the object selection target.

  • PickDrag

    Controls the method of drawing a selection window.

  • PickFirst

    Determines if you select objects before (noun-verb selection) or after you issue a command.

  • PickfirstSelectionSet

    Gets the pickfirst selection set.

  • PickGroup

    Determines if picking a single object in a group selects the entire group.

  • Plot

    Gets the Plot object for the document.

  • PlotConfigurations

    Gets the PlotConfigurations collection for the document.

  • PlotHidden

    Specifies if objects are to be hidden during a plot.

  • PlotLegacy

    Toggles whether legacy plot scripts are allowed to run.

  • PlotLogFilePath

    Specifies the path of the Plot log file.

  • PlotOrigin

    Specifies the origin of the UCS, block, layout, or raster image in WCS coordinates.

  • PlotPolicy

    Determines whether an object's color property is associated with its plot style name when a new drawing is created.

  • PlotRotation

    Specifies the rotation angle for the layout or plot configuration.

  • PlotStyleName

    Specifies the plot style name for an object, group of objects, or layer.

  • Plottable

    Specifies if the layer is plottable.

  • PlotType

    Specifies the type of layout or plot configuration.

  • PlotViewportBorders

    Specifies if the viewport borders are to be plotted.

  • PlotViewportsFirst

    Specifies if all geometry in paper space viewports is plotted first.

  • PlotWithLineweights

    Specifies whether objects plot with the lineweights they are assigned in the plot file, or with the lineweights in the drawing file.

  • PlotWithPlotStyles

    Specifies whether or not to plot using the plot styles that are applied to objects and defined in the plot style table.

  • PolarTrackingVector

    Toggles the display of polar tracking vectors.

  • Position

    Specifies the X, Y, Z coordinate for center of the base or center of the solid, or the origin for the position marker, helix, or underlay.

  • PostScriptPrologFile

    Specifies a name for a customized prolog section in the acad.psf file.

  • Preferences

    Gets the Preferences object.

  • Preset

    Specifies if the attribute is preset.

  • PrimaryUnitsPrecision

    Specifies the number of decimal places displayed for the primary units of a dimension or tolerance.

  • PrincipalDirections

    Gets the principal directions of the solid or region.

  • PrincipalMoments

    Gets the principal moments property of the solid or region.

  • PrinterConfigPath

    Specifies the location for printer configuration files.

  • PrinterDescPath

    Specifies the location for printer description files.

  • PrinterPaperSizeAlert

    Specifies whether to alert the user when a layout is configured with a paper size that is different than the default setting for the PC3 file.

  • PrinterSpoolAlert

    Specifies whether to alert the user when the output to a device must be spooled through a system printer due to a conflict with the I/O port.

  • PrinterStyleSheetPath

    Specifies the location for printer style sheet files.

  • PrintFile

    Specifies an alternate name to use for the temporary plot file name.

  • PrintSpoolerPath

    Specifies the directory for the print spool files. AutoCAD writes the plot to this location.

  • PrintSpoolExecutable

    Specifies the application to use for print spooling.

  • ProductOfInertia

    Gets the product of inertia of the solid or region.

  • ProfileRotation

    Specifies the rotation of the sweep profile.

  • Profiles

    Gets the PreferencesProfiles object.

  • PromptString

    Specifies the prompt string for an attribute.

  • PropertyName

    Specifies the name for the property.

  • ProviderName

    Specifies the encryption provider name.

  • ProviderType

    Specifies the encryption provider type.

  • ProxyImage

    Controls the display of objects in a drawing that were created in a third-party application.

  • QNewTemplateFile

    Sets the default template file name for the QNEW command.

  • QuietErrorMode

    Toggles the quiet error mode for plot-error reporting.

  • Rows

    Specifies the number of rows in a block array or table.

  • RadiiOfGyration

    Gets the radius of gyration of the solid or region.

  • Radius

    Specifies the radius of an arc, circle, or position marker.

  • RadiusRatio

    Specifies the major to minor axis ratio of an ellipse.

  • ReadOnly

    Specifies if the document or property is read-only or read-write.

  • Red

    Specifies the red component of the True Color.

  • ReferenceCount

    Specifies the reference count of an entry in the File Dependency List.

  • RegenerateTableSuppressed

    Enables or disables regeneration of the table block.

  • RegisteredApplications

    Gets the RegisteredApplications collection for the document.

  • RemoveHiddenLines

    Specifies if hidden lines are to be plotted on a paper space viewport. (Obsolete)

  • RenderSmoothness

    Specifies the smoothness of shaded, rendered, and hidden line-removed objects.

  • RepeatBottomLabels

    Determines whether the bottom set of label rows is repeated at the bottom of each broken table part.

  • RepeatTopLabels

    Determines whether the first set of label rows will be repeated at the top of each broken table part.

  • RevisionNumber

    Specifies the revision number.

  • RevolutionAngle

    Specifies the angle of revolution.

  • Rotation

    Specifies the rotation angle for the object.

  • RoundDistance

    Specifies the rounding of dimension units.

  • RowHeight

    Specifies a uniform height for all rows in the table.

  • RowSpacing

    Specifies the spacing of the rows in a block array.

  • SaveAsType

    Specifies the drawing type for saving the drawing.

  • Saved

    Specifies if the document has any unsaved changes.

  • SavePreviewThumbnail

    Specifies if BMP preview images are saved with the drawing.

  • Scale

    Specifies the scale factor from start to the end of the sweep path.

  • ScaleFactor

    Specifies the scale factor for the object.

  • ScaleHeight

    Specifies the height of the object as a percentage of its original height.

  • ScaleLineweights

    Specifies if the lineweight is scaled with the rest of the geometry when a layout is printed.

  • ScaleWidth

    Specifies the width of the object as a percentage of its original width.

  • SCMCommandMode

    Determines right-click functionality in the drawing area while in Command mode, which means that a command is currently in progress.

  • SCMDefaultMode

    Determines right-click functionality in the drawing area while in Default mode, which means that no objects are selected and no commands are in progress.

  • SCMEditMode

    Determines right-click functionality in the drawing area while in Edit mode, which means that one or more objects are selected and no commands are in progress.

  • SCMTimeMode

    Controls time-sensitive right-click behavior.

  • SCMTimeValue

    Controls time-sensitive right-click behavior by setting the duration of the long click that displays a shortcut menu.

  • SecondPoint

    Specifies the second point of the ray or xline.

  • SecondSegmentAngleConstraint

    Specifies the SecondSegmentAngleConstraint of the mleaderstyle.

  • SectionManager

    Returns the section manager object.

  • SegmentPerPolyline

    Specifies the number of line segments to be generated for each polyline curve.

  • Selection

    Gets the PreferencesSelection object.

  • SelectionSets

    Gets the SelectionSets collection for the document.

  • SerialNumber

    Specifies the serial number of the digital certificate.

  • Settings

    Retrieves the section geometry settings for the Section object.

  • ShadePlot

    Specifies the shaded viewport plotting mode of a viewport.

  • ShadowDisplay

    Specifies the shadow display property of the object.

  • SheetView

    Returns and sets the sheet view associated with the viewport.

  • ShortcutMenu

    Determines if the specified popup menu is the shortcut menu.

  • ShortCutMenuDisplay

    Controls whether right-clicking in the drawing area displays a shortcut menu or issues Enter.

  • Show

    Specifies whether the property is shown in the user interface.

  • ShowAssociativity

    Specifies if dependent surfaces are highlighted when the surface is selected.

  • ShowClipped

    Enables or disables the clipping boundary.

  • ShowCropped

    Specifies if the point cloud is shown cropped.

  • ShowHistory

    Specifies whether to show history of the solid.

  • ShowIntensity

    Specifies if the point cloud is displayed using a shaded color scheme.

  • ShowPlotStyles

    Specifies whether or not plot styles and plot style names are displayed in the drawing.

  • ShowProxyDialogBox

    Specifies if AutoCAD displays a warning message when you open a drawing that contains custom objects.

  • ShowRasterImage

    Controls the display of raster images during real-time pan and zooms.

  • ShowRotation

    Determines if a raster image is displayed at its rotation value.

  • ShowWarningMessages

    Resets all dialog boxes that have the "Don't Display This Warning Again" check box so they display again.

  • SingleDocumentMode

    Determines if AutoCAD runs in single- or multiple-document mode.

  • Smoothness

    Specifies the level of smoothness for the SubD mesh.

  • SnapBasePoint

    Specifies the snap base point for the viewport.

  • SnapOn

    Specifies the status of snap.

  • SnapRotationAngle

    Specifies the snap rotation angle of the viewport relative to the current UCS.

  • SolidFill

    Specifies if multilines, traces, solids, all hatches (including solid-fill), and wide polylines are filled in.

  • SolidType

    Indicates the type of solid.

  • SourceObjects

    Specifies the source objects for section generation.

  • SplineFrame

    Specifies the display of the control vertices (CVs) for a spline.

  • SplineMethod

    Specifies the type of the spline.

  • StandardScale

    Specifies the standard scale for the layout, viewport, or plot configuration.

  • StandardScale2

    Specifies a standard scale for the viewport.

  • StartAngle

    Specifies the start angle of an arc or an ellipse.

  • StartDraftAngle

    Specifies the draft angle of the surface for the first cross section.

  • StartDraftMagnitude

    Specifies the draft magnitude of the surface for the first cross section.

  • StartParameter

    Specifies the start parameter for an ellipse.

  • StartPoint

    Specifies the start point for the arc, line, or ellipse.

  • StartSmoothContinuity

    Specifies the tangency and curvature of the first cross section.

  • StartSmoothMagnitude

    Specifies the size of the curve of the first cross section.

  • State

    Specifies section object type.

  • StatusID

    Gets the current active status of the viewport.

  • StoreSQLIndex

    Determines if the SQL index is stored in the drawing.

  • StyleName

    Specifies the name of the style used with the object.

  • StyleSheet

    Specifies the style sheet for the layout or plot configuration.

  • Stylization

    Specifies color stylization for selected point cloud.

  • Subject

    Specifies the subject name of the digital ID (certificate) or drawing.

  • SubMenu

    Gets the popup menu associated with a sub menu.

  • SubUnitsFactor

    Specifies the sub-units scale factor for dimension when unit changes to sub-unit.

  • SubUnitsSuffix

    Specifies the sub-units suffix for dimensions when unit changes to sub-unit.

  • SummaryInfo

    Specifies the properties of a drawing.

  • SupportPath

    Specifies the directories where AutoCAD searches for support files.

  • SuppressLeadingZeros

    Specifies the suppression of leading zeros in dimension values.

  • SuppressTrailingZeros

    Specifies the suppression of trailing zeros in dimension values.

  • SuppressZeroFeet

    Specifies the suppression of a zero foot measurement in dimension values.

  • SuppressZeroInches

    Specifies the suppression of a zero inch measurement in dimension values.

  • SurfaceNormals

    Specifies for which cross-section curves the surface is normal to the cross section.

  • SurfaceType

    Indicates the type of surface.

  • SurfTrimAssociativity

    Specifies if associativity is maintained between the surface and the objects used to trim the object.

  • SymbolPosition

    Specifies placement of the arc length dimension symbol.

  • System

    Gets the PreferencesSystem object.

  • TableBreakFlowDirection

    Determines the direction that parts of the table flow.

  • TableBreakHeight

    Sets the breaking height for the initial table part and any other table parts that do not have manual heights set.

  • TablesReadOnly

    Determines whether to open database tables in read-only mode.

  • TableStyleOverrides

    Specifies the table style overrides.

  • TabOrder

    Specifies the tab order of a layout.

  • TagString

    Specifies the tag string of the object.

  • TaperAngle

    Specifies the taper angle of the extrusion.

  • Target

    Specifies the target point for the view or viewport.

  • TempFileExtension

    Specifies the extension for temporary files.

  • TempFilePath

    Specifies the directory AutoCAD uses to store temporary files.

  • TemplateDWGPath

    Specifies the path for the template files used by the start-up wizards.

  • TemplateId

    Specifies the template ID for the table style.

  • TempXRefPath

    Specifies the location of external reference files.

  • TextAlignmentPoint

    Specifies the alignment point for text and attributes.

  • TextAlignmentType

    Specifies the TextAlignmentType of the mleaderstyle.

  • TextAttachmentDirection

    Specifies if the text content uses a horizontal or vertical attachment direction.

  • TextAttachmentType

    Specify how leaders connect with the text.

  • TextBackgroundFill

    Specifies if background mask ought to be used.

  • TextBottomAttachmentType

    Specifies the attachment of the leader to the bottom of the text content.

  • TextColor

    Specifies the color of the text for dimension and tolerance objects.

  • TextDirection

    Specifies the drawing direction of the MText.

  • TextEditor

    Specifies the name of the text editor for the MTEXT command.

  • TextFill

    Sets fill color On or Off.

  • TextFillColor

    Sets text fill color.

  • TextFont

    Specifies the font for new text.

  • TextFontSize

    Specifies the font size for new text.

  • TextFontStyle

    Specifies the font style for new text.

  • TextFrameDisplay

    Toggles the display of frames around the multileader text content with a text box or for text objects instead of displaying the text itself.

  • TextGap

    Specifies the distance between the dimension text and the dimension line when you break the dimension line to accommodate dimension text.

  • TextGenerationFlag

    Specifies the attribute text generation flag.

  • TextHeight

    Specifies the height for the dimension or tolerance text.

  • TextInside

    Specifies if the dimension text is to be drawn inside the extension lines.

  • TextInsideAlign

    Specifies the position of dimension text inside the extension lines for all dimension types except ordinate.

  • TextJustify

    Specifies the attachment point of the MText.

  • TextLeftAttachmentType

    Specify how leaders on the left side connect with the text.

  • TextLineSpacingDistance

    Specifies the line spacing distance of the MText content in the multileader object.

  • TextLineSpacingFactor

    Specifies the line spacing factor of the MText content in the multileader object.

  • TextLineSpacingStyle

    Specifies the line spacing style of the MText content in the multileader object.

  • TextMovement

    Specifies how dimension text is drawn when text is moved.

  • TextOutsideAlign

    Specifies the position of dimension text outside the extension lines for all dimension types except ordinate.

  • TextOverride

    Specifies the text string for the dimension.

  • TextPosition

    Specifies the dimension text position.

  • TextPrecision

    Specifies the precision of angular dimension text.

  • TextPrefix

    Specifies the dimension value prefix.

  • TextRightAttachmentType

    Specify how leaders on the right side connect with the text.

  • TextRotation

    Specifies the rotation angle of the dimension text.

  • TextString

    Specifies the text string for the entity.

  • TextStyle

    Specifies the text style for the dimension or tolerance text.

  • TextStyleName

    Specifies the style name of the MText.

  • TextStyles

    Gets the TextStyles collection for the document.

  • TextSuffix

    Specifies the dimension value suffix.

  • TextureMapPath

    Specifies the directory in which AutoCAD searches for rendering texture maps.

  • TextWidth

    Specifies the width of the MText.

  • TextWinBackgrndColor

    Specifies the background color for the text window.

  • TextWinTextColor

    Specifies the text color for the text window.

  • Thickness

    Specifies the distance a 2D AutoCAD object is extruded above or below its elevation.

  • TimeServer

    Specifies the name of the time server to be used for a digital signature.

  • TimeStamp

    Specifies the timestamp of an entry in the File Dependency List.

  • Title

    Specifies the title you want to use to locate the drawing.

  • TitleSuppressed

    Specifies whether the title of the table is suppressed.

  • ToleranceDisplay

    Specifies if tolerances are displayed with the dimension text.

  • ToleranceHeightScale

    Specifies a scale factor for the text height of tolerance values relative to the dimension text height.

  • ToleranceJustification

    Specifies the vertical justification of tolerance values relative to the nominal dimension text.

  • ToleranceLowerLimit

    Specifies the minimum tolerance limit for dimension text.

  • TolerancePrecision

    Specifies the precision of tolerance values in primary dimensions.

  • ToleranceSuppressLeadingZeros

    Specifies the suppression of leading zeros in tolerance values.

  • ToleranceSuppressTrailingZeros

    Specifies the suppression of trailing zeros in dimension values.

  • ToleranceSuppressZeroFeet

    Specifies the suppression of a zero foot measurement in tolerance values.

  • ToleranceSuppressZeroInches

    Specifies the suppression of a zero inch measurement in tolerance values.

  • ToleranceUpperLimit

    Specifies the maximum tolerance limit for dimension text.

  • Toolbars

    Gets the Toolbars collection.

  • ToolPalettePath

    Sets the tool palette path.

  • Top

    Specifies the top edge of a toolbar.

  • TopHeight

    Specifies elevation of section plane top extents relative to the object’s elevation.

  • TopRadius

    Specifies the top radius of the helix.

  • TotalAngle

    Gets the total angle for the arc.

  • TotalLength

    Specifies the total length of the helix.

  • TranslateIDs

    Specifies the translation of any contained object IDs during deepClone or wblockClone operations.

  • Transparency

    Specifies if the transparency for a particular bitonal image is on or off.

  • TrueColor

    Specifies the True Color of an object.

  • TrueColorImages

    Determines if raster and render images are displayed at true color or palletized color.

  • TurnHeight

    Specifies the height of one full turn for the helix.

  • Turns

    Specifies the number of turns for the helix.

  • TurnSlope

    Displays the constant incline angle for the helix path.

  • Twist

    Controls the twist direction of the helix or specifies the amount of rotation along the entire length of the sweep path.

  • TwistAngle

    Specifies the twist angle for the viewport.

  • Type

    Specifies type of a Leader, MenuGroup, PopupMenuItem, ToolbarItem, Polyline, or PolygonMesh object.

  • UCSIconAtOrigin

    Specifies if the UCS icon is displayed at the origin.

  • UCSIconOn

    Specifies if the UCS icon is on.

  • UCSPerViewport

    Specifies if the UCS is saved with the viewport.

  • UIsolineDensity

    Specifies the number of U isolines that are displayed.

  • UnderlayLayerOverrideApplied

    Determines whether underlay layer overrides are applied or not.

  • UnderlayName

    Specifies the name of the underlay file.

  • UnderlayVisibility

    Specifies the visibility of the underlay file.

  • Unit

    Gets the unit of the point cloud file.

  • UnitFactor

    Gets the insertion unit factor of the point cloud file.

  • Units

    Specifies the native units of measure for the block.

  • UnitsFormat

    Specifies the unit format for all dimensions except angular.

  • UnitsType

    Specifies the current display units type for the property.

  • UpperRightCorner

    Gets the upper-right corner of the current active viewport.

  • UpsideDown

    Specifies the direction of text.

  • URL

    Specifies the URL for the Hyperlink object.

  • URLDescription

    Specifies the URL description for the Hyperlink object.

  • URLNamedLocation

    Specifies the named location for the Hyperlink object.

  • Used

    Specifies whether a layer is in use.

  • UseEntityColor

    Specifies the color source for the point cloud.

  • UseLastPlotSettings

    Applies the plotting settings of the last successful plot.

  • User

    Gets the PreferencesUser object.

  • UserCoordinateSystems

    Gets the UCSs collection for the document.

  • UseStandardScale

    Specifies if the plot is to use a standard or custom scale.

  • Utility

    Gets the Utility object for the document.

  • Value

    Specifies the current value for the property, or the object ID of the newly created cloned object.

  • VBE

    Gets the VBAIDE extensibility object.

  • Verify

    Specifies if the attribute is set for verification.

  • Version

    Gets the version of the AutoCAD application you are using.

  • VersionGUID

    Specifies the name of the Version GUID of an entry in the File Dependency List.

  • VertCellMargin

    Specifies the value of the vertical margin of cells.

  • VertexCount

    Returns the number of vertices in the SubD mesh.

  • VerticalDirection

    Specifies the vertical direction for the section plane.

  • VerticalTextPosition

    Specifies the vertical position of text in relation to the dimension line.

  • Vertices

    Gets the vertices in the section line.

  • ViewingDirection

    Specifies the viewing direction for the section plane.

  • ViewportDefault

    Specifies if the layer is to be frozen in new viewports.

  • ViewportOn

    Specifies the display status of the viewport.

  • Viewports

    Gets the Viewports collection for the document.

  • Views

    Gets the Views collection for the document.

  • ViewToPlot

    Specifies the name of the view to plot.

  • VisibilityEdge1

    Specifies the visibility of a 3DFace edge 1.

  • VisibilityEdge2

    Specifies the visibility of a 3DFace edge 2.

  • VisibilityEdge3

    Specifies the visibility of a 3DFace edge 3.

  • VisibilityEdge4

    Specifies the visibility of a 3DFace edge 4.

  • Visible

    Specifies the visibility of an object or the application.

  • VIsolineDensity

    Specifies the number of V isolines that are displayed.

  • VisualStyle

    Specifies the visual style for a viewport.

  • Volume

    Gets the volume of the solid.

  • Weights

    Gets the weight vector for spline.

  • Width

    Specifies the width of the object.

  • WindowLeft

    Specifies the left edge of the application window.

  • WindowState

    Specifies the state of the application or document window.

  • WindowTitle

    Gets the title of the document window.

  • WindowTop

    Specifies the top edge of the application window.

  • WireframeType

    Specifies the wireframe display type of the surface.

  • WorkspacePath

    Specifies the path for the database workspace file.

  • XEffectiveScaleFactor

    Specifies the effective XScale factor of the block.

  • XRefDatabase

    Gets the Database object that defines the contents of the block.

  • XRefDemandLoad

    Specifies demand loading of external references.

  • XRefEdit

    Determines if the current drawing can be edited in place when being referenced by another user.

  • XRefFadeIntensity

    Controls the dimming intensity for XRefs.

  • XRefLayerVisibility

    Determines the visibility of xref-dependent layers and specifies if nested xref path changes are saved.

  • XScaleFactor

    Specifies the X scale factor for the block or external reference (xref).

  • XVector

    Specifies the X direction of the given UCS.

  • YEffectiveScaleFactor

    Specifies the effective YScale factor of the block.

  • YScaleFactor

    Specifies the Y scale factor for the block or external reference (xref).

  • YVector

    Specifies the Y direction of the given UCS.

  • ZEffectiveScaleFactor

    Specifies the effective ZScale factor of the block.

  • ZScaleFactor

    Specifies the Z scale factor for the block or external reference (xref).


Action Property (ActiveX)

Specifies the security-related operations to be performed on a drawing.

Supported platforms: Windows only

Signature

VBA:

object.Action
object

Type: SecurityParams

The object this property applies to.

Property Value

Read-only: No

Type: Long; AcadSecurityParamsType enum

Specify one or more of the following constants for drawing encryption, drawing properties encryption, a digital signature, or a time stamp.

  • ACADSECURITYPARAMS_ENCRYPT_DATA: 0x00000001
  • ACADSECURITYPARAMS_ENCRYPT_PROPS: 0x00000002
  • ACADSECURITYPARAMS_SIGN_DATA: 0x00000010
  • ACADSECURITYPARAMS_ADD_TIMESTAMP: 0x00000020

Remarks

Each constant represents a security-related operation. When you use the Action property, at some point in the set of operations you must set the Action property to either the ACADSECURITYPARAMS_ENCRYPT_DATA constant, the ACADSECURITYPARAMS_SIGN_DATA constant, or to both.

To specify multiple security-related operations, add the constants representing the operations. For example, to sign a drawing and use a time stamp, specify the following:

ACADSECURITYPARAMS_SIGN_DATA + ACADSECURITYPARAMS_ADD_TIMESTAMP

Examples

VBA:

Sub Example_Action()
    ' This example encrypts and saves a file.
    Dim sp As AcadSecurityParams
    Set sp = GetInterfaceObject("AutoCAD.SecurityParams.20")

    sp.Action = AcadSecurityParamsType.ACADSECURITYPARAMS_ENCRYPT_DATA
    sp.Algorithm = AcadSecurityParamsConstants.ACADSECURITYPARAMS_ALGID_RC4
    sp.KeyLength = 40
    sp.Password = UCase("mypassword") 'AutoCAD converts all passwords to uppercase before applying them
    sp.ProviderName = "Microsoft Base Cryptographic Provider v1.0"
    sp.ProviderType = 1

    ThisDrawing.SaveAs "C:\MyDrawing.dwg", , sp
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Action()
    ;; This example encrypts and saves a drawing file.
    (setq acadObj (vlax-get-acad-object))
    (setq sp (vlax-create-object "AutoCAD.SecurityParams.20"))

    (vla-put-Visible acadObj :vlax-true)

    (vla-put-Action sp ACADSECURITYPARAMS_ENCRYPT_DATA)
    (vla-put-Algorithm sp ACADSECURITYPARAMS_ALGID_RC4)
    (vla-put-KeyLength sp 40)
    (vla-put-Password sp (strcase "mypassword"))
    (vla-put-ProviderName sp "Microsoft Base Cryptographic Provider v1.0")
    (vla-put-ProviderType sp 1)

    (setq doc (vla-get-ActiveDocument acadObj))
    (vla-SaveAs doc "C:\\MyDrawing.dwg" acNative sp)

    (vlax-release-object sp)
)


Active Property (ActiveX)

Determines if the document is the active document for the session.

Supported platforms: Windows only

Signature

VBA:

object.Active
object

Type: Document

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

Determines if the document is the active document for the session.

  • True: The document is the active document.
  • False: The document is not the active document.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Active()
    ' This example creates two new drawings and determines
    ' which of the drawings is the active drawing.

    Dim NewDrawing1 As AcadDocument
    Dim Newdrawing2 As AcadDocument
    Set NewDrawing1 = ThisDrawing.Application.Documents.Add("")
    Set Newdrawing2 = ThisDrawing.Application.Documents.Add("")

    Dim activeStatus As String
    Dim drawing As AcadDocument
    activeStatus = ""
    For Each drawing In ThisDrawing.Application.Documents
        If drawing.Active Then
                activeStatus = activeStatus & drawing.Name & " is active." & vbCrLf
        Else
                activeStatus = activeStatus & drawing.Name & " is not active." & vbCrLf
        End If
    Next drawing
    MsgBox activeStatus
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Active()
    ;; This example creates two new drawings and determines
    ;; which open drawing is the active drawing.
    (setq acadObj (vlax-get-acad-object))
    (setq docs (vla-get-Documents acadObj))

    (setq NewDrawing1 (vla-Add docs ""))
    (setq NewDrawing2 (vla-Add docs ""))

    (setq activeStatus "")

    (vlax-for each-doc docs
      (princ (vla-get-Active each-doc))
        (if (= (vla-get-Active each-doc) :vlax-true)
           (setq activeStatus (strcat activeStatus (vla-get-name each-doc) " is active.\n"))
           (setq activeStatus (strcat activeStatus (vla-get-name each-doc) " is not active.\n"))
        )
    )

    (alert activeStatus)
)


ActiveDimStyle Property (ActiveX)

Specifies the active dimension style.

Supported platforms: Windows only

Signature

VBA:

object.ActiveDimStyle
object

Type: Document

The object this property applies to.

Property Value

Read-only: No

Type: DimStyle

A user-specified variable declared as an AcadDimStyle object type.

Remarks

This style will be applied to all newly created dimensions. To change the style on an existing dimension, use the StyleName property.

To control the settings of the current document overrides, use the dimensioning system variables. See "System Variables" in the AutoCAD documentation for a list of dimensioning system variables.

When you change a dimensioning system variable, you are actually setting a document override for the active dimension style. You are not changing the active dimension style itself. To change the settings of a given dimension style, use the CopyFrom method. This method copies a dimension style configuration, including overrides, from a document, dimension, or other dimension style.

Dimensions created via the AutoCAD user interface are created with the active dimension style plus all document overrides. Dimensions created via ActiveX are created with the active dimension style only. To have the dimensions created via ActiveX take on the document overrides, use the CopyFrom method to copy the dimension style from the document to the active dimension style. This process will copy all existing overrides into the active dimension style.

Examples

VBA:

Sub Example_ActiveDimStyle()
    ' This example returns the current dimension style
    ' and then sets a new style.
    ' Finally, it returns the style to the previous setting.
    Dim newDimStyle As AcadDimStyle
    Dim currDimStyle As AcadDimStyle

    ' Return current dimension style of active document
    Set currDimStyle = ThisDrawing.ActiveDimStyle
    MsgBox "The current dimension style is " & currDimStyle.name, vbInformation, "ActiveDimStyle Example"

    ' Create a dimension style and makes it current
    Set newDimStyle = ThisDrawing.DimStyles.Add("TestDimStyle")
    ThisDrawing.ActiveDimStyle = newDimStyle    ' set current dimension style to newDimStyle
    MsgBox "The new dimension style is " & newDimStyle.name, vbInformation, "ActiveDimStyle Example"

    ' Reset the dimension style to its previous setting
    ThisDrawing.ActiveDimStyle = currDimStyle
    MsgBox "The dimension style is reset to " & currDimStyle.name, vbInformation, "ActiveDimStyle Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ActiveDimStyle()
    ;; This example returns the current dimension style
    ;; and then sets a new style.
    ;; Finally, it returns the style to the previous setting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get the current dimension style of the active document
    (setq currDimStyle (vla-get-ActiveDimStyle doc))
    (alert (strcat "The current dimension style is " (vla-get-Name currDimStyle)))

    ;; Create a dimension style and make it current
    (setq dimStyles (vla-get-DimStyles doc))
    (setq newDimStyle (vla-Add dimStyles "TestDimStyle"))
    (vla-put-ActiveDimStyle doc newDimStyle)    ;; set current dimension style to newDimStyle
    (alert (strcat "The new dimension style is " (vla-get-Name newDimStyle)))

    ;; Restore the previously active dimension style
    (vla-put-ActiveDimStyle doc currDimStyle)
    (alert (strcat "The dimension style is restored to " (vla-get-Name currDimStyle)))
)


ActiveDocument Property (ActiveX)

Specifies the active document (drawing file).

Supported platforms: Windows only

Signature

VBA:

object.ActiveDocument
object

Type: Application

The object this property applies to.

Property Value

Read-only: No

Type: Document

The default is drawing.dwg.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ActiveDocument()
    Dim activeDoc As AcadDocument
    ' Returns current document in AutoCAD
    Set activeDoc = ThisDrawing.Application.ActiveDocument
    MsgBox "The active document is: " & activeDoc.name, vbInformation, "ActiveDocument Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ActiveDocument()
    ;; Returns current document in AutoCAD
    (setq acadObj (vlax-get-acad-object))
    (setq activeDoc (vla-get-ActiveDocument acadObj))
    (alert (strcat "The active document is: " (vla-get-Name activeDoc)))
)


ActiveInvProject Property (ActiveX)

Specifies the active Inventor project being used by the Model Documentation feature. (Internal Use Only)

Supported platforms: Windows only

Signature

VBA:

object.ActiveInvProject
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The name of the active Autodesk Inventor project.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ActiveLayer Property (ActiveX)

Specifies the active layer.

Supported platforms: Windows only

Signature

VBA:

object.ActiveLayer
object

Type: Document

The object this property applies to.

Property Value

Read-only: No

Type: Layer

The layer that is currently active.

Remarks

New objects are placed on the active layer as they are created. To change the layer on which an existing object resides, use the Layer property for that object.

To create a new layer, use the Add method.

To change the visibility or another property of a layer, refer to the Layer object.

Examples

VBA:

Sub Example_ActiveLayer()
    ' This example returns the current layer
    ' and then adds a new layer.
    ' Finally, it returns the layer to the previous setting.
    Dim currLayer As AcadLayer
    Dim newLayer As AcadLayer

    ' Return the current layer of the active document
    Set currLayer = ThisDrawing.ActiveLayer
    MsgBox "The current layer is " & currLayer.name, vbInformation, "ActiveLayer Example"

    ' Create a Layer and make it the active layer
    Set newLayer = ThisDrawing.Layers.Add("TestLayer")
    ThisDrawing.ActiveLayer = newLayer
    MsgBox "The new layer is " & newLayer.name, vbInformation, "ActiveLayer Example"

    ' Reset the layer to its previous setting
    ThisDrawing.ActiveLayer = currLayer
    MsgBox "The active layer is reset to " & currLayer.name, vbInformation, "ActiveLayer Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ActiveLayer()
    ;; This example returns the current layer
    ;; and then adds a new layer.
    ;; Finally, it returns the layer to the previous setting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Return the current layer of the active document
    (setq currLayer (vla-get-ActiveLayer doc))
    (alert (strcat "The current layer is " (vla-get-Name currLayer)))

    ;; Create a Layer and make it the active layer
    (setq layers (vla-get-Layers doc))
    (setq newLayer (vla-Add layers "TestLayer"))
    (alert (strcat "The new layer is " (vla-get-Name newLayer)))

    ;; Restore the previous layer
    (setq currLayer (vla-get-ActiveLayer doc))
    (alert (strcat "The active layer is restored to " (vla-get-Name currLayer)))
)


ActiveLayout Property (ActiveX)

Specifies the active layout.

Supported platforms: Windows only

Signature

VBA:

object.ActiveLayout
object

Type: Document

The object this property applies to.

Property Value

Read-only: No

Type: Layout

The layout that is currently active for the drawing.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ActiveLayout()
    ' This example cycles through the documents collection
    ' and uses the ActiveLayout object to list the active layout
    ' for all open documents.

    Dim DOC As AcadDocument
    Dim msg As String

    ' If there are no open documents, then exit
    If Documents.Count = 0 Then
        MsgBox "There are no open documents!"
        Exit Sub
    End If

    msg = vbCrLf   ' Start with a space

    ' Cycle through documents and determine the active layout name using the
    ' ActiveLayout property of the document object
    For Each DOC In Documents
        msg = msg & DOC.WindowTitle & ": " & DOC.ActiveLayout.Name & vbCrLf
    Next

    ' Display results
    MsgBox "The active layouts for the open drawings are: " & msg
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ActiveLayout()
    ;; This example cycles through the documents collection
    ;; and uses the ActiveLayout object to list the active layout
    ;; for all open documents.
    (setq acadObj (vlax-get-acad-object))
    (setq docs (vla-get-Documents acadObj))

    (setq msg "")

    ;; Cycle through the Documents collection and determine the active layout name using the
    ;; ActiveLayout property of the document object
    (vlax-for each-doc docs
        (setq msg (strcat msg (vla-get-WindowTitle each-doc) ": " (vla-get-Name (vla-get-ActiveLayout each-doc)) "\n"))
    )

    ;; Display results
    (alert (strcat "The active layouts for the open drawings are: \n\n" msg))
)


ActiveLinetype Property (ActiveX)

Specifies the active linetype for the drawing.

Supported platforms: Windows only

Signature

VBA:

object.ActiveLinetype
object

Type: Document

The object this property applies to.

Property Value

Read-only: No

Type: Linetype

The active linetype for the drawing.

Remarks

The specified linetype must already exist in the drawing. To add a new linetype, use the Add method.

Examples

VBA:

Sub Example_ActiveLinetype()
    ' This example finds the current linetype. It then sets
    ' the new linetype to be the first entry in the linetype
    ' collection that is not equal to the current linetype.
    ' Finally, it resets the active linetype to the original
    ' setting.

    Dim currLineType As AcadLineType
    Dim newLineType As AcadLineType

    ' Find the current LineType of the active document
    Set currLineType = ThisDrawing.ActiveLinetype
    MsgBox "The current linetype is " & currLineType.name, vbInformation, "ActiveLinetype Example"

    ' Set the current Linetype to anything else in the collection
    Dim entry
    Dim found As Boolean
    For Each entry In ThisDrawing.Linetypes
        If StrComp(entry.name, currLineType.name, 1) <> 0 Then
            Set newLineType = entry
            found = True
            Exit For
        End If
    Next
    If found Then
        ThisDrawing.ActiveLinetype = newLineType
        MsgBox "The new linetype is " & newLineType.name, vbInformation, "ActiveLinetype Example"
        ' Reset the linetype to the previous setting
        ThisDrawing.ActiveLinetype = currLineType
        MsgBox "The active linetype is reset to " & currLineType.name, vbInformation, "ActiveLinetype Example"
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ActiveLinetype()
    ;; This example finds the current linetype. It then sets
    ;; the new linetype to be the first entry in the linetype
    ;; collection that is not equal to the current linetype.
    ;; Finally, it resets the active linetype to the original
    ;; setting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Find the current LineType of the active document
    (setq currLineType (vla-get-ActiveLinetype doc))
    (alert (strcat "The current linetype is " (vla-get-Name currLineType)))

    ;; Set the current Linetype to anything else in the collection
    (setq newLineType nil)
    (setq found :vlax-false)
    (vlax-for each-linetype (vla-get-Linetypes doc)
        (if (and (/= (vla-get-Name each-linetype) (vla-get-Name currLineType)) (/= found :vlax-true))
            (progn
                (setq newLineType each-linetype)
                (setq found :vlax-true)
            )
        )
    )

    (if (= found :vlax-true)
        (progn
            (vla-put-ActiveLinetype doc newLineType)
            (alert (strcat "The new linetype is " (vla-get-Name newLineType)))
            ;; Restore the previous linetype
            (vla-put-ActiveLinetype doc currLineType)
            (alert (strcat "The active linetype is restored to " (vla-get-Name currLineType)))
        )
    )
)


ActiveMaterial Property (ActiveX)

Specifies the current default material for this document.

Supported platforms: Windows only

Signature

VBA:

object.ActiveMaterial
object

Type: Document

The object to which this property applies.

Property Value

Read-only: No

Type: Material

The material assigned to new objects.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ActiveProfile Property (ActiveX)

Specifies the active profile for the AutoCAD session.

Supported platforms: Windows only

Signature

VBA:

object.ActiveProfile
object

Type: PreferencesProfiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The name of the active profile.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ActiveProfile()
    ' This example returns the current setting of
    ' ActiveProfile.

    Dim preferences As AcadPreferences
    Dim currActiveProfile As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current ActiveProfile value
    currActiveProfile = preferences.Profiles.ActiveProfile
    MsgBox "The current value for ActiveProfile is " & currActiveProfile, vbInformation, "ActiveProfile Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ActiveProfile()
    ;; This example returns the current setting of
    ;; ActiveProfile.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current ActiveProfile value
    (setq currActiveProfile (vla-get-ActiveProfile (vla-get-Profiles preferences)))
    (alert (strcat "The current value for ActiveProfile is " currActiveProfile))
)


ActivePViewport Property (ActiveX)

Specifies the active paper space viewport for the drawing.

Supported platforms: Windows only

Signature

VBA:

object.ActivePViewport
object

Type: Document

The object this property applies to.

Property Value

Read-only: No

Type: PViewport

The active paper space viewport.

Remarks

A viewport must be set active using this property before you can see any changes to it.

Examples

VBA:

Sub Example_ActivePViewport()

    Dim newPViewport As AcadPViewport
    Dim centerPoint(0 To 2) As Double
    Dim height As Double
    Dim width As Double
    height = 5#
    width = 5#
    centerPoint(0) = 5#: centerPoint(1) = 5#: centerPoint(2) = 0#

    ' Create a paper space Viewport object
    ThisDrawing.ActiveSpace = acPaperSpace
    Set newPViewport = ThisDrawing.PaperSpace.AddPViewport(centerPoint, width, height)
    ZoomAll
    newPViewport.DISPLAY (True)

    ' Before making a paper space Viewport active,
    ' the mspace property needs to be True
    ThisDrawing.mspace = True
    ThisDrawing.ActivePViewport = newPViewport
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ActivePViewport()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq centerPoint (vlax-3d-point 5 5 0)
          height 5.0
          width 5.0)

    ;; Create a paper space Viewport object
    (vla-put-ActiveSpace doc acPaperSpace)
    (setq paperSpace (vla-get-PaperSpace doc))
    (setq newPViewport (vla-AddPViewport paperSpace centerPoint width height))
    (vla-ZoomAll acadObj)
    (vla-Display newPViewport :vlax-true)

    ;; Before making a paper space Viewport active,
    ;; the mspace property needs to be True
    (vla-put-MSpace doc :vlax-true)
    (vla-put-ActivePViewport doc newPViewport)
)


ActiveSelectionSet Property (ActiveX)

Gets the active selection set for the drawing.

Supported platforms: Windows only

Signature

VBA:

object.ActiveSelectionSet
object

Type: Document

The object this property applies to.

Property Value

Read-only: Yes

Type: SelectionSet

The active selection set for the drawing.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ActiveSelectionSet()
    Dim sset As AcadSelectionSet
    ' The following example returns current selection set from current drawing
    Set sset = ThisDrawing.ActiveSelectionSet
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ActiveSelectionSet()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; The following example returns the current selection set from the current drawing
    (setq sset (vla-get-ActiveSelectionSet doc))
)


ActiveSpace Property (ActiveX)

Toggles the active space between paper space and model space.

Supported platforms: Windows only

Signature

VBA:

object.ActiveSpace
object

Type: Document

The object this property applies to.

Property Value

Read-only: No

Type: acActiveSpace enum

  • acModelSpace
  • acPaperSpace

Remarks

For model space floating viewports, this value is set to acPaperSpace. Even though you have the capability of editing the model, you are still technically in paper space.

For more information on this property, see the PViewport object.

NoteThe value of this property is stored in the TILEMODE system variable.

Examples

VBA:

Sub Example_ActiveSpace()
    ' This example toggles the ActiveSpace property from
    ' paper space to model space.
    ' Display the current setting for TILEMODE
    MsgBox "TILEMODE = " & ThisDrawing.ActiveSpace, vbInformation, "ActiveSpace Example"

    ' Changes active document to paper space
    ThisDrawing.ActiveSpace = acPaperSpace
    MsgBox "TILEMODE = " & ThisDrawing.ActiveSpace, vbInformation, "ActiveSpace Example"

    ' Changes active document to model space
    ThisDrawing.ActiveSpace = acModelSpace
    MsgBox "TILEMODE = " & ThisDrawing.ActiveSpace, vbInformation, "ActiveSpace Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ActiveSpace()
    ;; This example toggles the ActiveSpace property from
    ;; paper space to model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Display the current setting for TILEMODE
    (alert (strcat "TILEMODE = " (itoa (vla-get-ActiveSpace doc))))

    ;; Changes active document to paper space
    (vla-put-ActiveSpace doc acPaperSpace)
    (alert (strcat "TILEMODE = " (itoa (vla-get-ActiveSpace doc))))

    ;; Changes active document to model space
    (vla-put-ActiveSpace doc acModelSpace)
    (alert (strcat "TILEMODE = " (itoa (vla-get-ActiveSpace doc))))
)


ActiveTextStyle Property (ActiveX)

Specifies the active text style for the drawing.

Supported platforms: Windows only

Signature

VBA:

object.ActiveTextStyle
object

Type: Document

The object this property applies to.

Property Value

Read-only: No

Type: TextStyle

The active text style for the drawing.

Remarks

New text added to the drawing will adopt the active text style. Existing text that has no distinct text style specified will adopt the new active text style.

Changes made to the current active text style will become visible only after that text style is reset as the active text style. To reset the active text style, simply call this property with the updated text style object.

NoteA call to the Regen method is necessary to see this change.

To specify a distinct text style for an object so it will not change along with the active text style, use the StyleName property.

Examples

VBA:

Sub Example_ActiveTextStyle()
    ' This example returns the current text style
    ' and then sets a new style.
    ' Finally, it returns the style to the previous setting.
    Dim newTextStyle As AcadTextStyle
    Dim currTextStyle As AcadTextStyle

    ' Return current text style of active document
    Set currTextStyle = ThisDrawing.ActiveTextStyle
    MsgBox "The current text style is " & currTextStyle.name, vbInformation, "ActiveTextStyle Example"

    ' Create a text style and make it current
    Set newTextStyle = ThisDrawing.TextStyles.Add("TestTextStyle")
    ThisDrawing.ActiveTextStyle = newTextStyle
    MsgBox "The new text style is " & newTextStyle.name, vbInformation, "ActiveTextStyle Example"

    ' Reset the text style to its previous setting
    ThisDrawing.ActiveTextStyle = currTextStyle
    MsgBox "The text style is reset to " & currTextStyle.name, vbInformation, "ActiveTextStyle Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ActiveTextStyle()
    ;; This example returns the current text style
    ;; and then sets a new style.
    ;; Finally, it returns the style to the previous setting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Return current text style of active document
    (setq currTextStyle (vla-get-ActiveTextStyle doc))
    (alert (strcat "The current text style is " (vla-get-Name currTextStyle)))

    ;; Create a text style and make it current
    (setq textStyles (vla-get-TextStyles doc))
    (setq newTextStyle (vla-Add textStyles "TestTextStyle"))
    (vla-put-ActiveTextStyle doc newTextStyle)
    (alert (strcat "The new text style is " (vla-get-Name newTextStyle)))

    ;; Restore the previous text style
    (vla-put-ActiveTextStyle doc currTextStyle)
    (alert (strcat "The text style is restored to " (vla-get-Name currTextStyle)))
)


ActiveUCS Property (ActiveX)

Specifies the active UCS for the drawing.

Supported platforms: Windows only

Signature

VBA:

object.ActiveUCS
object

Type: Document

The object this property applies to.

Property Value

Read-only: No

Type: UCS

The active UCS for the drawing.

Remarks

Changes made to the current active UCS will become visible only after that UCS is reset as the active UCS.

If you try to get the active UCS value when the current UCS is unsaved, an error will occur. It is recommended that you confirm that the value of the UCSNAME system variable is not empty before you get the active UCS value. Alternatively, you can add a new UCS object and set it to active before getting the active UCS value.

Examples

VBA:

Sub Example_ActiveUCS()
    ' This example returns the current saved UCS (or saves a new one dynamically)
    ' and then sets a new UCS.
    ' Finally, it returns the UCS to the previous setting.

    Dim newUCS As AcadUCS
    Dim currUCS As AcadUCS
    Dim origin(0 To 2) As Double
    Dim xAxis(0 To 2) As Double
    Dim yAxis(0 To 2) As Double

    ' Get the current saved UCS of the active document. If the current UCS is
    ' not saved, then add a new UCS to the UserCoordinateSystems collection
    If ThisDrawing.GetVariable("UCSNAME") = "" Then
        ' Current UCS is not saved so get the data and save it
        With ThisDrawing
            Set currUCS = .UserCoordinateSystems.Add( _
                            .GetVariable("UCSORG"), _
                            .Utility.TranslateCoordinates(.GetVariable("UCSXDIR"), acUCS, acWorld, 0), _
                            .Utility.TranslateCoordinates(.GetVariable("UCSYDIR"), acUCS, acWorld, 0), _
                            "OriginalUCS")
        End With
    Else
        Set currUCS = ThisDrawing.ActiveUCS  'current UCS is saved
    End If

    MsgBox "The current UCS is " & currUCS.name, vbInformation, "ActiveUCS Example"

    ' Create a UCS and make it current
    origin(0) = 0: origin(1) = 0: origin(2) = 0
    xAxis(0) = 1: xAxis(1) = 1: xAxis(2) = 0
    yAxis(0) = -1: yAxis(1) = 1: yAxis(2) = 0
    Set newUCS = ThisDrawing.UserCoordinateSystems.Add(origin, xAxis, yAxis, "TestUCS")
    ThisDrawing.ActiveUCS = newUCS
    MsgBox "The new UCS is " & newUCS.name, vbInformation, "ActiveUCS Example"

    ' Reset the UCS to its previous setting
    ThisDrawing.ActiveUCS = currUCS
    MsgBox "The UCS is reset to " & currUCS.name, vbInformation, "ActiveUCS Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ActiveUCS()
    ;; This example returns the current saved UCS (or saves a new one dynamically)
    ;; and then sets a new UCS.
    ;; Finally, it returns the UCS to the previous setting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq UCSs (vla-get-UserCoordinateSystems doc))

    ;; Get the current saved UCS of the active document. If the current UCS is
    ;; not saved, then add a new UCS to the UserCoordinateSystems collection
    (if (= (vlax-variant-value (vla-GetVariable doc "UCSNAME")) "")
        (progn
               (setq utility (vla-get-Utility doc))
            (setq currUCS (vla-Add UCSs
                                      (vla-GetVariable doc "UCSORG")
                                      (vla-TranslateCoordinates utility (vla-GetVariable doc "UCSXDIR") acUCS acWorld :vlax-false)
                                      (vla-TranslateCoordinates utility (vla-GetVariable doc "UCSYDIR") acUCS acWorld :vlax-false)
                                      "OriginalUCS"
                                   )
            )
        )
        (setq currUCS (vla-get-ActiveUCS doc))  ;; current UCS is saved
    )

    (alert (strcat "The current UCS is " (vla-get-Name currUCS)))

    ;; Create a UCS and make it current
    (setq origin (vlax-3d-point 0 0 0)
          xAxis (vlax-3d-point 1 1 0)
          yAxis (vlax-3d-point -1 1 0))

    (setq newUCS (vla-Add UCSs origin xAxis yAxis "TestUCS"))
    (vla-put-ActiveUCS doc newUCS)
    (alert (strcat "The new UCS is " (vla-get-Name newUCS)))

    ;; Restore the previous UCS
    (vla-put-ActiveUCS doc currUCS)
    (alert (strcat "The UCS is restored to " (vla-get-Name currUCS)))
)


ActiveViewport Property (ActiveX)

Specifies the active viewport for the drawing.

Supported platforms: Windows only

Signature

VBA:

object.ActiveViewport
object

Type: Document

The object this property applies to.

Property Value

Read-only: No

Type: Viewport

The active viewport for the drawing.

Remarks

Changes made to the current active viewport will become visible only after you reset the viewport as the active viewport. To reset the active viewport, simply call this property with the updated viewport object.

Use the StatusID property to determine if a viewport is currently active.

You can iterate through existing viewports to find a particular viewport. To do this, first identify the name of the viewport configuration on which the desired viewport resides using the Name property. Additionally, if the viewport configuration has been split, each individual viewport on the configuration can be identified through the LowerLeftCorner and UpperRightCorner properties.

The LowerLeftCorner and UpperRightCorner properties represent the graphic placement of the viewport on the display. These properties are defined as follows (using a four-way split as an example):

Viewport 1—LowerLeftCorner = (0, .5), UpperRightCorner = (.5, 1)

Viewport 2—LowerLeftCorner = (.5, .5), UpperRightCorner = (1, 1)

Viewport 3—LowerLeftCorner = (0, 0), UpperRightCorner = (.5, .5)

Viewport 4—LowerLeftCorner = (.5, 0), UpperRightCorner = (1, .5)

Examples

VBA:

Sub Example_ActiveViewport()
    ' This example returns the current viewport.
    ' It creates a new viewport and makes it active, and
    ' Then it splits the viewport into four windows.
    ' It then takes one of the four windows, and splits that
    ' window horizontally into half.
    Dim currViewport As AcadViewport
    Dim newViewport As AcadViewport

    ' Returns current viewport of active document
    Set currViewport = ThisDrawing.ActiveViewport
    MsgBox "The current viewport is " & currViewport.name, vbInformation, "ActiveViewport Example"

    ' Create a new viewport and make it active
    Set newViewport = ThisDrawing.Viewports.Add("TESTVIEWPORT")
    ThisDrawing.ActiveViewport = newViewport
    MsgBox "The new active viewport is " & newViewport.name, vbInformation, "ActiveViewport Example"

    ' Split the viewport in four windows
    newViewport.Split acViewport4

    ' Make the newly split viewport active
    ThisDrawing.ActiveViewport = newViewport

    ' Note that current drawing layout will show four windows.
    ' However, only one of the windows will be active.
    ' The following code sets the lower-left corner window
    ' to be the active window and then splits that
    ' window into two horizontal windows.
    Dim entry
    For Each entry In ThisDrawing.Viewports
        If entry.name = "TESTVIEWPORT" Then
            Dim lowerLeft
            lowerLeft = entry.LowerLeftCorner
            If lowerLeft(0) = 0 And lowerLeft(1) = 0 Then
                Set newViewport = entry
                Exit For
            End If
        End If
    Next

    newViewport.Split acViewport2Horizontal
    ThisDrawing.ActiveViewport = newViewport
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ActiveViewport()
    ;; This example returns the current viewport.
    ;; It creates a new viewport and makes it active, and
    ;; Then it splits the viewport into four windows.
    ;; It then takes one of the four windows, and splits that
    ;; window horizontally into half.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Returns current viewport of active document
    (setq currViewport (vla-get-ActiveViewport doc))
    (alert (strcat "The current viewport is " (vla-get-Name currViewport)))

    ;; Create a new viewport and make it active
    (setq viewports (vla-get-Viewports doc))
    (setq newViewport (vla-Add viewports "TESTVIEWPORT"))
    (vla-put-ActiveViewport doc newViewport)
    (alert (strcat "The new active viewport is " (vla-get-Name newViewport)))

    ;; Split the viewport in four windows
    (vla-Split newViewport acViewport4)

    ;; Make the newly split viewport active
    (vla-put-ActiveViewport doc newViewport)

    ;; Note that current drawing layout will show four windows.
    ;; However, only one of the windows will be active.
    ;; The following code sets the lower-left corner window
    ;; to be the active window and then splits that
    ;; window into two horizontal windows.
    (vlax-for each-viewport viewports
        (if (= (vla-get-Name each-viewport) "TESTVIEWPORT")
            (progn
                (setq lowerLeft (vla-get-LowerLeftCorner each-viewport))

                (if (and (= (vlax-safearray-get-element (vlax-variant-value lowerLeft) 0) 0)
                         (= (vlax-safearray-get-element (vlax-variant-value lowerLeft) 1) 0)
                    )
                    (setq newViewport each-viewport)
                )
            )
        )
    )
    (vla-Split newViewport acViewport2Horizontal)
    (vla-put-ActiveViewport doc newViewport)
)


ADCInsertUnitsDefaultSource Property (ActiveX)

Determines the units to use automatically for objects in DesignCenter for a source drawing that does not have assigned insert units.

Supported platforms: Windows only

Signature

VBA:

object.ADCInsertUnitsDefaultSource
object

Type: PreferencesUser

The object this property applies to.

Property Value

Read-only: No

Type: acInsertUnits enum

  • acInsertUnitsUnitless
  • acInsertUnitsInches
  • acInsertUnitsFeet
  • acInsertUnitsMiles
  • acInsertUnitsMillimeters
  • acInsertUnitsCentimeters
  • acInsertUnitsMeters
  • acInsertUnitsKilometers
  • acInsertUnitsMicroinches
  • acInsertUnitsMils
  • acInsertUnitsYards
  • acInsertUnitsAngstroms
  • acInsertUnitsNanometers
  • acInsertUnitsMicrons
  • acInsertUnitsDecimeters
  • acInsertUnitsDecameters
  • acInsertUnitsHectometers
  • acInsertUnitsGigameters
  • acInsertUnitsAstronomicalUnits
  • acInsertUnitsLightYears
  • acInsertUnitsParsecs

Remarks

The initial value for this property is acInsertUnitsUnitless.

NoteThe value of this property is stored in the INSUNITSDEFSOURCE system variable.

Examples

VBA:

Sub Example_ADCInsertUnitsDefaultSource()
    ' This example reads and modifies the ADCInsertUnitsDefaultSource
    ' preference value.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesUser
    Dim originalValue As Integer, newValue As Integer

    ' Get the user preferences object

    Set ACADPref = ThisDrawing.Application.preferences.User

    ' Read and display the original value
    originalValue = ACADPref.ADCInsertUnitsDefaultSource
    MsgBox "The ADCInsertUnitsDefaultSource preference is set to: " & originalValue

    ' Modify the ADCInsertUnitsDefaultSource preference by toggling the value
    ACADPref.ADCInsertUnitsDefaultSource = acInsertUnitsMillimeters

    MsgBox "The ADCInsertUnitsDefaultSource preference has been set to: " & ACADPref.ADCInsertUnitsDefaultSource

    ' Reset the preference back to its original value
    ACADPref.ADCInsertUnitsDefaultSource = originalValue
    MsgBox "The ADCInsertUnitsDefaultSource preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ADCInsertUnitsDefaultSource()
    ;; This example reads and modifies the ADCInsertUnitsDefaultSource
    ;; preference value.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))

    ;; Get the user preferences object
    (setq pref (vla-get-Preferences acadObj))
    (setq user (vla-get-User pref))

    ;; Read and display the original value
    (setq originalValue (vla-get-ADCInsertUnitsDefaultSource user))
    (alert (strcat "The ADCInsertUnitsDefaultSource preference is set to: " (itoa originalValue)))

    ;; Modify the ADCInsertUnitsDefaultSource preference by toggling the value
    (vla-put-ADCInsertUnitsDefaultSource user acInsertUnitsMillimeters)
    (alert (strcat "The ADCInsertUnitsDefaultSource preference has been set to: " (itoa (vla-get-ADCInsertUnitsDefaultSource user))))

    ;; Restore the preference back to its original value
    (vla-put-ADCInsertUnitsDefaultSource user originalValue)
    (alert (strcat "The ADCInsertUnitsDefaultSource preference was restored back to: " (itoa originalValue)))
)


ADCInsertUnitsDefaultTarget Property (ActiveX)

Determines the units to use automatically for objects in DesignCenter for a target drawing that does not have assigned insert units.

Supported platforms: Windows only

Signature

VBA:

object.ADCInsertUnitsDefaultTarget
object

Type: PreferencesUser

The object this property applies to.

Property Value

Read-only: No

Type: acInsertUnits enum

  • acInsertUnitsUnitless
  • acInsertUnitsInches
  • acInsertUnitsFeet
  • acInsertUnitsMiles
  • acInsertUnitsMillimeters
  • acInsertUnitsCentimeters
  • acInsertUnitsMeters
  • acInsertUnitsKilometers
  • acInsertUnitsMicroinches
  • acInsertUnitsMils
  • acInsertUnitsYards
  • acInsertUnitsAngstroms
  • acInsertUnitsNanometers
  • acInsertUnitsMicrons
  • acInsertUnitsDecimeters
  • acInsertUnitsDecameters
  • acInsertUnitsHectometers
  • acInsertUnitsGigameters
  • acInsertUnitsAstronomicalUnits
  • acInsertUnitsLightYears
  • acInsertUnitsParsecs

Remarks

The initial value for this property is acInsertUnitsUnitless.

NoteThe value of this property is stored in the INSUNITSDEFTARGET system variable.

Examples

VBA:

Sub Example_ADCInsertUnitsDefaultTarget()
    ' This example reads and modifies the ADCInsertUnitsDefaultTarget
    ' preference value.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesUser
    Dim originalValue As Integer, newValue As Integer

    ' Get the user preferences object

    Set ACADPref = ThisDrawing.Application.preferences.User

    ' Read and display the original value
    originalValue = ACADPref.ADCInsertUnitsDefaultTarget
    MsgBox "The ADCInsertUnitsDefaultTarget preference is set to: " & originalValue

    ' Modify the ADCInsertUnitsDefaultTarget preference by toggling the value
    ACADPref.ADCInsertUnitsDefaultTarget = acInsertUnitsMillimeters

    MsgBox "The ADCInsertUnitsDefaultTarget preference has been set to: " & ACADPref.ADCInsertUnitsDefaultTarget

    ' Reset the preference back to its original value
    ACADPref.ADCInsertUnitsDefaultTarget = originalValue
    MsgBox "The ADCInsertUnitsDefaultTarget preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ADCInsertUnitsDefaultTarget()
    ;; This example reads and modifies the ADCInsertUnitsDefaultTarget
    ;; preference value.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))

    ;; Get the user preferences object
    (setq pref (vla-get-Preferences acadObj))
    (setq user (vla-get-User pref))

    ;; Read and display the original value
    (setq originalValue (vla-get-ADCInsertUnitsDefaultTarget user))
    (alert (strcat "The ADCInsertUnitsDefaultTarget preference is set to: " (itoa originalValue)))

    ;; Modify the ADCInsertUnitsDefaultTarget preference by toggling the value
    (vla-put-ADCInsertUnitsDefaultTarget user acInsertUnitsMillimeters)
    (alert (strcat "The ADCInsertUnitsDefaultTarget preference has been set to: " (itoa (vla-get-ADCInsertUnitsDefaultTarget user))))

    ;; Restore the preference back to its original value
    (vla-put-ADCInsertUnitsDefaultTarget user originalValue)
    (alert (strcat "The ADCInsertUnitsDefaultTarget preference was restored back to: " (itoa originalValue)))
)


AdjustForBackground Property (ActiveX)

Determines whether the underlay colors are adjusted for the current background color.

Supported platforms: Windows only

Signature

VBA:

object.AdjustForBackground
object

Type: DgnUnderlay, DwfUnderlay, PdfUnderlay

The object to which this property applies.

Property Value

Read-only: No

Type: Boolean

  • True: Colors in the underlay are adjusted.
  • False: Colors in the underlay are not adjusted.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


AffectsGraphics Property (ActiveX)

Specifies that the entry in the File Dependency List affects graphics.

Supported platforms: Windows only

Signature

VBA:

object.AffectsGraphics
object

Type: FileDependency

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: Entry affects the display.
  • False: Entry does not affect the display.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AffectsGraphics()
    ' This example reads information from a File Dependency List
    ' Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ' \Sample\Sheet Sets\Architectural\A-01.dwg

    Dim objFDLCol As AutoCAD.AcadFileDependencies
    Dim objFDL As AutoCAD.AcadFileDependency

    Set objFDLCol = ThisDrawing.FileDependencies
    MsgBox ("The number of entries in the File Dependency List is " & objFDLCol.count & ".")

    Dim strTemp As String
    For Each objFDL In objFDLCol
        strTemp = "Affects graphics?: " & vbTab & objFDL.AffectsGraphics
        strTemp = strTemp & vbCrLf & "Feature: " & vbTab & objFDL.Feature
        strTemp = strTemp & vbCrLf & "FileName: " & vbTab & objFDL.FileName
        strTemp = strTemp & vbCrLf & "FileSize: " & vbTab & objFDL.FileSize
        strTemp = strTemp & vbCrLf & "Fingerprint GUID: " & vbTab & objFDL.FingerprintGuid
        strTemp = strTemp & vbCrLf & "FoundPath: " & vbTab & objFDL.FoundPath
        strTemp = strTemp & vbCrLf & "FullFileName: " & vbTab & objFDL.FullFileName
        strTemp = strTemp & vbCrLf & "Index: " & vbTab & objFDL.Index
        strTemp = strTemp & vbCrLf & "Modified?: " & vbTab & objFDL.IsModified
        strTemp = strTemp & vbCrLf & "ReferenceCount: " & vbTab & objFDL.ReferenceCount
        strTemp = strTemp & vbCrLf & "Timestamp: " & vbTab & objFDL.TimeStamp
        strTemp = strTemp & vbCrLf & "Version GUID: " & vbTab & objFDL.VersionGuid
        MsgBox strTemp
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AffectsGraphics()
    ;; This example reads information from a File Dependency List
    ;; Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ;; .\\Sample\\Sheet Sets\\Architectural\\A-01.dwg
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq objFDLCol (vla-get-FileDependencies doc))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))

    (setq strTemp "")
    (vlax-for each-objFDL objFDLCol
        (setq strTemp (strcat "Affects graphics?: " (if (= (vla-get-AffectsGraphics each-objFDL) :vlax-true) "True" "False")))
        (setq strTemp (strcat strTemp
                                       "\nFeature: " (vla-get-Feature each-objFDL)
                                       "\nFileName: " (vla-get-FileName each-objFDL)
                                       "\nFileSize: " (itoa (vla-get-FileSize each-objFDL))
                                       "\nFingerprint GUID: " (vla-get-FingerprintGuid each-objFDL)
                                       "\nFoundPath: " (vla-get-FoundPath each-objFDL)
                                       "\nFullFileName: " (vla-get-FullFileName each-objFDL)
                                       "\nIndex: " (itoa (vla-get-Index each-objFDL))
                                       "\nModified?: " (if (= (vla-get-IsModified each-objFDL) :vlax-true) "True" "False")
                                       "\nReferenceCount: " (itoa (vla-get-ReferenceCount each-objFDL))
                                       "\nTimeStamp: " (itoa (vla-get-TimeStamp each-objFDL))
                                       "\nVersion GUID: " (vla-get-VersionGuid each-objFDL)
                         )
        )
        (alert strTemp)
    )
)


Algorithm Property (ActiveX)

Specifies the identifier of the encryption algorithm.

Supported platforms: Windows only

Signature

VBA:

object.Algorithm
object

Type: SecurityParams

The object this property applies to.

Property Value

Read-only: No

Type: Long; AcadSecurityParamsConstants enum

Specify only the following constant.

  • ACADSECURITYPARAMS_ALGID_RC4: 0x00006801

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Algorithm()
    ' This example encrypts and saves a file.
    Dim sp As AcadSecurityParams
    Set sp = GetInterfaceObject("AutoCAD.SecurityParams.20")

    sp.Action = AcadSecurityParamsType.ACADSECURITYPARAMS_ENCRYPT_DATA
    sp.Algorithm = AcadSecurityParamsConstants.ACADSECURITYPARAMS_ALGID_RC4
    sp.KeyLength = 40
    sp.Password = UCase("mypassword") 'AutoCAD converts all passwords to uppercase before applying them
    sp.ProviderName = "Microsoft Base Cryptographic Provider v1.0"
    sp.ProviderType = 1

    ThisDrawing.SaveAs "C:\MyDrawing.dwg", , sp
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Algorithm()
    ;; This example encrypts and saves a drawing file.

    (setq acadObj (vlax-get-acad-object))
    (setq sp (vlax-create-object "AutoCAD.SecurityParams.20"))

    (vla-put-Visible acadObj :vlax-true)

    (vla-put-Action sp ACADSECURITYPARAMS_ENCRYPT_DATA)
    (vla-put-Algorithm sp ACADSECURITYPARAMS_ALGID_RC4)
    (vla-put-KeyLength sp 40)
    (vla-put-Password sp (strcase "mypassword"))
    (vla-put-ProviderName sp "Microsoft Base Cryptographic Provider v1.0")
    (vla-put-ProviderType sp 1)

    (setq doc (vla-get-ActiveDocument acadObj))
    (vla-SaveAs doc "C:\\MyDrawing.dwg" acNative sp)

    (vlax-release-object sp)
)


Alignment Property (ActiveX)

Specifies both the vertical and horizontal alignments for the attribute, attribute reference, or text.

Supported platforms: Windows only

Signature

VBA:

object.Alignment
object

Type: Attribute, AttributeRef, Text

The objects this property applies to.

Property Value

Read-only: No

Type: acAlignment enum

  • acAlignmentLeft
  • acAlignmentCenter
  • acAlignmentRight
  • acAlignmentAligned
  • acAlignmentMiddle
  • acAlignmentFit
  • acAlignmentTopLeft
  • acAlignmentTopCenter
  • acAlignmentTopRight
  • acAlignmentMiddleLeft
  • acAlignmentMiddleCenter
  • acAlignmentMiddleRight
  • acAlignmentBottomLeft
  • acAlignmentBottomCenter
  • acAlignmentBottomRight

Remarks

Text aligned to acAlignmentLeft uses the InsertionPoint property to position the text.

Text aligned to acAlignmentAligned or acAlignmentFit uses both the InsertionPoint and TextAlignmentPoint properties to position the text.

Text aligned to any other position uses the TextAlignmentPoint property to position the text.

Examples

VBA:

Sub Example_Alignment()
   ' This example creates a text object in model space and
   ' demonstrates setting the alignment of the new text string

    Dim textObj As AcadText
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double, alignmentPoint(0 To 2) As Double
    Dim height As Double
    Dim oldPDMODE As Integer
    Dim pointObj As AcadPoint

    ' Define the new Text object
    textString = "Hello, World."
    insertionPoint(0) = 3: insertionPoint(1) = 3: insertionPoint(2) = 0
    alignmentPoint(0) = 3: alignmentPoint(1) = 3: alignmentPoint(2) = 0
    height = 0.5

    ' Create the Text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)

    oldPDMODE = ThisDrawing.GetVariable("PDMODE")   ' Record existing point style

    ' Create a crosshair over the text alignment point
    ' to better visualize the alignment process
    Set pointObj = ThisDrawing.ModelSpace.AddPoint(alignmentPoint)

    ThisDrawing.SetVariable "PDMODE", 2             ' Set point style to crosshair

    ThisDrawing.Application.ZoomAll

    ' Set the text alignment to a value other than acAlignmentLeft, which is the default.
    ' Create a point that will act as an alignment reference point
    textObj.Alignment = acAlignmentRight

    ' Create the text alignment reference point and the text will automatically
    ' align to the right of this point, because the text
    ' alignment was set to acAlignmentRight
    textObj.TextAlignmentPoint = alignmentPoint
    ThisDrawing.Regen acActiveViewport
    MsgBox "The Text object is now aligned to the right of the alignment point"

    ' Center the text to the alignment point
    textObj.Alignment = acAlignmentCenter
    ThisDrawing.Regen acActiveViewport
    MsgBox "The Text object is now centered to the alignment point"

    ' Reset point style
    ThisDrawing.SetVariable "PDMODE", oldPDMODE
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Alignment()
   ;; This example creates a text object in model space and
   ;; demonstrates setting the alignment of the new text string
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Text object
    (setq insertionPoint (vlax-3d-point 3 3 0)
          alignmentPoint (vlax-3d-point 3 3 0)
          textString "Hello, World."
          height 0.5)

    ;; Create the Text object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq textObj (vla-AddText modelSpace textString insertionPoint height))

    (setq oldPDMODE (vlax-variant-value (vla-GetVariable doc "PDMODE")))   ;; Record existing point style

    ;; Create a crosshair over the text alignment point
    ;; to better visualize the alignment process
    (setq pointObj (vla-AddPoint modelSpace alignmentPoint))

    (vla-SetVariable doc "PDMODE" 2)             ;; Set point style to crosshair

    (vla-ZoomAll acadObj)

    ;; Set the text alignment to a value other than acAlignmentLeft, which is the default.
    ;; Create a point that will act as an alignment reference point
    (vla-put-Alignment textObj acAlignmentRight)

    ;; Create the text alignment reference point and the text will automatically
    ;; align to the right of this point, because the text
    ;; alignment was set to acAlignmentRight
    (vla-put-TextAlignmentPoint textObj alignmentPoint)
    (vla-Regen doc acActiveViewport)
    (alert "The Text object is now aligned to the right of the alignment point.")

    ;; Center the text to the alignment point
    (vla-put-Alignment textObj acAlignmentCenter)
    (vla-Regen doc acActiveViewport)
    (alert "The Text object is now centered to the alignment point.")

    ;; Reset point style
    (vla-SetVariable doc "PDMODE" oldPDMODE)
)


AlignmentPointAcquisition Property (ActiveX)

Specifies how AutoAlignment points are acquired.

Supported platforms: Windows only

Signature

VBA:

object.AlignmentPointAcquisition
object

Type: PreferencesDrafting

The object this property applies to.

Property Value

Read-only: No

Type: acAlignmentPointAcquisition enum

  • acAlignPntAcquisitionAutomatic: AutoAlignment points are acquired automatically.
  • acAlignPntAcquisitionShiftToAcquire: The user must use the Shift key to acquire AutoAlignment points.

Remarks

The initial value for this property is acAlignPntAcquisitionAutomatic.

Examples

VBA:

Sub Example_AlignmentPointAcquisition()
    ' This example reads and modifies the preference value that controls
    ' how AutoAlignment points are acquired. When finished, this example resets
    ' the preference value back to its original value.

    Dim ACADPref As AcadPreferencesDrafting
    Dim originalValue As Variant, newValue As Variant

    ' Get the drafting preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Drafting

    ' Read and display the original value
    originalValue = ACADPref.AlignmentPointAcquisition
    MsgBox "The AlignmentPointAcquisition preference is: " & originalValue

    ' Toggle and display the AlignmentPointAcquisition preference
    If ACADPref.AlignmentPointAcquisition = acAlignPntAcquisitionAutomatic Then
        ACADPref.AlignmentPointAcquisition = acAlignPntAcquisitionShiftToAcquire
    Else
        ACADPref.AlignmentPointAcquisition = acAlignPntAcquisitionAutomatic
    End If

    newValue = ACADPref.AlignmentPointAcquisition
    MsgBox "The AlignmentPointAcquisition preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.AlignmentPointAcquisition = originalValue
    MsgBox "The AlignmentPointAcquisition preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AlignmentPointAcquisition()
    ;; This example reads and modifies the preference value that controls
    ;; how AutoAlignment points are acquired. When finished, this example resets
    ;; the preference value back to its original value.
    (setq acadObj (vlax-get-acad-object))

    ;; Get the drafting preferences object
    (setq ACADPref (vla-get-Drafting (vla-get-Preferences acadObj)))

    ;; Read and display the original value
    (setq originalValue (vla-get-AlignmentPointAcquisition ACADPref))
    (alert (strcat "The AlignmentPointAcquisition preference is: " (itoa originalValue)))

    ;; Toggle and display the AlignmentPointAcquisition preference
    (if (= (vla-get-AlignmentPointAcquisition ACADPref) acAlignPntAcquisitionAutomatic)
        (vla-put-AlignmentPointAcquisition ACADPref acAlignPntAcquisitionShiftToAcquire)
        (vla-put-AlignmentPointAcquisition ACADPref acAlignPntAcquisitionAutomatic)
    )

    (setq newValue (vla-get-AlignmentPointAcquisition ACADPref))
    (alert (strcat "The AlignmentPointAcquisition preference has been set to: " (itoa newValue)))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-AlignmentPointAcquisition ACADPref originalValue)
    (alert (strcat "The AlignmentPointAcquisition preference was reset back to: " (itoa originalValue)))
)


AlignSpace Property (ActiveX)

Specifies the AlignSpace of the mleaderstyle.

Supported platforms: Windows only

Signature

VBA:

object.AlignSpace
object

Type: MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: Long

The alignment space value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


AllowedValues Property (ActiveX)

Specifies the allowed values for the property.

Supported platforms: Windows only

Signature

VBA:

object.AllowedValues
object

Type: DynamicBlockReferenceProperty

The object this property applies to.

Property Value

Read-only: Yes

Type: Variant

Set of property values.

Remarks

Not all dynamic block properties have a restricted set of property values. Some properties are unrestricted, some specify a minimum or maximum value (or both), and some have a list of allowed values. This property supports only allowed property values that are defined by a list; minimum, maximum, and unrestricted property types are not supported.

Examples

VBA:

Not available

Visual LISP:

Not available


AllowLongSymbolNames Property (ActiveX)

Determines if symbol names may include extended character sets, or more than 31 characters.

Supported platforms: Windows only

Signature

VBA:

object.AllowLongSymbolNames
object

Type: DatabasePreferences

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Use extended symbol names.
  • False: Use restricted symbol names.

Remarks

The initial value of this property is True.

Extended symbol names may contain up to 255 characters and A-Z, 0-9, spaces, and any special character not used by Microsoft Windows and AutoCAD for other purposes.

Restricted symbol names may contain up to 31 characters and A-Z, 0-9, dollar sign ($), underscore (_), and hyphen (-).

This property applies to the names of non-graphical objects (such as linetypes and layers) that are stored in symbol tables.

NoteThe value of this property is stored in the EXTNAMES system variable.

Examples

VBA:

Sub Example_AllowLongSymbolNames()
    ' This example reads and modifies the preference value that controls
    ' whether symbol names include extended character sets or more
    ' than 31 characters.
    '
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadDatabasePreferences
    Dim originalValue As Variant, newValue As Variant

    ' Get the user preferences object
    Set ACADPref = ThisDrawing.preferences

    ' Read and display the original value
    originalValue = ACADPref.AllowLongSymbolNames
    MsgBox "The AllowLongSymbolNames preference is set to: " & originalValue

    ' Modify the AllowLongSymbolNames preference by toggling the value
    ACADPref.AllowLongSymbolNames = Not (ACADPref.AllowLongSymbolNames)
    newValue = ACADPref.AllowLongSymbolNames
    MsgBox "The AllowLongSymbolNames preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.AllowLongSymbolNames = originalValue
    MsgBox "The AllowLongSymbolNames preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AllowLongSymbolNames()
    ;; This example reads and modifies the preference value that controls
    ;; whether symbol names include extended character sets or more
    ;; than 31 characters.
    ;;
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))

    ;; Get the drafting preferences object
    (setq ACADPref (vla-get-Preferences doc))

    ;; Read and display the original value
    (setq originalValue (vla-get-AllowLongSymbolNames ACADPref))
    (alert (strcat "The AllowLongSymbolNames preference is set to: " (if (= originalValue :vlax-true) "1" "0")))

    ;; Modify the AllowLongSymbolNames preference by toggling the value
    (vla-put-AllowLongSymbolNames ACADPref (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-AllowLongSymbolNames ACADPref))
    (alert (strcat "The AllowLongSymbolNames preference has been set to: " (if (= newValue :vlax-true) "1" "0")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-AllowLongSymbolNames ACADPref originalValue)
    (alert (strcat "The AllowLongSymbolNames preference was reset back to: " (if (= originalValue :vlax-true) "1" "0")))
)


AllowManualHeights Property (ActiveX)

Toggles the manual heights in a table.

Supported platforms: Windows only

Signature

VBA:

object.AllowManualHeights
object

Type: Table

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Broken table parts to have their own breaking height.
  • False: All table parts will break at the height of the initial table part.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


AllowManualPositions Property (ActiveX)

Toggles the manual positions in a table.

Supported platforms: Windows only

Signature

VBA:

object.AllowManualPositions
object

Type: Table

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Each table part can be moved outside of the boundary.
  • False: Table parts are contained within a rectangular boundary.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


AltFontFile Property (ActiveX)

Specifies the location of the font file to use if AutoCAD cannot locate the original font and an alternate font is not specified in the font mapping file.

Supported platforms: Windows only

Signature

VBA:

object.AltFontFile
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The alternate font file.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AltFontFile()
    ' This example returns the current setting of
    ' AltFontFile. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currAltFontFile As String
    Dim newAltFontFile As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current AltFontFile value
    currAltFontFile = preferences.Files.AltFontFile
    MsgBox "The current value for AltFontFile is " & currAltFontFile, vbInformation, "AltFontFile Example"

    ' Change the value for AltFontFile
    newAltFontFile = "C:/AutoCAD/Fonts/gothice.shx"
    preferences.Files.AltFontFile = newAltFontFile
    MsgBox "The new value for AltFontFile is " & newAltFontFile, vbInformation, "AltFontFile Example"

    ' Reset AltFontFile to its original value
    preferences.Files.AltFontFile = currAltFontFile
    MsgBox "The AltFontFile value is reset to " & currAltFontFile, vbInformation, "AltFontFile Example"
 End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AltFontFile()
    ;; This example returns the current setting of
    ;; AltFontFile. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))
    (setq files (vla-get-Files preferences))

    ;; Retrieve the current AltFontFile value
    (setq currAltFontFile (vla-get-AltFontFile files))
    (alert (strcat "The current value for AltFontFile is " currAltFontFile))

    ;; Change the value for AltFontFile
    (setq newAltFontFile "C:/AutoCAD/Fonts/gothice.shx")
    (vla-put-AltFontFile files newAltFontFile)
    (alert (strcat "The new value for AltFontFile is " newAltFontFile))

    ;; Reset AltFontFile to its original value
    (vla-put-AltFontFile files currAltFontFile)
    (alert (strcat "The AltFontFile value is reset to " currAltFontFile))
)


Altitude Property (ActiveX)

Specifies the elevation of the position marker.

Supported platforms: Windows only

Signature

VBA:

object.Altitude
object

Type: GeoPositionMarker

The object this property applies to.

Property Value

Read-only: No

Type: Double

The current elevation of the position marker.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


AltRoundDistance Property (ActiveX)

Specifies the rounding of alternate units.

Supported platforms: Windows only

Signature

VBA:

object.AltRoundDistance
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Double

A positive real number representing the value to round distances to. The initial value is 0.00.

Remarks

If the AltUnits property is turned on, this property defines the number to round distances to.

NoteThis property overrides the value of the DIMALTRND system variable for the given dimension.

Examples

VBA:

Sub Example_AltRoundDistance()
   ' This example creates an aligned dimension in model space and
   ' uses AltRoundDistance to set the alternate unit display
   ' of the dimension to rounded values

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 10.123: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Enable alternate unit display
    dimObj.AltUnits = True

    ThisDrawing.Application.ZoomAll

    MsgBox "Press any key to round the alternate dimension unit display to .5"

    ' Round the distance of the alternate dimension to 0.50 of a unit
    dimObj.AltRoundDistance = 0.5
    ThisDrawing.Regen acAllViewports

    MsgBox "Alternate dimension units have been rounded to: " & dimObj.AltRoundDistance
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AltRoundDistance()
    ;; This example creates an aligned dimension in model space and
    ;; uses AltRoundDistance to set the alternate unit display
    ;; of the dimension to rounded values
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 10.123 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Enable alternate unit display
    (vla-put-AltUnits dimObj :vlax-true)

    (vla-ZoomAll acadObj)

    (alert "Round the alternate dimension unit display to .5")

    ;; Round the distance of the alternate dimension to 0.50 of a unit
    (vla-put-AltRoundDistance dimObj 0.5)
    (vla-Regen doc acAllViewports)

    (alert (strcat "Alternate dimension units have been rounded to: " (rtos (vla-get-AltRoundDistance dimObj) 2 4)))
)


AltSubUnitsFactor Property (ActiveX)

Specifies the scale factor for the alternate dimension when unit changes to sub-unit.

Supported platforms: Windows only

Signature

VBA:

object.AltSubUnitsFactor
object

Type: DimAligned, DimArcLength, DimOrdinate, DimRotated

The object this property applies to.

Property Value

Read-only: No

Type: Double

The scale factor for alternate sub-unit dimensions.

Remarks

The AltSubUnitsFactor property will only take affect when leading zeros are suppressed.

AltSubUnitsFactor affects all linear dimension types that allow a suffix. The alternate sub-unit scale factor replaces the alternate dimension scale factor when unit changes to sub-unit. When units are less than 1, the sub-units factor controls the location of the decimal separator.

Examples

VBA:

Not available

Visual LISP:

Not available


AltSubUnitsSuffix Property (ActiveX)

Specifies the text suffix for the alternate dimension when unit changes to sub-unit.

Supported platforms: Windows only

Signature

VBA:

object.AltSubUnitsSuffix
object

Type: DimAligned, DimArcLength, DimOrdinate, DimRotated

The object this property applies to.

Property Value

Read-only: No

Type: String

The suffix for alternate sub-unit dimensions.

Remarks

The AltSubUnitsSuffix property will only take affect when leading zeros are suppressed.

AltSubUnitsSuffix affects all linear dimension types that allow a suffix. The alternate dimension sub-suffix replaces the alternate dimension suffix when unit changes to sub-unit.

Examples

VBA:

Not available

Visual LISP:

Not available


AltSuppressLeadingZeros Property (ActiveX)

Specifies the suppression of leading zeros in alternate dimension values.

Supported platforms: Windows only

Signature

VBA:

object.AltSuppressLeadingZeros
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress leading zeros in alternate dimensions. For example, 0.5000 becomes .5000.
  • False: Do not suppress leading zeros in alternate dimensions.

Remarks

The initial value for this property is False.

NoteThis property overrides the value for the DIMALTZ system variable for the given dimension.

Examples

VBA:

Sub Example_AltSuppressLeadingZeros()
   ' This example creates an aligned dimension in model space and
   ' uses AltSuppressLeadingZeros to toggle the display of leading zeros
   ' in the alternate dimension display

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 5.01: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Enable alternate unit display
    dimObj.AltUnits = True

    ThisDrawing.Application.ZoomAll

Toggle:
    Select Case MsgBox("Press OK to toggle the display of leading zeros in the alternate dimension", vbOKCancel)
        Case vbOK
            ' Toggle the display of leading zeros for the alternate dimension value
            dimObj.AltSuppressLeadingZeros = Not (dimObj.AltSuppressLeadingZeros)
            ThisDrawing.Regen acAllViewports
        Case vbCancel
            Exit Sub
    End Select

    GoTo Toggle
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AltSuppressLeadingZeros()
    ;; This example creates an aligned dimension in model space and
    ;; uses AltSuppressLeadingZeros to toggle the display of leading zeros
    ;; in the alternate dimension display
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 5.01 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Set up alternate unit tolerance display
    (setq originalValue (vla-get-AltSuppressLeadingZeros dimObj))
    (vla-put-AltUnits dimObj :vlax-true)

    (vla-ZoomAll acadObj)
    (vla-Regen doc acAllViewports)

    (alert "Toggling the display of leading zeros in the alternate dimension.")

    ;; Toggle the display of leading zeros for the alternate dimension tolerance value
    (vla-put-AltSuppressLeadingZeros dimObj (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-AltSuppressLeadingZeros dimObj))

    (vla-Regen doc acAllViewports)

    (alert "Toggling the display of leading zeros in the alternate dimension to original value.")

    (vla-put-AltSuppressLeadingZeros dimObj (if (= newValue :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
)


AltSuppressTrailingZeros Property (ActiveX)

Specifies the suppression of trailing zeros in alternate dimension values.

Supported platforms: Windows only

Signature

VBA:

object.AltSuppressTrailingZeros
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress trailing zeros in alternate dimensions. For example, 12.5000 becomes 12.5.
  • False: Do not suppress trailing zeros in alternate dimensions.

Remarks

The initial value for this property is False.

NoteThis property overrides the value for the DIMALTZ system variable for the given dimension.

Examples

VBA:

Sub Example_AltSuppressTrailingZeros()
   ' This example creates an aligned dimension in model space and
   ' uses AltSuppressTrailingZeros to toggle the display of trailing zeros
   ' in the alternate dimension display

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 7: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Enable alternate unit display
    dimObj.AltUnits = True

    ThisDrawing.Application.ZoomAll

Toggle:
    Select Case MsgBox("Press OK to toggle the display of trailing zeros in the alternate dimension", vbOKCancel)
        Case vbOK
            ' Toggle the display of trailing zeros for the alternate dimension value
            dimObj.AltSuppressTrailingZeros = Not (dimObj.AltSuppressTrailingZeros)
            ThisDrawing.Regen acAllViewports
        Case vbCancel
            Exit Sub
    End Select

    GoTo Toggle
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AltSuppressTrailingZeros()
    ;; This example creates an aligned dimension in model space and
    ;; uses AltSuppressTrailingZeros to toggle the display of trailing zeros
    ;; in the alternate dimension display
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 7 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Enable alternate unit display
    (vla-put-AltUnits dimObj :vlax-true)

    ;; Set up alternate unit tolerance display
    (setq originalValue (vla-get-AltSuppressTrailingZeros dimObj))
    (vla-put-AltSuppressTrailingZeros dimObj :vlax-true)

    (vla-ZoomAll acadObj)
    (vla-Regen doc acAllViewports)

    (alert "Toggling the display of trailing zeros in the alternate dimension.")

    ;; Toggle the display of trailing zeros for the alternate dimension tolerance value
    (vla-put-AltSuppressTrailingZeros dimObj (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-AltSuppressTrailingZeros dimObj))

    (vla-Regen doc acAllViewports)

    (alert "Toggling the display of trailing zeros in the alternate dimension to original value.")

    (vla-put-AltSuppressTrailingZeros dimObj (if (= newValue :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
)


AltSuppressZeroFeet Property (ActiveX)

Specifies the suppression of a zero foot measurement in alternate dimension values.

Supported platforms: Windows only

Signature

VBA:

object.AltSuppressZeroFeet
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress the display of a zero foot measurement.
  • False: Do not suppress the display of a zero foot measurement.

Remarks

The initial value for this property is False.

NoteThis property overrides the value for the DIMALTZ system variable for the given dimension.

Examples

VBA:

Sub Example_AltSuppressZeroFeet()
   ' This example creates an aligned dimension in model space and
   ' uses AltSuppressZeroFeet to suppress or view the display of
   ' zero feet in the alternate dimension display

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 0: point1(1) = 5: point1(2) = 0
    point2(0) = 5: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Enable alternate unit display
    dimObj.AltUnits = True

    ' Set the dimension display to a style that works with AltSuppressZeroFeet
    dimObj.AltUnitsFormat = acDimLArchitectural
    dimObj.AltUnitsScale = 2    ' Set the alternate unit scale to be a multiple of 2

    ThisDrawing.Application.ZoomAll

Toggle:
    Select Case MsgBox("Press OK to suppress or view the display of zero feet in the alternate dimension", vbOKCancel)
        Case vbOK
            ' Toggle the display of zero feet for the alternate dimension value
            dimObj.AltSuppressZeroFeet = Not (dimObj.AltSuppressZeroFeet)
            ThisDrawing.Regen acAllViewports
        Case vbCancel
            Exit Sub
    End Select

    GoTo Toggle
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AltSuppressZeroFeet()
    ;; This example creates an aligned dimension in model space and
    ;; uses AltSuppressZeroFeet to suppress or view the display of
    ;; zero feet in the alternate dimension display
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 0 5 0)
          point2 (vlax-3d-point 5 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Enable alternate unit display
    (setq originalValue (vla-get-AltSuppressZeroFeet dimObj))
    (vla-put-AltUnits dimObj :vlax-true)

    ;; Set the dimension display to a style that works with AltSuppressZeroFeet
    (vla-put-AltUnitsFormat dimObj acDimLArchitectural)
    (vla-put-AltUnitsScale dimObj 2)    ;; Set the alternate unit scale to be a multiple of 2

    (vla-ZoomAll acadObj)
    (vla-Regen doc acAllViewports)

    (alert "Toggling the display of zero feet in the alternate tolerance.")

    ;; Set the dimension display to a style that works with AltSuppressZeroFeet
    (vla-put-AltSuppressZeroFeet dimObj (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-AltSuppressZeroFeet dimObj))

    (vla-Regen doc acAllViewports)

    (alert "Toggling the display of zero feet in the alternate tolerance to original value.")

    (vla-put-AltSuppressZeroFeet dimObj (if (= newValue :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
)


AltSuppressZeroInches Property (ActiveX)

Specifies the suppression of a zero inch measurement in alternate dimension values.

Supported platforms: Windows only

Signature

VBA:

object.AltSuppressZeroInches
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress the display of a zero inch measurement.
  • False: Do not suppress the display of a zero inch measurement.

Remarks

The initial value for this property is False.

NoteThis property overrides the value for the DIMALTZ system variable for the given dimension.

Examples

VBA:

Sub Example_AltSuppressZeroInches()
   ' This example creates an aligned dimension in model space and
   ' uses AltSuppressZeroInches to suppress or view the display of
   ' zero inches in the alternate dimension display

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 0: point1(1) = 5: point1(2) = 0
    point2(0) = 12: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Enable alternate unit display
    dimObj.AltUnits = True

    ' Set the dimension display to a style that works with AltSuppressZeroInches
    dimObj.AltUnitsFormat = acDimLArchitectural
    dimObj.AltUnitsScale = 2    ' Set the alternate unit scale to be a multiple of 2

    ThisDrawing.Application.ZoomAll

Toggle:
    Select Case MsgBox("Press OK to suppress or view the display of zero inches in the alternate dimension", vbOKCancel)
        Case vbOK
            ' Toggle the display of zero inches for the alternate dimension value
            dimObj.AltSuppressZeroInches = Not (dimObj.AltSuppressZeroInches)
            ThisDrawing.Regen acAllViewports
        Case vbCancel
            Exit Sub
    End Select

    GoTo Toggle
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AltSuppressZeroInches()
    ;; This example creates an aligned dimension in model space and
    ;; uses AltSuppressZeroInches to suppress or view the display of
    ;; zero inches in the alternate dimension display
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 0 5 0)
          point2 (vlax-3d-point 5 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Enable alternate unit display
    (setq originalValue (vla-get-AltSuppressZeroInches dimObj))
    (vla-put-AltUnits dimObj :vlax-true)

    ;; Set the dimension display to a style that works with AltSuppressZeroInches
    (vla-put-AltUnitsFormat dimObj acDimLArchitectural)
    (vla-put-AltUnitsScale dimObj 2)    ;; Set the alternate unit scale to be a multiple of 2

    (vla-ZoomAll acadObj)
    (vla-Regen doc acAllViewports)

    (alert "Toggling the display of zero inches in the alternate tolerance.")

    ;; Set the dimension display to a style that works with AltSuppressZeroInches
    (vla-put-AltSuppressZeroInches dimObj (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-AltSuppressZeroInches dimObj))

    (vla-Regen doc acAllViewports)

    (alert "Toggling the display of zero inches in the alternate tolerance to original value.")

    (vla-put-AltSuppressZeroInches dimObj (if (= newValue :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
)


AltTabletMenuFile Property (ActiveX)

Specifies the path for an alternate menu to swap with the standard AutoCAD tablet menu.

Supported platforms: Windows only

Signature

VBA:

object.AltTabletMenuFile
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The alternate tablet menu path.

Remarks

This property is applicable only if you use a digitizer.

Examples

VBA:

Sub Example_AltTabletMenuFile()
    ' This example returns the current setting of
    ' AltTabletMenuFile. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currAltTabletMenuFile As String
    Dim newAltTabletMenuFile As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current AltTabletMenuFile value
    currAltTabletMenuFile = preferences.Files.AltTabletMenuFile
    If currAltTabletMenuFile = "" Then
        MsgBox "AltTabletMenuFile is not currently set.", vbInformation, "AltTabletMenuFile Example"
    Else
        MsgBox "The current value for AltTabletMenuFile is " & currAltTabletMenuFile, vbInformation, "AltTabletMenuFile Example"
    End If

    ' Change the value for AltTabletMenuFile
    newAltTabletMenuFile = "d:\acad\support\acad"
    preferences.Files.AltTabletMenuFile = newAltTabletMenuFile
    MsgBox "The new value for AltTabletMenuFile is " & newAltTabletMenuFile, vbInformation, "AltTabletMenuFile Example"

    ' Reset AltTabletMenuFile to its original value
    preferences.Files.AltTabletMenuFile = currAltTabletMenuFile
    If currAltTabletMenuFile = "" Then
        MsgBox "AltTabletMenuFile is reset to Null.", vbInformation, "AltTabletMenuFile Example"
    Else
        MsgBox "The AltTabletMenuFile value is reset to " & currAltTabletMenuFile, vbInformation, "AltTabletMenuFile Example"
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AltTabletMenuFile()
    ;; This example returns the current setting of
    ;; AltTabletMenuFile. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current AltTabletMenuFile value
    (setq currAltTabletMenuFile (vla-get-AltTabletMenuFile (vla-get-Files preferences)))
    (if (= currAltTabletMenuFile "")
        (alert "AltTabletMenuFile is not currently set.")
        (alert (strcat "The current value for AltTabletMenuFile is " currAltTabletMenuFile))
    )

    ;; Change the value for AltTabletMenuFile
    (vla-put-AltTabletMenuFile (vla-get-Files preferences) "C:\\AutoCAD\\acad")
    (alert (strcat "The new value for AltTabletMenuFile is " (vla-get-AltTabletMenuFile (vla-get-Files preferences))))

    ;; Reset AltTabletMenuFile to its original value
    (vla-put-AltTabletMenuFile (vla-get-Files preferences) currAltTabletMenuFile)
    (if (= currAltTabletMenuFile "")
        (alert "AltTabletMenuFile is reset to Null.")
        (alert (strcat "The AltTabletMenuFile value is reset to " (vla-get-AltTabletMenuFile (vla-get-Files preferences))))
    )
)


AltTextPrefix Property (ActiveX)

Specifies a prefix for the alternate dimension measurement for all dimension types except angular.

Supported platforms: Windows only

Signature

VBA:

object.AltTextPrefix
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: String

The prefix for the alternate dimensions.

Remarks

The initial value for this property is "".

To turn off an established prefix, set this property equal to a single period (.).

NoteThis property overrides the value of the DIMAPOST system variable for the given dimension.

Examples

VBA:

Sub Example_AltTextPrefix()
   ' This example creates an aligned dimension in model space and
   ' uses AltTextPrefix to allow the user to change the text prefix for the
   ' alternate dimension

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim prefix As String

    ' Define the dimension
    point1(0) = 0: point1(1) = 5: point1(2) = 0
    point2(0) = 5: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Enable alternate unit display
    dimObj.AltUnits = True

    ThisDrawing.Application.ZoomAll

    ' Allow the user to change the text prefix for the alternate dimension
    prefix = InputBox("Enter a new text prefix for the alternate dimension", "Alternate Dimension Prefix", "PREFIX:")
    dimObj.AltTextPrefix = prefix   ' Commit changes to prefix

    ThisDrawing.Regen acAllViewports

    ' Read back and display the alternate dimension text prefix
    prefix = dimObj.AltTextPrefix
    If prefix <> "" Then
        MsgBox "The prefix of the alternate dimension has been changed to: " & prefix
    Else
        MsgBox "The prefix of the alternate dimension has been removed"
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AltTextPrefix()
    ;; This example creates an aligned dimension in model space and
    ;; uses AltTextPrefix to allow the user to change the text prefix for the
    ;; alternate dimension
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 0 5 0)
          point2 (vlax-3d-point 5 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Enable alternate unit display
    (vla-put-AltUnits dimObj :vlax-true)

    (vla-ZoomAll acadObj)

    ;; Allow the user to change the text prefix for the alternate dimension
    (setq prefix (vla-GetString (vla-get-Utility doc) :vlax-false "\nEnter a new text prefix for the alternate dimension: "))
    (vla-put-AltTextPrefix dimObj prefix)   ;; Commit changes to prefix

    (vla-Regen doc acAllViewports)

    ;; Read back and display the alternate dimension text prefix
    (setq prefix (vla-get-AltTextPrefix dimObj))
    (if (/= prefix "")
        (alert (strcat "The prefix of the alternate dimension has been changed to: " prefix))
        (alert "The prefix of the alternate dimension has been removed")
    )
)


AltTextSuffix Property (ActiveX)

Specifies a suffix for the alternate dimension measurement for all dimension types except angular.

Supported platforms: Windows only

Signature

VBA:

object.AltTextSuffix
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: String

The suffix for the alternate dimensions.

Remarks

The initial value for this property is "".

To turn off an established suffix, set this property equal to a single period (.).

NoteThis property overrides the value of the DIMAPOST system variable for the given dimension.

Examples

VBA:

Sub Example_AltTextSuffix()
   ' This example creates an aligned dimension in model space and
   ' uses AltTextSuffix to allow the user to change the text suffix for the
   ' alternate dimension

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim suffix As String

    ' Define the dimension
    point1(0) = 0: point1(1) = 5: point1(2) = 0
    point2(0) = 5: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Enable alternate unit display
    dimObj.AltUnits = True

    ThisDrawing.Application.ZoomAll

    ' Allow the user to change the text suffix for the alternate dimension
    suffix = InputBox("Enter a new text suffix for the alternate dimension", "Alternate Dimension Suffix", ":SUFFIX")
    dimObj.AltTextSuffix = suffix   ' Commit changes to suffix

    ThisDrawing.Regen acAllViewports

    ' Read back and display the alternate dimension text suffix
    suffix = dimObj.AltTextSuffix
    If suffix <> "" Then
        MsgBox "The suffix of the alternate dimension has been changed to: " & suffix
    Else
        MsgBox "The suffix of the alternate dimension has been removed"
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AltTextSuffix()
    ;; This example creates an aligned dimension in model space and
    ;; uses AltTextSuffix to allow the user to change the text suffix for the
    ;; alternate dimension
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 0 5 0)
          point2 (vlax-3d-point 5 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Enable alternate unit display
    (vla-put-AltUnits dimObj :vlax-true)

    (vla-ZoomAll acadObj)

    ;; Allow the user to change the text suffix for the alternate dimension
    (setq suffix (vla-GetString (vla-get-Utility doc) :vlax-false "\nEnter a new text suffix for the alternate dimension: "))
    (vla-put-AltTextSuffix dimObj suffix)   ;; Commit changes to suffix

    (vla-Regen doc acAllViewports)

    ;; Read back and display the alternate dimension text suffix
    (setq suffix (vla-get-AltTextSuffix dimObj))
    (if (/= suffix "")
        (alert (strcat "The suffix of the alternate dimension has been changed to: " suffix))
        (alert "The suffix of the alternate dimension has been removed")
    )
)


AltTolerancePrecision Property (ActiveX)

Specifies the precision of tolerance values in alternate dimensions.

Supported platforms: Windows only

Signature

VBA:

object.AltTolerancePrecision
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: acDimPrecision enum

  • acDimPrecisionZero: 0.
  • acDimPrecisionOne: 0.0
  • acDimPrecisionTwo: 0.00
  • acDimPrecisionThree: 0.000
  • acDimPrecisionFour: 0.0000
  • acDimPrecisionFive: 0.00000
  • acDimPrecisionSix: 0.000000
  • acDimPrecisionSeven: 0.0000000
  • acDimPrecisionEight: 0.00000000

Remarks

The initial value for this property is acDimPrecisionTwo.

This property is available only when the ToleranceDisplay property is set to any value other than acTolNone.

NoteThis property overrides the value of the DIMTDEC system variable for the given dimension.

Examples

VBA:

Sub Example_AltTolerancePrecision()
   ' This example creates an aligned dimension in model space and
   ' uses AltTolerancePrecision to allow the user to change the
   ' precision of the alternate dimension tolerance

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim oldTolerance As String, newTolerance As String

    ' Define the dimension
    point1(0) = 0: point1(1) = 5: point1(2) = 0
    point2(0) = 5.12345678: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Enable alternate unit display
    dimObj.AltUnits = True
    dimObj.ToleranceDisplay = acTolLimits

    ThisDrawing.Application.ZoomAll

    ' Store old tolerance value as default for input box
    oldTolerance = dimObj.AltTolerancePrecision

    ' Allow the user to change the precision for the alternate dimension tolerance
    newTolerance = InputBox("Enter a new tolerance precision for the alternate dimension.  The value must range from 0 to 8.", "Alternate Dimension Tolerance Precision", oldTolerance)

    Select Case newTolerance
        Case 0: newTolerance = acDimPrecisionZero
        Case 1: newTolerance = acDimPrecisionOne
        Case 2: newTolerance = acDimPrecisionTwo
        Case 3: newTolerance = acDimPrecisionThree
        Case 4: newTolerance = acDimPrecisionFour
        Case 5: newTolerance = acDimPrecisionFive
        Case 6: newTolerance = acDimPrecisionSix
        Case 7: newTolerance = acDimPrecisionSeven
        Case 8: newTolerance = acDimPrecisionEight
        Case Else
            MsgBox "The alternate tolerance precision has not been changed."
            Exit Sub
    End Select

    dimObj.AltTolerancePrecision = newTolerance   ' Commit changes to tolerance precision

    ThisDrawing.Regen acAllViewports

    ' Read back and display the alternate dimension tolerance precision
    newTolerance = dimObj.AltTolerancePrecision
    MsgBox "The tolerance precision has been set to " & newTolerance & " decimal places"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AltTolerancePrecision()
    ;; This example creates an aligned dimension in model space and
    ;; uses AltTolerancePrecision to allow the user to change the
    ;; precision of the alternate dimension tolerance
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 0 5 0)
          point2 (vlax-3d-point 5.12345678 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Enable alternate unit display
    (vla-put-AltUnits dimObj :vlax-true)
    (vla-put-ToleranceDisplay dimObj acTolLimits)

    (vla-ZoomAll acadObj)

    ;; Store old tolerance value as default for input box
    (setq oldTolerance (vla-get-AltTolerancePrecision dimObj))

    ;; Allow the user to change the precision for the alternate dimension tolerance
    (setq newTolerance (vla-GetInteger (vla-get-Utility doc) (strcat "\nEnter a new tolerance precision for the alternate dimension (0 to 8) <" (itoa oldTolerance) ">: ")))

    (if (= newTolerance nil) (setq newTolerance oldTolerance))

    (setq newTolerance (cond
                           ((= newTolerance 0) acDimPrecisionZero)
                           ((= newTolerance 1) acDimPrecisionOne)
                           ((= newTolerance 2) acDimPrecisionTwo)
                           ((= newTolerance 3) acDimPrecisionThree)
                           ((= newTolerance 4) acDimPrecisionFour)
                           ((= newTolerance 5) acDimPrecisionFive)
                           ((= newTolerance 6) acDimPrecisionSix)
                           ((= newTolerance 7) acDimPrecisionSeven)
                           ((= newTolerance 8) acDimPrecisionEight)
                           (progn (setq newTolerance nil) (alert "The alternate tolerance precision has not been changed."))
                       ))

    (if (/= newTolerance nil)
        (progn
            (vla-put-AltTolerancePrecision dimObj newTolerance)   ;; Commit changes to tolerance precision

            (vla-Regen doc acAllViewports)

            ;; Read back and display the alternate dimension tolerance precision
            (alert (strcat "The tolerance precision has been set to " (itoa (vla-get-AltTolerancePrecision dimObj)) " decimal places"))
        )
    )
)


AltToleranceSuppressLeadingZeros Property (ActiveX)

Specifies the suppression of leading zeros in alternate dimension values.

Supported platforms: Windows only

Signature

VBA:

object.AltToleranceSuppressLeadingZeros
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress leading zeros in alternate dimensions. For example, 0.5000 becomes .5000.
  • False: Do not suppress leading zeros in alternate dimensions.

Remarks

The initial value for this property is False.

NoteThis property overrides the value for the DIMALTTZ system variable for the given dimension.

Examples

VBA:

Sub Example_AltToleranceSuppressLeadingZeros()
   ' This example creates an aligned dimension in model space and
   ' uses AltToleranceSuppressLeadingZeros to toggle the display of leading zeros
   ' in the alternate dimension tolerance display

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 5.01: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Set up alternate unit tolerance display
    dimObj.AltUnits = True
    dimObj.ToleranceDisplay = acTolLimits

    ThisDrawing.Application.ZoomAll

Toggle:
    Select Case MsgBox("Press OK to toggle the display of leading zeros in the alternate dimension tolerance", vbOKCancel)
        Case vbOK
            ' Toggle the display of leading zeros for the alternate dimension tolerance value
            dimObj.AltToleranceSuppressLeadingZeros = Not (dimObj.AltToleranceSuppressLeadingZeros)
            ThisDrawing.Regen acAllViewports
        Case vbCancel
            Exit Sub
    End Select

    GoTo Toggle
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AltToleranceSuppressLeadingZeros()
    ;; This example creates an aligned dimension in model space and
    ;; uses AltToleranceSuppressLeadingZeros to toggle the display of leading zeros
    ;; in the alternate dimension tolerance display
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 5.01 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Set up alternate unit tolerance display
    (vla-put-AltUnits dimObj :vlax-true)
    (vla-put-ToleranceDisplay dimObj acTolLimits)

    (vla-ZoomAll acadObj)

    ;; Toggle the display of leading zeros for the alternate dimension tolerance value
    (vla-put-AltToleranceSuppressLeadingZeros dimObj (if (= (vla-get-AltToleranceSuppressLeadingZeros dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of leading zeros in the alternate dimension tolerance toggled.")

    ;; Toggle the display of leading zeros for the alternate dimension tolerance value back to previous state
    (vla-put-AltToleranceSuppressLeadingZeros dimObj (if (= (vla-get-AltToleranceSuppressLeadingZeros dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of leading zeros in the alternate dimension tolerance toggled back.")
)


AltToleranceSuppressTrailingZeros Property (ActiveX)

Specifies the suppression of trailing zeros in alternate tolerance values.

Supported platforms: Windows only

Signature

VBA:

object.AltToleranceSuppressTrailingZeros
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress trailing zeros in alternate tolerance values. For example, 12.5000 becomes 12.5.
  • False: Do not suppress trailing zeros in alternate tolerance values.

Remarks

The initial value for this property is False.

NoteThis property overrides the value for the DIMALTTZ system variable for the given dimension.

Examples

VBA:

Sub Example_AltToleranceSuppressTrailingZeros()
   ' This example creates an aligned dimension in model space and
   ' uses AltToleranceSuppressTrailingZeros to toggle the display of trailing zeros
   ' in the alternate dimension tolerance display

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 7: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Set up alternate unit tolerance display
    dimObj.AltUnits = True
    dimObj.ToleranceDisplay = acTolLimits

    ThisDrawing.Application.ZoomAll

Toggle:
    Select Case MsgBox("Press OK to toggle the display of trailing zeros in the alternate dimension tolerance", vbOKCancel)
        Case vbOK
            ' Toggle the display of trailing zeros for the alternate dimension tolerance value
            dimObj.AltToleranceSuppressTrailingZeros = Not (dimObj.AltToleranceSuppressTrailingZeros)
            ThisDrawing.Regen acAllViewports
        Case vbCancel
            Exit Sub
    End Select

    GoTo Toggle
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AltToleranceSuppressTrailingZeros()
    ;; This example creates an aligned dimension in model space and
    ;; uses AltToleranceSuppressTrailingZeros to toggle the display of trailing zeros
    ;; in the alternate dimension tolerance display
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 7 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Set up alternate unit tolerance display
    (vla-put-AltUnits dimObj :vlax-true)
    (vla-put-ToleranceDisplay dimObj acTolLimits)

    (vla-ZoomAll acadObj)

    ;; Toggle the display of trailing zeros for the alternate dimension tolerance value
    (vla-put-AltToleranceSuppressTrailingZeros dimObj (if (= (vla-get-AltToleranceSuppressTrailingZeros dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of trailing zeros in the alternate dimension tolerance toggled.")

    ;; Toggle the display of trailing zeros for the alternate dimension tolerance value back to previous state
    (vla-put-AltToleranceSuppressTrailingZeros dimObj (if (= (vla-get-AltToleranceSuppressTrailingZeros dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of trailing zeros in the alternate dimension tolerance toggled back.")
)


AltToleranceSuppressZeroFeet Property (ActiveX)

Specifies the suppression of a zero foot measurement in alternate tolerance values.

Supported platforms: Windows only

Signature

VBA:

object.AltToleranceSuppressZeroFeet
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress the display of a zero foot measurement.
  • False: Do not suppress the display of a zero foot measurement.

Remarks

The initial value for this property is False.

NoteThis property overrides the value for the DIMALTTZ system variable for the given dimension.

Examples

VBA:

Sub Example_AltToleranceSuppressZeroFeet()
   ' This example creates an aligned dimension in model space and
   ' uses AltToleranceSuppressZeroFeet to suppress or view the display of
   ' zero feet in the alternate dimension tolerance display

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 0: point1(1) = 5: point1(2) = 0
    point2(0) = 5: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Set up alternate unit tolerance display
    dimObj.AltUnits = True
    dimObj.ToleranceDisplay = acTolLimits

    ' Set the dimension display to a style that works with AltToleranceSuppressZeroFeet
    dimObj.AltUnitsFormat = acDimLArchitectural
    dimObj.AltUnitsScale = 2    ' Set the alternate unit scale to be a multiple of 2

    ThisDrawing.Application.ZoomAll

Toggle:
    Select Case MsgBox("Press OK to suppress or view the display of zero feet in the alternate dimension tolerance", vbOKCancel)
        Case vbOK
            ' Toggle the display of zero feet for the alternate dimension value
            dimObj.AltToleranceSuppressZeroFeet = Not (dimObj.AltToleranceSuppressZeroFeet)
            ThisDrawing.Regen acAllViewports
        Case vbCancel
            Exit Sub
    End Select

    GoTo Toggle
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AltToleranceSuppressZeroFeet()
    ;; This example creates an aligned dimension in model space and
    ;; uses AltToleranceSuppressZeroFeet to suppress or view the display of
    ;; zero feet in the alternate dimension tolerance display
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 6.01 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Set up alternate unit tolerance display
    (vla-put-AltUnits dimObj :vlax-true)
    (vla-put-ToleranceDisplay dimObj acTolLimits)

    ;; Set the dimension display to a style that works with AltToleranceSuppressZeroFeet
    (vla-put-AltUnitsFormat dimObj acDimLArchitectural)
    (vla-put-AltUnitsScale dimObj 2)    ;; Set the alternate unit scale to be a multiple of 2

    (vla-ZoomAll acadObj)

    ;; Toggle the display of zero feet for the alternate dimension value
    (vla-put-AltToleranceSuppressZeroFeet dimObj (if (= (vla-get-AltToleranceSuppressZeroFeet dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of zero feet in the alternate dimension tolerance toggled.")

    ;; Toggle the display of zero feet for the alternate dimension value back to previous state
    (vla-put-AltToleranceSuppressZeroFeet dimObj (if (= (vla-get-AltToleranceSuppressZeroFeet dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of zero feet in the alternate dimension tolerance toggled back.")
)


AltToleranceSuppressZeroInches Property (ActiveX)

Specifies the suppression of a zero inch measurement in alternate tolerance values.

Supported platforms: Windows only

Signature

VBA:

object.AltToleranceSuppressZeroInches
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress the display of a zero inch measurement.
  • False: Do not suppress the display of a zero inch measurement.

Remarks

The initial value for this property is False.

NoteThis property overrides the value for the DIMALTTZ system variable for the given dimension.

Examples

VBA:

Sub Example_AltToleranceSuppressZeroInches()
   ' This example creates an aligned dimension in model space and
   ' uses AltToleranceSuppressZeroInches to suppress or view the display of
   ' zero inches in the alternate dimension tolerance display

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 0: point1(1) = 5: point1(2) = 0
    point2(0) = 12: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Set up alternate unit tolerance display
    dimObj.AltUnits = True
    dimObj.ToleranceDisplay = acTolLimits

    ' Set the dimension display to a style that works with AltToleranceSuppressZeroInches
    dimObj.AltUnitsFormat = acDimLArchitectural
    dimObj.AltUnitsScale = 2    ' Set the alternate unit scale to be a multiple of 2

    ThisDrawing.Application.ZoomAll

Toggle:
    Select Case MsgBox("Press OK to suppress or view the display of zero inches in the alternate dimension tolerance", vbOKCancel)
        Case vbOK
            ' Toggle the display of zero inches for the alternate dimension tolerance value
            dimObj.AltToleranceSuppressZeroInches = Not (dimObj.AltToleranceSuppressZeroInches)
            ThisDrawing.Regen acAllViewports
        Case vbCancel
            Exit Sub
    End Select

    GoTo Toggle
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AltToleranceSuppressZeroInches()
    ;; This example creates an aligned dimension in model space and
    ;; uses AltToleranceSuppressZeroInches to suppress or view the display of
    ;; zero inches in the alternate dimension tolerance display
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 0 5 0)
          point2 (vlax-3d-point 12 5 0)
          location (vlax-3d-point 5 7 0))

    ; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Set up alternate unit tolerance display
    (vla-put-AltUnits dimObj :vlax-true)
    (vla-put-ToleranceDisplay dimObj acTolLimits)

    ;; Set the dimension display to a style that works with AltToleranceSuppressZeroInches
    (vla-put-AltUnitsFormat dimObj acDimLArchitectural)
    (vla-put-AltUnitsScale dimObj 2)    ;; Set the alternate unit scale to be a multiple of 2

    (vla-ZoomAll acadObj)

    ;; Toggle the display of zero inches for the alternate dimension tolerance value
    (vla-put-AltToleranceSuppressZeroInches dimObj (if (= (vla-get-AltToleranceSuppressZeroInches dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of zero inches in the alternate dimension tolerance toggled.")

    ;; Toggle the display of zero inches for the alternate dimension tolerance value back to previous state
    (vla-put-AltToleranceSuppressZeroInches dimObj (if (= (vla-get-AltToleranceSuppressZeroInches dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of zero inches in the alternate dimension tolerance toggled back.")
)


AltUnits Property (ActiveX)

Enables dimensioning in alternate units.

Supported platforms: Windows only

Signature

VBA:

object.AltUnits
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Enable dimensioning in alternate units.
  • False: Disable dimensioning in alternate units.

Remarks

The initial value for this property is False.

NoteThis property overrides the value of the DIMALT system variable for the given dimension.

Examples

VBA:

Sub Example_AltUnits()
   ' This example creates an aligned dimension in model space and
   ' uses AltUnits to toggle the alternate dimension units on and off

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 0: point1(1) = 5: point1(2) = 0
    point2(0) = 5: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ThisDrawing.Application.ZoomAll

    ' Toggle alternate unit display
Toggle:
    Select Case MsgBox("Press OK to toggle the display of alternate dimensions", vbOKCancel)
        Case vbOK
            ' Toggle the alternate dimension display
            dimObj.AltUnits = Not (dimObj.AltUnits)
            ThisDrawing.Regen acAllViewports
        Case vbCancel
            Exit Sub
    End Select

    ' Display status of alternate units display
    If dimObj.AltUnits Then
        MsgBox "Alternate units display is on."
    Else
        MsgBox "Alternate units display is off."
    End If

    GoTo Toggle

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AltUnits()
    ;; This example creates an aligned dimension in model space and
    ;; uses AltUnits to toggle the alternate dimension units on and off
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 0 5 0)
          point2 (vlax-3d-point 5 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    ;; Toggle alternate unit display
    (setq originalValue (vla-get-AltUnits dimObj))
    (vla-Regen doc acAllViewports)

    (alert "Toggling the display of alternate units.")

    ;; Toggle the display of trailing zeros for the alternate dimension tolerance value
    (vla-put-AltUnits dimObj (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-AltUnits dimObj))

    (vla-Regen doc acAllViewports)

    (alert "Toggling the display of alternate units to original value.")

    (vla-put-AltUnits dimObj (if (= newValue :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
)


AltUnitsFormat Property (ActiveX)

Specifies the units format for alternate units of all dimensions except angular.

Supported platforms: Windows only

Signature

VBA:

object.AltUnitsFormat
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: acDimUnits enum

  • acDimScientific
  • acDimDecimal
  • acDimEngineering
  • acDimArchitecturalStacked
  • acDimFractionalStacked
  • acDimArchitectural
  • acDimFractional
  • acDimWindowsDesktop

Remarks

The initial value for this property is acDimDecimal.

NoteThis property overrides the value of the DIMALTU system variable for the given dimension.

Examples

VBA:

Sub Example_AltUnitsFormat()
    ' This example creates an aligned dimension in model space and
    ' uses AltUnitsFormat to cycle through some common unit formats
    ' for the alternate dimension

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 0: point1(1) = 5: point1(2) = 0
    point2(0) = 5.12345678: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ThisDrawing.Application.ZoomAll

    ' Enable unit display of alternate units
    dimObj.AltUnits = True

    dimObj.AltUnitsFormat = acDimScientific     ' Change format to Scientific
    ThisDrawing.Regen acAllViewports
    MsgBox "The alternate dimension units are now set to Scientific"

    dimObj.AltUnitsFormat = acDimDecimal        ' Change format to Decimal
    ThisDrawing.Regen acAllViewports
    MsgBox "The alternate dimension units are now set to Decimal"

    dimObj.AltUnitsFormat = acDimArchitectural  ' Change format to Architectural
    ThisDrawing.Regen acAllViewports
    MsgBox "The alternate dimension units are now set to Architectural"

    dimObj.AltUnitsFormat = acDimWindowsDesktop ' Change format to Windows Desktop
    ThisDrawing.Regen acAllViewports
    MsgBox "The alternate dimension units are now set to Windows Desktop"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AltUnitsFormat()
    ;; This example creates an aligned dimension in model space and
    ;; uses AltUnitsFormat to cycle through some common unit formats
    ;; for the alternate dimension
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 0 5 0)
          point2 (vlax-3d-point 5.12345678 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    ;; Enable unit display of alternate units
    (vla-put-AltUnits dimObj :vlax-true)

    (vla-put-AltUnitsFormat dimObj acDimScientific)     ;; Change format to Scientific
    (vla-Regen doc acAllViewports)
    (alert "The alternate dimension units are now set to Scientific.")

    (vla-put-AltUnitsFormat dimObj acDimDecimal)        ;; Change format to Decimal
    (vla-Regen doc acAllViewports)
    (alert "The alternate dimension units are now set to Decimal.")

    (vla-put-AltUnitsFormat dimObj acDimArchitectural)  ;; Change format to Architectural
    (vla-Regen doc acAllViewports)
    (alert "The alternate dimension units are now set to Architectural.")

    (vla-put-AltUnitsFormat dimObj acDimWindowsDesktop) ;; Change format to Windows Desktop
    (vla-Regen doc acAllViewports)
    (alert "The alternate dimension units are now set to Windows Desktop.")
)


AltUnitsPrecision Property (ActiveX)

Specifies the number of decimal places in alternate units.

Supported platforms: Windows only

Signature

VBA:

object.AltUnitsPrecision
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: acDimPrecision enum

Use one of the following constants to specify precision:

  • acDimPrecisionZero: 0.
  • acDimPrecisionOne: 0.0
  • acDimPrecisionTwo: 0.00
  • acDimPrecisionThree: 0.000
  • acDimPrecisionFour: 0.0000
  • acDimPrecisionFive: 0.00000
  • acDimPrecisionSix: 0.000000
  • acDimPrecisionSeven: 0.0000000
  • acDimPrecisionEight: 0.00000000

Remarks

The initial value for this property is acDimPrecisionTwo.

NoteThis property overrides the value of the DIMALTD system variable for the given dimension.

Examples

VBA:

Sub Example_AltUnitsPrecision()
    ' This example creates an aligned dimension in model space and
    ' uses AltUnitsPrecision to allow the user to change the
    ' precision of the alternate dimension

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim oldPrecision As String, newPrecision As String

    ' Define the dimension
    point1(0) = 0: point1(1) = 5: point1(2) = 0
    point2(0) = 5.12345678: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Enable alternate unit display
    dimObj.AltUnits = True

    ThisDrawing.Application.ZoomAll

    ' Store old Precision value as default for input box
    oldPrecision = dimObj.AltUnitsPrecision

    ' Allow the user to change the precision for the alternate dimension
    newPrecision = InputBox("Enter a new precision for the alternate dimension.  The value must range from 0 to 8.", "Alternate Dimension Precision", oldPrecision)

    Select Case newPrecision
        Case 0: newPrecision = acDimPrecisionZero
        Case 1: newPrecision = acDimPrecisionOne
        Case 2: newPrecision = acDimPrecisionTwo
        Case 3: newPrecision = acDimPrecisionThree
        Case 4: newPrecision = acDimPrecisionFour
        Case 5: newPrecision = acDimPrecisionFive
        Case 6: newPrecision = acDimPrecisionSix
        Case 7: newPrecision = acDimPrecisionSeven
        Case 8: newPrecision = acDimPrecisionEight
        Case Else
            MsgBox "The alternate precision has not been changed."
            Exit Sub
    End Select

    dimObj.AltUnitsPrecision = newPrecision   ' Commit changes to precision

    ThisDrawing.Regen acAllViewports

    ' Read back and display the alternate dimension precision
    newPrecision = dimObj.AltUnitsPrecision
    MsgBox "The alternate dimension precision has been set to " & newPrecision & " decimal places"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AltUnitsPrecision()
    ;; This example creates an aligned dimension in model space and
    ;; uses AltUnitsPrecision to allow the user to change the
    ;; precision of the alternate dimension
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 0 5 0)
          point2 (vlax-3d-point 5.12345678 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Enable alternate unit display
    (vla-put-AltUnits dimObj :vlax-true)

    (vla-ZoomAll acadObj)

    ;; Store old Precision value as default for input box
    (setq oldPrecision (vla-get-AltUnitsPrecision dimObj))

    ;; Allow the user to change the precision for the alternate dimension
    (if (= (setq newPrecision (getint "\nEnter a new precision for the alternate dimension (0-8): ")) nil) (setq newPrecision oldPrecision))

    (cond
      ((= newPrecision 0)(setq newPrecision acDimPrecisionZero))
      ((= newPrecision 1)(setq newPrecision acDimPrecisionOne))
      ((= newPrecision 2)(setq newPrecision acDimPrecisionTwo))
      ((= newPrecision 3)(setq newPrecision acDimPrecisionThree))
      ((= newPrecision 4)(setq newPrecision acDimPrecisionFour))
      ((= newPrecision 5)(setq newPrecision acDimPrecisionFive))
      ((= newPrecision 6)(setq newPrecision acDimPrecisionSix))
      ((= newPrecision 7)(setq newPrecision acDimPrecisionSeven))
      ((= newPrecision 8)(setq newPrecision acDimPrecisionEight))
      ((progn (alert "The alternate precision has not been changed.")(setq newPrecision oldPrecision)))
    )

    (vla-put-AltUnitsPrecision dimObj newPrecision)   ;; Commit changes to precision

    (vla-Regen doc acAllViewports)

    ;; Read back and display the alternate dimension precision
    (setq newPrecision (vla-get-AltUnitsPrecision dimObj))
    (alert (strcat "The alternate dimension precision has been set to " (itoa newPrecision) " decimal places."))
)


AltUnitsScale Property (ActiveX)

Specifies the scale factor for alternate units.

Supported platforms: Windows only

Signature

VBA:

object.AltUnitsScale
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The scale factor that is applied to alternate units.

Remarks

If the AltUnits property is turned on, this property multiplies linear dimensions by a factor to produce a value in an alternate system of measurement. The initial value represents the number of millimeters in an inch.

Initial value of the property is 25.4000.

NoteThis property overrides the value of the DIMALTF system variable for the given dimension.

Examples

VBA:

Sub Example_AltUnitsScale()
    ' This example creates an aligned dimension in model space and
    ' uses AltUnitsScale to cycle through some common scales
    ' for the alternate dimension

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 0: point1(1) = 5: point1(2) = 0
    point2(0) = 5: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ThisDrawing.Application.ZoomAll

    ' Enable display of alternate units
    dimObj.AltUnits = True

    ' Cycle through some common dimension scales

    dimObj.AltUnitsScale = 1         ' Change scale to Inches
    ThisDrawing.Regen acAllViewports
    MsgBox "The alternate dimension units are now set to inches"

    dimObj.AltUnitsScale = 25.4     ' Change scale to Millimeters (default)
    ThisDrawing.Regen acAllViewports
    MsgBox "The alternate dimension units are now set to millimeters"

    dimObj.AltUnitsScale = 2.54      ' Change scale to Centimeters
    ThisDrawing.Regen acAllViewports
    MsgBox "The alternate dimension units are now set to centimeters"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AltUnitsScale()
    ;; This example creates an aligned dimension in model space and
    ;; uses AltUnitsScale to cycle through some common scales
    ;; for the alternate dimension
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 0 5 0)
          point2 (vlax-3d-point 5 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    ;; Enable display of alternate units
    (vla-put-AltUnits dimObj :vlax-true)

    ;; Cycle through some common dimension scales
    (vla-put-AltUnitsScale dimObj 1)         ;; Change scale to Inches
    (vla-Regen doc acAllViewports)
    (alert "The alternate dimension units are now set to inches.")

    (vla-put-AltUnitsScale dimObj 25.4)     ;; Change scale to Millimeters (default)
    (vla-Regen doc acAllViewports)
    (alert "The alternate dimension units are now set to millimeters.")

    (vla-put-AltUnitsScale dimObj 2.54)      ;; Change scale to Centimeters
    (vla-Regen doc acAllViewports)
    (alert "The alternate dimension units are now set to centimeters.")
)


Angle Property (ActiveX)

Gets the angle of a line.

Supported platforms: Windows only

Signature

VBA:

object.Angle
object

Type: Line

The object this property applies to.

Property Value

Read-only: Yes

Type: Double

The angle of the line in radians. The angle measurement begins at the X axis and proceeds in a counterclockwise direction.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Angle()
    ' This example adds a line in model space and returns the angle of the new line

    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double, endPoint(0 To 2)  As Double

    ' Define the start and end points for the line
    startPoint(0) = 1: startPoint(1) = 1: startPoint(2) = 0
    endPoint(0) = 5: endPoint(1) = 5: endPoint(2) = 0

    ' Create the line in model space
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ThisDrawing.Application.ZoomAll

    MsgBox "The angle of the new Line is: " & lineObj.angle
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Angle()
    ;; This example adds a line in model space and returns the angle of the new line
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the start and end points for the line
    (setq startPoint (vlax-3d-point 1 1 0)
          endPoint (vlax-3d-point 5 5 0))

    ;; Create the line in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    (vla-ZoomAll acadObj)

    (alert (strcat "The angle of the new Line is: " (rtos (vla-get-Angle lineObj) 2)))
)


AngleFormat Property (ActiveX)

Specifies the unit format for angular dimensions.

Supported platforms: Windows only

Signature

VBA:

object.AngleFormat
object

Type: Dim3PointAngular, DimAngular

The objects this property applies to.

Property Value

Read-only: No

Type: acAngleUnits enum

  • acDegrees
  • acDegreeMinuteSeconds
  • acGrads
  • acRadians

Remarks

The initial value for this property is acDegrees.

NoteThis property overrides the value of the DIMAUNIT system variable for the given dimension.

Examples

VBA:

Sub Example_AngleFormat()
    ' This example creates a Dim3PointAngular object in model space
    ' and sets its Angle Format to some common values

    Dim DimPointAngularObj As AcadDim3PointAngular
    Dim AngleVertex(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double

    ' Define the new Dim3PointAngular object
    AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
    FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
    SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
    TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

    ' Create the new Dim3PointAngular object in model space
    Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)
    ThisDrawing.Application.ZoomAll

    ' Cycle through some common angle formats

    DimPointAngularObj.AngleFormat = acDegreeMinuteSeconds
    ThisDrawing.Regen acAllViewports
    MsgBox "The angle format of the new Dim3PointAngular object is now set to degree/minute/second"

    DimPointAngularObj.AngleFormat = acGrads
    ThisDrawing.Regen acAllViewports
    MsgBox "The angle format of the new Dim3PointAngular object is now set to grads"

    DimPointAngularObj.AngleFormat = acRadians
    ThisDrawing.Regen acAllViewports
    MsgBox "The angle format of the new Dim3PointAngular object is now set to radians"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AngleFormat()
    ;; This example creates a Dim3PointAngular object in model space
    ;; and sets its Angle Format to some common values
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Dim3PointAngular object
    (setq AngleVertex (vlax-3d-point 0 0 0)
          FirstPoint (vlax-3d-point 2 2 0)
          SecondPoint (vlax-3d-point 1 4 0)
          TextPoint (vlax-3d-point 6 6 0))

    ;; Create the new Dim3PointAngular object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq DimPointAngularObj (vla-AddDim3PointAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    ;; Cycle through some common angle formats

    (vla-put-AngleFormat DimPointAngularObj acDegreeMinuteSeconds)
    (vla-Regen doc acAllViewports)
    (alert "The angle format of the new Dim3PointAngular object is now set to degree/minute/second.")

    (vla-put-AngleFormat DimPointAngularObj acGrads)
    (vla-Regen doc acAllViewports)
    (alert "The angle format of the new Dim3PointAngular object is now set to grads.")

    (vla-put-AngleFormat DimPointAngularObj acRadians)
    (vla-Regen doc acAllViewports)
    (alert "The angle format of the new Dim3PointAngular object is now set to radians.")
)


AngleVertex Property (ActiveX)

Specifies the angle vertex for the three-point angular dimension.

Supported platforms: Windows only

Signature

VBA:

object.AngleVertex
object

Type: Dim3PointAngular

The object this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

A 3D coordinate representing the angle vertex.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AngleVertex()
    ' This example creates a Dim3PointAngular object in model space
    ' and then alters its angle vertex

    Dim DimPointAngularObj As AcadDim3PointAngular
    Dim AngleVertex(0 To 2) As Double, NewAngleVertex(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double
    Dim CurrentVertex As Variant

    ' Define the new Dim3PointAngular object
    AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
    NewAngleVertex(0) = 1: NewAngleVertex(1) = 1: NewAngleVertex(2) = 0
    FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
    SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
    TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

    ' Create the new Dim3PointAngular object in model space
    Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)
    ThisDrawing.Application.ZoomAll

    ' Display current vertex
    CurrentVertex = DimPointAngularObj.AngleVertex
    MsgBox "The angle vertex of the new object is set to:" & vbCrLf & _
            CurrentVertex(0) & vbCrLf & _
            CurrentVertex(1) & vbCrLf & _
            CurrentVertex(2)

    ' Alter vertex setting for this object
    DimPointAngularObj.AngleVertex = NewAngleVertex
    ThisDrawing.Regen acAllViewports

    ' Display new vertex settings
    CurrentVertex = DimPointAngularObj.AngleVertex
    MsgBox "The angle vertex of the object has been reset to:" & vbCrLf & _
            CurrentVertex(0) & vbCrLf & _
            CurrentVertex(1) & vbCrLf & _
            CurrentVertex(2)

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AngleVertex()
    ;; This example creates a Dim3PointAngular object in model space
    ;; and then alters its angle vertex
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Dim3PointAngular object
    (setq AngleVertex (vlax-3d-point 2 5 0)
          NewAngleVertex (vlax-3d-point 1 1 0)
          FirstPoint (vlax-3d-point 2 2 0)
          SecondPoint (vlax-3d-point 1 4 0)
          TextPoint (vlax-3d-point 6 6 0))

    ;; Create the new Dim3PointAngular object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq DimPointAngularObj (vla-AddDim3PointAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    ;; Display current vertex
    (setq CurrentVertex (vla-get-AngleVertex DimPointAngularObj))
    (alert (strcat "The angle vertex of the new object is set to:\n"
                   (rtos (vlax-safearray-get-element (vlax-variant-value CurrentVertex) 0) 2) "\n"
                   (rtos (vlax-safearray-get-element (vlax-variant-value CurrentVertex) 1) 2) "\n"
                   (rtos (vlax-safearray-get-element (vlax-variant-value CurrentVertex) 2) 2)))

    ;; Alter vertex setting for this object
    (vla-put-AngleVertex DimPointAngularObj NewAngleVertex)
    (vla-Regen doc acAllViewports)

    ;; Display new vertex settings
    (setq CurrentVertex (vla-get-AngleVertex DimPointAngularObj))
    (alert (strcat "The angle vertex of the object has been reset to:\n"
                   (rtos (vlax-safearray-get-element (vlax-variant-value CurrentVertex) 0) 2) "\n"
                   (rtos (vlax-safearray-get-element (vlax-variant-value CurrentVertex) 1) 2) "\n"
                   (rtos (vlax-safearray-get-element (vlax-variant-value CurrentVertex) 2) 2)))
)


Annotation Property (ActiveX)

Specifies the annotation object for a leader.

Supported platforms: Windows only

Signature

VBA:

object.Annotation
object

Type: Leader

The object this property applies to.

Property Value

Read-only: No

Type: BlockReference, MText, Tolerance

The annotation object for the leader. Leader annotations can be a tolerance object, multiline text object, or a block reference.

Remarks

Not all leaders have annotation objects. If a leader has no annotation, this property will return Nothing (logical False). To test for a logical False value in VB or VBA, use the Nothing keyword.

Examples

VBA:

Sub Example_Annotation()
    ' This example creates a leader in model space with an associated
    ' annotation and then checks for the existence of an
    ' Annotation object for the new Leader

    Dim leaderObj As AcadLeader, MTextObj As AcadMText
    Dim points(0 To 8) As Double, insertionPoint(0 To 2) As Double, width As Double
    Dim leaderType As Integer
    Dim annotationObject As Object
    Dim textString As String, msg As String

    ' Define the new MText object
    textString = "Hello, World."
    insertionPoint(0) = 5: insertionPoint(1) = 5: insertionPoint(2) = 0
    width = 2

    ' Create the MText object in model space
    Set MTextObj = ThisDrawing.ModelSpace.AddMText(insertionPoint, width, textString)

    ' Data for Leader
    points(0) = 0: points(1) = 0: points(2) = 0
    points(3) = 4: points(4) = 4: points(5) = 0
    points(6) = 4: points(7) = 5: points(8) = 0
    leaderType = acLineWithArrow

    ' Create the Leader object in model space and Associate new MText object
    ' with new Leader by making the MText object the annotation for the Leader
    Set annotationObject = MTextObj
    Set leaderObj = ThisDrawing.ModelSpace.AddLeader(points, annotationObject, leaderType)
    ThisDrawing.Application.ZoomAll

    ' Display whether or not this particular Leader has an associated Annotation
    msg = IIf(leaderObj.Annotation Is Nothing, "does not have", "has")
    MsgBox "The new Leader object " & msg & " an associated Annotation object."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Annotation()
    ;; This example creates a leader in model space with an associated
    ;; annotation and then checks for the existence of an
    ;; Annotation object for the new Leader
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new MText object
    (setq insertionPoint (vlax-3d-point 5 5 0)
          textString "Hello, World."
          width 2)

    ;; Create the MText object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MTextObj (vla-AddMText modelSpace insertionPoint width textString))

    ;; Data for Leader
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill points '(0 0 0
                  4 4 0
                  4 5 0
                 ))
    (setq leaderType acLineWithArrow)

    ;; Create the Leader object in model space and Associate new MText object
    ;; with new Leader by making the MText object the annotation for the Leader
    (setq annotationObject MTextObj)
    (setq leaderObj (vla-AddLeader modelSpace points annotationObject leaderType))
    (vla-ZoomAll acadObj)

    (alert "The new Leader object has an associated Annotation object.")
)


Annotative Property (ActiveX)

Specifies the Annotative of the mleaderstyle.

Supported platforms: Windows only

Signature

VBA:

object.Annotative
object

Type: MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

The annotative status of the object.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Application Property (ActiveX)

Gets the Application object.

Supported platforms: Windows only

Signature

VBA:

object.Application
object

Type: All objects

The object this property applies to.

Property Value

Read-only: Yes

Type: Application

The Application object that is the owner of the object.

Remarks

The Application object represents the application's frame controls and path settings, and provides the means to navigate down the object hierarchy.

Examples

VBA:

Sub Example_Application()
    ' This example creates a line and then uses the
    ' Application property of the line to return the
    ' application name.
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    Dim myApp As AcadApplication

    ' Create a new line reference
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    lineObj.Update

    ' Return the application for the object
    Set myApp = lineObj.Application

    ' Display the name of the application
    MsgBox "The application name is: " & myApp.name, vbInformation, "Application Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Application()
    ;; This example creates a line and then uses the
    ;; Application property of the line to return the
    ;; application name.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create a new line reference
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 2 2 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-Update lineObj)

    ;; Return the application for the object
    (setq myApp (vla-get-Application lineObj))

    ;; Display the name of the application
    (alert (strcat "The application name is: " (vla-get-Name myApp)))
)


ArcEndParam Property (ActiveX)

Specifies the end parameter of the arc.

Supported platforms: Windows only

Signature

VBA:

object.ArcEndParam
object

Type: DimArcLength

The object this property applies to.

Property Value

Read-only: No

Type: Double

The current end parameter of the arc.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ArcLength Property (ActiveX)

Gets the length of the arc.

Supported platforms: Windows only

Signature

VBA:

object.ArcLength
object

Type: Arc

The object this property applies to.

Property Value

Read-only: Yes

Type: Double

The length of the arc.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ArcLength()
    ' This example creates an Arc in model space and returns the length of the new Arc
    Dim arcObj As AcadArc
    Dim centerPoint(0 To 2)  As Double
    Dim radius As Double
    Dim startAngleInDegree As Double, endAngleInDegree As Double
    Dim startAngleInRadian As Double, endAngleInRadian As Double

    ' Define the Arc
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    radius = 5#
    startAngleInDegree = 10#: endAngleInDegree = 230#

    ' Convert the angles in degrees to angles in radians
    startAngleInRadian = startAngleInDegree * 3.141592 / 180#
    endAngleInRadian = endAngleInDegree * 3.141592 / 180#

    ' Create the arc object in model space
    Set arcObj = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngleInRadian, endAngleInRadian)
    ThisDrawing.Application.ZoomAll

    ' Return length of new arc
    MsgBox "The length of the new Arc is: " & arcObj.ArcLength
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ArcLength()
    ;; This example creates an Arc in model space and returns the length of the new Arc
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Arc
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius 5
          startAngleInDegree 10
          endAngleInDegree 230)

    ;; Convert the angles in degrees to angles in radians
    (setq startAngleInRadian (/ (* startAngleInDegree 3.141592) 180))
    (setq endAngleInRadian (/ (* endAngleInDegree 3.141592) 180))

    ;; Create the arc object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq arcObj (vla-AddArc modelSpace centerPoint radius startAngleInRadian endAngleInRadian))
    (vla-ZoomAll acadObj)

    ;; Return length of new arc
    (alert (strcat "The length of the new Arc is: " (rtos (vla-get-ArcLength arcObj) 2)))
)


ArcPoint Property (ActiveX)

Specifies a point on the arc.

Supported platforms: Windows only

Signature

VBA:

object.ArcPoint
object

Type: DimArcLength

The object this property applies to.

Property Value

Read-only: Yes

Type: Variant

Point on the arc.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ArcSmoothness Property (ActiveX)

Specifies the smoothness of circles, arcs, and ellipses.

Supported platforms: Windows only

Signature

VBA:

object.ArcSmoothness
object

Type: PViewport, Viewport

The objects this property applies to.

Property Value

Read-only: No

Type: Integer

A positive integer from 1 to 20,000.

Remarks

The initial value for this property is 100.

A higher number produces smoother objects, but AutoCAD requires more time to regenerate them. You can improve performance by setting this property to a low value for drawing and increasing the value for rendering. The valid range is 1 through 20,000.

Examples

VBA:

Sub Example_ArcSmoothness()
    ' This example returns the current setting of
    ' ArcSmoothness. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim currArcSmoothness As Integer
    Dim newArcSmoothness As Integer

    ' Retrieve the current ArcSmoothness value
    currArcSmoothness = ThisDrawing.ActiveViewport.ArcSmoothness
    MsgBox "The current value for ArcSmoothness is " & currArcSmoothness, vbInformation, "ArcSmoothness Example"

    ' Change the value for ArcSmoothness
    newArcSmoothness = 2001
    ThisDrawing.ActiveViewport.ArcSmoothness = newArcSmoothness
    MsgBox "The new value for ArcSmoothness is " & newArcSmoothness, vbInformation, "ArcSmoothness Example"

    ' Reset ArcSmoothness to its original value
    ThisDrawing.ActiveViewport.ArcSmoothness = currArcSmoothness
    MsgBox "The ArcSmoothness value is reset to " & currArcSmoothness, vbInformation, "ArcSmoothness Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ArcSmoothness()
    ;; This example returns the current setting of
    ;; ArcSmoothness. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Retrieve the current ArcSmoothness value
    (setq currArcSmoothness (vla-get-ArcSmoothness (vla-get-ActiveViewport doc)))
    (alert (strcat "The current value for ArcSmoothness is " (itoa currArcSmoothness)))

    ;; Change the value for ArcSmoothness
    (setq newArcSmoothness 2001)
    (vla-put-ArcSmoothness (vla-get-ActiveViewport doc) newArcSmoothness)
    (alert (strcat "The new value for ArcSmoothness is " (itoa newArcSmoothness)))

    ;; Reset ArcSmoothness to its original value
    (vla-put-ArcSmoothness (vla-get-ActiveViewport doc) currArcSmoothness)
    (alert (strcat "The ArcSmoothness value is reset to " (itoa currArcSmoothness)))
)


ArcStartParam Property (ActiveX)

Specifies the start parameter of the arc.

Supported platforms: Windows only

Signature

VBA:

object.ArcStartParam
object

Type: DimArcLength

The object this property applies to.

Property Value

Read-only: No

Type: Double

The current start parameter of the arc.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Area Property (ActiveX)

Specifies the enclosed area of an arc, circle, ellipse, hatch, lightweight polyline, polyline, region, or planar-closed spline.

Supported platforms: Windows only

Signature

VBA:

object.Area
object

Type: Arc, Circle, Ellipse, Hatch, LWPolyline, Polyline, Region, Spline

The objects this property applies to.

Property Value

Read-only: No, for Circle objects; Yes, for all other objects

Type: Double

The area of the object specified in square drawing units.

Remarks

Hatch objects:

The total area of the combined areas for the fill.

Wide polylines:

The area is defined by the center of the width.

Regions:

The area equals the combined area for all the objects in the region.

Open objects such as arcs, spline curves, and open polylines:

The area is computed as though a straight line connects the start point and endpoint.

Examples

VBA:

Sub Example_Area()
    ' This example creates a polyline object and
    ' then uses the area property to find the
    ' area of that polyline.

    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    Dim plineArea As Double

    ' Establish the points for the Polyline
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5

    ' Create the polyline in model space
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)

    ' Close the polyline and update display of it
    plineObj.Closed = True
    plineObj.Update
    ZoomAll

    ' Get the area of the polyline
    plineArea = plineObj.Area

    MsgBox "The area of the new Polyline is: " & plineArea, vbInformation, "Area Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Area()
    ;; This example creates a polyline object and
    ;; then uses the area property to find the
    ;; area of that polyline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Establish the points for the Polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
                  9 2
                  3 5
                 )
    )

    ;; Create the polyline in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))

    ;; Close the polyline and update display of it
    (vla-put-Closed plineObj :vlax-true)
    (vla-Update plineObj)
    (vla-ZoomAll acadObj)

    ;; Get the area of the polyline
    (setq plineArea (vla-get-Area plineObj))

    (alert (strcat "The area of the new Polyline is: " (rtos plineArea 2)))
)


Arrowhead1Block Property (ActiveX)

Specifies the block to use as the custom arrowhead for the first end of the dimension line.

Supported platforms: Windows only

Signature

VBA:

object.Arrowhead1Block
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: String

The name of the block to use as the arrowhead for the first end of the dimension line.

Remarks

NoteThis property overrides the value of the DIMBLK1 system variable for the given dimension.

Examples

VBA:

Sub Example_ArrowHead1Block()
    ' This example creates an aligned dimension object in model space
    ' and then alters the visible appearance (shape) of the arrowhead
    ' using the ArrowHeadBlock property.
    ' Use the ArrowHeadBlock property to set the arrowhead to an existing
    ' block object containing a custom Circle object

    Dim DimPointAngularObj As AcadDim3PointAngular
    Dim AngleVertex(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double
    Dim BlockName As String

    ' Define the new Dim3PointAngular object
    AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
    FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
    SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
    TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

    ' Create the new Dim3PointAngular object in model space
    Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)
    ZoomAll

    ' Set arrowhead type to user-defined to allow
    ' the use of a block as the new arrowhead
    'dimObj.ArrowheadType = acArrowUserDefined
    DimPointAngularObj.Arrowhead1Block = "CBlock"
    DimPointAngularObj.Arrowhead2Block = "CBlock"
    ZoomAll

    ' Read and display current arrowhead block name
    BlockName = DimPointAngularObj.Arrowhead1Block

    MsgBox "The arrowhead block name for this object is: " & BlockName

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ArrowHead1Block()
    ;; This example creates an aligned dimension object in model space
    ;; and then alters the visible appearance (shape) of the arrowhead
    ;; using the ArrowHeadBlock property.
    ;; Use the ArrowHeadBlock property to set the arrowhead to an existing
    ;; block object containing a custom Circle object
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Dim3PointAngular object
    (setq AngleVertex (vlax-3d-point 0 0 0)
          FirstPoint (vlax-3d-point 2 2 0)
          SecondPoint (vlax-3d-point 1 4 0)
          TextPoint (vlax-3d-point 6 6 0))

    ;; Create the new Dim3PointAngular object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq DimPointAngularObj (vla-AddDim3PointAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    ;; Use the custom block as the new arrowhead, the block must exist in the drawing
    (vla-put-Arrowhead1Block DimPointAngularObj "CBlock")
    (vla-put-Arrowhead2Block DimPointAngularObj "CBlock")
    (vla-ZoomAll acadObj)

    ;; Read and display current arrowhead block name
    (setq BlockName (vla-get-Arrowhead1Block DimPointAngularObj))

    (alert (strcat "The arrowhead block name for this object is: " BlockName))
)


Arrowhead1Type Property (ActiveX)

Specifies the type of arrowhead for the first end of the dimension line.

Supported platforms: Windows only

Signature

VBA:

object.Arrowhead1Type
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: acDimArrowheadType enum

  • acArrowDefault
  • acArrowDot
  • acArrowDotSmall
  • acArrowDotBlank
  • acArrowOrigin
  • acArrowOrigin2
  • acArrowOpen
  • acArrowOpen90
  • acArrowOpen30
  • acArrowClosed
  • acArrowSmall
  • acArrowNone
  • acArrowOblique
  • acArrowBoxFilled
  • acArrowBoxBlank
  • acArrowClosedBlank
  • acArrowDatumFilled
  • acArrowDatumBlank
  • acArrowIntegral
  • acArrowArchTick
  • acArrowUserDefined Read-only

Remarks

The initial value for this property is acArrowDefault.

When you use the Arrowhead1Block property to specify a block to use as a custom arrowhead, this property will be set to acArrowUserDefined.

NoteThis property overrides the value of the DIMBLK1 system variable for the given dimension.

Examples

VBA:

Sub Example_ArrowHead1Type()
    ' This example creates a Dim3PointAngular object in model space
    ' and then alters the visible appearance (shape) of its arrowheads
    ' using the ArrowHead1Type and ArrowHead2Type properties

    Dim DimPointAngularObj As AcadDim3PointAngular
    Dim AngleVertex(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double

    ' Define the new Dim3PointAngular object
    AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
    FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
    SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
    TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

    ' Create the new Dim3PointAngular object in model space
    Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)
    ThisDrawing.Application.ZoomAll

    ' Read and display current arrowhead type
    MsgBox "The arrowhead type for the first arrow of this object is: " & DimPointAngularObj.Arrowhead1Type & vbCrLf & _
           "The arrowhead type for the second arrow of this object is: " & DimPointAngularObj.Arrowhead2Type

    ' Alter the arrowhead type property for both arrows of this object
    DimPointAngularObj.Arrowhead1Type = acArrowBoxBlank
    DimPointAngularObj.Arrowhead2Type = acArrowBoxBlank
    ThisDrawing.Regen acAllViewports

    ' Read and display current arrowhead type
    MsgBox "The arrowhead type for the first arrow of this object is now set to: " & DimPointAngularObj.Arrowhead1Type & vbCrLf & _
           "The arrowhead type for the second arrow of this object is now set to: " & DimPointAngularObj.Arrowhead2Type
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ArrowHead1Type()
    ;; This example creates a Dim3PointAngular object in model space
    ;; and then alters the visible appearance (shape) of its arrowheads
    ;; using the ArrowHead1Type and ArrowHead2Type properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Dim3PointAngular object
    (setq AngleVertex (vlax-3d-point 0 0 0)
          FirstPoint (vlax-3d-point 2 2 0)
          SecondPoint (vlax-3d-point 1 4 0)
          TextPoint (vlax-3d-point 6 6 0))

    ;; Create the new Dim3PointAngular object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq DimPointAngularObj (vla-AddDim3PointAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    ;; Read and display current arrowhead type
    (alert (strcat "The arrowhead type for the first arrow of this object is: " (itoa (vla-get-Arrowhead1Type DimPointAngularObj))
                   "\nThe arrowhead type for the second arrow of this object is: " (itoa (vla-get-Arrowhead2Type DimPointAngularObj))))

    ;; Alter the arrowhead type property for both arrows of this object
    (vla-put-Arrowhead1Type DimPointAngularObj acArrowBoxBlank)
    (vla-put-Arrowhead2Type DimPointAngularObj acArrowBoxBlank)
    (vla-Regen doc acAllViewports)

    ;; Read and display current arrowhead type
    (alert (strcat "The arrowhead type for the first arrow of this object is now set to: " (itoa (vla-get-Arrowhead1Type DimPointAngularObj))
                   "\nThe arrowhead type for the second arrow of this object is now set to: " (itoa (vla-get-Arrowhead2Type DimPointAngularObj))))
)


Arrowhead2Block Property (ActiveX)

Specifies the block to use as the custom arrowhead for the second end of the dimension line.

Supported platforms: Windows only

Signature

VBA:

object.Arrowhead2Block
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: String

The name of the block to use as the arrowhead for the first end of the dimension line.

Remarks

NoteThis property overrides the value of the DIMBLK2 system variable for the given dimension.

Examples

VBA:

Sub Example_ArrowHead2Block()
    ' This example creates an aligned dimension object in model space
    ' and then alters the visible appearance (shape) of the arrowhead
    ' using the ArrowHeadBlock property.
    ' Use the ArrowHeadBlock property to set the arrowhead to an existing
    ' block object containing a custom Circle object

    Dim DimPointAngularObj As AcadDim3PointAngular
    Dim AngleVertex(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double
    Dim BlockName As String

    ' Define the new Dim3PointAngular object
    AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
    FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
    SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
    TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

    ' Create the new Dim3PointAngular object in model space
    Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)
    ZoomAll

    ' Set arrowhead type to user-defined to allow
    ' the use of a block as the new arrowhead
    'dimObj.ArrowheadType = acArrowUserDefined
    DimPointAngularObj.Arrowhead1Block = "CBlock"
    DimPointAngularObj.Arrowhead2Block = "CBlock"
    ZoomAll

    ' Read and display current arrowhead block name
    BlockName = DimPointAngularObj.Arrowhead2Block

    MsgBox "The arrowhead block name for this object is: " & BlockName

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ArrowHead2Block()
    ;; This example creates an aligned dimension object in model space
    ;; and then alters the visible appearance (shape) of the arrowhead
    ;; using the ArrowHeadBlock property.
    ;; Use the ArrowHeadBlock property to set the arrowhead to an existing
    ;; block object containing a custom Circle object
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Dim3PointAngular object
    (setq AngleVertex (vlax-3d-point 0 0 0)
          FirstPoint (vlax-3d-point 2 2 0)
          SecondPoint (vlax-3d-point 1 4 0)
          TextPoint (vlax-3d-point 6 6 0))

    ;; Create the new Dim3PointAngular object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq DimPointAngularObj (vla-AddDim3PointAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    ;; Use the custom block as the new arrowhead, the block must exist in the drawing
    (vla-put-Arrowhead1Block DimPointAngularObj "CBlock")
    (vla-put-Arrowhead2Block DimPointAngularObj "CBlock")
    (vla-ZoomAll acadObj)

    ;; Read and display current arrowhead block name
    (setq BlockName (vla-get-Arrowhead2Block DimPointAngularObj))

    (alert (strcat "The arrowhead block name for this object is: " BlockName))
)


Arrowhead2Type Property (ActiveX)

Specifies the type of arrowhead for the second end of the dimension line.

Supported platforms: Windows only

Signature

VBA:

object.Arrowhead2Type
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: acDimArrowheadType enum

  • acArrowDefault
  • acArrowDot
  • acArrowDotSmall
  • acArrowDotBlank
  • acArrowOrigin
  • acArrowOrigin2
  • acArrowOpen
  • acArrowOpen90
  • acArrowOpen30
  • acArrowClosed
  • acArrowSmall
  • acArrowNone
  • acArrowOblique
  • acArrowBoxFilled
  • acArrowBoxBlank
  • acArrowClosedBlank
  • acArrowDatumFilled
  • acArrowDatumBlank
  • acArrowIntegral
  • acArrowArchTick
  • acArrowUserDefined Read-only

Remarks

The initial value for this property is acArrowDefault.

When you use the Arrowhead2Block property to specify a block to use as a custom arrowhead, this property will be set to acArrowUserDefined.

NoteThis property overrides the value of the DIMBLK2 system variable for the given dimension.

Examples

VBA:

Sub Example_ArrowHead2Type()
    ' This example creates a Dim3PointAngular object in model space
    ' and then alters the visible appearance (shape) of its arrowheads
    ' using the ArrowHead1Type and ArrowHead2Type properties

    Dim DimPointAngularObj As AcadDim3PointAngular
    Dim AngleVertex(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double

    ' Define the new Dim3PointAngular object
    AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
    FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
    SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
    TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

    ' Create the new Dim3PointAngular object in model space
    Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)
    ThisDrawing.Application.ZoomAll

    ' Read and display current arrowhead type
    MsgBox "The arrowhead type for the first arrow of this object is: " & DimPointAngularObj.Arrowhead1Type & vbCrLf & _
           "The arrowhead type for the second arrow of this object is: " & DimPointAngularObj.Arrowhead2Type

    ' Alter the arrowhead type property for both arrows of this object
    DimPointAngularObj.Arrowhead1Type = acArrowBoxBlank
    DimPointAngularObj.Arrowhead2Type = acArrowBoxBlank
    ThisDrawing.Regen acAllViewports

    ' Read and display current arrowhead type
    MsgBox "The arrowhead type for the first arrow of this object is now set to: " & DimPointAngularObj.Arrowhead1Type & vbCrLf & _
           "The arrowhead type for the second arrow of this object is now set to: " & DimPointAngularObj.Arrowhead2Type
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ArrowHead2Type()
    ;; This example creates a Dim3PointAngular object in model space
    ;; and then alters the visible appearance (shape) of its arrowheads
    ;; using the ArrowHead1Type and ArrowHead2Type properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Dim3PointAngular object
    (setq AngleVertex (vlax-3d-point 0 0 0)
          FirstPoint (vlax-3d-point 2 2 0)
          SecondPoint (vlax-3d-point 1 4 0)
          TextPoint (vlax-3d-point 6 6 0))

    ;; Create the new Dim3PointAngular object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq DimPointAngularObj (vla-AddDim3PointAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    ;; Read and display current arrowhead type
    (alert (strcat "The arrowhead type for the first arrow of this object is: " (itoa (vla-get-Arrowhead1Type DimPointAngularObj))
                   "\nThe arrowhead type for the second arrow of this object is: " (itoa (vla-get-Arrowhead2Type DimPointAngularObj))))

    ;; Alter the arrowhead type property for both arrows of this object
    (vla-put-Arrowhead1Type DimPointAngularObj acArrowBoxBlank)
    (vla-put-Arrowhead2Type DimPointAngularObj acArrowBoxBlank)
    (vla-Regen doc acAllViewports)

    ;; Read and display current arrowhead type
    (alert (strcat "The arrowhead type for the first arrow of this object is now set to: " (itoa (vla-get-Arrowhead1Type DimPointAngularObj))
                   "\nThe arrowhead type for the second arrow of this object is now set to: " (itoa (vla-get-Arrowhead2Type DimPointAngularObj))))
)


ArrowheadBlock Property (ActiveX)

Specifies the block to use as the custom arrowhead for a radial dimension or leader line.

Supported platforms: Windows only

Signature

VBA:

object.ArrowheadBlock
object

Type: DimRadial, DimRadialLarge, Leader, MLeader, MLeaderLeader

The objects this property applies to.

Property Value

Read-only: No

Type: String

The name of the block to use as the arrowhead for the leader.

Remarks

NoteThis property overrides the value of the DIMLDRBLK system variable for the given dimension.

Examples

VBA:

Sub Example_ArrowHeadBlock()
    ' This example creates a radial dimension object in model space
    ' and then alters the visible appearance (shape) of the arrowhead
    ' using the ArrowHeadBlock property.
    ' Use the ArrowHeadBlock property to set the arrowhead to an existing
    ' block object containing a custom Circle object

    Dim dimObj As AcadDimRadial
    Dim center(0 To 2) As Double
    Dim chordPoint(0 To 2) As Double
    Dim leaderLen As Integer
    Dim BlockName As String

    ' Define the dimension
    center(0) = 0#: center(1) = 0#: center(2) = 0#
    chordPoint(0) = 5#: chordPoint(1) = 5#: chordPoint(2) = 0#
    leaderLen = 5

    ' Create the radial dimension in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimRadial(center, chordPoint, leaderLen)
    ZoomAll

    ' Set arrowhead type to user-defined to allow
    ' the use of a block as the new arrowhead
    'dimObj.ArrowheadType = acArrowUserDefined
    dimObj.ArrowheadBlock = "CBlock"
    ZoomAll

    ' Read and display current arrowhead block name
    BlockName = dimObj.ArrowheadBlock

    MsgBox "The arrowhead block name for this object is: " & BlockName

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ArrowHeadBlock()
    ;; This example creates a radial dimension object in model space
    ;; and then alters the visible appearance (shape) of the arrowhead
    ;; using the ArrowHeadBlock property.
    ;; Use the ArrowHeadBlock property to set the arrowhead to an existing
    ;; block object containing a custom Circle object
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq center (vlax-3d-point 0 0 0)
          chordPoint (vlax-3d-point 5 5 0)
          leaderLen 5)

    ;; Create the radial dimension in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimRadial modelSpace center chordPoint leaderLen))
    (vla-ZoomAll acadObj)

    ;; Use the custom block as the new arrowhead, the block must exist in the drawing
    (vla-put-ArrowheadBlock dimObj "CBlock")
    (vla-ZoomAll acadObj)

    ;; Read and display current arrowhead block name
    (setq BlockName (vla-get-ArrowheadBlock dimObj))

    (alert (strcat "The arrowhead block name for this object is: " BlockName))
)


ArrowheadSize Property (ActiveX)

Specifies the size of dimension line arrowheads, leader and mleader line arrowheads, and hook lines.

Supported platforms: Windows only

Signature

VBA:

object.ArrowheadSize
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated, Leader, MLeader, MLeaderLeader

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The size of the arrowhead must be specified as a positive real >= 0.0.

Remarks

The initial value for this property is 0.1800.

Multiples of the arrowhead size determine if dimension lines and text should fit between the extension lines. This property is also used to scale arrowhead blocks if set by DIMBLK. This property has no effect when DIMTSZ is other than zero.

NoteThis property overrides the value of the DIMASZ system variable for the given dimension.

Examples

VBA:

Sub Example_ArrowHeadSize()
    ' This example creates a Dim3PointAngular object in model space
    ' and then alters the visible appearance (size) of its arrowheads
    ' using the ArrowHeadSize property

    Dim DimPointAngularObj As AcadDim3PointAngular
    Dim AngleVertex(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double

    ' Define the new Dim3PointAngular object
    AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
    FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
    SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
    TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

    ' Create the new Dim3PointAngular object in model space
    Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)
    ThisDrawing.Application.ZoomAll

    ' Read and display current arrowhead size
    MsgBox "The arrowhead size for this object is currently set to: " & DimPointAngularObj.ArrowheadSize

    ' Alter the arrowhead size property for this object
    DimPointAngularObj.ArrowheadSize = 0.5
    ThisDrawing.Regen acAllViewports

    ' Read and display new arrowhead size setting
    MsgBox "The arrowhead size for this object is now set to: " & DimPointAngularObj.ArrowheadSize
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ArrowHeadSize()
    ;; This example creates a Dim3PointAngular object in model space
    ;; and then alters the visible appearance (size) of its arrowheads
    ;; using the ArrowHeadSize property
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Dim3PointAngular object
    (setq AngleVertex (vlax-3d-point 0 0 0)
          FirstPoint (vlax-3d-point 2 2 0)
          SecondPoint (vlax-3d-point 1 4 0)
          TextPoint (vlax-3d-point 6 6 0))

    ;; Create the new Dim3PointAngular object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq DimPointAngularObj (vla-AddDim3PointAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    ;; Read and display current arrowhead size
    (alert (strcat "The arrowhead size for this object is currently set to: " (rtos (vla-get-ArrowheadSize DimPointAngularObj) 2)))

    ;; Alter the arrowhead size property for this object
    (vla-put-ArrowheadSize DimPointAngularObj 0.5)
    (vla-Regen doc acAllViewports)

    ;; Read and display new arrowhead size setting
    (alert (strcat "The arrowhead size for this object is now set to: " (rtos (vla-get-ArrowheadSize DimPointAngularObj) 2)))
)


ArrowheadType Property (ActiveX)

Specifies the type of arrowhead for the radial dimension, leader, or mleader.

Supported platforms: Windows only

Signature

VBA:

object.ArrowheadType
object

Type: DimRadial, DimRadialLarge, Leader, MLeader, MLeaderLeader

The objects this property applies to.

Property Value

Read-only: No

Type: acDimArrowheadType enum

  • acArrowDefault
  • acArrowDot
  • acArrowDotSmall
  • acArrowDotBlank
  • acArrowOrigin
  • acArrowOrigin2
  • acArrowOpen
  • acArrowOpen90
  • acArrowOpen30
  • acArrowClosed
  • acArrowSmall
  • acArrowNone
  • acArrowOblique
  • acArrowBoxFilled
  • acArrowBoxBlank
  • acArrowClosedBlank
  • acArrowDatumFilled
  • acArrowDatumBlank
  • acArrowIntegral
  • acArrowArchTick
  • acArrowUserDefined Read-only

Remarks

The initial value for this property is acArrowDefault.

When you use the ArrowheadBlock property to specify a block to use as a custom arrowhead, this property will be set to acArrowUserDefined.

NoteThis property overrides the value of the DIMLDRBLK system variable for the given dimension.

Examples

VBA:

Sub Example_ArrowHeadType()
    ' This example creates a Leader object in model space with an associated Annotation
    ' and then alters the visible appearance (shape) of its arrowhead
    ' using the ArrowHeadType property

    Dim leaderObj As AcadLeader, MTextObj As AcadMText
    Dim points(0 To 8) As Double, insertionPoint(0 To 2) As Double, iTextWidth As Double
    Dim leaderType As Integer
    Dim annotationObject As Object
    Dim textString As String

    ' Define the new MText object
    textString = "Hello, World."
    insertionPoint(0) = 5: insertionPoint(1) = 5: insertionPoint(2) = 0
    iTextWidth = 2

    ' Create the MText object in model space
    Set MTextObj = ThisDrawing.ModelSpace.AddMText(insertionPoint, iTextWidth, textString)

    ' Data for Leader
    points(0) = 0: points(1) = 0: points(2) = 0
    points(3) = 4: points(4) = 4: points(5) = 0
    points(6) = 4: points(7) = 5: points(8) = 0
    leaderType = acLineWithArrow

    ' Create the Leader object in model space and Associate new MText object
    ' with new Leader by making the MText object the annotation for the Leader
    Set annotationObject = MTextObj
    Set leaderObj = ThisDrawing.ModelSpace.AddLeader(points, annotationObject, leaderType)
    ThisDrawing.Application.ZoomAll

    ' Read and display current arrowhead type
    MsgBox "The arrowhead type for this object is: " & leaderObj.ArrowheadType

    ' Alter the arrowhead type property for this object
    leaderObj.ArrowheadType = acArrowBoxBlank
    ThisDrawing.Application.ZoomAll

    ' Read and display current arrowhead type
    MsgBox "The arrowhead type for this object is now set to: " & leaderObj.ArrowheadType
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ArrowHeadType()
    ;; This example creates a Leader object in model space with an associated Annotation
    ;; and then alters the visible appearance (shape) of its arrowhead
    ;; using the ArrowHeadType property
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new MText object
    (setq insertionPoint (vlax-3d-point 5 5 0)
          textString "Hello, World."
      iTextWidth 2)

    ;; Create the MText object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MTextObj (vla-AddMText modelSpace insertionPoint iTextWidth textString))

    ;; Data for Leader
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill points '(0 0 0
                  4 4 0
                  4 5 0
                 )
    )
    (setq leaderType acLineWithArrow)

    ;; Create the Leader object in model space and Associate new MText object
    ;; with new Leader by making the MText object the annotation for the Leader
    (setq annotationObject MTextObj)
    (setq leaderObj (vla-AddLeader modelSpace points annotationObject leaderType))
    (vla-ZoomAll acadObj)

    ;; Read and display current arrowhead type
    (alert (strcat "The arrowhead type for this object is: " (itoa (vla-get-ArrowheadType leaderObj))))

    ;; Alter the arrowhead type property for this object
    (vla-put-ArrowheadType leaderObj acArrowBoxBlank)
    (vla-ZoomAll acadObj)

    ;; Read and display current arrowhead type
    (alert (strcat "The arrowhead type for this object is now set to: " (itoa (vla-get-ArrowheadType leaderObj))))
)


ArrowSize Property (ActiveX)

Specifies the arrow size of the mleaderstyle.

Supported platforms: Windows only

Signature

VBA:

object.ArrowSize
object

Type: MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: Long

Size of the arrow.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ArrowSymbol Property (ActiveX)

Specifies the arrow symbol of the mleaderstyle.

Supported platforms: Windows only

Signature

VBA:

object.ArrowSymbol
object

Type: MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: String

Block name of the arrow symbol.

Remarks

The following block names for standard arrowhead types can be specified for ArrowSymbol:

  • ""
  • "_ClosedBlank"
  • "_Closed"
  • "_Dot"
  • "_ArchTick"
  • "_Oblique"
  • "_Open"
  • "_Origin"
  • "_Origin2"
  • "_Open30"
  • "_Open90"
  • "_DotSmall"
  • "_DotBlank"
  • "_Small"
  • "_BoxBlank"
  • "_BoxFilled"
  • "_DatumBlank"
  • "_DatumFilled"
  • "_Integral"
  • "_None"
  • "_User"

Examples

VBA:

Not available

Visual LISP:

Not available


AssociativeHatch Property (ActiveX)

Specifies whether the hatch is associative.

Supported platforms: Windows only

Signature

VBA:

object.AssociativeHatch
object

Type: Hatch

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: The hatch is associative.
  • False: The hatch is not associative.

Remarks

An associative hatch is updated when its boundaries are modified. A nonassociative hatch is not updated when its boundaries are modified.

Associativity can only be set when a hatch is created. See the AddHatch method for more information on creating a hatch.

Examples

VBA:

Sub Example_AssociativeHatch()
    ' This example creates a hatch in model space.
    ' It then reports whether the hatch is associative.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "ANSI31"
    PatternType = 0
    bAssociativity = True

    ' Create the associative Hatch object
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)

    ' Create the outer loop for the hatch.
    ' An arc and a line are used to create a closed loop.

    Dim outerLoop(0 To 1) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    center(0) = 5: center(1) = 3: center(2) = 0
    radius = 3
    startAngle = 0
    endAngle = 3.141592
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddArc(center, radius, startAngle, endAngle)
    Set outerLoop(1) = ThisDrawing.ModelSpace.AddLine(outerLoop(0).startPoint, outerLoop(0).endPoint)

    ' Append the outer loop to the hatch object
    hatchObj.AppendOuterLoop (outerLoop)

    ' Evaluate and display the hatch
    hatchObj.Evaluate
    ThisDrawing.Regen True

    ' Return whether the hatch is associative.
    Dim hatchAssoc As Boolean
    hatchAssoc = hatchObj.AssociativeHatch
    MsgBox "The HatchStyle is " & IIf(hatchObj.AssociativeHatch, "associative.", "not associative."), , "AssociativeHatch Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AssociativeHatch()
    ;; This example creates a hatch in model space.
    ;; It then reports whether the hatch is associative.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "ANSI31"
          patternType 0
          bAssociativity :vlax-true)

    ;; Create the associative Hatch object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acHatchObject))

    ;; Create the outer loop for the hatch.
    ;; An arc and a line are used to create a closed loop.
    (setq center (vlax-3d-point 5 3 0)
          radius 3
          startAngle 0
          endAngle 3.141592)

    (setq arc (vla-AddArc modelSpace center radius startAngle endAngle))
    (setq line (vla-AddLine modelSpace (vla-get-StartPoint arc) (vla-get-EndPoint arc)))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element outerLoop 0 arc)
    (vlax-safearray-put-element outerLoop 1 line)

    ;; Append the outer loop to the hatch object
    (vla-AppendOuterLoop hatchObj outerLoop)

    ;; Evaluate and display the hatch
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)

    ;; Return whether the hatch is associative.
    (setq hatchAssoc (vla-get-AssociativeHatch hatchObj))
    (alert (strcat "The HatchStyle is " (if (= hatchAssoc :vlax-true) "associative." "not associative.")))
)


AttachmentPoint Property (ActiveX)

Specifies the attachment point for an MText object.

Supported platforms: Windows only

Signature

VBA:

object.AttachmentPoint
object

Type: MText

The object this property applies to.

Property Value

Read-only: No

Type: acAttachmentPoint enum

  • acAttachmentPointTopLeft
  • acAttachmentPointTopCenter
  • acAttachmentPointTopRight
  • acAttachmentPointMiddleLeft
  • acAttachmentPointMiddleCenter
  • acAttachmentPointMiddleRight
  • acAttachmentPointBottomLeft
  • acAttachmentPointBottomCenter
  • acAttachmentPointBottomRight

Remarks

The attachment point specifies where the insertion point aligns with the text boundary. The option you select determines both the text justification and text spill in relation to the text boundary. The options for text justification are Left, Right, and Center. The options for text spill are Top, Mid (middle), and Bottom.

Top Left left-justified, spills down | Top Center center-justified, spills down | Top Right right-justified, spills down
Mid Left left-justified, spills up and down | Mid Center center-justified, spills up and down | Mid Right right-justified, spills up and down
Bottom Left left-justified, spills up | Bottom Center center-justified, spills up | Bottom Right right-justified, spills up

When the AttachmentPoint property is changed, the position of the existing bounding box does not change; the text is simply rejustified within the bounding box. However, the InsertionPoint property reflects the coordinates of the attachment point being used, so the value of the InsertionPoint property will change to reflect the change in justification.

Examples

VBA:

Sub Example_AttachmentPoint()
    Dim MTextObj As AcadMText
    Dim width As Double
    Dim text As String
    Dim count As Integer
    Dim attachPoint As String
    Dim corner(0 To 2) As Double

    corner(0) = 3#: corner(1) = 3#: corner(2) = 0#
    width = 10
    text = "Hello, World."
    ' Creates a MText object in model space
    Set MTextObj = ThisDrawing.ModelSpace.AddMText(corner, width, text)

    For count = 1 To 9
        MTextObj.AttachmentPoint = count

        ' Gets the attachment point of an MText object
        attachPoint = Choose(MTextObj.AttachmentPoint, "TopLeft", "TopCenter", "TopRight", "MiddleLeft", "MiddleCenter", "MiddleRight", "BottomLeft", "BottomCenter", "BottomRight")

        ThisDrawing.Regen True
        MsgBox "The attachment point of the MText is now: " & attachPoint, vbInformation, "AttachmentPoint Example"
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AttachmentPoint()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq corner (vlax-3d-point 3 3 0)
          width 10
          text "Hello, World.")

    ;; Creates a MText object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MTextObj (vla-AddMText modelSpace corner width text))

    (setq count 1)
    (repeat 9
        (vla-put-AttachmentPoint MTextObj count)

        ;; Gets the attachment point of an MText object
        (cond
            ((= (vla-get-AttachmentPoint MTextObj) 1)(setq attachPoint "TopLeft"))
            ((= (vla-get-AttachmentPoint MTextObj) 2)(setq attachPoint "TopCenter"))
            ((= (vla-get-AttachmentPoint MTextObj) 3)(setq attachPoint "TopRight"))
            ((= (vla-get-AttachmentPoint MTextObj) 4)(setq attachPoint "MiddleLeft"))
            ((= (vla-get-AttachmentPoint MTextObj) 5)(setq attachPoint "MiddleCenter"))
            ((= (vla-get-AttachmentPoint MTextObj) 6)(setq attachPoint "MiddleRight"))
            ((= (vla-get-AttachmentPoint MTextObj) 7)(setq attachPoint "BottomLeft"))
            ((= (vla-get-AttachmentPoint MTextObj) 8)(setq attachPoint "BottomCenter"))
            ((= (vla-get-AttachmentPoint MTextObj) 9)(setq attachPoint "BottomRight"))
    )

        (vla-Regen doc :vlax-true)
        (alert (strcat "The attachment point of the MText is now: " attachPoint))

        (setq count (1+ count))
    )
)


Author Property (ActiveX)

Specifies the author of the drawing.

Supported platforms: Windows only

Signature

VBA:

object.Author
object

Type: SummaryInfo

The object this property applies to.

Property Value

Read-only: No

Type: String

The Author property of a drawing.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Author()
    ' This example shows how to access drawing properties

    ' Add and display standard properties
    ThisDrawing.SummaryInfo.Author = "John Doe"
    ThisDrawing.SummaryInfo.Comments = "Includes all ten levels of Building Five"
    ThisDrawing.SummaryInfo.HyperlinkBase = "http://www.autodesk.com"
    ThisDrawing.SummaryInfo.Keywords = "Building Complex"
    ThisDrawing.SummaryInfo.LastSavedBy = "JD"
    ThisDrawing.SummaryInfo.RevisionNumber = "4"
    ThisDrawing.SummaryInfo.Subject = "Plan for Building Five"
    ThisDrawing.SummaryInfo.Title = "Building Five"

    Author = ThisDrawing.SummaryInfo.Author
    Comments = ThisDrawing.SummaryInfo.Comments
    HLB = ThisDrawing.SummaryInfo.HyperlinkBase
    KW = ThisDrawing.SummaryInfo.Keywords
    LSB = ThisDrawing.SummaryInfo.LastSavedBy
    RN = ThisDrawing.SummaryInfo.RevisionNumber
    Subject = ThisDrawing.SummaryInfo.Subject
    Title = ThisDrawing.SummaryInfo.Title
    MsgBox "The standard drawing properties are " & vbCrLf & _
           "Author = " & Author & vbCrLf & _
           "Comments = " & Comments & vbCrLf & _
           "HyperlinkBase = " & HLB & vbCrLf & _
           "Keywords = " & KW & vbCrLf & _
           "LastSavedBy = " & LSB & vbCrLf & _
           "RevisionNumber = " & RN & vbCrLf & _
           "Subject = " & Subject & vbCrLf & _
           "Title = " & Title & vbCrLf

    ' Add and display custom properties
    Dim Key0 As String
    Dim Value0 As String
    Dim Key1 As String
    Dim Value1 As String
    Dim CustomPropertyBranch As String
    Dim PropertyBranchValue As String
    Dim CustomPropertyZone As String
    Dim PropertyZoneValue As String

    CustomPropertyBranch = "Branch"
    PropertyBranchValue = "Main"
    CustomPropertyZone = "Zone"
    PropertyZoneValue = "Industrial"

    ' Add custom properties
    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 1) Then
        ThisDrawing.SummaryInfo.SetCustomByIndex 0, CustomPropertyBranch, PropertyBranchValue
    Else
        ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyBranch, PropertyBranchValue
    End If

    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 2) Then
         ThisDrawing.SummaryInfo.SetCustomByKey CustomPropertyBranch, "Satellite"
    Else
         ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyZone, PropertyZoneValue
    End If

    'Get custom properties
    ThisDrawing.SummaryInfo.GetCustomByIndex 0, Key0, Value0
    Key1 = CustomPropertyZone
    ThisDrawing.SummaryInfo.GetCustomByKey Key1, Value1

    MsgBox "The custom drawing properties are " & vbCrLf & _
           "First property name = " & Key0 & vbCrLf & _
           "First property value = " & Value0 & vbCrLf & _
           "Second property name = " & Key1 & vbCrLf & _
           "Second property value = " & Value1 & vbCrLf
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Author()
    ;; This example shows how to access drawing properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq summaryInfo (vla-get-SummaryInfo doc))

    ;; Add and display standard properties
    (vla-put-Author summaryInfo "John Doe")
    (vla-put-Comments summaryInfo "Includes all ten levels of Building Five")
    (vla-put-HyperlinkBase summaryInfo "http://www.autodesk.com")
    (vla-put-Keywords summaryInfo "Building Complex")
    (vla-put-LastSavedBy summaryInfo "JD")
    (vla-put-RevisionNumber summaryInfo "4")
    (vla-put-Subject summaryInfo "Plan for Building Five")
    (vla-put-Title summaryInfo "Building Five")

    (setq author (vla-get-Author summaryInfo))
    (setq comments (vla-get-Comments summaryInfo))
    (setq HLB (vla-get-HyperlinkBase summaryInfo))
    (setq KW (vla-get-Keywords summaryInfo))
    (setq LSB (vla-get-LastSavedBy summaryInfo))
    (setq RN (vla-get-RevisionNumber summaryInfo))
    (setq subject (vla-get-Subject summaryInfo))
    (setq Title (vla-get-Title summaryInfo))
    (alert (strcat "The standard drawing properties are "
                   "\nAuthor = " author
                   "\nComments = " comments
                   "\nHyperlinkBase = " HLB
                   "\nKeywords = " KW
                   "\nLastSavedBy = " LSB
                   "\nRevisionNumber = " RN
                   "\nSubject = " Subject
                   "\nTitle = " Title
           )
    )

    ;; Add and display custom properties
    (setq CustomPropertyBranch "Branch")
    (setq PropertyBranchValue "Main")
    (setq CustomPropertyZone "Zone")
    (setq PropertyZoneValue "Industrial")

    ;; Add custom properties
    (if (>= (vla-NumCustomInfo summaryInfo) 1)
        (vla-SetCustomByIndex summaryInfo 0 CustomPropertyBranch PropertyBranchValue)
        (vla-AddCustomInfo summaryInfo CustomPropertyBranch PropertyBranchValue)
    )

    (if (>= (vla-NumCustomInfo summaryInfo) 2)
        (vla-SetCustomByKey summaryInfo CustomPropertyBranch "Satellite")
        (vla-AddCustomInfo summaryInfo CustomPropertyZone PropertyZoneValue)
    )

    ;; Get custom properties
    (vla-GetCustomByIndex summaryInfo 0 'Key0 'Value0)
    (setq Key1 CustomPropertyZone)
    (vla-GetCustomByKey summaryInfo Key1 'Value1)

    (alert (strcat "The custom drawing properties are "
                   "\nFirst property name = " Key0
                   "\nFirst property value = " Value0
                   "\nSecond property name = " Key1
                   "\nSecond property value = " Value1
           )
    )
)


AutoAudit Property (ActiveX)

Specifies whether AutoCAD should perform an audit after you render a DXFIN or DXBIN interchange command.

Supported platforms: Windows only

Signature

VBA:

object.AutoAudit
object

Type: PreferencesOpenSave

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Performs an audit after each DXFIN or DXBIN command.
  • False: Does not perform an audit after each DXFIN or DXBIN command.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AutoAudit()
    ' This example returns the current setting of
    ' AutoAudit. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currAutoAudit As Boolean
    Dim newAutoAudit As Boolean

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current AutoAudit value
    currAutoAudit = preferences.OpenSave.AutoAudit
    MsgBox "The current value for AutoAudit is " & currAutoAudit, vbInformation, "AutoAudit Example"

    ' Toggle the value for AutoAudit
    newAutoAudit = Not (currAutoAudit)
    preferences.OpenSave.AutoAudit = newAutoAudit
    MsgBox "The new value for AutoAudit is " & newAutoAudit, vbInformation, "AutoAudit Example"

    ' Reset AutoAudit to its original value
    preferences.OpenSave.AutoAudit = currAutoAudit
    MsgBox "The AutoAudit value is reset to " & currAutoAudit, vbInformation, "AutoAudit Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AutoAudit()
    ;; This example returns the current setting of
    ;; AutoAudit. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current AutoAudit value
    (setq currAutoAudit (vla-get-AutoAudit (vla-get-OpenSave preferences)))
    (alert (strcat "The current value for AutoAudit is " (if (= currAutoAudit :vlax-true) "True" "False")))

    ;; Toggle the value for AutoAudit
    (setq newAutoAudit (if (= currAutoAudit :vlax-true) :vlax-false :vlax-true))
    (vla-put-AutoAudit (vla-get-OpenSave preferences) newAutoAudit)
    (alert (strcat "The new value for AutoAudit is " (if (= newAutoAudit :vlax-true) "True" "False")))

    ;; Reset AutoAudit to its original value
    (vla-put-AutoAudit (vla-get-OpenSave preferences) currAutoAudit)
    (alert (strcat "The AutoAudit value is reset to " (if (= currAutoAudit :vlax-true) "True" "False")))
)


AutomaticPlotLog Property (ActiveX)

Specifies whether to automatically save a Plot or Publish log.

Supported platforms: Windows only

Signature

VBA:

object.AutomaticPlotLog
object

Type: PreferencesOutput

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

Controls if a log file is automatically created when plotting or publishing.

Remarks

This property is equivalent to the AutoCAD Options dialog box setting "Automatically Save Plot and Publish Log."

Examples

VBA:

Sub Example_AutomaticPlotLog()
    ' This example sets the AutoCAD Options dialog box
    ' setting Automatically Save Plot and Publish Log to True.

    Dim MyPreference As AcadPreferencesOutput
    Set MyPreference = AcadApplication.preferences.Output
    MyPreference.AutomaticPlotLog = True

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AutomaticPlotLog()
    ;; This example sets the AutoCAD Options dialog box
    ;; setting Automatically Save Plot and Publish Log to True.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    (vla-put-AutomaticPlotLog (vla-get-Output preferences) :vlax-true)
)


AutoSaveInterval Property (ActiveX)

Specifies an automatic save interval in minutes.

Supported platforms: Windows only

Signature

VBA:

object.AutoSaveInterval
object

Type: PreferencesOpenSave

The object this property applies to.

Property Value

Read-only: No

Type: Integer

0 >= AutoSaveInterval <= 600

An interval equal to 0 disables automatic save.

An interval greater than 0 automatically saves the drawing at the specified intervals.

Remarks

The initial setting for this property is 120.

The timer starts as soon as you make a change to a drawing. It is reset and restarted whenever the drawing is saved. The current drawing is saved to auto.sv$ unless you have specified a different name using the AutoSavePath property.

NoteThis property is also controlled by the SAVETIME system variable. The ISAVEBAK system variable (set using the CreateBackup property) improves the speed of incremental saves, especially for larger drawings. The ISAVEPERCENT system variable (set using the IncrementalSavePercent property) determines the amount of wasted space tolerated in a drawing.

Examples

VBA:

Sub Example_AutoSaveInterval()
    ' This example returns the current setting of
    ' AutoSaveInterval. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currAutoSaveInterval As Integer
    Dim newAutoSaveInterval As Integer

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current AutoSaveInterval value
    currAutoSaveInterval = preferences.OpenSave.AutoSaveInterval
    MsgBox "The current value for AutoSaveInterval is " & currAutoSaveInterval, vbInformation, "AutoSaveInterval Example"

    ' Change the value for AutoSaveInterval
    If currAutoSaveInterval = 0 Then
        newAutoSaveInterval = 10
    Else
        newAutoSaveInterval = 0
    End If
    preferences.OpenSave.AutoSaveInterval = newAutoSaveInterval
    MsgBox "The new value for AutoSaveInterval is " & newAutoSaveInterval, vbInformation, "AutoSaveInterval Example"

    ' Reset AutoSaveInterval to its original value
    preferences.OpenSave.AutoSaveInterval = currAutoSaveInterval
    MsgBox "The AutoSaveInterval value is reset to " & currAutoSaveInterval, vbInformation, "AutoSaveInterval Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AutoSaveInterval()
    ;; This example returns the current setting of
    ;; AutoSaveInterval. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current AutoSaveInterval value
    (setq currAutoSaveInterval (vla-get-AutoSaveInterval (vla-get-OpenSave preferences)))
    (alert (strcat "The current value for AutoSaveInterval is " (itoa currAutoSaveInterval)))

    ;; Change the value for AutoSaveInterval
    (if (= currAutoSaveInterval 0)
        (setq newAutoSaveInterval 10)
        (setq newAutoSaveInterval 0)
    )

    (vla-put-AutoSaveInterval (vla-get-OpenSave preferences) newAutoSaveInterval)
    (alert (strcat "The new value for AutoSaveInterval is " (itoa newAutoSaveInterval)))

    ;; Reset AutoSaveInterval to its original value
    (vla-put-AutoSaveInterval (vla-get-OpenSave preferences) currAutoSaveInterval)
    (alert (strcat "The AutoSaveInterval value is reset to " (itoa currAutoSaveInterval)))
)


AutoSavePath Property (ActiveX)

Specifies the path for the file that is created if you enable automatic save using the AutoSaveInterval property.

Supported platforms: Windows only

Signature

VBA:

object.AutoSavePath
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The drive and path of the automatic save files.

Remarks

NoteThe value for this property is stored in the SAVEFILEPATH system variable.

Examples

VBA:

Sub Example_AutoSavePath()
    ' This example returns the current setting of
    ' AutoSavePath. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currAutoSavePath As String
    Dim newAutoSavePath As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current AutoSavePath value
    currAutoSavePath = preferences.Files.AutoSavePath
    If currAutoSavePath = "" Then
        MsgBox "AutoSavePath is not currently set.", vbInformation, "AutoSavePath Example"
    Else
        MsgBox "The current value for AutoSavePath is " & currAutoSavePath, vbInformation, "AutoSavePath Example"
    End If

    ' Change the value for AutoSavePath
    newAutoSavePath = "C:\AutoCAD\"
    preferences.Files.AutoSavePath = newAutoSavePath
    MsgBox "The new value for AutoSavePath is " & newAutoSavePath, vbInformation, "AutoSavePath Example"

    ' Reset AutoSavePath to its original value
    preferences.Files.AutoSavePath = currAutoSavePath
    If currAutoSavePath = "" Then
        MsgBox "AutoSavePath is reset to Null.", vbInformation, "AutoSavePath Example"
    Else
        MsgBox "The AutoSavePath value is reset to " & currAutoSavePath, vbInformation, "AutoSavePath Example"
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AutoSavePath()
    ;; This example returns the current setting of
    ;; AutoSavePath. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current AutoSavePath value
    (setq currAutoSavePath (vla-get-AutoSavePath (vla-get-Files preferences)))

    (if (= currAutoSavePath "")
        (alert "AutoSavePath is not currently set.")
        (alert "The current value for AutoSavePath is " currAutoSavePath)
    )

    ;; Change the value for AutoSavePath
    (setq newAutoSavePath "C:\\AutoCAD\\")
    (vla-put-AutoSavePath (vla-get-Files preferences) newAutoSavePath)
    (alert (strcat "The new value for AutoSavePath is " newAutoSavePath))

    ;; Reset AutoSavePath to its original value
    (vla-put-AutoSavePath (vla-get-Files preferences) currAutoSavePath)
    (if (= currAutoSavePath "")
        (alert "AutoSavePath is reset to Null.")
        (alert (strcat "The AutoSavePath value is reset to " currAutoSavePath))
    )
)


AutoSnapAperture Property (ActiveX)

Toggles the display of the AutoSnap aperture.

Supported platforms: Windows only

Signature

VBA:

object.AutoSnapAperture
object

Type: PreferencesDrafting

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Displays the AutoSnap aperture.
  • False: Hides the AutoSnap aperture.

Remarks

The initial value for this property is True.

The AutoSnap aperture is displayed in the center of the crosshairs when you snap to an object. This option is available only when the AutoSnap marker, magnet, or tooltip is enabled.

NoteThe value of this property is stored in the APBOX system variable.

Examples

VBA:

Sub Example_AutoSnapAperture()
    ' This example reads and modifies the preference value that controls
    ' the display of the AutoSnap aperture.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesDrafting
    Dim originalValue As Variant, newValue As Variant

    ' Get the drafting preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Drafting

    ' Read and display the original value
    originalValue = ACADPref.AutoSnapAperture
    MsgBox "The AutoSnapAperture preference is set to: " & originalValue

    ' Modify the AutoSnapAperture preference by toggling the value
    ACADPref.AutoSnapAperture = Not (originalValue)
    newValue = ACADPref.AutoSnapAperture
    MsgBox "The AutoSnapAperture preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.AutoSnapAperture = originalValue
    MsgBox "The AutoSnapAperture preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AutoSnapAperture()
    ;; This example reads and modifies the preference value that controls
    ;; the display of the AutoSnap aperture.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the drafting preferences object
    (setq ACADPref (vla-get-Drafting preferences))

    ;; Read and display the original value
    (setq originalValue (vla-get-AutoSnapAperture ACADPref))
    (alert (strcat "The AutoSnapAperture preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the AutoSnapAperture preference by toggling the value
    (vla-put-AutoSnapAperture ACADPref (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-AutoSnapAperture ACADPref))
    (alert (strcat "The AutoSnapAperture preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-AutoSnapAperture ACADPref originalValue)
    (alert (strcat "The AutoSnapAperture preference was reset back to: " (if (= originalValue :vlax-true) "True" "false")))
)


AutoSnapApertureSize Property (ActiveX)

Specifies the size of the AutoSnap aperture.

Supported platforms: Windows only

Signature

VBA:

object.AutoSnapApertureSize
object

Type: PreferencesDrafting

The object this property applies to.

Property Value

Read-only: No

Type: Long

The size of the AutoSnap aperture in pixels.

Remarks

The initial value for this property is 10.

The AutoSnap aperture is displayed in the center of the crosshairs when you snap to an object. This option is available only when the AutoSnap marker, magnet, or tooltip is enabled.

NoteThe value of this property is stored in the APERTURE system variable.

Examples

VBA:

Sub Example_AutoSnapApertureSize()
    ' This example reads and modifies the preference value that controls
    ' the size of the AutoSnap aperture. When finished, this example resets
    ' the preference value back to its original value.

    Dim ACADPref As AcadPreferencesDrafting
    Dim originalValue As Variant, newValue As Variant

    ' Get the drafting preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Drafting

    ' Read and display the original value
    originalValue = ACADPref.AutoSnapApertureSize
    MsgBox "The AutoSnapApertureSize preference is: " & originalValue

    ' Modify the AutoSnapApertureSize preference by setting it to 25
    ACADPref.AutoSnapApertureSize = 25
    newValue = ACADPref.AutoSnapApertureSize
    MsgBox "The AutoSnapApertureSize preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.AutoSnapApertureSize = originalValue
    MsgBox "The AutoSnapApertureSize preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AutoSnapApertureSize()
    ;; This example reads and modifies the preference value that controls
    ;; the size of the AutoSnap aperture. When finished, this example resets
    ;; the preference value back to its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the drafting preferences object
    (setq ACADPref (vla-get-Drafting preferences))

    ;; Read and display the original value
    (setq originalValue (vla-get-AutoSnapApertureSize ACADPref))
    (alert (strcat "The AutoSnapApertureSize preference is set to: " (itoa originalValue)))

    ;; Modify the AutoSnapApertureSize preference by setting it to 25
    (vla-put-AutoSnapApertureSize ACADPref 25)
    (setq newValue (vla-get-AutoSnapApertureSize ACADPref))
    (alert (strcat "The AutoSnapApertureSize preference has been set to: " (itoa newValue)))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-AutoSnapApertureSize ACADPref originalValue)
    (alert (strcat "The AutoSnapApertureSize preference was reset back to: " (itoa originalValue)))
)


AutoSnapMagnet Property (ActiveX)

Toggles the AutoSnap magnet.

Supported platforms: Windows only

Signature

VBA:

object.AutoSnapMagnet
object

Type: PreferencesDrafting

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Enables the AutoSnap magnet.
  • False: Disables the AutoSnap magnet.

Remarks

The initial value for this property is True.

NoteThe value of this property is stored in the AUTOSNAP system variable.

Examples

VBA:

Sub Example_AutoSnapMagnet()
    ' This example reads and modifies the preference value that controls
    ' the AutoSnap magnet.  When finished, this example resets the
    ' preference value back to its original value.

    Dim ACADPref As AcadPreferencesDrafting
    Dim originalValue As Variant, newValue As Variant

    ' Get the drafting preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Drafting

    ' Read and display the original value
    originalValue = ACADPref.AutoSnapMagnet
    MsgBox "The AutoSnapMagnet preference is set to: " & originalValue

    ' Modify the AutoSnapMagnet preference by toggling the value
    ACADPref.AutoSnapMagnet = Not (originalValue)
    newValue = ACADPref.AutoSnapMagnet
    MsgBox "The AutoSnapMagnet preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.AutoSnapMagnet = originalValue
    MsgBox "The AutoSnapMagnet preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AutoSnapMagnet()
    ;; This example reads and modifies the preference value that controls
    ;; the AutoSnap magnet.  When finished, this example resets the
    ;; preference value back to its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the drafting preferences object
    (setq ACADPref (vla-get-Drafting preferences))

    ;; Read and display the original value
    (setq originalValue (vla-get-AutoSnapMagnet ACADPref))
    (alert (strcat "The AutoSnapMagnet preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the AutoSnapMagnet preference by toggling the value
    (vla-put-AutoSnapMagnet ACADPref (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-AutoSnapMagnet ACADPref))
    (alert (strcat "The AutoSnapMagnet preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-AutoSnapMagnet ACADPref originalValue)
    (alert (strcat "The AutoSnapMagnet preference was reset back to: "  (if (= originalValue :vlax-true) "True" "false")))
)


AutoSnapMarker Property (ActiveX)

Toggles the AutoSnap marker.

Supported platforms: Windows only

Signature

VBA:

object.AutoSnapMarker
object

Type: PreferencesDrafting

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Enables the AutoSnap marker.
  • False: Disables the AutoSnap marker.

Remarks

The initial value for this property is True.

NoteThe value of this property is stored in the AUTOSNAP system variable.

Examples

VBA:

Sub Example_AutoSnapMarker()
    ' This example reads and modifies the preference value that controls
    ' the AutoSnap marker.  When finished, this example resets the
    ' preference value back to its original value.

    Dim ACADPref As AcadPreferencesDrafting
    Dim originalValue As Variant, newValue As Variant

    ' Get the drafting preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Drafting

    ' Read and display the original value
    originalValue = ACADPref.AutoSnapMarker
    MsgBox "The AutoSnapMarker preference is set to: " & originalValue

    ' Modify the AutoSnapMarker preference by toggling the value
    ACADPref.AutoSnapMarker = Not (originalValue)
    newValue = ACADPref.AutoSnapMarker
    MsgBox "The AutoSnapMarker preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.AutoSnapMarker = originalValue
    MsgBox "The AutoSnapMarker preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AutoSnapMarker()
    ;; This example reads and modifies the preference value that controls
    ;; the AutoSnap marker.  When finished, this example resets the
    ;; preference value back to its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the drafting preferences object
    (setq ACADPref (vla-get-Drafting preferences))

    ;; Read and display the original value
    (setq originalValue (vla-get-AutoSnapMarker ACADPref))
    (alert (strcat "The AutoSnapMarker preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the AutoSnapMarker preference by toggling the value
    (vla-put-AutoSnapMarker ACADPref (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-AutoSnapMarker ACADPref))
    (alert (strcat "The AutoSnapMarker preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-AutoSnapMarker ACADPref originalValue)
    (alert (strcat "The AutoSnapMarker preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


AutoSnapMarkerColor Property (ActiveX)

Specifies the color of the AutoSnap marker.

Supported platforms: Windows only

Signature

VBA:

object.AutoSnapMarkerColor
object

Type: PreferencesDrafting

The object this property applies to.

Property Value

Read-only: No

Type: acColor enum

  • acRed
  • acYellow
  • acGreen
  • acCyan
  • acBlue
  • acMagenta
  • acWhite

Remarks

The initial value for this property is acYellow.

Examples

VBA:

Sub Example_AutoSnapMarkerColor()
    ' This example reads and modifies the preference value that controls
    ' the color of the AutoSnap marker. When finished, this example resets
    ' the preference value back to its original value.

    Dim ACADPref As AcadPreferencesDrafting
    Dim originalValue As Variant, newValue As Variant

    ' Get the drafting preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Drafting

    ' Read and display the original value
    originalValue = ACADPref.AutoSnapMarkerColor
    MsgBox "The AutoSnapMarkerColor preference is: " & originalValue

    ' Modify the AutoSnapMarkerColor preference by setting it to red
    ACADPref.AutoSnapMarkerColor = acRed
    newValue = ACADPref.AutoSnapMarkerColor
    MsgBox "The AutoSnapMarkerColor preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.AutoSnapMarkerColor = originalValue
    MsgBox "The AutoSnapMarkerColor preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AutoSnapMarkerColor()
    ;; This example reads and modifies the preference value that controls
    ;; the color of the AutoSnap marker. When finished, this example resets
    ;; the preference value back to its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the drafting preferences object
    (setq ACADPref (vla-get-Drafting preferences))

    ;; Read and display the original value
    (setq originalValue (vla-get-AutoSnapMarkerColor ACADPref))
    (alert (strcat "The AutoSnapMarkerColor preference is: " (itoa originalValue)))

    ;; Modify the AutoSnapMarkerColor preference by setting it to red
    (vla-put-AutoSnapMarkerColor ACADPref acRed)
    (setq newValue (vla-get-AutoSnapMarkerColor ACADPref))
    (alert (strcat "The AutoSnapMarkerColor preference has been set to: " (itoa newValue)))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-AutoSnapMarkerColor ACADPref originalValue)
    (alert (strcat "The AutoSnapMarkerColor preference was reset back to: " (itoa originalValue)))
)


AutoSnapMarkerSize Property (ActiveX)

Specifies the size of the AutoSnap marker.

Supported platforms: Windows only

Signature

VBA:

object.AutoSnapMarkerSize
object

Type: PreferencesDrafting

The object this property applies to.

Property Value

Read-only: No

Type: Long

A value from 1 to 20 representing the size of the AutoSnap marker in pixels.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AutoSnapMarkerSize()
    ' This example reads and modifies the preference value that controls
    ' the size of the AutoSnap marker. When finished, this example resets
    ' the preference value back to its original value.

    Dim ACADPref As AcadPreferencesDrafting
    Dim originalValue As Variant, newValue As Variant

    ' Get the drafting preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Drafting

    ' Read and display the original value
    originalValue = ACADPref.AutoSnapMarkerSize
    MsgBox "The AutoSnapMarkerSize preference is: " & originalValue

    ' Modify the AutoSnapMarkerSize preference by setting it to 10
    ACADPref.AutoSnapMarkerSize = 10
    newValue = ACADPref.AutoSnapMarkerSize
    MsgBox "The AutoSnapMarkerSize preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.AutoSnapMarkerSize = originalValue
    MsgBox "The AutoSnapMarkerSize preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AutoSnapMarkerSize()
    ;; This example reads and modifies the preference value that controls
    ;; the size of the AutoSnap marker. When finished, this example resets
    ;; the preference value back to its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the drafting preferences object
    (setq ACADPref (vla-get-Drafting preferences))

    ;; Read and display the original value
    (setq originalValue (vla-get-AutoSnapMarkerSize ACADPref))
    (alert (strcat "The AutoSnapMarkerSize preference is: " (itoa originalValue)))

    ;; Modify the AutoSnapMarkerSize preference by setting it to 10
    (vla-put-AutoSnapMarkerSize ACADPref 10)
    (setq newValue (vla-get-AutoSnapMarkerSize ACADPref))
    (alert (strcat "The AutoSnapMarkerSize preference has been set to: " (itoa newValue)))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-AutoSnapMarkerSize ACADPref originalValue)
    (alert (strcat "The AutoSnapMarkerSize preference was reset back to: " (itoa originalValue)))
)


AutoSnapToolTip Property (ActiveX)

Toggles the AutoSnap tooltips.

Supported platforms: Windows only

Signature

VBA:

object.AutoSnapToolTip
object

Type: PreferencesDrafting

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Enables the AutoSnap tooltips.
  • False: Disables the AutoSnap tooltips.

Remarks

The initial value for this property is True.

NoteThe value of this property is stored in the AUTOSNAP system variable.

Examples

VBA:

Sub Example_AutoSnapToolTip()
    ' This example reads and modifies the preference value that controls
    ' the AutoSnap tooltips.  When finished, this example resets the
    ' preference value back to its original value.

    Dim ACADPref As AcadPreferencesDrafting
    Dim originalValue As Variant, newValue As Variant

    ' Get the drafting preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Drafting

    ' Read and display the original value
    originalValue = ACADPref.AutoSnapTooltip
    MsgBox "The AutoSnapToolTip preference is set to: " & originalValue

    ' Modify the AutoSnapToolTip preference by toggling the value
    ACADPref.AutoSnapTooltip = Not (originalValue)
    newValue = ACADPref.AutoSnapTooltip
    MsgBox "The AutoSnapToolTip preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.AutoSnapTooltip = originalValue
    MsgBox "The AutoSnapToolTip preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AutoSnapToolTip()
    ;; This example reads and modifies the preference value that controls
    ;; the AutoSnap tooltips.  When finished, this example resets the
    ;; preference value back to its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the drafting preferences object
    (setq ACADPref (vla-get-Drafting preferences))

    ;; Read and display the original value
    (setq originalValue (vla-get-AutoSnapTooltip ACADPref))
    (alert (strcat "The AutoSnapToolTip preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the AutoSnapToolTip preference by toggling the value
    (vla-put-AutoSnapTooltip ACADPref (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-AutoSnapTooltip ACADPref))
    (alert (strcat "The AutoSnapToolTip preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-AutoSnapTooltip ACADPref originalValue)
    (alert (strcat "The AutoSnapToolTip preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


AutoTrackingVecColor Property (ActiveX)

Specifies the color of the auto tracking vector.

Supported platforms: Windows only

Signature

VBA:

object.AutoTrackingVecColor
object

Type: PreferencesDrafting

The object this property applies to.

Property Value

Read-only: No

Type: OLE_COLOR (constant)

  • vbBlack
  • vbRed
  • vbYellow
  • vbGreen
  • vbCyan
  • vbBlue
  • vbMagenta
  • vbWhite

Remarks

The default color for this property is vbWhite.

Examples

VBA:

Sub Example_AutoTrackingVecColor()
    ' This example reads and modifies the preference value that controls
    ' the color of the AutoTrack vector. When finished, this example
    ' resets the preference value back to its original value.

    Dim ACADPref As AcadPreferencesDisplay
    Dim originalValue As Variant, newValue As Variant

    ' Get the display preferences object
    Set ACADPref = ThisDrawing.Application.preferences.DISPLAY

    ' Read and display the original value
    originalValue = ACADPref.AutoTrackingVecColor
    MsgBox "The AutoTrackingVecColor preference is: " & originalValue

    ' Modify the AutoTrackingVecColor preference by making it red
    ACADPref.AutoTrackingVecColor = vbRed
    newValue = ACADPref.AutoTrackingVecColor
    MsgBox "The AutoTrackingVecColor preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.AutoTrackingVecColor = originalValue
    MsgBox "The AutoTrackingVecColor preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AutoTrackingVecColor()
    ;; This example reads and modifies the preference value that controls
    ;; the color of the AutoTrack vector. When finished, this example
    ;; resets the preference value back to its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the Display preferences object
    (setq ACADPref (vla-get-Display preferences))

    ;; Read and display the original value
    (setq originalValue (vlax-variant-change-type (vla-get-AutoTrackingVecColor ACADPref) vlax-vbLong))
    (alert (strcat "The AutoTrackingVecColor preference is: " (itoa (vlax-variant-value originalValue))))

    ;; Modify the AutoTrackingVecColor preference by making it red
    (vla-put-AutoTrackingVecColor ACADPref (vlax-make-variant acRed 19))
    (setq newValue (vlax-variant-change-type (vla-get-AutoTrackingVecColor ACADPref) vlax-vbLong))
    (alert (strcat "The AutoTrackingVecColor preference has been set to: " (itoa (vlax-variant-value newValue))))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-AutoTrackingVecColor ACADPref (vlax-variant-change-type originalValue 19))
    (alert (strcat "The AutoTrackingVecColor preference was reset back to: " (itoa (vlax-variant-value originalValue))))
)


AutoTrackTooltip Property (ActiveX)

Toggles the display of the AutoTrack tooltips.

Supported platforms: Windows only

Signature

VBA:

object.AutoTrackTooltip
object

Type: PreferencesDrafting

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Displays AutoTrack tooltips.
  • False: Does not display AutoTrack tooltips.

Remarks

The initial value for this property is True.

When this property is enabled, the user sees a tooltip whenever the cursor is over an alignment path. When the property is disabled, the tooltip does not show.

NoteThe value of this property is stored in the AUTOSNAP system variable.

Examples

VBA:

Sub Example_AutoTrackToolTip()
    ' This example reads and modifies the preference value that controls
    ' the display of the AutoTrack tooltips.  When finished, this example resets the
    ' preference value back to its original value.

    Dim ACADPref As AcadPreferencesDrafting
    Dim originalValue As Variant, newValue As Variant

    ' Get the drafting preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Drafting

    ' Read and display the original value
    originalValue = ACADPref.AutoTrackTooltip
    MsgBox "The AutoTrackToolTip preference is set to: " & originalValue

    ' Modify the AutoTrackToolTip preference by toggling the value
    ACADPref.AutoTrackTooltip = Not (originalValue)
    newValue = ACADPref.AutoTrackTooltip
    MsgBox "The AutoTrackToolTip preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.AutoTrackTooltip = originalValue
    MsgBox "The AutoTrackToolTip preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AutoTrackToolTip()
    ;; This example reads and modifies the preference value that controls
    ;; the display of the AutoTrack tooltips.  When finished, this example resets the
    ;; preference value back to its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the drafting preferences object
    (setq ACADPref (vla-get-Drafting preferences))

    ;; Read and display the original value
    (setq originalValue (vla-get-AutoTrackTooltip ACADPref))
    (alert (strcat "The AutoTrackToolTip preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the AutoTrackToolTip preference by toggling the value
    (vla-put-AutoTrackTooltip ACADPref (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-AutoTrackTooltip ACADPref))
    (alert (strcat "The AutoTrackToolTip preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-AutoTrackTooltip ACADPref originalValue)
    (alert (strcat "The AutoTrackToolTip preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


AxisDirection Property (ActiveX)

Displays the direction of the axis of revolution.

Supported platforms: Windows only

Signature

VBA:

object.AxisDirection
object

Type: RevolvedSurface

The object to which this property applies.

Property Value

Read-only: Yes

Type: Variant

Direction of the axis for the revolved surface.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


AxisPosition Property (ActiveX)

Specifies the start point of the axis of revolution.

Supported platforms: Windows only

Signature

VBA:

object.AxisPosition
object

Type: RevolvedSurface

The object to which this property applies.

Property Value

Read-only: No

Type: Variant

Position of the axis for the revolved surface.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


BackgroundColor Property (ActiveX)

Specifies the background color of the hatch object.

Supported platforms: Windows only

Signature

VBA:

object.BackgroundColor
object

Type: Hatch

The object this property applies to.

Property Value

Read-only: No

Type: AcCmColor

Hatch object's background color.

Remarks

The value contained in this property is the Background Color property in the Properties palette.

Examples

VBA:

Not available

Visual LISP:

Not available


BackgroundFill Property (ActiveX)

Specifies whether multiline text has a background fill.

Supported platforms: Windows only

Signature

VBA:

object.BackgroundFill
object

Type: GeoPositionMarker, MText

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Background fill is enabled.
  • False: Background fill is disabled.

Remarks

MText: The value contained in this property is the Background Mask property in the Properties palette.

Examples

VBA:

Sub Example_BackgroundFill()
    ' This example creates a circle and an MText object, and masks part of the
    ' circle with the MText object

    'Draw a circle
    Dim circleObj As AcadCircle
    Dim CircleReference(0 To 2) As Double
    Dim radius As Double
    CircleReference(0) = 0
    CircleReference(1) = 0
    CircleReference(2) = 0
    radius = 5
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(CircleReference, radius)
    ZoomAll
    MsgBox "A circle has been drawn."

    'Create an MText object with the BackgroundFill property set to True
    Dim MTextObj As AcadMText
    Dim width As Double
    Dim text As String
    width = 10
    text = "This is the text for the MText object"
    Set MTextObj = ThisDrawing.ModelSpace.AddMText(CircleReference, width, text)
    MTextObj.BackgroundFill = True
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_BackgroundFill()
    ;; This example creates a circle and an MText object, and masks part of the
    ;; circle with the MText object
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Draw a circle
    (setq CircleReference (vlax-3d-point 0 0 0)
          radius 0.5)
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace CircleReference radius))
    (vla-ZoomAll acadObj)
    (alert "A circle has been drawn.")

    ;; Create an MText object with the BackgroundFill property set to True
    (setq width 5
          text "This is the text for the MText object")
    (setq MTextObj (vla-AddMText modelSpace CircleReference width text))
    (vla-put-AttachmentPoint MTextObj 5)
    (vla-put-InsertionPoint MTextObj CircleReference)
    (vla-put-BackgroundFill MTextObj :vlax-true)
    (vla-ZoomAll acadObj)
)


BackgroundLinesColor Property (ActiveX)

Specifies the color of background lines.

Supported platforms: Windows only

Signature

VBA:

object.BackgroundLinesColor
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: AcCmColor

Color assigned to background lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


BackgroundLinesHiddenLine Property (ActiveX)

Specifies the hidden line visibility of background lines.

Supported platforms: Windows only

Signature

VBA:

object.BackgroundLinesHiddenLine
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: Boolean

  • True: Hidden lines are drawn for background lines.
  • False: Hidden lines are not drawn for background lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


BackgroundLinesLayer Property (ActiveX)

Specifies the layer of background lines.

Supported platforms: Windows only

Signature

VBA:

object.BackgroundLinesLayer
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: String

Name of the layer to be applied to the background lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


BackgroundLinesLinetype Property (ActiveX)

Specifies the linetype of background lines.

Supported platforms: Windows only

Signature

VBA:

object.BackgroundLinesLinetype
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: String

Name of the linetype to be applied to the background lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


BackgroundLinesLinetypeScale Property (ActiveX)

Specifies the linetype scale of background lines.

Supported platforms: Windows only

Signature

VBA:

object.BackgroundLinesLinetypeScale
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: ACAD_NOUNITS

Numeric value that represents the linetype scale factor to be applied to the background lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


BackgroundLinesLineweight Property (ActiveX)

Specifies the line weight of background lines.

Supported platforms: Windows only

Signature

VBA:

object.BackgroundLinesLineweight
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: ACAD_LWEIGHT

Value that represents the lineweight to be applied to the background lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


BackgroundLinesPlotStyleName Property (ActiveX)

Specifies the plot style name of background lines.

Supported platforms: Windows only

Signature

VBA:

object.BackgroundLinesPlotStyleName
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: String

Name of the plot style to be applied to the background lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


BackgroundLinesVisible Property (ActiveX)

Specifies the visibility of background lines.

Supported platforms: Windows only

Signature

VBA:

object.BackgroundLinesVisible
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: Boolean

  • True: Background lines are visible.
  • False: Background lines are not visible.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Backward Property (ActiveX)

Specifies the direction of text.

Supported platforms: Windows only

Signature

VBA:

object.Backward
object

Type: Attribute, AttributeReference, Text

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The text is backward.
  • False: The text is forward.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Backward()
    ' This example creates a text object in model space and
    ' uses the Backward property to flip the text horizontally

    Dim textObj As AcadText
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double

    ' Define the new Text object
    textString = "Hello, World."
    insertionPoint(0) = 3: insertionPoint(1) = 3: insertionPoint(2) = 0
    height = 0.5

    ' Create the Text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)

    ThisDrawing.Application.ZoomAll

    MsgBox "The Text oject is now forward"

    textObj.Backward = True
    ThisDrawing.Regen acActiveViewport

    MsgBox "The Text object is now backward"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Backward()
    ;; This example creates a text object in model space and
    ;; uses the Backward property to flip the text horizontally
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Text object
    (setq insertionPoint (vlax-3d-point 3 3 0)
          textString "Hello, World."
          height 0.5)

    ;; Create the Text object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq textObj (vla-AddText modelSpace textString insertionPoint height))

    (vla-ZoomAll acadObj)

    (alert "The Text oject is now forward.")

    (vla-put-Backward textObj :vlax-true)
    (vla-Regen doc acActiveViewport)

    (alert "The Text object is now backward.")
)


Bank Property (ActiveX)

Specifies whether or not the profile curve twists and rotates along a 3D path.

Supported platforms: Windows only

Signature

VBA:

object.Bank
object

Type: SweptSurface

The object to which this property applies.

Property Value

Read-only: No

Type: Boolean

  • True: Profile curve can twist and rotate.
  • False: Profile curve cannot twist and rotate.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


BasePoint Property (ActiveX)

Specifies the point through which the ray or construction line passes.

Supported platforms: Windows only

Signature

VBA:

object.BasePoint
object

Type: Ray, XLine

The objects this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

The 3D coordinate representing the point through which the ray or construction line passes.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_BasePoint()
    ' This example creates a ray object. It then finds the
    ' base point of the ray, changes the base point, and
    ' queries the new base point.
    Dim basePoint(0 To 2) As Double
    Dim directionVec(0 To 2) As Double
    Dim rayObj As AcadRay

    ' Establish the base point and directional vector for the ray
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    directionVec(0) = 1#: directionVec(1) = 1#: directionVec(2) = 0#

    ' Create a Ray object in model space
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, directionVec)

    ThisDrawing.Regen True
    MsgBox "A new Ray has been added.", vbInformation

    ' Define a new base point
    Dim newBase(0 To 2) As Double
    newBase(0) = 4#: newBase(1) = 2#: newBase(2) = 0#

    ' Update the ray using the new base point
    rayObj.basePoint = newBase

    ' Query the new basepoint for the Ray
    Dim currBase As Variant      ' Note that return from basepoint property is Variant and not a SafeArray
    Dim msg As String
    currBase = rayObj.basePoint
    msg = currBase(0) & ", " & currBase(1) & ", " & currBase(2)

    ThisDrawing.Regen True
    MsgBox "We've just changed the basepoint of the new Ray to: " & msg, vbInformation
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_BasePoint()
    ;; This example creates a ray object. It then finds the
    ;; base point of the ray, changes the base point, and
    ;; queries the new base point.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Establish the base point and directional vector for the ray
    (setq basePoint (vlax-3d-point 3 3 0)
          directionVec (vlax-3d-point 1 1 0))

    ;; Create a Ray object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq rayObj (vla-AddRay modelSpace basePoint directionVec))

    (vla-Regen doc :vlax-true)
    (alert "A new Ray has been added.")

    ;; Define a new base point
    (setq newBase (vlax-3d-point 4 2 0))

    ;; Update the ray using the new base point
    (vla-put-basePoint rayObj newBase)

    ;; Query the new basepoint for the Ray
    (setq currBase (vlax-safearray->list (vlax-variant-value (vla-get-BasePoint rayObj))))
    (setq msg (strcat (rtos (nth 0 currBase) 2) ", "
              (rtos (nth 1 currBase) 2) ", "
              (rtos (nth 2 currBase) 2)))

    (vla-Regen doc :vlax-true)
    (alert (strcat "We've just changed the basepoint of the new Ray to: " msg))
)


BaseRadius Property (ActiveX)

Specifies the base radius of the helix.

Supported platforms: Windows only

Signature

VBA:

object.BaseRadius
object

Type: Helix

The object to which this property applies.

Property Value

Read-only: No

Type: Double

Radius of the helix object's base.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Helix_BaseRadius()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.BaseRadius = helix.BaseRadius * 2
            MsgBox "Baseradius of helix is doubled to " & helix.BaseRadius * 2
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_TopRadius()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.TopRadius = helix.TopRadius * 0.5
            MsgBox "Top radius of helix is halved to " & helix.TopRadius * 0.5
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Direction()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            If helix.Twist = acCCW Then
                helix.Twist = acCW
            Else
                helix.Twist = acCCW
            End If
            MsgBox "Direction is reversed"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Height()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acHeight
            helix.height = helix.height * 2
            MsgBox "Height doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Turns()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acTurns
            helix.Turns = helix.Turns * 2
            MsgBox "Turns doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_TurnHeight()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acTurnHeight
            helix.TurnHeight = helix.TurnHeight * 2
            MsgBox "Turns height doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Helix_BaseRadius()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-BaseRadius helix (* (vla-get-BaseRadius helix) 2))
                (alert (strcat "Baseradius of helix is doubled to " (rtos (vla-get-BaseRadius helix) 2)))
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_TopRadius()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-TopRadius helix (* (vla-get-TopRadius helix) 0.5))
                (alert (strcat "Top radius of helix is halved to " (rtos (vla-get-TopRadius helix) 2)))
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Direction()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
            (if (= (vla-get-Twist helix) acCCW)
                (vla-put-Twist helix acCW)
                (vla-put-Twist helix acCCW)
            )
                (alert "Direction is reversed")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Height()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acHeight)
                (vla-put-Height helix (* (vla-get-Height helix) 2))
                (alert "Height doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Turns()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acTurns)
                (vla-put-Turns helix (* (vla-get-Turns helix) 2))
                (alert "Turns doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_TurnHeight()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acTurnHeight)
                (vla-put-TurnHeight helix (* (vla-get-TurnHeight helix) 2))
                (alert "Turns height doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)


BatchPlotProgress Property (ActiveX)

Gets the current status of the batch plot, or terminates the batch plot.

Supported platforms: Windows only

Signature

VBA:

object.BatchPlotProgress
object

Type: Plot

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The batch plot is in progress.
  • False: The batch plot has been cancelled or aborted. Setting BatchPlotProgress to False will terminate the batch plot.

Remarks

This property is obsolete and may be removed in a future version of AutoCAD.

Examples

VBA:

Sub Example_BatchPlotProgress()
' This property is obsolete and may be removed
' in a future (post-AutoCAD 2005) version.
End Sub

Visual LISP:

Not available


BeepOnError Property (ActiveX)

Specifies if AutoCAD should sound an alarm beep when it detects an invalid entry.

Supported platforms: Windows only

Signature

VBA:

object.BeepOnError
object

Type: PreferencesSystem

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Sounds an alarm beep with an invalid entry.
  • False: Does not sound an alarm beep with an invalid entry.

Remarks

The initial value for this property is False.

Examples

VBA:

Sub Example_BeepOnError()
    ' This example returns the current setting of
    ' BeepOnError. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currBeepOnError As Boolean

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current BeepOnError value
    currBeepOnError = preferences.System.BeepOnError
    MsgBox "The current value for BeepOnError is " & preferences.System.BeepOnError, vbInformation, "BeepOnError Example"

    ' Change the value for BeepOnError
    preferences.System.BeepOnError = Not (currBeepOnError)
    MsgBox "The new value for BeepOnError is " & preferences.System.BeepOnError, vbInformation, "BeepOnError Example"

    ' Reset BeepOnError to its original value
    preferences.System.BeepOnError = currBeepOnError
    MsgBox "The BeepOnError value is reset to " & preferences.System.BeepOnError, vbInformation, "BeepOnError Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_BeepOnError()
    ;; This example returns the current setting of
    ;; BeepOnError. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current BeepOnError value
    (setq currBeepOnError (vla-get-BeepOnError (vla-get-System preferences)))
    (alert (strcat "The current value for BeepOnError is " (if (= currBeepOnError :vlax-true) "True" "False")))

    ;; Change the value for BeepOnError
    (vla-put-BeepOnError (vla-get-System preferences) (if (= currBeepOnError :vlax-true) :vlax-false :vlax-true))
    (setq newBeepOnError (vla-get-BeepOnError (vla-get-System preferences)))
    (alert (strcat "The new value for BeepOnError is " (if (= newBeepOnError :vlax-true) "True" "False")))

    ;; Reset BeepOnError to its original value
    (vla-put-BeepOnError (vla-get-System preferences) currBeepOnError)
    (alert (strcat "The BeepOnError value is reset to " (if (= currBeepOnError :vlax-true) "True" "False")))
)


BigFontFile Property (ActiveX)

Specifies the name of the Big Font file associated with the text or attribute.

Supported platforms: Windows only

Signature

VBA:

object.BigFontFile
object

Type: TextStyle

The object this property applies to.

Property Value

Read-only: No

Type: String

The name of the Big Font file.

Remarks

This property is similar to the FontFile property, except that it is used to specify an Asian-language Big Font file. The only valid file type is SHX.

This property cannot be set to NULL or an empty string.

Examples

VBA:

Sub Example_BigFontFile()
    ' This example returns the current setting of
    ' BigFontFile. It then changes the value.

    Dim textStyle1 As AcadTextStyle
    Dim currBigFontFile As String
    Dim newBigFontFile As String

    Set textStyle1 = ThisDrawing.ActiveTextStyle

    ' Retrieve the current BigFontFile value
    currBigFontFile = textStyle1.BigFontFile
    MsgBox "The current value for BigFontFile is " & currBigFontFile, vbInformation, "BigFontFile Example"

    ' Change the value for BigFontFile
    newBigFontFile = "C:/AutoCAD/Fonts/bigfont.shx"
    textStyle1.BigFontFile = newBigFontFile
    MsgBox "The new value for BigFontFile is " & newBigFontFile, vbInformation, "BigFontFile Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_BigFontFile()
    ;; This example returns the current setting of
    ;; BigFontFile. It then changes the value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq textStyle1 (vla-get-ActiveTextStyle doc))

    ;; Retrieve the current BigFontFile value
    (setq currBigFontFile (vla-get-BigFontFile textStyle1))
    (alert (if (= currBigFontFile "")
           (strcat "There is not big font file assigned to this font.")
           (strcat "The current value for BigFontFile is " currBigFontFile))
    )

    ;; Change the value for BigFontFile
    (setq newBigFontFile (findfile "./Fonts/bigfont.shx"))
    (vla-put-BigFontFile textStyle1 newBigFontFile)
    (alert (strcat "The new value for BigFontFile is " newBigFontFile))
)


BitFlags Property (ActiveX)

Specifies the bit flag values of a style.

Supported platforms: Windows only

Signature

VBA:

object.BitFlags
object

Type: TableStyle, MLeaderStyle

The objects this property applies to.

Property Value

Read-only: No

Type: Long

Style bit flag values.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_BitFlags()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.FlowDirection = acTableBottomToTop
    customObj.HorzCellMargin = 0.22
    customObj.BitFlags = 1
    customObj.SetTextHeight AcRowType.acDataRow + AcRowType.acTitleRow, 1.3
    customObj.SetTextStyle AcRowType.acDataRow + AcRowType.acTitleRow, "Standard"

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 12, 23, 45
    customObj.SetBackgroundColor AcRowType.acDataRow + AcRowType.acTitleRow, col
    customObj.SetGridVisibility AcGridLineType.acHorzInside + AcGridLineType.acHorzTop _
                                , AcRowType.acDataRow + AcRowType.acTitleRow, True

    customObj.SetAlignment AcRowType.acDataRow + AcRowType.acTitleRow, acBottomRight
    col.SetRGB 244, 0, 0
    customObj.SetGridColor 3, 1, col

    MsgBox "Table Style Name = " & customObj.Name & vbCrLf & _
           "Style Description = " & customObj.Description & vbCrLf & _
           "Flow Direction = " & customObj.FlowDirection & vbCrLf & _
           "Horzontal Cell Margin = " & customObj.HorzCellMargin & vbCrLf & _
           "Bit Flags = " & customObj.BitFlags & vbCrLf & _
           "Title Row Text Height = " & customObj.GetTextHeight(acTitleRow) & vbCrLf & _
           "Title Row Text Style = " & customObj.GetTextStyle(acTitleRow) & vbCrLf & _
           "Grid Visibility for HorizontalBottom TitleRow  = " & customObj.GetGridVisibility(acHorzBottom, acTitleRow) & vbCrLf & _
           "Title Row Alignment = " & customObj.GetAlignment(acTitleRow) & vbCrLf & _
           "Header Suppression = " & customObj.HeaderSuppressed

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_BitFlags()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-put-FlowDirection customObj acTableBottomToTop)
    (vla-put-HorzCellMargin customObj 0.22)
    (vla-put-BitFlags customObj 1)
    (vla-SetTextHeight customObj (+ acDataRow acTitleRow) 1.3)
    (vla-SetTextStyle customObj (+ acDataRow acTitleRow) "Standard")

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 12 23 45)

    (vla-SetBackgroundColor customObj (+ acDataRow acTitleRow) col)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) (+ acDataRow acTitleRow) :vlax-true)
    (vla-SetAlignment customObj (+ acDataRow acTitleRow) acBottomRight)
    (vla-SetRGB col 244 0 0)
    (vla-SetGridColor customObj (+ acHorzTop acHorzInside) acDataRow col)

    (alert (strcat "Table Style Name = " (vla-get-Name customObj)
                   "\nStyle Description = " (vla-get-Description customObj)
                   "\nFlow Direction = " (itoa (vla-get-FlowDirection customObj))
                   "\nHorzontal Cell Margin = " (rtos (vla-get-HorzCellMargin customObj) 2)
                   "\nBit Flags = " (itoa (vla-get-BitFlags customObj))
                   "\nTitle Row Text Height = " (rtos (vla-GetTextHeight customObj acTitleRow) 2)
                   "\nTitle Row Text Style = " (vla-GetTextStyle customObj acTitleRow)
                   "\nGrid Visibility for HorizontalBottom TitleRow  = " (if (= (vla-GetGridVisibility customObj acHorzBottom acTitleRow) :vlax-true) "True" "False")
                   "\nTitle Row Alignment = " (itoa (vla-GetAlignment customObj acTitleRow))
               "\nHeader Suppression = " (if (= (vla-get-HeaderSuppressed customObj) :vlax-true) "True" "False")
       )
    )
    (vlax-release-object col)
)


Block Property (ActiveX)

Specifies the block associated with the layout or multileader style.

Supported platforms: Windows only

Signature

VBA:

object.Block
object

Type: Layout, MLeaderStyle

The objects this property applies to.

Property Value - Layout

Read-only: Yes

Type: Block

The block associated with the layout.

Property Value - MLeaderStyle

Read-only: No

Type: String

The MLeaderStyle block ID.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_LayoutBlock()
    ' This example finds the name of the block associated with a layout.

    Dim xBlock As AcadBlock
    Set xBlock = ThisDrawing.ActiveLayout.Block

    MsgBox "The active layout corresponds to block: " & xBlock.name
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LayoutBlock()
    ;; This example finds the name of the block associated with a layout.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq xBlock (vla-get-Block (vla-get-ActiveLayout doc)))

    (alert (strcat "The active layout corresponds to block: " (vla-get-Name xBlock)))
)


BlockColor Property (ActiveX)

Specifies the block color of the mleaderstyle.

Supported platforms: Windows only

Signature

VBA:

object.BlockColor
object

Type: MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: AcCmColor

The block color.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


BlockConnectionType Property (ActiveX)

The types of block connection a multileader can have.

Supported platforms: Windows only

Signature

VBA:

object.BlockConnectionType
object

Type: MLeader, MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: acBlockConnectionType enum

  • acConnectBase
  • acConnectExtents

Remarks

No additional remarks.

Examples

VBA:

Sub Example_LeaderLine()
    Dim oML As AcadMLeader
    Dim points(0 To 5) As Double
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 4: points(4) = 4: points(5) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    Dim r As Long
    r = oML.AddLeader()

    points(4) = 10
    Call oML.AddLeaderLine(r, points)

    MsgBox "LeaderCount = " & oML.LeaderCount
    ZoomExtents
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LeaderLine()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(1 1 0
                                  4 4 0
                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (setq r (vla-AddLeader oML))

    (vlax-safearray-put-element points 4 10)
    (vla-AddLeaderLine oML r points)

    (alert (strcat "LeaderCount = " (itoa (vla-get-LeaderCount oML))))
    (vla-ZoomExtents acadObj)
)


BlockRotation Property (ActiveX)

Specifies the block rotation value of an mleader style.

Supported platforms: Windows only

Signature

VBA:

object.BlockRotation
object

Type: MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: Double

The value of the block rotation.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Blocks Property (ActiveX)

Gets the Blocks collection for the drawing.

Supported platforms: Windows only

Signature

VBA:

object.Blocks
object

Type: Database, Document

The object this property applies to.

Property Value

Read-only: Yes

Type: Blocks

The Blocks collection for the drawing.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Blocks()
    ' This example first finds the Blocks collection
    ' using the Blocks property. It then adds a new
    ' block to the Blocks collection.

    Dim blkColl As AcadBlocks
    Dim newBlock As AcadBlock
    Dim insertionPnt(0 To 2) As Double

    ' Get the Blocks collection
    Set blkColl = ThisDrawing.Blocks

    ' Define the insertion point for the new block
    insertionPnt(0) = 0#: insertionPnt(1) = 0#: insertionPnt(2) = 0#

    ' Add the new block into the Blocks collection
    Set newBlock = blkColl.Add(insertionPnt, "TEST")
    MsgBox "A block called " & newBlock.name & " has been added to the blocks collection", vbInformation, "Blocks Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Blocks()
    ;; This example first finds the Blocks collection
    ;; using the Blocks property. It then adds a new
    ;; block to the Blocks collection.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get the Blocks collection
    (setq blkColl (vla-get-Blocks doc))

    ;; Define the insertion point for the new block
    (setq insertionPnt (vlax-3d-point 0 0 0))

    ;; Add the new block into the Blocks collection
    (setq newBlock (vla-Add blkColl insertionPnt "TEST"))
    (alert (strcat "A block called " (vla-get-Name newBlock) " has been added to the blocks collection."))
)


BlockScale Property (ActiveX)

Specifies the BlockScale of the mleader style.

Supported platforms: Windows only

Signature

VBA:

object.BlockScale
object

Type: MLeader, MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: Long

The block scale factor.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


BlockScaling Property (ActiveX)

Specifies the scaling allowed for the block.

Supported platforms: Windows only

Signature

VBA:

object.BlockScaling
object

Type: Block

The object this property applies to.

Property Value

Read-only: No

Type: acBlockScaling enum

  • acAny
  • acUniform

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Blue Property (ActiveX)

Specifies the blue component of the True Color.

Supported platforms: Windows only

Signature

VBA:

object.Blue
object

Type: AcCmColor

The object this property applies to.

Property Value

Read-only: Yes

Type: Long

The blue component, from 0-255, of AcCmColor.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Blue()
    ' This example draws a line and returns the RGB values
    Dim color As AcadAcCmColor
    Set color = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    color.SetRGB 80, 100, 244

    Dim line As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double

    startPoint(0) = 1#: startPoint(1) = 1#: startPoint(2) = 0#
    endPoint(0) = 5#: endPoint(1) = 5#: endPoint(2) = 0#

    Set line = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    ZoomAll

    line.TrueColor = color
    Dim retcolor As AcadAcCmColor
    Set retcolor = line.TrueColor

    MsgBox "Red = " & retcolor.Red & vbLf & _
           "Green = " & retcolor.Green & vbLf & _
           "Blue = " & retcolor.Blue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Blue()
    ;; This example draws a line and returns the RGB values
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq color (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB color 80 100 244)

    (setq startPoint (vlax-3d-point 1 1 0)
          endPoint (vlax-3d-point 5 5 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq line (vla-AddLine modelSpace startPoint endPoint))
    (vla-ZoomAll acadObj)

    (vla-put-TrueColor line color)
    (setq retcolor (vla-get-TrueColor line))

    (alert (strcat "Red = " (itoa (vla-get-Red retcolor))
                   "\nGreen = " (itoa (vla-get-Green retcolor))
                   "\nBlue = " (itoa (vla-get-Blue retcolor))
           )
    )

    (vlax-release-object color)
)


BookName Property (ActiveX)

Specifies the book name (if any) of the color.

Supported platforms: Windows only

Signature

VBA:

object.BookName
object

Type: AcCmColor

The object this property applies to.

Property Value

Read-only: Yes

Type: String

The name of the color book that the color came from.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_BookName()
    'This example draws a circle and
    'returns the color name and color book name of the color.

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 125, 175, 235
    col.SetNames "MyColor", "MyColorBook"

    Dim cir As AcadCircle
    Dim pt(0 To 2) As Double
    Set cir = ThisDrawing.ModelSpace.AddCircle(pt, 2)
    cir.TrueColor = col
    ZoomAll

    Dim retCol As AcadAcCmColor
    Set retCol = cir.TrueColor
    MsgBox "BookName=" & col.BookName & vbLf & _
           "ColorName=" & col.ColorName
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_BookName()
    ;; This example draws a circle and
    ;; returns the color name and color book name of the color.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 125 175 235)
    (vla-SetNames col "MyColor" "MyColorBook")

    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq cir (vla-AddCircle modelSpace pt 2))
    (vla-put-TrueColor cir col)
    (vla-ZoomAll acadObj)

    (setq retCol (vla-get-TrueColor cir))
    (alert (strcat "BookName=" (vla-get-BookName col)
                   "\nColorName=" (vla-get-ColorName col)
       )
    )

    (vlax-release-object col)
)


BottomHeight Property (ActiveX)

Specifies elevation of section plane bottom extents relative to the object’s elevation.

Supported platforms: Windows only

Signature

VBA:

object.BottomHeight
object

Type: Section

The object to which this property applies.

Property Value

Read-only: No

Type: Long

Height of the section plane's bottom.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


BreaksEnabled Property (ActiveX)

Specifies if table breaks are enabled.

Supported platforms: Windows only

Signature

VBA:

object.BreaksEnabled
object

Type: Table

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

Determines whether table breaking is in use. When enabled, the table will break automatically at the current specified height.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_BreakHeight()
    ' This example creates a table object and then breaks it into
    ' two tables.

    ' Create a new table objetc in model space
    Dim pt(2) As Double

    Dim modelSpace As AcadModelSpace
    Set modelSpace = ThisDrawing.modelSpace

    Dim table As AcadTable
    Set table = modelSpace.AddTable(pt, 5, 5, 10, 30)

    table.EnableBreak = True
    table.BreakSpacing = 3.5
    table.TableBreakHeight = 35#
    table.AllowManualHeights = True
    table.SetBreakHeight 0, 20#
    table.SetBreakHeight 1, 35#

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_BreakHeight()
    ;; This example creates a table object and then breaks it into
    ;; two tables.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create a new table objetc in model space
    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq table (vla-Addtable modelSpace pt 5 5 10 30))

    (vla-put-EnableBreak table :vlax-true)
    (vla-put-BreakSpacing table 3.5)
    (vla-put-TableBreakHeight table 35.0)
    (vla-put-AllowManualHeights table :vlax-true)
    (vla-SetBreakHeight table 0 20.0)
    (vla-SetBreakHeight table 1 35.0)

    (vla-ZoomExtents acadObj)
)


BreakSize Property (ActiveX)

Specifies the BreakSize of the mleader style.

Supported platforms: Windows only

Signature

VBA:

object.BreakSize
object

Type: MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: Double

The size of the gap used for breaking leader lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


BreakSpacing Property (ActiveX)

Specifies the break spacing for a table.

Supported platforms: Windows only

Signature

VBA:

object.BreakSpacing
object

Type: Table

The object this property applies to.

Property Value

Read-only: No

Type: Double

Controls the spacing between the broken table parts. Depending on the break direction this will be a horizontal or vertical spacing.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_BreakHeight()
    ' This example creates a table object and then breaks it into
    ' two tables.

    ' Create a new table object in model space
    Dim pt(2) As Double

    Dim modelSpace As AcadModelSpace
    Set modelSpace = ThisDrawing.modelSpace

    Dim table As AcadTable
    Set table = modelSpace.AddTable(pt, 5, 5, 10, 30)

    table.EnableBreak = True
    table.BreakSpacing = 3.5
    table.TableBreakHeight = 35#
    table.AllowManualHeights = True
    table.SetBreakHeight 0, 20#
    table.SetBreakHeight 1, 35#

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_BreakHeight()
    ;; This example creates a table object and then breaks it into
    ;; two tables.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create a new table object in model space
    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq table (vla-Addtable modelSpace pt 5 5 10 30))

    (vla-put-EnableBreak table :vlax-true)
    (vla-put-BreakSpacing table 3.5)
    (vla-put-TableBreakHeight table 35.0)
    (vla-put-AllowManualHeights table :vlax-true)
    (vla-SetBreakHeight table 0 20.0)
    (vla-SetBreakHeight table 1 35.0)

    (vla-ZoomExtents acadObj)
)


Brightness Property (ActiveX)

Specifies the current brightness value of an image.

Supported platforms: Windows only

Signature

VBA:

object.Brightness
object

Type: GeomapImage, RasterImage, Wipeout

The objects this property applies to.

Property Value

Read-only: No

Type: Integer

The brightness value is a positive integer between 0 and 100 inclusive. The default value is 50.

Remarks

You can adjust the image brightness, contrast, and fade to the display of the image as well as to the plotted output without affecting the original raster image file. Adjust brightness to darken or lighten an image. Adjust contrast to make images that have poor quality easier to read. Adjust fade to make vectors easier to see over images and to create a watermark effect in your plotted output.

Bitonal images cannot be adjusted for brightness, contrast, or fade.

Examples

VBA:

Sub Example_Brightness()
    ' This example inserts a raster image and finds the current
    ' brightness of the image. It then changes the brightness
    ' of the image.

    ' This example uses the "2d Projected Polylines.jpg." found in the Sample
    ' directory. If you do not have this image, or if it is located
    ' in a different directory, insert a valid path and file name
    ' for the imageName variable below.
    Dim insertionPoint(0 To 2) As Double
    Dim scalefactor As Double
    Dim rotAngleInDegree As Double, rotAngle As Double
    Dim imageName As String
    Dim raster As AcadRasterImage
    imageName = "C:/AutoCAD/sample/2d Projected Polylines.jpg"

    insertionPoint(0) = 2#: insertionPoint(1) = 2#: insertionPoint(2) = 0#
    scalefactor = 1#
    rotAngleInDegree = 0#
    rotAngle = rotAngleInDegree * 3.141592 / 180#

    On Error Resume Next

    ' Creates a raster image in model space
    Set raster = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotAngle)
    If Err.Description = "File error" Then
        MsgBox imageName & " could not be found."
        Exit Sub
    End If

    ' Find the current brightness
    ThisDrawing.Regen True
    MsgBox "The brightness is currently set to: " & raster.Brightness, vbInformation

    ' Change the brightness to 5
    raster.Brightness = 5
    ThisDrawing.Regen True
    MsgBox "The brightness is now set to: " & raster.Brightness, vbInformation
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Brightness()
    ;; This example inserts a raster image and finds the current
    ;; brightness of the image. It then changes the brightness
    ;; of the image.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; This example uses the "2d Projected Polylines.jpg" found in the Sample
    ;; directory. If you do not have this image, or if it is located
    ;; in a different directory, insert a valid path and file name
    ;; for the imageName variable below.
    (setq insertionPoint (vlax-3d-point 2 2 0)
          imageName ".\\Sample\\VBA\\2d Projected Polylines.jpg"
          scalefactor 1
          rotAngleInDegree 0
          rotAngle (/ (* rotAngleInDegree 3.141592) 180))

    (if (/= (findfile ".\\Sample\\VBA\\2d Projected Polylines.jpg") nil)
        (progn
            ;; Creates a raster image in model space
            (setq modelSpace (vla-get-ModelSpace doc))
            (setq raster (vla-AddRaster modelSpace (findfile ".\\Sample\\VBA\\2d Projected Polylines.jpg") insertionPoint scalefactor rotAngle))
            (vla-ZoomExtents acadObj)

            ;; Find the current brightness
            (vla-Regen doc :vlax-true)
            (alert (strcat "The brightness is currently set to: " (rtos (vla-get-Brightness raster) 2)))

            ;; Change the brightness to 5
            (vla-put-Brightness raster 5)
            (vla-Regen doc :vlax-true)
            (alert (strcat "The brightness is now set to: " (rtos (vla-get-Brightness raster) 2)))
    )
        (alert (strcat imageName " could not be found."))
    )
)


CanonicalMediaName Property (ActiveX)

Specifies the paper size by name.

Supported platforms: Windows only

Signature

VBA:

object.CanonicalMediaName
object

Type: Layout, PlotConfiguration

The objects this property applies to.

Property Value

Read-only: No

Type: String

The name of the paper size.

Remarks

Changes to this property will not be visible until after a regeneration of the drawing. Use the Regen method to regenerate the drawing.

Examples

VBA:

Sub Example_CanonicalMediaName()
    ' This example finds the name of the media for the active layout

    Dim MediaName As String
    MediaName = ThisDrawing.ActiveLayout.CanonicalMediaName

    If MediaName = "" Then
        MsgBox "There is no media set for the active layout."
    Else
        MsgBox "The media for the active layout is: " & MediaName
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CanonicalMediaName()
    ;; This example finds the name of the media for the active layout
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq MediaName (vla-get-CanonicalMediaName (vla-get-ActiveLayout doc)))

    (if (/= MediaName "")
        (alert "There is no media set for the active layout.")
        (alert (strcat "The media for the active layout is: " MediaName))
    )
)


Caption Property (ActiveX)

Gets the text that the user sees displayed for the application or a menu item.

Supported platforms: Windows only

Signature

VBA:

object.Caption
object

Type: Application, PopupMenuItem

The objects this property applies to.

Property Value

Read-only: No (except for PopupMenuItem objects)

Type: String

Title displayed in the AutoCAD application window or for a menu item on a popup menu.

Remarks

For a menu item, this property is read-only and is derived from the Label property by removing any DIESEL string expressions.

Examples

VBA:

Sub Example_Caption()
    ' This example returns the caption for the current
    ' AutoCAD session.

    ' Get the Caption property
    Dim strCaption As String
    strCaption = ThisDrawing.Application.Caption
    MsgBox "The caption for this session is " & ThisDrawing.Application.Caption, , "Caption Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Caption()
    ;; This example returns the caption for the current
    ;; AutoCAD session.
    (setq acadObj (vlax-get-acad-object))

    ;; Get the Caption property
    (setq strCaption (vla-get-Caption acadObj))
    (alert (strcat "The caption for this session is " strCaption))
)


CategoryName Property (ActiveX)

Specifies the category name of a view.

Supported platforms: Windows only

Signature

VBA:

object.CategoryName
object

Type: View

The object this property applies to.

Property Value

Read-only: No

Type: String

The category name of the view.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CategoryName()
    ' This example demonstrates the
    ' CategoryName, LayoutId, LayerState,
    ' and HasVpAssociation properties of the View object

    Dim oLSM As AcadLayerStateManager

    ' Access the LayerStateManager object
    Set oLSM = ThisDrawing.Application. _
       GetInterfaceObject("AutoCAD.AcadLayerStateManager.20")

    ' Associate the current drawing database with LayerStateManager
    oLSM.SetDatabase ThisDrawing.Database

    oLSM.Save "ColorLinetype", acLsColor + acLsLineType

    ' Create a view named "New_View" in current drawing
    Dim viewObj As AcadView

    ' Add the view to the views collection
    Set viewObj = ThisDrawing.Views.Add("New_View")
    MsgBox viewObj.Name & " has been added." & vbCrLf & _
           "Height: " & viewObj.Height & vbCrLf & _
           "Width: " & viewObj.Width, , "Example"

    viewObj.CategoryName = "My View Category"
    viewObj.LayerState = "My Layer State"

    viewObj.LayoutId = ThisDrawing.Layouts(1).ObjectID

    MsgBox viewObj.CategoryName & " is the Category name." & vbCrLf & _
            viewObj.LayoutId & " is the Layout ID." & vbCrLf & _
            viewObj.LayerState & " is the Layer state."

    If viewObj.HasVpAssociation = True Then
        MsgBox "The view is associated with a paper space viewport."
    Else
        MsgBox "The view is not associated with a paper space viewport."

   End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CategoryName()
    ;; This example demonstrates the
    ;; CategoryName, LayoutId, LayerState,
    ;; and HasVpAssociation properties of the View object
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Access the LayerStateManager object
    (setq oLSM (vla-GetInterfaceObject acadObj "AutoCAD.AcadLayerStateManager.20"))

    ;; Associate the current drawing database with LayerStateManager
    (vla-SetDatabase oLSM (vla-get-Database doc))

    (vla-Save oLSM "ColorLinetype" (+ acLsColor acLsLineType))

    ;; Add the view to the views collection
    (setq viewObj (vla-Add (vla-get-Views doc) "New_View"))
    (alert (strcat (vla-get-Name viewObj) " has been added."
                   "\nHeight: " (rtos (vla-get-Height viewObj) 2)
                   "\nWidth: " (rtos (vla-get-Width viewObj) 2)
           )
    )

    (vla-put-CategoryName viewObj "My View Category")
    (vla-put-LayerState viewObj "My Layer State")

    (vla-put-LayoutId viewObj (vla-get-ObjectID (vla-Item (vla-get-Layouts doc) 1)))

    (alert (strcat (vla-get-CategoryName viewObj) " is the Category name."
                   "\n" (itoa (vla-get-LayoutId viewObj)) " is the Layout ID."
                   "\n" (vla-get-LayerState viewObj) " is the Layer state."
           )
    )

    (if (= (vla-get-HasVpAssociation viewObj) :vlax-true)
        (alert "The view is associated with a paper space viewport.")
        (alert "The view is not associated with a paper space viewport.")
    )

    (vlax-release-object oLSM)
)


Center Property (ActiveX)

Specifies the center of an arc, circle, ellipse, view, or viewport.

Supported platforms: Windows only

Signature

VBA:

object.Center
object

Type: Arc, Circle, DimRadialLarge, Ellipse, PViewport, View, Viewport

The objects this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

The 3D coordinate representing the center of the object. The default center is (0,0,0).

Viewport, View: The center for the viewport and view objects is a 2D coordinate.

Remarks

Center of an arc

Examples

VBA:

Sub Example_Center()

    Dim circObj As AcadCircle
    Dim currCenterPt(0 To 2) As Double
    Dim newCenterPt(0 To 2) As Double
    Dim radius As Double

    ' Define the initial center point and radius for the circle
    currCenterPt(0) = 20: currCenterPt(1) = 30: currCenterPt(2) = 0
    radius = 3

    ' Create the circle in model space
    Set circObj = ThisDrawing.ModelSpace.AddCircle(currCenterPt, radius)
    ZoomAll
    MsgBox "The center point of the circle is " & currCenterPt(0) & ", " & currCenterPt(1) & ", " & currCenterPt(2), vbInformation, "Center Example"

    ' Change the center point of the circle
    newCenterPt(0) = 25: newCenterPt(1) = 25: newCenterPt(2) = 0
    circObj.center = newCenterPt
    circObj.Update

    ' Query the results of the new center position
    ' Notice the output from the center property is a variant
    Dim centerPoint As Variant
    centerPoint = circObj.center
    MsgBox "The center point of the circle is " & centerPoint(0) & ", " & centerPoint(1) & ", " & centerPoint(2), vbInformation, "Center Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Center()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the initial center point and radius for the circle
    (setq currCenterPt (vlax-3d-point 20 30 0)
          radius 3)

    ;; Create the circle in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circObj (vla-AddCircle modelSpace currCenterPt radius))
    (vla-ZoomAll acadObj)
    (alert (strcat "The center point of the circle is"
           "\n" (rtos (nth 0 (vlax-safearray->list (vlax-variant-value currCenterPt)))) ", "
           (rtos (nth 1 (vlax-safearray->list (vlax-variant-value currCenterPt)))) ", "
           (rtos (nth 2 (vlax-safearray->list (vlax-variant-value currCenterPt))))
           )
    )

    ;; Change the center point of the circle
    (setq newCenterPt (vlax-3d-point 25 25 0))
    (vla-put-Center circObj newCenterPt)
    (vla-Update circObj)

    ;; Query the results of the new center position
    ;; Notice the output from the center property is a variant
    (setq centerPoint (vlax-variant-value (vla-get-Center circObj)))
    (alert (strcat "The center point of the circle is"
           "\n" (rtos (nth 0 (vlax-safearray->list centerPoint))) ", "
           (rtos (nth 1 (vlax-safearray->list centerPoint))) ", "
           (rtos (nth 2 (vlax-safearray->list centerPoint)))
           )
    )
)


CenterMarkSize Property (ActiveX)

Specifies the size of the center mark for radial and diameter dimensions.

Supported platforms: Windows only

Signature

VBA:

object.CenterMarkSize
object

Type: DimDiametric, DimRadial, DimRadialLarge

The objects this property applies to.

Property Value

Read-only: No

Type: Double

A positive real number specifying the size of the center mark or lines.

Remarks

The initial value for this property is 0.0900.

This property is not available if the CenterType property is set to acCenterNone.

NoteThis property overrides the value of the DIMCEN system variable for the given dimension.

Examples

VBA:

Sub Example_CenterMarkSize()
    ' This example creates a diametric dimension in model space.
    ' It then changes the type of center for the dimension to
    ' center mark, and adjusts the size of the center mark.

    Dim dimObj As AcadDimDiametric
    Dim chordPoint(0 To 2) As Double
    Dim farChordPoint(0 To 2) As Double
    Dim leaderLength As Double

    ' Define the dimension
    chordPoint(0) = 5#: chordPoint(1) = 3#: chordPoint(2) = 0#
    farChordPoint(0) = 5#: farChordPoint(1) = 5#: farChordPoint(2) = 0#
    leaderLength = 1#

    ' Create the diametric dimension in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimDiametric(chordPoint, farChordPoint, leaderLength)
    ZoomAll

    ' Change the center type to center mark and set the size of the center mark
    dimObj.CenterType = acCenterMark
    dimObj.CenterMarkSize = 0.1
    dimObj.Update
    MsgBox "The center mark size is: " & dimObj.CenterMarkSize

    dimObj.CenterMarkSize = dimObj.CenterMarkSize * 2
    dimObj.Update
    MsgBox "The center mark size is: " & dimObj.CenterMarkSize
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CenterMarkSize()
    ;; This example creates a diametric dimension in model space.
    ;; It then changes the type of center for the dimension to
    ;; center mark, and adjusts the size of the center mark.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq chordPoint (vlax-3d-point 5 3 0)
          farChordPoint (vlax-3d-point 5 5 0)
          leaderLength 1)

    ;; Create the diametric dimension in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimDiametric modelSpace chordPoint farChordPoint leaderLength))
    (vla-ZoomAll acadObj)

    ;; Change the center type to center mark and set the size of the center mark
    (vla-put-CenterType dimObj acCenterMark)
    (vla-put-CenterMarkSize dimObj 0.1)
    (vla-Update dimObj)
    (alert (strcat "The center mark size is: " (rtos (vla-get-CenterMarkSize dimObj) 2)))

    (vla-put-CenterMarkSize dimObj (* (vla-get-CenterMarkSize dimObj) 2))
    (vla-Update dimObj)
    (alert (strcat "The center mark size is: " (rtos (vla-get-CenterMarkSize dimObj) 2)))
)


CenterPlot Property (ActiveX)

Specifies the centering of the plot on the media.

Supported platforms: Windows only

Signature

VBA:

object.CenterPlot
object

Type: Layout, PlotConfiguration

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Center the plot on the media.
  • False: Do not center the plot on the media.

Remarks

Changes to this property will not be visible until after a regeneration of the drawing. Use the Regen method to regenerate the drawing.

This property cannot be set to True on a layout object whose PlotType property is set to acLayout.

Examples

VBA:

Sub Example_CenterPlot()
    ' This example will access the Layouts collection for the current drawing
    ' and display whether the plot for this layout is to be centered on the media.
    ' It will then toggle the state of CenterPlot for "Layout1" and re-display the
    ' CenterPlot state for each Layout.

    Dim Layouts As AcadLayouts, Layout As ACADLayout
    Dim msg As String
    Dim IsCentered As String

    ' Get layouts collection from document object
    Set Layouts = ThisDrawing.Layouts

    ' Display current layout information
    GoSub DISPLAY

    ' Toggle centered state for Layout1
    Layouts("Layout1").PlotType = acDisplay
    Layouts("Layout1").CenterPlot = Not (Layouts("Layout1").CenterPlot)
    ThisDrawing.Regen acAllViewports

    ' Display new layout information
    GoSub DISPLAY

    Exit Sub

DISPLAY:
    msg = ""    ' Clear message

    ' Determine whether this layout is centered on the media during a plot
    For Each Layout In Layouts
        IsCentered = IIf(Layout.CenterPlot, " are centered ", " are not centered ")

        ' Format for display
        msg = msg & "Objects for " & Layout.name & IsCentered & "on the media during a plot." & vbCrLf
    Next

    ' Display layout information
    MsgBox msg

    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CenterPlot()
    ;; This example will access the Layouts collection for the current drawing
    ;; and display whether the plot for this layout is to be centered on the media.
    ;; It will then toggle the state of CenterPlot for "Layout1" and re-display the
    ;; CenterPlot state for each Layout.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get layouts collection from document object
    (setq Layouts (vla-get-Layouts doc))

    ;; Display current layout information
    (setq msg "")    ;; Clear message

    ;; Determine whether this layout is centered on the media during a plot
    (vlax-for Layout Layouts
        (setq IsCentered (if (= (vla-get-CenterPlot Layout) :vlax-true) " are centered " " are not centered "))

        ;; Format for display
        (setq msg (strcat msg "Objects for " (vla-get-Name Layout) IsCentered "on the media during a plot.\n"))
    )

    ;; Display layout information
    (alert msg)

    ;; Toggle centered state for Layout1
    (vla-put-PlotType (vla-Item Layouts "Layout1") acDisplay)
    (vla-put-CenterPlot (vla-Item Layouts "Layout1") (if (= (vla-get-CenterPlot (vla-Item Layouts "Layout1")) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)

    (setq msg "")    ;; Clear message
    ;; Display new layout information
    (vlax-for Layout Layouts
        (setq IsCentered (if (= (vla-get-CenterPlot Layout) :vlax-true) " are centered " " are not centered "))

        ;; Format for display
        (setq msg (strcat msg "Objects for " (vla-get-Name Layout) IsCentered "on the media during a plot.\n"))
    )

    ;; Display layout information
    (alert msg)
)


CenterPoint Property (ActiveX)

Specifies the center of the arc.

Supported platforms: Windows only

Signature

VBA:

object.CenterPoint
object

Type: DimArcLength

The object this property applies to.

Property Value

Read-only: No

Type: Variant

Center point for the arc.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


CenterType Property (ActiveX)

Specifies the type of center mark for radial and diameter dimensions.

Supported platforms: Windows only

Signature

VBA:

object.CenterType
object

Type: DimDiametric, DimRadial, DimRadialLarge

The objects this property applies to.

Property Value

Read-only: No

Type: acDimCenterType enum

  • acCenterMark
  • acCenterLine
  • acCenterNone

Remarks

The center mark is visible only if you place the dimension line outside the circle or arc.

acCenterMark

acCenterLine

NoteThis property overrides the value of the DIMCEN system variable for the given dimension.

Examples

VBA:

Sub Example_CenterType()
    ' This example creates a diametric dimension in model space.
    ' It then changes the type of center for the dimension.

    Dim dimObj As AcadDimDiametric
    Dim chordPoint(0 To 2) As Double
    Dim farChordPoint(0 To 2) As Double
    Dim leaderLength As Double

    ' Define the dimension
    chordPoint(0) = 5#: chordPoint(1) = 3#: chordPoint(2) = 0#
    farChordPoint(0) = 5#: farChordPoint(1) = 5#: farChordPoint(2) = 0#
    leaderLength = 1#

    ' Create the diametric dimension in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimDiametric(chordPoint, farChordPoint, leaderLength)
    ZoomAll

    ' Set the center to be none
    dimObj.CenterType = acCenterNone
    dimObj.Update
    MsgBox "The dimension center type is set to none."

    ' Change the center type to center mark
    dimObj.CenterType = acCenterMark
    dimObj.Update
    MsgBox "The dimension center type is set to center mark."

    ' Change the center type to center line
    dimObj.CenterType = acCenterLine
    dimObj.Update
    MsgBox "The dimension center type is set to center line."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CenterType()
    ;; This example creates a diametric dimension in model space.
    ;; It then changes the type of center for the dimension.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq chordPoint (vlax-3d-point 5 3 0)
          farChordPoint (vlax-3d-point 5 5 0)
          leaderLength 1)

    ;; Create the diametric dimension in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimDiametric modelSpace chordPoint farChordPoint leaderLength))
    (vla-ZoomAll acadObj)

    ;; Set the center to be none
    (vla-put-CenterType dimObj acCenterNone)
    (vla-Update dimObj)
    (alert "The dimension center type is set to none.")

    ;; Change the center type to center mark
    (vla-put-CenterType dimObj acCenterMark)
    (vla-Update dimObj)
    (alert "The dimension center type is set to center mark.")

    ;; Change the center type to center line
    (vla-put-CenterType dimObj acCenterLine)
    (vla-Update dimObj)
    (alert "The dimension center type is set to center line.")
)


Centroid Property (ActiveX)

Gets the center of area or mass for a region or solid.

Supported platforms: Windows only

Signature

VBA:

object.Centroid
object

Type: 3DSolid, Region

The objects this property applies to.

Property Value

Read-only: Yes

Type: Variant (two-element array of doubles)

The 2D coordinate representing the centroid.

Remarks

The centroid is returned as X and Y coordinates defined as a variant.

Examples

VBA:

Sub Example_Centroid()
    ' This example creates a box in model space.
    ' It then returns the Centroid for that box.

    Dim boxObj As Acad3DSolid
    Dim length As Double, width As Double, height As Double
    Dim center(0 To 2) As Double

    ' Define the box
    center(0) = 5#: center(1) = 5#: center(2) = 0
    length = 5#: width = 7: height = 10#

    ' Create the box (3DSolid) object in model space
    Set boxObj = ThisDrawing.ModelSpace.AddBox(center, length, width, height)

    ' Change the viewing direction of the viewport to better see the box
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

    ' Return the Centroid for the box
    Dim Centroid As Variant
    Centroid = boxObj.Centroid
    MsgBox "The Centroid for the box is " & Centroid(0) & ", " & Centroid(1), , "Centroid Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Centroid()
    ;; This example creates a box in model space.
    ;; It then returns the Centroid for that box.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the box
    (setq center (vlax-3d-point 5 5 0)
          boxLength 5
             boxWidth 7
             boxHeight 10)

    ;; Create the box (3DSolid) object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq boxObj (vla-AddBox modelSpace center boxLength boxWidth boxHeight))

    ;; Change the viewing direction of the viewport to better see the box
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)

    ;; Return the Centroid for the box
    (setq Centroid (vlax-safearray->list (vlax-variant-value (vla-get-Centroid boxObj))))
    (alert (strcat "The Centroid for the box is " (rtos (nth 0 Centroid) 2) ", " (rtos (nth 1 Centroid) 2)))
)


Check Property (ActiveX)

Specifies the check status for the popup menu item.

Supported platforms: Windows only

Signature

VBA:

object.Check
object

Type: PopupMenuItem

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The popup menu item is checked.
  • False: The popup menu item is not checked.

Remarks

In the following example, the 1Drawing.dwg menu item is checked.

Examples

VBA:

Sub Example_Check()
    ' This example creates a new menu called TestMenu and inserts two menu items
    ' into it. The second menu item is then checked.
    ' The menu is displayed on the menu bar.
    ' To remove the menu after execution of this macro, use the Customize Menu
    ' option from the Tools menu.

    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    ' Create the new menu
    Dim newMenu As AcadPopupMenu
    Set newMenu = currMenuGroup.Menus.Add("TestMenu")

    ' Add two menu items to the new menu
    Dim Menu1 As AcadPopupMenuItem
    Dim Menu2 As AcadPopupMenuItem
    Dim MenuSeparator As AcadPopupMenuItem
    Dim openMacro As String

    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set Menu1 = newMenu.AddMenuItem(newMenu.count + 1, "Open1", openMacro)
    Set MenuSeparator = newMenu.AddSeparator("")
    Set Menu2 = newMenu.AddMenuItem(newMenu.count + 1, "Open2", openMacro)

    ' Disable the new menu item
    Menu2.Check = True

    ' Display the menu on the menu bar
    newMenu.InsertInMenuBar (ThisDrawing.Application.MenuBar.count + 1)

End Subt

Visual LISP:

(vl-load-com)
(defun c:Example_Check()
    ;; This example creates a new menu called TestMenu and inserts two menu items
    ;; into it. The second menu item is then checked.
    ;; The menu is displayed on the menu bar.
    ;; To remove the menu after execution of this macro, use the Customize Menu
    ;; option from the Tools menu.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new menu
    (setq newMenu (vla-Add (vla-get-Menus currMenuGroup) "TestMenu"))

    ;; Add two menu items to the new menu
    ;; Assign the macro string the VB equivalent of "ESC ESC _open "
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))

    (setq Menu1 (vla-AddMenuItem newMenu (1+ (vla-get-Count newMenu)) "Open1" openMacro))
    (setq MenuSeparator (vla-AddSeparator newMenu ""))
    (setq Menu2 (vla-AddMenuItem newMenu (1+ (vla-get-Count newMenu)) "Open2" openMacro))

    ;; Disable the new menu item
    (vla-put-Check Menu2 :vlax-true)

    ;; Display the menu on the menu bar
    (vla-InsertInMenuBar newMenu (1+ (vla-get-Count (vla-get-MenuBar acadObj))))
)


ChordPoint Property (ActiveX)

Specifies the chord point for the arc.

Supported platforms: Windows only

Signature

VBA:

object.ChordPoint
object

Type: DimRadialLarge

The object this property applies to.

Property Value

Read-only: No

Type: Variant

Chord point for the arc.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Circumference Property (ActiveX)

Specifies the circumference of a circle.

Supported platforms: Windows only

Signature

VBA:

object.Circumference
object

Type: Circle

The object this property applies to.

Property Value

Read-only: No

Type: Double

The circumference of the circle.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Circumference()
    ' This example creates a Circle object in model space and
    ' returns the circumference of the Circle

    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double

    ' Define the new Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    radius = 5#

    ' Create the Circle object in model space
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)

    ThisDrawing.Application.ZoomAll

    MsgBox "The circumference of the new Circle is: " & circleObj.Circumference

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Circumference()
    ;; This example creates a Circle object in model space and
    ;; returns the circumference of the Circle
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Circle object
    (setq centerPoint (vlax-3d-point 5 5 0)
          radius 5)

    ;; Create the Circle object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))

    (vla-ZoomAll acadObj)

    (alert (strcat "The circumference of the new Circle is: " (rtos (vla-get-Circumference circleObj) 2)))
)


Clipped Property (ActiveX)

Determines if the viewport has been clipped.

Supported platforms: Windows only

Signature

VBA:

object.Clipped
object

Type: PViewport

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: The viewport has been clipped.
  • False: The viewport has not been clipped.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Clipped()
    ' This example scans the current drawing paper space Viewports
    ' and displays whether or not any of them are clipped.

    Dim pviewportObj As Object
    Dim msg As String, ClippedState As String

    ' Make sure this drawing contains paper space viewports before continuing
    If ThisDrawing.PaperSpace.Count = 0 Then
        MsgBox "There are no paper space viewports in the current drawing."
        Exit Sub
    End If

    ' Go through each PViewport object in the drawing paper space
    ' and determine whether the paper space viewport is clipped or not

    For Each pviewportObj In ThisDrawing.PaperSpace
        ' Determine if this is a paper space viewport
        If pviewportObj.ObjectName = "AcDbViewport" Then
            ' Determine if this paper space viewport is clipped
            ClippedState = IIf(pviewportObj.Clipped, " is clipped", " is not clipped")
            msg = msg & "PViewport ID " & pviewportObj.ObjectID & ClippedState & vbCrLf
        End If
    Next

    ' Display clipped state of paper space Viewports
    MsgBox msg
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Clipped()
    ;; This example scans the current drawing paper space Viewports
    ;; and displays whether or not any of them are clipped.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Make sure this drawing contains paper space viewports before continuing
    (if (= (vla-get-Count (vla-get-PaperSpace doc)) 0)
        (alert "There are no paper space viewports in the current drawing.")
        (progn
        ;; Go through each PViewport object in the drawing paper space
        ;; and determine whether the paper space viewport is clipped or not
            (setq msg "")

        (vlax-for pviewportObj (vla-get-PaperSpace doc)
            ;; Determine if this is a paper space viewport
            (if (= (vla-get-ObjectName pviewportObj) "AcDbViewport")
                (progn
                    ;; Determine if this paper space viewport is clipped
                    (setq ClippedState (if (= (vla-get-Clipped pviewportObj) :vlax-true) " is clipped" " is not clipped"))
                    (setq msg (strcat msg "PViewport ID " (itoa (vla-get-ObjectID pviewportObj)) ClippedState "\n"))
            )
            )
        )

        ;; Display clipped state of paper space Viewports
        (alert msg)
    )
    )
)


ClippingEnabled Property (ActiveX)

Enables or disables the clipping boundary.

Supported platforms: Windows only

Signature

VBA:

object.ClippingEnabled
object

Type: DgnUnderlay, DwfUnderlay, GeomapImage, PdfUnderlay, RasterImage, Wipeout

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The clipping boundary is enabled.
  • False: The clipping boundary is not enabled.

Remarks

You can display a clipped image or underlay using the clipping boundary, or you can hide the clipping boundary and display the original image or underlay boundaries. To set the clipping boundary, use the ClipBoundary method.

Examples

VBA:

Sub Example_ClippingEnabled()
    ' This example adds a raster image in model space.
    ' It then clips the image based on a clip boundary,
    ' and toggles the display of the clipping.

    Dim insertionPoint(0 To 2) As Double
    Dim scalefactor As Double
    Dim rotationAngle As Double
    Dim imageName As String
    Dim rasterObj As AcadRasterImage

    imageName = "C:\AutoCAD\sample\2d Projected Polylines.jpg"
    insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0#
    scalefactor = 2#
    rotationAngle = 0

    On Error Resume Next
    ' Creates a raster image in model space
    Set rasterObj = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotationAngle)

    If Err.Description = "Filer error" Then
        MsgBox imageName & " could not be found."
        Exit Sub
    End If

    ZoomAll
    MsgBox "Clip the image?", , "ClipBoundary Example"

    ' Establish the clip boundary with an array of points
    Dim clipPoints(0 To 9) As Double
    clipPoints(0) = 6: clipPoints(1) = 6.75
    clipPoints(2) = 7: clipPoints(3) = 6
    clipPoints(4) = 6: clipPoints(5) = 5
    clipPoints(6) = 5: clipPoints(7) = 6
    clipPoints(8) = 6: clipPoints(9) = 6.75

    ' Clip the image
    rasterObj.clipBoundary clipPoints

    ' Enable the display of the clip
    rasterObj.ClippingEnabled = True
    ThisDrawing.Regen acActiveViewport
    MsgBox "Turn off the display of the clipped image.", , "ClippingEnabled Example"

    ' Disable the display of the clip
    rasterObj.ClippingEnabled = False
    ThisDrawing.Regen acActiveViewport
    MsgBox "Display off.", , "ClippingEnabled Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ClippingEnabled()
    ;; This example adds a raster image in model space.
    ;; It then clips the image based on a clip boundary.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; This example uses the "downtown.jpg" found in the Sample
    ;; directory. If you do not have the image, or if it is located
    ;; in a different directory, insert a valid path and name for the
    ;; imageName variable below.
    (setq insertionPoint (vlax-3d-point 5 5 0)
          imageName ".\\Sample\\VBA\\2d Projected Polylines.jpg"
          scalefactor 2
          rotationAngle 0)

    (if (/= (findfile ".\\Sample\\VBA\\2d Projected Polylines.jpg") nil)
        (progn
        ;; Creates a raster image in model space
            (setq modelSpace (vla-get-ModelSpace doc))
            (setq rasterObj (vla-AddRaster modelSpace (findfile ".\\Sample\\VBA\\2d Projected Polylines.jpg") insertionPoint scalefactor rotationAngle))

        (vla-ZoomAll acadObj)
        (alert "Clip the image?")

        ;; Establish the clip boundary with an array of points
        (setq clipPoints (vlax-make-safearray vlax-vbDouble '(0 . 9)))
        (vlax-safearray-fill clipPoints '(6 6.75
                          7 6
                          6 5
                          5 6
                          6 6.75
                         )
        )

        ;; Clip the image
        (vla-ClipBoundary rasterObj clipPoints)

            ;; Enable the display of the clip
            (vla-put-ClippingEnabled rasterObj :vlax-true)
            (vla-Regen doc acActiveViewport)
            (alert "Turn off the display of the clipped image.")

            ;; Disable the display of the clip
            (vla-put-ClippingEnabled rasterObj :vlax-false)
            (vla-Regen doc acActiveViewport)
            (alert "Clip boundary off.")

    )
        (alert (strcat imageName " could not be found."))
    )
)


Closed Property (ActiveX)

Specifies whether the 3D polyline, lightweight polyline, lofted surface, polyline, or spline is open or closed.

Supported platforms: Windows only

Signature

VBA:

object.Closed
object

Type: 3DPolyline, LoftedSurface, LWPolyline, Polyline, Spline

The objects this property applies to.

Property Value

Read-only: No (except for Spline objects)

Type: Boolean

  • True: The object is closed.
  • False: The object is open (default).

Remarks

An open 3D polyline

A closed 3D polyline

A lofted surface is closed if the cross-section curves that determine its profile are closed. For instance, if an arc is used in the lofting profile, the resulting surface is open. If closed curves such as circles are used for lofting, the resulting surface is closed.

Examples

VBA:

Sub Example_Closed()
    ' This example creates a polyline and then toggles the
    ' setting to Closed.
    Dim plineObj As AcadPolyline
    Dim closedState As String

    ' Create the polyline
    Dim points(8) As Double
    points(0) = 3: points(1) = 7: points(2) = 0
    points(3) = 9: points(4) = 2: points(5) = 0
    points(6) = 3: points(7) = 5: points(8) = 0
    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)

    ' Set the closed property to True
    plineObj.Closed = True      ' Close Polyline
    ThisDrawing.Regen (True)
    GoSub DISPLAY

    ' Open the PolyLine by setting the closed property to False
    plineObj.Closed = False      ' Open Polyline
    ThisDrawing.Regen (True)
    GoSub DISPLAY

    Exit Sub

DISPLAY:
    ' Retrieve and display the Closed property
    closedState = IIf(plineObj.Closed, "Closed", "Open")
    MsgBox "The new Polyline is: " & closedState, vbInformation, "Closed Example"
    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Closed()
    ;; This example creates a polyline and then toggles the
    ;; setting to Closed.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill points '(3 7 0
                  9 2 0
                  3 5 0
                 )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddPolyline modelSpace points))

    ;; Set the closed property to True
    (vla-put-Closed plineObj :vlax-true)      ;; Close Polyline
    (vla-Regen doc :vlax-true)

    ;; Retrieve and display the Closed property
    (setq closedState (if (= (vla-get-Closed plineObj) :vlax-true) "Closed" "Open"))
    (alert (strcat "The new Polyline is: " closedState))

    ;; Open the PolyLine by setting the closed property to False
    (vla-put-Closed plineObj :vlax-false)      ;; Open Polyline
    (vla-Regen doc :vlax-true)

    ;; Retrieve and display the Closed property
    (setq closedState (if (= (vla-get-Closed plineObj) :vlax-true) "Closed" "Open"))
    (alert (strcat "The new Polyline is: " closedState))
)


Closed2 Property (ActiveX)

Specifies whether the spline is open or closed.

Supported platforms: Windows only

Signature

VBA:

object.Closed2
object

Type: Spline

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The object is closed.
  • False: The object is open (default).

Remarks

When you close a spline, you make it tangent-continuous at both ends. If the spline's start point and endpoint are already the same, closing the spline makes it tangent-continuous at both points.

When you open a closed spline, if the spline's start point and endpoint were the same before the close, this property returns the spline to its original state. The start point and endpoint remain the same, but lose their tangent continuity.

When you open a closed spline, if the spline's start point and endpoint were not the same before the close, this property returns the spline to its original state and removes tangent continuity.

Examples

VBA:

Sub Example_Closed()
    ' This example creates a polyline and then toggles the
    ' setting to Closed.
    Dim plineObj As AcadPolyline
    Dim closedState As String

    ' Create the polyline
    Dim points(8) As Double
    points(0) = 3: points(1) = 7: points(2) = 0
    points(3) = 9: points(4) = 2: points(5) = 0
    points(6) = 3: points(7) = 5: points(8) = 0
    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)

    ' Set the closed property to True
    plineObj.Closed = True      ' Close Polyline
    ThisDrawing.Regen (True)
    GoSub DISPLAY

    ' Open the PolyLine by setting the closed property to False
    plineObj.Closed = False      ' Open Polyline
    ThisDrawing.Regen (True)
    GoSub DISPLAY

    Exit Sub

DISPLAY:
    ' Retrieve and display the Closed property
    closedState = IIf(plineObj.Closed, "Closed", "Open")
    MsgBox "The new Polyline is: " & closedState, vbInformation, "Closed Example"
    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Closed()
    ;; This example creates a polyline and then toggles the
    ;; setting to Closed.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill points '(3 7 0
                  9 2 0
                  3 5 0
                 )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddPolyline modelSpace points))

    ;; Set the closed property to True
    (vla-put-Closed plineObj :vlax-true)      ;; Close Polyline
    (vla-Regen doc :vlax-true)

    ;; Retrieve and display the Closed property
    (setq closedState (if (= (vla-get-Closed plineObj) :vlax-true) "Closed" "Open"))
    (alert (strcat "The new Polyline is: " closedState))

    ;; Open the PolyLine by setting the closed property to False
    (vla-put-Closed plineObj :vlax-false)      ;; Open Polyline
    (vla-Regen doc :vlax-true)

    ;; Retrieve and display the Closed property
    (setq closedState (if (= (vla-get-Closed plineObj) :vlax-true) "Closed" "Open"))
    (alert (strcat "The new Polyline is: " closedState))
)


Color Property (ActiveX)

Specifies the color of an object or layer.

Supported platforms: Windows only

Signature

VBA:

object.Color
object

Type: All drawing objects, Group, Layer, MLeaderLeader, SubDMeshEdge, SubDMeshFace, SubDMeshVertex, SubEntity, SubEntSolidEdge, SubEntSolidFace, SubEntSolidNode, SubEntSolidVertex

The objects this property applies to.

Property Value

Read-only: No (except for the Group object which is write-only)

Type: acColor enum

The default color designation is acByLayer. Use a color index number from 0 to 256, or one of the constants listed here:

  • acByBlock
  • acByLayer (not valid for Layer object)
  • acRed
  • acYellow
  • acGreen
  • acCyan
  • acBlue
  • acMagenta
  • acWhite

Remarks

This property is obsolete for most drawing objects and will be removed in a future version accordingly. When using this property, colors can be set and read as numeric index values ranging from 0 to 256. Constants are provided for the standard seven colors, as well as for the BYBLOCK and BYLAYER designations.

If you use acByBlock, AutoCAD draws new objects in the default color (white or black, depending on your configuration) until they are grouped into the block. When the block is inserted in the drawing, the objects in the block inherit the current setting of the color property.

If you use acByLayer, new objects assume the color of the layer upon which they are drawn. The value acByLayer is not valid for a Layer object.

Examples

VBA:

Sub Example_Color()
    ' This example creates a polyline and colors it red.
    ' It then displays the current color setting for the polyline.
    Dim plineObj As AcadPolyline
    Dim currentcolor As Variant

    ' Create Polyline
    Dim points(8) As Double
    points(0) = 3: points(1) = 7: points(2) = 0
    points(3) = 9: points(4) = 2: points(5) = 0
    points(6) = 3: points(7) = 5: points(8) = 0

    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)

    ' First set the color of the object to Red
    plineObj.Color = acRed
    ThisDrawing.Regen (True)

    ' Now retrieve and display the Color property
    currentcolor = plineObj.Color

    ' Translate the color from a number into text
    If currentcolor = 256 Then
        currentcolor = "By Layer"
    Else
        currentcolor = Choose(currentcolor + 1, "By Block", "Red", "Yellow", "Green", "Cyan", "Blue", "Magenta", "White")
    End If

    ' Display
    MsgBox "The Polyline color is: " & currentcolor, vbInformation, "Color Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Color()
    ;; This example creates a polyline and colors it red.
    ;; It then displays the current color setting for the polyline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create Polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill points '(3 7 0
                  9 2 0
                  3 5 0
                 )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddPolyline modelSpace points))

    ;; First set the color of the object to Red
    (vla-put-Color plineObj acRed)
    (vla-Regen doc :vlax-true)

    ;; Now retrieve and display the Color property
    (setq currentcolor (vla-get-Color plineObj))

    ;; Translate the color from a number into text
    (if (= currentcolor 256)
        (setq currentcolor "ByLayer")
        (setq currentcolor (cond
            ((= currentcolor 257) "ByBlock")
            ((= currentcolor 1) "Red")
            ((= currentcolor 2) "Yellow")
            ((= currentcolor 3) "Green")
            ((= currentcolor 4) "Cyan")
            ((= currentcolor 5) "Blue")
            ((= currentcolor 6) "Magenta")
            ((= currentcolor 7) "White/Black")
            ("Other")
    ))
    )

    ;; Display
    (alert (strcat "The Polyline color is: " currentcolor))
)


ColorBookPath Property (ActiveX)

Sets the color book path.

Supported platforms: Windows only

Signature

VBA:

object.ColorBookPath
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The color book path.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ColorBookPath()
    'This example changes the color book path
    'and then sets it to its original string

    Dim pref As AutoCAD.AcadPreferencesFiles
    Set pref = AcadApplication.Preferences.Files

    Dim defCBPath As String
    Dim changedCBPath As String

    defCBPath = pref.ColorBookPath
    MsgBox "The current color book path is " & defCBPath

    pref.ColorBookPath = "c:\winnt;c:\temp"
    changedCBPath = pref.ColorBookPath
    MsgBox "The changed color book path is " & changedCBPath

    pref.ColorBookPath = defCBPath

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ColorBookPath()
    ;; This example changes the color book path
    ;; and then sets it to its original string
    (setq acadObj (vlax-get-acad-object))
    (setq pref (vla-get-Files (vla-get-Preferences acadObj)))

    (setq defCBPath (vla-get-ColorBookPath pref))
    (alert (strcat "The current color book path is " defCBPath))

    (vla-put-ColorBookPath pref "c:\\winnt;c:\\temp")
    (setq changedCBPath (vla-get-ColorBookPath pref))
    (alert (strcat "The changed color book path is " changedCBPath))

    (vla-put-ColorBookPath pref defCBPath)
)


ColorIndex Property (ActiveX)

Specifies the color index.

Supported platforms: Windows only

Signature

VBA:

object.ColorIndex
object

Type: AcCmColor

The object this property applies to.

Property Value

Read-only: No

Type: acColor enum

The default color designation is acByLayer. Use a color index number from 0 to 256, or one of the constants listed here:

  • acByBlock
  • acByLayer (not valid for Layer object)
  • acRed
  • acYellow
  • acGreen
  • acCyan
  • acBlue
  • acMagenta
  • acWhite

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ColorIndex()
    'This example draws a circle and
    'returns the closest color index.

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 125, 175, 235

    Dim cir As AcadCircle
    Dim pt(0 To 2) As Double
    Set cir = ThisDrawing.modelSpace.AddCircle(pt, 2)
    cir.TrueColor = col
    ZoomAll

    Dim retCol As AcadAcCmColor
    Set retCol = cir.TrueColor

    If col.ColorMethod = AutoCAD.acColorMethodByRGB Then
    MsgBox "Closest ColorIndex=" & col.ColorIndex
    End If

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ColorIndex()
    ;;This example draws a circle and
    ;;returns the closest color index.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 125 175 235)

    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq cir (vla-AddCircle modelSpace pt 2))
    (vla-put-TrueColor cir col)
    (vla-ZoomAll acadObj)

    (setq retCol (vla-get-TrueColor cir))

    (if (= (vla-get-ColorMethod col) acColorMethodByRGB)
        (alert (strcat "Closest ColorIndex=" (itoa (vla-get-ColorIndex col))))
    )

    (vlax-release-object col)
)


ColorMethod Property (ActiveX)

Specifies the color method.

Supported platforms: Windows only

Signature

VBA:

object.ColorMethod
object

Type: AcCmColor

The object this property applies to.

Property Value

Read-only: No

Type: acColorMethod enum

The default color method is acColorMethodByLayer. To directly determine how a color is set, use the constants listed here:

  • acColorMethodByACI
  • acColorMethodByBlock
  • acColorMethodByLayer
  • acColorMethodByRGB
  • acColorMethodForeground

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ColorMethod()
    ' This example shows how to change the
    ' ColorMethod property
    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.ColorMethod = AutoCAD.acColorMethodForeground

    ' Circle number one
    Dim cir1 As AcadCircle
    Dim pt(0 To 2) As Double
    Set cir1 = ThisDrawing.modelSpace.AddCircle(pt, 2)
    cir1.TrueColor = col
    ZoomAll

    Dim retCol As AcadAcCmColor
    Set retCol = cir1.TrueColor

    ' Message box with method and index
    Dim MethodText As String
    MethodText = col.ColorMethod
    MsgBox "ColorMethod=" & MethodText & vbCrLf & "Index=" & col.ColorIndex

    ' Circle number two
    Dim cir2 As AcadCircle
    Set cir2 = ThisDrawing.modelSpace.AddCircle(pt, 6)
    ZoomAll

    col.ColorMethod = AutoCAD.acColorMethodByBlock

    ' Message box with method and index
    MethodText = col.ColorMethod
    MsgBox "ColorMethod=" & MethodText & vbCrLf & "Index=" & col.ColorIndex

    ' Circle number three
    Dim cir3 As AcadCircle
    Set cir3 = ThisDrawing.modelSpace.AddCircle(pt, 10)
    ZoomAll

    Dim layColor As AcadAcCmColor
    Set layColor = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    layColor.SetRGB 122, 199, 25
    ThisDrawing.ActiveLayer.TrueColor = layColor

    col.ColorMethod = AutoCAD.acColorMethodByLayer

    Set retCol = cir3.TrueColor

    ' Message box with method and index
    MethodText = col.ColorMethod
    MsgBox "ColorMethod=" & MethodText & vbCrLf & "Index=" & col.ColorIndex
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ColorMethod()
    ;; This example shows how to change the
    ;; ColorMethod property
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-put-ColorMethod col acColorMethodForeground)

    ;; Circle number one
    (setq pt (vlax-3d-point 0 0 0))

    (setq cir1 (vla-AddCircle modelSpace pt 2))
    (vla-put-TrueColor cir1 col)
    (vla-ZoomAll acadObj)
    (vla-Regen doc :vlax-true)

    (setq retCol (vla-get-TrueColor cir1))

    ;; Message box with method and index
    (setq MethodText (vla-get-ColorMethod col))
    (alert (strcat "ColorMethod=" (itoa MethodText) "\nIndex=" (itoa (vla-get-ColorIndex col))))

    ;; Circle number two
    (setq cir2 (vla-AddCircle modelSpace pt 6))
    (vla-ZoomAll acadObj)
    (vla-Regen doc :vlax-true)

    (vla-put-ColorMethod col acColorMethodByBlock)

    ;; Message box with method and index
    (setq MethodText (vla-get-ColorMethod col))
    (alert (strcat "ColorMethod=" (itoa MethodText) "\nIndex=" (itoa (vla-get-ColorIndex col))))

    ;; Circle number three
    (setq cir3 (vla-AddCircle modelSpace pt 10))
    (vla-ZoomAll acadObj)
    (vla-Regen doc :vlax-true)

    (setq layColor (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB layColor 122 199 25)
    (vla-put-TrueColor (vla-get-ActiveLayer doc) layColor)

    (vla-put-ColorMethod col acColorMethodByLayer)

    (setq retCol (vla-get-TrueColor cir3))
    (vla-Regen doc :vlax-true)

    ;;Message box with method and index
    (setq MethodText (vla-get-ColorMethod col))
    (alert (strcat "ColorMethod=" (itoa MethodText) "\nIndex=" (itoa (vla-get-ColorIndex col))))

    (vlax-release-object col)
)


ColorName Property (ActiveX)

Specifies the name (if any) of the color.

Supported platforms: Windows only

Signature

VBA:

object.ColorName
object

Type: AcCmColor

The object this property applies to.

Property Value

Read-only: Yes

Type: String

The color name.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ColorName()
    'This example draws a circle and
    'returns the color name and color book name of the color.

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")

    col.SetRGB 125, 175, 235
    col.SetNames "MyColor", "MyColorBook"

    Dim cir As AcadCircle
    Dim pt(0 To 2) As Double
    Set cir = ThisDrawing.modelSpace.AddCircle(pt, 2)
    cir.TrueColor = col
    ZoomAll

    Dim retCol As AcadAcCmColor
    Set retCol = cir.TrueColor
    MsgBox "BookName=" & col.BookName & vbLf & _
           "ColorName=" & col.ColorName
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ColorName()
    ;; This example draws a circle and
    ;; returns the color name and color book name of the color.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 125 175 235)
    (vla-SetNames col "MyColor" "MyColorBook")

    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq cir (vla-AddCircle modelSpace pt 2))
    (vla-put-TrueColor cir col)
    (vla-ZoomAll acadObj)

    (setq retCol (vla-get-TrueColor cir))
    (alert (strcat "BookName=" (vla-get-BookName retCol)
                   "\nColorName=" (vla-get-ColorName retCol)))

    (vlax-release-object col)
)


ColorScheme Property (ActiveX)

Specifies the color scheme to display point cloud.

Supported platforms: Windows only

Signature

VBA:

object.ColorScheme
object

Type: PointCloudEx

The object this property applies to.

Property Value

Read-only: No

Type: String

The name of the color scheme to use for the point cloud.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Columns Property (ActiveX)

Specifies the number of columns in a block array or table.

Supported platforms: Windows only

Signature

VBA:

object.Columns
object

Type: MInsertBlock, Table

The object this property applies to.

Property Value

Read-only: No

Type: Long

The number of columns in the block array or table.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Columns()
    ' This example creates a new MInsertBlock in the current drawing and
    ' displays the column and row information for the new MInsertBlock

    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double, InsertPoint(0 To 2) As Double
    Dim radius As Double
    Dim newMBlock As AcadMInsertBlock
    Dim newBlock As AcadBlock

    ' Define the Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    InsertPoint(0) = 1: InsertPoint(1) = 1: InsertPoint(2) = 0
    radius = 0.5

    ' Create a new block to hold the Circle
    Set newBlock = ThisDrawing.Blocks.Add(centerPoint, "CBlock")

    ' Add the Circle object to the new block
    Set circleObj = ThisDrawing.Blocks("CBlock").AddCircle(centerPoint, radius)

    ' Create a rectangular array of Circles using the new block containing the Circle
    ' and the AddMInsertBlock method
    Set newMBlock = ThisDrawing.ModelSpace.AddMInsertBlock(InsertPoint, "CBlock", 1, 1, 1, 1, 2, 2, 1, 1)

    ThisDrawing.Application.ZoomAll

    ' Display information about the Columns and Rows defined by the MInsertBlock
    MsgBox "The new rectangular array comprises: " & vbCrLf & _
            newMBlock.Columns & " columns with a spacing of " & newMBlock.ColumnSpacing & " and" & vbCrLf & _
            newMBlock.Rows & " rows with a spacing of " & newMBlock.RowSpacing

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Columns()
    ;; This example creates a new MInsertBlock in the current drawing and
    ;; displays the column and row information for the new MInsertBlock
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Circle object
    (setq centerPoint (vlax-3d-point 0 0 0)
          InsertPoint (vlax-3d-point 1 1 0)
          radius 0.5)

    ;; Create a new block to hold the Circle
    (setq newBlock (vla-Add (vla-get-Blocks doc) centerPoint "CBlock"))

    ;; Add the Circle object to the new block
    (setq circleObj (vla-AddCircle newBlock centerPoint radius))

    ;; Create a rectangular array of Circles using the new block containing the Circle
    ;; and the AddMInsertBlock method
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq newMBlock (vla-AddMInsertBlock modelSpace InsertPoint "CBlock" 1 1 1 1 2 2 1 1))

    (vla-ZoomAll acadObj)

    ;; Display information about the Columns and Rows defined by the MInsertBlock
    (alert (strcat "The new rectangular array comprises: \n"
                   (itoa (vla-get-Columns newMBlock)) " columns with a spacing of " (rtos (vla-get-ColumnSpacing newMBlock) 2) " and\n"
                   (itoa (vla-get-Rows newMBlock)) " rows with a spacing of " (rtos (vla-get-RowSpacing newMBlock) 2) "."))
)


ColumnSpacing Property (ActiveX)

Specifies the spacing of the columns in a block array.

Supported platforms: Windows only

Signature

VBA:

object.ColumnSpacing
object

Type: MInsertBlock

The object this property applies to.

Property Value

Read-only: No

Type: Double

The spacing of the columns in the block array.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ColumnSpacing()
    ' This example creates a new MInsertBlock in the current drawing and
    ' displays the column and row information for the new MInsertBlock

    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double, InsertPoint(0 To 2) As Double
    Dim radius As Double
    Dim newMBlock As AcadMInsertBlock
    Dim newBlock As AcadBlock

    ' Define the Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    InsertPoint(0) = 1: InsertPoint(1) = 1: InsertPoint(2) = 0
    radius = 0.5

    ' Create a new block to hold the Circle
    Set newBlock = ThisDrawing.Blocks.Add(centerPoint, "CBlock")

    ' Add the Circle object to the new block
    Set circleObj = ThisDrawing.Blocks("CBlock").AddCircle(centerPoint, radius)

    ' Create a rectangular array of Circles using the new block containing the Circle
    ' and the AddMInsertBlock method
    Set newMBlock = ThisDrawing.ModelSpace.AddMInsertBlock(InsertPoint, "CBlock", 1, 1, 1, 1, 2, 2, 1, 1)

    ThisDrawing.Application.ZoomAll

    ' Display information about the Columns and Rows defined by the MInsertBlock
    MsgBox "The new rectangular array comprises: " & vbCrLf & _
            newMBlock.Columns & " columns with a spacing of " & newMBlock.ColumnSpacing & " and" & vbCrLf & _
            newMBlock.Rows & " rows with a spacing of " & newMBlock.RowSpacing

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ColumnSpacing()
    ;; This example creates a new MInsertBlock in the current drawing and
    ;; displays the column and row information for the new MInsertBlock
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Circle object
    (setq centerPoint (vlax-3d-point 0 0 0)
          InsertPoint (vlax-3d-point 1 1 0)
          radius 0.5)

    ;; Create a new block to hold the Circle
    (setq newBlock (vla-Add (vla-get-Blocks doc) centerPoint "CBlock"))

    ;; Add the Circle object to the new block
    (setq circleObj (vla-AddCircle newBlock centerPoint radius))

    ;; Create a rectangular array of Circles using the new block containing the Circle
    ;; and the AddMInsertBlock method
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq newMBlock (vla-AddMInsertBlock modelSpace InsertPoint "CBlock" 1 1 1 1 2 2 1 1))

    (vla-ZoomAll acadObj)

    ;; Display information about the Columns and Rows defined by the MInsertBlock
    (alert (strcat "The new rectangular array comprises: \n"
                   (itoa (vla-get-Columns newMBlock)) " columns with a spacing of " (rtos (vla-get-ColumnSpacing newMBlock) 2) " and\n"
                   (itoa (vla-get-Rows newMBlock)) " rows with a spacing of " (rtos (vla-get-RowSpacing newMBlock) 2) "."))
)


ColumnWidth Property (ActiveX)

Specifies the uniform width of all columns in the table.

Supported platforms: Windows only

Signature

VBA:

object.ColumnWidth
object

Type: Table

The object this property applies to.

Property Value

Read-only: No

Type: Double

Uniform width of all columns.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


CommandDisplayName Property (ActiveX)

Specifies the displayed command name for a button on the toolbar.

Supported platforms: Windows only

Signature

VBA:

object.CommandDisplayName
object

Type: ToolbarItem

The object this property applies to.

Property Value

Read-only: No

Type: String

The string for the command name.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CommandDisplayName()
    Dim currMenuGroup As AcadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    Dim newToolBar As AcadToolbar
    Set newToolBar = currMenuGroup.Toolbars.Add("TestNewToolbar")

    ' Add a button to the new toolbar.
    Dim newButton1 As IAcadToolbarItem
    Dim openMacro As String

    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set newButton1 = newToolBar.AddToolbarButton("", "NewButton1", "Open a file.", openMacro)

    ' Display the toolbar
    newToolBar.Visible = True

    newButton1.CommandDisplayName = "Open a File"

    ' Read the current value of the Help string
    MsgBox "The current CommandDisplayName for the toolbar button is: " & newButton1.CommandDisplayName

    ' Change the value of the CommandDisplayName
    newButton1.CommandDisplayName = "Open File"

    ' Read the new value of the CommandDisplayName
    MsgBox "The new CommandDisplayName for the toolbar button is: " & newButton1.CommandDisplayName
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CommandDisplayName()
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new toolbar
    (setq newToolBar (vla-Add (vla-get-Toolbars currMenuGroup) "TestToolbar"))

    ;; Assign the macro string the VB equivalent of "ESC ESC _open "
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))
    (setq newButton1 (vla-AddToolbarButton newToolBar "" "NewButton1" "Open a file." openMacro))

    ;; Display the toolbar
    (vla-put-Visible newToolBar :vlax-true)

    (vla-put-CommandDisplayName newButton1 "Open a File")

    ;; Read the current value of the Help string
    (alert (strcat "The current CommandDisplayName for the toolbar button is: " (vla-get-CommandDisplayName newButton1)))

    ;; Change the value of the CommandDisplayName
    (vla-put-CommandDisplayName newButton1 "Open File")

    ;; Read the new value of the CommandDisplayName
    (alert (strcat "The new CommandDisplayName for the toolbar button is: " (vla-get-CommandDisplayName newButton1)))
)


Comment Property (ActiveX)

Specifies the comment to be included with a digital signature.

Supported platforms: Windows only

Signature

VBA:

object.Comment
object

Type: SecurityParams

The object this property applies to.

Property Value

Read-only: No

Type: String

The comment to be included with a digital signature.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Comment()
    ' This example attaches a digital signature and accompanying data to a file,
    ' and saves the file.

    Dim sp As AcadSecurityParams
    Set sp = GetInterfaceObject("AutoCAD.SecurityParams.20")

    ' Attach a digital signature and timestamp it
    sp.Action = AcadSecurityParamsType.ACADSECURITYPARAMS_SIGN_DATA _
                + AcadSecurityParamsType.ACADSECURITYPARAMS_ADD_TIMESTAMP

    ' Certificate details follow
    sp.Subject = "Thawte Freemail Member"
    sp.Issuer = "Personal Freemail RSA 2000.8.30"
    sp.SerialNumber = "073848"
    sp.Comment = "This is now signed"
    sp.TimeServer = "NIST(time.nist.gov)"

    ThisDrawing.SaveAs "C:\MyDrawing.dwg", , sp
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Comment()
    ;; This example attaches a digital signature and accompanying data to a file,
    ;; and saves the file.
    (setq acadObj (vlax-get-acad-object))
    (setq sp (vlax-create-object "AutoCAD.SecurityParams.20"))

    (vla-put-Visible acadObj :vlax-true)

    ;; Attach a digital signature and timestamp it
    (vla-put-Action sp (+ ACADSECURITYPARAMS_SIGN_DATA ACADSECURITYPARAMS_ADD_TIMESTAMP))

    ;; Certificate details follow
    (vla-put-Subject sp "Thawte Freemail Member")
    (vla-put-Issuer sp "Personal Freemail RSA 2000.8.30")
    (vla-put-SerialNumber sp "073848")
    (vla-put-Comment sp "This is now signed")
    (vla-put-TimeServer sp "NIST(time.nist.gov)")

    (setq doc (vla-get-ActiveDocument acadObj))
    (vla-SaveAs doc "C:\\MyDrawing.dwg" acNative sp)

    (vlax-release-object sp)
)


Comments Property (ActiveX)

Specifies the comments for the block or drawing.

Supported platforms: Windows only

Signature

VBA:

object.Comments
object

Type: Block, SummaryInfo

The object this property applies to.

Property Value

Read-only: No

Type: String

The comment of a block or drawing.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Comments()
    ' This example shows how to access drawing properties

    ' Add and display standard properties
    ThisDrawing.SummaryInfo.Author = "John Doe"
    ThisDrawing.SummaryInfo.Comments = "Includes all ten levels of Building Five"
    ThisDrawing.SummaryInfo.HyperlinkBase = "http://www.autodesk.com"
    ThisDrawing.SummaryInfo.Keywords = "Building Complex"
    ThisDrawing.SummaryInfo.LastSavedBy = "JD"
    ThisDrawing.SummaryInfo.RevisionNumber = "4"
    ThisDrawing.SummaryInfo.Subject = "Plan for Building Five"
    ThisDrawing.SummaryInfo.Title = "Building Five"

    Author = ThisDrawing.SummaryInfo.Author
    Comments = ThisDrawing.SummaryInfo.Comments
    HLB = ThisDrawing.SummaryInfo.HyperlinkBase
    KW = ThisDrawing.SummaryInfo.Keywords
    LSB = ThisDrawing.SummaryInfo.LastSavedBy
    RN = ThisDrawing.SummaryInfo.RevisionNumber
    Subject = ThisDrawing.SummaryInfo.Subject
    Title = ThisDrawing.SummaryInfo.Title
    MsgBox "The standard drawing properties are " & vbCrLf & _
            "Author = " & Author & vbCrLf & _
            "Comments = " & Comments & vbCrLf & _
            "HyperlinkBase = " & HLB & vbCrLf & _
            "Keywords = " & KW & vbCrLf & _
            "LastSavedBy = " & LSB & vbCrLf & _
            "RevisionNumber = " & RN & vbCrLf & _
            "Subject = " & Subject & vbCrLf & _
            "Title = " & Title & vbCrLf

    ' Add and display custom properties
    Dim Key0 As String
    Dim Value0 As String
    Dim Key1 As String
    Dim Value1 As String
    Dim CustomPropertyBranch As String
    Dim PropertyBranchValue As String
    Dim CustomPropertyZone As String
    Dim PropertyZoneValue As String

    CustomPropertyBranch = "Branch"
    PropertyBranchValue = "Main"
    CustomPropertyZone = "Zone"
    PropertyZoneValue = "Industrial"

    ' Add custom properties
    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 1) Then
        ThisDrawing.SummaryInfo.SetCustomByIndex 0, CustomPropertyBranch, PropertyBranchValue
    Else
        ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyBranch, PropertyBranchValue
    End If

    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 2) Then
         ThisDrawing.SummaryInfo.SetCustomByKey CustomPropertyBranch, "Satellite"
    Else
         ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyZone, PropertyZoneValue
    End If

    'Get custom properties
    ThisDrawing.SummaryInfo.GetCustomByIndex 0, Key0, Value0
    Key1 = CustomPropertyZone
    ThisDrawing.SummaryInfo.GetCustomByKey Key1, Value1

    MsgBox "The custom drawing properties are " & vbCrLf & _
            "First property name = " & Key0 & vbCrLf & _
            "First property value = " & Value0 & vbCrLf & _
            "Second property name = " & Key1 & vbCrLf & _
            "Second property value = " & Value1 & vbCrLf
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Comments()
    ;; This example shows how to access drawing properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq summaryInfo (vla-get-SummaryInfo doc))

    ;; Add and display standard properties
    (vla-put-Author summaryInfo "John Doe")
    (vla-put-Comments summaryInfo "Includes all ten levels of Building Five")
    (vla-put-HyperlinkBase summaryInfo "http://www.autodesk.com")
    (vla-put-Keywords summaryInfo "Building Complex")
    (vla-put-LastSavedBy summaryInfo "JD")
    (vla-put-RevisionNumber summaryInfo "4")
    (vla-put-Subject summaryInfo "Plan for Building Five")
    (vla-put-Title summaryInfo "Building Five")

    (setq author (vla-get-Author summaryInfo))
    (setq comments (vla-get-Comments summaryInfo))
    (setq HLB (vla-get-HyperlinkBase summaryInfo))
    (setq KW (vla-get-Keywords summaryInfo))
    (setq LSB (vla-get-LastSavedBy summaryInfo))
    (setq RN (vla-get-RevisionNumber summaryInfo))
    (setq subject (vla-get-Subject summaryInfo))
    (setq Title (vla-get-Title summaryInfo))
    (alert (strcat "The standard drawing properties are "
                   "\nAuthor = " author
                   "\nComments = " comments
                   "\nHyperlinkBase = " HLB
                   "\nKeywords = " KW
                   "\nLastSavedBy = " LSB
                   "\nRevisionNumber = " RN
                   "\nSubject = " Subject
                   "\nTitle = " Title
           )
    )

    ;; Add and display custom properties
    (setq CustomPropertyBranch "Branch")
    (setq PropertyBranchValue "Main")
    (setq CustomPropertyZone "Zone")
    (setq PropertyZoneValue "Industrial")

    ;; Add custom properties
    (if (>= (vla-NumCustomInfo summaryInfo) 1)
        (vla-SetCustomByIndex summaryInfo 0 CustomPropertyBranch PropertyBranchValue)
        (vla-AddCustomInfo summaryInfo CustomPropertyBranch PropertyBranchValue)
    )

    (if (>= (vla-NumCustomInfo summaryInfo) 2)
        (vla-SetCustomByKey summaryInfo CustomPropertyBranch "Satellite")
        (vla-AddCustomInfo summaryInfo CustomPropertyZone PropertyZoneValue)
    )

    ;; Get custom properties
    (vla-GetCustomByIndex summaryInfo 0 'Key0 'Value0)
    (setq Key1 CustomPropertyZone)
    (vla-GetCustomByKey summaryInfo Key1 'Value1)

    (alert (strcat "The custom drawing properties are "
                   "\nFirst property name = " Key0
                   "\nFirst property value = " Value0
                   "\nSecond property name = " Key1
                   "\nSecond property value = " Value1
           )
    )
)


ConfigFile Property (ActiveX)

Gets the location of the configuration file used to store hardware device driver information.

Supported platforms: Windows only

Signature

VBA:

object.ConfigFile
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: Yes

Type: String

The location of the configuration file used to store hardware device driver information.

Remarks

This value is read-only and can only be changed using the /c command line switch. For more information about command line switches, see the AutoCAD Online help.

Examples

VBA:

Sub Example_ConfigFile()
    ' This example returns the current setting of ConfigFile.

    Dim preferences As AcadPreferences
    Dim currConfigFile As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current ConfigFile value
    currConfigFile = preferences.Files.ConfigFile
    If currConfigFile = "" Then
        MsgBox "ConfigFile is not currently set.", vbInformation, "ConfigFile Example"
    Else
        MsgBox "The current value for ConfigFile is " & currConfigFile, vbInformation, "ConfigFile Example"
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ConfigFile()
    ;; This example returns the current setting of ConfigFile.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current ConfigFile value
    (setq currConfigFile (vla-get-ConfigFile (vla-get-Files preferences)))
    (if (= currConfigFile "")
        (alert "ConfigFile is not currently set.")
        (alert (strcat "The current value for ConfigFile is " currConfigFile))
    )
)


ConfigName Property (ActiveX)

Specifies the plotter configuration name.

Supported platforms: Windows only

Signature

VBA:

object.ConfigName
object

Type: Layout, PlotConfiguration

The objects this property applies to.

Property Value

Read-only: No

Type: String

The name of the PC3 file or print device to be used by the layout or plot configuration.

Remarks

This property does not take a fully qualified path, only the file name for the configuration file. Use the PrinterConfigPath property to specify the path for printer configuration files.

Use the RefreshPlotDeviceInfo method before trying to change the ConfigName property.

Do not assign the ConfigName property a value of "None." Attempting to do so results in unexpected behavior.

Examples

VBA:

Sub Example_ConfigName()
    ' This example will add a new plot configuration to the current drawing.
    ' It will then list the plotter configuration file name for each Layout
    ' in the current drawing, change the configuration for Layout1 to "DWF Classic.pc3"
    ' and re-display the configuration information for the drawing.
    '
    ' * Note: File names may differ on your system, so be prepared to change
    ' the configuration file name used in the example to a file that exists
    ' on your system.

    Dim Layouts As AcadLayouts, Layout As ACADLayout
    Dim msg As String
    Dim ACADPref As AcadPreferencesFiles
    Dim originalValue As Variant

    ' Get the files preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Files

    ' Read and display the original value
    originalValue = ACADPref.PrinterConfigPath

    ' Get layouts collection from document object
    Set Layouts = ThisDrawing.Layouts

    ' Display current plotter configuration information
    GoSub DISPLAY_CONFIG

    ' Change plotter configuration file for "Layout1"
    Layouts("Layout1").ConfigName = "DWF6 ePlot.pc3"

    ' Display new plotter configuration information
    GoSub DISPLAY_CONFIG

    Exit Sub

DISPLAY_CONFIG:
    msg = vbCrLf & vbCrLf   ' Start with a space

    ' Format and display current directory for configuration files
    msg = msg & vbTab & "Directories that will be scanned for the plotter configuration files are: " _
                & vbCrLf & vbTab & vbTab & originalValue & vbCrLf & vbCrLf

    ' Get the plotter configuration name of every layout in this drawing
    For Each Layout In Layouts
        ' Format for display
        msg = msg & vbTab & Layout.name & " is using configuration: " & Layout.ConfigName & vbCrLf
    Next

    ' Display paper units information
    MsgBox "The plotter configuration information used in the current drawing is listed below." & msg

    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ConfigName()
    ;; This example will add a new plot configuration to the current drawing.
    ;; It will then list the plotter configuration file name for each Layout
    ;; in the current drawing, change the configuration for Layout1 to "DWF Classic.pc3"
    ;; and re-display the configuration information for the drawing.
    ;;
    ;; * Note: File names may differ on your system, so be prepared to change
    ;; the configuration file name used in the example to a file that exists
    ;; on your system.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get the files preferences object
    (setq ACADPref (vla-get-Files (vla-get-Preferences acadObj)))

    ;; Read and display the original value
    (setq originalValue (vla-get-PrinterConfigPath ACADPref))

    ;; Get layouts collection from document object
    (setq Layouts (vla-get-Layouts doc))

    ;; Format and display current directory for configuration files
    (setq msg "")
    (setq msg (strcat msg "Directories that will be scanned for the plotter configuration files are: \n"
                          originalValue "\n"))

    ;; Get the plotter configuration name of every layout in this drawing
    (vlax-for Layout Layouts
        (setq msg (strcat msg "\n" (vla-get-Name Layout) " is using configuration: " (vla-get-ConfigName Layout)))
    )

    ;; Display paper units information
    (alert (strcat "The plotter configuration information used in the current drawing is listed below.\n\n" msg))

    ;; Change plotter configuration file for "Layout1"
    (vla-put-ConfigName (vla-Item Layouts "Layout1") "DWF6 ePlot.pc3")

    ;; Display new plotter configuration information
    ;; Format and display current directory for configuration files
    (setq msg "")
    (setq msg (strcat msg "Directories that will be scanned for the plotter configuration files are: \n"
                          originalValue "\n"))

    ;; Get the plotter configuration name of every layout in this drawing
    (vlax-for Layout Layouts
        (setq msg (strcat msg "\n" (vla-get-Name Layout) " is using configuration: " (vla-get-ConfigName Layout)))
    )

    ;; Display paper units information
    (alert (strcat "The plotter configuration information used in the current drawing is listed below.\n\n" msg))
)


Constant Property (ActiveX)

Specifies whether the attribute or attribute reference is constant or not.

Supported platforms: Windows only

Signature

VBA:

object.Constant
object

Type: Attribute, AttributeReference

The objects this property applies to.

Property Value

Read-only: No, Attribute objects; Yes, AttributeReference objects

Type: Boolean

  • True: The attribute is a constant attribute.
  • False: The attribute is not a constant attribute.

Remarks

A constant attribute is one that maintains the same value in every occurrence. AutoCAD does not prompt for a value of constant attributes. An attribute can exist as only one of four optional modes: constant, preset, invisible, or verify.

NoteThe AFLAGS system variable stores the current mode settings. You can query the current mode using the Mode property.

Examples

VBA:

Sub Example_Constant()
    ' This example creates an attribute definition in model space.
    ' It then queries the attribute to see if it is a constant attribute.

    Dim attributeObj As AcadAttribute
    Dim height As Double
    Dim mode As Long
    Dim prompt As String
    Dim insertionPoint(0 To 2) As Double
    Dim tag As String
    Dim value As String

    ' Define the attribute definition
    height = 1#
    mode = acAttributeModeVerify
    prompt = "New Prompt"
    insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0
    tag = "New_Tag"
    value = "New Value"

    ' Create the attribute definition object in model space
    Set attributeObj = ThisDrawing.ModelSpace.AddAttribute(height, mode, prompt, insertionPoint, tag, value)
    ZoomAll

    ' Query the attribute
    GoSub QUERYSTATUS

    ' Change the attribute
    attributeObj.constant = Not attributeObj.constant
    GoSub QUERYSTATUS

    Exit Sub

QUERYSTATUS:
    If attributeObj.constant Then
        MsgBox "The attribute is a constant attribute."
    Else
        MsgBox "The attribute is not a constant attribute."
    End If
    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Constant()
    ;; This example creates an attribute definition in model space.
    ;; It then queries the attribute to see if it is a constant attribute.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the attribute definition
    (setq insertionPoint (vlax-3d-point 5 5 0)
          attHeight 1
          attMode acAttributeModeVerify
          attPrompt "New Prompt"
          attTag "New_Tag"
          attValue "New Value")

    ;; Create the attribute definition object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq attributeObj (vla-AddAttribute modelSpace attHeight attMode attPrompt insertionPoint attTag attValue))
    (vla-ZoomAll acadObj)

    ;; Query the attribute
    (if (= (vla-get-Constant attributeObj) :vlax-true)
        (alert "The attribute is a constant attribute.")
        (alert "The attribute is not a constant attribute.")
    )

    ;; Change the attribute
    (vla-put-Constant attributeObj (if (= (vla-get-Constant attributeObj) :vlax-true) :vlax-false :vlax-true))

    (if (= (vla-get-Constant attributeObj) :vlax-true)
        (alert "The attribute is a constant attribute.")
        (alert "The attribute is not a constant attribute.")
    )
)


ConstantWidth Property (ActiveX)

Specifies a global width for all segments in a polyline.

Supported platforms: Windows only

Signature

VBA:

object.ConstantWidth
object

Type: LWPolyline, Polyline

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The global width for all segments in the object.

Remarks

This property sets the start and end widths for all segments in a polyline to a uniform value. This property will return a constant width only if all the segments are set to a uniform width.

Use the SetWidth and GetWidth methods to specify the width of an individual segment.

Examples

VBA:

Sub Example_ConstantWidth()
    ' This example creates a lightweight polyline in model space and
    ' uses the ConstantWidth property to determine if the polyline comprises
    ' equal width segments.  If the segments are not equal,
    ' use the ConstantWidth property to set all the segments to the same
    ' width.

    Dim plineObj As AcadLWPolyline
    Dim points(0 To 9) As Double
    Dim msg As String, CWidth As Double

    ' Define the 2D polyline points
    points(0) = 1: points(1) = 1
    points(2) = 1: points(3) = 2
    points(4) = 2: points(5) = 2
    points(6) = 3: points(7) = 2
    points(8) = 4: points(9) = 4

    ' Create a lightweight Polyline object in model space
    '
    ' * Note: Return the new PolyLine object into a Module
    ' level variable, which allows events associated
    ' with that particular object to be intercepted.
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    ThisDrawing.Application.ZoomAll

    ' Display segment information before altering the width of segment 1
    GoSub DISPLAYSEGMENTS

    ' Set the first segment width
    plineObj.SetWidth 1, 0.1, 0.3
    ThisDrawing.Regen acAllViewports

    ' Display segment information after altering the width of segment 1
    GoSub DISPLAYSEGMENTS

    ' Make all segments uniform in width
    plineObj.ConstantWidth = 0.1
    ThisDrawing.Regen acAllViewports

    ' Display segment information after making the segments uniform
    GoSub DISPLAYSEGMENTS

    Exit Sub

DISPLAYSEGMENTS:
    On Error Resume Next

    ' Check to see if the segment widths are uniform
    CWidth = plineObj.ConstantWidth

    ' If ConstantWidth returns an error, the
    ' segments are not all the same width
    If Err.Description = "Invalid input" Then
        msg = " are not equal."
    Else
        msg = " are all equal."
    End If
    On Error GoTo 0

    MsgBox "The segments of the new polyline" & msg

    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ConstantWidth()
    ;; This example creates a lightweight polyline in model space and
    ;; uses the ConstantWidth property to determine if the polyline comprises
    ;; equal width segments.  If the segments are not equal,
    ;; use the ConstantWidth property to set all the segments to the same
    ;; width.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the 2D polyline points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 9)))
    (vlax-safearray-fill points '(1 1
                  1 2
                  2 2
                  3 2
                  4 4
                 )
    )

    ;; Create a lightweight Polyline object in model space
    ;;
    ;; * Note: Return the new PolyLine object into a Module
    ;; level variable, which allows events associated
    ;; with that particular object to be intercepted.
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-ZoomAll acadObj)

    ;; Display segment information before altering the width of segment 1
    ;; Check to see if the segment widths are uniform
    (setq err (vl-catch-all-apply 'vla-get-ConstantWidth (list plineObj)))
    (if (vl-catch-all-error-p err)
        (setq msg " are not equal.")
        (setq msg " are all equal."
          CWidth err)
    )

    (alert (strcat "The segments of the new polyline" msg))

    ;; Set the first segment width
    (vla-SetWidth plineObj 1 0.1 0.3)
    (vla-Regen doc acAllViewports)

    ;; Display segment information after altering the width of segment 1
    ;; Check to see if the segment widths are uniform
    (setq err (vl-catch-all-apply 'vla-get-ConstantWidth (list plineObj)))
    (if (vl-catch-all-error-p err)
        (setq msg " are not equal.")
        (setq msg " are all equal."
          CWidth err)
    )

    (alert (strcat "The segments of the new polyline" msg))

    ;; Make all segments uniform in width
    (vla-put-ConstantWidth plineObj 0.1)
    (vla-Regen doc acAllViewports)

    ;; Display segment information after making the segments uniform
    ;; Check to see if the segment widths are uniform
    (setq err (vl-catch-all-apply 'vla-get-ConstantWidth (list plineObj)))
    (if (vl-catch-all-error-p err)
        (setq msg " are not equal.")
        (setq msg " are all equal."
          CWidth err)
    )

    (alert (strcat "The segments of the new polyline" msg))
)


Constrain Property (ActiveX)

Controls which property is constrained when editing other property values.

Supported platforms: Windows only

Signature

VBA:

object.Constrain
object

Type: Helix

The object to which this property applies.

Property Value

Read-only: No

Type: acHelixConstrainType enum

  • acHeight
  • acTurnHeight
  • acTurns

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Helix_BaseRadius()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.BaseRadius = helix.BaseRadius * 2
            MsgBox "Baseradius of helix is doubled to " & helix.BaseRadius * 2
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_TopRadius()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.TopRadius = helix.TopRadius * 0.5
            MsgBox "Top radius of helix is halved to " & helix.TopRadius * 0.5
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Direction()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            If helix.Twist = acCCW Then
                helix.Twist = acCW
            Else
                helix.Twist = acCCW
            End If
            MsgBox "Direction is reversed"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Height()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acHeight
            helix.height = helix.height * 2
            MsgBox "Height doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Turns()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acTurns
            helix.Turns = helix.Turns * 2
            MsgBox "Turns doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_TurnHeight()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acTurnHeight
            helix.TurnHeight = helix.TurnHeight * 2
            MsgBox "Turns height doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Helix_BaseRadius()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-BaseRadius helix (* (vla-get-BaseRadius helix) 2))
                (alert (strcat "Baseradius of helix is doubled to " (rtos (vla-get-BaseRadius helix) 2)))
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_TopRadius()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-TopRadius helix (* (vla-get-TopRadius helix) 0.5))
                (alert (strcat "Top radius of helix is halved to " (rtos (vla-get-TopRadius helix) 2)))
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Direction()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
            (if (= (vla-get-Twist helix) acCCW)
                (vla-put-Twist helix acCW)
                (vla-put-Twist helix acCCW)
            )
                (alert "Direction is reversed")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Height()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acHeight)
                (vla-put-Height helix (* (vla-get-Height helix) 2))
                (alert "Height doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Turns()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acTurns)
                (vla-put-Turns helix (* (vla-get-Turns helix) 2))
                (alert "Turns doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_TurnHeight()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acTurnHeight)
                (vla-put-TurnHeight helix (* (vla-get-TurnHeight helix) 2))
                (alert "Turns height doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)


ContentBlockName Property (ActiveX)

The name of the content block.

Supported platforms: Windows only

Signature

VBA:

object.ContentBlockName
object

Type: MLeader

The object this property applies to.

Property Value

Read-only: No

Type: String

A string which contains the name of the content block.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_LeaderLine()
    Dim oML As AcadMLeader
    Dim points(0 To 5) As Double
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 4: points(4) = 4: points(5) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    Dim r As Long
    r = oML.AddLeader()

    points(4) = 10
    Call oML.AddLeaderLine(r, points)

    MsgBox "LeaderCount = " & oML.LeaderCount
    ZoomExtents
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LeaderLine()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(1 1 0
                                  4 4 0
                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (setq r (vla-AddLeader oML))

    (vlax-safearray-put-element points 4 10)
    (vla-AddLeaderLine oML r points)

    (alert (strcat "LeaderCount = " (itoa (vla-get-LeaderCount oML))))
    (vla-ZoomExtents acadObj)
)


ContentBlockType Property (ActiveX)

The type of the content block.

Supported platforms: Windows only

Signature

VBA:

object.ContentBlockType
object

Type: MLeader

The object this property applies to.

Property Value

Read-only: No

Type: acPredefBlockType enum

  • acBlockBox
  • acBlockCircle
  • acBlockHexagon
  • acBlockImperial
  • acBlockSlot
  • acBlockTriangle
  • acBlockUserDefined

A type of content block.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_LeaderLine()
    Dim oML As AcadMLeader
    Dim points(0 To 5) As Double
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 4: points(4) = 4: points(5) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    Dim r As Long
    r = oML.AddLeader()

    points(4) = 10
    Call oML.AddLeaderLine(r, points)

    MsgBox "LeaderCount = " & oML.LeaderCount
    ZoomExtents
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LeaderLine()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(1 1 0
                                  4 4 0
                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (setq r (vla-AddLeader oML))

    (vlax-safearray-put-element points 4 10)
    (vla-AddLeaderLine oML r points)

    (alert (strcat "LeaderCount = " (itoa (vla-get-LeaderCount oML))))
    (vla-ZoomExtents acadObj)
)


ContentType Property (ActiveX)

Specifies the content type.

Supported platforms: Windows only

Signature

VBA:

object.ContentType
object

Type: MLeader, MLeaderStyle

The objects this property applies to.

Property Value

Read-only: No

Type: acMLeaderContentType enum

  • acBlockContent
  • acMTextContent
  • acNoneContent

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ContinuousPlotLog Property (ActiveX)

Specifies whether to save a continuous Plot log.

Supported platforms: Windows only

Signature

VBA:

object.ContinuousPlotLog
object

Type: PreferencesOutput

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Writes to a single plot log file for all plotting activity.
  • False: Writes to a unique plot log for each plotting activity.

Remarks

This property is equivalent to the AutoCAD Options dialog box settings "Save One Continuous Plot Log" and "Save One Log Per Plot."

Examples

VBA:

Sub Example_ContinuousPlotLog()
    ' This example changes the AutoCAD Options dialog box
    ' to specify one log per plot.

    Dim MyPreference As AcadPreferencesOutput
    Set MyPreference = AcadApplication.preferences.Output
    MyPreference.ContinuousPlotLog = False

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ContinuousPlotLog()
    ;; This example changes the AutoCAD Options dialog box
    ;; to specify one log per plot.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    (setq MyPreference (vla-get-Output preferences))
    (vla-put-ContinuousPlotLog MyPreference :vlax-false)
)


ContourLinesPerSurface Property (ActiveX)

Specifies the number of contour lines (isolines) per surface on objects.

Supported platforms: Windows only

Signature

VBA:

object.ContourLinesPerSurface
object

Type: DatabasePreferences

The object this property applies to.

Property Value

Read-only: No

Type: Integer

The valid range is 0 to 2047.

Remarks

The initial value for this property is 4.

A torus with ContourLinesPerSurface set to 4

A torus with ContourLinesPerSurface set to 20

NoteThe value of this property is stored in the ISOLINES system variable.

Examples

VBA:

Sub Example_ContourLinesPerSurface()
    ' This example returns the current setting of
    ' ContourLinesPerSurface. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim currContourLinesPerSurface As Integer
    Dim newContourLinesPerSurface As Integer

    ' Retrieve the current ContourLinesPerSurface value
    currContourLinesPerSurface = ThisDrawing.preferences.ContourLinesPerSurface
    MsgBox "The current value for ContourLinesPerSurface is " & currContourLinesPerSurface, vbInformation, "ContourLinesPerSurface Example"

    ' Change the value for ContourLinesPerSurface
    newContourLinesPerSurface = 2001
    ThisDrawing.preferences.ContourLinesPerSurface = newContourLinesPerSurface
    MsgBox "The new value for ContourLinesPerSurface is " & newContourLinesPerSurface, vbInformation, "ContourLinesPerSurface Example"

    ' Reset ContourLinesPerSurface to its original value
    ThisDrawing.preferences.ContourLinesPerSurface = currContourLinesPerSurface
    MsgBox "The ContourLinesPerSurface value is reset to " & currContourLinesPerSurface, vbInformation, "ContourLinesPerSurface Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ContourLinesPerSurface()
    ;; This example returns the current setting of
    ;; ContourLinesPerSurface. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences doc))

    ;; Retrieve the current ContourLinesPerSurface value
    (setq currContourLinesPerSurface (vla-get-ContourLinesPerSurface preferences))
    (alert (strcat "The current value for ContourLinesPerSurface is " (itoa currContourLinesPerSurface)))

    ;; Change the value for ContourLinesPerSurface
    (setq newContourLinesPerSurface 2001)
    (vla-put-ContourLinesPerSurface preferences newContourLinesPerSurface)
    (alert (strcat "The new value for ContourLinesPerSurface is " (itoa newContourLinesPerSurface)))

    ;; Reset ContourLinesPerSurface to its original value
    (vla-put-ContourLinesPerSurface preferences currContourLinesPerSurface)
    (alert (strcat "The ContourLinesPerSurface value is reset to " (itoa currContourLinesPerSurface)))
)


Contrast Property (ActiveX)

Specifies the current contrast value of an image or underlay.

Supported platforms: Windows only

Signature

VBA:

object.Contrast
object

Type: DgnUnderlay, DwfUnderlay, GeomapImage, PdfUnderlay, RasterImage, Wipeout

The objects this property applies to.

Property Value

Read-only: No

Type: Integer

The valid range is 0 to 100 inclusive. The default is 50.

Remarks

You can adjust the image brightness, contrast, and fade to the display of the image as well as to the plotted output without affecting the original raster image or underlay file. Adjust brightness to darken or lighten an image. Adjust contrast to make images that have poor quality easier to read. Adjust fade to make vectors easier to see over images, and to create a watermark effect in your plotted output.

NoteBitonal images cannot be adjusted for brightness, contrast, or fade.

Examples

VBA:

Sub Example_Contrast()
    ' This example inserts a raster image and finds the current
    ' Contrast of the image. It then changes the Contrast
    ' of the image.

    ' This example uses the "2d Projected Polylines.jpg" found in the Sample
    ' directory. If you do not have the image, or if it is located
    ' in a different directory, insert a valid path and name for the
    ' imageName variable below.
    Dim insertionPoint(0 To 2) As Double
    Dim scalefactor As Double
    Dim rotAngleInDegree As Double
    Dim rotAngle As Double
    Dim imageName As String
    Dim raster As AcadRasterImage
    imageName = "C:\AutoCAD\sample\2d Projected Polylines.jpg"
    insertionPoint(0) = 2#: insertionPoint(1) = 2#: insertionPoint(2) = 0#
    scalefactor = 1#
    rotAngleInDegree = 0#
    rotAngle = rotAngleInDegree * 3.141592 / 180#

    On Error Resume Next

    ' Creates a raster image in model space
    Set raster = ThisDrawing.modelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotAngle)
    If Err.Description = "File error" Then
        MsgBox imageName & " could not be found."
        Exit Sub
    End If

    ' Find the current Contrast
    ThisDrawing.Regen True
    MsgBox "The Contrast is currently set to: " & raster.Contrast, vbInformation

    ' Change the Contrast to 5
    raster.Contrast = 5
    ThisDrawing.Regen True
    MsgBox "The Contrast is now set to: " & raster.Contrast, vbInformation
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Contrast()
    ;; This example inserts a raster image and finds the current
    ;; Contrast of the image. It then changes the Contrast
    ;; of the image.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; This example uses the "2d Projected Polylines.jpg" found in the Sample
    ;; directory. If you do not have the image, or if it is located
    ;; in a different directory, insert a valid path and name for the
    ;; imageName variable below.
    (setq insertionPoint (vlax-3d-point 2 2 0)
          imageName ".\\Sample\\VBA\\2d Projected Polylines.jpg"
          scalefactor 1
          rotAngleInDegree 0
          rotAngle (/ (* rotAngleInDegree 3.141592) 180))

    (if (/= (findfile ".\\Sample\\VBA\\2d Projected Polylines.jpg") nil)
        (progn
            ;; Creates a raster image in model space
            (setq modelSpace (vla-get-ModelSpace doc))
            (setq raster (vla-AddRaster modelSpace (findfile ".\\Sample\\VBA\\2d Projected Polylines.jpg") insertionPoint scalefactor rotAngle))
            (vla-ZoomExtents acadObj)

            ;; Find the current contrast
            (vla-Regen doc :vlax-true)
            (alert (strcat "The Contrast is currently set to: " (rtos (vla-get-Contrast raster) 2)))

            ;; Change the contrast to 5
            (vla-put-Contrast raster 5)
            (vla-Regen doc :vlax-true)
            (alert (strcat "The Contrast is now set to: " (rtos (vla-get-Contrast raster) 2)))
    )
        (alert (strcat imageName " could not be found."))
    )
)


ControlPoints Property (ActiveX)

Specifies the control points of a spline.

Supported platforms: Windows only

Signature

VBA:

object.ControlPoints
object

Type: Spline

The object this property applies to.

Property Value

Read-only: No

Type: Variant (array of doubles)

An array of 3D WCS control points for the spline.

Remarks

You can find out how many control points a spline has by using the NumberOfControlPoints property.

Examples

VBA:

Sub Example_ControlPoints()
    ' This example creates a Spline object in model space, reads the control points
    ' of the Spline and then modifies the control points of the Spline.

    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double, endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double
    Dim UserMessage As String
    Dim ControlPoints As Variant
    Dim iCount As Long, iPoint As Integer

    ' Define the Spline object
    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 0: fitPoints(1) = 0: fitPoints(2) = 0
    fitPoints(3) = 5:   fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0

    ' Create new Spline object
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ThisDrawing.Application.ZoomAll

    ' Display control points for this Spline
    GoSub DISPLAYPOINTS

    ' Modify control points for this Spline
    ControlPoints(0) = 3
    splineObj.ControlPoints = ControlPoints
    ThisDrawing.Application.ZoomAll

    ' Display new control points for this Spline
    GoSub DISPLAYPOINTS

    Exit Sub

DISPLAYPOINTS:
    ControlPoints = splineObj.ControlPoints

    ' Display in groups of three
    UserMessage = ""
    iPoint = 0
    For iCount = 0 To UBound(ControlPoints) Step 3
        iPoint = iPoint + 1
        UserMessage = UserMessage & iPoint & ")" & vbTab
        UserMessage = UserMessage & ControlPoints(iCount)
        UserMessage = UserMessage & ", " & ControlPoints(iCount + 1)
        UserMessage = UserMessage & ", " & ControlPoints(iCount + 2)
        UserMessage = UserMessage & vbCrLf
    Next

    MsgBox "The " & splineObj.NumberOfControlPoints & " Spline control points are: " & vbCrLf & vbCrLf & UserMessage

    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ControlPoints()
    ;; This example creates a Spline object in model space, reads the control points
    ;; of the Spline and then modifies the control points of the Spline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Spline object
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(0 0 0
                     5 5 0
                     10 0 0
                    )
    )

    ;; Create new Spline object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)

    ;; Display control points for this Spline
    (setq ControlPoints (vlax-variant-value (vla-get-ControlPoints splineObj)))

    ;; Display in groups of three
    (setq UserMessage ""
          iPoint 0
      iCount 0)

    (while (>= (vlax-safearray-get-u-bound ControlPoints 1) iCount)
        (setq iPoint (1+ iPoint))
        (setq UserMessage (strcat UserMessage (itoa iPoint) ")  "
                                  (rtos (nth iCount (vlax-safearray->list ControlPoints)) 2) ", "
                                  (rtos (nth (+ iCount 1) (vlax-safearray->list ControlPoints)) 2) ", "
                                  (rtos (nth (+ iCount 2) (vlax-safearray->list ControlPoints)) 2) "\n"
                  )
    )

        (setq iCount (+ iCount 3))
    )

    (alert (strcat "The " (itoa (vla-get-NumberOfControlPoints splineObj)) " Spline control points are: " "\n\n" UserMessage))

    ;; Modify control points for this Spline
    (setq newFitPoint (vlax-3d-point 8 2 0))

    (vla-AddFitPoint splineObj 3 newFitPoint)
    (setq ControlPoints (vlax-variant-value (vla-get-ControlPoints splineObj)))
    (vla-ZoomAll acadObj)

    ;; Display new control points for this Spline
    (setq UserMessage ""
          iPoint 0
      iCount 0)

    (while (>= (vlax-safearray-get-u-bound ControlPoints 1) iCount)
        (setq iPoint (1+ iPoint))
        (setq UserMessage (strcat UserMessage (itoa iPoint) ")  "
                                  (rtos (nth iCount (vlax-safearray->list ControlPoints)) 2) ", "
                                  (rtos (nth (+ iCount 1) (vlax-safearray->list ControlPoints)) 2) ", "
                                  (rtos (nth (+ iCount 2) (vlax-safearray->list ControlPoints)) 2) "\n"
                  )
    )

        (setq iCount (+ iCount 3))
    )

    (alert (strcat "The " (itoa (vla-get-NumberOfControlPoints splineObj)) " Spline control points are: " "\n\n" UserMessage))
)


Coordinate Property (ActiveX)

Specifies the coordinate of a single vertex in the object.

Supported platforms: Windows only

Signature

VBA:

object.Coordinate(index)
object

Type: 3DFace, 3DPoly, Leader, LWPolyline, PolyfaceMesh, PolygonMesh, Polyline, Section, Solid, SubDMesh, Trace

The objects this property applies to.

index

Type: Integer

The index in the array of vertices for the vertex you want to set or query. The vertex arrays are 0 based.

Property Value

Read-only: No

Type: Variant (three-element or two-element array of doubles)

The array of X, Y, and Z coordinates for the specified vertex.

LightweightPolyline object: The variant has two elements representing the X and Y coordinates in OCS.

Polyline object: The variant has three elements, representing the X and Y coordinates in OCS. The Z coordinate is present in the variant but ignored.

All other objects: The variant has three elements, representing the X and Y coordinates in WCS; the Z coordinate will default to 0 on the active UCS.

Remarks

This property will replace any existing vertices for the specified object. Use standard array-handling techniques to process the values contained in this property.

3DPolyline, Polyline, PolygonMesh: For simple polylines (not splined or curve fit), this property specifies simple vertices. For splined or curve-fit polylines, this property specifies control point vertices.

The OCS coordinates for the Polyline and LightweightPolyline objects can be converted to and from other coordinate systems using the TranslateCoordinates method.

Examples

VBA:

Sub Example_Coordinate()
    ' This example creates a polyline in model space and
    ' queries and changes the coordinate in the first index position.

    Dim plineObj As AcadPolyline
    Dim points(0 To 14) As Double

    ' Define the 2D polyline points
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 1: points(4) = 2: points(5) = 0
    points(6) = 2: points(7) = 2: points(8) = 0
    points(9) = 3: points(10) = 2: points(11) = 0
    points(12) = 4: points(13) = 4: points(14) = 0

    ' Create a lightweight Polyline object in model space
    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
    ZoomAll

    ' Find the coordinate in the first index position
    Dim coord As Variant
    coord = plineObj.Coordinate(0)
    MsgBox "The coordinate in the first index position of the polyline is: " & coord(0) & ", " _
        & coord(1) & ", " & coord(2)

    ' Change the coordinate
    coord(0) = coord(0) + 1
    plineObj.Coordinate(0) = coord
    plineObj.Update

    ' Query the new coordinate
    coord = plineObj.Coordinate(0)
    MsgBox "The coordinate in the first index position of the polyline is now: " & coord(0) & ", " _
        & coord(1) & ", " & coord(2)

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Coordinate()
    ;; This example creates a polyline in model space and
    ;; queries and changes the coordinate in the first index position.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the 2D polyline points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill points '(1 1 0
                  1 2 0
                  2 2 0
                  3 2 0
                  4 4 0
                 )
    )

    ;; Create a lightweight Polyline object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddPolyline modelSpace points))
    (vla-ZoomAll acadObj)

    ;; Find the coordinate in the first index position
    (setq coord (vlax-safearray->list (vlax-variant-value (vla-get-Coordinate plineObj 0))))
    (alert (strcat "The coordinate in the first index position of the polyline is: "
           (rtos (nth 0 coord) 2) ", " (rtos (nth 1 coord) 2) ", " (rtos (nth 2 coord) 2)))

    ;; Change the coordinate
    (setq newCoord (vlax-make-safearray vlax-vbDouble '(0 . 2)))
    (vlax-safearray-fill newCoord (list (+ (nth 0 coord) 1)
                        (nth 1 coord)
                        (nth 2 coord)))

    (vla-put-Coordinate plineObj 0 newCoord)
    (vla-Update plineObj)

    ; Query the new coordinate
    (setq coord (vlax-safearray->list (vlax-variant-value (vla-get-Coordinate plineObj 0))))
    (alert (strcat "The coordinate in the first index position of the polyline is now: "
           (rtos (nth 0 coord) 2) ", " (rtos (nth 1 coord) 2) ", " (rtos (nth 2 coord) 2)))
)


Coordinates Property (ActiveX)

Specifies the coordinates for each vertex in the object.

Supported platforms: Windows only

Signature

VBA:

object.Coordinates
object

Type: 3DFace, 3DPolyline , Leader, LWPolyline, MLine, Point, PolyfaceMesh, PolygonMesh, Polyline, Solid, SubDMesh, SubDMeshVertex, Trace

The objects this property applies to.

Property Value

Read-only: No

Type: Variant (array of doubles)

The array of points.

LightweightPolyline objects: The variant is an array of 2D points in OCS.

Polyline objects: The variant is an array of 3D points: the X and Y coordinates are in OCS; the Z coordinate is ignored.

All other objects: The variant is an array of 3D points in WCS.

Remarks

This property will replace any existing coordinates for the specified object. Use standard array-handling techniques to process the coordinates contained in this property.

You cannot change the number of coordinates in the object by using this property. You can change only the location of existing coordinates.

For the following objects, the Z coordinate will always default to 0 on the active UCS: 3DFace, Leader, MLine, PolyfaceMesh, and Trace.

3DPolyline, Polyline, PolygonMesh: For simple polylines (not splined or curve fit), this property specifies simple vertices. For splined or curve-fit polylines, this property specifies control point vertices.

When setting the coordinates for a polyline, if you supply fewer coordinates than the object currently possesses, the polyline will be truncated. Any fit points applying to the truncated vertices will also be truncated. If you supply more coordinates than the object currently possesses, the extra vertices will be appended to the polyline.

The OCS coordinates for the Polyline and LightweightPolyline objects can be converted to and from other coordinate systems using the TranslateCoordinates method.

Examples

VBA:

Sub Example_Coordinates()
    ' This example creates a polyline. It then uses the Coordinates
    ' property to return all the coordinates  in the polyline. It then
    ' resets one of the vertices using the Coordinates property.

    Dim plineObj As AcadPolyline

    ' Create Polyline
    Dim points(5) As Double
    points(0) = 3: points(1) = 7: points(2) = 0
    points(3) = 9: points(4) = 2: points(5) = 0
    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
    ThisDrawing.Regen True

    ' Return all the coordinates of the polyline
    Dim retCoord As Variant
    retCoord = plineObj.Coordinates

    ' Display current coordinates for the second vertex
    MsgBox "The current coordinates of the second vertex are: " & points(3) & ", " & points(4) & ", " & points(5), vbInformation, "Coordinates Example"

    ' Modify the coordinate of the second vertex to (5,5,0). Note that in
    ' case of a lightweight Polyline, indices will be different because the points are 2D only.
    points(3) = 5
    points(4) = 5
    points(5) = 0
    plineObj.Coordinates = points

    ' Update display
    ThisDrawing.Regen True

    MsgBox "The new coordinates have been set to " & points(3) & ", " & points(4) & ", " & points(5), vbInformation, "Coordinates Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Coordinates()
    ;; This example creates a polyline. It then uses the Coordinates
    ;; property to return all the coordinates  in the polyline. It then
    ;; resets one of the vertices using the Coordinates property.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create Polyline
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7 0
                  9 2 0
                 )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddPolyline modelSpace points))
    (vla-ZoomAll acadObj)

    ;; Return all the coordinates of the polyline
    (setq retCoord (vla-get-Coordinates plineObj))

    ;; Display current coordinates for the second vertex
    (alert (strcat "The current coordinates of the second vertex are: " (rtos (vlax-safearray-get-element points 3) 2) ", "
                                                                (rtos (vlax-safearray-get-element points 4) 2) ", "
                                                                (rtos (vlax-safearray-get-element points 5) 2)))

    ;; Modify the coordinate of the second vertex to (5,5,0). Note that in
    ;; case of a lightweight Polyline, indices will be different because the points are 2D only.
    (vlax-safearray-put-element points 3 5)
    (vlax-safearray-put-element points 4 5)
    (vlax-safearray-put-element points 5 0)
    (vla-put-Coordinates plineObj points)

    ;; Update display
    (vla-Regen doc :vlax-true)

    (alert (strcat "The new coordinates have been set to: " (rtos (vlax-safearray-get-element points 3) 2) ", "
                                                    (rtos (vlax-safearray-get-element points 4) 2) ", "
                                                    (rtos (vlax-safearray-get-element points 5) 2)))
)


Count Property (ActiveX)

Gets the number of items in the object.

Supported platforms: Windows only

Signature

VBA:

object.Count
object

Type: All Collections, Block, Dictionary, Group, Materials, SectionManager, SelectionSet

The object this property applies to.

Property Value

Read-only: Yes

Type: Integer

The number of items in the object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Count()
    ' Use count to retrieve the number of objects in a collection
    ' You might use this value in a loop structure to iterate through the collection

    MsgBox "There are " & ThisDrawing.Layers.Count & " layer(s) in the drawing."
    MsgBox "There are " & ThisDrawing.ModelSpace.Count & " object(s) in ModelSpace."

    Dim objCount As Integer
    Dim I As Integer
    objCount = ThisDrawing.ModelSpace.Count

    Dim mspaceObj As AcadObject
    For I = 0 To objCount - 1
        Set mspaceObj = ThisDrawing.modelSpace.Item(I)
        MsgBox "The objects in ModelSpace include: " & mspaceObj.ObjectName, vbInformation, "Count Example"
    Next

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Count()
    ;; Use count to retrieve the number of objects in a collection
    ;; You might use this value in a loop structure to iterate through the collection
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (alert (strcat "There are " (itoa (vla-get-Count (vla-get-Layers doc))) " layer(s) in the drawing."))
    (alert (strcat "There are " (itoa (vla-get-Count (vla-get-ModelSpace doc))) " object(s) in ModelSpace."))

    (setq I 0
      objCount (vla-get-Count (vla-get-ModelSpace doc)))

    (while (>= (- objCount 1) I)
        (setq mspaceObj (vla-Item (vla-get-ModelSpace doc) I)
          I (1+ I))
        (alert (strcat "The objects in ModelSpace include: " (vla-get-ObjectName mspaceObj)))
    )
)


CreaseLevel Property (ActiveX)

Specifies the crease level for the subentity of the SubD mesh.

Supported platforms: Windows only

Signature

VBA:

object.CreaseLevel
object

Type: SubDMeshEdge, SubDMeshFace, SubDMeshVertex

The objects this property applies to.

Property Value

Read-only: No

Type: Double

Level of crease for the subentity.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


CreaseType Property (ActiveX)

Specifies the crease type to apply to the subentity of a SubD mesh.

Supported platforms: Windows only

Signature

VBA:

object.CreaseType
object

Type: SubDMeshEdge, SubDMeshFace, SubDMeshVertex

The object this property applies to.

Property Value

Read-only: No

Type: AcMeshCreaseType enum

  • acNoneCrease
  • acAlwaysCrease
  • acCreaseByLevel

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


CreateBackup Property (ActiveX)

Specifies the use of a backup file.

Supported platforms: Windows only

Signature

VBA:

object.CreateBackup
object

Type: PreferencesOpenSave

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: A backup file is created.
  • False: No backup file is created (even for a full save).

Remarks

The initial value for this property is True.

This property improves the speed of incremental saves by creating a backup file (.bak). The operating system copies the file data to create a backup file for large drawings which takes a major portion of the incremental save time.

ImportantIn the case of a problem (such as a power failure in the middle of a save), it's possible that drawing data can be lost.
NoteThe value of this property is stored in the ISAVEBAK system variable.

Examples

VBA:

Sub Example_CreateBackup()
    ' This example returns the current setting of
    ' CreateBackup. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currCreateBackup As Boolean

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current CreateBackup value
    currCreateBackup = preferences.OpenSave.CreateBackup
    MsgBox "The current value for CreateBackup is " & preferences.OpenSave.CreateBackup, vbInformation, "CreateBackup Example"

    ' Change the value for CreateBackup
    preferences.OpenSave.CreateBackup = Not (currCreateBackup)
    MsgBox "The new value for CreateBackup is " & preferences.OpenSave.CreateBackup, vbInformation, "CreateBackup Example"

    ' Reset CreateBackup to its original value
    preferences.OpenSave.CreateBackup = currCreateBackup
    MsgBox "The CreateBackup value is reset to " & preferences.OpenSave.CreateBackup, vbInformation, "CreateBackup Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CreateBackup()
    ;; This example returns the current setting of
    ;; CreateBackup. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current CreateBackup value
    (setq currCreateBackup (vla-get-CreateBackup (vla-get-OpenSave preferences)))
    (alert (strcat "The current value for CreateBackup is " (if (= currCreateBackup :vlax-true) "True" "False")))

    ;; Change the value for CreateBackup
    (setq newCreateBackup (if (= currCreateBackup :vlax-true) :vlax-false :vlax-true))
    (vla-put-CreateBackup (vla-get-OpenSave preferences) newCreateBackup)
    (alert (strcat "The new value for CreateBackup is " (if (= newCreateBackup :vlax-true) "True" "False")))

    ;; Reset CreateBackup to its original value
    (vla-put-CreateBackup (vla-get-OpenSave preferences) currCreateBackup)
    (alert (strcat "The CreateBackup value is reset to " (if (= currCreateBackup :vlax-true) "True" "False")))
)


CurrentSectionType Property (ActiveX)

Specifies the current section type.

Supported platforms: Windows only

Signature

VBA:

object.CurrentSectionType
object

Type: SectionSettings

The object to which this property applies.

Property Value

Read-only: No

Type: AcSectionType enum

  • acSectionType2dSection
  • acSectionType3dSection
  • acSectionTypeLiveSection

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


CursorSize Property (ActiveX)

Specifies the crosshairs size as a percentage of the screen size.

Supported platforms: Windows only

Signature

VBA:

object.CursorSize
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: Integer

A positive integer from 1 to 100 representing the percentage of total screen area to size the crosshairs to.

Remarks

The default value for this property is 5 percent.

The allowable range is 1 to 100 percent of the total screen. At 100 percent, the ends of the crosshairs are not visible. If the size is decreased to 99 percent or below, the crosshairs have a finite size and the ends of the crosshairs are visible when moved to the edge of the drawing area.

NoteThe value for this property is stored in the CURSORSIZE system variable.

Examples

VBA:

Sub Example_CursorSize()
    ' This example returns the current setting of
    ' CursorSize. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currCursorSize As Integer
    Dim newCursorSize As Integer

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current CursorSize value
    currCursorSize = preferences.DISPLAY.CursorSize
    MsgBox "The current value for CursorSize is " & currCursorSize, vbInformation, "CursorSize Example"

    ' Change the value for CursorSize
    newCursorSize = 10
    preferences.DISPLAY.CursorSize = newCursorSize
    MsgBox "The new value for CursorSize is " & newCursorSize, vbInformation, "CursorSize Example"

    ' Reset CursorSize to its original value
    preferences.DISPLAY.CursorSize = currCursorSize
    MsgBox "The CursorSize value is reset to " & currCursorSize, vbInformation, "CursorSize Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CursorSize()
    ;; This example returns the current setting of
    ;; CursorSize. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current CursorSize value
    (setq currCursorSize (vla-get-CursorSize (vla-get-Display preferences)))
    (alert (strcat "The current value for CursorSize is " (itoa currCursorSize)))

    ;; Change the value for CursorSize
    (setq newCursorSize 10)
    (vla-put-CursorSize (vla-get-Display preferences) newCursorSize)
    (alert (strcat "The new value for CursorSize is " (itoa newCursorSize)))

    ;; Reset CursorSize to its original value
    (vla-put-CursorSize (vla-get-Display preferences) currCursorSize)
    (alert (strcat "The CursorSize value is reset to " (itoa currCursorSize)))
)


CurveTangencyLinesColor Property (ActiveX)

Specifies the color of curve tangency lines.

Supported platforms: Windows only

Signature

VBA:

object.CurveTangencyLinesColor
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: AcCmColor

Color assigned to curve tangency lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


CurveTangencyLinesLayer Property (ActiveX)

Specifies the layer of curve tangency lines.

Supported platforms: Windows only

Signature

VBA:

object.CurveTangencyLinesLayer
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: String

Name of the layer to be applied to the curve tangency lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


CurveTangencyLinesLinetype Property (ActiveX)

Specifies the linetype of curve tangency lines.

Supported platforms: Windows only

Signature

VBA:

object.CurveTangencyLinesLinetype
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: String

Name of the linetype to be applied to the curve tangency lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


CurveTangencyLinesLinetypeScale Property (ActiveX)

Specifies the linetype scale of curve tangency lines.

Supported platforms: Windows only

Signature

VBA:

object.CurveTangencyLinesLinetypeScale
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: ACAD_NOUNITS

Numeric value that represents the linetype scale factor to be applied to the curve tangency lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


CurveTangencyLinesLineweight Property (ActiveX)

Specifies the lineweight of curve tangency lines.

Supported platforms: Windows only

Signature

VBA:

object.CurveTangencyLinesLineweight
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: ACAD_LWEIGHT

Value that represents the lineweight to be applied to the curve tangency lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


CurveTangencyLinesPlotStyleName Property (ActiveX)

Specifies the plot style name of curve tangency lines.

Supported platforms: Windows only

Signature

VBA:

object.CurveTangencyLinesPlotStyleName
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: String

Name of the plot style to be applied to the curve tangency lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


CurveTangencyLinesVisible Property (ActiveX)

Specifies the visibility of curve tangency lines.

Supported platforms: Windows only

Signature

VBA:

object.CurveTangencyLinesVisible
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: Boolean

  • True: Curve tangency lines are visible.
  • False: Curve tangency lines are not visible.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


CustomDictionary Property (ActiveX)

Specifies a custom dictionary to use if you have one.

Supported platforms: Windows only

Signature

VBA:

object.CustomDictionary
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The custom dictionary to use.

Remarks

This property contains the drive, path, and file name of the custom dictionary for the AutoCAD session.

Examples

VBA:

Sub Example_CustomDictionary()
    ' This example returns the current setting of
    ' CustomDictionary. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currCustomDictionary As String
    Dim newCustomDictionary As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current CustomDictionary value
    currCustomDictionary = preferences.Files.CustomDictionary
    MsgBox "The current value for CustomDictionary is " & currCustomDictionary, vbInformation, "CustomDictionary Example"

    ' Change the value for CustomDictionary
    newCustomDictionary = "TestCustomDictionary.cus"
    preferences.Files.CustomDictionary = newCustomDictionary
    MsgBox "The new value for CustomDictionary is " & newCustomDictionary, vbInformation, "CustomDictionary Example"

    ' Reset CustomDictionary to its original value
    preferences.Files.CustomDictionary = currCustomDictionary
    MsgBox "The CustomDictionary value is reset to " & currCustomDictionary, vbInformation, "CustomDictionary Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CustomDictionary()
    ;; This example returns the current setting of
    ;; CustomDictionary. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current CustomDictionary value
    (setq currCustomDictionary (vla-get-CustomDictionary (vla-get-Files preferences)))
    (alert (strcat "The current value for CustomDictionary is " currCustomDictionary))

    ;; Change the value for CustomDictionary
    (setq newCustomDictionary "TestCustomDictionary.cus")
    (vla-put-CustomDictionary (vla-get-Files preferences) newCustomDictionary)
    (alert (strcat "The new value for CustomDictionary is " newCustomDictionary))

    ;; Reset CustomDictionary to its original value
    (vla-put-CustomDictionary (vla-get-Files preferences) currCustomDictionary)
    (alert (strcat "The CustomDictionary value is reset to " currCustomDictionary))
)


CustomIconPath Property (ActiveX)

Specifies the search path for custom icons.

Supported platforms: Windows only

Signature

VBA:

object.CustomIconPath
object

Type: PreferencesFiles

The object to which this property applies.

Property Value

Read-only: No

Type:String

The path that contains custom icons referenced by customization files.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


CustomScale Property (ActiveX)

Specifies the custom scale factor for the viewport.

Supported platforms: Windows only

Signature

VBA:

object.CustomScale
object

Type: PViewport

The object this property applies to.

Property Value

Read-only: No

Type: Double

The custom scale factor for the viewport.

Remarks

To set the viewport to a custom scale, first set the StandardScale property to acVpCustomScale, then use this property to define the custom scale value.

Examples

VBA:

Sub Example_CustomScale()
    ' This example adds a line in paper space, creates a new paper space viewport, and cycles through some common paper space custom scale sizes
    ' for the new paper space viewport

    Dim lineObj As AcadLine
    Dim PViewPort As AcadPViewport
    Dim startPoint(0 To 2) As Double, endPoint(0 To 2)  As Double
    Dim center(0 To 2) As Double
    Dim width As Double, height As Double

    ' Define the start and end points for the line
    startPoint(0) = 1: startPoint(1) = 1: startPoint(2) = 0
    endPoint(0) = 5: endPoint(1) = 5: endPoint(2) = 0

    ' Define the paper space viewport
    center(0) = 3: center(1) = 3: center(2) = 0
    width = 40: height = 40

    ' Create the line in paper space
    Set lineObj = ThisDrawing.PaperSpace.AddLine(startPoint, endPoint)

    ' Create the paper space viewport
    Set PViewPort = ThisDrawing.PaperSpace.AddPViewport(center, width, height)

    ' Set the paper space viewport scale to custom
    PViewPort.StandardScale = acVpCustomScale

    ' Change from model space to paper space
    ThisDrawing.ActiveSpace = acPaperSpace

    ' Read and display the existing paper space viewport scale setting
    MsgBox "The scale of the new PViewport is: " & PViewPort.CustomScale

    ' Change the custom scale setting to 1:10 scale
    PViewPort.CustomScale = 0.1

    ' Read and display the new paper space viewport scale setting
    MsgBox "The scale of the new PViewport has been changed to: " & PViewPort.CustomScale

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CustomScale()
    ;; This example adds a line in paper space, creates a new paper space viewport, and cycles through some common paper space custom scale sizes
    ;; for the new paper space viewport
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the start and end points for the line
    (setq startPoint (vlax-3d-point 1 1 0)
          endPoint (vlax-3d-point 5 5 0))

    ;; Define the paper space viewport
    (setq center (vlax-3d-point 3 3 0)
          width 40
          height 40)

    ;; Create the line in paper space
    (setq paperSpace (vla-get-PaperSpace doc))
    (setq lineObj (vla-AddLine paperSpace startPoint endPoint))

    ;; Create the paper space viewport
    (setq PViewPort (vla-AddPViewport paperSpace center width height))

    ;; Set the paper space viewport scale to custom
    (vla-put-StandardScale PViewPort acVpCustomScale)

    ;; Change from model space to paper space
    (vla-put-ActiveSpace doc acPaperSpace)
    (vla-Regen doc acAllViewports)
    (vla-ZoomAll acadObj)

    ;; Read and display the existing paper space viewport scale setting
    (alert (strcat "The scale of the new PViewport is: " (rtos (vla-get-CustomScale PViewPort) 2)))

    ;; Change the custom scale setting to 1:10 scale
    (vla-put-CustomScale PViewPort 0.1)

    ;; Read and display the new paper space viewport scale setting
    (alert (strcat "The scale of the new PViewport has been changed to: " (rtos (vla-get-CustomScale PViewPort) 2)))
)


CvHullDisplay Property (ActiveX)

Specifies if the control vertices (CV) Hull is displayed for the NURBS surface.

Supported platforms: Windows only

Signature

VBA:

object.CvHullDisplay
object

Type: NurbSurface

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: CV Hull is displayed
  • False: CV Hull is hidden

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


Database Property (ActiveX)

Gets the database in which the object belongs.

Supported platforms: Windows only

Signature

VBA:

object.Database
object

Type: Document

The object this property applies to.

Property Value

Read-only: Yes

Type: Database

The Database object that contains the object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Database()
    ' This example references the Database object obtained from model space.
    ' Information from the Database object is then displayed

    Dim Database As AcadDatabase

    ' Attach to Database object
    Set Database = ThisDrawing.ModelSpace.Database
    MsgBox "We now have access to the properties and methods of the Database object!"

    ' Retrieve the number of Blocks in this database
    MsgBox "The number of Blocks in this database is: " & Database.Blocks.Count

    ' Release object
    Set Database = Nothing
    MsgBox "The Database object has been released!"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Database()
    ;; This example references the Database object obtained from model space.
    ;; Information from the Database object is then displayed
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Attach to Database object
    (setq database (vla-get-Database (vla-get-ModelSpace doc)))
    (alert "We now have access to the properties and methods of the Database object!")

    ;; Retrieve the number of Blocks in this database
    (alert (strcat "The number of Blocks in this database is: " (itoa (vla-get-Count (vla-get-Blocks database)))))

    ;; Release object
    (vlax-release-object database)
    (alert "The Database object has been released!")
)


DecimalSeparator Property (ActiveX)

Specifies the character to be used as the decimal separator in decimal dimension and tolerance values.

Supported platforms: Windows only

Signature

VBA:

object.DecimalSeparator
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: String

A single character used as the separator in decimal values.

Remarks

The initial value for this property is ".".

Any character will be accepted as a valid value for this property.

This property will be used only when the UnitsFormat property is set to acDimDecimal.

NoteThis property overrides the value of the DIMDSEP system variable for the given dimension.

Examples

VBA:

Sub Example_DecimalSeparator()
    ' This example creates a Dim3PointAngular object in model space
    ' and allows the user to change the decimal separator appearance
    ' using the DecimalSeparator property

    Dim DimPointAngularObj As AcadDim3PointAngular
    Dim AngleVertex(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double
    Dim oldSeparator As String, newSeparator As String

    ' Define the new Dim3PointAngular object
    AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
    FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
    SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
    TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

    ' Create the new Dim3PointAngular object in model space
    Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)

    ' Set precision so that degrees are visible
    DimPointAngularObj.TextPrecision = acDimPrecisionFour

    ThisDrawing.Application.ZoomAll

    ' Read and display current decimal separator
    MsgBox "The decimal separator for this object is currently set to: [" & DimPointAngularObj.DecimalSeparator & "]"

    ' Alter the decimal separator property for this object
    oldSeparator = DimPointAngularObj.DecimalSeparator
    newSeparator = InputBox("Enter a new decimal separator", "Change Decimal Separator", oldSeparator)

    If newSeparator = "" Then
        Exit Sub
    Else
        ' Set new decimal separator, making sure to use only one character
        DimPointAngularObj.DecimalSeparator = Left(newSeparator, 1)
    End If

    ThisDrawing.Regen acAllViewports

    ' Read and display current decimal separator
    MsgBox "The decimal separator for this object is now set to: [" & DimPointAngularObj.DecimalSeparator & "]"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DecimalSeparator()
    ;; This example creates a Dim3PointAngular object in model space
    ;; and allows the user to change the decimal separator appearance
    ;; using the DecimalSeparator property
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Dim3PointAngular object
    (setq AngleVertex (vlax-3d-point 0 0 0)
          FirstPoint (vlax-3d-point 2 2 0)
          SecondPoint (vlax-3d-point 1 4 0)
          TextPoint (vlax-3d-point 6 6 0))

    ;; Create the new Dim3PointAngular object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq DimPointAngularObj (vla-AddDim3PointAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))

    ;; Set precision so that degrees are visible
    (vla-put-TextPrecision DimPointAngularObj acDimPrecisionFour)

    (vla-ZoomAll acadObj)

    ;; Read and display current decimal separator
    (alert (strcat "The decimal separator for this object is currently set to: [" (vla-get-DecimalSeparator DimPointAngularObj) "]"))

    ;; Alter the decimal separator property for this object
    (setq oldSeparator (vla-get-DecimalSeparator DimPointAngularObj))
    (setq newSeparator (getstring "\nEnter a new decimal separator: "))

    (if (/= newSeparator "")
        ;; Set new decimal separator, making sure to use only one character
        (vla-put-DecimalSeparator DimPointAngularObj newSeparator)
    )

    (vla-Regen doc acAllViewports)

    ;; Read and display current decimal separator
    (alert (strcat "The decimal separator for this object is now set to: [" (vla-get-DecimalSeparator DimPointAngularObj) "]"))
)


DefaultInternetURL Property (ActiveX)

Specifies the default Internet address.

Supported platforms: Windows only

Signature

VBA:

object.DefaultInternetURL
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The default Internet address.

Remarks

NoteThe value for this property is stored in the INETLOCATION system variable.

Examples

VBA:

Sub Example_DefaultInternetURL()
    ' This example returns the current setting of
    ' DefaultInternetURL. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currDefaultInternetURL As String
    Dim newDefaultInternetURL As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current DefaultInternetURL value
    currDefaultInternetURL = preferences.Files.DefaultInternetURL
    MsgBox "The current value for DefaultInternetURL is " & currDefaultInternetURL, vbInformation, "DefaultInternetURL Example"

    ' Change the value for DefaultInternetURL
    newDefaultInternetURL = "TestDefaultInternetURL"
    preferences.Files.DefaultInternetURL = newDefaultInternetURL
    MsgBox "The new value for DefaultInternetURL is " & newDefaultInternetURL, vbInformation, "DefaultInternetURL Example"

    ' Reset DefaultInternetURL to its original value
    preferences.Files.DefaultInternetURL = currDefaultInternetURL
    MsgBox "The DefaultInternetURL value is reset to " & currDefaultInternetURL, vbInformation, "DefaultInternetURL Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DefaultInternetURL()
    ;; This example returns the current setting of
    ;; DefaultInternetURL. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current DefaultInternetURL value
    (setq currDefaultInternetURL (vla-get-DefaultInternetURL (vla-get-Files preferences)))
    (alert (strcat "The current value for DefaultInternetURL is " currDefaultInternetURL))

    ;; Change the value for DefaultInternetURL
    (setq newDefaultInternetURL "TestDefaultInternetURL")
    (vla-put-DefaultInternetURL (vla-get-Files preferences) newDefaultInternetURL)
    (alert (strcat "The new value for DefaultInternetURL is " newDefaultInternetURL))

    ;; Reset DefaultInternetURL to its original value
    (vla-put-DefaultInternetURL (vla-get-Files preferences) currDefaultInternetURL)
    (alert (strcat "The DefaultInternetURL value is reset to " currDefaultInternetURL))
)


DefaultOutputDevice Property (ActiveX)

Specifies the default output device for new layouts and model space.

Supported platforms: Windows only

Signature

VBA:

object.DefaultOutputDevice
object

Type: PreferencesOutput

The object this property applies to.

Property Value

Read-only: No

Type: String

The name of the default printer to use.

Remarks

You can specify any printers your computer is configured for, as well as any PC3 files in the plotter configuration path.

If no devices are on the system, this property will return "None."

Examples

VBA:

Sub Example_DefaultOutputDevice()
    ' This example reads and modifies the preference value that controls
    ' the default output device for new layouts and model space.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesOutput
    Dim originalValue As Variant, newValue As Variant

    ' Get the output preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Output

    ' Read and display the original value
    originalValue = ACADPref.DefaultOutputDevice
    MsgBox "The DefaultOutputDevice preference is: " & originalValue

    ' Modify the DefaultOutputDevice preference
    ACADPref.DefaultOutputDevice = "DWG to PDF.pc3"
    newValue = ACADPref.DefaultOutputDevice
    MsgBox "The DefaultOutputDevice preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.DefaultOutputDevice = originalValue
    MsgBox "The DefaultOutputDevice preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DefaultOutputDevice()
    ;; This example reads and modifies the preference value that controls
    ;; the default output device for new layouts and model space.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the output preferences object
    (setq ACADPref (vla-get-Output preferences))

    ;; Read and display the original value
    (setq originalValue (vla-get-DefaultOutputDevice ACADPref))
    (alert (strcat "The DefaultOutputDevice preference is: " originalValue))

    ;; Modify the DefaultOutputDevice preference
    (vla-put-DefaultOutputDevice ACADPref "DWG to PDF.pc3")
    (setq newValue (vla-get-DefaultOutputDevice ACADPref))
    (alert (strcat "The DefaultOutputDevice preference has been set to: " newValue))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-DefaultOutputDevice ACADPref originalValue)
    (alert (strcat "The DefaultOutputDevice preference was reset back to: " originalValue))
)


DefaultPlotStyleForLayer Property (ActiveX)

Specifies the default plot style for Layer 0 for new drawings or drawings created with earlier releases of AutoCAD that have never been saved in AutoCAD 2000 or later format.

Supported platforms: Windows only

Signature

VBA:

object.DefaultPlotStyleForLayer
object

Type: PreferencesOutput

The object this property applies to.

Property Value

Read-only: No

Type: String

You can enter the default value "Normal" and enter any plot styles defined in the currently loaded plot style table.

Remarks

The initial value of this property is "Normal".

This property is only available when PlotPolicy is set to acPolicyNamed.

Use the DefaultPlotStyleTable property to find the current plot style.

NoteThe value of this property is stored in the DEFLPLSTYLE system variable.

Examples

VBA:

Sub Example_DefaultPlotStyleForLayer()
    ' This example reads and modifies the preference value that controls
    ' the default plot style assigned to layers.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesOutput
    Dim originalPolicyValue As Variant, originalValue As Variant, _
        originalPlotStyleTableValue As Variant, newValue As Variant

    ' Get the output preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Output

    ' Set the default plot style to named plot styles
    originalPolicyValue = ACADPref.PlotPolicy
    ACADPref.PlotPolicy = acPolicyNamed

    ' Read and display the original value
    originalValue = ACADPref.DefaultPlotStyleForLayer
    MsgBox "The DefaultPlotStyleForLayer preference is: " & originalValue

    originalPlotStyleTableValue = ACADPref.DefaultPlotStyleTable
    ACADPref.DefaultPlotStyleTable = "acad.stb"

    ' Toggle and display the DefaultPlotStyleForLayer preference
    If ACADPref.DefaultPlotStyleForLayer = "Style 1" Then
        ACADPref.DefaultPlotStyleForLayer = "Normal"
    Else
        ACADPref.DefaultPlotStyleForLayer = "Style 1"
    End If

    newValue = ACADPref.DefaultPlotStyleForLayer
    MsgBox "The DefaultPlotStyleForLayer preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.DefaultPlotStyleForLayer = originalValue
    MsgBox "The DefaultPlotStyleForLayer preference was reset back to: " & originalValue

    ' Restore the original plot style
    ACADPref.PlotPolicy = originalPolicyValue
    ACADPref.DefaultPlotStyleTable = originalPlotStyleTableValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DefaultPlotStyleForLayer()
    ;; This example reads and modifies the preference value that controls
    ;; the default plot style assigned to layers.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the output preferences object
    (setq ACADPref (vla-get-Output preferences))

    ;; Set the default plot style to named plot styles
    (setq originalPolicyValue (vla-get-PlotPolicy ACADPref))
    (vla-put-PlotPolicy ACADPref acPolicyNamed)

    (setq originalPlotStyleTableValue (vla-get-DefaultPlotStyleTable ACADPref))
    (vla-put-DefaultPlotStyleTable ACADPref "acad.stb")

    ;; Read and display the original value
    (setq originalValue (vla-get-DefaultPlotStyleForLayer ACADPref))
    (alert (strcat "The DefaultPlotStyleForLayer preference is: " originalValue))

    ;; Toggle and display the DefaultPlotStyleForLayer preference
    (if (= (vla-get-DefaultPlotStyleForLayer ACADPref) "Style 1")
        (vla-put-DefaultPlotStyleForLayer ACADPref "Normal")
        (vla-put-DefaultPlotStyleForLayer ACADPref "Style 1")
    )

    (setq newValue (vla-get-DefaultPlotStyleForLayer ACADPref))
    (alert (strcat "The DefaultPlotStyleForLayer preference has been set to: " newValue))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-DefaultPlotStyleForLayer ACADPref originalValue)
    (alert (strcat "The DefaultPlotStyleForLayer preference was reset back to: " originalValue))

    ;; Restore the original plot style
    (vla-put-PlotPolicy ACADPref originalPolicyValue)
    (vla-put-DefaultPlotStyleTable ACADPref originalPlotStyleTableValue)
)


DefaultPlotStyleForObjects Property (ActiveX)

Specifies the default plot style name for newly created objects.

Supported platforms: Windows only

Signature

VBA:

object.DefaultPlotStyleForObjects
object

Type: PreferencesOutput

The object this property applies to.

Property Value

Read-only: No

Type: String

Valid entries include "ByLayer", "ByBlock", "Normal", or any style name in the currently loaded plot style.

Remarks

The initial value of this property is "ByLayer".

This property is available only when PlotPolicy is set to acPolicyNamed.

Use the DefaultPlotStyleTable property to find the current plot style.

NoteThe value of this property is stored in the DEFLPLSTYLE system variable.

Examples

VBA:

Sub Example_DefaultPlotStyleForObjects()
    ' This example reads and modifies the preference value that controls
    ' the default plot style name for newly created objects.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesOutput
    Dim originalPolicyValue As Variant, originalValue As Variant, newValue As Variant

    ' Get the output preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Output

    ' Set the default plot style to named plot styles
    originalPolicyValue = ACADPref.PlotPolicy
    ACADPref.PlotPolicy = acPolicyNamed

    ' Read and display the original value
    originalValue = ACADPref.DefaultPlotStyleForObjects
    MsgBox "The DefaultPlotStyleForObjects preference is: " & originalValue

    ' Toggle and display the DefaultPlotStyleForObjects preference
    If ACADPref.DefaultPlotStyleForObjects = "ByBlock" Then
        ACADPref.DefaultPlotStyleForObjects = "Normal"
    Else
        ACADPref.DefaultPlotStyleForObjects = "ByBlock"
    End If

    newValue = ACADPref.DefaultPlotStyleForObjects
    MsgBox "The DefaultPlotStyleForObjects preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.DefaultPlotStyleForObjects = originalValue
    MsgBox "The DefaultPlotStyleForObjects preference was reset back to: " & originalValue

    ACADPref.PlotPolicy = originalPolicyValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DefaultPlotStyleForObjects()
    ;; This example reads and modifies the preference value that controls
    ;; the default plot style name for newly created objects.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the output preferences object
    (setq ACADPref (vla-get-Output preferences))

    ;; Set the default plot style to named plot styles
    (setq originalPolicyValue (vla-get-PlotPolicy ACADPref))
    (vla-put-PlotPolicy ACADPref acPolicyNamed)

    ;; Read and display the original value
    (setq originalValue (vla-get-DefaultPlotStyleForObjects ACADPref))
    (alert (strcat "The DefaultPlotStyleForObjects preference is: " originalValue))

    ;; Toggle and display the DefaultPlotStyleForObjects preference
    (if (= (vla-get-DefaultPlotStyleForObjects ACADPref) "ByBlock")
        (vla-put-DefaultPlotStyleForObjects ACADPref "Normal")
        (vla-put-DefaultPlotStyleForObjects ACADPref "ByBlock")
    )

    (setq newValue (vla-get-DefaultPlotStyleForObjects ACADPref))
    (alert (strcat "The DefaultPlotStyleForObjects preference has been set to: " newValue))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-DefaultPlotStyleForObjects ACADPref originalValue)
    (alert (strcat "The DefaultPlotStyleForObjects preference was reset back to: " originalValue))

    (vla-put-PlotPolicy ACADPref originalPolicyValue)
)


DefaultPlotStyleTable Property (ActiveX)

Specifies the default plot style table to attach to new drawings.

Supported platforms: Windows only

Signature

VBA:

object.DefaultPlotStyleTable
object

Type: PreferencesOutput

The object this property applies to.

Property Value

Read-only: No

Type: String

A plot style table has a .ctb or .stb extension and includes and defines plot styles.

Remarks

If you are using color-dependent plot styles, this option can be set to any color dependent plot style tables found in the search path as well as the value "None". If you are using named plot styles, this option can be set to any named plot style tables.

To set color-dependent plot styles, use the PlotPolicy property.

Examples

VBA:

Sub Example_DefaultPlotStyleTable()
    ' This example reads and modifies the preference value that
    ' specifies the default plot style table to attach to new drawings.
    '
    ' Note: You may want to change the path of the new plot style table below.

    Dim ACADPref As AcadPreferencesOutput
    Dim CurrentFile As String

    Const NewFile = "c:\monochrome.ctb"

    ' Get the drafting preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Output

    ' Read and display the current plot style table path
    CurrentFile = ACADPref.DefaultPlotStyleTable
    If CurrentFile = "" Then
        MsgBox "There is no current plot style table being used", vbInformation
    Else
        MsgBox "The current plot style table is: " & CurrentFile
    End If

    ' Use a new plot style table
    ACADPref.DefaultPlotStyleTable = NewFile

    ' Read and display the new plot style table path
    CurrentFile = ACADPref.DefaultPlotStyleTable
    MsgBox "The new plot style table is: " & CurrentFile, vbInformation

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DefaultPlotStyleTable()
    ;; This example reads and modifies the preference value that
    ;; specifies the default plot style table to attach to new drawings.
    ;;
    ;; Note: You may want to change the path of the new plot style table below.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    (setq NewFile (strcat (vla-get-PrinterStyleSheetPath (vla-get-Files preferences)) "\\monochrome.ctb"))

    ;; Get the drafting preferences object
    (setq ACADPref (vla-get-Output preferences))

    ;; Read and display the current plot style table path
    (setq CurrentFile (vla-get-DefaultPlotStyleTable ACADPref))
    (if (= CurrentFile "")
        (alert "There is no current plot style table being used.")
        (alert (strcat "The current plot style table is: " CurrentFile))
    )

    ;; Use a new plot style table
    (vla-put-DefaultPlotStyleTable ACADPref NewFile)

    ;; Read and display the new plot style table path
    (alert (strcat "The new plot style table is: " (vla-get-DefaultPlotStyleTable ACADPref)))

    (vla-put-DefaultPlotStyleTable ACADPref CurrentFile)
)


DefaultPlotToFilePath Property (ActiveX)

Specifies the default path for plotting to a file.

Supported platforms: Windows only

Signature

VBA:

object.DefaultPlotToFilePath
object

Type: PreferencesOutput

The object this property applies to.

Property Value

Read-only: No

Type: String

The default path for plotting to a file.

Remarks

This property is equivalent to the AutoCAD Options dialog box setting "Default Location for Plot to File Operations."

Examples

VBA:

Sub Example_DefaultPlotToFilePath()
    ' Note: Change the path to a valid folder on your system.

    Dim MyPreference As AcadPreferencesOutput
    Set MyPreference = AcadApplication.preferences.Output
    MyPreference.DefaultPlotToFilePath = "C:\Plots"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DefaultPlotToFilePath()
    ;; Note: Change the path to a valid folder on your system.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    (setq MyPreference (vla-get-Output preferences))
    (vla-put-DefaultPlotToFilePath MyPreference "C:\\Plots")
)


Degree Property (ActiveX)

Gets the degree of the spline's polynomial representation.

Supported platforms: Windows only

Signature

VBA:

object.Degree
object

Type: Spline

The object this property applies to.

Property Value

Read-only: Yes

Type: Integer

An integer between 1 and 25 inclusive.

Remarks

The order of the spline is equal to the degree of the spline plus one (+1).

Examples

VBA:

Sub Example_Degree()
    ' This example creates a spline and returns the degree
    ' of the spline's polynomial representation.

    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 0: fitPoints(1) = 0: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)

    ThisDrawing.Regen True
    MsgBox "The degree of this Spline's polynomial representation is: " & splineObj.Degree, vbInformation
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Degree()
    ;; This example creates a spline and returns the degree
    ;; of the spline's polynomial representation.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the spline
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(0 0 0
                     5 5 0
                     10 0 0
                    )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))

    (vla-ZoomExtents acadObj)
    (vla-Regen doc :vlax-true)
    (alert (strcat "The degree of this Spline's polynomial representation is: " (itoa (vla-get-Degree splineObj))))
)


Degree2 Property (ActiveX)

Specifies the degree of the spline's polynomial representation.

Supported platforms: Windows only

Signature

VBA:

object.Degree2
object

Type: Spline

The object this property applies to.

Property Value

Read-only: No

Type: Integer

An integer between 1 and 25 inclusive.

Remarks

The order of the spline is equal to the degree of the spline plus one (+1).

Examples

VBA:

Sub Example_Degree()
    ' This example creates a spline and returns the degree
    ' of the spline's polynomial representation.

    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 0: fitPoints(1) = 0: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)

    ThisDrawing.Regen True
    MsgBox "The degree of this Spline's polynomial representation is: " & splineObj.Degree, vbInformation
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Degree()
    ;; This example creates a spline and returns the degree
    ;; of the spline's polynomial representation.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the spline
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(0 0 0
                     5 5 0
                     10 0 0
                    )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))

    (vla-ZoomExtents acadObj)
    (vla-Regen doc :vlax-true)
    (alert (strcat "The degree of this Spline's polynomial representation is: " (itoa (vla-get-Degree splineObj))))
)


Delta Property (ActiveX)

Gets the delta of a line.

Supported platforms: Windows only

Signature

VBA:

object.Delta
object

Type: Line

The object this property applies to.

Property Value

Read-only: Yes

Type: Variant (three-element array of doubles)

A three-element array representing the deltaX, deltaY, and deltaZ values for the line.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Delta()
    ' This example adds a line in model space and returns the delta of the new line

    Dim lineObj As AcadLine
    Dim lineDelta As Variant
    Dim startPoint(0 To 2) As Double, endPoint(0 To 2) As Double

    ' Define the start and end points for the line
    startPoint(0) = 1: startPoint(1) = 1: startPoint(2) = 0
    endPoint(0) = 5: endPoint(1) = 5: endPoint(2) = 0

    ' Create the line in model space
    Set lineObj = ThisDrawing.modelSpace.AddLine(startPoint, endPoint)

    ThisDrawing.Application.ZoomAll

    ' Display the delta of the new line
    lineDelta = lineObj.Delta
    MsgBox "The delta of the new Line is: " & vbCrLf & _
           "DeltaX: " & lineDelta(0) & vbCrLf & _
           "DeltaY: " & lineDelta(1) & vbCrLf & _
           "DeltaZ: " & lineDelta(2)
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Delta()
    ;; This example adds a line in model space and returns the delta of the new line
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the start and end points for the line
    (setq startPoint (vlax-3d-point 1 1 0)
          endPoint (vlax-3d-point 5 5 0))

    ;; Create the line in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-ZoomAll acadObj)

    ;; Display the delta of the new line
    (setq lineDelta (vlax-safearray->list (vlax-variant-value (vla-get-Delta lineObj))))
    (alert (strcat "The delta of the new Line is: "
                   "\nDeltaX: " (rtos (nth 0 lineDelta) 2)
                   "\nDeltaY: " (rtos (nth 1 lineDelta) 2)
                   "\nDeltaZ: " (rtos (nth 2 lineDelta) 2)
       )
    )
)


DemandLoadARXApp Property (ActiveX)

Specifies whether AutoCAD demand-loads a third-party application if a drawing contains custom objects.

Supported platforms: Windows only

Signature

VBA:

object.DemandLoadARXApp
object

Type: PreferencesOpenSave

The object this property applies to.

Property Value

Read-only: No

Type: acARXDemandLoad enum

  • acDemandLoadDisabled: Turns off demand-loading.
  • acDemandLoadOnObjectDetect: Demand-loads the source application when you open a drawing that contains custom objects. This setting does not demand-load the application when you invoke one of the application's commands.
  • acDemandLoadCmdInvoke: Demand-loads the source application when you invoke one of the application's commands. This setting does not demand-load the application when you open a drawing that contains custom objects.
  • acDemandLoadOnObjectDetect + acDemandLoadCmdInvoke: Demand-loads the source application when you open a drawing that contains custom objects or when you invoke one of the application's commands.

Remarks

The initial value for this property is acDemandLoadOnObjectDetect + acDemandLoadCmdInvoke.

NoteThe value for this property is stored in the DEMANDLOAD system variable.

Examples

VBA:

Sub Example_DemandLoadARXApp()
    ' This example returns the current setting of
    ' DemandLoadARXApp. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currDemandLoadARXApp As Integer
    Dim constant As String
    Dim newConstant As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current DemandLoadARXApp value
    currDemandLoadARXApp = preferences.OpenSave.DemandLoadARXApp
    MsgBox "The current value for DemandLoadARXApp is " & currDemandLoadARXApp, vbInformation, "DemandLoadARXApp Example"

    ' Change the value for DemandLoadARXApp
    newConstant = acDemandLoadCmdInvoke
    preferences.OpenSave.DemandLoadARXApp = acDemandLoadCmdInvoke
    MsgBox "The new value for DemandLoadARXApp is " & newConstant, vbInformation, "DemandLoadARXApp Example"

    ' Reset DemandLoadARXApp to its original value
    preferences.OpenSave.DemandLoadARXApp = currDemandLoadARXApp
    MsgBox "The DemandLoadARXApp value is reset to " & currDemandLoadARXApp, vbInformation, "DemandLoadARXApp Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DemandLoadARXApp()
    ;; This example returns the current setting of
    ;; DemandLoadARXApp. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current DemandLoadARXApp value
    (setq currDemandLoadARXApp (vla-get-DemandLoadARXApp (vla-get-OpenSave preferences)))
    (alert (strcat "The current value for DemandLoadARXApp is " (itoa currDemandLoadARXApp)))

    ;; Change the value for DemandLoadARXApp
    (setq newConstant acDemandLoadCmdInvoke)
    (vla-put-DemandLoadARXApp (vla-get-OpenSave preferences) newConstant)
    (alert (strcat "The new value for DemandLoadARXApp is " (itoa newConstant)))

    ;; Reset DemandLoadARXApp to its original value
    (vla-put-DemandLoadARXApp (vla-get-OpenSave preferences) currDemandLoadARXApp)
    (alert (strcat "The DemandLoadARXApp value is reset to " (itoa currDemandLoadARXApp)))
)


Description Property (ActiveX)

Specifies the description of an object.

Supported platforms: Windows only

Signature

VBA:

object.Description
object

Type: DynamicBlockReferenceProperty, Layer, Linetype, Material, MLeaderStyle, TableStyle

The objects this property applies to.

Property Value

Read-only: No; except for DynamicBlockReferenceProperty objects

Type: String

The description assigned to the object.

Remarks

The description for a dynamic block reference property is set by the block author and cannot be edited.

A linetype description can have up to 47 characters. The description can be a comment or a series of underscores, dots, dashes, and spaces to show a simple representation of the linetype pattern.

Examples

VBA:

Sub Example_Description()
    ' This example returns the description of the active linetype.
    ' It then changes the description of the active linetype.

    Dim currDescription As String

    ' This example modifies the description of a linetype
    currDescription = ThisDrawing.ActiveLinetype.Description
    MsgBox "The description of the active LineType is: " & currDescription, vbInformation, "Description Example"

    ' Change the description of the active linetype
    ThisDrawing.ActiveLinetype.Description = "My favorite LineType"
    MsgBox "The new description of the active LineType is: " & ThisDrawing.ActiveLinetype.Description, vbInformation, "Description Example"

    ' Reset the description of the active linetype
    ThisDrawing.ActiveLinetype.Description = currDescription
    MsgBox "The description of the active LineType is reset to: " & ThisDrawing.ActiveLinetype.Description, vbInformation, "Description Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Description()
    ;; This example returns the description of the active linetype.
    ;; It then changes the description of the active linetype.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; This example modifies the description of a linetype
    (setq currDescription (vla-get-Description (vla-get-ActiveLinetype doc)))
    (alert (strcat "The description of the active Linetype is: " currDescription))

    ;; Change the description of the active linetype
    (vla-put-Description (vla-get-ActiveLinetype doc) "My favorite LineType")
    (alert (strcat "The new description of the active Linetype is: " (vla-get-Description (vla-get-ActiveLinetype doc))))

    ;; Reset the description of the active linetype
    (vla-put-Description (vla-get-ActiveLinetype doc) currDescription)
    (alert (strcat "The description of the active Linetype is reset to: " currDescription))
)


DestinationBlock Property (ActiveX)

Specifies the destination block for section generation.

Supported platforms: Windows only

Signature

VBA:

object.DestinationBlock
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: Variant

The block generated from the section.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


DestinationFile Property (ActiveX)

Specifies the destination file for section generation.

Supported platforms: Windows only

Signature

VBA:

object.DestinationFile
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: String

The destination file generated from the section.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Diameter Property (ActiveX)

Specifies the diameter of a circle.

Supported platforms: Windows only

Signature

VBA:

object.Diameter
object

Type: Circle

The object this property applies to.

Property Value

Read-only: No

Type: Double

The diameter of the circle.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Diameter()
    ' This example creates a Circle object in model space and
    ' returns the diameter of the new Circle

    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double

    ' Define the new Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    radius = 5#

    ' Create the Circle object in model space
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)

    ThisDrawing.Application.ZoomAll

    MsgBox "The diameter of the new Circle is: " & circleObj.Diameter
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Diameter()
    ;; This example creates a Circle object in model space and
    ;; returns the diameter of the new Circle
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Circle object
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius 5)

    ;; Create the Circle object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))

    (vla-ZoomAll acadObj)

    (alert (strcat "The diameter of the new Circle is: " (rtos (vla-get-Diameter circleObj) 2)))
)


Dictionaries Property (ActiveX)

Gets the Dictionaries collection for the document.

Supported platforms: Windows only

Signature

VBA:

object.Dictionaries
object

Type: Database, Document

The objects this property applies to.

Property Value

Read-only: Yes

Type: Dictionaries

The Dictionaries collection for the document.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Dictionaries()
    ' This example finds the current dictionary collection and
    ' adds a new dictionary to that collection.

    Dim dict As AcadDictionary
    Set dict = ThisDrawing.Dictionaries.Add("TEST")
    MsgBox "A new dictionary called " & dict.name & " has been added to the dictionaries collection.", vbInformation, "Dictionaries Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Dictionaries()
    ;; This example finds the current dictionary collection and
    ;; adds a new dictionary to that collection.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dict (vla-Add (vla-get-Dictionaries doc) "TEST"))
    (alert (strcat "A new dictionary called " (vla-get-Name dict) " has been added to the dictionaries collection."))
)


DimConstrDesc Property (ActiveX)

Specifies a description for the constraint.

Supported platforms: Windows only

Signature

VBA:

object.DimConstrDesc
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimDiametric, DimRadial, DimRotated

The objects to which this property applies.

Property Value

Read-only: No

Type: String

The description for the constraint.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


DimConstrExpression Property (ActiveX)

Specifies the expression or value of the constraint.

Supported platforms: Windows only

Signature

VBA:

object.DimConstrExpression
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimDiametric, DimRadial, DimRotated

The objects to which this property applies.

Property Value

Read-only: No

Type: String

The expression or value of the constraint.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


DimConstrForm Property (ActiveX)

Specifies the type of constraint.

Supported platforms: Windows only

Signature

VBA:

object.DimConstrForm
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimDiametric, DimRadial, DimRotated

The objects to which this property applies.

Property Value

Read-only: No

Type: Boolean

  • True: Dynamic
  • False: Annotational

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


DimConstrName Property (ActiveX)

Specifies a name for the constraint.

Supported platforms: Windows only

Signature

VBA:

object.DimConstrName
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimDiametric, DimRadial, DimRotated

The objects to which this property applies.

Property Value

Read-only: No

Type: String

The name for the constraint.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


DimConstrReference Property (ActiveX)

Specifies the parameter is a reference constraint.

Supported platforms: Windows only

Signature

VBA:

object.DimConstrReference
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimDiametric, DimRadial, DimRotated

The objects to which this property applies.

Property Value

Read-only: No

Type: Boolean

  • True: A reference dimension
  • False: Not a reference dimension

Remarks

Reference dimensions can be used in expressions, but cannot control geometry.

Examples

VBA:

Not available

Visual LISP:

Not available


DimConstrValue Property (ActiveX)

Specifies the value of the constraint.

Supported platforms: Windows only

Signature

VBA:

object.DimConstrValue
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimDiametric, DimRadial, DimRotated

The objects to which this property applies.

Property Value

Read-only: No

Type: String

The value of the constraint.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


DimensionLineColor Property (ActiveX)

Specifies the color of the dimension line for a dimension, leader, or tolerance object.

Supported platforms: Windows only

Signature

VBA:

object.DimensionLineColor
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimRadial, DimRadialLarge, DimRotated, Leader, Tolerance

The objects this property applies to.

Property Value

Read-only: No

Type: acColor enum

Use a color index number from 0 to 256, or one of the constants listed here:

  • acByBlock
  • acByLayer
  • acRed
  • acYellow
  • acGreen
  • acCyan
  • acBlue
  • acMagenta
  • acWhite

Remarks

Colors can be set and read as numeric index values ranging from 0 to 256. Constants have been provided for the standard seven colors, as well as the BYBLOCK and BYLAYER designations.

If you use acByBlock, AutoCAD draws new objects in the default color (white or black, depending on your configuration) until they are grouped into the block. When the block is inserted in the drawing, the objects in the block inherit the current setting of the color property.

If you use acByLayer, new objects assume the color of the layer upon which they are drawn.

When you assign color to a dimension object, the color applies to the dimension lines, arrowheads, and dimension leader lines.

NoteThis property overrides the value of the DIMCLRD system variable for the given dimension, leader, or tolerance object.

Examples

VBA:

Sub Example_DimensionLineColor()
    ' This example creates a Dim3PointAngular object in model space
    ' and changes the dimension line color to red using the DimensionLineColor property

    Dim DimPointAngularObj As AcadDim3PointAngular
    Dim AngleVertex(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double

    ' Define the new Dim3PointAngular object
    AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
    FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
    SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
    TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

    ' Create the new Dim3PointAngular object in model space
    Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)
    ThisDrawing.Application.ZoomAll

    ' Read and display current dimension line color
    MsgBox "The dimension line color for this object is currently set to: " & DimPointAngularObj.DimensionLineColor

    ' Change the dimension line color
    DimPointAngularObj.DimensionLineColor = acRed
    ThisDrawing.Regen acAllViewports

    ' Read and display current dimension line color
    MsgBox "The dimension line color for this object is now set to: " & DimPointAngularObj.DimensionLineColor & " (Red)"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DimensionLineColor()
    ;; This example creates a Dim3PointAngular object in model space
    ;; and changes the dimension line color to red using the DimensionLineColor property
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Dim3PointAngular object
    (setq AngleVertex (vlax-3d-point 0 0 0)
          FirstPoint (vlax-3d-point 2 2 0)
          SecondPoint (vlax-3d-point 1 4 0)
          TextPoint (vlax-3d-point 6 6 0))

    ;; Create the new Dim3PointAngular object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq DimPointAngularObj (vla-AddDim3PointAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    ;; Read and display current dimension line color
    (alert (strcat "The dimension line color for this object is currently set to: " (itoa (vla-get-DimensionLineColor DimPointAngularObj))))

    ;; Change the dimension line color
    (vla-put-DimensionLineColor DimPointAngularObj acRed)
    (vla-Regen doc acAllViewports)

    ;; Read and display current dimension line color
    (alert (strcat "The dimension line color for this object is now set to: " (itoa (vla-get-DimensionLineColor DimPointAngularObj)) " (Red)"))
)


DimensionLineExtend Property (ActiveX)

Specifies the distance the dimension line extends beyond the extension line when oblique strokes are drawn instead of arrowheads.

Supported platforms: Windows only

Signature

VBA:

object.DimensionLineExtend
object

Type: DimAligned, DimArcLength, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Double

A positive real number specifying the distance to extend the dimension line beyond the extension line.

Remarks

The initial value for this property is 0.0000.

NoteThis property overrides the value of the DIMDLE system variable for the given dimension.

Examples

VBA:

Sub Example_DimensionLineExtend()
   ' This example creates an aligned dimension in model space and
   ' uses DimensionLineExtend to specify the distance the dimension
   ' line extends beyond the extension line when oblique strokes are
   ' drawn instead of arrowheads

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 10.123: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    dimObj.Arrowhead1Type = acArrowOblique
    dimObj.Arrowhead2Type = acArrowOblique

    ThisDrawing.Application.ZoomAll

    MsgBox "A new Dimension has been created.  Press any key to extend the dimension lines."

    ' Round the distance of the alternate dimension to 0.50 of a unit
    dimObj.DimensionLineExtend = 2
    ThisDrawing.Regen acAllViewports

    MsgBox "The dimension lines have been extended to: " & dimObj.DimensionLineExtend
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DimensionLineExtend()
    ;; This example creates an aligned dimension in model space and
    ;; uses DimensionLineExtend to specify the distance the dimension
    ;; line extends beyond the extension line when oblique strokes are
    ;; drawn instead of arrowheads
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 10.123 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-put-Arrowhead1Type dimObj acArrowOblique)
    (vla-put-Arrowhead2Type dimObj acArrowOblique)

    (vla-ZoomAll acadObj)

    (alert "A new Dimension has been created.")

    ;; Round the distance of the alternate dimension to 0.50 of a unit
    (vla-put-DimensionLineExtend dimObj 2)
    (vla-Regen doc acAllViewports)

    (alert (strcat "The dimension lines have been extended to: " (rtos (vla-get-DimensionLineExtend dimObj) 2)))
)


DimensionLinetype Property (ActiveX)

Specifies the linetype of the dimension line.

Supported platforms: Windows only

Signature

VBA:

object.DimensionLinetype
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: String

The name of the linetype assigned to the dimension line.

Remarks

NoteThis property overrides the value of the DIMLTYPE system variable for the given dimension.

Examples

VBA:

Not available

Visual LISP:

Not available


DimensionLineWeight Property (ActiveX)

Specifies the lineweight for the dimension lines.

Supported platforms: Windows only

Signature

VBA:

object.DimensionLineWeight
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimRadial, DimRadialLarge, DimRotated, Leader

The objects this property applies to.

Property Value

Read-only: No

Type: acLineWeight enum

  • acLnWtByLayer
  • acLnWtByBlock
  • acLnWtByLwDefault
  • acLnWt000
  • acLnWt005
  • acLnWt009
  • acLnWt013
  • acLnWt015
  • acLnWt018
  • acLnWt020
  • acLnWt025
  • acLnWt030
  • acLnWt035
  • acLnWt040
  • acLnWt050
  • acLnWt053
  • acLnWt060
  • acLnWt070
  • acLnWt080
  • acLnWt090
  • acLnWt100
  • acLnWt106
  • acLnWt120
  • acLnWt140
  • acLnWt158
  • acLnWt200
  • acLnWt211

Remarks

The initial value for this property is acLnWtByBlock.

Lineweight settings are only visible when the LineweightDisplay property is set to True.

Examples

VBA:

Sub Example_DimensionLineWeight()
    ' This example creates a Dim3PointAngular object in model space
    ' and changes the dimension lineweight to a thicker value
    ' using the DimensionLineWeight property

    Dim DimPointAngularObj As AcadDim3PointAngular
    Dim AngleVertex(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double
    Dim oldLWSetting As Boolean
    Dim CurrentSetting As String

    ' Turn on lineweight display so the changes can be seen
    oldLWSetting = ThisDrawing.preferences.LineWeightDisplay
    ThisDrawing.preferences.LineWeightDisplay = True

    ' Define the new Dim3PointAngular object
    AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
    FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
    SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
    TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

    ' Create the new Dim3PointAngular object in model space
    Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)
    ThisDrawing.Application.ZoomAll

    ' Read and display current dimension lineweight
    CurrentSetting = DimPointAngularObj.DimensionLineWeight
    Select Case CurrentSetting
        Case acLnWtByLayer: CurrentSetting = "ByLayer"
        Case acLnWtByBlock: CurrentSetting = "ByBlock"
        Case acLnWtByLwDefault: CurrentSetting = "ByDefault"
        Case Else
    End Select

    MsgBox "The dimension lineweight setting for this object is currently set to: " & CurrentSetting

    ' Change the dimension lineweight
    DimPointAngularObj.DimensionLineWeight = acLnWt100
    ThisDrawing.Regen acAllViewports

    ' Read and display current dimension lineweight
    MsgBox "The dimension lineweight setting for this object is now set to: " & DimPointAngularObj.DimensionLineWeight

    ' Return previous lineweight setting
    ThisDrawing.preferences.LineWeightDisplay = oldLWSetting

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DimensionLineWeight()
    ;; This example creates a Dim3PointAngular object in model space
    ;; and changes the dimension lineweight to a thicker value
    ;; using the DimensionLineWeight property
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences doc))

    ;; Turn on lineweight display so the changes can be seen
    (setq oldLWSetting (vla-get-LineWeightDisplay preferences))
    (vla-put-LineWeightDisplay preferences :vlax-true)

    ;; Define the new Dim3PointAngular object
    (setq AngleVertex (vlax-3d-point 0 0 0)
          FirstPoint (vlax-3d-point 2 2 0)
          SecondPoint (vlax-3d-point 1 4 0)
          TextPoint (vlax-3d-point 6 6 0))

    ;; Create the new Dim3PointAngular object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq DimPointAngularObj (vla-AddDim3PointAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    ;; Read and display current dimension lineweight
    (setq CurrentSetting (vla-get-DimensionLineWeight DimPointAngularObj))
    (cond
        ((= acLnWtByLayer CurrentSetting)(setq CurrentSetting "ByLayer"))
        ((= acLnWtByBlock CurrentSetting)(setq CurrentSetting "ByBlock"))
        ((= acLnWtByLwDefault CurrentSetting)(setq CurrentSetting "ByDefault"))
    (setq CurrentSetting (itoa CurrentSetting))
    )

    (alert (strcat "The dimension lineweight setting for this object is currently set to: " CurrentSetting))

    ;; Change the dimension lineweight
    (vla-put-DimensionLineWeight DimPointAngularObj acLnWt100)
    (vla-Regen doc acAllViewports)

    ;; Read and display current dimension lineweight
    (alert (strcat "The dimension lineweight setting for this object is now set to: " (itoa (vla-get-DimensionLineWeight DimPointAngularObj))))

    ;; Return previous lineweight setting
    (vla-put-DimensionLineWeight DimPointAngularObj oldLWSetting)
)


DimLine1Suppress Property (ActiveX)

Specifies the suppression of the first dimension line.

Supported platforms: Windows only

Signature

VBA:

object.DimLine1Suppress
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress the first dimension line.
  • False: Do not suppress the first dimension line.

Remarks

The initial value for this property is False.

When this property is set to True, the display of the dimension line and arrowhead between the first extension line and the text is suppressed.

NoteThis property overrides the value of the DIMSD1 system variable for the given dimension.

Examples

VBA:

Sub Example_DimensionLine1Suppress()
    ' This example creates a Dim3PointAngular object in model space
    ' and suppresses the dimension lines using the DimensionLine1Suppress
    ' and DimensionLine2Suppress properties

    Dim DimPointAngularObj As AcadDim3PointAngular
    Dim AngleVertex(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double
    Dim Line1Suppressed As String, Line2Suppressed As String

    ' Define the new Dim3PointAngular object
    AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
    FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
    SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
    TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

    ' Create the new Dim3PointAngular object in model space
    Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)
    ThisDrawing.Application.ZoomAll

    ' Read and display current line suppression information
    Line1Suppressed = IIf(DimPointAngularObj.DimLine1Suppress, "is suppressed", "is not suppressed")
    Line2Suppressed = IIf(DimPointAngularObj.DimLine2Suppress, "is suppressed", "is not suppressed")

    MsgBox "Line one of the dimension " & Line1Suppressed & vbCrLf & _
           "Line two of the dimension " & Line2Suppressed

    ' Suppress line one of the dimension
    DimPointAngularObj.DimLine1Suppress = True
    ThisDrawing.Regen acAllViewports
    MsgBox "Line one of the dimension is now suppressed"

    ' Suppress line two of the dimension
    DimPointAngularObj.DimLine2Suppress = True
    ThisDrawing.Regen acAllViewports
    MsgBox "Line two of the dimension is now suppressed"

    ' Turn both dimension lines back on
    DimPointAngularObj.DimLine1Suppress = False
    DimPointAngularObj.DimLine2Suppress = False
    ThisDrawing.Regen acAllViewports
    MsgBox "Both dimension lines are now visible again"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DimensionLine1Suppress()
    ;; This example creates a Dim3PointAngular object in model space
    ;; and suppresses the dimension lines using the DimensionLine1Suppress
    ;; and DimensionLine2Suppress properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Dim3PointAngular object
    (setq AngleVertex (vlax-3d-point 0 0 0)
          FirstPoint (vlax-3d-point 2 2 0)
          SecondPoint (vlax-3d-point 1 4 0)
          TextPoint (vlax-3d-point 6 6 0))

    ;; Create the new Dim3PointAngular object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq DimPointAngularObj (vla-AddDim3PointAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    ;; Read and display current line suppression information
    (setq Line1Suppressed (if (= (vla-get-DimLine1Suppress DimPointAngularObj) :vlax-true) "is suppressed" "is not suppressed"))
    (setq Line2Suppressed (if (= (vla-get-DimLine2Suppress DimPointAngularObj) :vlax-true) "is suppressed" "is not suppressed"))

    (alert (strcat "Line one of the dimension " Line1Suppressed
                   "\nLine two of the dimension " Line2Suppressed))

    ;; Suppress line one of the dimension
    (vla-put-DimLine1Suppress DimPointAngularObj :vlax-true)
    (vla-Regen doc acAllViewports)
    (alert "Line one of the dimension is now suppressed")

    ;; Suppress line two of the dimension
    (vla-put-DimLine2Suppress DimPointAngularObj :vlax-true)
    (vla-Regen doc acAllViewports)
    (alert "Line two of the dimension is now suppressed")

    ;; Turn both dimension lines back on
    (vla-put-DimLine1Suppress DimPointAngularObj :vlax-false)
    (vla-put-DimLine2Suppress DimPointAngularObj :vlax-false)
    (vla-Regen doc acAllViewports)
    (alert "Both dimension lines are now visible again")
)


DimLine2Suppress Property (ActiveX)

Specifies the suppression of the second dimension line.

Supported platforms: Windows only

Signature

VBA:

object.DimLine2Suppress
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress the second dimension line.
  • False: Do not suppress the second dimension line.

Remarks

The initial value for this property is False.

When this property is set to True, the display of the dimension line and arrowhead between the second extension line and the text is suppressed.

NoteThis property overrides the value of the DIMSD2 system variable for the given dimension.

Examples

VBA:

Sub Example_DimensionLine2Suppress()
    ' This example creates a Dim3PointAngular object in model space
    ' and suppresses the dimension lines using the DimensionLine1Suppress
    ' and DimensionLine2Suppress properties

    Dim DimPointAngularObj As AcadDim3PointAngular
    Dim AngleVertex(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double
    Dim Line1Suppressed As String, Line2Suppressed As String

    ' Define the new Dim3PointAngular object
    AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
    FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
    SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
    TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

    ' Create the new Dim3PointAngular object in model space
    Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)
    ThisDrawing.Application.ZoomAll

    ' Read and display current line suppression information
    Line1Suppressed = IIf(DimPointAngularObj.DimLine1Suppress, "is suppressed", "is not suppressed")
    Line2Suppressed = IIf(DimPointAngularObj.DimLine2Suppress, "is suppressed", "is not suppressed")

    MsgBox "Line one of the dimension " & Line1Suppressed & vbCrLf & _
           "Line two of the dimension " & Line2Suppressed

    ' Suppress line one of the dimension
    DimPointAngularObj.DimLine1Suppress = True
    ThisDrawing.Regen acAllViewports
    MsgBox "Line one of the dimension is now suppressed"

    ' Suppress line two of the dimension
    DimPointAngularObj.DimLine2Suppress = True
    ThisDrawing.Regen acAllViewports
    MsgBox "Line two of the dimension is now suppressed"

    ' Turn both dimension lines back on
    DimPointAngularObj.DimLine1Suppress = False
    DimPointAngularObj.DimLine2Suppress = False
    ThisDrawing.Regen acAllViewports
    MsgBox "Both dimension lines are now visible again"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DimensionLine2Suppress()
    ;; This example creates a Dim3PointAngular object in model space
    ;; and suppresses the dimension lines using the DimensionLine1Suppress
    ;; and DimensionLine2Suppress properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Dim3PointAngular object
    (setq AngleVertex (vlax-3d-point 0 0 0)
          FirstPoint (vlax-3d-point 2 2 0)
          SecondPoint (vlax-3d-point 1 4 0)
          TextPoint (vlax-3d-point 6 6 0))

    ;; Create the new Dim3PointAngular object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq DimPointAngularObj (vla-AddDim3PointAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    ;; Read and display current line suppression information
    (setq Line1Suppressed (if (= (vla-get-DimLine1Suppress DimPointAngularObj) :vlax-true) "is suppressed" "is not suppressed"))
    (setq Line2Suppressed (if (= (vla-get-DimLine2Suppress DimPointAngularObj) :vlax-true) "is suppressed" "is not suppressed"))

    (alert (strcat "Line one of the dimension " Line1Suppressed
                   "\nLine two of the dimension " Line2Suppressed))

    ;; Suppress line one of the dimension
    (vla-put-DimLine1Suppress DimPointAngularObj :vlax-true)
    (vla-Regen doc acAllViewports)
    (alert "Line one of the dimension is now suppressed")

    ;; Suppress line two of the dimension
    (vla-put-DimLine2Suppress DimPointAngularObj :vlax-true)
    (vla-Regen doc acAllViewports)
    (alert "Line two of the dimension is now suppressed")

    ;; Turn both dimension lines back on
    (vla-put-DimLine1Suppress DimPointAngularObj :vlax-false)
    (vla-put-DimLine2Suppress DimPointAngularObj :vlax-false)
    (vla-Regen doc acAllViewports)
    (alert "Both dimension lines are now visible again")
)


DimLineInside Property (ActiveX)

Specifies the display of dimension lines inside the extension lines only.

Supported platforms: Windows only

Signature

VBA:

object.DimLineInside
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress the display of dimension lines outside the extension lines.
  • False: Display dimension lines outside the extension lines.

Remarks

The initial value for this property is False.

NoteThis property overrides the value of the DIMSOXD system variable for the given dimension.

Examples

VBA:

Sub Example_DimLineInside()
    ' This example creates a DimAligned object in model space
    ' and toggles the dimension lines to be both allowed and disallowed
    ' outside the extension lines

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim CurrentValue As String

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 6: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ThisDrawing.Application.ZoomAll

    ' Read and display current line suppression information
    CurrentValue = IIf(dimObj.DimLineInside, "are not", "are")
    MsgBox "Dimension lines " & CurrentValue & " allowed outside the extension lines"

    ' Suppress the display of dimension lines outside the extension lines
    dimObj.DimLineInside = True
    ThisDrawing.Regen acAllViewports
    MsgBox "Dimension lines are not allowed outside the extension lines"

    ' Allow the display of dimension lines outside the extension lines (default)
    dimObj.DimLineInside = False
    ThisDrawing.Regen acAllViewports
    MsgBox "Dimension lines are allowed outside the extension lines"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DimLineInside()
    ;; This example creates a DimAligned object in model space
    ;; and toggles the dimension lines to be both allowed and disallowed
    ;; outside the extension lines
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 6 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    ;; Read and display current line suppression information
    (setq CurrentValue (if (= (vla-get-DimLineInside dimObj) :vlax-true) "are not" "are"))
    (alert (strcat "Dimension lines " CurrentValue " allowed outside the extension lines"))

    ;; Suppress the display of dimension lines outside the extension lines
    (vla-put-DimLineInside dimObj :vlax-true)
    (vla-Regen doc acAllViewports)
    (alert "Dimension lines are not allowed outside the extension lines")

    ;; Allow the display of dimension lines outside the extension lines (default)
    (vla-put-DimLineInside dimObj :vlax-false)
    (vla-Regen doc acAllViewports)
    (alert "Dimension lines are allowed outside the extension lines")
)


DimLineSuppress Property (ActiveX)

Specifies the suppression of the dimension line for radial dimensions.

Supported platforms: Windows only

Signature

VBA:

object.DimLineSuppress
object

Type: DimRadial, DimRadialLarge

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress the dimension line.
  • False: Do not suppress the dimension line.

Remarks

The initial value for this property is False.

When this property is set to True, the display of the dimension line and arrowhead between the extension line and the text is suppressed.

NoteThis property overrides the value of the DIMSD2 system variable.

Examples

VBA:

Sub Example_DimLineSuppress()
   ' This example creates a Radial Dimension in model space and
   ' uses the DimLineSuppress property to toggle the display
   ' of the dimension lines

    Dim dimObj As AcadDimRadial
    Dim center(0 To 2) As Double
    Dim chordPoint(0 To 2) As Double
    Dim leaderLen As Integer

    ' Define the dimension
    center(0) = 0: center(1) = 0: center(2) = 0
    chordPoint(0) = 5: chordPoint(1) = 5: chordPoint(2) = 0
    leaderLen = 5

    ' Create the radial dimension in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimRadial(center, chordPoint, leaderLen)
    ThisDrawing.Application.ZoomAll

    MsgBox "The radial dimension has been created.", vbInformation

    dimObj.DimLineSuppress = Not (dimObj.DimLineSuppress)
    ThisDrawing.Application.ZoomAll

    MsgBox "The radial dimension appearance has been modified.", vbInformation
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DimLineSuppress()
    ;; This example creates a Radial Dimension in model space and
    ;; uses the DimLineSuppress property to toggle the display
    ;; of the dimension lines
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq center (vlax-3d-point 0 0 0)
          chordPoint (vlax-3d-point 5 5 0)
          leaderLen 5)

    ;; Create the radial dimension in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimRadial modelSpace center chordPoint leaderLen))
    (vla-ZoomAll acadObj)

    (alert "The radial dimension has been created.")

    (vla-put-DimLineSuppress dimObj (if (= (vla-get-DimLineSuppress dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-ZoomAll acadObj)

    (alert "The radial dimension appearance has been modified.")
)


DimStyles Property (ActiveX)

Gets the DimStyles collection for the document.

Supported platforms: Windows only

Signature

VBA:

object.DimStyles
object

Type: Database, Document

The objects this property applies to.

Property Value

Read-only: Yes

Type: DimStyles

The DimStyles collection for the document.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_DimStyles()
    ' This example adds a new dimension style.
    Dim dimStyle As AcadDimStyle
    Set dimStyle = ThisDrawing.DimStyles.Add("TEST")
    MsgBox "A new dimension style called " & dimStyle.name & " has been added to the Dimstyles collection.", vbInformation, "Dimstyles Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DimStyles()
    ;; This example adds a new dimension style.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dimStyle (vla-Add (vla-get-DimStyles doc) "TEST"))
    (alert (strcat "A new dimension style called " (vla-get-Name dimStyle) " has been added to the Dimstyles collection."))
)


DimTxtDirection Property (ActiveX)

Specifies the direction of the dimension text.

Supported platforms: Windows only

Signature

VBA:

object.DimTxtDirection
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • False: Displays dimension text in a Left-to-Right reading style
  • True: Displays dimension text in a Right-to-Left reading style

Remarks

NoteThis property overrides the value of the DIMTXTDIRECTION system variable for the given dimension.

Examples

VBA:

Not available

Visual LISP:

Not available


Direction Property (ActiveX)

Specifies the viewing direction for a 3D visualization of the drawing, or the direction vector of the table.

Supported platforms: Windows only

Signature

VBA:

object.Direction
object

Type: ExtrudedSurface, PViewport, Table, View, Viewport

The objects this property applies to.

Property Value

Read-only: No

Type: Variant

Table objects: The vector (X axis, in WCS coordinates) defines the horizontal plane containing the table.

All other objects: The vector is a three-element array of doubles that defines a direction from which the drawing can be viewed.

Remarks

This property puts the viewer in a position to look at the drawing as if looking back at the origin (0, 0, 0) from a specified point in space. This property is similar to the VPOINT command in AutoCAD.

Examples

VBA:

Sub Example_Direction()
    ' This example creates a circle in model space
    ' and changes the thickness of the circle. Once
    ' the thickness has been changed, the direction
    ' of the active viewport is changed so that the
    ' new thickness setting is visible.

    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double

    ' Define the circle
    centerPoint(0) = 0#: centerPoint(1) = 0#: centerPoint(2) = 0#
    radius = 5#

    ' Create the Circle object in model space
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)

    ' Change the thickness of the circle
    circleObj.Thickness = 3

    ' Change the direction of the viewport so that you can
    ' view the change made to the thickness. Once you change
    ' the direction, you must reset the active viewport.
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport

End Sub

Sub example_tableDirection()
    Dim oMS As AcadModelSpace
    Set oMS = ThisDrawing.ModelSpace
    Dim oT As AcadTable
    Dim pt(2) As Double
    Set oT = oMS.AddTable(pt, 4, 5, 5, 20)
    ZoomExtents
    Dim vDirection As Variant
    vDirection = oT.Direction
    MsgBox "Table Direction vector is " & vbCrLf & vDirection(0) & "," & vDirection(1) & "," & vDirection(2)

    Dim vNewDirection(2) As Double
    vNewDirection(0) = 0
    vNewDirection(1) = 1
    vNewDirection(2) = 0
    oT.Direction = vNewDirection

    Dim vRetDirection As Variant
    vRetDirection = oT.Direction
    MsgBox "New Table Direction vector is " & vbCrLf & vRetDirection(0) & "," & vRetDirection(1) & "," & vRetDirection(2)
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Direction()
    ;; This example creates a circle in model space
    ;; and changes the thickness of the circle. Once
    ;; the thickness has been changed, the direction
    ;; of the active viewport is changed so that the
    ;; new thickness setting is visible.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the circle
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius 5)

    ;; Create the Circle object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))

    ;; Change the thickness of the circle
    (vla-put-Thickness circleObj 3)

    ;; Change the direction of the viewport so that you can
    ;; view the change made to the thickness. Once you change
    ;; the direction, you must reset the active viewport.
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
)

(defun c:Example_TableDirection()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    (setq pt (vlax-3d-point 0 0 0)
          oT (vla-AddTable modelSpace pt 4 5 5 20))

    (vla-ZoomExtents acadObj)
    (setq vDirection (vlax-safearray->list (vlax-variant-value (vla-get-Direction oT))))
    (alert (strcat "Table Direction vector is "
               "\n" (rtos (nth 0 vDirection) 2) "," (rtos (nth 1 vDirection) 2) "," (rtos (nth 2 vDirection) 2)))

    (setq vNewDirection (vlax-3d-point 0 1 0))
    (vla-put-Direction oT vNewDirection)

    (setq vRetDirection (vlax-safearray->list (vlax-variant-value (vla-get-Direction oT))))
    (alert (strcat "New Table Direction vector is "
               "\n" (rtos (nth 0 vRetDirection) 2) "," (rtos (nth 1 vRetDirection) 2) "," (rtos (nth 2 vRetDirection) 2)))
)


DirectionVector Property (ActiveX)

Specifies the direction for the ray, tolerance, or xline through a vector.

Supported platforms: Windows only

Signature

VBA:

object.DirectionVector
object

Type: Ray, Tolerance, XLine

The objects this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

The direction for the ray, tolerance, or construction line (XLine).

Remarks

No additional remarks.

Examples

VBA:

Sub Example_DirectionVector()
    ' This example creates a ray and then changes the direction vector
    ' for the ray.

    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    Dim newDirectionVec(0 To 2) As Double

    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#

    ' Create a Ray object in model space
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)
    ZoomAll
    MsgBox "The ray has a direction vector of " & rayObj.DirectionVector(0) & ", " & rayObj.DirectionVector(1) & ", " & rayObj.DirectionVector(2), vbInformation, "DirectionVector Example"

    ' Change the direction vector
    newDirectionVec(0) = 3#: newDirectionVec(1) = 1#: newDirectionVec(2) = 0#
    rayObj.DirectionVector = newDirectionVec

    ' Query the new direction vector for the Ray
    Dim retDir As Variant            ' Note that return from DirectionVector property is Variant and not a SafeArray
    retDir = rayObj.DirectionVector

    ThisDrawing.Regen True
    MsgBox "The direction vector of the ray has been changed to " & rayObj.DirectionVector(0) & ", " & rayObj.DirectionVector(1) & ", " & rayObj.DirectionVector(2), vbInformation, "DirectionVector Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DirectionVector()
    ;; This example creates a ray and then changes the direction vector
    ;; for the ray.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq basePoint (vlax-3d-point 3 3 0)
          SecondPoint (vlax-3d-point 1 3 0))

    ;; Create a Ray object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq rayObj (vla-AddRay modelSpace basePoint SecondPoint))
    (vla-ZoomAll acadObj)

    (setq vDirection (vlax-safearray->list (vlax-variant-value (vla-get-DirectionVector rayObj))))
    (alert (strcat "The ray has a direction vector of "
               "\n" (rtos (nth 0 vDirection) 2) "," (rtos (nth 1 vDirection) 2) "," (rtos (nth 2 vDirection) 2)))

    ;; Change the direction vector
    (setq newDirectionVec (vlax-3d-point 3 1 0))
    (vla-put-DirectionVector rayObj newDirectionVec)

    ;; Query the new direction vector for the Ray
    (setq retDir (vlax-safearray->list (vlax-variant-value (vla-get-DirectionVector rayObj))))

    (vla-Regen doc :vlax-true)
    (alert (strcat "The direction vector of the ray has been changed to "
               "\n" (rtos (nth 0 retDir) 2) "," (rtos (nth 1 retDir) 2) "," (rtos (nth 2 retDir) 2)))
)


Display Property (ActiveX)

Gets the PreferencesDisplay object.

Supported platforms: Windows only

Signature

VBA:

object.Display
object

Type: Preferences

The object this property applies to.

Property Value

Read-only: Yes

Type: PreferencesDisplay

Gets the PreferencesDisplay object.

Remarks

The PreferencesDisplay object holds all the options from the Display tab on the Options dialog stored in the registry. All options that are stored with the drawing can be found on the DatabasePreferences object.

Examples

VBA:

Sub Example_Display()
    ' This example obtains a reference to the Display Preferences object
    ' from the Application Preferences object, and reads one of the Display
    ' preferences

    Dim ACADPref As AcadPreferencesDisplay

    ' Obtain a reference to the Display Preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.Display

    MsgBox "We now have access to the properties and methods of the Display Preferences object!"
    MsgBox "The Display preference CursorSize is set to: " & ACADPref.CursorSize

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Display()
    ;; This example obtains a reference to the Display Preferences object
    ;; from the Application Preferences object, and reads one of the Display
    ;; preferences
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Obtain a reference to the Display Preferences object
    (setq ACADPref (vla-get-Display preferences))

    (alert "We now have access to the properties and methods of the Display Preferences object!")
    (alert (strcat "The Display preference CursorSize is set to: " (itoa (vla-get-CursorSize ACADPref))))
)


DisplayGrips Property (ActiveX)

Controls the display of selection set grips for the Stretch, Move, Rotate, Scale, and Mirror grip modes.

Supported platforms: Windows only

Signature

VBA:

object.DisplayGrips
object

Type: PreferencesSelection

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Display grips.
  • False: Do not display grips.

Remarks

The initial value of this property is True.

To adjust the size of the grips and the effective selection area used by the cursor when you snap to a grip, use the GripSize property.

To adjust the color of selected or unselected grips, use the GripColorSelected or GripColorUnselected properties.

NoteThe value for this property is stored in the GRIPS system variable.

Examples

VBA:

Sub Example_DisplayGrips()
    ' This example reads and modifies the preference value that controls
    ' the display of selection set grips for the Stretch, Move, Rotate,
    ' Scale, and Mirror grip modes.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesSelection
    Dim originalValue As Variant, newValue As Variant

    ' Get the selection preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.Selection

    ' Read and display the original value
    originalValue = ACADPref.DisplayGrips
    MsgBox "The DisplayGrips preference is set to: " & originalValue

    ' Modify the DisplayGrips preference by toggling the value
    ACADPref.DisplayGrips = Not (originalValue)
    newValue = ACADPref.DisplayGrips
    MsgBox "The DisplayGrips preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.DisplayGrips = originalValue
    MsgBox "The DisplayGrips preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DisplayGrips()
    ;; This example reads and modifies the preference value that controls
    ;; the display of selection set grips for the Stretch, Move, Rotate,
    ;; Scale, and Mirror grip modes.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the selection preferences object
    (setq ACADPref (vla-get-Selection preferences))

    ;; Read and display the original value
    (setq originalValue (vla-get-DisplayGrips ACADPref))
    (alert (strcat "The DisplayGrips preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the DisplayGrips preference by toggling the value
    (vla-put-DisplayGrips ACADPref (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-DisplayGrips ACADPref))
    (alert (strcat "The DisplayGrips preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-DisplayGrips ACADPref originalValue)
    (alert (strcat "The DisplayGrips preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


DisplayGripsWithinBlocks Property (ActiveX)

Controls the assignment of grips within blocks.

Supported platforms: Windows only

Signature

VBA:

object.DisplayGripsWithinBlocks
object

Type: PreferencesSelection

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Assigns grips to objects within the block.
  • False: Assigns a grip only to the insertion point of the block.

Remarks

The initial value of this property is False.

NoteThe value for this property is stored in the GRIPBLOCK system variable.

Examples

VBA:

Sub Example_DisplayGripsWithinBlocks()
    ' This example reads and modifies the preference value that controls
    ' the assignment of grips within blocks.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesSelection
    Dim originalValue As Variant, newValue As Variant

    ' Get the selection preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.Selection

    ' Read and display the original value
    originalValue = ACADPref.DisplayGripsWithinBlocks
    MsgBox "The DisplayGripsWithinBlocks preference is set to: " & originalValue

    ' Modify the DisplayGripsWithinBlocks preference by toggling the value
    ACADPref.DisplayGripsWithinBlocks = Not (originalValue)
    newValue = ACADPref.DisplayGripsWithinBlocks
    MsgBox "The DisplayGripsWithinBlocks preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.DisplayGripsWithinBlocks = originalValue
    MsgBox "The DisplayGripsWithinBlocks preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DisplayGripsWithinBlocks()
    ;; This example reads and modifies the preference value that controls
    ;; the assignment of grips within blocks.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the selection preferences object
    (setq ACADPref (vla-get-Selection preferences))

    ;; Read and display the original value
    (setq originalValue (vla-get-DisplayGripsWithinBlocks ACADPref))
    (alert (strcat "The DisplayGripsWithinBlocks preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the DisplayGripsWithinBlocks preference by toggling the value
    (vla-put-DisplayGripsWithinBlocks ACADPref (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-DisplayGripsWithinBlocks ACADPref))
    (alert (strcat "The DisplayGripsWithinBlocks preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-DisplayGripsWithinBlocks ACADPref originalValue)
    (alert (strcat "The DisplayGripsWithinBlocks preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


DisplayLayoutTabs Property (ActiveX)

Specifies whether to display the Model and layout tabs in the drawing editor.

Supported platforms: Windows only

Signature

VBA:

object.DisplayLayoutTabs
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Display the Model and layout tabs.
  • False: Do not display the Model and layout tabs.

Remarks

The initial value for this property is True.

Examples

VBA:

Sub Example_DisplayLayoutTabs()
    ' This example reads and modifies the preference value that controls
    ' the display of the Model and layout tabs. When finished, this example
    ' resets the preference value back to its original value.

    Dim ACADPref As AcadPreferencesDisplay
    Dim originalValue As Variant, newValue As Variant

    ' Get the display preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.DISPLAY

    ' Read and display the original value
    originalValue = ACADPref.DisplayLayoutTabs
    MsgBox "The DisplayLayoutTabs preference is set to: " & originalValue

    ' Modify the DisplayLayoutTabs preference by toggling the value
    ACADPref.DisplayLayoutTabs = Not (originalValue)
    newValue = ACADPref.DisplayLayoutTabs
    MsgBox "The DisplayLayoutTabs preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.DisplayLayoutTabs = originalValue
    MsgBox "The DisplayLayoutTabs preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DisplayLayoutTabs()
    ;; This example reads and modifies the preference value that controls
    ;; the display of the Model and layout tabs. When finished, this example
    ;; resets the preference value back to its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the display preferences object
    (setq ACADPref (vla-get-Display preferences))

    ;; Read and display the original value
    (setq originalValue (vla-get-DisplayLayoutTabs ACADPref))
    (alert (strcat "The DisplayLayoutTabs preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the DisplayLayoutTabs preference by toggling the value
    (vla-put-DisplayLayoutTabs ACADPref (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-DisplayLayoutTabs ACADPref))
    (alert (strcat "The DisplayLayoutTabs preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-DisplayLayoutTabs ACADPref originalValue)
    (alert (strcat "The DisplayLayoutTabs preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


DisplayLocked Property (ActiveX)

Specifies whether the viewport is locked.

Supported platforms: Windows only

Signature

VBA:

object.DisplayLocked
object

Type: PViewport

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The viewport is locked.
  • False: The viewport is not locked.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_DisplayLocked()
    ' This example scans the current drawing paper space Viewports
    ' and displays whether or not any of them are locked.

    Dim pviewportObj As Object
    Dim msg As String, DisplayState As String

    ' Make sure this drawing contains paper space viewports before continuing
    If ThisDrawing.PaperSpace.Count = 0 Then
        MsgBox "There are no paper space viewports in the current drawing."
        Exit Sub
    End If

    ' Go through each PViewport object in the drawing paper space
    ' and determine whether the paper space viewport is locked or not

    For Each pviewportObj In ThisDrawing.PaperSpace
        ' Determine if this is a paper space viewport
        If pviewportObj.ObjectName = "AcDbViewport" Then
            ' Determine if this paper space viewport is clipped
            DisplayState = IIf(pviewportObj.DisplayLocked, " is locked", " is not locked")
            msg = msg & "PViewport ID " & pviewportObj.ObjectID & DisplayState & vbCrLf
        End If
    Next

    ' Display locked state of paper space Viewports
    MsgBox msg
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DisplayLocked()
    ;; This example scans the current drawing paper space Viewports
    ;; and displays whether or not any of them are locked.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq paperSpace (vla-get-PaperSpace doc))

    ;; Make sure this drawing contains paper space viewports before continuing
    (if (= (vla-get-count paperSpace) 0)
        (alert "There are no paper space viewports in the current drawing.")
        (progn
               (setq msg "")
               ;; Go through each paper space viewport object in the drawing paper space
               ;; and determine whether or not it is locked
               (vlax-for pviewportObj paperSpace
                   ;; Determine whether this is a paper space viewport
                   (if (= (vla-get-ObjectName pviewportObj) "AcDbViewport")
                       (progn
                           ;; Determine whether this paper space viewport is locked
                           (setq DisplayState (if (= (vla-get-DisplayLocked pviewportObj) :vlax-true) " is locked" " is not locked"))
                              (setq ID (itoa (vla-get-ObjectID pviewportObj)))
                           (setq msg (strcat msg "PViewport ID " ID DisplayState "\n"))
                       )
                   )
               )

               ;; Display locked state of paper space Viewports
               (alert msg)
           )
    )
)


DisplayOLEScale Property (ActiveX)

Determines whether the OLE scaling dialog is displayed when OLE objects are inserted into a drawing.

Supported platforms: Windows only

Signature

VBA:

object.DisplayOLEScale
object

Type: PreferencesSystem

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Display the OLE scaling dialog when OLE objects are inserted into a drawing.
  • False: Do not display the OLE scaling dialog when OLE objects are inserted into a drawing.

Remarks

The initial value for this property is True.

Examples

VBA:

Sub Example_DisplayOLEScale()
    ' This example reads and modifies the preference value that controls
    ' whether the OLE scaling dialog is displayed when OLE objects are
    ' inserted into a drawing.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesSystem
    Dim originalValue As Variant, newValue As Variant

    ' Get the system preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.System

    ' Read and display the original value
    originalValue = ACADPref.DisplayOLEScale
    MsgBox "The DisplayOLEScale preference is set to: " & originalValue

    ' Modify the DisplayOLEScale preference by toggling the value
    ACADPref.DisplayOLEScale = Not (ACADPref.DisplayOLEScale)
    newValue = ACADPref.DisplayOLEScale
    MsgBox "The DisplayOLEScale preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.DisplayOLEScale = originalValue
    MsgBox "The DisplayOLEScale preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DisplayOLEScale()
    ;; This example reads and modifies the preference value that controls
    ;; whether the OLE scaling dialog is displayed when OLE objects are
    ;; inserted into a drawing.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the system preferences object
    (setq ACADPref (vla-get-System preferences))

    ;; Read and display the original value
    (setq originalValue (vla-get-DisplayOLEScale ACADPref))
    (alert (strcat "The DisplayOLEScale preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the DisplayOLEScale preference by toggling the value
    (vla-put-DisplayOLEScale ACADPref (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-DisplayOLEScale ACADPref))
    (alert (strcat "The DisplayOLEScale preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-DisplayOLEScale ACADPref originalValue)
    (alert (strcat "The DisplayOLEScale preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


DisplayScreenMenu Property (ActiveX)

Specifies whether to display the screen menu on the right side of the drawing window. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.DisplayScreenMenu
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Display the screen menu.
  • False: Do not display the screen menu.

Remarks

The initial value for this property is False.

Examples

VBA:

Sub Example_DisplayScreenMenu()
    ' This example returns the current setting of
    ' DisplayScreenMenu. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currDisplayScreenMenu As Boolean

    Set preferences = ThisDrawing.Application.Preferences

    ' Retrieve the current DisplayScreenMenu value
    currDisplayScreenMenu = preferences.Display.DisplayScreenMenu
    MsgBox "The current value for DisplayScreenMenu is " & preferences.DISPLAY.DisplayScreenMenu, vbInformation, "DisplayScreenMenu Example"

    ' Change the value for DisplayScreenMenu
    preferences.DISPLAY.DisplayScreenMenu = Not (currDisplayScreenMenu)
    MsgBox "The new value for DisplayScreenMenu is " & preferences.DISPLAY.DisplayScreenMenu, vbInformation, "DisplayScreenMenu Example"

    ' Reset DisplayScreenMenu to its original value
    preferences.DISPLAY.DisplayScreenMenu = currDisplayScreenMenu
    MsgBox "The DisplayScreenMenu value is reset to " & preferences.DISPLAY.DisplayScreenMenu, vbInformation, "DisplayScreenMenu Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DisplayScreenMenu()
    ;; This example returns the current setting of
    ;; DisplayScreenMenu. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the Display preferences object
    (setq ACADPref (vla-get-Display preferences))

    ;; Retrieve the current DisplayScreenMenu value
    (setq currDisplayScreenMenu (vla-get-DisplayScreenMenu ACADPref))
    (alert (strcat "The current value for DisplayScreenMenu is " (if (= currDisplayScreenMenu :vlax-true) "True" "False")))

    ;; Change the value for DisplayScreenMenu
    (setq newValue (if (= currDisplayScreenMenu :vlax-true) :vlax-false :vlax-true))
    (vla-put-DisplayScreenMenu ACADPref newValue)
    (alert (strcat "The new value for DisplayScreenMenu is " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset DisplayScreenMenu to its original value
    (vla-put-DisplayScreenMenu ACADPref currDisplayScreenMenu)
    (alert (strcat "The DisplayScreenMenu value is reset to " (if (= currDisplayScreenMenu :vlax-true) "True" "False")))
)


DisplayScrollBars Property (ActiveX)

Specifies whether to display scroll bars at the bottom and right sides of the drawing window.

Supported platforms: Windows only

Signature

VBA:

object.DisplayScrollBars
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Display the scroll bars.
  • False: Do not display the scroll bars.

Remarks

The initial value for this property is False.

Examples

VBA:

Sub Example_DisplayScrollBars()
    ' This example returns the current setting of
    ' DisplayScrollBars. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currDisplayScrollBars As Boolean

    Set preferences = ThisDrawing.Application.Preferences

    ' Retrieve the current DisplayScrollBars value
    currDisplayScrollBars = preferences.Display.DisplayScrollBars
    MsgBox "The current value for DisplayScrollBars is " & preferences.DISPLAY.DisplayScrollBars, vbInformation, "DisplayScrollBars Example"

    ' Change the value for DisplayScrollBars
    preferences.DISPLAY.DisplayScrollBars = Not (currDisplayScrollBars)
    MsgBox "The new value for DisplayScrollBars is " & preferences.DISPLAY.DisplayScrollBars, vbInformation, "DisplayScrollBars Example"

    ' Reset DisplayScrollBars to its original value
    preferences.DISPLAY.DisplayScrollBars = currDisplayScrollBars
    MsgBox "The DisplayScrollBars value is reset to " & preferences.DISPLAY.DisplayScrollBars, vbInformation, "DisplayScrollBars Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DisplayScrollBars()
    ;; This example returns the current setting of
    ;; DisplayScrollBars. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the Display preferences object
    (setq ACADPref (vla-get-Display preferences))

    ;; Retrieve the current DisplayScrollBars value
    (setq currDisplayScrollBars (vla-get-DisplayScrollBars ACADPref))
    (alert (strcat "The current value for DisplayScrollBars is " (if (= currDisplayScrollBars :vlax-true) "True" "False")))

    ;; Change the value for DisplayScrollBars
    (setq newValue (if (= currDisplayScrollBars :vlax-true) :vlax-false :vlax-true))
    (vla-put-DisplayScrollBars ACADPref newValue)
    (alert (strcat "The new value for DisplayScrollBars is " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset DisplayScrollBars to its original value
    (vla-put-DisplayScrollBars ACADPref currDisplayScrollBars)
    (alert (strcat "The DisplayScrollBars value is reset to " (if (= currDisplayScrollBars :vlax-true) "True" "False")))
)


DisplaySilhouette Property (ActiveX)

Controls whether silhouette curves of solid objects are displayed in Wireframe mode.

Supported platforms: Windows only

Signature

VBA:

object.DisplaySilhouette
object

Type: DatabasePreferences

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Display only silhouette lines for solid objects.
  • False: Display isolines for solid objects.

Remarks

The initial value for this property is False.

NoteThe value of this property is stored in the DISPSILH system variable.

Examples

VBA:

Sub Example_DisplaySilhouette()
    ' This example returns the current setting of
    ' DisplaySilhouette. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim currDisplaySilhouette As Boolean

    ' Retrieve the current DisplaySilhouette value
    currDisplaySilhouette = ThisDrawing.Preferences.DisplaySilhouette
    MsgBox "The current value for DisplaySilhouette is " & preferences.DisplaySilhouette, vbInformation, "DisplaySilhouette Example"

    ' Change the value for DisplaySilhouette
    ThisDrawing.Preferences.DisplaySilhouette = Not (currDisplaySilhouette)
    MsgBox "The new value for DisplaySilhouette is " & preferences.DisplaySilhouette, vbInformation, "DisplaySilhouette Example"

    ' Reset DisplaySilhouette to its original value
    ThisDrawing.Preferences.DisplaySilhouette = currDisplaySilhouette
    MsgBox "The DisplaySilhouette value is reset to " & preferences.DisplaySilhouette, vbInformation, "DisplaySilhouette Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DisplaySilhouette()
    ;; This example returns the current setting of
    ;; DisplaySilhouette. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences doc))

    ;; Retrieve the current DisplaySilhouette value
    (setq currDisplaySilhouette (vla-get-DisplaySilhouette preferences))
    (alert (strcat "The current value for DisplaySilhouette is " (if (= currDisplaySilhouette :vlax-true) "True" "False")))

    ;; Change the value for DisplaySilhouette
    (setq newValue (if (= currDisplaySilhouette :vlax-true) :vlax-false :vlax-true))
    (vla-put-DisplaySilhouette preferences newValue)
    (alert (strcat "The new value for DisplaySilhouette is " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset DisplaySilhouette to its original value
    (vla-put-DisplaySilhouette preferences currDisplaySilhouette)
    (alert (strcat "The DisplaySilhouette value is reset to " (if (= currDisplaySilhouette :vlax-true) "True" "False")))
)


DockedVisibleLines Property (ActiveX)

Specifies the number of lines of text to display in the command window. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.DockedVisibleLines
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: Integer

A positive integer representing the number of text lines to display in the command window.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_DockedVisibleLines()
    ' This example returns the current setting of
    ' DockedVisibleLines. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currDockedVisibleLines As Integer

    Set preferences = ThisDrawing.Application.Preferences

    ' Retrieve the current DockedVisibleLines value
    currDockedVisibleLines = preferences.Display.DockedVisibleLines
    MsgBox "The current value for DockedVisibleLines is " & preferences.DISPLAY.DockedVisibleLines, vbInformation, "DockedVisibleLines Example"

    ' Change the value for DockedVisibleLines
    preferences.Display.DockedVisibleLines = 15
    MsgBox "The new value for DockedVisibleLines is " & preferences.DISPLAY.DockedVisibleLines, vbInformation, "DockedVisibleLines Example"

    ' Reset DockedVisibleLines to its original value
    preferences.Display.DockedVisibleLines = currDockedVisibleLines
    MsgBox "The DockedVisibleLines value is reset to " & preferences.Display.DockedVisibleLines, vbInformation, "DockedVisibleLines Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DockedVisibleLines()
    ;; This example returns the current setting of
    ;; DockedVisibleLines. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the Display preferences object
    (setq ACADPref (vla-get-Display preferences))

    ;; Retrieve the current DockedVisibleLines value
    (setq currDockedVisibleLines (vla-get-DockedVisibleLines ACADPref))
    (alert (strcat "The current value for DockedVisibleLines is " (itoa currDockedVisibleLines)))

    ;; Change the value for DockedVisibleLines
    (setq newValue 15)
    (vla-put-DockedVisibleLines ACADPref newValue)
    (alert (strcat "The new value for DockedVisibleLines is " (itoa newValue)))

    ;; Reset DockedVisibleLines to its original value
    (vla-put-DockedVisibleLines ACADPref currDockedVisibleLines)
    (alert (strcat "The DockedVisibleLines value is reset to " (itoa currDockedVisibleLines)))
)


DockStatus Property (ActiveX)

Specifies whether the toolbar is docked or floating.

Supported platforms: Windows only

Signature

VBA:

object.DockStatus
object

Type: Toolbar

The object this property applies to.

Property Value

Read-only: Yes

Type: acToolbarDockStatus enum

  • acToolbarDockTop
  • acToolbarDockBottom
  • acToolbarDockLeft
  • acToolbarDockRight
  • acToolbarFloating

Remarks

No additional remarks.

Examples

VBA:

Sub Example_DockStatus()
    ' This example creates a new toolbar called "TestToolbar" and inserts three
    ' buttons into it. The toolbar is then displayed as a floating toolbar,
    ' and then as a docked toolbar.
    ' To remove the toolbar after execution of this macro, use the Customize Menu
    ' option from the Tools menu.

    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    ' Create the new toolbar
    Dim newToolBar As AcadToolbar
    Set newToolBar = currMenuGroup.Toolbars.Add("TestToolbar")

    ' Add three buttons to the new toolbar.
    ' All three buttons will have the same macro attached.
    Dim newButton1 As AcadToolbarItem
    Dim newButton2 As AcadToolbarItem
    Dim newButton3 As AcadToolbarItem
    Dim openMacro As String

    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set newButton1 = newToolBar.AddToolbarButton("", "NewButton1", "Open a file.", openMacro)
    Set newButton2 = newToolBar.AddToolbarButton("", "NewButton2", "Open a file.", openMacro)
    Set newButton3 = newToolBar.AddToolbarButton("", "NewButton3", "Open a file.", openMacro)

    ' Display the toolbar
    newToolBar.Visible = True

    ' Dock the toolbar to the left of the screen.
    newToolBar.Dock acToolbarDockLeft
    GoSub QUERYSTATUS

    ' Float the toolbar
    newToolBar.Float 200, 200, 1
    GoSub QUERYSTATUS

    Exit Sub

QUERYSTATUS:
    ' Query the toolbar to see if it is docked.
    If newToolBar.DockStatus = acToolbarFloating Then
        MsgBox "The toolbar is floating."
    Else
        MsgBox "The toolbar is docked."
    End If
    Return

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DockStatus()
    ;; This example creates a new toolbar called "TestToolbar" and inserts three
    ;; buttons into it. The toolbar is then displayed as a floating toolbar,
    ;; and then as a docked toolbar.
    ;; To remove the toolbar after execution of this macro, use the Customize Menu
    ;; option from the Tools menu.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new toolbar
    (setq newToolBar (vla-Add (vla-get-Toolbars currMenuGroup) "TestToolbar"))

    ;; Add three buttons to the new toolbar.
    ;; All three buttons will have the same macro attached.
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))

    (setq newButton1 (vla-AddToolbarButton newToolBar "" "NewButton1" "Open a file." openMacro))
    (setq newButton2 (vla-AddToolbarButton newToolBar "" "NewButton2" "Open a file." openMacro))
    (setq newButton3 (vla-AddToolbarButton newToolBar "" "NewButton3" "Open a file." openMacro))

    ;; Display the toolbar
    (vla-put-Visible newToolBar :vlax-true)

    ;; Dock the toolbar to the left of the screen.
    (vla-Dock newToolBar acToolbarDockLeft)

    ;; Query the toolbar to see if it is docked.
    (if (= (vla-get-DockStatus newToolBar) acToolbarFloating)
        (alert "The toolbar is floating.")
        (alert "The toolbar is docked.")
    )

    ;; Float the toolbar
    (vla-Float newToolBar 200 200 1)

    (if (= (vla-get-DockStatus newToolBar) acToolbarFloating)
        (alert "The toolbar is floating.")
        (alert "The toolbar is docked.")
    )
)


Document Property (ActiveX)

Gets the document (drawing) in which the object belongs.

Supported platforms: Windows only

Signature

VBA:

object.Document
object

Type: All drawing objects, Block, Blocks, Dictionary, Dictionaries, DimStyle, DimStyles, Group, Groups, Layer, Layers, Layout, Layouts, Linetype, Linetypes, ModelSpace, PaperSpace, PlotConfiguration, PlotConfigurations, RegisteredApplication, RegisteredApplications, SectionManager, SectionSettings, SortentsTable, SubDMesh, TableStyle, TextStyle, TextStyles, UCS, UCSs, View, Views, Viewport, Viewports, XRecord

The objects this property applies to.

Property Value

Read-only: Yes

Type: Document

The document (drawing) that contains the object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Document()
    ' This example creates a circle in model space and then
    ' finds the name of the document that the circle resides in.

    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double

    ' Define the circle
    centerPoint(0) = 0#: centerPoint(1) = 0#: centerPoint(2) = 0#
    radius = 5#

    ' Create the Circle object in model space
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)
    ZoomAll

    ' Find the document name for the circle
    Dim currDoc As AcadDocument
    Set currDoc = circleObj.Document

    MsgBox "The circle resides in: " & currDoc.name

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Document()
    ;; This example creates a circle in model space and then
    ;; finds the name of the document that the circle resides in.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the circle
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius 5)

    ;; Create the Circle object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))
    (vla-ZoomAll acadObj)

    ;; Find the document name for the circle
    (setq currDoc (vla-get-Document circleObj))

    (alert (strcat "The circle resides in: " (vla-get-Name currDoc)))
)


Documents Property (ActiveX)

Gets the Documents collection.

Supported platforms: Windows only

Signature

VBA:

object.Documents
object

Type: Application

The object this property applies to.

Property Value

Read-only: Yes

Type: Documents

The Documents collection for the current AutoCAD session.

Remarks

The Documents collection allows you to access all the documents, or drawings, in the current AutoCAD session.

Examples

VBA:

Sub Example_Documents()
    ' This example obtains a reference to the Documents collection
    ' and displays information about the loaded documents.

    Dim Document As AcadDocument
    Dim msg As String
    msg = vbCrLf

    ' Cycle through the Documents collection and retrieve the names
    ' of the loaded documents
    For Each Document In Documents
        msg = msg & Document.Name & vbCrLf
    Next

    ' Display loaded document information
    If Documents.Count > 0 Then
        MsgBox "The loaded documents are: " & msg
    Else
        MsgBox "There are no loaded documents!"
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Documents()
    ;; This example obtains a reference to the Documents collection
    ;; and displays information about the loaded documents.
    (setq acadObj (vlax-get-acad-object))

    ;; Cycle through the Documents collection and retrieve the names
    ;; of the loaded documents
    (setq msg "")
    (vlax-for Document (vla-get-Documents acadObj)
        (setq msg (strcat msg "\n" (vla-get-Name Document)))
    )

    ;; Display loaded document information
    (if (> (vla-get-Count (vla-get-Documents acadObj)))
        (alert (strcat "The loaded documents are: " msg))
        (alert "There are no loaded documents!")
    )
)


DogLegged Property (ActiveX)

The status of the dog-leg.

Supported platforms: Windows only

Signature

VBA:

object.DogLegged
object

Type: MLeader

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The horizontal landing is enabled.
  • False: The horizontal landing is disabled.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_DogLeg()
    Dim oML As AcadMLeader
    Dim points(0 To 14) As Double

    ' Define the leader points
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 1: points(4) = 2: points(5) = 0
    points(6) = 2: points(7) = 2: points(8) = 0
    points(9) = 3: points(10) = 2: points(11) = 0
    points(12) = 4: points(13) = 4: points(14) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    oML.DogLegged = True
    oML.DoglegLength = 1.3

    MsgBox "The dog-leg length is  " & oML.DoglegLength

    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DogLeg()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the leader points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill points '(1 1 0
                                              1 2 0
                                              2 2 0
                                              3 2 0
                                              4 4 0
                                             )
    )
    (setq i 0)
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (vla-put-DogLegged oML :vlax-true)
    (vla-put-DoglegLength oML 1.3)

    (alert (strcat "The dog-leg length is " (rtos (vla-get-DoglegLength oML) 2)))

    (vla-ZoomAll acadObj)
)


DoglegLength Property (ActiveX)

The length of the dog-leg.

Supported platforms: Windows only

Signature

VBA:

object.DoglegLength
object

Type: MLeader, MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: Double

Specifies the landing distance.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_DogLeg()
    Dim oML As AcadMLeader
    Dim points(0 To 14) As Double

    ' Define the leader points
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 1: points(4) = 2: points(5) = 0
    points(6) = 2: points(7) = 2: points(8) = 0
    points(9) = 3: points(10) = 2: points(11) = 0
    points(12) = 4: points(13) = 4: points(14) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    oML.DogLegged = True
    oML.DoglegLength = 1.3

    MsgBox "The dog-leg length is  " & oML.DoglegLength

    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DogLeg()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the leader points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill points '(1 1 0
                                              1 2 0
                                              2 2 0
                                              3 2 0
                                              4 4 0
                                             )
    )
    (setq i 0)
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (vla-put-DogLegged oML :vlax-true)
    (vla-put-DoglegLength oML 1.3)

    (alert (strcat "The dog-leg length is " (rtos (vla-get-DoglegLength oML) 2)))

    (vla-ZoomAll acadObj)
)


Drafting Property (ActiveX)

Gets the PreferencesDrafting object.

Supported platforms: Windows only

Signature

VBA:

object.Drafting
object

Type: Preferences

The object this property applies to.

Property Value

Read-only: Yes

Type: PreferencesDrafting

Gets the PreferencesDrafting object.

Remarks

The PreferencesDrafting object holds all the options from the Drafting tab on the Options dialog stored in the registry. All options that are stored with the drawing can be found on the DatabasePreferences object.

Examples

VBA:

Sub Example_Drafting()
    ' This example obtains a reference to the Drafting Preferences object
    ' from the Application Preferences object, and reads one of the Drafting
    ' preferences

    Dim ACADPref As AcadPreferencesDrafting

    ' Obtain a reference to the Drafting Preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.Drafting

    MsgBox "We now have access to the properties and methods of the Drafting Preferences object!"
    MsgBox "The Drafting preference AutoSnapTooltip is set to: " & ACADPref.AutoSnapTooltip

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Drafting()
    ;; This example obtains a reference to the Drafting Preferences object
    ;; from the Application Preferences object, and reads one of the Drafting
    ;; preferences
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Obtain a reference to the Drafting Preferences object
    (setq ACADPref (vla-get-Drafting preferences))

    (alert "We now have access to the properties and methods of the Drafting Preferences object!")
    (alert (strcat "The Drafting preference AutoSnapTooltip is set to: " (if (= (vla-get-AutoSnapTooltip ACADPref) :vlax-true) "True" "false")))
)


DrawingDirection Property (ActiveX)

Specifies the direction in which the mtext paragraph is to be read.

Supported platforms: Windows only

Signature

VBA:

object.DrawingDirection
object

Type: GeoPositionMarker, MText

The object this property applies to.

Property Value

Read-only: No

Type: acDrawingDirection enum

  • acLeftToRight
  • acTopToBottom
  • acRightToLeft (Reserved for future use)
  • acBottomToTop (Reserved for future use)
  • acByStyle (Reserved for future use)

Remarks

For languages such as English or Spanish, text is read horizontally, left to right. For languages such as Chinese or Japanese, sometimes text is read vertically, top to bottom. AutoCAD will draw the text according to this property setting.

Left to right

Top to bottom

The settings acRightToLeft, acBottomToTop, and acByStyle are reserved for future use and cannot be used in this release.

Examples

VBA:

Sub Example_DrawingDirection()
    ' This example changes the drawing direction for an MText object
    ' in model space.

    Dim MTextObj As AcadMText
    Dim corner1(0 To 2) As Double
    Dim width As Double
    Dim text As String

    ' Define the MText object
    corner1(0) = 0#: corner1(1) = 6#: corner1(2) = 0#
    width = 7
    text = "This is a text String."

    ' Create the MText object in model space
    Set MTextObj = ThisDrawing.ModelSpace.AddMText(corner1, width, text)
    ZoomAll

    'Change the drawing direction of the MText object
    MTextObj.DrawingDirection = acLeftToRight
    ZoomAll
    MsgBox "The DrawingDirection of the text is left to right.", vbInformation, "DrawingDirection Example"

    MTextObj.DrawingDirection = acTopToBottom
    ZoomAll
    MsgBox "The DrawingDirection of the text is top to bottom.", vbInformation, "DrawingDirection Example"

    ' Return the drawing direction
    Dim retDirection As Integer
    retDirection = MTextObj.DrawingDirection

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DrawingDirection()
    ;; This example changes the drawing direction for an MText object
    ;; in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the MText object
    (setq corner1 (vlax-3d-point 0 6 0)
          width 7
          text "This is a text String.")

    ;; Create the MText object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MTextObj (vla-AddMText modelSpace corner1 width text))
    (vla-ZoomAll acadObj)

    ;; Change the drawing direction of the MText object
    (vla-put-DrawingDirection MTextObj acLeftToRight)
    (vla-ZoomAll acadObj)
    (alert "The DrawingDirection of the text is left to right.")

    (vla-put-DrawingDirection MTextObj acTopToBottom)
    (vla-ZoomAll acadObj)
    (alert "The DrawingDirection of the text is top to bottom.")

    ;; Return the drawing direction
    (setq retDirection (vla-get-DrawingDirection MTextObj))
    (alert (strcat "The current value of DrawingDirection: " (itoa retDirection)))
)


DrawLeaderOrderType Property (ActiveX)

Specifies the drawLeaderOrderType of the mleaderstyle.

Supported platforms: Windows only

Signature

VBA:

object.DrawLeaderOrderType
object

Type: MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: AcDrawLeaderOrderType enum

  • acDrawLeaderHeadFirst
  • acDrawLeaderTailFirst

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


DrawMLeaderOrderType Property (ActiveX)

Specifies the drawMLeaderOrderType of the mleaderstyle.

Supported platforms: Windows only

Signature

VBA:

object.DrawMLeaderOrderType
object

Type: MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: AcDrawLeaderOrderType enum

  • acDrawLeaderHeadFirst
  • acDrawLeaderTailFirst

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


DriversPath Property (ActiveX)

Specifies the directory in which AutoCAD looks for ADI device drivers for the video display, pointing devices, printers, and plotters.

Supported platforms: Windows only

Signature

VBA:

object.DriversPath
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The directory in which the device drivers are located. Specify a drive letter and path for each path. Separate multiple directory listings with a semicolon (;).

Remarks

No additional remarks.

Examples

VBA:

Sub Example_DriversPath()
    ' This example returns the current setting of
    ' DriversPath. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currDriversPath As String
    Dim newDriversPath As String

    Set preferences = ThisDrawing.Application.Preferences

    ' Retrieve the current DriversPath value
    currDriversPath = preferences.Files.DriversPath
    MsgBox "The current value for DriversPath is " & currDriversPath, vbInformation, "DriversPath Example"

    ' Change the value for DriversPath
    newDriversPath = "TestDriversPath"
    preferences.Files.DriversPath = newDriversPath
    MsgBox "The new value for DriversPath is " & newDriversPath, vbInformation, "DriversPath Example"

    ' Reset DriversPath to its original value
    preferences.Files.DriversPath = currDriversPath
    MsgBox "The DriversPath value is reset to " & currDriversPath, vbInformation, "DriversPath Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_DriversPath()
    ;; This example returns the current setting of
    ;; DriversPath. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current DriversPath value
    (setq currDriversPath (vla-get-DriversPath (vla-get-Files preferences)))
    (alert (strcat "The current value for DriversPath is " currDriversPath))

    ;; Change the value for DriversPath
    (setq newDriversPath "TestDriversPath")
    (vla-put-DriversPath (vla-get-Files preferences) newDriversPath)
    (alert (strcat "The new value for DriversPath is " newDriversPath))

    ;; Reset DriversPath to its original value
    (vla-put-DriversPath (vla-get-Files preferences) currDriversPath)
    (alert (strcat "The DriversPath value is reset to " currDriversPath))
)


DWFFormat Property (ActiveX)

Specifies the format of the DWF file.

Supported platforms: Windows only

Signature

VBA:

object.DWFFormat
object

Type: DwfUnderlay

The object to which this property applies.

Property Value

Read-only: No

Type: String

The DWF file format.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


EdgeExtensionDistances Property (ActiveX)

Specifies the distance by which the edges of surface are extended to merge to an existing surface.

Supported platforms: Windows only

Signature

VBA:

object.EdgeExtensionDistances
object

Type: ExtrudedSurface, LoftedSurface, NurbSurface, PlaneSurface, RevolvedSurface, Surface, SweptSurface

The objects this property applies to.

Property Value

Read-only: No

Type: Variant

The distance by which the edges of surface are extended.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


EffectiveName Property (ActiveX)

Specifies the original block name.

Supported platforms: Windows only

Signature

VBA:

object.EffectiveName
object

Type: BlockReference, MInsertBlock

The objects this property applies to.

Property Value

Read-only: Yes

Type: String

The effective name is the name of the block as the user would see it in the user interface. Dynamic blocks may draw themselves with an anonymous block whose name is different than the block name the user sees for the block in the user interface. The Name property returns the name of the block used to draw the reference, while the EffectiveName is the name the user sees for the reference.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Elevation Property (ActiveX)

Specifies the current elevation of the hatch, polyline, or section.

Supported platforms: Windows only

Signature

VBA:

object.Elevation
object

Type: Hatch, LWPolyline, Polyline, Section

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The current elevation of the object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Elevation()
    ' This example creates an associative hatch in model space.
    ' The elevation for that hatch is then changed.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "ANSI31"
    PatternType = 0
    bAssociativity = True

    ' Create the associative Hatch object
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)

    ' Create the outer loop for the hatch.
    ' An arc and a line are used to create a closed loop.

    Dim arcObj As AcadArc
    Dim lineObj As AcadLine
    Dim outerLoop(0 To 1) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    center(0) = 5: center(1) = 3: center(2) = 0
    radius = 3
    startAngle = 0
    endAngle = 3.141592
    Set arcObj = ThisDrawing.ModelSpace.AddArc(center, radius, startAngle, endAngle)
    Set lineObj = ThisDrawing.ModelSpace.AddLine(arcObj.startPoint, arcObj.endPoint)

    Set outerLoop(0) = arcObj
    Set outerLoop(1) = lineObj

    ' Append the outer loop to the hatch object
    hatchObj.AppendOuterLoop (outerLoop)

    ' Append the first circle as one inner loop
    Dim innerLoop1(0) As AcadEntity
    center(0) = 5: center(1) = 4.5: center(2) = 0
    radius = 1
    Set innerLoop1(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop1)

    ' Append the second circle as the other inner loop
    Dim innerLoop2(0) As AcadEntity
    radius = 0.5
    Set innerLoop2(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop2)

    ' Change the viewing direction of the viewport to better see the elevation
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

    ' Find the current elevation for the hatch
    Dim currElevation As Double
    currElevation = hatchObj.Elevation
    MsgBox "The current elevation is " & hatchObj.Elevation, , "Elevation Example"

    ' Set the hatch elevation to 3
    hatchObj.Elevation = 3#
    hatchObj.Evaluate
    ZoomAll
    MsgBox "The elevation is now " & hatchObj.Elevation, , "Elevation Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Elevation()
    ;; This example creates an associative hatch in model space.
    ;; The elevation for that hatch is then changed.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Define the hatch
    (setq patternName "ANSI31"
          patternType acHatchPatternTypePreDefined
          bAssociativity :vlax-true)

    ;; Create the associative Hatch object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acHatchObject))

    ;; Create the outer loop for the hatch.
    ;; An arc and a line are used to create a closed loop.
    (setq center (vlax-3d-point 5 3 0)
          radius 3
          startAngle 0
          endAngle 3.141592)

    ;; Add the arc and line to Model space
    (setq arcObj (vla-AddArc modelSpace center radius startAngle endAngle))
    (setq lineObj (vla-AddLine modelSpace (vla-get-StartPoint arcObj) (vla-get-EndPoint arcObj)))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element outerLoop 0 arcObj)
    (vlax-safearray-put-element outerLoop 1 lineObj)

    ;; Append the outer loop to the hatch object
    (vla-AppendOuterLoop hatchObj outerLoop)

    ;; Append the first circle as one inner loop
    (setq center (vlax-3d-point 5 4.5 0)
          radius 1)

    (setq innerLoop1 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element innerLoop1 0 (vla-AddCircle modelSpace center radius))
    (vla-AppendInnerLoop hatchObj innerLoop1)

    ;; Append the second circle as the other inner loop
    (setq radius 0.5)
    (setq innerLoop2 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element innerLoop2 0 (vla-AddCircle modelSpace center radius))
    (vla-AppendInnerLoop hatchObj innerLoop2)

    ;; Change the viewing direction of the viewport to better see the elevation
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)

    ;; Find the current elevation for the hatch
    (setq currElevation (vla-get-Elevation hatchObj))
    (alert (strcat "The current elevation is " (rtos currElevation 2)))

    ;; Set the hatch elevation to 3
    (vla-put-Elevation hatchObj 3)
    (vla-Evaluate hatchObj)
    (vla-ZoomAll acadObj)
    (alert (strcat "The elevation is now " (rtos (vla-get-Elevation hatchObj) 2)))
)


ElevationModelSpace Property (ActiveX)

Specifies the elevation setting in model space.

Supported platforms: Windows only

Signature

VBA:

object.ElevationModelSpace
object

Type: Database, Document

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The elevation setting for model space.

Remarks

The current elevation is the Z value that is used whenever a 3D point is expected but only the X and Y values are supplied. The current elevation is maintained separately in model space and paper space.

Examples

VBA:

Sub Example_ElevationModelSpace()
    ' This example changes the model space elevation of the current drawing
    ' and then resets it to the original value again.

    Dim currElevation As Double

    currElevation = ThisDrawing.ElevationModelSpace
    MsgBox "The current model space elevation is " & ThisDrawing.ElevationModelSpace, vbInformation, "ElevationModelSpace Example"

    ' Change the elevation
    ThisDrawing.ElevationModelSpace = currElevation + 2
    MsgBox "The new model space elevation is " & ThisDrawing.ElevationModelSpace, vbInformation, "ElevationModelSpace Example"

    ' Reset the elevation to its original value
    ThisDrawing.ElevationModelSpace = currElevation
    MsgBox "The model space elevation is reset to " & ThisDrawing.ElevationModelSpace, vbInformation, "ElevationModelSpace Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ElevationModelSpace()
    ;; This example changes the model space elevation of the current drawing
    ;; and then resets it to the original value again.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq currElevation (vla-get-ElevationModelSpace doc))
    (alert (strcat "The current model space elevation is " (rtos currElevation 2)))

    ;; Change the elevation
    (vla-put-ElevationModelSpace doc (+ currElevation 2))
    (alert (strcat "The new model space elevation is " (rtos (vla-get-ElevationModelSpace doc) 2)))

    ;; Reset the elevation to its original value
    (vla-put-ElevationModelSpace doc currElevation)
    (alert (strcat "The model space elevation is reset to " (rtos (vla-get-ElevationModelSpace doc) 2)))
)


ElevationPaperSpace Property (ActiveX)

Specifies the elevation setting in paper space.

Supported platforms: Windows only

Signature

VBA:

object.ElevationPaperSpace
object

Type: Database, Document

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The elevation for paper space.

Remarks

The current elevation is the Z value that is used whenever a 3D point is expected but only the X and Y values are supplied. The current elevation is maintained separately in model space and paper space.

Examples

VBA:

Sub Example_ElevationPaperSpace()
    ' This example changes the paper space elevation of the current drawing
    ' and then resets it to the original value.

    Dim currElevation As Double

    currElevation = ThisDrawing.ElevationPaperSpace
    MsgBox "The current paper space elevation is " & ThisDrawing.ElevationPaperSpace, vbInformation, "ElevationpaperSpace Example"

    ' Change the elevation
    ThisDrawing.ElevationPaperSpace = currElevation + 2
    MsgBox "The new paper space elevation is " & ThisDrawing.ElevationPaperSpace, vbInformation, "ElevationpaperSpace Example"

    ' Reset the elevation to its original value
    ThisDrawing.ElevationPaperSpace = currElevation
    MsgBox "The paper space elevation is reset to " & ThisDrawing.ElevationPaperSpace, vbInformation, "ElevationPaperSpace Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ElevationPaperSpace()
    ;; This example changes the paper space elevation of the current drawing
    ;; and then resets it to the original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq currElevation (vla-get-ElevationPaperSpace doc))
    (alert (strcat "The current paper space elevation is " (rtos currElevation 2)))

    ;; Change the elevation
    (vla-put-ElevationPaperSpace doc (+ currElevation 2))
    (alert (strcat "The new paper space elevation is " (rtos (vla-get-ElevationPaperSpace doc) 2)))

    ;; Reset the elevation to its original value
    (vla-put-ElevationPaperSpace doc currElevation)
    (alert (strcat "The paper space elevation is reset to " (rtos (vla-get-ElevationPaperSpace doc) 2)))
)


Enable Property (ActiveX)

Enables the popup menu item. Specifies the name of the object.

Supported platforms: Windows only

Signature

VBA:

object.Enable
object

Type: PopupMenuItem

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The item is enabled.
  • False: The item is disabled.

Remarks

In the following example, the Undo and Redo menu items are disabled.

Examples

VBA:

Sub Example_Enable()
    ' This example creates a new menu called TestMenu and inserts two menu items
    ' into it. The second menu item is then disabled.
    ' The menu is displayed on the menu bar.
    ' To remove the menu after execution of this macro, use the Customize Menu
    ' option from the Tools menu.

    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    ' Create the new menu
    Dim newMenu As AcadPopupMenu
    Set newMenu = currMenuGroup.Menus.Add("TestMenu")

    ' Add two menu items to the new menu
    Dim MenuEnable As AcadPopupMenuItem
    Dim MenuDisable As AcadPopupMenuItem
    Dim MenuSeparator As AcadPopupMenuItem
    Dim openMacro As String

    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set MenuEnable = newMenu.AddMenuItem(newMenu.count + 1, "OpenEnabled", openMacro)
    Set MenuSeparator = newMenu.AddSeparator("")
    Set MenuDisable = newMenu.AddMenuItem(newMenu.count + 1, "OpenDisabled", openMacro)

    ' Disable the new menu item
    MenuDisable.Enable = False

    ' Display the menu on the menu bar
    newMenu.InsertInMenuBar (ThisDrawing.Application.MenuBar.count + 1)

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Enable()
    ;; This example creates a new menu called TestMenu and inserts two menu items
    ;; into it. The second menu item is then disabled.
    ;; The menu is displayed on the menu bar.
    ;; To remove the menu after execution of this macro, use the Customize Menu
    ;; option from the Tools menu.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new menu
    (setq newMenu (vla-Add (vla-get-Menus currMenuGroup) "TestMenu"))

    ;; Add two menu items to the new menu
    ;; Assign the macro string the VB equivalent of "ESC ESC _open "
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))

    (setq MenuEnable (vla-AddMenuItem newMenu (1+ (vla-get-Count newMenu)) "OpenEnabled" openMacro))
    (setq MenuSeparator (vla-AddSeparator newMenu ""))
    (setq MenuDisable (vla-AddMenuItem newMenu (1+ (vla-get-Count newMenu)) "OpenDisabled" openMacro))

    ;; Disable the new menu item
    (vla-put-Enable MenuDisable :vlax-false)

    ;; Display the menu on the menu bar
    (vla-InsertInMenuBar newMenu (1+ (vla-get-Count (vla-get-MenuBar acadObj))))
)


EnableBlockRotation Property (ActiveX)

Specifies the EnableBlockRotation of the mleaderstyle.

Supported platforms: Windows only

Signature

VBA:

object.EnableBlockRotation
object

Type: MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Block rotation is enabled.
  • False: Block rotation is disabled.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


EnableBlockScale Property (ActiveX)

Specifies the EnableBlockScale of the mleaderstyle.

Supported platforms: Windows only

Signature

VBA:

object.EnableBlockScale
object

Type: MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Block scales are enabled.
  • False: Block scales are disabled.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


EnableBreak Property (ActiveX)

Toggles table breaking.

Supported platforms: Windows only

Signature

VBA:

object.EnableBreak
object

Type: Table

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Table breaks are enabled.
  • False: Table breaks are disabled.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_BreakHeight()
    ' This example creates a table object and then breaks it into
    ' two tables.

    ' Create a new table object in model space
    Dim pt(2) As Double

    Dim modelSpace As AcadModelSpace
    Set modelSpace = ThisDrawing.modelSpace

    Dim table As AcadTable
    Set table = modelSpace.AddTable(pt, 5, 5, 10, 30)

    table.EnableBreak = True
    table.BreakSpacing = 3.5
    table.TableBreakHeight = 35#
    table.AllowManualHeights = True
    table.SetBreakHeight 0, 20#
    table.SetBreakHeight 1, 35#

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_BreakHeight()
    ;; This example creates a table object and then breaks it into
    ;; two tables.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create a new table object in model space
    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq table (vla-Addtable modelSpace pt 5 5 10 30))

    (vla-put-EnableBreak table :vlax-true)
    (vla-put-BreakSpacing table 3.5)
    (vla-put-TableBreakHeight table 35.0)
    (vla-put-AllowManualHeights table :vlax-true)
    (vla-SetBreakHeight table 0 20.0)
    (vla-SetBreakHeight table 1 35.0)

    (vla-ZoomExtents acadObj)
)


EnableDogleg Property (ActiveX)

Specifies the enableDogleg of the mleaderstyle.

Supported platforms: Windows only

Signature

VBA:

object.EnableDogleg
object

Type: MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Dog legs for the leader line are enabled.
  • False: Dog legs for the leader line are disabled.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


EnableFrameText Property (ActiveX)

Specifies the EnableFrameText of the mleaderstyle.

Supported platforms: Windows only

Signature

VBA:

object.EnableFrameText
object

Type: MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Text frame is enabled.
  • False: Text frame is disabled.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


EnableLanding Property (ActiveX)

Specifies the enableLanding of the mleaderstyle.

Supported platforms: Windows only

Signature

VBA:

object.EnableLanding
object

Type: MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Leader line landings enabled.
  • False: Leader line landings disabled.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


EnableShadowDisplay Property (ActiveX)

Specifies whether the shadow display property is enabled for the object.

Supported platforms: Windows only

Signature

VBA:

object.EnableShadowDisplay
object

Type: ShadowDisplay

The object to which this property applies.

Property Value

Read-only: No

Type: Long

  • 0: Shadow display is enabled.
  • 1: Shadow display is disabled.

Remarks

This property is always set to 1 for 3D solid objects. It can be either 0 or 1 for 2D objects that can have thickness. For 2D objects whose thickness is non-zero, this property returns 1. For 2D objects whose thickness is 0, it returns 0. This property always returns 0 for 2D objects that are not capable of thickness, such as an RasterImage object.

Examples

VBA:

Sub Example_ShadowDisplay()

    ' This example creates a cone in model space and changes its shadow display setting.

    Dim coneObj As Acad3DSolid
    Dim centerPoint(0 To 2) As Double
    Set coneObj = ThisDrawing.ModelSpace.AddCone(centerPoint, 5, 20)

    Dim shadowObj As IAcadShadowDisplay
    Dim EnableShadowDisplayStatus As Long
    Dim ShadowDisplay As AcShadowDisplayType
    Dim displaySettingDesc As String
    Set shadowObj = coneObj

    EnableShadowDisplayStatus = shadowObj.EnableShadowDisplay
    ShadowDisplay = shadowObj.ShadowDisplay

    displaySettingDesc = DescribeShadowDisplay(ShadowDisplay)
    If EnableShadowDisplayStatus = 1 Then
        MsgBox "Shadow display is currently enabled for this object." & vbCr & _
            "Current shadow display setting is: " & displaySettingDesc
    Else
        MsgBox "Shadow display is disabled for this object."
    End If

    shadowObj.ShadowDisplay = acCastsShadows
    displaySettingDesc = DescribeShadowDisplay(shadowObj.ShadowDisplay)
    MsgBox "New shadow display setting is: " & displaySettingDesc
End Sub

Private Function DescribeShadowDisplay(acShadow As AcShadowDisplayType) As String
    Select Case acShadow
        Case acCastsAndReceivesShadows:
            DescribeShadowDisplay = "cast and receive shadows."
        Case acCastsShadows:
            DescribeShadowDisplay = "cast shadows only."
        Case acReceivesShadows:
            DescribeShadowDisplay = "receive shadows only."
        Case acIgnoreShadows:
            DescribeShadowDisplay = "ignore shadows."
    End Select
End Function

Visual LISP:

(vl-load-com)
(defun c:Example_ShadowDisplay()
    ;; This example creates a cone in model space and changes its shadow display setting.
    ;; AutoLISP cannot cast COM objects to different types, so you must change the Shadow Display
    ;; property via DXF code values.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq centerPoint (vlax-3d-point 0 0 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq coneObj (vla-AddCone modelSpace centerPoint 5 20))

    (setq ed (entget (vlax-vla-object->ename coneObj)))
    (setq shadowDisplay (assoc 284 ed))
    (if (= shadowDisplay nil)
        (setq shadowDisplay 0)
        (setq shadowDisplay (cdr shadowDisplay))
    )

    (setq displaySettingDesc (DescribeShadowDisplay ShadowDisplay))

    (alert (strcat "Shadow display is currently enabled for this object."
                   "\nCurrent shadow display setting is: " displaySettingDesc))

    ;; Before changing the value, you should validate the object is not a Line or some other
    ;; 2D object that does not support shadows.
    (setq newShadowDisplay acCastsShadows)
    (if (/= (assoc 284 ed) nil)
        (setq ed (subst (cons 284 acCastsShadows) (assoc 284 ed) ed))
        (setq ed (append ed (list (cons 284 acCastsShadows))))
    )

    (entmod ed)
    (entupd (vlax-vla-object->ename coneObj))
    (setq displaySettingDesc (DescribeShadowDisplay newShadowDisplay))
    (alert (strcat "New shadow display setting is: " displaySettingDesc))
)

(defun DescribeShadowDisplay (acShadow / )
    (cond
        ((= acShadow acCastsAndReceivesShadows) "cast and receive shadows.")
        ((= acShadow acCastsShadows) "cast shadows only.")
        ((= acShadow acReceivesShadows) "receive shadows only.")
        ((= acShadow acIgnoreShadows) "ignore shadows.")
    )
)


EnableStartupDialog Property (ActiveX)

Specifies whether a startup dialog box is displayed when AutoCAD is launched or a new drawing is created.

Supported platforms: Windows only

Signature

VBA:

object.EnableStartupDialog
object

Type: PreferencesSystem

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Displays a startup dialog box.
  • False: Does not display a startup dialog box.

Remarks

The initial value for this property is False.

The traditional startup dialog box can be displayed when EnableStartupDialog is True.

Examples

VBA:

Sub Example_EnableStartupDialog()
    ' This example returns the current setting of
    ' EnableStartupDialog. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currEnableStartupDialog As Boolean

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current EnableStartupDialog value
    currEnableStartupDialog = preferences.System.EnableStartupDialog
    MsgBox "The current value for EnableStartupDialog is " & preferences.System.EnableStartupDialog, vbInformation, "EnableStartupDialog Example"

    ' Change the value for EnableStartupDialog
    preferences.System.EnableStartupDialog = Not (currEnableStartupDialog)
    MsgBox "The new value for EnableStartupDialog is " & preferences.System.EnableStartupDialog, vbInformation, "EnableStartupDialog Example"

    ' Reset EnableStartupDialog to its original value
    preferences.System.EnableStartupDialog = currEnableStartupDialog
    MsgBox "The EnableStartupDialog value is reset to " & preferences.System.EnableStartupDialog, vbInformation, "EnableStartupDialog Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_EnableStartupDialog()
    ;; This example returns the current setting of
    ;; EnableStartupDialog. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the system preferences object
    (setq ACADPref (vla-get-System preferences))

    ;; Retrieve the current EnableStartupDialog value
    (setq currEnableStartupDialog (vla-get-EnableStartupDialog ACADPref))
    (alert (strcat "The current value for EnableStartupDialog is " (if (= currEnableStartupDialog :vlax-true) "True" "False")))

    ;; Change the value for EnableStartupDialog
    (vla-put-EnableStartupDialog ACADPref (if (= currEnableStartupDialog :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-EnableStartupDialog ACADPref))
    (alert (strcat "The new value for EnableStartupDialog is " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset EnableStartupDialog to its original value
    (vla-put-EnableStartupDialog ACADPref currEnableStartupDialog)
    (alert (strcat "The EnableStartupDialog value is reset to " (if (= currEnableStartupDialog :vlax-true) "True" "False")))
)


EndAngle Property (ActiveX)

Specifies the end angle of an arc or ellipse.

Supported platforms: Windows only

Signature

VBA:

object.EndAngle
object

Type: Arc, Ellipse

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The end angle in radians. Use 6.28 radians to specify a closed circle or ellipse.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_EndAngle()
    ' This example creates an ellipse and enters the start and
    ' end angles to create an elliptical arc.
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double

    ' Create an ellipse in model space
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    'Enter a start angle of 45 degrees, and an end angle of 270 degrees
    ellObj.startAngle = 45 * (3.14 / 180)
    ellObj.endAngle = 270 * (3.14 / 180)
    ZoomAll
    MsgBox "This ellipse has a start angle of " & ellObj.startAngle * (180 / 3.14) & " and the end angle of " & ellObj.endAngle * (180 / 3.14) & " degrees.", vbInformation, "EndAngle Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_EndAngle()
    ;; This example creates an ellipse and enters the start and
    ;; end angles to create an elliptical arc.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create an ellipse in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

    ;; Enter a start angle of 45 degrees, and an end angle of 270 degrees
    (vla-put-StartAngle ellObj (* 45 (/ 3.14 180)))
    (vla-put-EndAngle ellObj (* 270 (/ 3.14 180)))
    (vla-ZoomAll acadObj)
    (alert (strcat "This ellipse has a start angle of " (rtos (* (vla-get-StartAngle ellObj) (/ 180 3.14)) 2) " and the end angle of " (rtos (* (vla-get-EndAngle ellObj) (/ 180 3.14)) 2) " degrees."))
)


EndDraftAngle Property (ActiveX)

Specifies the draft angle of the surface for the last cross section.

Supported platforms: Windows only

Signature

VBA:

object.EndDraftAngle
object

Type: LoftedSurface

The object to which this property applies.

Property Value

Read-only: No

Type: Long

The draft angle of the last cross section.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


EndDraftMagnitude Property (ActiveX)

Specifies the draft magnitude of the surface for the last cross section.

Supported platforms: Windows only

Signature

VBA:

object.EndDraftMagnitude
object

Type: LoftedSurface

The object to which this property applies.

Property Value

Read-only: No

Type: Long

The draft magnitude of the last cross section.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


EndParameter Property (ActiveX)

Specifies the end parameter for an ellipse.

Supported platforms: Windows only

Signature

VBA:

object.EndParameter
object

Type: Ellipse

The object this property applies to.

Property Value

Read-only: No

Type: Double

The valid range is 0 to 2*PI.

Remarks

The start and end parameters of the ellipse are calculated based on the following equation:

P(Theta) = A * cos(Theta) + B * sin(Theta)

where A and B are the semimajor and semiminor axes respectively.

For example, if your start angle is Theta1, the corresponding start parameter is P(Theta1) calculated based on the above formula. Similarly, if your end angle is Theta2, the corresponding end parameter is P(Theta2) calculated based on the above formula.

You can use either an angle or a parameter to create the ellipse.

Examples

VBA:

Sub Example_EndParameter()
    ' This example creates an ellipse and enters the start and
    ' end parameters to create an elliptical arc.
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double

    ' Create an ellipse in model space
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    ' Enter a start parameter of 1.57, and an end parameter of 6.28
    ellObj.StartParameter = 1.57
    ellObj.EndParameter = 6.28
    ZoomAll

    ' Find the start and end parameters for the ellipse
    MsgBox "The ellipse has a start parameter of " & ellObj.StartParameter & " and an end parameter of " & ellObj.EndParameter, vbInformation, "EndParameter Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_EndParameter()
    ;; This example creates an ellipse and enters the start and
    ;; end parameters to create an elliptical arc.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create an ellipse in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

    ;; Enter a start parameter of 1.57, and an end parameter of 6.28
    (vla-put-StartParameter ellObj 1.57)
    (vla-put-EndParameter ellObj 6.28)
    (vla-ZoomAll acadObj)

    ;; Find the start and end parameters for the ellipse
    (alert (strcat "The ellipse has a start parameter of " (rtos (vla-get-StartParameter ellObj) 2) " and an end parameter of " (rtos (vla-get-EndParameter ellObj) 2)))
)


EndPoint Property (ActiveX)

Specifies the endpoint for the arc, line, or ellipse.

Supported platforms: Windows only

Signature

VBA:

object.EndPoint
object

Type: Arc, Ellipse, Line

The objects this property applies to.

Property Value

Read-only: Yes, except the Line object which is read-write

Type: Variant (three-element array of doubles)

A 3D coordinate representing the endpoint of the object.

Remarks

The endpoint for an arc, ellipse, and line

NoteYou cannot change the endpoint of an arc or an ellipse. To edit an arc, use the EndAngle and Radius properties. To edit an ellipse, use the EndAngle, MajorAxis, and RadiusRatio properties.

Examples

VBA:

Sub Example_EndPoint()
    ' This example creates an elliptical arc and then
    ' finds the coordinates of its start and end points.
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    Dim startPoint As Variant
    Dim endPoint As Variant

    ' Create an ellipse in model space
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    ' Enter a start angle of 45 degrees, and an end angle of 270 degrees
    ellObj.startAngle = 45 * (3.14 / 180)
    ellObj.endAngle = 270 * (3.14 / 180)
    ZoomAll

    ' Find the start and endpoints for the ellipse
    startPoint = ellObj.startPoint
    endPoint = ellObj.endPoint
    MsgBox "This ellipse has a start point of " & startPoint(0) & ", " & startPoint(1) & ", " & startPoint(2) & " and an endpoint of " & endPoint(0) & ", " & endPoint(1) & ", " & endPoint(2), vbInformation, "EndPoint Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_EndPoint()
    ;; This example creates an elliptical arc and then
    ;; finds the coordinates of its start and end points.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create an ellipse in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

    ;; Enter a start angle of 45 degrees, and an end angle of 270 degrees
    (vla-put-StartAngle ellObj (* 45 (/ 3.14 180)))
    (vla-put-EndAngle ellObj (* 270 (/ 3.14 180)))
    (vla-ZoomAll acadObj)

    ;; Find the start and endpoints for the ellipse
    (setq startPoint (vlax-safearray->list (vlax-variant-value (vla-get-StartPoint ellObj))))
    (setq endPoint (vlax-safearray->list (vlax-variant-value (vla-get-EndPoint ellObj))))
    (alert (strcat "This ellipse has a start point of " (rtos (nth 0 startPoint) 2) ", "
                                                (rtos (nth 1 startPoint) 2) ", "
                                                (rtos (nth 2 startPoint) 2) " and an endpoint of "
                                                (rtos (nth 0 endPoint) 2) ", "
                                                (rtos (nth 1 endPoint) 2) ", "
                                                (rtos (nth 2 endPoint) 2)))
)


EndSmoothContinuity Property (ActiveX)

Specifies the tangency and curvature of the last cross section.

Supported platforms: Windows only

Signature

VBA:

object.EndSmoothContinuity
object

Type: LoftedSurface

The object to which this property applies.

Property Value

Read-only: No

Type: Long

The tangency and curvature of the last cross section.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


EndSmoothMagnitude Property (ActiveX)

Specifies the size of the curve of the last cross section.

Supported platforms: Windows only

Signature

VBA:

object.EndSmoothMagnitude
object

Type: LoftedSurface

The object to which this property applies.

Property Value

Read-only: No

Type: Double

The size of the curve of the last cross section.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


EndSubMenuLevel Property (ActiveX)

Specifies the last item in a submenu.

Supported platforms: Windows only

Signature

VBA:

object.EndSubMenuLevel
object

Type: PopupMenuItem

The object this property applies to.

Property Value

Read-only: No

Type: Integer

The number of menu levels this menu item terminates.

Remarks

The default value for this property is zero (0), specifying that this menu item is not the last item in the submenu.

A value of one (1) indicates that this item is the last item in a submenu. A value of two (2) indicates that this item is the last item of a submenu and also of its parent menu. This value should be incremented for each parent menu for which this item terminates.

Examples

VBA:

Not available

Visual LISP:

Not available


EndTangent Property (ActiveX)

Specifies the end tangent of the spline as a directional vector.

Supported platforms: Windows only

Signature

VBA:

object.EndTangent
object

Type: Spline

The object this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

A directional vector representing the end tangent of the spline.

Remarks

When a spline is elevated, it is converted from an interpolated (fit) spline to a control point spline. This means that after elevation, the spline no longer has fit tangents and the StartTangent and EndTangent properties for the spline are no longer accessible. The only way to edit a control point spline is through the ControlPoints property, or the SetControlPoint or GetControlPoint methods.

Examples

VBA:

Sub Example_EndTangent()
    ' This example creates a spline. It then queries the current setting for
    ' the EndTangent, and then changes the EndTangent to a new value.

    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double
    Dim msg As String

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)

    ZoomAll
    GoSub GETPOINTS
    MsgBox "The EndTangent for the spline is " & msg, vbInformation, "EndTangent Example"

    ' Change the end tangent of Spline to (1.5,0.707,2)
    Dim newTan(0 To 2) As Double
    newTan(0) = 1.5: newTan(1) = 0.707: newTan(2) = 2
    splineObj.EndTangent = newTan

    ThisDrawing.Regen True
    GoSub GETPOINTS
    MsgBox "The EndTangent has been changed to " & msg, vbInformation, "EndTangent Example"

    Exit Sub

GETPOINTS:
    msg = ""
    ' Get the coordinates from the end tangent
    Dim count As Integer
    For count = 0 To 2
        msg = msg & Format(splineObj.EndTangent(count), "0.###") & ", "
    Next
    msg = VBA.Left(msg, Len(msg) - 2)
    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_EndTangent()
    ;; This example creates a spline. It then queries the current setting for
    ;; the EndTangent, and then changes the EndTangent to a new value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the spline
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(1 1 0
                     5 5 0
                     10 0 0
                    )
    )

    ;; Create the spline
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))

    (vla-ZoomAll acadObj)

    (setq msg "")

    ;; Get the coordinates from the end tangent
    (setq endTangent (vlax-safearray->list (vlax-variant-value (vla-get-EndTangent splineObj))))
    (setq msg (strcat msg (rtos (nth 0 endTangent) 2 3) ","
                  (rtos (nth 1 endTangent) 2 3) ","
                  (rtos (nth 2 endTangent) 2 3)))

    (alert (strcat "The EndTangent for the spline is " msg))

    ;; Change the end tangent of Spline to (1.5,0.707,2)
    (setq newTan (vlax-3d-point 1.5 0.707 2))
    (vla-put-EndTangent splineObj newTan)

    (vla-Regen doc :vlax-true)

    (setq msg "")
    (setq endTangent (vlax-safearray->list (vlax-variant-value (vla-get-EndTangent splineObj))))
    (setq msg (strcat msg (rtos (nth 0 endTangent) 2 3) ","
                  (rtos (nth 1 endTangent) 2 3) ","
                  (rtos (nth 2 endTangent) 2 3)))

    (alert (strcat "The EndTangent has been changed to " msg))
)


EnterpriseMenuFile Property (ActiveX)

Specifies the location of the enterprise customization (CUIx) file.

Supported platforms: Windows only

Signature

VBA:

object.EnterpriseMenuFile
object

Type: PreferencesFiles

The object to which this property applies.

Property Value

Read-only: No

Type: String

The location of the customization (CUIx) file.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


EntityColor Property (ActiveX)

Specifies the color value of the true color.

Supported platforms: Windows only

Signature

VBA:

object.EntityColor
object

Type: AcCmColor

The object this property applies to.

Property Value

Read-only: No

Type: Long

The color value of the true color.

Remarks

This property specifies the 32-bit AcCmEntityColor portion of the color.

Examples

VBA:

Sub Example_EntityColor()
    Dim color As AcadAcCmColor
    Set color = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Dim y As Long
    y = MakeLong(MakeWord(194, 122), MakeWord(133, 144))
    color.EntityColor = y
    Dim line As AcadLine
    Set line = CreateLine
    line.TrueColor = color
    Dim retcolor As AcadAcCmColor
    Set retcolor = line.TrueColor

    Dim x As Long
    x = retcolor.EntityColor

    Dim BreakLong(3) As Byte
    BreakLong(0) = x And &HFF&
    BreakLong(1) = (x And &HFF00&) \ &H100&
    BreakLong(2) = (x And &HFF0000) \ &H10000
    BreakLong(3) = (x And &H7F000000) \ &H1000000
    If x < 0 Then BreakLong(3) = BreakLong(3) Or &H80

    MsgBox "ColorMethod = " & BreakLong(3) & vbCrLf & _
     "Red = " & BreakLong(2) & vbCrLf & _
     "Green = " & BreakLong(1) & vbCrLf & _
     "Blue = " & BreakLong(0)
End Sub

Private Function CreateLine() As AcadLine
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double

    startPoint(0) = 1#: startPoint(1) = 1#: startPoint(2) = 0#
    endPoint(0) = 5#: endPoint(1) = 5#: endPoint(2) = 0#

    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    Set CreateLine = lineObj
    ZoomAll
End Function

Private Function MakeLong(WordHi As Variant, WordLo As Integer) As Long

   ' High word is coerced to a variant on the call, to allow
   ' it to overflow the limits of multiplication, which shifts
   ' it left.

   MakeLong = (WordHi * &H10000) + (WordLo And &HFFFF&)
End Function

Private Function MakeWord(ByteHi As Byte, ByteLo As Byte) As Integer
   ' If the high byte would push the final result out of the
   ' signed integer range, it must be slid back.

   If ByteHi > &H7F Then
      MakeWord = ((ByteHi * &H100&) + ByteLo) - &H10000
   Else
      MakeWord = (ByteHi * &H100&) + ByteLo
   End If
End Function

Visual LISP:

(vl-load-com)
(defun c:Example_EntityColor()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq color (vlax-create-object "AutoCAD.AcCmColor.20"))

    (setq y (MakeLong (MakeWord 194 122) (MakeWord 133 144)))
    (vla-put-EntityColor color y)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq line (CreateLine))
    (vla-put-TrueColor line color)
    (setq retcolor (vla-get-TrueColor line))

    (setq x (vla-get-EntityColor retcolor))

    (setq BreakLong (vlax-make-safearray vlax-vbDouble '(0 . 3)))
    (vlax-safearray-put-element BreakLong 0 (logand x 255))
    (vlax-safearray-put-element BreakLong 1 (/ (logand x 65280) 256))
    (vlax-safearray-put-element BreakLong 2 (/ (logand x 16711680) 65536))
    (vlax-safearray-put-element BreakLong 3 (/ (logand x 2130706432) 16777216))

    (if (< x 0)
        (vlax-safearray-put-element BreakLong 3 (logior (fix (vlax-safearray-get-element BreakLong 3)) 128))
    )

    (alert (strcat "ColorMethod = " (itoa (fix (vlax-safearray-get-element BreakLong 3))) "\n"
                   "Red = " (itoa (fix (vlax-safearray-get-element BreakLong 2))) "\n"
                   "Green = " (itoa (fix (vlax-safearray-get-element BreakLong 1))) "\n"
                   "Blue = " (itoa (fix (vlax-safearray-get-element BreakLong 0)))))

    (vlax-release-object color)
)

(defun CreateLine()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq startPoint (vlax-3d-point 1 1 0)
          endPoint (vlax-3d-point 5 5 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-ZoomAll acadObj)
    lineObj
)

(defun MakeLong (WordHi WordLo)
   ;; High word is coerced to a variant on the call, to allow
   ;; it to overflow the limits of multiplication, which shifts
   ;; it left.
   (+ (* WordHi 65536) (logand WordLo 65535))
)

(defun MakeWord(ByteHi ByteLo)
   ;; If the high byte would push the final result out of the
   ;; signed integer range, it must be slid back.
   (if (> ByteHi 127)
      (- (+ (* ByteHi 256) ByteLo) 65536)
      (+ (* ByteHi 256) ByteLo)
   )
)


EntityTransparency Property (ActiveX)

Specifies the transparency value for the entity.

Supported platforms: Windows only

Signature

VBA:

object.EntityTransparency
object

Type: All drawing objects

The object this property applies to.

Property Value

Read-only: No

Type: String

Use one of the following values:

  • ByLayer: Transparency value determined by layer
  • ByBlock: Transparency value determined by block
  • 0: Fully opaque (not transparent)
  • 1-90: Transparency value defined as a percentage

Remarks

When representing a percentage of transparency for an entity, the string value is of an integer and not a double.

Examples

VBA:

Not available

Visual LISP:

Not available


Explodable Property (ActiveX)

Specifies whether the block can be exploded.

Supported platforms: Windows only

Signature

VBA:

object.Explodable
object

Type: Block

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The block can be exploded.
  • False: The block cannot be exploded.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ExtensionLineColor Property (ActiveX)

Specifies the color for dimension extension lines.

Supported platforms: Windows only

Signature

VBA:

object.ExtensionLineColor
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimOrdinate, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: acColor enum

Use a color index number from 0 to 256, or one of the constants listed here:

  • acByBlock
  • acByLayer
  • acRed
  • acYellow
  • acGreen
  • acCyan
  • acBlue
  • acMagenta
  • acWhite

Remarks

Colors can be set and read as numeric index values ranging from 0 to 256. Constants have been provided for the standard seven colors, as well as the BYBLOCK and BYLAYER designations.

If you use acByBlock, AutoCAD draws new objects in the default color (white or black, depending on your configuration) until they are grouped into the block. When the block is inserted in the drawing, the objects in the block inherit the current setting of the color property.

If you use acByLayer, new objects assume the color of the layer upon which they are drawn.

NoteThis property overrides the value of the DIMCLRE system variable for the given dimension object.

Examples

VBA:

Sub Example_ExtensionLineColor()
    ' This example creates a Dim3PointAngular object in model space
    ' and changes the extension line color to red using the ExtensionLineColor property

    Dim DimPointAngularObj As AcadDim3PointAngular
    Dim AngleVertex(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double

    ' Define the new Dim3PointAngular object
    AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
    FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
    SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
    TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

    ' Create the new Dim3PointAngular object in model space
    Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)
    ThisDrawing.Application.ZoomAll

    ' Read and display current dimension line color
    MsgBox "The extension line color for this object is currently set to: " & DimPointAngularObj.ExtensionLineColor

    ' Change the extension line color
    DimPointAngularObj.ExtensionLineColor = acRed
    ThisDrawing.Regen acAllViewports

    ' Read and display current extension line color
    MsgBox "The extension line color for this object is now set to: " & DimPointAngularObj.ExtensionLineColor & " (Red)"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ExtensionLineColor()
    ;; This example creates a Dim3PointAngular object in model space
    ;; and changes the extension line color to red using the ExtensionLineColor property
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Dim3PointAngular object
    (setq AngleVertex (vlax-3d-point 0 0 0)
          FirstPoint (vlax-3d-point 2 2 0)
          SecondPoint (vlax-3d-point 1 4 0)
          TextPoint (vlax-3d-point 6 6 0))

    ;; Create the new Dim3PointAngular object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq DimPointAngularObj (vla-AddDim3PointAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    ;; Read and display current dimension line color
    (alert (strcat "The extension line color for this object is currently set to: " (itoa (vla-get-ExtensionLineColor DimPointAngularObj))))

    ;; Change the extension line color
    (vla-put-ExtensionLineColor DimPointAngularObj acRed)
    (vla-Regen doc acAllViewports)

    ;; Read and display current extension line color
    (alert (strcat "The extension line color for this object is now set to: " (itoa (vla-get-ExtensionLineColor DimPointAngularObj)) " (Red)"))
)


ExtensionLineExtend Property (ActiveX)

Specifies the distance the extension line extends beyond the dimension line.

Supported platforms: Windows only

Signature

VBA:

object.ExtensionLineExtend
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Double

A positive real number specifying the distance to extend the extension line beyond the dimension line.

Remarks

The initial value for this property is 0.1800.

NoteThis property overrides the value of the DIMEXE system variable for the given dimension.

Examples

VBA:

Sub Example_ExtensionLineExtend()
    ' This example creates a Dim3PointAngular object in model space
    ' and changes the length of the extension line to extend 1.5 units past
    ' the dimension using the ExtensionLineExtend property

    Dim DimPointAngularObj As AcadDim3PointAngular
    Dim AngleVertex(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double

    ' Define the new Dim3PointAngular object
    AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
    FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
    SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
    TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

    ' Create the new Dim3PointAngular object in model space
    Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)
    ThisDrawing.Application.ZoomAll

    ' Read and display current extension line extend length
    MsgBox "The extension line currently extends " & DimPointAngularObj.ExtensionLineExtend & " units past the dimension"

    ' Change the extension line extend length to extend 1.5
    ' units past the dimension
    DimPointAngularObj.ExtensionLineExtend = 1.5
    ThisDrawing.Regen acAllViewports

    ' Read and display current extension line extend length
    MsgBox "The extension line now extends " & DimPointAngularObj.ExtensionLineExtend & " units past the dimension"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ExtensionLineExtend()
    ;; This example creates a Dim3PointAngular object in model space
    ;; and changes the length of the extension line to extend 1.5 units past
    ;; the dimension using the ExtensionLineExtend property
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Dim3PointAngular object
    (setq AngleVertex (vlax-3d-point 0 0 0)
          FirstPoint (vlax-3d-point 2 2 0)
          SecondPoint (vlax-3d-point 1 4 0)
          TextPoint (vlax-3d-point 6 6 0))

    ;; Create the new Dim3PointAngular object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq DimPointAngularObj (vla-AddDim3PointAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    ;; Read and display current extension line extend length
    (alert (strcat "The extension line currently extends " (rtos (vla-get-ExtensionLineExtend DimPointAngularObj) 2) " units past the dimension"))

    ;; Change the extension line extend length to extend 1.5
    ;; units past the dimension
    (vla-put-ExtensionLineExtend DimPointAngularObj 1.5)
    (vla-Regen doc acAllViewports)

    ;; Read and display current extension line extend length
    (alert (strcat "The extension line now extends " (rtos (vla-get-ExtensionLineExtend DimPointAngularObj) 2) " units past the dimension"))
)


ExtensionLineOffset Property (ActiveX)

Specifies the distance the extension lines are offset from the origin points.

Supported platforms: Windows only

Signature

VBA:

object.ExtensionLineOffset
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimOrdinate, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Double

A positive real number specifying the distance to offset the extension line beyond the origin points.

Remarks

The initial value for this property is 0.0625.

NoteThis property overrides the value of the DIMEXO system variable for the given dimension.

Examples

VBA:

Sub Example_ExtensionLineOffset()
    ' This example creates a Dim3PointAngular object in model space
    ' and changes the offset of the extension lines using the
    ' ExtensionLineOffset property

    Dim DimPointAngularObj As AcadDim3PointAngular
    Dim AngleVertex(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double

    ' Define the new Dim3PointAngular object
    AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
    FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
    SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
    TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

    ' Create the new Dim3PointAngular object in model space
    Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)
    ThisDrawing.Application.ZoomAll

    ' Read and display current offset of the extension lines from the control points
    MsgBox "The extension lines are currently offset " & DimPointAngularObj.ExtensionLineOffset & " units"

    ' Change the extension lines offset distance from the control points
    DimPointAngularObj.ExtensionLineOffset = 1.5
    ThisDrawing.Regen acAllViewports

    ' Read and display current offset of the extension lines from the control points
    MsgBox "The extension lines are now offset " & DimPointAngularObj.ExtensionLineOffset & " units"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ExtensionLineOffset()
    ;; This example creates a Dim3PointAngular object in model space
    ;; and changes the offset of the extension lines using the
    ;; ExtensionLineOffset property
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Dim3PointAngular object
    (setq AngleVertex (vlax-3d-point 0 0 0)
          FirstPoint (vlax-3d-point 2 2 0)
          SecondPoint (vlax-3d-point 1 4 0)
          TextPoint (vlax-3d-point 6 6 0))

    ;; Create the new Dim3PointAngular object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq DimPointAngularObj (vla-AddDim3PointAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    ;; Read and display current offset of the extension lines from the control points
    (alert (strcat "The extension lines are currently offset " (rtos (vla-get-ExtensionLineOffset DimPointAngularObj) 2) " units"))

    ;; Change the extension lines offset distance from the control points
    (vla-put-ExtensionLineOffset DimPointAngularObj 1.5)
    (vla-Regen doc acAllViewports)

    ;; Read and display current offset of the extension lines from the control points
    (alert (strcat "The extension lines are now offset " (rtos (vla-get-ExtensionLineOffset DimPointAngularObj) 2) " units"))
)


ExtensionLineWeight Property (ActiveX)

Specifies the lineweight for the extension lines.

Supported platforms: Windows only

Signature

VBA:

object.ExtensionLineWeight
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimOrdinate, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: acLineWeight enum

  • acLnWtByLayer
  • acLnWtByBlock
  • acLnWtByLwDefault
  • acLnWt000
  • acLnWt005
  • acLnWt009
  • acLnWt013
  • acLnWt015
  • acLnWt018
  • acLnWt020
  • acLnWt025
  • acLnWt030
  • acLnWt035
  • acLnWt040
  • acLnWt050
  • acLnWt053
  • acLnWt060
  • acLnWt070
  • acLnWt080
  • acLnWt090
  • acLnWt100
  • acLnWt106
  • acLnWt120
  • acLnWt140
  • acLnWt158
  • acLnWt200
  • acLnWt211

Remarks

The initial value for this property is acLnWtByBlock.

Lineweight settings are only visible when the LineweightDisplay property is set to True.

NoteThis property overrides the value of the DIMLWE system variable for the given dimension.

Examples

VBA:

Sub Example_ExtensionLineWeight()
    ' This example creates a Dim3PointAngular object in model space
    ' and changes the extension lineweight to a thicker value
    ' using the ExtensionLineWeight property

    Dim DimPointAngularObj As AcadDim3PointAngular
    Dim AngleVertex(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double
    Dim oldLWSetting As Boolean
    Dim CurrentSetting As String

    ' Turn on lineweight display to see the changes
    oldLWSetting = ThisDrawing.preferences.LineWeightDisplay
    ThisDrawing.preferences.LineWeightDisplay = True

    ' Define the new Dim3PointAngular object
    AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
    FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
    SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
    TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

    ' Create the new Dim3PointAngular object in model space
    Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)
    ThisDrawing.Application.ZoomAll

    ' Read and display current extension lineweight
    CurrentSetting = DimPointAngularObj.ExtensionLineWeight
    Select Case CurrentSetting
        Case acLnWtByLayer: CurrentSetting = "ByLayer"
        Case acLnWtByBlock: CurrentSetting = "ByBlock"
        Case acLnWtByLwDefault: CurrentSetting = "ByDefault"
        Case Else
    End Select

    MsgBox "The extension lineweight for this object is currently set to: " & CurrentSetting

    ' Change the extension lineweight
    DimPointAngularObj.ExtensionLineWeight = acLnWt100
    ThisDrawing.Regen acAllViewports

    ' Read and display current extension lineweight
    MsgBox "The extension line weight for this object is now set to: " & DimPointAngularObj.ExtensionLineWeight

    ' Return previous lineweight setting
    ThisDrawing.preferences.LineWeightDisplay = oldLWSetting

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ExtensionLineWeight()
    ;; This example creates a Dim3PointAngular object in model space
    ;; and changes the extension lineweight to a thicker value
    ;; using the ExtensionLineWeight property
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences doc))

    ;; Turn on lineweight display to see the changes
    (setq oldLWSetting (vla-get-LineWeightDisplay preferences))
    (vla-put-LineWeightDisplay preferences :vlax-true)

    ;; Define the new Dim3PointAngular object
    (setq AngleVertex (vlax-3d-point 0 0 0)
          FirstPoint (vlax-3d-point 2 2 0)
          SecondPoint (vlax-3d-point 1 4 0)
          TextPoint (vlax-3d-point 6 6 0))

    ;; Create the new Dim3PointAngular object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq DimPointAngularObj (vla-AddDim3PointAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    ;; Read and display current extension lineweight
    (setq CurrentSetting (vla-get-ExtensionLineWeight DimPointAngularObj))
    (cond
        ((= acLnWtByLayer CurrentSetting)(setq CurrentSetting "ByLayer"))
        ((= acLnWtByBlock CurrentSetting)(setq CurrentSetting "ByBlock"))
        ((= acLnWtByLwDefault CurrentSetting)(setq CurrentSetting "ByDefault"))
                                                (setq CurrentSetting (itoa CurrentSetting))
    )

    (alert (strcat "The extension lineweight for this object is currently set to: " CurrentSetting))

    ;; Change the extension lineweight
    (vla-put-ExtensionLineWeight DimPointAngularObj acLnWt100)
    (vla-Regen doc acAllViewports)

    ;; Read and display current extension lineweight
    (alert (strcat "The extension line weight for this object is now set to: " (itoa (vla-get-ExtensionLineWeight DimPointAngularObj))))

    ;; Return previous lineweight setting
    (vla-put-ExtensionLineWeight DimPointAngularObj oldLWSetting)
)


ExtLine1EndPoint Property (ActiveX)

Specifies the endpoint of the first extension line.

Supported platforms: Windows only

Signature

VBA:

object.ExtLine1EndPoint
object

Type: Dim3PointAngular, DimAngular

The objects this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

A 3D coordinate representing the endpoint of the first extension line.

Remarks

The ExtLine1EndPoint and ExtLine2EndPoint properties contain the endpoints of the extension lines. If no extension lines exist for a given dimension, these points will equal ExtLine1StartPoint and ExtLine2StartPoint.

ExtLine1EndPoint

Examples

VBA:

Sub Example_ExtLine1EndPoint()
    ' This example creates an angular dimension. It then changes
    ' the location of the ExtLine1EndPoint.

    Dim dimObj As AcadDimAngular
    Dim angVert(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double

    ' Define the dimension
    angVert(0) = 0#: angVert(1) = 5#: angVert(2) = 0#
    FirstPoint(0) = 1#: FirstPoint(1) = 7#: FirstPoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    TextPoint(0) = 3#: TextPoint(1) = 5#: TextPoint(2) = 0#

    ' Create the angular dimension in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAngular(angVert, FirstPoint, SecondPoint, TextPoint)
    ZoomAll
    MsgBox "The current value of ExtLine1EndPoint is " & dimObj.ExtLine1EndPoint(0) & ", " & dimObj.ExtLine1EndPoint(1) & ", " & dimObj.ExtLine1EndPoint(2), vbInformation, "ExtLine1EndPoint Example"

    ' Change the endpoint of the first extension line
    SecondPoint(0) = 0: SecondPoint(1) = 3: SecondPoint(2) = 0
    dimObj.ExtLine1EndPoint = SecondPoint
    dimObj.Update

    ' Return the endpoint of the first extension line
    ' Note that the return value is a Variant
    Dim retPnt As Variant
    retPnt = dimObj.ExtLine1EndPoint
    MsgBox "The new value of ExtLine1EndPoint is " & dimObj.ExtLine1EndPoint(0) & ", " & dimObj.ExtLine1EndPoint(1) & ", " & dimObj.ExtLine1EndPoint(2), vbInformation, "ExtLine1EndPoint Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ExtLine1EndPoint()
    ;; This example creates an angular dimension. It then changes
    ;; the location of the ExtLine1EndPoint.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq AngleVertex (vlax-3d-point 0 5 0)
          FirstPoint (vlax-3d-point 1 7 0)
          SecondPoint (vlax-3d-point 1 3 0)
          TextPoint (vlax-3d-point 3 5 0))

    ;; Create the angular dimension in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    (setq extLineEndPoint (vlax-safearray->list (vlax-variant-value (vla-get-ExtLine1EndPoint dimObj))))
    (alert (strcat "The current value of ExtLine1EndPoint is " (rtos (nth 0 extLineEndPoint) 2) ", "
                                                       (rtos (nth 1 extLineEndPoint) 2) ", "
                                                       (rtos (nth 2 extLineEndPoint) 2)))

    ;; Change the endpoint of the first extension line
    (setq SecondPoint (vlax-3d-point 0 3 0))
    (vla-put-ExtLine1EndPoint dimObj SecondPoint)
    (vla-Update dimObj)

    ;; Return the endpoint of the first extension line
    ;; Note that the return value is a Variant
    (setq retPnt (vlax-safearray->list (vlax-variant-value (vla-get-ExtLine1EndPoint dimObj))))
    (alert (strcat "The new value of ExtLine1EndPoint is " (rtos (nth 0 retPnt) 2) ", "
                                                   (rtos (nth 1 retPnt) 2) ", "
                                                   (rtos (nth 2 retPnt) 2)))
)


ExtLine1Linetype Property (ActiveX)

Specifies the linetype of the first extension line.

Supported platforms: Windows only

Signature

VBA:

object.ExtLine1Linetype
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimRotated

The objects to which this property applies.

Property Value

Read-only: No

Type: String

The linetype of the first extension line.

Remarks

NoteThis property overrides the value of the DIMLTEX1 system variable for the given dimension.

Examples

VBA:

Not available

Visual LISP:

Not available


ExtLine1Point Property (ActiveX)

Specifies the origin of extension line 1.

Supported platforms: Windows only

Signature

VBA:

object.ExtLine1Point
object

Type: DimAligned, DimArcLength

The objects this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

A 3D coordinate representing the origin of the first extension line.

Remarks

The dimension line of an aligned dimension will be parallel to the line joining the origins of extension lines 1 and 2.

Line to be dimensioned

Dimension created

Examples

VBA:

Sub Example_ExtLine1Point()
    ' This example creates an aligned dimension and then changes the
    ' ExtLine1Point property for that dimension.

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5#: point1(1) = 5#: point1(2) = 0#
    point2(0) = 10#: point2(1) = 5#: point2(2) = 0#
    location(0) = 5#: location(1) = 7#: location(2) = 0#

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ZoomAll
    MsgBox "The current value for ExtLine1Point is " & dimObj.ExtLine1Point(0) & ", " & dimObj.ExtLine1Point(1) & ", " & dimObj.ExtLine1Point(2), vbInformation, "ExtLine1Point Example"

    ' Change the endpoint of the first extension line
    point1(0) = 2: point1(1) = 5: point1(2) = 0
    dimObj.ExtLine1Point = point1
    dimObj.Update

    ' Return the endpoint of the first extension line
    ' Note that the return value is a Variant
    Dim retPnt As Variant
    retPnt = dimObj.ExtLine1Point

    MsgBox "The new value for ExtLine1Point is " & dimObj.ExtLine1Point(0) & ", " & dimObj.ExtLine1Point(1) & ", " & dimObj.ExtLine1Point(2), vbInformation, "ExtLine1Point Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ExtLine1Point()
    ;; This example creates an aligned dimension and then changes the
    ;; ExtLine1Point property for that dimension.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 10 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    (setq extLinePoint (vlax-safearray->list (vlax-variant-value (vla-get-ExtLine1Point dimObj))))
    (alert (strcat "The current value for ExtLine1Point is " (rtos (nth 0 extLinePoint) 2) ", "
                                                     (rtos (nth 1 extLinePoint) 2) ", "
                                                     (rtos (nth 2 extLinePoint) 2)))

    ;; Change the endpoint of the first extension line
    (setq point1 (vlax-3d-point 2 5 0))
    (vla-put-ExtLine1Point dimObj point1)
    (vla-Update dimObj)

    ;; Return the endpoint of the first extension line
    ;; Note that the return value is a Variant
    (setq retPnt (vlax-safearray->list (vlax-variant-value (vla-get-ExtLine1Point dimObj))))
    (alert (strcat "The new value for ExtLine1Point is " (rtos (nth 0 retPnt) 2) ", "
                                                 (rtos (nth 1 retPnt) 2) ", "
                                                 (rtos (nth 2 retPnt) 2)))
)


ExtLine1StartPoint Property (ActiveX)

Specifies the start point of the first extension line.

Supported platforms: Windows only

Signature

VBA:

object.ExtLine1StartPoint
object

Type: DimAngular

The object this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

A 3D coordinate representing the start point of the first extension line.

Remarks

The ExtLine1StartPoint and ExtLine2StartPoint properties are equal to the FirstEndPoint and SecondEndPoint parameters from the AddDimAngular method. The extension lines are originally drawn from the FirstEndPoint and SecondEndPoint locations to the intersection of the dimension line. AutoCAD draws the dimension line as an arc between the extension lines.

ExtLine1StartPoint

Examples

VBA:

Sub Example_ExtLine1StartPoint()
    ' This example creates an angular dimension. It then changes
    ' the location of the ExtLine1StartPoint.

    Dim dimObj As AcadDimAngular
    Dim angVert(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double

    ' Define the dimension
    angVert(0) = 0#: angVert(1) = 5#: angVert(2) = 0#
    FirstPoint(0) = 1#: FirstPoint(1) = 7#: FirstPoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    TextPoint(0) = 3#: TextPoint(1) = 5#: TextPoint(2) = 0#

    ' Create the angular dimension in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAngular(angVert, FirstPoint, SecondPoint, TextPoint)
    ZoomAll
    MsgBox "The current value of ExtLine1StartPoint is " & dimObj.ExtLine1StartPoint(0) & ", " & dimObj.ExtLine1StartPoint(1) & ", " & dimObj.ExtLine1StartPoint(2), vbInformation, "ExtLine1StartPoint Example"

    ' Change the start point of the first extension line
    FirstPoint(0) = 0: FirstPoint(1) = 3: FirstPoint(2) = 0
    dimObj.ExtLine1StartPoint = FirstPoint
    dimObj.Update

    ' Return the start point of the first extension line
    ' Note that the return value is a Variant
    Dim retPnt As Variant
    retPnt = dimObj.ExtLine1StartPoint
    MsgBox "The new value of ExtLine1StartPoint is " & dimObj.ExtLine1StartPoint(0) & ", " & dimObj.ExtLine1StartPoint(1) & ", " & dimObj.ExtLine1StartPoint(2), vbInformation, "ExtLine1StartPoint Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ExtLine1StartPoint()
    ;; This example creates an angular dimension. It then changes
    ;; the location of the ExtLine1StartPoint.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq AngleVertex (vlax-3d-point 0 5 0)
          FirstPoint (vlax-3d-point 1 7 0)
          SecondPoint (vlax-3d-point 1 3 0)
          TextPoint (vlax-3d-point 3 5 0))

    ;; Create the angular dimension in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    (setq extLineStartPoint (vlax-safearray->list (vlax-variant-value (vla-get-ExtLine1StartPoint dimObj))))
    (alert (strcat "The current value of ExtLine1StartPoint is " (rtos (nth 0 extLineStartPoint) 2) ", "
                                                         (rtos (nth 1 extLineStartPoint) 2) ", "
                                                         (rtos (nth 2 extLineStartPoint) 2)))

    ;; Change the start point of the first extension line
    (setq FirstPoint (vlax-3d-point 0 3 0))
    (vla-put-ExtLine1StartPoint dimObj FirstPoint)
    (vla-Update dimObj)

    ;; Return the start point of the first extension line
    ;; Note that the return value is a Variant
    (setq retPnt (vlax-safearray->list (vlax-variant-value (vla-get-ExtLine1StartPoint dimObj))))
    (alert (strcat "The new value of ExtLine1StartPoint is " (rtos (nth 0 retPnt) 2) ", "
                                                     (rtos (nth 1 retPnt) 2) ", "
                                                     (rtos (nth 2 retPnt) 2)))
)


ExtLine1Suppress Property (ActiveX)

Specifies the suppression of the first extension line.

Supported platforms: Windows only

Signature

VBA:

object.ExtLine1Suppress
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress the first extension line.
  • False: Do not suppress the first extension line.

Remarks

The initial value for this property is False.

NoteThis property overrides the value of the DIMSE1 system variable for the given dimension.

Examples

VBA:

Sub Example_ExtLine1Suppress()
    ' This example creates a Dim3PointAngular object in model space
    ' and suppresses the extension lines using the ExtLine1Suppress
    ' and ExtLine2Suppress properties

    Dim DimPointAngularObj As AcadDim3PointAngular
    Dim AngleVertex(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double
    Dim Line1Suppressed As String, Line2Suppressed As String

    ' Define the new Dim3PointAngular object
    AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
    FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
    SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
    TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

    ' Create the new Dim3PointAngular object in model space
    Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)
    ThisDrawing.Application.ZoomAll

    ' Read and display current extension line suppression information
    Line1Suppressed = IIf(DimPointAngularObj.ExtLine1Suppress, "is suppressed", "is not suppressed")
    Line2Suppressed = IIf(DimPointAngularObj.ExtLine2Suppress, "is suppressed", "is not suppressed")

    MsgBox "Line one of the extension " & Line1Suppressed & vbCrLf & _
           "Line two of the extension " & Line2Suppressed

    ' Suppress line one of the extension
    DimPointAngularObj.ExtLine1Suppress = True
    ThisDrawing.Regen acAllViewports
    MsgBox "Line one of the extension is now suppressed"

    ' Suppress line two of the extension
    DimPointAngularObj.ExtLine2Suppress = True
    ThisDrawing.Regen acAllViewports
    MsgBox "Line two of the extension is now suppressed"

    ' Turn both extension lines back on
    DimPointAngularObj.ExtLine1Suppress = False
    DimPointAngularObj.ExtLine2Suppress = False
    ThisDrawing.Regen acAllViewports
    MsgBox "Both extension lines are now visible again"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ExtLine1Suppress()
    ;; This example creates a Dim3PointAngular object in model space
    ;; and suppresses the extension lines using the ExtLine1Suppress
    ;; and ExtLine2Suppress properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Dim3PointAngular object
    (setq AngleVertex (vlax-3d-point 0 0 0)
          FirstPoint (vlax-3d-point 2 2 0)
          SecondPoint (vlax-3d-point 1 4 0)
          TextPoint (vlax-3d-point 6 6 0))

    ;; Create the new Dim3PointAngular object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq DimPointAngularObj (vla-AddDim3PointAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    ;; Read and display current extension line suppression information
    (setq Line1Suppressed (if (= (vla-get-ExtLine1Suppress DimPointAngularObj) :vlax-true) "is suppressed" "is not suppressed"))
    (setq Line2Suppressed (if (= (vla-get-ExtLine2Suppress DimPointAngularObj) :vlax-true) "is suppressed" "is not suppressed"))

    (alert (strcat "Line one of the extension " Line1Suppressed "\n"
                   "Line two of the extension " Line2Suppressed))

    ;; Suppress line one of the extension
    (vla-put-ExtLine1Suppress DimPointAngularObj :vlax-true)
    (vla-Regen doc acAllViewports)
    (alert "Line one of the extension is now suppressed")

    ;; Suppress line two of the extension
    (vla-put-ExtLine2Suppress DimPointAngularObj :vlax-true)
    (vla-Regen doc acAllViewports)
    (alert "Line two of the extension is now suppressed")

    ;; Turn both extension lines back on
    (vla-put-ExtLine1Suppress DimPointAngularObj :vlax-false)
    (vla-put-ExtLine2Suppress DimPointAngularObj :vlax-false)
    (vla-Regen doc acAllViewports)
    (alert "Both extension lines are now visible again")
)


ExtLine2EndPoint Property (ActiveX)

Specifies the endpoint of the second extension line.

Supported platforms: Windows only

Signature

VBA:

object.ExtLine2EndPoint
object

Type: Dim3PointAngular, DimAngular

The objects this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

A 3D coordinate representing the endpoint of the second extension line.

Remarks

The ExtLine1EndPoint and ExtLine2EndPoint properties contain the endpoints of the extension lines. If no extension lines exist for a given dimension, these points will equal ExtLine1StartPoint and ExtLine2StartPoint.

ExtLine2EndPoint

Examples

VBA:

Sub Example_ExtLine2EndPoint()
    ' This example creates an angular dimension. It then changes
    ' the location of the ExtLine2EndPoint.

    Dim dimObj As AcadDimAngular
    Dim angVert(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double

    ' Define the dimension
    angVert(0) = 0#: angVert(1) = 5#: angVert(2) = 0#
    FirstPoint(0) = 1#: FirstPoint(1) = 7#: FirstPoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    TextPoint(0) = 3#: TextPoint(1) = 5#: TextPoint(2) = 0#

    ' Create the angular dimension in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAngular(angVert, FirstPoint, SecondPoint, TextPoint)
    ZoomAll
    MsgBox "The current value of ExtLine2EndPoint is " & dimObj.ExtLine2EndPoint(0) & ", " & dimObj.ExtLine2EndPoint(1) & ", " & dimObj.ExtLine2EndPoint(2), vbInformation, "ExtLine2EndPoint Example"

    ' Change the endpoint of the second extension line
    SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
    dimObj.ExtLine2EndPoint = SecondPoint
    dimObj.Update

    ' Return the endpoint of the second extension line
    ' Note that the return value is a Variant
    Dim retPnt As Variant
    retPnt = dimObj.ExtLine2EndPoint
    MsgBox "The new value of ExtLine2EndPoint is " & dimObj.ExtLine2EndPoint(0) & ", " & dimObj.ExtLine2EndPoint(1) & ", " & dimObj.ExtLine2EndPoint(2), vbInformation, "ExtLine2EndPoint Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ExtLine2EndPoint()
    ;; This example creates an angular dimension. It then changes
    ;; the location of the ExtLine2EndPoint.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq AngleVertex (vlax-3d-point 0 5 0)
          FirstPoint (vlax-3d-point 1 7 0)
          SecondPoint (vlax-3d-point 1 3 0)
          TextPoint (vlax-3d-point 3 5 0))

    ;; Create the angular dimension in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    (setq extLineEndPoint (vlax-safearray->list (vlax-variant-value (vla-get-ExtLine2EndPoint dimObj))))
    (alert (strcat "The current value of ExtLine2EndPoint is " (rtos (nth 0 extLineEndPoint) 2) ", "
                                                       (rtos (nth 1 extLineEndPoint) 2) ", "
                                                       (rtos (nth 2 extLineEndPoint) 2)))

    ;; Change the endpoint of the second extension line
    (setq SecondPoint (vlax-3d-point 1 4 0))
    (vla-put-ExtLine2EndPoint dimObj SecondPoint)
    (vla-Update dimObj)

    ;; Return the endpoint of the second extension line
    ;; Note that the return value is a Variant
    (setq retPnt (vlax-safearray->list (vlax-variant-value (vla-get-ExtLine2EndPoint dimObj))))
    (alert (strcat "The new value of ExtLine2EndPoint is " (rtos (nth 0 retPnt) 2) ", "
                                                   (rtos (nth 1 retPnt) 2) ", "
                                                   (rtos (nth 2 retPnt) 2)))
)


ExtLine2Linetype Property (ActiveX)

Specifies the linetype of the second extension line.

Supported platforms: Windows only

Signature

VBA:

object.ExtLine2Linetype
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimRotated

The objects to which this property applies.

Property Value

Read-only: No

Type: String

The linetype of the second extension line.

Remarks

NoteThis property overrides the value of the DIMLTEX2 system variable for the given dimension.

Examples

VBA:

Not available

Visual LISP:

Not available


ExtLine2Point Property (ActiveX)

Specifies the origin of extension line 2.

Supported platforms: Windows only

Signature

VBA:

object.ExtLine2Point
object

Type: DimAligned, DimArcLength

The objects this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

A 3D coordinate representing the origin of the second extension line.

Remarks

The dimension line of an aligned dimension will be parallel to the origins of extension lines 1 and 2.

Line to be dimensioned

Dimension created

Examples

VBA:

Sub Example_ExtLine2Point()
    ' This example creates an aligned dimension and then changes the
    ' ExtLine2Point property for that dimension.

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5#: point1(1) = 5#: point1(2) = 0#
    point2(0) = 10#: point2(1) = 5#: point2(2) = 0#
    location(0) = 5#: location(1) = 7#: location(2) = 0#

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ZoomAll
    MsgBox "The current value for ExtLine2Point is " & dimObj.ExtLine2Point(0) & ", " & dimObj.ExtLine2Point(1) & ", " & dimObj.ExtLine2Point(2), vbInformation, "ExtLine2Point Example"

    ' Change the endpoint of the second extension line
    point1(0) = 12: point1(1) = 5: point1(2) = 0
    dimObj.ExtLine2Point = point1
    dimObj.Update

    ' Return the endpoint of the second extension line
    ' Note that the return value is a Variant
    Dim retPoint As Variant
    retPoint = dimObj.ExtLine2Point

    MsgBox "The new value for ExtLine2Point is " & dimObj.ExtLine2Point(0) & ", " & dimObj.ExtLine2Point(1) & ", " & dimObj.ExtLine2Point(2), vbInformation, "ExtLine2Point Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ExtLine2Point()
    ;; This example creates an aligned dimension and then changes the
    ;; ExtLine2Point property for that dimension.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 10 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    (setq extLinePoint (vlax-safearray->list (vlax-variant-value (vla-get-ExtLine2Point dimObj))))
    (alert (strcat "The current value for ExtLine2Point is " (rtos (nth 0 extLinePoint) 2) ", "
                                                     (rtos (nth 1 extLinePoint) 2) ", "
                                                     (rtos (nth 2 extLinePoint) 2)))

    ;; Change the endpoint of the second extension line
    (setq point2 (vlax-3d-point 12 5 0))
    (vla-put-ExtLine2Point dimObj point2)
    (vla-Update dimObj)

    ;; Return the endpoint of the second extension line
    ;; Note that the return value is a Variant
    (setq retPnt (vlax-safearray->list (vlax-variant-value (vla-get-ExtLine2Point dimObj))))
    (alert (strcat "The new value for ExtLine2Point is " (rtos (nth 0 retPnt) 2) ", "
                                                 (rtos (nth 1 retPnt) 2) ", "
                                                 (rtos (nth 2 retPnt) 2)))
)


ExtLine2StartPoint Property (ActiveX)

Specifies the start point of the second extension line.

Supported platforms: Windows only

Signature

VBA:

object.ExtLine2StartPoint
object

Type: DimAngular

The object this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

A 3D coordinate representing the start point of the second extension line.

Remarks

The ExtLine1StartPoint and ExtLine2StartPoint properties are equal to the FirstEndPoint and SecondEndPoint parameters from the AddDimAngular method. The extension lines are originally drawn from the FirstEndPoint and SecondEndPoint locations to the intersection of the dimension line. AutoCAD draws the dimension line as an arc between the extension lines.

ExtLine2StartPoint

Examples

VBA:

Sub Example_ExtLine2StartPoint()
    ' This example creates an angular dimension. It then changes
    ' the location of the ExtLine2StartPoint.

    Dim dimObj As AcadDimAngular
    Dim angVert(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double

    ' Define the dimension
    angVert(0) = 0#: angVert(1) = 5#: angVert(2) = 0#
    FirstPoint(0) = 1#: FirstPoint(1) = 7#: FirstPoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    TextPoint(0) = 3#: TextPoint(1) = 5#: TextPoint(2) = 0#

    ' Create the angular dimension in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAngular(angVert, FirstPoint, SecondPoint, TextPoint)
    ZoomAll
    MsgBox "The current value of ExtLine2StartPoint is " & dimObj.ExtLine2StartPoint(0) & ", " & dimObj.ExtLine2StartPoint(1) & ", " & dimObj.ExtLine2StartPoint(2), vbInformation, "ExtLine2StartPoint Example"

    ' Change the start point of the second extension line
    FirstPoint(0) = 1: FirstPoint(1) = 4: FirstPoint(2) = 0
    dimObj.ExtLine2StartPoint = FirstPoint
    dimObj.Update

    ' Return the start point of the second extension line
    ' Note that the return value is a Variant
    Dim retPnt As Variant
    retPnt = dimObj.ExtLine2StartPoint
    MsgBox "The new value of ExtLine2StartPoint is " & dimObj.ExtLine2StartPoint(0) & ", " & dimObj.ExtLine2StartPoint(1) & ", " & dimObj.ExtLine2StartPoint(2), vbInformation, "ExtLine2StartPoint Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ExtLine2StartPoint()
    ;; This example creates an angular dimension. It then changes
    ;; the location of the ExtLine2StartPoint.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq AngleVertex (vlax-3d-point 0 5 0)
          FirstPoint (vlax-3d-point 1 7 0)
          SecondPoint (vlax-3d-point 1 3 0)
          TextPoint (vlax-3d-point 3 5 0))

    ;; Create the angular dimension in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    (setq extLineStartPoint (vlax-safearray->list (vlax-variant-value (vla-get-ExtLine2StartPoint dimObj))))
    (alert (strcat "The current value of ExtLine2StartPoint is " (rtos (nth 0 extLineStartPoint) 2) ", "
                                                         (rtos (nth 1 extLineStartPoint) 2) ", "
                                                         (rtos (nth 2 extLineStartPoint) 2)))

    ;; Change the start point of the second extension line
    (setq FirstPoint (vlax-3d-point 1 4 0))
    (vla-put-ExtLine2StartPoint dimObj FirstPoint)
    (vla-Update dimObj)

    ;; Return the start point of the second extension line
    ;; Note that the return value is a Variant
    (setq retPnt (vlax-safearray->list (vlax-variant-value (vla-get-ExtLine2StartPoint dimObj))))
    (alert (strcat "The new value of ExtLine2StartPoint is " (rtos (nth 0 retPnt) 2) ", "
                                                     (rtos (nth 1 retPnt) 2) ", "
                                                     (rtos (nth 2 retPnt) 2)))
)


ExtLine2Suppress Property (ActiveX)

Specifies the suppression of the second extension line.

Supported platforms: Windows only

Signature

VBA:

object.ExtLine2Suppress
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress the second extension line.
  • False: Do not suppress the second extension line.

Remarks

The initial value for this property is False.

NoteThis property overrides the value of the DIMSE2 system variable for the given dimension.

Examples

VBA:

Sub Example_ExtLine2Suppress()
    ' This example creates a Dim3PointAngular object in model space
    ' and suppresses the extension lines using the ExtLine1Suppress
    ' and ExtLine2Suppress properties

    Dim DimPointAngularObj As AcadDim3PointAngular
    Dim AngleVertex(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double
    Dim Line1Suppressed As String, Line2Suppressed As String

    ' Define the new Dim3PointAngular object
    AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
    FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
    SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
    TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

    ' Create the new Dim3PointAngular object in model space
    Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)
    ThisDrawing.Application.ZoomAll

    ' Read and display current extension line suppression information
    Line1Suppressed = IIf(DimPointAngularObj.ExtLine1Suppress, "is suppressed", "is not suppressed")
    Line2Suppressed = IIf(DimPointAngularObj.ExtLine2Suppress, "is suppressed", "is not suppressed")

    MsgBox "Line one of the extension " & Line1Suppressed & vbCrLf & _
           "Line two of the extension " & Line2Suppressed

    ' Suppress line one of the extension
    DimPointAngularObj.ExtLine1Suppress = True
    ThisDrawing.Regen acAllViewports
    MsgBox "Line one of the extension is now suppressed"

    ' Suppress line two of the extension
    DimPointAngularObj.ExtLine2Suppress = True
    ThisDrawing.Regen acAllViewports
    MsgBox "Line two of the extension is now suppressed"

    ' Turn both extension lines back on
    DimPointAngularObj.ExtLine1Suppress = False
    DimPointAngularObj.ExtLine2Suppress = False
    ThisDrawing.Regen acAllViewports
    MsgBox "Both extension lines are now visible again"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ExtLine2Suppress()
    ;; This example creates a Dim3PointAngular object in model space
    ;; and suppresses the extension lines using the ExtLine1Suppress
    ;; and ExtLine2Suppress properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Dim3PointAngular object
    (setq AngleVertex (vlax-3d-point 0 0 0)
          FirstPoint (vlax-3d-point 2 2 0)
          SecondPoint (vlax-3d-point 1 4 0)
          TextPoint (vlax-3d-point 6 6 0))

    ;; Create the new Dim3PointAngular object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq DimPointAngularObj (vla-AddDim3PointAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    ;; Read and display current extension line suppression information
    (setq Line1Suppressed (if (= (vla-get-ExtLine1Suppress DimPointAngularObj) :vlax-true) "is suppressed" "is not suppressed"))
    (setq Line2Suppressed (if (= (vla-get-ExtLine2Suppress DimPointAngularObj) :vlax-true) "is suppressed" "is not suppressed"))

    (alert (strcat "Line one of the extension " Line1Suppressed "\n"
                   "Line two of the extension " Line2Suppressed))

    ;; Suppress line one of the extension
    (vla-put-ExtLine1Suppress DimPointAngularObj :vlax-true)
    (vla-Regen doc acAllViewports)
    (alert "Line one of the extension is now suppressed")

    ;; Suppress line two of the extension
    (vla-put-ExtLine2Suppress DimPointAngularObj :vlax-true)
    (vla-Regen doc acAllViewports)
    (alert "Line two of the extension is now suppressed")

    ;; Turn both extension lines back on
    (vla-put-ExtLine1Suppress DimPointAngularObj :vlax-false)
    (vla-put-ExtLine2Suppress DimPointAngularObj :vlax-false)
    (vla-Regen doc acAllViewports)
    (alert "Both extension lines are now visible again")
)


ExtLineFixedLen Property (ActiveX)

Set extension line fixed length.

Supported platforms: Windows only

Signature

VBA:

object.ExtLineFixedLen
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimOrdinate, DimRotated

The objects to which this property applies.

Property Value

Read-only: No

Type: Double

The fixed length of the extension line.

Remarks

NoteThis property overrides the value of the DIMFXL system variable for the given dimension.

Examples

VBA:

Not available

Visual LISP:

Not available


ExtLineFixedLenSuppress Property (ActiveX)

Sets suppression of extension line fixed length On or Off.

Supported platforms: Windows only

Signature

VBA:

object.ExtLineFixedLenSuppress
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimOrdinate, DimRotated

The objects to which this property applies.

Property Value

Read-only: No

Type: Boolean

  • True: Extension line fixed length enabled.
  • False: Extension line fixed length disabled.

Remarks

NoteThis property overrides the value of the DIMFXLON system variable for the given dimension.

Examples

VBA:

Not available

Visual LISP:

Not available


FaceCount Property (ActiveX)

Returns the number of faces in the SubD mesh.

Supported platforms: Windows only

Signature

VBA:

object.FaceCount
object

Type: SubDMesh

The objects this property applies to.

Property Value

Read-only: Yes

Type: Long

The number of faces in the SubD mesh.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Fade Property (ActiveX)

Specifies the current fade value of a raster or underlay image.

Supported platforms: Windows only

Signature

VBA:

object.Fade
object

Type: DgnUnderlay, DwfUnderlay, GeomapImage, PdfUnderlay, RasterImage, Wipeout

The objects this property applies to.

Property Value

Read-only: No

Type: Long

The value is between 0 and 100 inclusive.

Remarks

You can adjust the raster or underlay image brightness, contrast, and fade to the display of the image as well as to the plotted output without affecting the original raster or underlay file. Adjust brightness to darken or lighten an image. Adjust contrast to make images with poor quality easier to read. Adjust fade to make vectors easier to see over images and to create a watermark effect in your plotted output.

NoteBitonal images cannot be adjusted for brightness, contrast, or fade.

Examples

VBA:

Sub Example_Fade()
    ' This example inserts a raster image and finds the current
    ' Fade value of the image. It then changes the Fade value
    ' of the image.

    ' This example uses the "2d Projected Polylines.jpg" found in the Sample
    ' directory. If you do not have the image, or if it is located
    ' in a different directory, insert a valid path and name for the
    ' imageName variable below.
    Dim insertionPoint(0 To 2) As Double
    Dim scalefactor As Double
    Dim rotAngleInDegree As Double
    Dim rotAngle As Double
    Dim imageName As String
    Dim raster As AcadRasterImage
    imageName = "C:\AutoCAD\sample\2d Projected Polylines.jpg"
    insertionPoint(0) = 2#: insertionPoint(1) = 2#: insertionPoint(2) = 0#
    scalefactor = 1#
    rotAngleInDegree = 0#
    rotAngle = rotAngleInDegree * 3.141592 / 180#

    On Error Resume Next

    ' Creates a raster image in model space
    Set raster = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotAngle)
    If Err.Description = "Filer error" Then
        MsgBox imageName & " could not be found."
        Exit Sub
    End If

    ' Find the current Fade
    ThisDrawing.Regen True
    MsgBox "The Fade is currently set to: " & raster.Fade, vbInformation

    ' Change the Fade to 5
    raster.Fade = 50
    ThisDrawing.Regen True
    MsgBox "The Fade is now set to: " & raster.Fade, vbInformation
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Fade()
    ;; This example inserts a raster image and finds the current
    ;; Fade value of the image. It then changes the Fade value
    ;; of the image.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; This example uses the "2d Projected Polylines.jpg" found in the Sample
    ;; directory. If you do not have the image, or if it is located
    ;; in a different directory, insert a valid path and name for the
    ;; imageName variable below.
    (setq insertionPoint (vlax-3d-point 2 2 0)
          imageName ".\\Sample\\VBA\\2d Projected Polylines.jpg"
          scalefactor 1
          rotAngle (/ (* 0 3.141592) 180))

    (if (/= (findfile imageName) nil)
        (progn
            ;; Creates a raster image in model space
            (setq modelSpace (vla-get-ModelSpace doc))
            (setq raster (vla-AddRaster modelSpace (findfile imageName) insertionPoint scalefactor rotAngle))
            (vla-ZoomExtents acadObj)

            ;; Find the current Fade
            (vla-Regen doc :vlax-true)
            (alert (strcat "The Fade is currently set to: " (rtos (vla-get-Fade raster) 2)))

            ;; Change the Fade to 5
            (vla-put-Fade raster 5)
            (vla-Regen doc :vlax-true)
            (alert (strcat "The Fade is now set to: " (rtos (vla-get-Fade raster) 2)))
    )
        (alert (strcat imageName " could not be found."))
    )
)


Feature Property (ActiveX)

Specifies the feature name of an entry in the File Dependency List.

Supported platforms: Windows only

Signature

VBA:

object.Feature
object

Type: FileDependency

The object this property applies to.

Property Value

Read-only: Yes

Type: String

Feature name (for example, "Acad:Xref").

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Feature()
    ' This example reads information from a File Dependency List
    ' Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ' \Sample\Sheet Sets\Architectural\A-01.dwg

    Dim objFDLCol As AutoCAD.AcadFileDependencies
    Dim objFDL As AutoCAD.AcadFileDependency

    Set objFDLCol = ThisDrawing.FileDependencies
    MsgBox ("The number of entries in the File Dependency List is " & objFDLCol.count & ".")

    Dim strTemp As String
    For Each objFDL In objFDLCol
        strTemp = "Affects graphics?: " & vbTab & objFDL.AffectsGraphics
        strTemp = strTemp & vbCrLf & "Feature: " & vbTab & objFDL.Feature
        strTemp = strTemp & vbCrLf & "FileName: " & vbTab & objFDL.FileName
        strTemp = strTemp & vbCrLf & "FileSize: " & vbTab & objFDL.FileSize
        strTemp = strTemp & vbCrLf & "Fingerprint GUID: " & vbTab & objFDL.FingerprintGuid
        strTemp = strTemp & vbCrLf & "FoundPath: " & vbTab & objFDL.FoundPath
        strTemp = strTemp & vbCrLf & "FullFileName: " & vbTab & objFDL.FullFileName
        strTemp = strTemp & vbCrLf & "Index: " & vbTab & objFDL.Index
        strTemp = strTemp & vbCrLf & "Modified?: " & vbTab & objFDL.IsModified
        strTemp = strTemp & vbCrLf & "ReferenceCount: " & vbTab & objFDL.ReferenceCount
        strTemp = strTemp & vbCrLf & "Timestamp: " & vbTab & objFDL.TimeStamp
        strTemp = strTemp & vbCrLf & "Version GUID: " & vbTab & objFDL.VersionGuid
        MsgBox strTemp
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Feature()
    ;; This example reads information from a File Dependency List
    ;; Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ;; .\\Sample\\Sheet Sets\\Architectural\\A-01.dwg
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq objFDLCol (vla-get-FileDependencies doc))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))

    (setq strTemp "")
    (vlax-for each-objFDL objFDLCol
        (setq strTemp (strcat "Affects graphics?: " (if (= (vla-get-AffectsGraphics each-objFDL) :vlax-true) "True" "False")))
        (setq strTemp (strcat strTemp
                                       "\nFeature: " (vla-get-Feature each-objFDL)
                                       "\nFileName: " (vla-get-FileName each-objFDL)
                                       "\nFileSize: " (itoa (vla-get-FileSize each-objFDL))
                                       "\nFingerprint GUID: " (vla-get-FingerprintGuid each-objFDL)
                                       "\nFoundPath: " (vla-get-FoundPath each-objFDL)
                                       "\nFullFileName: " (vla-get-FullFileName each-objFDL)
                                       "\nIndex: " (itoa (vla-get-Index each-objFDL))
                                       "\nModified?: " (if (= (vla-get-IsModified each-objFDL) :vlax-true) "True" "False")
                                       "\nReferenceCount: " (itoa (vla-get-ReferenceCount each-objFDL))
                                       "\nTimeStamp: " (itoa (vla-get-TimeStamp each-objFDL))
                                       "\nVersion GUID: " (vla-get-VersionGuid each-objFDL)
                          )
        )
        (alert strTemp)
    )
)


FieldLength Property (ActiveX)

Specifies the field length of the attribute.

Supported platforms: Windows only

Signature

VBA:

object.FieldLength
object

Type: Attribute, AttributeReference

The objects this property applies to.

Property Value

Read-only: No

Type: Integer

The field length of the attribute.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_FieldLength()
    ' This example creates an attribute definition in model space.
    ' It then queries the initial value of the FieldLength property,
    ' changes that value, and finally resets the value.

    Dim attributeObj As AcadAttribute
    Dim height As Double
    Dim mode As Long
    Dim prompt As String
    Dim insertionPoint(0 To 2) As Double
    Dim tag As String
    Dim value As String

    ' Define the attribute definition
    height = 1#
    mode = acAttributeModeVerify
    prompt = "New Prompt"
    insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0
    tag = "New_Tag"
    value = "New Value"

    ' Create the attribute definition object in model space
    Set attributeObj = ThisDrawing.ModelSpace.AddAttribute(height, mode, prompt, insertionPoint, tag, value)
    ZoomAll

    ' Return the current field length of the attribute
    Dim currFieldLength As Integer
    currFieldLength = attributeObj.FieldLength
    MsgBox "The FieldLength of the attribute is " & attributeObj.FieldLength, vbInformation, "FieldLength Example"

    ' Change the field length
    attributeObj.FieldLength = currFieldLength + 2
    attributeObj.Update
    MsgBox "The new FieldLength of the attribute is " & attributeObj.FieldLength, vbInformation, "FieldLength Example"

    ' Reset the field length to the original value
    attributeObj.FieldLength = currFieldLength
    attributeObj.Update
    MsgBox "The FieldLength of the attribute is reset to " & attributeObj.FieldLength, vbInformation, "FieldLength Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_FieldLength()
    ;; This example creates an attribute definition in model space.
    ;; It then queries the initial value of the FieldLength property,
    ;; changes that value, and finally resets the value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the attribute definition
    (setq insertionPoint (vlax-3d-point 5 5 0)
          height 1
          attMode acAttributeModeVerify
          attPrompt "New Prompt"
          attTag "NEW_TAG"
          attValue "New Value")

    ;; Create the attribute definition object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq attributeObj (vla-AddAttribute modelSpace height attMode attPrompt insertionPoint attTag attValue))
    (vla-ZoomAll acadObj)

    ;; Return the current field length of the attribute
    (setq currFieldLength (vla-get-FieldLength attributeObj))
    (alert (strcat "The FieldLength of the attribute is " (itoa currFieldLength)))

    ;; Change the field length
    (setq newFieldLength (+ currFieldLength 2))
    (vla-put-FieldLength attributeObj newFieldLength)
    (vla-Update attributeObj)
    (alert (strcat "The new FieldLength of the attribute is " (itoa newFieldLength)))

    ;; Reset the field length to the original value
    (vla-put-FieldLength attributeObj currFieldLength)
    (vla-Update attributeObj)
    (alert (strcat "The FieldLength of the attribute is reset to " (itoa currFieldLength)))
)


File Property (ActiveX)

Specifies the path to the underlay file.

Supported platforms: Windows only

Signature

VBA:

object.File
object

Type: DgnUnderlay, DwfUnderlay, PdfUnderlay

The object to which this property applies.

Property Value

Read-only: No

Type: String

The path to the underlay file.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


FileDependencies Property (ActiveX)

Returns the file dependency manager object.

Supported platforms: Windows only

Signature

VBA:

object.FileDependencies
object

Type: Database, Document

The object this property applies to.

Property Value

Read-only: Yes

Type: FileDependencies

Gets the FileDependencies object.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


FileName Property (ActiveX)

Specifies the file name of an entry in the File Dependency List.

Supported platforms: Windows only

Signature

VBA:

object.FileName
object

Type: FileDependency

The object this property applies to.

Property Value

Read-only: Yes

Type: String

Saved base file name without the path.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_FileName()
    ' This example reads information from a File Dependency List
    ' Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ' \Sample\Sheet Sets\Architectural\A-01.dwg

    Dim objFDLCol As AutoCAD.AcadFileDependencies
    Dim objFDL As AutoCAD.AcadFileDependency

    Set objFDLCol = ThisDrawing.FileDependencies
    MsgBox ("The number of entries in the File Dependency List is " & objFDLCol.count & ".")

    Dim strTemp As String
    For Each objFDL In objFDLCol
        strTemp = "Affects graphics?: " & vbTab & objFDL.AffectsGraphics
        strTemp = strTemp & vbCrLf & "Feature: " & vbTab & objFDL.Feature
        strTemp = strTemp & vbCrLf & "FileName: " & vbTab & objFDL.FileName
        strTemp = strTemp & vbCrLf & "FileSize: " & vbTab & objFDL.FileSize
        strTemp = strTemp & vbCrLf & "Fingerprint GUID: " & vbTab & objFDL.FingerprintGuid
        strTemp = strTemp & vbCrLf & "FoundPath: " & vbTab & objFDL.FoundPath
        strTemp = strTemp & vbCrLf & "FullFileName: " & vbTab & objFDL.FullFileName
        strTemp = strTemp & vbCrLf & "Index: " & vbTab & objFDL.Index
        strTemp = strTemp & vbCrLf & "Modified?: " & vbTab & objFDL.IsModified
        strTemp = strTemp & vbCrLf & "ReferenceCount: " & vbTab & objFDL.ReferenceCount
        strTemp = strTemp & vbCrLf & "Timestamp: " & vbTab & objFDL.TimeStamp
        strTemp = strTemp & vbCrLf & "Version GUID: " & vbTab & objFDL.VersionGuid
        MsgBox strTemp
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_FileName()
    ;; This example reads information from a File Dependency List
    ;; Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ;; .\\Sample\\Sheet Sets\\Architectural\\A-01.dwg
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq objFDLCol (vla-get-FileDependencies doc))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))

    (setq strTemp "")
    (vlax-for each-objFDL objFDLCol
        (setq strTemp (strcat "Affects graphics?: " (if (= (vla-get-AffectsGraphics each-objFDL) :vlax-true) "True" "False")))
        (setq strTemp (strcat strTemp
                                                         "\nFeature: " (vla-get-Feature each-objFDL)
                                                         "\nFileName: " (vla-get-FileName each-objFDL)
                                                         "\nFileSize: " (itoa (vla-get-FileSize each-objFDL))
                                                         "\nFingerprint GUID: " (vla-get-FingerprintGuid each-objFDL)
                                                         "\nFoundPath: " (vla-get-FoundPath each-objFDL)
                                                         "\nFullFileName: " (vla-get-FullFileName each-objFDL)
                                                         "\nIndex: " (itoa (vla-get-Index each-objFDL))
                                                         "\nModified?: " (if (= (vla-get-IsModified each-objFDL) :vlax-true) "True" "False")
                                                         "\nReferenceCount: " (itoa (vla-get-ReferenceCount each-objFDL))
                                                         "\nTimeStamp: " (itoa (vla-get-TimeStamp each-objFDL))
                                                         "\nVersion GUID: " (vla-get-VersionGuid each-objFDL)
                         )
           )
        (alert strTemp)
    )
)


Files Property (ActiveX)

Gets the PreferencesFiles object.

Supported platforms: Windows only

Signature

VBA:

object.Files
object

Type: Preferences

The object this property applies to.

Property Value

Read-only: Yes

Type: PreferencesFiles

Gets the PreferencesFiles object.

Remarks

The PreferencesFiles object holds all the options from the Files tab on the Options dialog stored in the registry. All options that are stored with the drawing can be found on the DatabasePreferences object.

Examples

VBA:

Sub Example_Files()
    ' This example obtains a reference to the Files Preferences object
    ' from the Application Preferences object, and reads one of the File
    ' preferences

    Dim ACADPref As AcadPreferencesFiles

    ' Obtain a reference to the Files Preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Files

    MsgBox "We now have access to the properties and methods of the Files Preferences object!"
    MsgBox "The File preference AutoSavePath is set to: " & ACADPref.AutoSavePath

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Files()
    ;; This example obtains a reference to the Files Preferences object
    ;; from the Application Preferences object, and reads one of the File
    ;; preferences
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Obtain a reference to the Files Preferences object
    (setq ACADPref (vla-get-Files preferences))

    (alert "We now have access to the properties and methods of the Files Preferences object!")
    (alert (strcat "The File preference AutoSavePath is set to: " (vla-get-AutoSavePath ACADPref)))
)


FileSize Property (ActiveX)

Specifies the file size of an entry in the File Dependency List.

Specifies the file size of an entry in the File Dependency List.

Supported platforms: Windows only

Signature

VBA:

object.FileSize
object

Type: FileDependency

The object this property applies to.

Property Value

Read-only: Yes

Type: Long

Current file size in bytes.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_FileSize()
    ' This example reads information from a File Dependency List
    ' Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ' \Sample\Sheet Sets\Architectural\A-01.dwg

    Dim objFDLCol As AutoCAD.AcadFileDependencies
    Dim objFDL As AutoCAD.AcadFileDependency

    Set objFDLCol = ThisDrawing.FileDependencies
    MsgBox ("The number of entries in the File Dependency List is " & objFDLCol.count & ".")

    Dim strTemp As String
    For Each objFDL In objFDLCol
        strTemp = "Affects graphics?: " & vbTab & objFDL.AffectsGraphics
        strTemp = strTemp & vbCrLf & "Feature: " & vbTab & objFDL.Feature
        strTemp = strTemp & vbCrLf & "FileName: " & vbTab & objFDL.FileName
        strTemp = strTemp & vbCrLf & "FileSize: " & vbTab & objFDL.FileSize
        strTemp = strTemp & vbCrLf & "Fingerprint GUID: " & vbTab & objFDL.FingerprintGuid
        strTemp = strTemp & vbCrLf & "FoundPath: " & vbTab & objFDL.FoundPath
        strTemp = strTemp & vbCrLf & "FullFileName: " & vbTab & objFDL.FullFileName
        strTemp = strTemp & vbCrLf & "Index: " & vbTab & objFDL.Index
        strTemp = strTemp & vbCrLf & "Modified?: " & vbTab & objFDL.IsModified
        strTemp = strTemp & vbCrLf & "ReferenceCount: " & vbTab & objFDL.ReferenceCount
        strTemp = strTemp & vbCrLf & "Timestamp: " & vbTab & objFDL.TimeStamp
        strTemp = strTemp & vbCrLf & "Version GUID: " & vbTab & objFDL.VersionGuid
        MsgBox strTemp
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_FileSize()
    ;; This example reads information from a File Dependency List
    ;; Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ;; .\\Sample\\Sheet Sets\\Architectural\\A-01.dwg
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq objFDLCol (vla-get-FileDependencies doc))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))

    (setq strTemp "")
    (vlax-for each-objFDL objFDLCol
        (setq strTemp (strcat "Affects graphics?: " (if (= (vla-get-AffectsGraphics each-objFDL) :vlax-true) "True" "False")))
        (setq strTemp (strcat strTemp
                                       "\nFeature: " (vla-get-Feature each-objFDL)
                                       "\nFileName: " (vla-get-FileName each-objFDL)
                                       "\nFileSize: " (itoa (vla-get-FileSize each-objFDL))
                                       "\nFingerprint GUID: " (vla-get-FingerprintGuid each-objFDL)
                                       "\nFoundPath: " (vla-get-FoundPath each-objFDL)
                                       "\nFullFileName: " (vla-get-FullFileName each-objFDL)
                                       "\nIndex: " (itoa (vla-get-Index each-objFDL))
                                       "\nModified?: " (if (= (vla-get-IsModified each-objFDL) :vlax-true) "True" "False")
                                       "\nReferenceCount: " (itoa (vla-get-ReferenceCount each-objFDL))
                                       "\nTimeStamp: " (itoa (vla-get-TimeStamp each-objFDL))
                                       "\nVersion GUID: " (vla-get-VersionGuid each-objFDL)
                         )
           )
        (alert strTemp)
    )
)


FingerprintGUID Property (ActiveX)

Specifies the Fingerprint GUID of an entry in the File Dependency List.

Supported platforms: Windows only

Signature

VBA:

object.FingerprintGUID
object

Type: FileDependency

The object this property applies to.

Property Value

Read-only: Yes

Type: String

The Fingerprint GUID of the entry.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_FingerprintGUID()
    ' This example reads information from a File Dependency List
    ' Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ' \Sample\Sheet Sets\Architectural\A-01.dwg

    Dim objFDLCol As AutoCAD.AcadFileDependencies
    Dim objFDL As AutoCAD.AcadFileDependency

    Set objFDLCol = ThisDrawing.FileDependencies
    MsgBox ("The number of entries in the File Dependency List is " & objFDLCol.count & ".")

    Dim strTemp As String
    For Each objFDL In objFDLCol
        strTemp = "Affects graphics?: " & vbTab & objFDL.AffectsGraphics
        strTemp = strTemp & vbCrLf & "Feature: " & vbTab & objFDL.Feature
        strTemp = strTemp & vbCrLf & "FileName: " & vbTab & objFDL.FileName
        strTemp = strTemp & vbCrLf & "FileSize: " & vbTab & objFDL.FileSize
        strTemp = strTemp & vbCrLf & "Fingerprint GUID: " & vbTab & objFDL.FingerprintGuid
        strTemp = strTemp & vbCrLf & "FoundPath: " & vbTab & objFDL.FoundPath
        strTemp = strTemp & vbCrLf & "FullFileName: " & vbTab & objFDL.FullFileName
        strTemp = strTemp & vbCrLf & "Index: " & vbTab & objFDL.Index
        strTemp = strTemp & vbCrLf & "Modified?: " & vbTab & objFDL.IsModified
        strTemp = strTemp & vbCrLf & "ReferenceCount: " & vbTab & objFDL.ReferenceCount
        strTemp = strTemp & vbCrLf & "Timestamp: " & vbTab & objFDL.TimeStamp
        strTemp = strTemp & vbCrLf & "Version GUID: " & vbTab & objFDL.VersionGuid
        MsgBox strTemp
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_FingerprintGUID()
    ;; This example reads information from a File Dependency List
    ;; Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ;; .\\Sample\\Sheet Sets\\Architectural\\A-01.dwg
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq objFDLCol (vla-get-FileDependencies doc))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))

    (setq strTemp "")
    (vlax-for each-objFDL objFDLCol
        (setq strTemp (strcat "Affects graphics?: " (if (= (vla-get-AffectsGraphics each-objFDL) :vlax-true) "True" "False")))
        (setq strTemp (strcat strTemp
                                       "\nFeature: " (vla-get-Feature each-objFDL)
                                       "\nFileName: " (vla-get-FileName each-objFDL)
                                       "\nFileSize: " (itoa (vla-get-FileSize each-objFDL))
                                       "\nFingerprint GUID: " (vla-get-FingerprintGuid each-objFDL)
                                       "\nFoundPath: " (vla-get-FoundPath each-objFDL)
                                       "\nFullFileName: " (vla-get-FullFileName each-objFDL)
                                       "\nIndex: " (itoa (vla-get-Index each-objFDL))
                                       "\nModified?: " (if (= (vla-get-IsModified each-objFDL) :vlax-true) "True" "False")
                                       "\nReferenceCount: " (itoa (vla-get-ReferenceCount each-objFDL))
                                       "\nTimeStamp: " (itoa (vla-get-TimeStamp each-objFDL))
                                       "\nVersion GUID: " (vla-get-VersionGuid each-objFDL)
                         )
           )
        (alert strTemp)
    )
)


FirstSegmentAngleConstraint Property (ActiveX)

Specifies the FirstSegmentAngleConstraint of the mleaderstyle.

Supported platforms: Windows only

Signature

VBA:

object.FirstSegmentAngleConstraint
object

Type: MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: Long

The first segment's angle constraint value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Fit Property (ActiveX)

Specifies the placement of text and arrowheads inside or outside extension lines, based on the available space between the extension lines.

Supported platforms: Windows only

Signature

VBA:

object.Fit
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: acDimFit enum

  • acTextAndArrows: This option places both the text and arrowheads inside the extension lines.
  • acArrowsOnly: This option places only the arrowheads inside the extension lines. The text is placed outside the arrowheads.
  • acTextOnly: This option places only the text inside the extension lines. The arrowheads are placed outside the extension lines.
  • acBestFit: This option places the text and arrowheads in the best fit location given the space available.

    When enough space is available for text and arrowheads, this option places both between the extension lines.

    When enough space is available for text only, this option places the text between the extension lines and places the arrowheads outside the extension lines.

    When enough space is available for arrowheads only, this option places them between the extension lines and places the text outside the extension lines.

    When space is available for neither text nor arrowheads, this option places them both outside the extension lines.

Remarks

The initial value for this property is acBestFit.

The Fit property sets priorities for moving text and arrowheads when space is not available to fit both within the extension lines.

NoteThis property overrides the value of the DIMATFIT system variable for the given dimension.

Examples

VBA:

Sub Example_Fit()
    ' This example creates an aligned dimension in model space
    ' and cycles the text fit of the dimension to a couple of common values

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim CurrentFit As String

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 6: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ThisDrawing.Application.ZoomAll

    ' Read and display current dimension line fit information
    Select Case dimObj.Fit
        Case acTextAndArrows:   CurrentFit = "Text and Arrows"
        Case acArrowsOnly:      CurrentFit = "Arrows Only"
        Case acTextOnly:        CurrentFit = "Text Only"
        Case acBestFit:         CurrentFit = "Best Fit"
    End Select

    MsgBox "The current dimension fit is set to: " & CurrentFit

    ' Change the fit to arrows only
    dimObj.Fit = acArrowsOnly
    ThisDrawing.Regen acAllViewports
    MsgBox "The dimension fit has been changed to arrows only"

    ' Change the fit to text only
    dimObj.Fit = acTextOnly
    ThisDrawing.Regen acAllViewports
    MsgBox "The dimension fit has been changed to text only"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Fit()
    ;; This example creates an aligned dimension in model space
    ;; and cycles the text fit of the dimension to a couple of common values
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 6 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    ;; Read and display current dimension line fit information
    (setq CurrentFit (vla-get-Fit dimObj))
    (cond
        ((= acTextAndArrows CurrentFit)(setq CurrentFit "Text and Arrows"))
        ((= acArrowsOnly CurrentFit)(setq CurrentFit "Arrows Only"))
        ((= acTextOnly CurrentFit)(setq CurrentFit "Text Only"))
        ((= acBestFit CurrentFit)(setq CurrentFit "Best Fit"))
                                    (setq CurrentFit (itoa CurrentFit))
    )

    (alert (strcat "The current dimension fit is set to: " CurrentFit))

    ;; Change the fit to arrows only
    (vla-put-Fit dimObj acArrowsOnly)
    (vla-Regen doc acAllViewports)
    (alert "The dimension fit has been changed to arrows only")

    ;; Change the fit to text only
    (vla-put-Fit dimObj acTextOnly)
    (vla-Regen doc acAllViewports)
    (alert "The dimension fit has been changed to text only")
)


FitPoints Property (ActiveX)

Specifies the fit points of a spline.

Supported platforms: Windows only

Signature

VBA:

object.FitPoints
object

Type: Spline

The object this property applies to.

Property Value

Read-only: No

Type: Variant (array of doubles)

An array of 3D WCS coordinates representing the fit points of the spline.

Remarks

The fit points define the path of the spline. You can change the tolerance of a given fit point by using the FitTolerance property. You can add a fit point by using the AddFitPoint method. You can delete a fit point by using the DeleteFitPoint method. You can query the location of a fit point by using the GetFitPoint method. You can change the location of a given fit point by using the SetFitPoint method.

Examples

VBA:

Sub Example_FitPoints()
    ' This example creates a Spline object in model space, reads the fit points
    ' of the Spline and then modifies the fit points of the Spline.

    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double, endTan(0 To 2) As Double
    Dim FPoints(0 To 8) As Double
    Dim UserMessage As String
    Dim fitPoints As Variant
    Dim iCount As Long, iPoint As Integer
    Dim NewFP(0 To 2) As Double

    ' Define the Spline object
    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    FPoints(0) = 0: FPoints(1) = 0: FPoints(2) = 0
    FPoints(3) = 5:   FPoints(4) = 5: FPoints(5) = 0
    FPoints(6) = 10: FPoints(7) = 0: FPoints(8) = 0

    ' Create new Spline object
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(FPoints, startTan, endTan)
    ThisDrawing.Application.ZoomAll

    ' Display fit points for this Spline
    GoSub DISPLAYPOINTS

    ' Modify an existing fit point for this Spline
    fitPoints(0) = 3
    splineObj.fitPoints = fitPoints

    ' Now add a new fit point
    NewFP(0) = 15: NewFP(1) = 4: NewFP(2) = 0
    splineObj.AddFitPoint splineObj.NumberOfFitPoints + 1, NewFP

    ThisDrawing.Application.ZoomAll

    ' Display new fit points for this Spline
    GoSub DISPLAYPOINTS

    Exit Sub

DISPLAYPOINTS:
    fitPoints = splineObj.fitPoints

    ' Display in groups of three
    UserMessage = ""
    iPoint = 0
    For iCount = 0 To UBound(fitPoints) Step 3
        iPoint = iPoint + 1
        UserMessage = UserMessage & iPoint & ")" & vbTab
        UserMessage = UserMessage & fitPoints(iCount)
        UserMessage = UserMessage & ", " & fitPoints(iCount + 1)
        UserMessage = UserMessage & ", " & fitPoints(iCount + 2)
        UserMessage = UserMessage & vbCrLf
    Next

    MsgBox "The " & splineObj.NumberOfFitPoints & " Spline fit points are: " & vbCrLf & vbCrLf & UserMessage

    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_FitPoints()
    ;; This example creates a Spline object in model space, reads the fit points
    ;; of the Spline and then modifies the fit points of the Spline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Spline object
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(0 0 0
                     5 5 0
                     10 0 0
                    )
    )

    ;; Create new Spline object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))

    (vla-ZoomAll acadObj)

    ;; Display fit points for this Spline
    (setq fitPoints (vlax-variant-value (vla-get-FitPoints splineObj)))

    ;; Display in groups of three
    (setq UserMessage ""
          iPoint 0
             iCount 0)

    (while (>= (vlax-safearray-get-u-bound fitPoints 1) iCount)
        (setq iPoint (1+ iPoint))
        (setq UserMessage (strcat UserMessage (itoa iPoint) ")  "
                                  (rtos (vlax-safearray-get-element fitPoints iCount) 2) ",  "
                                  (rtos (vlax-safearray-get-element fitPoints (+ iCount 1)) 2) ",  "
                                  (rtos (vlax-safearray-get-element fitPoints (+ iCount 2)) 2) "\n"))
        (setq iCount (+ iCount 3))
    )

    (alert (strcat "The " (itoa (vla-get-NumberOfFitPoints splineObj)) " Spline fit points are: \n\n" UserMessage))

    ;; Modify an existing fit point for this Spline
    (vlax-safearray-put-element fitPoints 0 3)
    (vla-put-FitPoints splineObj fitPoints)

    ;; Now add a new fit point
    (setq NewFP (vlax-3d-point 15 4 0))

    (vla-AddFitPoint splineObj (+ (vla-get-NumberOfFitPoints splineObj) 1) NewFP)

    (vla-ZoomAll acadObj)

    ;; Display new fit points for this Spline
    (setq fitPoints (vlax-variant-value (vla-get-FitPoints splineObj)))

    (setq UserMessage ""
          iPoint 0
             iCount 0)

    (while (>= (vlax-safearray-get-u-bound fitPoints 1) iCount)
        (setq iPoint (1+ iPoint))
        (setq UserMessage (strcat UserMessage (itoa iPoint) ")  "
                                  (rtos (vlax-safearray-get-element fitPoints iCount) 2) ",  "
                                  (rtos (vlax-safearray-get-element fitPoints (+ iCount 1)) 2) ",  "
                                  (rtos (vlax-safearray-get-element fitPoints (+ iCount 2)) 2) "\n"))
        (setq iCount (+ iCount 3))
    )

    (alert (strcat "The " (itoa (vla-get-NumberOfFitPoints splineObj)) " Spline fit points are: \n\n" UserMessage))
)


FitTolerance Property (ActiveX)

Refits the spline to the existing points with new tolerance values.

Supported platforms: Windows only

Signature

VBA:

object.FitTolerance
object

Type: Spline

The object this property applies to.

Property Value

Read-only: No

Type: Double

The fit tolerance cannot be a negative number.

Remarks

If the fit tolerance is set to zero, then the spline will pass through all the fit points. Providing a value greater than zero allows the curve to pass through the fit points within the specified tolerance.

Examples

VBA:

Sub Example_FitTolerance()
    ' This example creates a spline object in model space.
    ' It then changes the FitTolerance property of that spline.

    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ZoomAll

    ' Find the current FitTolerance value
    Dim currFitTolerance As Double
    currFitTolerance = splineObj.FitTolerance
    MsgBox "The current FitTolerance is " & currFitTolerance, vbInformation, "FitTolerance Example"

    ' Change the fit tolerance value
    splineObj.FitTolerance = 5
    ZoomAll
    MsgBox "The FitTolerance is now " & splineObj.FitTolerance, vbInformation, "FitTolerance Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_FitTolerance()
    ;; This example creates a spline object in model space.
    ;; It then changes the FitTolerance property of that spline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the spline
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(1 1 0
                     5 5 0
                     10 0 0
                    )
    )

    ;; Create new Spline object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)

    ;; Find the current FitTolerance value
    (setq currFitTolerance (vla-get-FitTolerance splineObj))
    (alert (strcat "The current FitTolerance is " (rtos currFitTolerance 2)))

    ;; Change the fit tolerance value
    (vla-put-FitTolerance splineObj 5)
    (vla-ZoomAll acadObj)
    (alert (strcat "The FitTolerance is now " (rtos (vla-get-FitTolerance splineObj) 2)))
)


FloatingRows Property (ActiveX)

Specifies the number of rows for a floating toolbar.

Supported platforms: Windows only

Signature

VBA:

object.FloatingRows
object

Type: Toolbar

The object this property applies to.

Property Value

Read-only: No

Type: Integer

The number of rows for a floating toolbar.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_FloatingRows()
    ' This example creates a new toolbar called "TestToolbar" and inserts three
    ' buttons into it. The toolbar is then displayed as a floating
    ' toolbar with 1 and then 3 rows.
    ' To remove the toolbar after execution of this macro, use the Customize Menu
    ' option from the Tools menu.

    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    ' Create the new toolbar
    Dim newToolBar As AcadToolbar
    Set newToolBar = currMenuGroup.Toolbars.Add("TestToolbar")

    ' Add three buttons to the new toolbar.
    ' All three buttons will have the same macro attached.
    Dim newButton1 As AcadToolbarItem
    Dim newButton2 As AcadToolbarItem
    Dim newButton3 As AcadToolbarItem
    Dim openMacro As String

    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set newButton1 = newToolBar.AddToolbarButton("", "NewButton1", "Open a file.", openMacro)
    Set newButton2 = newToolBar.AddToolbarButton("", "NewButton2", "Open a file.", openMacro)
    Set newButton3 = newToolBar.AddToolbarButton("", "NewButton3", "Open a file.", openMacro)

    ' Display the toolbar
    newToolBar.Visible = True
    newToolBar.Float 200, 200, 1

    MsgBox "The toolbar has " & newToolBar.FloatingRows & " row."

    newToolBar.FloatingRows = 2
    MsgBox "The toolbar has " & newToolBar.FloatingRows & " rows."

    newToolBar.FloatingRows = 3
    MsgBox "The toolbar has " & newToolBar.FloatingRows & " rows."

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_FloatingRows()
    ;; This example creates a new toolbar called "TestToolbar" and inserts three
    ;; buttons into it. The toolbar is then displayed as a floating
    ;; toolbar with 1 and then 3 rows.
    ;; To remove the toolbar after execution of this macro, use the Customize Menu
    ;; option from the Tools menu.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new toolbar
    (setq newToolBar (vla-Add (vla-get-Toolbars currMenuGroup) "TestToolbar"))

    ;; Add three buttons to the new toolbar.
    ;; All three buttons will have the same macro attached.
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))

    (setq newButton1 (vla-AddToolbarButton newToolBar "" "NewButton1" "Open a file." openMacro))
    (setq newButton2 (vla-AddToolbarButton newToolBar "" "NewButton2" "Open a file." openMacro))
    (setq newButton3 (vla-AddToolbarButton newToolBar "" "NewButton3" "Open a file." openMacro))

    ;; Display the toolbar
    (vla-put-Visible newToolBar :vlax-true)
    (vla-Float newToolBar 200 200 1)

    (alert (strcat "The toolbar has " (itoa (vla-get-FloatingRows newToolBar)) " row."))

    (vla-put-FloatingRows newToolBar 2)
    (alert (strcat "The toolbar has " (itoa (vla-get-FloatingRows newToolBar)) " rows."))

    (vla-put-FloatingRows newToolBar 3)
    (alert (strcat "The toolbar has " (itoa (vla-get-FloatingRows newToolBar)) " rows."))
)


FlowDirection Property (ActiveX)

Specifies whether the title and header rows are at the bottom or the top of the table.

Supported platforms: Windows only

Signature

VBA:

object.FlowDirection
object

Type: Table, TableStyle

The object this property applies to.

Property Value

Read-only: No

Type: AcTableDirection enum

Specify one of the following constants for the location of the title and header rows.

  • acTableBottomToTop: Table flow direction of bottom to top; value = 1
  • acTableTopToBottom: Table flow direction of top to bottom (default); value = 0

Remarks

No additional remarks.

Examples

VBA:

Sub Example_FlowDirection()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.FlowDirection = acTableBottomToTop
    customObj.HorzCellMargin = 0.22
    customObj.BitFlags = 1
    customObj.SetTextHeight AcRowType.acDataRow + AcRowType.acTitleRow, 1.3
    customObj.SetTextStyle AcRowType.acDataRow + AcRowType.acTitleRow, "Standard"

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 12, 23, 45
    customObj.SetBackgroundColor AcRowType.acDataRow + AcRowType.acTitleRow, col
    customObj.SetGridVisibility AcGridLineType.acHorzInside + AcGridLineType.acHorzTop _
                                , AcRowType.acDataRow + AcRowType.acTitleRow, True

    customObj.SetAlignment AcRowType.acDataRow + AcRowType.acTitleRow, acBottomRight
    col.SetRGB 244, 0, 0
    customObj.SetGridColor 3, 1, col

    MsgBox "Table Style Name = " & customObj.Name & vbCrLf & _
           "Style Description = " & customObj.Description & vbCrLf & _
           "Flow Direction = " & customObj.FlowDirection & vbCrLf & _
           "Horzontal Cell Margin = " & customObj.HorzCellMargin & vbCrLf & _
           "Bit Flags = " & customObj.BitFlags & vbCrLf & _
           "Title Row Text Height = " & customObj.GetTextHeight(acTitleRow) & vbCrLf & _
           "Title Row Text Style = " & customObj.GetTextStyle(acTitleRow) & vbCrLf & _
           "Grid Visibility for HorizontalBottom TitleRow  = " & customObj.GetGridVisibility(acHorzBottom, acTitleRow) & vbCrLf & _
           "Title Row Alignment = " & customObj.GetAlignment(acTitleRow) & vbCrLf & _
           "Header Suppression = " & customObj.HeaderSuppressed

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_FlowDirection()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-put-FlowDirection customObj acTableBottomToTop)
    (vla-put-HorzCellMargin customObj 0.22)
    (vla-put-BitFlags customObj 1)
    (vla-SetTextHeight customObj (+ acDataRow acTitleRow) 1.3)

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 12 23 45)

    (vla-SetBackgroundColor customObj (+ acDataRow acTitleRow) col)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) (+ acDataRow acTitleRow) :vlax-true)
    (vla-SetAlignment customObj (+ acDataRow acTitleRow) acBottomRight)
    (vla-SetRGB col 244 0 0)
    (vla-SetGridColor customObj (+ acHorzTop acHorzInside) acDataRow col)

    (alert (strcat "Table Style Name = " (vla-get-Name customObj)
                   "\nStyle Description = " (vla-get-Description customObj)
                   "\nFlow Direction = " (itoa (vla-get-FlowDirection customObj))
                   "\nHorzontal Cell Margin = " (rtos (vla-get-HorzCellMargin customObj) 2)
                   "\nBit Flags = " (itoa (vla-get-BitFlags customObj))
                   "\nTitle Row Text Height = " (rtos (vla-GetTextHeight customObj acTitleRow) 2)
                   "\nGrid Visibility for HorizontalBottom TitleRow  = " (if (= (vla-GetGridVisibility customObj acHorzBottom acTitleRow) :vlax-true) "True" "False")
                   "\nTitle Row Alignment = " (itoa (vla-GetAlignment customObj acTitleRow))
                      "\nHeader Suppression = " (if (= (vla-get-HeaderSuppressed customObj) :vlax-true) "True" "False")
              )
    )
    (vlax-release-object col)
)


Flyout Property (ActiveX)

Gets the toolbar associated with a flyout toolbar item.

Supported platforms: Windows only

Signature

VBA:

object.Flyout
object

Type: ToolbarItem

The object this property applies to.

Property Value

Read-only: Yes

Type: Toolbar

The toolbar that contains the toolbar item.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Flyout()
    ' This example uses MenuGroups to obtain a reference to the AutoCAD main menu.
    ' It then creates a new Toolbar(TestMenu) with a Toolbar button that will act
    ' as a flyout.  The examples sets the Flyout menu to an existing Toolbar menu.
    ' The Toolbar will automatically be displayed and will display the UCS menu
    ' as a flyout.

    Dim currMenuGroup As acadMenuGroup
    Dim newToolBar As AcadToolbar, newToolBarFlyoutButton As AcadToolbarItem

    On Error GoTo ERRORTRAP

    ' Use MenuGroups property to obtain reference to main AutoCAD menu
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item("ACAD")

    ' Create a new Toolbar in this group
    Set newToolBar = currMenuGroup.Toolbars.Add("TestMenu")

    ' Add new button to TestMenu that will link to the Flyout menu
    '
    ' * NOTE: Set the macro name to the name of the flyout toolbar because
    ' setting it to an empty string causes an error.  The paremeter
    ' is actually ignored when the style is flyout, but must have any value other than "".
    Set newToolBarFlyoutButton = newToolBar.AddToolbarButton(newToolBar.count + 1, "Flyout", "Flyout", "UCS", True)

    ' Link the existing toolbar "UCS" as the flyout for the new toolbar button
    '
    ' * NOTE: To change the flyout, simply change the MenuGroup and Toolbar name below
    newToolBarFlyoutButton.AttachToolbarToFlyout "ACAD", "UCS"

    MsgBox "The flyout attached to the Test menu is " & newToolBarFlyoutButton.Flyout.name

    Exit Sub

ERRORTRAP:
    MsgBox "The following error has occurred: " & Err.Description
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Flyout()
    ;; This example uses MenuGroups to obtain a reference to the AutoCAD main menu.
    ;; It then creates a new Toolbar(TestMenu) with a Toolbar button that will act
    ;; as a flyout.  The examples sets the Flyout menu to an existing Toolbar menu.
    ;; The Toolbar will automatically be displayed and will display the UCS menu
    ;; as a flyout.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create a new Toolbar in this group
    (setq newToolBar (vla-Add (vla-get-Toolbars currMenuGroup) "TestToolbar"))

    ;; Add new button to TestMenu that will link to the Flyout menu
    ;;
    ;; * NOTE: Set the macro name to the name of the flyout toolbar because
    ;; setting it to an empty string causes an error.  The paremeter
    ;; is actually ignored when the style is flyout, but must have any value other than "".
    (setq newToolBarFlyoutButton (vla-AddToolbarButton newToolBar (1+ (vla-get-Count newToolBar)) "Flyout" "Flyout" "UCS" :vlax-true))

    ;; Link the existing toolbar "UCS" as the flyout for the new toolbar button
    ;;
    ;; * NOTE: To change the flyout, simply change the MenuGroup and Toolbar name below
    (vla-AttachToolbarToFlyout newToolBarFlyoutButton "ACAD" "UCS")

    (alert (strcat "The flyout attached to the Test menu is " (vla-get-Name (vla-get-Flyout newToolBarFlyoutButton))))
)


FontFile Property (ActiveX)

Specifies the primary font file name and the path.

Supported platforms: Windows only

Signature

VBA:

object.FontFile
object

Type: TextStyle

The object this property applies to.

Property Value

Read-only: No

Type: String

The primary font file path.

Remarks

To specify an Asian-language font file, use the BigFontFile property.

Fonts define the shapes of the text characters that make up each character set.

NoteOnce this property has been set, you must call the Regen method to see the changes to the text.

Examples

VBA:

Sub Example_FontFile()
    ' This example returns the current setting of
    ' the FontFile property. It then changes the value, and
    ' finally resets the value back to the original setting.

    Dim textStyle1 As AcadTextStyle
    Dim currFontFile As String
    Dim newFontFile As String

    Set textStyle1 = ThisDrawing.ActiveTextStyle

    ' Retrieve the current FontFile value
    currFontFile = textStyle1.fontFile
    MsgBox "The current value for FontFile is " & currFontFile, vbInformation, "FontFile Example"

    ' Change the value for FontFile
    newFontFile = "C:/AutoCAD/Fonts/italic.shx"
    textStyle1.fontFile = newFontFile
    MsgBox "The new value for FontFile is " & textStyle1.fontFile, vbInformation, "FontFile Example"

    ' Reset font file
    textStyle1.fontFile = currFontFile
    MsgBox "The value for FontFile has been reset to " & textStyle1.fontFile, vbInformation, "FontFile Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_FontFile()
    ;; This example returns the current setting of
    ;; the FontFile property. It then changes the value, and
    ;; finally resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq textStyle1 (vla-get-ActiveTextStyle doc))

    ;; Retrieve the current FontFile value
    (setq currFontFile (vla-get-FontFile textStyle1))
    (alert (strcat "The current value for FontFile is " currFontFile))

    ;; Change the value for FontFile
    (setq newFontFile (findfile "./Fonts/italic.shx"))
    (vla-put-FontFile textStyle1 newFontFile)
    (alert (strcat "The new value for FontFile is " (vla-get-FontFile textStyle1)))

    ;; Reset font file
    (if (= (findfile currFontFile) nil)
    (setq currFontFile (findfile (strcat (getenv "WinDir") "\\Fonts\\" currFontFile)))
    )

    (vla-put-FontFile textStyle1 (findfile currFontFile))
    (alert (strcat "The value for FontFile has been reset to " (vla-get-FontFile textStyle1)))
)


FontFileMap Property (ActiveX)

Specifies the location of the file that defines how AutoCAD should convert unfound fonts.

Supported platforms: Windows only

Signature

VBA:

object.FontFileMap
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The drive, path, and file name of the font mapping file.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_FontFileMap()
    ' This example returns the current setting of
    ' FontFileMap. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currFontFileMap As String
    Dim newFontFileMap As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current FontFileMap value
    currFontFileMap = preferences.Files.FontFileMap
    MsgBox "The current value for FontFileMap is " & currFontFileMap, vbInformation, "FontFileMap Example"

    ' Change the value for FontFileMap
    newFontFileMap = "TestFontFileMap.fmp"
    preferences.Files.FontFileMap = newFontFileMap
    MsgBox "The new value for FontFileMap is " & newFontFileMap, vbInformation, "FontFileMap Example"

    ' Reset FontFileMap to its original value
    preferences.Files.FontFileMap = currFontFileMap
    MsgBox "The FontFileMap value is reset to " & currFontFileMap, vbInformation, "FontFileMap Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_FontFileMap()
    ;; This example returns the current setting of
    ;; FontFileMap. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current FontFileMap value
    (setq currFontFileMap (vla-get-FontFileMap (vla-get-Files preferences)))
    (alert (strcat "The current value for FontFileMap is " currFontFileMap))

    ;; Change the value for FontFileMap
    ;; The file being specified must exist or an error will be generated
    (setq newFontFileMap "C:\\AutoCAD\\TestFontFileMap.fmp")
    (vla-put-FontFileMap (vla-get-Files preferences) newFontFileMap)
    (alert (strcat "The new value for FontFileMap is " newFontFileMap))

    ;; Reset FontFileMap to its original value
    (vla-put-FontFileMap (vla-get-Files preferences) currFontFileMap)
    (alert (strcat "The FontFileMap value is reset to " currFontFileMap))
)


ForceLineInside Property (ActiveX)

Specifies whether a dimension line is drawn between the extension lines even when the text is placed outside the extension lines.

Supported platforms: Windows only

Signature

VBA:

object.ForceLineInside
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Draw dimension lines between the measured points when arrowheads are placed outside the measured points.
  • False: Do not draw dimension lines between the measured points when arrowheads are placed outside the measured points.

Remarks

The initial value for this property is False.

For radius and diameter dimensions (when the TextInside property is set to False), this property draws a dimension line and arrowheads inside the circle or arc and places the text and leader outside.

NoteThis property overrides the value of the DIMTOFL system variable for the given dimension.

Examples

VBA:

Sub Example_ForceLineInside()
    ' This example creates an aligned dimension in model space
    ' and toggles dimension lines to be drawn between extension lines

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim CurrentValue As String

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 5.5: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ThisDrawing.Application.ZoomAll

    ' Read and display current line suppression information
    CurrentValue = IIf(dimObj.ForceLineInside, "are", "are not")
    MsgBox "Dimension lines " & CurrentValue & " forced between the extension lines"

    ' Force the display of dimension lines between the extension lines
    dimObj.ForceLineInside = True
    ThisDrawing.Regen acAllViewports
    MsgBox "Dimension lines are forced between the extension lines"

    ' Do not force the display of dimension lines between the extension lines (default)
    dimObj.ForceLineInside = False
    ThisDrawing.Regen acAllViewports
    MsgBox "Dimension lines are not forced between the extension lines"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ForceLineInside()
    ;; This example creates an aligned dimension in model space
    ;; and toggles dimension lines to be drawn between extension lines
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 5.5 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    ;; Read and display current line suppression information
    (setq CurrentValue (if (= (vla-get-ForceLineInside dimObj) :vlax-true) "are" "are not"))
    (alert (strcat "Dimension lines " CurrentValue " forced between the extension lines"))

    ;; Force the display of dimension lines between the extension lines
    (vla-put-ForceLineInside dimObj :vlax-true)
    (vla-Regen doc acAllViewports)
    (alert "Dimension lines are forced between the extension lines")

    ;; Do not force the display of dimension lines between the extension lines (default)
    (vla-put-ForceLineInside dimObj :vlax-false)
    (vla-Regen doc acAllViewports)
    (alert "Dimension lines are not forced between the extension lines")
)


ForegroundLinesColor Property (ActiveX)

Specifies the color of foreground lines.

Supported platforms: Windows only

Signature

VBA:

object.ForegroundLinesColor
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: AcCmColor

The color assigned to foreground lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ForegroundLinesEdgeTransparency Property (ActiveX)

Specifies the edge transparency of foreground lines.

Supported platforms: Windows only

Signature

VBA:

object.ForegroundLinesEdgeTransparency
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: Long

The edge transparency of the foreground lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ForegroundLinesFaceTransparency Property (ActiveX)

Specifies the face transparency of foreground lines.

Supported platforms: Windows only

Signature

VBA:

object.ForegroundLinesFaceTransparency
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: Long

The face transparency of the foreground lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ForegroundLinesHiddenLine Property (ActiveX)

Specifies the hidden line visibility of foreground lines.

Supported platforms: Windows only

Signature

VBA:

object.ForegroundLinesHiddenLine
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: Boolean

  • True: Hidden line visibility is enabled.
  • False: Hidden line visibility is not enabled.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ForegroundLinesLayer Property (ActiveX)

Specifies the layer of foreground lines.

Supported platforms: Windows only

Signature

VBA:

object.ForegroundLinesLayer
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: String

The layer assigned to the foreground lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ForegroundLinesLinetype Property (ActiveX)

Specifies the linetype of foreground lines.

Supported platforms: Windows only

Signature

VBA:

object.ForegroundLinesLinetype
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: String

The linetype assigned to the foreground lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ForegroundLinesLinetypeScale Property (ActiveX)

Specifies the linetype scale of foreground lines.

Supported platforms: Windows only

Signature

VBA:

object.ForegroundLinesLinetypeScale
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: ACAD_NOUNITS

The linetype scale assigned to the foreground lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ForegroundLinesLineweight Property (ActiveX)

Specifies the lineweight of foreground lines.

Supported platforms: Windows only

Signature

VBA:

object.ForegroundLinesLineweight
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: ACAD_LWEIGHT

The lineweight assigned to the foreground lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ForegroundLinesPlotStyleName Property (ActiveX)

Specifies the plot style name of foreground lines.

Supported platforms: Windows only

Signature

VBA:

object.ForegroundLinesPlotStyleName
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: String

The plot style name assigned to the foreground lines.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ForegroundLinesVisible Property (ActiveX)

Specifies the visibility of foreground lines.

Supported platforms: Windows only

Signature

VBA:

object.ForegroundLinesVisible
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: Boolean

  • True: Foreground lines are visible.
  • False: Foreground lines are not visible.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


FoundPath Property (ActiveX)

Specifies an alternate path of an entry in the File Dependency List.

Supported platforms: Windows only

Signature

VBA:

object.FoundPath
object

Type: FileDependency

The object this property applies to.

Property Value

Read-only: Yes

Type: String

Alternate path at which the file was found, if any.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_FoundPath()
    ' This example reads information from a File Dependency List
    ' Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ' \Sample\Sheet Sets\Architectural\A-01.dwg

    Dim objFDLCol As AutoCAD.AcadFileDependencies
    Dim objFDL As AutoCAD.AcadFileDependency

    Set objFDLCol = ThisDrawing.FileDependencies
    MsgBox ("The number of entries in the File Dependency List is " & objFDLCol.count & ".")

    Dim strTemp As String
    For Each objFDL In objFDLCol
        strTemp = "Affects graphics?: " & vbTab & objFDL.AffectsGraphics
        strTemp = strTemp & vbCrLf & "Feature: " & vbTab & objFDL.Feature
        strTemp = strTemp & vbCrLf & "FileName: " & vbTab & objFDL.FileName
        strTemp = strTemp & vbCrLf & "FileSize: " & vbTab & objFDL.FileSize
        strTemp = strTemp & vbCrLf & "Fingerprint GUID: " & vbTab & objFDL.FingerprintGuid
        strTemp = strTemp & vbCrLf & "FoundPath: " & vbTab & objFDL.FoundPath
        strTemp = strTemp & vbCrLf & "FullFileName: " & vbTab & objFDL.FullFileName
        strTemp = strTemp & vbCrLf & "Index: " & vbTab & objFDL.Index
        strTemp = strTemp & vbCrLf & "Modified?: " & vbTab & objFDL.IsModified
        strTemp = strTemp & vbCrLf & "ReferenceCount: " & vbTab & objFDL.ReferenceCount
        strTemp = strTemp & vbCrLf & "Timestamp: " & vbTab & objFDL.TimeStamp
        strTemp = strTemp & vbCrLf & "Version GUID: " & vbTab & objFDL.VersionGuid
        MsgBox strTemp
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_FoundPath()
    ;; This example reads information from a File Dependency List
    ;; Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ;; .\\Sample\\Sheet Sets\\Architectural\\A-01.dwg
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq objFDLCol (vla-get-FileDependencies doc))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))

    (setq strTemp "")
    (vlax-for each-objFDL objFDLCol
        (setq strTemp (strcat "Affects graphics?: " (if (= (vla-get-AffectsGraphics each-objFDL) :vlax-true) "True" "False")))
        (setq strTemp (strcat strTemp
                                       "\nFeature: " (vla-get-Feature each-objFDL)
                                       "\nFileName: " (vla-get-FileName each-objFDL)
                                       "\nFileSize: " (itoa (vla-get-FileSize each-objFDL))
                                       "\nFingerprint GUID: " (vla-get-FingerprintGuid each-objFDL)
                                       "\nFoundPath: " (vla-get-FoundPath each-objFDL)
                                       "\nFullFileName: " (vla-get-FullFileName each-objFDL)
                                       "\nIndex: " (itoa (vla-get-Index each-objFDL))
                                       "\nModified?: " (if (= (vla-get-IsModified each-objFDL) :vlax-true) "True" "False")
                                       "\nReferenceCount: " (itoa (vla-get-ReferenceCount each-objFDL))
                                       "\nTimeStamp: " (itoa (vla-get-TimeStamp each-objFDL))
                                       "\nVersion GUID: " (vla-get-VersionGuid each-objFDL)
                         )
           )
        (alert strTemp)
    )
)


FractionFormat Property (ActiveX)

Specifies the format of fractional values in dimensions and tolerances.

Supported platforms: Windows only

Signature

VBA:

object.FractionFormat
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: acDimFractionType enum

  • acHorizontal
  • acDiagonal
  • acNotStacked

Remarks

This property is used when the UnitsFormat property is set to acDimLArchitectural or acDimLFractional.

NoteThis property overrides the value of the DIMFRAC system variable for the given dimension.

Examples

VBA:

Sub Example_FractionFormat()
    ' This example creates an aligned dimension in model space and
    ' uses FractionFormat to cycle through some fractional formats
    ' for the dimension.
    ' * Note the appearance of the "1/2" component of the dimension

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 0: point1(1) = 5: point1(2) = 0
    point2(0) = 5.5: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ThisDrawing.Application.ZoomAll

    ' Switch to a mode that works with the FractionFormat property
    dimObj.UnitsFormat = acDimLArchitectural

    ' Cycle through some common fractional formats

    dimObj.FractionFormat = acDiagonal      ' Change format to Diagonal
    ThisDrawing.Regen acAllViewports
    MsgBox "The dimension format is now set to diagonal"

    dimObj.FractionFormat = acHorizontal    ' Change format to Horizontal
    ThisDrawing.Regen acAllViewports
    MsgBox "The dimension format is now set to horizontal"

    dimObj.FractionFormat = acNotStacked    ' Change format to NotStacked
    ThisDrawing.Regen acAllViewports
    MsgBox "The dimension format is now unstacked"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_FractionFormat()
   ;; This example creates an aligned dimension in model space and
   ;; uses FractionFormat to cycle through some fractional formats
   ;; for the dimension.
   ;; * Note the appearance of the "1/2" component of the dimension
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 0 5 0)
          point2 (vlax-3d-point 5.5 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    ;; Switch to a mode that works with the FractionFormat property
    (vla-put-UnitsFormat dimObj acDimLArchitectural)

    ;; Cycle through some common fractional formats
    (vla-put-FractionFormat dimObj acDiagonal)      ;; Change format to Diagonal
    (vla-Regen doc acAllViewports)
    (alert "The dimension format is now set to diagonal")

    (vla-put-FractionFormat dimObj acHorizontal)    ;; Change format to Horizontal
    (vla-Regen doc acAllViewports)
    (alert "The dimension format is now set to horizontal")

    (vla-put-FractionFormat dimObj acNotStacked)    ;; Change format to NotStacked
    (vla-Regen doc acAllViewports)
    (alert "The dimension format is now unstacked")
)


Freeze Property (ActiveX)

Specifies the freeze status of a layer.

Supported platforms: Windows only

Signature

VBA:

object.Freeze
object

Type: Layer

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Freeze the layer.
  • False: Thaw the layer.

Remarks

Freezing layers makes them invisible and excludes them from regeneration and plotting. Thawing a layer enables these capabilities. AutoCAD surfaces and circles on a turned-off or frozen layer are invisible, but they still hide objects when you use the HIDE, SHADEMODE, or RENDER commands.

You cannot freeze the active layer, or make a frozen layer active.

This property differs from the LayerOn property because frozen layers are not generated during a regeneration.

Examples

VBA:

Sub Example_Freeze()
    ' This example creates a new layer called "Freeze".
    ' It then displays the status of the Freeze property
    ' for the new layer, toggles the status of the
    ' Freeze property, and again displays its status.
    ' After running this example, you can check the layer
    ' control on the Object Properties tool bar. It will
    ' show the new layer and the latest Freeze status.

    Dim layerObj As AcadLayer

    ' Create the new layer
    Set layerObj = ThisDrawing.Layers.Add("Freeze")

    ' Display the Freeze status of the new layer
    GoSub DISPLAYSTATUS

    ' Toggle the status of the Freeze property for the layer
    layerObj.Freeze = Not (layerObj.Freeze)

    ' Display the Freeze status of the new layer
    GoSub DISPLAYSTATUS
    Exit Sub

DISPLAYSTATUS:
    If layerObj.Freeze Then
        MsgBox "Layer " & layerObj.name & " is frozen.", , "Freeze Example"
    Else
        MsgBox "Layer " & layerObj.name & " is thawed.", , "Freeze Example"
    End If
    Return

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Freeze()
    ;; This example creates a new layer called "Freeze".
    ;; It then displays the status of the Freeze property
    ;; for the new layer, toggles the status of the
    ;; Freeze property, and again displays its status.
    ;; After running this example, you can check the layer
    ;; control on the Object Properties tool bar. It will
    ;; show the new layer and the latest Freeze status.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the new layer
    (setq layerObj (vla-Add (vla-get-Layers doc) "Freeze"))

    ;; Display the Freeze status of the new layer
    (if (= (vla-get-Freeze layerObj) :vlax-true)
        (alert (strcat "Layer " (vla-get-Name layerObj) " is frozen."))
        (alert (strcat "Layer " (vla-get-Name layerObj) " is thawed."))
    )

    ;; Toggle the status of the Freeze property for the layer
    (vla-put-Freeze layerObj (if (= (vla-get-Freeze layerObj) :vlax-true) :vlax-false :vlax-true))

    ;; Display the Freeze status of the new layer
    (if (= (vla-get-Freeze layerObj) :vlax-true)
        (alert (strcat "Layer " (vla-get-Name layerObj) " is frozen."))
        (alert (strcat "Layer " (vla-get-Name layerObj) " is thawed."))
    )
)


FullCRCValidation Property (ActiveX)

Specifies whether a cyclic redundancy check (CRC) should be performed each time an object is read into the drawing.

Supported platforms: Windows only

Signature

VBA:

object.FullCRCValidation
object

Type: PreferencesOpenSave

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Turns on full-time cyclic redundancy check.
  • False: Turns off full-time cyclic redundancy check.

Remarks

The initial value for this property is False.

If your drawings are being corrupted and you suspect a hardware problem or an AutoCAD error, set FullCRCValidation to True.

Examples

VBA:

Sub Example_FullCRCValidation()
    ' This example returns the current setting of
    ' FullCRCValidation. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currFullCRCValidation As Boolean

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current FullCRCValidation value
    currFullCRCValidation = preferences.OpenSave.FullCRCValidation
    MsgBox "The current value for FullCRCValidation is " & preferences.OpenSave.FullCRCValidation, vbInformation, "FullCRCValidation Example"

    ' Change the value for FullCRCValidation
    preferences.OpenSave.FullCRCValidation = Not (currFullCRCValidation)
    MsgBox "The new value for FullCRCValidation is " & preferences.OpenSave.FullCRCValidation, vbInformation, "FullCRCValidation Example"

    ' Reset FullCRCValidation to its original value
    preferences.OpenSave.FullCRCValidation = currFullCRCValidation
    MsgBox "The FullCRCValidation value is reset to " & preferences.OpenSave.FullCRCValidation, vbInformation, "FullCRCValidation Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_FullCRCValidation()
    ;; This example returns the current setting of
    ;; FullCRCValidation. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current FullCRCValidation value
    (setq currFullCRCValidation (vla-get-FullCRCValidation (vla-get-OpenSave preferences)))
    (alert (strcat "The current value for FullCRCValidation is " (if (= currFullCRCValidation :vlax-true) "True" "False")))

    ;; Change the value for FullCRCValidation
    (setq newFullCRCValidation (if (= currFullCRCValidation :vlax-true) :vlax-false :vlax-true))
    (vla-put-FullCRCValidation (vla-get-OpenSave preferences) newFullCRCValidation)
    (alert (strcat "The new value for FullCRCValidation is " (if (= newFullCRCValidation :vlax-true) "True" "False")))

    ;; Reset FullCRCValidation to its original value
    (vla-put-FullCRCValidation (vla-get-OpenSave preferences) currFullCRCValidation)
    (alert (strcat "The FullCRCValidation value is reset to " (if (= currFullCRCValidation :vlax-true) "True" "False")))
)


FullFileName Property (ActiveX)

Specifies the saved full path name of an entry in the File Dependency List.

Supported platforms: Windows only

Signature

VBA:

object.FullFileName
object

Type: FileDependency

The object this property applies to.

Property Value

Read-only: Yes

Type: String

Saved full path name.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_FullFileName()
    ' This example reads information from a File Dependency List
    ' Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ' \Sample\Sheet Sets\Architectural\A-01.dwg

    Dim objFDLCol As AutoCAD.AcadFileDependencies
    Dim objFDL As AutoCAD.AcadFileDependency

    Set objFDLCol = ThisDrawing.FileDependencies
    MsgBox ("The number of entries in the File Dependency List is " & objFDLCol.count & ".")

    Dim strTemp As String
    For Each objFDL In objFDLCol
        strTemp = "Affects graphics?: " & vbTab & objFDL.AffectsGraphics
        strTemp = strTemp & vbCrLf & "Feature: " & vbTab & objFDL.Feature
        strTemp = strTemp & vbCrLf & "FileName: " & vbTab & objFDL.FileName
        strTemp = strTemp & vbCrLf & "FileSize: " & vbTab & objFDL.FileSize
        strTemp = strTemp & vbCrLf & "Fingerprint GUID: " & vbTab & objFDL.FingerprintGuid
        strTemp = strTemp & vbCrLf & "FoundPath: " & vbTab & objFDL.FoundPath
        strTemp = strTemp & vbCrLf & "FullFileName: " & vbTab & objFDL.FullFileName
        strTemp = strTemp & vbCrLf & "Index: " & vbTab & objFDL.Index
        strTemp = strTemp & vbCrLf & "Modified?: " & vbTab & objFDL.IsModified
        strTemp = strTemp & vbCrLf & "ReferenceCount: " & vbTab & objFDL.ReferenceCount
        strTemp = strTemp & vbCrLf & "Timestamp: " & vbTab & objFDL.TimeStamp
        strTemp = strTemp & vbCrLf & "Version GUID: " & vbTab & objFDL.VersionGuid
        MsgBox strTemp
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_FullFileName()
    ;; This example reads information from a File Dependency List
    ;; Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ;; .\\Sample\\Sheet Sets\\Architectural\\A-01.dwg
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq objFDLCol (vla-get-FileDependencies doc))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))

    (setq strTemp "")
    (vlax-for each-objFDL objFDLCol
        (setq strTemp (strcat "Affects graphics?: " (if (= (vla-get-AffectsGraphics each-objFDL) :vlax-true) "True" "False")))
        (setq strTemp (strcat strTemp
                                       "\nFeature: " (vla-get-Feature each-objFDL)
                                       "\nFileName: " (vla-get-FileName each-objFDL)
                                       "\nFileSize: " (itoa (vla-get-FileSize each-objFDL))
                                       "\nFingerprint GUID: " (vla-get-FingerprintGuid each-objFDL)
                                       "\nFoundPath: " (vla-get-FoundPath each-objFDL)
                                       "\nFullFileName: " (vla-get-FullFileName each-objFDL)
                                       "\nIndex: " (itoa (vla-get-Index each-objFDL))
                                       "\nModified?: " (if (= (vla-get-IsModified each-objFDL) :vlax-true) "True" "False")
                                       "\nReferenceCount: " (itoa (vla-get-ReferenceCount each-objFDL))
                                       "\nTimeStamp: " (itoa (vla-get-TimeStamp each-objFDL))
                                       "\nVersion GUID: " (vla-get-VersionGuid each-objFDL)
                         )
           )
        (alert strTemp)
    )
)


FullName Property (ActiveX)

Gets the name of the application or document, including the path.

Supported platforms: Windows only

Signature

VBA:

object.FullName
object

Type: Application, Document

The objects this property applies to.

Property Value

Read-only: Yes

Type: String

The name and path of the application or document.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_FullName()
    ' This example uses the FullName property to find
    ' the full name of the current drawing, and of
    ' the application.

    ' Find the full name of current drawing file including path.
    ' (If the drawing has not been saved, this name will be blank.)
    Dim docName As String
    docName = ThisDrawing.FullName
    MsgBox "The full name of the current drawing is " & docName, , "FullName Example"

    ' Find the full name of application
    Dim appName As String
    appName = ThisDrawing.Application.FullName
    MsgBox "The full name of the current application is " & appName, , "FullName Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_FullName()
    ;; This example uses the FullName property to find
    ;; the full name of the current drawing, and of
    ;; the application.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Find the full name of current drawing file including path.
    ;; (If the drawing has not been saved, this name will be blank.)
    (setq docName (vla-get-FullName doc))
    (alert (strcat "The full name of the current drawing is " docName))

    ;; Find the full name of application
    (setq appName (vla-get-FullName acadObj))
    (alert (strcat "The full name of the current application is " appName))
)


FullScreenTrackingVector Property (ActiveX)

Toggles the display of full-screen tracking vectors.

Supported platforms: Windows only

Signature

VBA:

object.FullScreenTrackingVector
object

Type: PreferencesDrafting

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Enables full-screen tracking vectors.
  • False: Disables full-screen tracking vectors.

Remarks

The initial value for this property is True.

NoteThe value of this property is stored in the TRACKPATH system variable.

Examples

VBA:

Sub Example_FullScreenTrackingVector()
    ' This example reads and modifies the preference value that controls
    ' the display of full-screen tracking vectors.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesDrafting
    Dim originalValue As Variant, newValue As Variant

    ' Get the drafting preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Drafting

    ' Read and display the original value
    originalValue = ACADPref.FullScreenTrackingVector
    MsgBox "The FullScreenTrackingVector preference is set to: " & originalValue

    ' Modify the FullScreenTrackingVector preference by toggling the value
    ACADPref.FullScreenTrackingVector = Not (originalValue)
    newValue = ACADPref.FullScreenTrackingVector
    MsgBox "The FullScreenTrackingVector preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.FullScreenTrackingVector = originalValue
    MsgBox "The FullScreenTrackingVector preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_FullScreenTrackingVector()
    ;; This example reads and modifies the preference value that controls
    ;; the display of full-screen tracking vectors.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the drafting preferences object
    (setq ACADPref (vla-get-Drafting preferences))

    ;; Read and display the original value
    (setq originalValue (vla-get-FullScreenTrackingVector ACADPref))
    (alert (strcat "The FullScreenTrackingVector preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the FullScreenTrackingVector preference by toggling the value
    (vla-put-FullScreenTrackingVector ACADPref (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-FullScreenTrackingVector ACADPref))
    (alert (strcat "The FullScreenTrackingVector preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-FullScreenTrackingVector ACADPref originalValue)
    (alert (strcat "The FullScreenTrackingVector preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


GenerationOptions Property (ActiveX)

Specifies the section generation options.

Supported platforms: Windows only

Signature

VBA:

object.GenerationOptions
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: AcSectionGeneration enum

  • acSectionGenerationDestinationFile
  • acSectionGenerationDestinationNewBlock
  • acSectionGenerationDestinationReplaceBlock
  • acSectionGenerationSourceAllObjects
  • acSectionGenerationSourceSelectedObjects

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GeoImageBrightness Property (ActiveX)

Specifies the brightness value of the embedded image.

Supported platforms: Windows only

Signature

VBA:

object.GeoImageBrightness
object

Type: GeomapImage

The object this property applies to.

Property Value

Read-only: No

Type: Long

The brightness value for the image is a positive integer between 0 and 100 inclusive.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GeoImageContrast Property (ActiveX)

Specifies the contrast value of the embedded image.

Supported platforms: Windows only

Signature

VBA:

object.GeoImageContrast
object

Type: GeomapImage

The object this property applies to.

Property Value

Read-only: No

Type: Long

The valid range is 0 to 100 inclusive.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GeoImageFade Property (ActiveX)

Specifies the current fade value of the embedded image.

Supported platforms: Windows only

Signature

VBA:

object.GeoImageFade
object

Type: GeomapImage

The object this property applies to.

Property Value

Read-only: No

Type: Long

The value is between 0 and 100 inclusive.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GeoImageHeight Property (ActiveX)

Specifies the height of the embedded image.

Supported platforms: Windows only

Signature

VBA:

object.GeoImageHeight
object

Type: GeomapImage

The object this property applies to.

Property Value

Read-only: Yes

Type: Double

The height of the image.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GeoImagePosition Property (ActiveX)

Specifies the bottom left corner of the embedded image.

Supported platforms: Windows only

Signature

VBA:

object.GeoImagePosition
object

Type: GeomapImage

The object this property applies to.

Property Value

Read-only: Yes

Type: Variant (three-element array of doubles)

The position of the image.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GeoImageWidth Property (ActiveX)

Specifies the width of the embedded image.

Supported platforms: Windows only

Signature

VBA:

object.GeoImageWidth
object

Type: GeomapImage

The object this property applies to.

Property Value

Read-only: Yes

Type: Double

The width of the image.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Geolocate Property (ActiveX)

Specifies whether the point cloud is geographically located.

Supported platforms: Windows only

Signature

VBA:

object.Geolocate
object

Type: PointCloudEx

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Point cloud is geographically located.
  • False: Point cloud is not geographically located.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GradientAngle Property (ActiveX)

Specifies the gradient angle.

Supported platforms: Windows only

Signature

VBA:

object.GradientAngle
object

Type: Hatch

The object this property applies to.

Property Value

Read-only: No

Type: ACAD_ANGLE

Angle of the gradient pattern.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GradientAngle()
    ' This example changes the value of the GradientAngle property.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "CYLINDER"
    PatternType = acPreDefinedGradient '0
    bAssociativity = True

    ' Create the associative Hatch object in model space
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity, acGradientObject)
    Dim col1 As AcadAcCmColor, col2 As AcadAcCmColor
    Set col1 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Set col2 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col1.SetRGB 255, 0, 0
    col2.SetRGB 0, 255, 0
    hatchObj.GradientColor1 = col1
    hatchObj.GradientColor2 = col2

    ' Create the outer boundary for the hatch (a circle)
    Dim outerLoop(0 To 0) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 3: center(1) = 3: center(2) = 0
    radius = 1
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)

    ' Append the outerboundary to the hatch object, and display the hatch
    hatchObj.AppendOuterLoop (outerLoop)
    hatchObj.Evaluate
    ThisDrawing.Regen True
    MsgBox "Initial value of GradientAngle is " & hatchObj.GradientAngle
    hatchObj.GradientAngle = 3.1415 / 4
    MsgBox "New value of GradientAngle is " & hatchObj.GradientAngle
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GradientAngle()
    ;; This example changes the value of the GradientAngle property.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "CYLINDER")
    (setq patternType acPreDefinedGradient)
    (setq bAssociativity :vlax-true)

    ;; Create the associative Hatch object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acGradientObject))

    (setq col1 (vlax-create-object "AutoCAD.AcCmColor.20"))
    (setq col2 (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col1 255 0 0)
    (vla-SetRGB col2 0 255 0)
    (vla-put-GradientColor1 hatchObj col1)
    (vla-put-GradientColor2 hatchObj col2)

    ;; Create the outer boundary for the hatch (a circle)
    (setq center (vlax-3d-point 3 3 0)
          radius 1)
    (setq circle (vla-AddCircle modelSpace center radius))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element outerLoop 0 circle)

    ;; Append the outerboundary to the hatch object, and display the hatch
    (vla-AppendOuterLoop hatchObj outerLoop)
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)

    (alert (strcat "Initial value of GradientAngle is " (rtos (vla-get-GradientAngle hatchObj) 2)))
    (vla-put-GradientAngle hatchObj (/ 3.1415 4))
    (alert (strcat "New value of GradientAngle is " (rtos (vla-get-GradientAngle hatchObj) 2)))

    (vlax-release-object col1)
    (vlax-release-object col2)
)


GradientCentered Property (ActiveX)

Specifies whether the gradient is centered.

Supported platforms: Windows only

Signature

VBA:

object.GradientCentered
object

Type: Hatch

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Gradient pattern is centered.
  • False: Gradient pattern is not centered.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GradientCentered()
    ' This example changes the value of the GradientCentered property.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "CYLINDER"
    PatternType = acPreDefinedGradient '0
    bAssociativity = True

    ' Create the associative Hatch object in model space
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity, acGradientObject)
    Dim col1 As AcadAcCmColor, col2 As AcadAcCmColor
    Set col1 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Set col2 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col1.SetRGB 255, 0, 0
    col2.SetRGB 0, 255, 0
    hatchObj.GradientColor1 = col1
    hatchObj.GradientColor2 = col2

    ' Create the outer boundary for the hatch (a circle)
    Dim outerLoop(0 To 0) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 3: center(1) = 3: center(2) = 0
    radius = 1
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)

    ' Append the outerboundary to the hatch object, and display the hatch
    hatchObj.AppendOuterLoop (outerLoop)
    hatchObj.Evaluate
    ThisDrawing.Regen True
    MsgBox "Initial value of GradientCentered is " & hatchObj.GradientCentered
    hatchObj.GradientCentered = False
    MsgBox "New value of GradientCentered is " & hatchObj.GradientCentered
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GradientCentered()
    ;; This example changes the value of the GradientCentered property.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "CYLINDER")
    (setq patternType acPreDefinedGradient)
    (setq bAssociativity :vlax-true)

    ;; Create the associative Hatch object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acGradientObject))

    (setq col1 (vlax-create-object "AutoCAD.AcCmColor.20"))
    (setq col2 (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col1 255 0 0)
    (vla-SetRGB col2 0 255 0)
    (vla-put-GradientColor1 hatchObj col1)
    (vla-put-GradientColor2 hatchObj col2)

    ;; Create the outer boundary for the hatch (a circle)
    (setq center (vlax-3d-point 3 3 0)
          radius 1)
    (setq circle (vla-AddCircle modelSpace center radius))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element outerLoop 0 circle)

    ;; Append the outerboundary to the hatch object, and display the hatch
    (vla-AppendOuterLoop hatchObj outerLoop)
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)

    (alert (strcat "Initial value of GradientCentered is " (if (= (vla-get-GradientCentered hatchObj) :vlax-true) "True" "False")))
    (vla-put-GradientCentered hatchObj (if (= (vla-get-GradientCentered hatchObj) :vlax-true) :vlax-false :vlax-true))
    (alert (strcat "New value of GradientCentered is " (if (= (vla-get-GradientCentered hatchObj) :vlax-true) "True" "False")))

    (vlax-release-object col1)
    (vlax-release-object col2)
)


GradientColor1 Property (ActiveX)

Specifies the start color of the gradient.

Supported platforms: Windows only

Signature

VBA:

object.GradientColor1
object

Type: Hatch

The object this property applies to.

Property Value

Read-only: No

Type: AcCmColor

The AcCmColor object must contain one of the following constants, or an error is returned:

  • acColorMethodByACI
  • acColorMethodByBlock

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GradientColor1()
    ' This example changes the value of the GradientColor1 property.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "CYLINDER"
    PatternType = acPreDefinedGradient '0
    bAssociativity = True

    ' Create the associative Hatch object in model space
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity, acGradientObject)
    Dim col1 As AcadAcCmColor, col2 As AcadAcCmColor, newColor As AcadAcCmColor
    Set col1 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Set col2 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Set newColor = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col1.SetRGB 255, 0, 0
    col2.SetRGB 0, 255, 0
    newColor.SetRGB 0, 100, 0
    hatchObj.GradientColor1 = col1
    hatchObj.GradientColor2 = col2

    ' Create the outer boundary for the hatch (a circle)
    Dim outerLoop(0 To 0) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 3: center(1) = 3: center(2) = 0
    radius = 1
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)

    ' Append the outerboundary to the hatch object, and display the hatch
    hatchObj.AppendOuterLoop (outerLoop)
    hatchObj.Evaluate
    ThisDrawing.Regen True
    MsgBox "Initial value of GradientColor1 is :" & vbCrLf & _
                    "red = " & hatchObj.GradientColor1.Red & vbCrLf & _
                    "green = " & hatchObj.GradientColor1.Green & vbCrLf & _
                    "blue = " & hatchObj.GradientColor1.Blue

    hatchObj.GradientColor1 = newColor
    MsgBox "New value of GradientColor1 is :" & vbCrLf & _
                    "red = " & hatchObj.GradientColor1.Red & vbCrLf & _
                    "green = " & hatchObj.GradientColor1.Green & vbCrLf & _
                    "blue = " & hatchObj.GradientColor1.Blue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GradientColor1()
    ;; This example changes the value of the GradientColor1 property.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "CYLINDER")
    (setq patternType acPreDefinedGradient)
    (setq bAssociativity :vlax-true)

    ;; Create the associative Hatch object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acGradientObject))

    (setq col1 (vlax-create-object "AutoCAD.AcCmColor.20"))
    (setq col2 (vlax-create-object "AutoCAD.AcCmColor.20"))
    (setq newColor (vlax-create-object "AutoCAD.AcCmColor.20"))

    (vla-SetRGB col1 255 0 0)
    (vla-SetRGB col2 0 255 0)
    (vla-SetRGB newColor 0 100 0)

    (vla-put-GradientColor1 hatchObj col1)
    (vla-put-GradientColor2 hatchObj col2)

    ;; Create the outer boundary for the hatch (a circle)
    (setq center (vlax-3d-point 3 3 0)
          radius 1)
    (setq circle (vla-AddCircle modelSpace center radius))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element outerLoop 0 circle)

    ;; Append the outerboundary to the hatch object, and display the hatch
    (vla-AppendOuterLoop hatchObj outerLoop)
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)
    (alert (strcat "Initial value of GradientColor1 is :"
                   "\nred = " (itoa (vla-get-Red (vla-get-GradientColor1 hatchObj)))
                   "\ngreen = " (itoa (vla-get-Green (vla-get-GradientColor1 hatchObj)))
                   "\nblue = " (itoa (vla-get-Blue (vla-get-GradientColor1 hatchObj)))))

    (vla-put-GradientColor1 hatchObj newColor)
    (alert (strcat "New value of GradientColor1 is :"
                   "\nred = " (itoa (vla-get-Red (vla-get-GradientColor1 hatchObj)))
                   "\ngreen = " (itoa (vla-get-Green (vla-get-GradientColor1 hatchObj)))
                   "\nblue = " (itoa (vla-get-Blue (vla-get-GradientColor1 hatchObj)))))

    (vlax-release-object col1)
    (vlax-release-object col2)
    (vlax-release-object newColor)
)


GradientColor2 Property (ActiveX)

Specifies the end color of the gradient.

Supported platforms: Windows only

Signature

VBA:

object.GradientColor2
object

Type: Hatch

The object this property applies to.

Property Value

Read-only: No

Type: AcCmColor

The AcCmColor object must contain one of the following constants, or an error is returned:

  • acColorMethodByACI
  • acColorMethodByBlock

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GradientColor2()
    ' This example changes the value of the GradientColor2 property.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "CYLINDER"
    PatternType = acPreDefinedGradient '0
    bAssociativity = True

    ' Create the associative Hatch object in model space
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity, acGradientObject)
    Dim col1 As AcadAcCmColor, col2 As AcadAcCmColor, newColor As AcadAcCmColor
    Set col1 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Set col2 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Set newColor = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col1.SetRGB 255, 0, 0
    col2.SetRGB 0, 255, 0
    newColor.SetRGB 0, 100, 0
    hatchObj.GradientColor1 = col1
    hatchObj.GradientColor2 = col2

    ' Create the outer boundary for the hatch (a circle)
    Dim outerLoop(0 To 0) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 3: center(1) = 3: center(2) = 0
    radius = 1
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)

    ' Append the outerboundary to the hatch object, and display the hatch
    hatchObj.AppendOuterLoop (outerLoop)
    hatchObj.Evaluate
    ThisDrawing.Regen True
    MsgBox "Initial value of GradientColor2 is :" & vbCrLf & _
                    "red = " & hatchObj.GradientColor2.Red & vbCrLf & _
                    "green = " & hatchObj.GradientColor2.Green & vbCrLf & _
                    "blue = " & hatchObj.GradientColor2.Blue

    hatchObj.GradientColor2 = newColor
    MsgBox "New value of GradientColor2 is :" & vbCrLf & _
                    "red = " & hatchObj.GradientColor2.Red & vbCrLf & _
                    "green = " & hatchObj.GradientColor2.Green & vbCrLf & _
                    "blue = " & hatchObj.GradientColor2.Blue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GradientColor2()
    ;; This example changes the value of the GradientColor2 property.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "CYLINDER")
    (setq patternType acPreDefinedGradient)
    (setq bAssociativity :vlax-true)

    ;; Create the associative Hatch object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acGradientObject))

    (setq col1 (vlax-create-object "AutoCAD.AcCmColor.20"))
    (setq col2 (vlax-create-object "AutoCAD.AcCmColor.20"))
    (setq newColor (vlax-create-object "AutoCAD.AcCmColor.20"))

    (vla-SetRGB col1 255 0 0)
    (vla-SetRGB col2 0 255 0)
    (vla-SetRGB newColor 0 100 0)

    (vla-put-GradientColor1 hatchObj col1)
    (vla-put-GradientColor2 hatchObj col2)

    ;; Create the outer boundary for the hatch (a circle)
    (setq center (vlax-3d-point 3 3 0)
          radius 1)
    (setq circle (vla-AddCircle modelSpace center radius))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element outerLoop 0 circle)

    ;; Append the outerboundary to the hatch object, and display the hatch
    (vla-AppendOuterLoop hatchObj outerLoop)
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)
    (alert (strcat "Initial value of GradientColor2 is :"
                   "\nred = " (itoa (vla-get-Red (vla-get-GradientColor2 hatchObj)))
                   "\ngreen = " (itoa (vla-get-Green (vla-get-GradientColor2 hatchObj)))
                   "\nblue = " (itoa (vla-get-Blue (vla-get-GradientColor2 hatchObj)))))

    (vla-put-GradientColor2 hatchObj newColor)
    (alert (strcat "New value of GradientColor2 is :"
                   "\nred = " (itoa (vla-get-Red (vla-get-GradientColor2 hatchObj)))
                   "\ngreen = " (itoa (vla-get-Green (vla-get-GradientColor2 hatchObj)))
                   "\nblue = " (itoa (vla-get-Blue (vla-get-GradientColor2 hatchObj)))))

    (vlax-release-object col1)
    (vlax-release-object col2)
    (vlax-release-object newColor)
)


GradientName Property (ActiveX)

Specifies the pattern name of the gradient.

Supported platforms: Windows only

Signature

VBA:

object.GradientName
object

Type: Hatch

The object this property applies to.

Property Value

Read-only: No

Type: String

The pattern name of the gradient, which can be

  • "Linear"
  • "Cylinder"
  • "InvCylinder"
  • "Spherical"
  • "HemiSpherical"
  • "Curved"
  • "InvSpherical"
  • "InvHemiSpherical"
  • "InvCurved"

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GradientName()
    ' This example changes the value of the GradientName property.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "CYLINDER"
    PatternType = acPreDefinedGradient '0
    bAssociativity = True

    ' Create the associative Hatch object in model space
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity, acGradientObject)
    Dim col1 As AcadAcCmColor, col2 As AcadAcCmColor
    Set col1 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Set col2 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col1.SetRGB 255, 0, 0
    col2.SetRGB 0, 255, 0
    hatchObj.GradientColor2 = col1
    hatchObj.GradientColor2 = col2

    ' Create the outer boundary for the hatch (a circle)
    Dim outerLoop(0 To 0) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 3: center(1) = 3: center(2) = 0
    radius = 1
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)

    ' Append the outerboundary to the hatch object, and display the hatch
    hatchObj.AppendOuterLoop (outerLoop)
    hatchObj.Evaluate
    ThisDrawing.Regen True
    MsgBox "Initial value of GradientName is " & hatchObj.GradientName
    hatchObj.GradientName = "SPHERICAL"
    MsgBox "New value of GradientName is " & hatchObj.GradientName
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GradientName()
    ;; This example changes the value of the GradientColor1 property.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "CYLINDER")
    (setq patternType acPreDefinedGradient)
    (setq bAssociativity :vlax-true)

    ;; Create the associative Hatch object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acGradientObject))

    (setq col1 (vlax-create-object "AutoCAD.AcCmColor.20"))
    (setq col2 (vlax-create-object "AutoCAD.AcCmColor.20"))

    (vla-SetRGB col1 255 0 0)
    (vla-SetRGB col2 0 255 0)

    (vla-put-GradientColor1 hatchObj col1)
    (vla-put-GradientColor2 hatchObj col2)

    ;; Create the outer boundary for the hatch (a circle)
    (setq center (vlax-3d-point 3 3 0)
          radius 1)
    (setq circle (vla-AddCircle modelSpace center radius))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element outerLoop 0 circle)

    ;; Append the outerboundary to the hatch object, and display the hatch
    (vla-AppendOuterLoop hatchObj outerLoop)
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)

    (alert (strcat "Initial value of GradientName is " (vla-get-GradientName hatchObj)))
    (vla-put-GradientName hatchObj "SPHERICAL")
    (alert (strcat "New value of GradientName is " (vla-get-GradientName hatchObj)))

    (vlax-release-object col1)
    (vlax-release-object col2)
)


GraphicsWinLayoutBackgrndColor Property (ActiveX)

Specifies the background color for the paper space layouts.

Supported platforms: Windows only

Signature

VBA:

object.GraphicsWinLayoutBackgrndColor
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: OLE_COLOR (constant)

  • vbBlack
  • vbRed
  • vbYellow
  • vbGreen
  • vbCyan
  • vbBlue
  • vbMagenta
  • vbWhite

Remarks

The initial value for this property is a color halfway between the Windows standard background color and the Windows standard active button color.

The paper space windows are identified by the Layout tabs in AutoCAD. The model space window is identified by the Model tab. You can change the background color of the model space window by using the GraphicsWinModelBackgrndColor property.

Examples

VBA:

Sub Example_GraphicsWinLayoutBackgrndColor()
    ' This example returns the current setting of
    ' GraphicsWinLayoutBackgrndColor. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currGraphicsWinLayoutBackgrndColor As OLE_COLOR

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current GraphicsWinLayoutBackgrndColor value
    currGraphicsWinLayoutBackgrndColor = preferences.DISPLAY.GraphicsWinLayoutBackgrndColor
    MsgBox "The current value for GraphicsWinLayoutBackgrndColor is " _
            & preferences.DISPLAY.GraphicsWinLayoutBackgrndColor, vbInformation, "GraphicsWinLayoutBackgrndColor Example"

    ' Change the value for GraphicsWinLayoutBackgrndColor
    preferences.DISPLAY.GraphicsWinLayoutBackgrndColor = 16
    MsgBox "The new value for GraphicsWinLayoutBackgrndColor is " _
            & preferences.DISPLAY.GraphicsWinLayoutBackgrndColor, vbInformation, "GraphicsWinLayoutBackgrndColor Example"

    ' Reset GraphicsWinLayoutBackgrndColor to its original value
    preferences.DISPLAY.GraphicsWinLayoutBackgrndColor = currGraphicsWinLayoutBackgrndColor
    MsgBox "The GraphicsWinLayoutBackgrndColor value is reset to " _
            & preferences.DISPLAY.GraphicsWinLayoutBackgrndColor, vbInformation, "GraphicsWinLayoutBackgrndColor Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GraphicsWinLayoutBackgrndColor()
    ;; This example returns the current setting of
    ;; GraphicsWinLayoutBackgrndColor. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Set PaperSpace/Layout current
    (vla-put-ActiveSpace doc acPaperSpace)

    ;; Retrieve the current GraphicsWinLayoutBackgrndColor value
    (setq currGraphicsWinLayoutBackgrndColor (vlax-variant-change-type (vla-get-GraphicsWinLayoutBackgrndColor (vla-get-Display preferences)) vlax-vbLong))
    (alert (strcat "The current value for GraphicsWinLayoutBackgrndColor is " (itoa (vlax-variant-value currGraphicsWinLayoutBackgrndColor))))

    ;; Change the value for GraphicsWinLayoutBackgrndColor
    (vla-put-GraphicsWinLayoutBackgrndColor ACADPref (vlax-make-variant 127 19))
    (setq newValue (vlax-variant-change-type (vla-get-GraphicsWinLayoutBackgrndColor ACADPref) vlax-vbLong))
    (alert (strcat "The new value for GraphicsWinLayoutBackgrndColor is " (itoa (vlax-variant-value newValue))))

    ;; Reset GraphicsWinLayoutBackgrndColor to its original value
    (vla-put-GraphicsWinLayoutBackgrndColor ACADPref currGraphicsWinLayoutBackgrndColor)
    (alert (strcat "The GraphicsWinLayoutBackgrndColor value is reset to " (itoa (vlax-variant-value currGraphicsWinLayoutBackgrndColor))))
)


GraphicsWinModelBackgrndColor Property (ActiveX)

Specifies the background color for the model space window.

Supported platforms: Windows only

Signature

VBA:

object.GraphicsWinModelBackgrndColor
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: OLE_COLOR (constant)

  • vbBlack
  • vbRed
  • vbYellow
  • vbGreen
  • vbCyan
  • vbBlue
  • vbMagenta
  • vbWhite

Remarks

The default color for this property is vbBlack.

Examples

VBA:

Sub Example_GraphicsWinModelBackgrndColor()
    ' This example returns the current setting of
    ' GraphicsWinModelBackgrndColor. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currGraphicsWinModelBackgrndColor As OLE_COLOR

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current GraphicsWinModelBackgrndColor value
    currGraphicsWinModelBackgrndColor = preferences.DISPLAY.GraphicsWinModelBackgrndColor
    MsgBox "The current value for GraphicsWinModelBackgrndColor is " _
            & preferences.DISPLAY.GraphicsWinModelBackgrndColor, vbInformation, "GraphicsWinModelBackgrndColor Example"

    ' Change the value for GraphicsWinModelBackgrndColor
    preferences.DISPLAY.GraphicsWinModelBackgrndColor = 16
    MsgBox "The new value for GraphicsWinModelBackgrndColor is " _
            & preferences.DISPLAY.GraphicsWinModelBackgrndColor, vbInformation, "GraphicsWinModelBackgrndColor Example"

    ' Reset GraphicsWinModelBackgrndColor to its original value
    preferences.DISPLAY.GraphicsWinModelBackgrndColor = currGraphicsWinModelBackgrndColor
    MsgBox "The GraphicsWinModelBackgrndColor value is reset to " _
            & preferences.DISPLAY.GraphicsWinModelBackgrndColor, vbInformation, "GraphicsWinModelBackgrndColor Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GraphicsWinModelBackgrndColor()
    ;; This example returns the current setting of
    ;; GraphicsWinModelBackgrndColor. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current GraphicsWinModelBackgrndColor value
    (setq currGraphicsWinModelBackgrndColor (vlax-variant-change-type (vla-get-GraphicsWinModelBackgrndColor (vla-get-Display preferences)) vlax-vbLong))
    (alert (strcat "The current value for GraphicsWinModelBackgrndColor is " (itoa (vlax-variant-value currGraphicsWinModelBackgrndColor))))

    ;; Change the value for GraphicsWinModelBackgrndColor
    (vla-put-GraphicsWinModelBackgrndColor ACADPref (vlax-make-variant 127 19))
    (setq newValue (vlax-variant-change-type (vla-get-GraphicsWinModelBackgrndColor ACADPref) vlax-vbLong))
    (alert (strcat "The new value for GraphicsWinModelBackgrndColor is " (itoa (vlax-variant-value newValue))))

    ;; Reset GraphicsWinModelBackgrndColor to its original value
    (vla-put-GraphicsWinModelBackgrndColor ACADPref currGraphicsWinModelBackgrndColor)
    (alert (strcat "The GraphicsWinModelBackgrndColor value is reset to " (itoa (vlax-variant-value currGraphicsWinModelBackgrndColor))))
)


Green Property (ActiveX)

Specifies the green component of the True Color.

Supported platforms: Windows only

Signature

VBA:

object.Green
object

Type: AcCmColor

The object this property applies to.

Property Value

Read-only: Yes

Type: Long

The green component, from 0-255, of AcCmColor.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Green()
    ' This example draws a line and returns the RGB values
    Dim color As AcadAcCmColor
    Set color = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    color.SetRGB 80, 100, 244

    Dim line As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double

    startPoint(0) = 1#: startPoint(1) = 1#: startPoint(2) = 0#
    endPoint(0) = 5#: endPoint(1) = 5#: endPoint(2) = 0#

    Set line = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    ZoomAll

    line.TrueColor = color
    Dim retcolor As AcadAcCmColor
    Set retcolor = line.TrueColor

    MsgBox "Red = " & retcolor.Red & vbLf & _
           "Green = " & retcolor.Green & vbLf & _
           "Blue = " & retcolor.Blue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Green()
    ;; This example draws a line and returns the RGB values
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq color (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB color 80 100 244)

    (setq startPoint (vlax-3d-point 1 1 0)
          endPoint (vlax-3d-point 5 5 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq line (vla-AddLine modelSpace startPoint endPoint))
    (vla-ZoomAll acadObj)

    (vla-put-TrueColor line color)
    (setq retcolor (vla-get-TrueColor line))

    (alert (strcat "Red = " (itoa (vla-get-Red retcolor))
                   "\nGreen = " (itoa (vla-get-Green retcolor))
                   "\nBlue = " (itoa (vla-get-Blue retcolor))
           )
    )

    (vlax-release-object color)
)


GridOn Property (ActiveX)

Specifies the status of the viewport grid.

Supported platforms: Windows only

Signature

VBA:

object.GridOn
object

Type: PViewport, Viewport

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The grid is on.
  • False: The grid is off.

Remarks

The grid is used only for visual reference. It is not plotted, nor is it considered part of the drawing. The grid origin is set by the SnapBasePoint method.

When the grid is turned on, it is set to the current grid spacing. To change the grid spacing, use the SetGridSpacing method.

When you turn the grid on or off on a viewport, the visibility of the grid will not change until the viewport is made active. If you toggle the grid of the active viewport, the visibility of the grid will not change until the viewport is reset as the active viewport. To set or reset the viewport as the active viewport, use the ActiveViewport property with the updated viewport object.

NoteThe value of this property is stored in the GRIDMODE system variable. When using the SetVariable method to update the grid mode of the active viewport, you do not have to reset the viewport as the active viewport to see the change.

Examples

VBA:

Sub Example_GridOn()
    ' This example toggles the setting of GridOn.

    Dim viewportObj As AcadViewport

    ' Set the viewportObj variable to the activeviewport
    Set viewportObj = ThisDrawing.ActiveViewport

TOGGLEGRID:
    If MsgBox("Toggle the grid?", vbOKCancel, "GridOn Example") = vbOK Then
        viewportObj.GridOn = Not (viewportObj.GridOn)
    Else
        Exit Sub
    End If

    ' Reset the active viewport to see the change
    ThisDrawing.ActiveViewport = viewportObj

    GoTo TOGGLEGRID

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GridOn()
    ;; This example toggles the setting of GridOn.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Set the viewportObj variable to the activeviewport
    (setq viewportObj (vla-get-ActiveViewport doc))

    (vla-put-GridOn viewportObj (if (= (vla-get-GridOn viewportObj) :vlax-true) :vlax-false :vlax-true))

    ;; Reset the active viewport to see the change
    (vla-put-ActiveViewport doc viewportObj)
    (vla-Regen doc acAllViewports)

    (alert "Toggled the display of the grid.")
)


GripColorSelected Property (ActiveX)

Specifies the color of selected grips.

Supported platforms: Windows only

Signature

VBA:

object.GripColorSelected
object

Type: PreferencesSelection

The object this property applies to.

Property Value

Read-only: No

Type: acColor enum

Control of the selected grips (drawn as filled boxes). The valid range is 1 to 255, or one of the constants listed here:

  • acRed
  • acYellow
  • acGreen
  • acCyan
  • acBlue
  • acMagenta
  • acWhite

Remarks

The initial value of this property is 12.

NoteThe value for this property is stored in the GRIPHOT system variable.

Examples

VBA:

Sub Example_GripColorSelected()
    ' This example reads and modifies the preference value that controls
    ' the color of selected grips.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesSelection
    Dim originalValue As Variant, newValue As Variant

    ' Get the selection preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Selection

    ' Read and display the original value
    originalValue = ACADPref.GripColorSelected
    MsgBox "The GripColorSelected preference is set to: " & originalValue

    ' Modify the GripColorSelected preference by setting it to green
    ACADPref.GripColorSelected = acGreen
    newValue = ACADPref.GripColorSelected
    MsgBox "The GripColorSelected preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.GripColorSelected = originalValue
    MsgBox "The GripColorSelected preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GripColorSelected()
    ;; This example reads and modifies the preference value that controls
    ;; the color of selected grips.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get the selection preferences object
    (setq ACADPref (vla-get-Selection (vla-get-preferences acadObj)))

    ;; Read and display the original value
    (setq originalValue (vla-get-GripColorSelected ACADPref))
    (alert (strcat "The GripColorSelected preference is set to: " (itoa originalValue)))

    ;; Modify the GripColorSelected preference by setting it to green
    (vla-put-GripColorSelected ACADPref acGreen)
    (setq newValue (vla-get-GripColorSelected ACADPref))
    (alert (strcat "The GripColorSelected preference has been set to: " (itoa newValue)))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-GripColorSelected ACADPref originalValue)
    (alert (strcat "The GripColorSelected preference was reset back to: " (itoa originalValue)))
)


GripColorUnselected Property (ActiveX)

Specifies the color of unselected grips.

Supported platforms: Windows only

Signature

VBA:

object.GripColorUnselected
object

Type: PreferencesSelection

The object this property applies to.

Property Value

Read-only: No

Type: acColor enum

Control of the selected grips (drawn as box outlines). The valid range is 1 to 255, or one of the constants listed here:

  • acRed
  • acYellow
  • acGreen
  • acCyan
  • acBlue
  • acMagenta
  • acWhite

Remarks

The initial value of this property is 150.

NoteThe value for this property is stored in the GRIPCOLOR system variable.

Examples

VBA:

Sub Example_GripColorUnselected()
    ' This example reads and modifies the preference value that controls
    ' the color of unselected grips.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesSelection
    Dim originalValue As Variant, newValue As Variant

    ' Get the selection preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Selection

    ' Read and display the original value
    originalValue = ACADPref.GripColorUnselected
    MsgBox "The GripColorUnselected preference is set to: " & originalValue

    ' Modify the GripColorUnselected preference by setting it to green
    ACADPref.GripColorUnselected = acGreen
    newValue = ACADPref.GripColorUnselected
    MsgBox "The GripColorUnselected preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.GripColorUnselected = originalValue
    MsgBox "The GripColorUnselected preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GripColorUnselected()
    ;; This example reads and modifies the preference value that controls
    ;; the color of unselected grips.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get the selection preferences object
    (setq ACADPref (vla-get-Selection (vla-get-preferences acadObj)))

    ;; Read and display the original value
    (setq originalValue (vla-get-GripColorUnselected ACADPref))
    (alert (strcat "The GripColorUnselected preference is set to: " (itoa originalValue)))

    ;; Modify the GripColorUnselected preference by setting it to green
    (vla-put-GripColorUnselected ACADPref acGreen)
    (setq newValue (vla-get-GripColorUnselected ACADPref))
    (alert (strcat "The GripColorUnselected preference has been set to: " (itoa newValue)))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-GripColorUnselected ACADPref originalValue)
    (alert (strcat "The GripColorUnselected preference was reset back to: " (itoa originalValue)))
)


GripSize Property (ActiveX)

Specifies the size of grips.

Supported platforms: Windows only

Signature

VBA:

object.GripSize
object

Type: PreferencesSelection

The object this property applies to.

Property Value

Read-only: No

Type: Longt

The size of the box drawn to display the grip, in pixels. The practical range for this property is 1 to 20, although any value from 1 to 255 is valid.

Remarks

The initial value of this property is 3.

NoteThe value for this property is stored in the GRIPSIZE system variable.

Examples

VBA:

Sub Example_GripSize()
    ' This example reads and modifies the preference value that controls
    ' the size of grips. When finished, this example resets the
    ' preference value back to its original value.

    Dim ACADPref As AcadPreferencesSelection
    Dim originalValue As Variant, newValue As Variant

    ' Get the selection preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Selection

    ' Read and display the original value
    originalValue = ACADPref.GripSize
    MsgBox "The GripSize preference is set to: " & originalValue

    ' Modify the GripSize preference by setting it to 5
    ACADPref.GripSize = 5
    newValue = ACADPref.GripSize
    MsgBox "The GripSize preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.GripSize = originalValue
    MsgBox "The GripSize preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GripSize()
    ;; This example reads and modifies the preference value that controls
    ;; the size of grips. When finished, this example resets the
    ;; preference value back to its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get the selection preferences object
    (setq ACADPref (vla-get-Selection (vla-get-preferences acadObj)))

    ;; Read and display the original value
    (setq originalValue (vla-get-GripSize ACADPref))
    (alert (strcat "The GripSize preference is set to: " (itoa originalValue)))

    ;; Modify the GripSize preference by setting it to 7
    (vla-put-GripSize ACADPref 7)
    (setq newValue (vla-get-GripSize ACADPref))
    (alert (strcat "The GripSize preference has been set to: " (itoa newValue)))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-GripSize ACADPref originalValue)
    (alert (strcat "The GripSize preference was reset back to: " (itoa originalValue)))
)


Groups Property (ActiveX)

Gets the Groups collection for the document.

Supported platforms: Windows only

Signature

VBA:

object.Groups
object

Type: Database, Document

The object this property applies to.

Property Value

Read-only: Yes

Type: Groups

The Groups collection for the document.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Groups()
    ' This example finds the current Groups collection and
    ' adds a new group to that collection.

    Dim groupColl As AcadGroups
    Set groupColl = ThisDrawing.Groups

    ' Create a dimension style named "TEST" in current drawing
    Dim testGroup As AcadGroup
    Set testGroup = groupColl.Add("TEST")
    MsgBox "A new group called " & testGroup.name & " has been added to the Groups collection.", vbInformation, "Groups Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Groups()
    ;; This example finds the current Groups collection and
    ;; adds a new group to that collection.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq groupColl (vla-get-Groups doc))

    ;; Create a dimension style named "TEST" in current drawing
    (setq testGroup (vla-Add groupColl "TEST"))
    (alert (strcat "A new group called " (vla-get-Name testGroup) " has been added to the Groups collection."))
)


Handle Property (ActiveX)

Gets the handle of an object.

Supported platforms: Windows only

Signature

VBA:

object.Handle
object

Type: All drawing objects, AttributeReference, Block, Blocks, Dictionaries, Dictionary, DimStyle, DimStyles, Group, Groups, Layer, Layers, Layout, Layouts, Linetype, Linetypes, ModelSpace, PaperSpace, PlotConfiguration, PlotConfigurations, RegisteredApplication, RegisteredApplications, SectionManager, SectionSettings, SortentsTable, TableStyle, TextStyle, TextStyles, UCS, UCSs, View, Views, Viewport, Viewports, XRecord

The object this property applies to.

Property Value

Read-only: Yes

Type: String

The handle of the entity.

Remarks

An object ID and a unique handle are the two ways of referencing an object. A handle is persistent (stays the same) in a drawing for the lifetime of the object.

In general, use a handle unless you plan to work with certain ObjectARX functions that require an object ID.

Examples

VBA:

Sub Example_Handle()
    ' This example creates several objects in model space.
    ' It then iterates through the objects in model space and displays the
    ' Handle for each object found.

    ' Create a Ray object in model space
    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)

    ' Create a polyline object in model space
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True

    ' Create a line object in model space
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ' Create a circle object in model space
    Dim circObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 5: centerPt(1) = 3: centerPt(2) = 0
    radius = 3
    Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)

    ' Create an ellipse object in model space
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    ZoomAll

    ' Iterate through the model space collection and display
    ' the handle of each object found.

    Dim entHandle As String
    Dim entry As AcadEntity
    For Each entry In ThisDrawing.ModelSpace
        entHandle = entry.handle
        entry.Highlight (True)
        MsgBox "The handle of this object is " & entHandle, vbInformation, "Handle Example"
        entry.Highlight (False)
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Handle()
    ;; This example creates several objects in model space.
    ;; It then iterates through the objects in model space and displays the
    ;; Handle for each object found.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Create a Ray object in model space
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 1 3 0))
    (setq rayObj (vla-AddRay modelSpace basePoint SecondPoint))

    ;; Create a polyline object in model space
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
                                  9 2
                  3 5
                 )
    )
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)

    ;; Create a line object in model space
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 2 2 0))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    ;; Create a circle object in model space
    (setq centerPt (vlax-3d-point 20 30 0)
          radius 3)
    (setq circObj (vla-AddCircle modelSpace centerPt radius))

    ;; Create an ellipse object in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

    (vla-ZoomAll acadObj)

    ;; Iterate through the model space collection and display
    ;; the handle of each object found.
    (vlax-for entry (vla-get-ModelSpace doc)
        (setq entHandle (vla-get-Handle entry))
        (vla-Highlight entry :vlax-true)
        (alert (strcat "The handle of this object is " entHandle))
        (vla-Highlight entry :vlax-false)
    )
)


HasAttributes Property (ActiveX)

Specifies whether the block has any attributes in it.

Supported platforms: Windows only

Signature

VBA:

object.HasAttributes
object

Type: BlockReferences, ExternalReference, MInsertBlock

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: The block reference has attributes.
  • False: The block reference does not have attributes.

Remarks

This property is True if the block reference contains any editable or constant (non-editable) attributes. It is False if there are no attributes.

To return an array of Attribute objects associated to a block, use the GetAttributes method.

Examples

VBA:

Sub Example_HasAttributes()
    ' This example first creates a block without attributes.
    ' It then inserts the block and checks whether it has attributes.
    ' It then adds attributes to the block and inserts it again.
    ' Then it checks the new block reference for attributes.

    ' Create the block
    Dim blockObj As AcadBlock
    Dim insertionPnt(0 To 2) As Double
    insertionPnt(0) = 0#: insertionPnt(1) = 0#: insertionPnt(2) = 0#
    Set blockObj = ThisDrawing.Blocks.Add(insertionPnt, "CircleBlock")

    ' Add a circle to the block
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 0: center(1) = 0: center(2) = 0
    radius = 1
    Set circleObj = blockObj.AddCircle(center, radius)

    ' Insert the block
    Dim blockRefObj As AcadBlockReference
    insertionPnt(0) = 2#: insertionPnt(1) = 2#: insertionPnt(2) = 0
    Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, "CircleBlock", 1#, 1#, 1#, 0)
    ThisDrawing.Application.ZoomAll
    MsgBox "This block reference " & IIf(blockRefObj.HasAttributes, "has attributes.", "does not have attributes."), , "Has Attributes Example"

    ' Add attributes to the block definition.
    ' Define the attribute definition.
    Dim attributeObj As AcadAttribute
    Dim height As Double
    Dim mode As Long
    Dim prompt As String
    Dim insertionPoint(0 To 2) As Double
    Dim tag As String
    Dim value As String
    height = 1#
    mode = acAttributeModeVerify
    prompt = "Attribute Prompt"
    insertionPoint(0) = 1#: insertionPoint(1) = 1#: insertionPoint(2) = 0
    tag = "Attribute_Tag"
    value = "Attribute Value"

    ' Create the attribute definition
    Set attributeObj = blockObj.AddAttribute(height, mode, prompt, insertionPoint, tag, value)

    ' Insert the block again
    Dim blockRefObj2 As AcadBlockReference
    insertionPnt(0) = 3#: insertionPnt(1) = 3#: insertionPnt(2) = 0
    Set blockRefObj2 = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, "CircleBlock", 1#, 1#, 1#, 0)
    ZoomAll
    MsgBox "The first block reference " & IIf(blockRefObj.HasAttributes, "has attributes.", "does not have attributes.") & vbCrLf & _
            "The second block reference " & IIf(blockRefObj2.HasAttributes, "has attributes.", "does not have attributes."), , "Has Attributes Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_HasAttributes()
    ;; This example first creates a block without attributes.
    ;; It then inserts the block and checks whether it has attributes.
    ;; It then adds attributes to the block and inserts it again.
    ;; Then it checks the new block reference for attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the block
    (setq insertionPnt (vlax-3d-point 0 0 0))
    (setq blockObj (vla-Add (vla-get-Blocks doc) insertionPnt "CircleBlock"))

    ;; Add a circle to the block
    (setq center (vlax-3d-point 0 0 0))
    (setq radius 1)
    (setq circleObj (vla-AddCircle blockObj center radius))

    ;; Insert the block
    (setq insertionPnt (vlax-3d-point 2 2 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq blockRefObj (vla-InsertBlock modelSpace insertionPnt "CircleBlock" 1 1 1 0))
    (vla-ZoomAll acadObj)
    (alert (strcat "This block reference " (if (= (vla-get-HasAttributes blockRefObj) :vlax-true) "has attributes." "does not have attributes.")))

    ;; Add attributes to the block definition.
    ;; Define the attribute definition.
    (setq insertionPoint (vlax-3d-point 1 1 0)
          attHeight 1
          attMode acAttributeModeVerify
          attPrompt "Attribute Prompt"
          attTag "Attribute_Tag"
          attValue "Attribute Value")

    ;; Create the attribute definition
    (setq attributeObj (vla-AddAttribute blockObj attHeight attMode attPrompt insertionPoint attTag attValue))

    ;; Insert the block again
    (setq insertionPnt (vlax-3d-point 3 3 0))
    (setq blockRefObj2 (vla-InsertBlock modelSpace insertionPnt "CircleBlock" 1 1 1 0))
    (vla-ZoomAll acadObj)
    (alert (strcat "The first block reference " (if (= (vla-get-HasAttributes blockRefObj) :vlax-true) "has attributes." "does not have attributes.")
                   "\nThe second block reference " (if (= (vla-get-HasAttributes blockRefObj2) :vlax-true) "has attributes." "does not have attributes.")))
)


HasExtensionDictionary Property (ActiveX)

Determines whether the object has an extension dictionary associated with it.

Supported platforms: Windows only

Signature

VBA:

object.HasExtensionDictionary
object

Type: All drawing objects, AttributeReference, Block, Dictionary, DimStyle, Group, Layer, Layout, Linetype, Material, MLeaderStyle, PlotConfiguration, RegisteredApplication, SectionManager, SectionSettings, SortentsTable, TableStyle, TextStyle, UCS, View, Viewport, XRecord

The objects this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: The object has an extension dictionary associated with it.
  • False: The object does not have an extension dictionary associated with it.

Remarks

You can create an extension dictionary for an object, or query an existing extension dictionary by using the GetExtensionDictionary method.

Examples

VBA:

Sub Example_HasExtensionDictionary()
    ' This example will iterate through each object in the current drawing and
    ' determine whether that object has an associated Extension Dictionary

    Dim DrawingObject As AcadObject
    Dim ExtensionDictionaryResults As String

    ' Make sure this drawing contains objects before continuing
    If ThisDrawing.ModelSpace.count = 0 Then
        MsgBox "There are no objects in the current drawing."
        Exit Sub
    End If

    For Each DrawingObject In ThisDrawing.ModelSpace
        ' Determine whether object contains Extension Dictionary
        Select Case DrawingObject.HasExtensionDictionary
            Case True
                ExtensionDictionaryResults = ExtensionDictionaryResults & _
                                             DrawingObject.ObjectName & _
                                             " has an associated Extension Dictionary" & vbCrLf
            Case False
                ExtensionDictionaryResults = ExtensionDictionaryResults _
                                             & DrawingObject.ObjectName & _
                                             " does not have an associated Extension Dictionary" & vbCrLf
        End Select
    Next

    MsgBox ExtensionDictionaryResults
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_HasExtensionDictionary()
    ;; This example will iterate through each object in the current drawing and
    ;; determine whether that object has an associated Extension Dictionary
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Make sure this drawing contains objects before continuing
    (if (= (vla-get-Count modelSpace) 0)
        (alert "There are no objects in the current drawing.")
        (progn
            (setq ExtensionDictionaryResults "")
               (vlax-for DrawingObject modelSpace
                   ;; Determine whether object contains Extension Dictionary
                   (cond
                    ((= (vla-get-HasExtensionDictionary DrawingObject) :vlax-true)
                        (setq ExtensionDictionaryResults (strcat ExtensionDictionaryResults
                                                                 (vla-get-ObjectName DrawingObject)
                                                                 " has an associated Extension Dictionary.\n")))
                    ((= (vla-get-HasExtensionDictionary DrawingObject) :vlax-false)
                        (setq ExtensionDictionaryResults (strcat ExtensionDictionaryResults
                                                                 (vla-get-ObjectName DrawingObject)
                                                                 " does not have an associated Extension Dictionary.\n")))
                )
        )

        (alert ExtensionDictionaryResults)
        )
    )
)


HasLeader Property (ActiveX)

Specifies whether the dimension has a leader.

Supported platforms: Windows only

Signature

VBA:

object.HasLeader
object

Type: DimArcLength

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The dimension has a leader.
  • False: The dimension does not have a leader.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


HasSheetView Property (ActiveX)

Specifies whether the viewport is linked to a corresponding sheet view.

Supported platforms: Windows only

Signature

VBA:

object.HasSheetView
object

Type: PViewport

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: The viewport has a corresponding sheet view.
  • False: The viewport does not have a corresponding sheet view.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


HasSubSelection Property (ActiveX)

Specifies whether the table contains a subselection set.

Supported platforms: Windows only

Signature

VBA:

object.HasSubSelection
object

Type: Table

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: Table contains a subselection set.
  • False: Table does not contain a subselection set.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


HasVpAssociation Property (ActiveX)

Specifies whether the view is associated with a paper space viewport.

Supported platforms: Windows only

Signature

VBA:

object.HasVpAssociation
object

Type: View

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The view is associated with a paper space viewport.
  • False: The view is not associated with a paper space viewport.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_HasVpAssociation()
    ' This example demonstrates the
    ' CategoryName, LayoutId, LayerState,
    ' and HasVpAssociation properties of the View object

    Dim oLSM As AcadLayerStateManager

    ' Access the LayerStateManager object
    Set oLSM = ThisDrawing.Application. _
       GetInterfaceObject("AutoCAD.AcadLayerStateManager.20")

    ' Associate the current drawing database with LayerStateManager
    oLSM.SetDatabase ThisDrawing.Database

    oLSM.Save "ColorLinetype", acLsColor + acLsLineType

    ' Create a view named "New_View" in current drawing
    Dim viewObj As AcadView

    ' Add the view to the views collection
    Set viewObj = ThisDrawing.Views.Add("New_View")
    MsgBox viewObj.Name & " has been added." & vbCrLf & _
           "Height: " & viewObj.height & vbCrLf & _
           "Width: " & viewObj.Width, , "Example"

    viewObj.CategoryName = "My View Category"
    viewObj.LayerState = "My Layer State"

    viewObj.LayoutId = ThisDrawing.Layouts(1).ObjectID

    MsgBox viewObj.CategoryName & " is the Category name." & vbCrLf & _
            viewObj.LayoutId & " is the Layout ID." & vbCrLf & _
            viewObj.LayerState & " is the Layer state."

    If viewObj.HasVpAssociation = True Then
        MsgBox "The view is associated with a paper space viewport."
    Else
        MsgBox "The view is not associated with a paper space viewport."
   End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_HasVpAssociation()
    ;; This example demonstrates the
    ;; CategoryName, LayoutId, LayerState,
    ;; and HasVpAssociation properties of the View object
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Access the LayerStateManager object
    (setq oLSM (vla-GetInterfaceObject acadObj "AutoCAD.AcadLayerStateManager.20"))

    ;; Associate the current drawing database with LayerStateManager
    (vla-SetDatabase oLSM (vla-get-Database doc))

    (vla-Save oLSM "ColorLinetype" (+ acLsColor acLsLineType))

    ;; Create a view named "New_View" in current drawing
    ;; Add the view to the views collection
    (setq viewObj (vla-Add (vla-get-Views doc) "New_View"))
    (alert (strcat (vla-get-Name viewObj) " has been added."
                   "\nHeight: " (rtos (vla-get-Height viewObj) 2)
                   "\nWidth: " (rtos (vla-get-Width viewObj) 2)))

    (vla-put-CategoryName viewObj "My View Category")
    (vla-put-LayerState viewObj "ColorLinetype")

    (vla-put-LayoutId viewObj (vla-get-ObjectID (vla-Item (vla-get-Layouts doc) 1)))

    (alert (strcat (vla-get-CategoryName viewObj) " is the Category name."
                   "\n" (itoa (vla-get-LayoutId viewObj)) " is the Layout ID."
                   "\n" (vla-get-LayerState viewObj) " is the Layer state."))

    (if (= (vla-get-HasVpAssociation viewObj) :vlax-true)
        (alert "The view is associated with a paper space viewport.")
        (alert "The view is not associated with a paper space viewport.")
    )

    (vlax-release-object oLSM)
)


HatchObjectType Property (ActiveX)

Specifies the type of the hatch, classic or gradient.

Supported platforms: Windows only

Signature

VBA:

object.HatchObjectType
object

Type: Hatch

The object this property applies to.

Property Value

Read-only: No

Type: AcHatchObjectType enum

  • acHatchObject
  • acGradientObject

Remarks

The default value of this property is 0, acHatchObject, which creates a classic hatch.

If the value of this property is 1, acGradientObject, a gradient is created by the AddHatch method for hatch creation. If a gradient is created, then PatternType should be AcGradientPatternType and PatternName should contain a gradient pattern name of LINEAR, CYLINDER, INVCYLINDER, SPHERICAL, HEMISPHERICAL, CURVED, INVSPHERICAL, INVHEMISPHERICAL, or INVCURVED.

Examples

VBA:

Sub Example_HatchObjectType()
    ' This example changes the value of the HatchObjectType property.
    ' The example requires that the active drawing contain an existing hatch.

    AppActivate ThisDrawing.Application.Caption

    Dim ent As AcadHatch
    Dim util As AcadUtility
    Set util = ThisDrawing.Utility
    Dim pt As Variant
    Call util.GetEntity(ent, pt, "Select hatch :")
    With ent
        MsgBox "Initial value of HatchObjectType = " & .HatchObjectType
        .HatchObjectType = acGradientObject
        .GradientAngle = 3.1415 / 4
        .GradientCentered = False
        .GradientName = "SPHERICAL"
        Dim col1 As AcadAcCmColor, col2 As AcadAcCmColor
        Set col1 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
        Set col2 = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
        col1.SetRGB 255, 0, 0
        col2.SetRGB 0, 255, 0
        .GradientColor1 = col1
        .GradientColor2 = col2
        MsgBox "New value of HatchObjectType = " & .HatchObjectType
    End With
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_HatchObjectType()
    ;; This example changes the value of the HatchObjectType property.
    ;; The example requires that the active drawing contain an existing hatch.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq util (vla-get-Utility doc))
    (vla-GetEntity util 'ent 'pt "Select hatch :")
    (alert (strcat "Initial value of HatchObjectType = " (itoa (vla-get-HatchObjectType ent))))

    (vla-put-HatchObjectType ent acGradientObject)
    (vla-put-GradientAngle ent (/ 3.1415 4))
    (vla-put-GradientCentered ent :vlax-false)
    (vla-put-GradientName ent "SPHERICAL")

    (setq col1 (vlax-create-object "AutoCAD.AcCmColor.20"))
    (setq col2 (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col1 255 0 0)
    (vla-SetRGB col2 0 255 0)
    (vla-put-GradientColor1 ent col1)
    (vla-put-GradientColor2 ent col2)

    (alert (strcat "New value of HatchObjectType = " (itoa (vla-get-HatchObjectType ent))))

    (vlax-release-object col1)
    (vlax-release-object col2)
)


HatchStyle Property (ActiveX)

Specifies the hatch style.

Supported platforms: Windows only

Signature

VBA:

object.HatchStyle
object

Type: Hatch

The object this property applies to.

Property Value

Read-only: No

Type: acHatchStyle enum

  • acHatchStyleNormal
  • acHatchStyleOuter
  • acHatchStyleIgnore

Remarks

  • acHatchStyleNormal

    Specifies standard style or normal. This option hatches inward from the outermost area boundary. If AutoCAD encounters an internal boundary, it turns off hatching until it encounters another boundary.

  • acHatchStyleOuter

    Fills the outermost areas only. This style also hatches inward from the area boundary, but it turns off hatching if it encounters an internal boundary and does not turn it back on again.

  • acHatchStyleIgnore

    Ignores internal structure. This option hatches through all internal objects.

Examples

VBA:

Sub Example_HatchStyle()
    ' This example creates an associative hatch in model space.
    ' The hatch style is then changed to demonstrate the different
    ' ways that inner loops are processed.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "ANSI31"
    PatternType = 0
    bAssociativity = True

    ' Create the associative Hatch object
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)

    ' Create the outer loop for the hatch.
    ' An arc and a line are used to create a closed loop.

    Dim outerLoop(0 To 1) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    center(0) = 5: center(1) = 3: center(2) = 0
    radius = 3
    startAngle = 0
    endAngle = 3.141592
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddArc(center, radius, startAngle, endAngle)
    Set outerLoop(1) = ThisDrawing.ModelSpace.AddLine(outerLoop(0).startPoint, outerLoop(0).endPoint)

    ' Append the outer loop to the hatch object
    hatchObj.AppendOuterLoop (outerLoop)

    ' Append the first circle as one inner loop
    Dim innerLoop1(0) As AcadEntity
    center(0) = 5: center(1) = 4.5: center(2) = 0
    radius = 1
    Set innerLoop1(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop1)

    ' Append the second circle as the other inner loop
    Dim innerLoop2(0) As AcadEntity
    radius = 0.5
    Set innerLoop2(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop2)

    ' Set the hatch style to normal
    hatchObj.hatchstyle = acHatchStyleNormal
    hatchObj.Evaluate
    ThisDrawing.Regen True
    MsgBox "The HatchStyle is set to " & Choose(hatchObj.hatchstyle + 1, "acHatchStyleNormal", "acHatchStyleOuter", "acHatchStyleIgnore"), , "HatchStyle Example"

    ' Set the hatch style to outer
    hatchObj.hatchstyle = acHatchStyleOuter
    hatchObj.Evaluate
    ThisDrawing.Regen True
    MsgBox "The HatchStyle is set to " & Choose(hatchObj.hatchstyle + 1, "acHatchStyleNormal", "acHatchStyleOuter", "acHatchStyleIgnore"), , "HatchStyle Example"

    ' Set the hatch style to ignore
    hatchObj.hatchstyle = acHatchStyleIgnore
    hatchObj.Evaluate
    ThisDrawing.Regen True
    MsgBox "The HatchStyle is set to " & Choose(hatchObj.hatchstyle + 1, "acHatchStyleNormal", "acHatchStyleOuter", "acHatchStyleIgnore"), , "HatchStyle Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_HatchStyle()
    ;; This example creates an associative hatch in model space.
    ;; The hatch style is then changed to demonstrate the different
    ;; ways that inner loops are processed.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "ANSI31"
          patternType 0
          bAssociativity :vlax-true)

    ;; Create the associative Hatch object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acHatchObject))

    ;; Create the outer loop for the hatch.
    ;; An arc and a line are used to create a closed loop.
    (setq center (vlax-3d-point 5 3 0)
          radius 3
          startAngle 0
          endAngle 3.141592)

    (setq arc (vla-AddArc modelSpace center radius startAngle endAngle))
    (setq line (vla-AddLine modelSpace (vla-get-StartPoint arc) (vla-get-EndPoint arc)))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element outerLoop 0 arc)
    (vlax-safearray-put-element outerLoop 1 line)

    ;; Append the outer loop to the hatch object, and display the hatch
    (vla-AppendOuterLoop hatchObj outerLoop)

    ;; Append a circle as the inner loop for the hatch.
    (setq center (vlax-3d-point 5 4.5 0))
    (setq radius 1)
    (setq circle1 (vla-AddCircle modelSpace center radius))

    (setq innerLoop1 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element innerLoop1 0 circle1)

    (vla-AppendInnerLoop hatchObj innerLoop1)

    ;; Append the second circle as the other inner loop
    (setq radius 0.5)
    (setq innerLoop2 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (setq circle2 (vla-AddCircle modelSpace center radius))
    (vlax-safearray-put-element innerLoop2 0 circle2)

    (vla-AppendInnerLoop hatchObj innerLoop2)
    (vla-ZoomAll acadObj)

    ;; Set the hatch style to normal
    (vla-put-hatchstyle hatchObj acHatchStyleNormal)
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)
    (alert (strcat "The HatchStyle is set to "
                   (cond
                     ((= (vla-get-hatchstyle hatchObj) 0) "acHatchStyleNormal")
                     ((= (vla-get-hatchstyle hatchObj) 1) "acHatchStyleOuter")
                     ((= (vla-get-hatchstyle hatchObj) 2) "acHatchStyleIgnore")
                   )))

    ;; Set the hatch style to outer
    (vla-put-hatchstyle hatchObj acHatchStyleOuter)
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)
    (alert (strcat "The HatchStyle is set to "
                   (cond
                     ((= (vla-get-hatchstyle hatchObj) 0) "acHatchStyleNormal")
                     ((= (vla-get-hatchstyle hatchObj) 1) "acHatchStyleOuter")
                     ((= (vla-get-hatchstyle hatchObj) 2) "acHatchStyleIgnore")
                   )))

    ;; Set the hatch style to ignore
    (vla-put-hatchstyle hatchObj acHatchStyleIgnore)
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)
    (alert (strcat "The HatchStyle is set to "
                   (cond
                     ((= (vla-get-hatchstyle hatchObj) 0) "acHatchStyleNormal")
                     ((= (vla-get-hatchstyle hatchObj) 1) "acHatchStyleOuter")
                     ((= (vla-get-hatchstyle hatchObj) 2) "acHatchStyleIgnore")
                   )))
)


HeaderSuppressed Property (ActiveX)

Specifies whether the header of the table is suppressed.

Supported platforms: Windows only

Signature

VBA:

object.HeaderSuppressed
object

Type: Table, TableStyle

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Table header is suppressed.
  • False: Table header is not suppressed.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_HeaderSuppressed()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.FlowDirection = acTableBottomToTop
    customObj.HorzCellMargin = 0.22
    customObj.BitFlags = 1
    customObj.SetTextHeight AcRowType.acDataRow + AcRowType.acTitleRow, 1.3
    customObj.SetTextStyle AcRowType.acDataRow + AcRowType.acTitleRow, "Standard"

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 12, 23, 45
    customObj.SetBackgroundColor AcRowType.acDataRow + AcRowType.acTitleRow, col
    customObj.SetGridVisibility AcGridLineType.acHorzInside + AcGridLineType.acHorzTop _
                                , AcRowType.acDataRow + AcRowType.acTitleRow, True

    customObj.SetAlignment AcRowType.acDataRow + AcRowType.acTitleRow, acBottomRight
    col.SetRGB 244, 0, 0
    customObj.SetGridColor 3, 1, col

    MsgBox "Table Style Name = " & customObj.Name & vbCrLf & _
           "Style Description = " & customObj.Description & vbCrLf & _
           "Flow Direction = " & customObj.FlowDirection & vbCrLf & _
           "Horzontal Cell Margin = " & customObj.HorzCellMargin & vbCrLf & _
           "Bit Flags = " & customObj.BitFlags & vbCrLf & _
           "Title Row Text Height = " & customObj.GetTextHeight(acTitleRow) & vbCrLf & _
           "Title Row Text Style = " & customObj.GetTextStyle(acTitleRow) & vbCrLf & _
           "Grid Visibility for HorizontalBottom TitleRow  = " & customObj.GetGridVisibility(acHorzBottom, acTitleRow) & vbCrLf & _
           "Title Row Alignment = " & customObj.GetAlignment(acTitleRow) & vbCrLf & _
           "Header Suppression = " & customObj.HeaderSuppressed

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_HeaderSuppressed()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-put-FlowDirection customObj acTableBottomToTop)
    (vla-put-HorzCellMargin customObj 0.22)
    (vla-put-BitFlags customObj 1)
    (vla-SetTextHeight customObj (+ acDataRow acTitleRow) 1.3)
    (vla-SetTextStyle customObj (+ acDataRow acTitleRow) "Standard")

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 12 23 45)

    (vla-SetBackgroundColor customObj (+ acDataRow acTitleRow) col)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) (+ acDataRow acTitleRow) :vlax-true)
    (vla-SetAlignment customObj (+ acDataRow acTitleRow) acBottomRight)
    (vla-SetRGB col 244 0 0)
    (vla-SetGridColor customObj (+ acHorzTop acHorzInside) acDataRow col)

    (alert (strcat "Table Style Name = " (vla-get-Name customObj)
                   "\nStyle Description = " (vla-get-Description customObj)
                   "\nFlow Direction = " (itoa (vla-get-FlowDirection customObj))
                   "\nHorzontal Cell Margin = " (rtos (vla-get-HorzCellMargin customObj) 2)
                   "\nBit Flags = " (itoa (vla-get-BitFlags customObj))
                   "\nTitle Row Text Height = " (rtos (vla-GetTextHeight customObj acTitleRow) 2)
                   "\nTitle Row Text Style = " (vla-GetTextStyle customObj acTitleRow)
                   "\nGrid Visibility for HorizontalBottom TitleRow  = " (if (= (vla-GetGridVisibility customObj acHorzBottom acTitleRow) :vlax-true) "True" "False")
                   "\nTitle Row Alignment = " (itoa (vla-GetAlignment customObj acTitleRow))
               "\nHeader Suppression = " (if (= (vla-get-HeaderSuppressed customObj) :vlax-true) "True" "False")
               "\nTitle Suppression = " (if (= (vla-get-TitleSuppressed customObj) :vlax-true) "True" "False")
       )
    )
    (vlax-release-object col)
)


Height Property (ActiveX)

Changes the height of the object.

Supported platforms: Windows only

Signature

VBA:

object.Height
object

Type: Application, Attribute, AttributeReference, DgnUnderlay, DwfUnderlay, ExtrudedSurface, GeomapImage, Helix, MText, OLE, PdfUnderlay, PointCloud, PViewport, RasterImage, Shape, Table, Text, TextStyle, Toolbar, View, Viewport, Wipeout

The objects this property applies to.

Property Value

Read-only: No (except for the GeomapImage, RasterImage and Toolbar objects that are read-only)

Type: Double (except for the Application and Toolbar objects that are of the Integer type)

This must be a positive, non-negative number.

Remarks

Application: The height of the main application window in pixels.

GeoPositionMarker, MText, Text: The height of the uppercase text. Height is measured in the current units. The Height property is used as a scale factor for both the height and width of the text.

GeomapImage, RasterImage: The height of the raster image in pixels.

Viewport: The height of a viewport is the Y axis measurement of the viewport frame.

View: The height of a view is the Y axis measurement of the area within a viewport that is used to display the model.

Examples - Text

VBA:

Sub Example_Height()
    ' This example creates a text object in model space.
    ' It then changes the height of the text object.

    Dim textObj As AcadText
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double

    ' Define the text object
    textString = "Hello, World."
    insertionPoint(0) = 3: insertionPoint(1) = 3: insertionPoint(2) = 0
    height = 0.5

    ' Create the text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)
    ZoomAll
    MsgBox "The text height is " & textObj.height, vbInformation, "Height Example"

    ' Change the value of the Height to 1
    textObj.height = 1
    textObj.Update
    MsgBox "The text height is set to " & textObj.height, vbInformation, "Height Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Height()
    ;; This example creates a text object in model space.
    ;; It then changes the height of the text object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the text object
    (setq textString "Hello, World."
          insertionPoint (vlax-3d-point 3 3 0)
          height 0.5)

    ;; Create the text object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq textObj (vla-AddText modelSpace textString insertionPoint height))
    (vla-ZoomAll acadObj)
    (vla-Update textObj)
    (alert (strcat "The text height is " (rtos (vla-get-height textObj) 2)))

    ;; Change the value of the Height to 1
    (vla-put-height textObj 1)
    (vla-Update textObj)
    (alert (strcat "The text height is set to " (rtos (vla-get-height textObj) 2)))
)

Examples - ExtrudedSurface

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


HelpFilePath Property (ActiveX)

Specifies the location of the AutoCAD Help file.

Supported platforms: Windows only

Signature

VBA:

object.HelpFilePath
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The location of the AutoCAD Help file.

Remarks

This property specifies the drive, path, and file name for the AutoCAD Help file.

Examples

VBA:

Sub Example_HelpFilePath()
    ' This example returns the current setting of
    ' HelpFilePath. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currHelpFilePath As String
    Dim newHelpFilePath As String
    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current HelpFilePath value
    currHelpFilePath = preferences.Files.HelpFilePath
    MsgBox "The current value for HelpFilePath is " & currHelpFilePath, vbInformation, "HelpFilePath Example"

    ' Change the value for HelpFilePath
    newHelpFilePath = "C:/AutoCAD/Help"
    preferences.Files.HelpFilePath = newHelpFilePath
    MsgBox "The new value for HelpFilePath is " & newHelpFilePath, vbInformation, "HelpFilePath Example"

    ' Reset HelpFilePath to its original value
    preferences.Files.HelpFilePath = currHelpFilePath
    MsgBox "The HelpFilePath value is reset to " & currHelpFilePath, vbInformation, "HelpFilePath Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_HelpFilePath()
    ;; This example returns the current setting of
    ;; HelpFilePath. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current HelpFilePath value
    (setq currHelpFilePath (vla-get-HelpFilePath (vla-get-Files preferences)))
    (alert (strcat "The current value for HelpFilePath is " currHelpFilePath))

    ;; Change the value for HelpFilePath
    (setq newHelpFilePath "C:/AutoCAD/Help")
    (vla-put-HelpFilePath (vla-get-Files preferences) newHelpFilePath)
    (alert (strcat "The new value for HelpFilePath is " newHelpFilePath))

    ;; Reset HelpFilePath to its original value
    (vla-put-HelpFilePath (vla-get-Files preferences) currHelpFilePath)
    (alert (strcat "The HelpFilePath value is reset to " currHelpFilePath))
)


HelpString Property (ActiveX)

Specifies the Help string for the toolbar, toolbar item, or menu item.

Supported platforms: Windows only

Signature

VBA:

object.HelpString
object

Type: PopupMenuItem, Toolbar, ToolbarItem

The objects this property applies to.

Property Value

Read-only: No

Type: String

The Help string for the toolbar, toolbar item, or menu item.

Remarks

The Help string is the text string that appears in the AutoCAD status line when a user highlights a menu item.

Examples

VBA:

Sub Example_HelpString()
    ' This example creates a new toolbar called "TestToolbar" and inserts a
    ' button into it. The HelpString property of the toolbar is then
    ' read and changed.
    ' To remove the toolbar after execution of this macro, use the Customize Menu
    ' option from the Tools menu.

    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    ' Create the new toolbar
    Dim newToolBar As AcadToolbar
    Set newToolBar = currMenuGroup.Toolbars.Add("TestToolbar")

    ' Add a button to the new toolbar.
    Dim newButton1 As AcadToolbarItem
    Dim openMacro As String

    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set newButton1 = newToolBar.AddToolbarButton("", "NewButton1", "Open a file.", openMacro)

    ' Display the toolbar
    newToolBar.Visible = True

    ' Read the current value of the Help string
    MsgBox "The current HelpString for the toolbar button is: " & newButton1.HelpString

    ' Change the value of the Help string
    newButton1.HelpString = "Use this toolbar button to Open a file."

    ' Read the new value of the Help string
    MsgBox "The new HelpString for the toolbar button is: " & newButton1.HelpString
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_HelpString()
    ;; This example creates a new toolbar called "TestToolbar" and inserts a
    ;; button into it. The HelpString property of the toolbar is then
    ;; read and changed.
    ;; To remove the toolbar after execution of this macro, use the Customize Menu
    ;; option from the Tools menu.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new toolbar
    (setq newToolBar (vla-Add (vla-get-Toolbars currMenuGroup) "TestToolbar"))

    ;; Add a button to the new toolbar.
    ;; Assign the macro string the VB equivalent of "ESC ESC _open "
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))
    (setq newButton1 (vla-AddToolbarButton newToolBar "" "NewButton1" "Open a file." openMacro))

    ;; Display the toolbar
    (vla-put-Visible newToolBar :vlax-true)

    ;; Read the current value of the Help string
    (alert (strcat "The current HelpString for the toolbar button is: " (vla-get-HelpString newButton1)))

    ;; Change the value of the Help string
    (vla-put-HelpString newButton1 "Use this toolbar button to Open a file.")

    ;; Read the new value of the Help string
    (alert (strcat "The new HelpString for the toolbar button is: " (vla-get-HelpString newButton1)))
)


History Property (ActiveX)

Specifies whether history is saved.

Supported platforms: Windows only

Signature

VBA:

object.History
object

Type: 3DSolid

The object to which this property applies.

Property Value

Read-only: No

Type: Boolean

  • True: History is saved.
  • False: History is not saved.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


HistoryLines Property (ActiveX)

Specifies the number of lines of text in the text window to keep in memory.

Supported platforms: Windows only

Signature

VBA:

object.HistoryLines
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: Integer

The initial value is 400.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_HistoryLines()
    ' This example returns the current setting of
    ' HistoryLines. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currHistoryLines As Integer

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current HistoryLines value
    currHistoryLines = preferences.DISPLAY.HistoryLines
    MsgBox "The current value for HistoryLines is " & preferences.DISPLAY.HistoryLines, vbInformation, "HistoryLines Example"

    ' Change the value for HistoryLines
    preferences.DISPLAY.HistoryLines = 42
    MsgBox "The new value for HistoryLines is " & preferences.DISPLAY.HistoryLines, vbInformation, "HistoryLines Example"

    ' Reset HistoryLines to its original value
    preferences.DISPLAY.HistoryLines = currHistoryLines
    MsgBox "The HistoryLines value is reset to " & preferences.DISPLAY.HistoryLines, vbInformation, "HistoryLines Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_HistoryLines()
    ;; This example returns the current setting of
    ;; HistoryLines. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current HistoryLines value
    (setq currHistoryLines (vla-get-HistoryLines (vla-get-Display preferences)))
    (alert (strcat "The current value for HistoryLines is " (itoa currHistoryLines)))

    ;; Change the value for HistoryLines
    (vla-put-HistoryLines (vla-get-Display preferences) 42)
    (alert (strcat "The new value for HistoryLines is " (itoa (vla-get-HistoryLines (vla-get-Display preferences)))))

    ;; Reset HistoryLines to its original value
    (vla-put-HistoryLines (vla-get-Display preferences) currHistoryLines)
    (alert (strcat "The HistoryLines value is reset to " (itoa (vla-get-HistoryLines (vla-get-Display preferences)))))
)


HorizontalTextPosition Property (ActiveX)

Specifies the horizontal justification for dimension text.

Supported platforms: Windows only

Signature

VBA:

object.HorizontalTextPosition
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: acDimHorizontalJustification enum

  • acHorzCentered: The text is centered along the dimension line between the extension lines.
  • acFirstExtensionLine: The text is next to the first extension line.
  • acSecondExtensionLine: The text is next to the second extension line.
  • acOverFirstExtension: The text is above and aligned with the first extension line.
  • acOverSecondExtension: The text is above and aligned with the second extension line.

Remarks

NoteThis property overrides the value of the DIMJUST system variable for the given dimension.

Examples

VBA:

Sub Example_HorizontalTextPosition()
    ' This example creates an aligned dimension in model space
    ' and cycles the dimension text through different
    ' horizontal alignments

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim CurrentValue As String

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 9: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ThisDrawing.Application.ZoomAll

    ' Read and display current text position
    Select Case dimObj.HorizontalTextPosition
        Case acHorzCentered:        CurrentValue = "centered"
        Case acFirstExtensionLine:  CurrentValue = "aligned to first extension line"
        Case acSecondExtensionLine: CurrentValue = "aligned to second extension line"
        Case acOverFirstExtension:  CurrentValue = "aligned over first extension line"
        Case acOverSecondExtension: CurrentValue = "aligned over second extension line"
    End Select

    MsgBox "The dimension is " & CurrentValue

    ' Force the alignment of the dimension text to the first extension line
    dimObj.HorizontalTextPosition = acFirstExtensionLine
    ThisDrawing.Regen acAllViewports
    MsgBox "Dimension text is now aligned to the first extension line"

    ' Force the alignment of the dimension text to the second extension line
    dimObj.HorizontalTextPosition = acSecondExtensionLine
    ThisDrawing.Regen acAllViewports
    MsgBox "Dimension text is now aligned to the second extension line"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_HorizontalTextPosition()
    ;; This example creates an aligned dimension in model space
    ;; and cycles the dimension text through different
    ;; horizontal alignments
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 9 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    ;; Read and display current text position
    (cond
        ((= (vla-get-HorizontalTextPosition dimObj) acHorzCentered) (setq CurrentValue "centered"))
        ((= (vla-get-HorizontalTextPosition dimObj) acFirstExtensionLine) (setq CurrentValue "aligned to first extension line"))
        ((= (vla-get-HorizontalTextPosition dimObj) acSecondExtensionLine) (setq CurrentValue "aligned to second extension line"))
        ((= (vla-get-HorizontalTextPosition dimObj) acOverFirstExtension) (setq CurrentValue "aligned over first extension line"))
        ((= (vla-get-HorizontalTextPosition dimObj) acOverSecondExtension) (setq CurrentValue "aligned over second extension line"))
    )

    (alert (strcat "The dimension is " CurrentValue))

    ;; Force the alignment of the dimension text to the first extension line
    (vla-put-HorizontalTextPosition dimObj acFirstExtensionLine)
    (vla-Regen doc acAllViewports)
    (alert "Dimension text is now aligned to the first extension line")

    ;; Force the alignment of the dimension text to the second extension line
    (vla-put-HorizontalTextPosition dimObj acSecondExtensionLine)
    (vla-Regen doc acAllViewports)
    (alert "Dimension text is now aligned to the second extension line")
)


HorzCellMargin Property (ActiveX)

Specifies the value of the horizontal margin of cells.

Supported platforms: Windows only

Signature

VBA:

object.HorzCellMargin
object

Type: Table, TableStyle

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The horizontal margin applied to each table cell.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_HorzCellMargin()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.FlowDirection = acTableBottomToTop
    customObj.HorzCellMargin = 0.22
    customObj.BitFlags = 1
    customObj.SetTextHeight AcRowType.acDataRow + AcRowType.acTitleRow, 1.3
    customObj.SetTextStyle AcRowType.acDataRow + AcRowType.acTitleRow, "Standard"

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 12, 23, 45
    customObj.SetBackgroundColor AcRowType.acDataRow + AcRowType.acTitleRow, col
    customObj.SetGridVisibility AcGridLineType.acHorzInside + AcGridLineType.acHorzTop _
                                , AcRowType.acDataRow + AcRowType.acTitleRow, True

    customObj.SetAlignment AcRowType.acDataRow + AcRowType.acTitleRow, acBottomRight
    col.SetRGB 244, 0, 0
    customObj.SetGridColor 3, 1, col

    MsgBox "Table Style Name = " & customObj.Name & vbCrLf & _
           "Style Description = " & customObj.Description & vbCrLf & _
           "Flow Direction = " & customObj.FlowDirection & vbCrLf & _
           "Horzontal Cell Margin = " & customObj.HorzCellMargin & vbCrLf & _
           "Bit Flags = " & customObj.BitFlags & vbCrLf & _
           "Title Row Text Height = " & customObj.GetTextHeight(acTitleRow) & vbCrLf & _
           "Title Row Text Style = " & customObj.GetTextStyle(acTitleRow) & vbCrLf & _
           "Grid Visibility for HorizontalBottom TitleRow  = " & customObj.GetGridVisibility(acHorzBottom, acTitleRow) & vbCrLf & _
           "Title Row Alignment = " & customObj.GetAlignment(acTitleRow) & vbCrLf & _
           "Header Suppression = " & customObj.HeaderSuppressed

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_HorzCellMargin()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-put-FlowDirection customObj acTableBottomToTop)
    (vla-put-HorzCellMargin customObj 0.22)
    (vla-put-VertCellMargin customObj 0.22)
    (vla-put-BitFlags customObj 1)
    (vla-SetTextHeight customObj (+ acDataRow acTitleRow) 1.3)
    (vla-SetTextStyle customObj (+ acDataRow acTitleRow) "Standard")

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 12 23 45)

    (vla-SetBackgroundColor customObj (+ acDataRow acTitleRow) col)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) (+ acDataRow acTitleRow) :vlax-true)
    (vla-SetAlignment customObj (+ acDataRow acTitleRow) acBottomRight)
    (vla-SetRGB col 244 0 0)
    (vla-SetGridColor customObj (+ acHorzTop acHorzInside) acDataRow col)

    (alert (strcat "Table Style Name = " (vla-get-Name customObj)
                   "\nStyle Description = " (vla-get-Description customObj)
                   "\nFlow Direction = " (itoa (vla-get-FlowDirection customObj))
                   "\nHorzontal Cell Margin = " (rtos (vla-get-HorzCellMargin customObj) 2)
                   "\nVertical Cell Margin = " (rtos (vla-get-VertCellMargin customObj) 2)
                   "\nBit Flags = " (itoa (vla-get-BitFlags customObj))
                   "\nTitle Row Text Height = " (rtos (vla-GetTextHeight customObj acTitleRow) 2)
                   "\nTitle Row Text Style = " (vla-GetTextStyle customObj acTitleRow)
                   "\nGrid Visibility for HorizontalBottom TitleRow  = " (if (= (vla-GetGridVisibility customObj acHorzBottom acTitleRow) :vlax-true) "True" "False")
                   "\nTitle Row Alignment = " (itoa (vla-GetAlignment customObj acTitleRow))
               "\nHeader Suppression = " (if (= (vla-get-HeaderSuppressed customObj) :vlax-true) "True" "False")
       )
    )
    (vlax-release-object col)
)


HWND Property (ActiveX)

Gets the window handle of the window frame.

Supported platforms: Windows only

Signature

VBA:

object.HWND
object

Type: Application, Document

The objects this property applies to.

Property Value

Read-only: Yes

Type: Long_PTR

The handle of the window frame.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_HWND()
    ' This example returns the handle (Hwnd) of a document window. The handle can be
    ' used with WindowsAPI calls, or with ActiveX components that require a handle
    ' to a window.

    ' If there are no open documents, then exit
    If Documents.Count = 0 Then
        MsgBox "There are no open documents!"
        Exit Sub
    End If

    MsgBox "The HWND of the active document is: " & ActiveDocument.HWND
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_HWND()
    ;; This example returns the handle (Hwnd) of a document window. The handle can be
    ;; used with WindowsAPI calls, or with ActiveX components that require a handle
    ;; to a window.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (alert (strcat "The HWND of the active document is: " (itoa (vla-get-HWND doc))))
)


HyperlinkBase Property (ActiveX)

Specifies the base address used for all relative links inserted within the drawing.

Supported platforms: Windows only

Signature

VBA:

object.HyperlinkBase
object

Type: SummaryInfo

The object this property applies to.

Property Value

Read-only: No

Type: String

The HyperlinkBase property of a drawing.

Remarks

You can specify an Internet location or a path to a folder on a network drive.

Examples

VBA:

Sub Example_HyperlinkBase()
    ' This example shows how to access drawing properties

    ' Add and display standard properties
    ThisDrawing.SummaryInfo.Author = "John Doe"
    ThisDrawing.SummaryInfo.Comments = "Includes all ten levels of Building Five"
    ThisDrawing.SummaryInfo.HyperlinkBase = "http://www.autodesk.com"
    ThisDrawing.SummaryInfo.Keywords = "Building Complex"
    ThisDrawing.SummaryInfo.LastSavedBy = "JD"
    ThisDrawing.SummaryInfo.RevisionNumber = "4"
    ThisDrawing.SummaryInfo.Subject = "Plan for Building Five"
    ThisDrawing.SummaryInfo.Title = "Building Five"

    Author = ThisDrawing.SummaryInfo.Author
    Comments = ThisDrawing.SummaryInfo.Comments
    HLB = ThisDrawing.SummaryInfo.HyperlinkBase
    KW = ThisDrawing.SummaryInfo.Keywords
    LSB = ThisDrawing.SummaryInfo.LastSavedBy
    RN = ThisDrawing.SummaryInfo.RevisionNumber
    Subject = ThisDrawing.SummaryInfo.Subject
    Title = ThisDrawing.SummaryInfo.Title
    MsgBox "The standard drawing properties are " & vbCrLf & _
            "Author = " & Author & vbCrLf & _
            "Comments = " & Comments & vbCrLf & _
            "HyperlinkBase = " & HLB & vbCrLf & _
            "Keywords = " & KW & vbCrLf & _
            "LastSavedBy = " & LSB & vbCrLf & _
            "RevisionNumber = " & RN & vbCrLf & _
            "Subject = " & Subject & vbCrLf & _
            "Title = " & Title & vbCrLf

    ' Add and display custom properties
    Dim Key0 As String
    Dim Value0 As String
    Dim Key1 As String
    Dim Value1 As String
    Dim CustomPropertyBranch As String
    Dim PropertyBranchValue As String
    Dim CustomPropertyZone As String
    Dim PropertyZoneValue As String

    CustomPropertyBranch = "Branch"
    PropertyBranchValue = "Main"
    CustomPropertyZone = "Zone"
    PropertyZoneValue = "Industrial"

    ' Add custom properties
    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 1) Then
        ThisDrawing.SummaryInfo.SetCustomByIndex 0, CustomPropertyBranch, PropertyBranchValue
    Else
        ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyBranch, PropertyBranchValue
    End If

    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 2) Then
         ThisDrawing.SummaryInfo.SetCustomByKey CustomPropertyBranch, "Satellite"
    Else
         ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyZone, PropertyZoneValue
    End If

    'Get custom properties
    ThisDrawing.SummaryInfo.GetCustomByIndex 0, Key0, Value0
    Key1 = CustomPropertyZone
    ThisDrawing.SummaryInfo.GetCustomByKey Key1, Value1

    MsgBox "The custom drawing properties are " & vbCrLf & _
            "First property name = " & Key0 & vbCrLf & _
            "First property value = " & Value0 & vbCrLf & _
            "Second property name = " & Key1 & vbCrLf & _
            "Second property value = " & Value1 & vbCrLf
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_HyperlinkBase()
    ;; This example shows how to access drawing properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq summaryInfo (vla-get-SummaryInfo doc))

    ;; Add and display standard properties
    (vla-put-Author summaryInfo "John Doe")
    (vla-put-Comments summaryInfo "Includes all ten levels of Building Five")
    (vla-put-HyperlinkBase summaryInfo "http://www.autodesk.com")
    (vla-put-Keywords summaryInfo "Building Complex")
    (vla-put-LastSavedBy summaryInfo "JD")
    (vla-put-RevisionNumber summaryInfo "4")
    (vla-put-Subject summaryInfo "Plan for Building Five")
    (vla-put-Title summaryInfo "Building Five")

    (setq author (vla-get-Author summaryInfo))
    (setq comments (vla-get-Comments summaryInfo))
    (setq HLB (vla-get-HyperlinkBase summaryInfo))
    (setq KW (vla-get-Keywords summaryInfo))
    (setq LSB (vla-get-LastSavedBy summaryInfo))
    (setq RN (vla-get-RevisionNumber summaryInfo))
    (setq subject (vla-get-Subject summaryInfo))
    (setq Title (vla-get-Title summaryInfo))
    (alert (strcat "The standard drawing properties are "
                   "\nAuthor = " author
                   "\nComments = " comments
                   "\nHyperlinkBase = " HLB
                   "\nKeywords = " KW
                   "\nLastSavedBy = " LSB
                   "\nRevisionNumber = " RN
                   "\nSubject = " Subject
                   "\nTitle = " Title
           )
    )

    ;; Add and display custom properties
    (setq CustomPropertyBranch "Branch")
    (setq PropertyBranchValue "Main")
    (setq CustomPropertyZone "Zone")
    (setq PropertyZoneValue "Industrial")

    ;; Add custom properties
    (if (>= (vla-NumCustomInfo summaryInfo) 1)
        (vla-SetCustomByIndex summaryInfo 0 CustomPropertyBranch PropertyBranchValue)
        (vla-AddCustomInfo summaryInfo CustomPropertyBranch PropertyBranchValue)
    )

    (if (>= (vla-NumCustomInfo summaryInfo) 2)
        (vla-SetCustomByKey summaryInfo CustomPropertyBranch "Satellite")
        (vla-AddCustomInfo summaryInfo CustomPropertyZone PropertyZoneValue)
    )

    ;; Get custom properties
    (vla-GetCustomByIndex summaryInfo 0 'Key0 'Value0)
    (setq Key1 CustomPropertyZone)
    (vla-GetCustomByKey summaryInfo Key1 'Value1)

    (alert (strcat "The custom drawing properties are "
                   "\nFirst property name = " Key0
                   "\nFirst property value = " Value0
                   "\nSecond property name = " Key1
                   "\nSecond property value = " Value1
           )
    )
)


HyperlinkDisplayCursor Property (ActiveX)

Toggles the display of the hyperlink cursor and shortcut menu.

Supported platforms: Windows only

Signature

VBA:

object.HyperlinkDisplayCursor
object

Type: PreferencesUser

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Displays the hyperlink cursor and shortcut menu.
  • False: Does not display the hyperlink cursor and shortcut menu.

Remarks

The initial value for this property is True.

When this property is enabled, the user sees a small bitmap (just below and to the right of the crosshairs) whenever the cursor is over an object that contains a hyperlink. When the property is disabled, this bitmap will not be shown.

Examples

VBA:

Sub Example_HyperlinkDisplayCursor()
    ' This example reads and modifies the preference value that controls
    ' the display of the hyperlink cursor and shortcut menu.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesUser
    Dim originalValue As Variant, newValue As Variant

    ' Get the user preferences object
    Set ACADPref = ThisDrawing.Application.preferences.User

    ' Read and display the original value
    originalValue = ACADPref.HyperlinkDisplayCursor
    MsgBox "The HyperlinkDisplayCursor preference is set to: " & originalValue

    ' Modify the HyperlinkDisplayCursor preference by toggling the value
    ACADPref.HyperlinkDisplayCursor = Not (ACADPref.HyperlinkDisplayCursor)
    newValue = ACADPref.HyperlinkDisplayCursor
    MsgBox "The HyperlinkDisplayCursor preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.HyperlinkDisplayCursor = originalValue
    MsgBox "The HyperlinkDisplayCursor preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_HyperlinkDisplayCursor()
    ;; This example reads and modifies the preference value that controls
    ;; the display of the hyperlink cursor and shortcut menu.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-HyperlinkDisplayCursor (vla-get-User preferences)))
    (alert (strcat "The HyperlinkDisplayCursor preference is set to: " (if (= originalValue :vlax-true) "True"  "False")))

    ;; Modify the HyperlinkDisplayCursor preference by toggling the value
    (vla-put-HyperlinkDisplayCursor (vla-get-User preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-HyperlinkDisplayCursor (vla-get-User preferences)))
    (alert (strcat "The HyperlinkDisplayCursor preference has been set to: " (if (= newValue :vlax-true) "True"  "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-HyperlinkDisplayCursor (vla-get-User preferences) originalValue)
    (alert (strcat "The HyperlinkDisplayCursor preference was reset back to: " (if (= originalValue :vlax-true) "True"  "False")))
)


Hyperlinks Property (ActiveX)

Gets the Hyperlinks collection for an entity.

Supported platforms: Windows only

Signature

VBA:

object.Hyperlinks
object

Type: All drawing objects, AttributeReference, SubDMeshEdge, SubDMeshFace, SubDMeshVertex, SubEntity, SubEntSolidEdge, SubEntSolidFace, SubEntSolidNode, SubEntSolidVertex

The objects this property applies to.

Property Value

Read-only: Yes

Type: Hyperlinks

The Hyperlinks collection for the entity.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_HyperLinks()
    ' This example creates a Circle object in model space and
    ' adds a new Hyperlink to its Hyperlink collection

    Dim Hyperlinks As AcadHyperlinks
    Dim Hyperlink As AcadHyperlink
    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    Dim HLList As String

    ' Define the Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    radius = 5#

    ' Create the Circle object in model space
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)

    ThisDrawing.Application.ZoomAll

    ' Get reference to the Circle's Hyperlinks collection
    Set Hyperlinks = circleObj.Hyperlinks

    ' Add a new Hyperlink complete with all properties
    Set Hyperlink = Hyperlinks.Add("AutoDesk")
    Hyperlink.URL = "www.autodesk.com"
    Hyperlink.URLDescription = "Autodesk Main Site"
    Hyperlink.URLNamedLocation = "MY_LOCATION"

    ' Read and display a list of existing Hyperlinks and
    ' their properties for this object
    For Each Hyperlink In Hyperlinks
        HLList = HLList & "____________________________________" & vbCrLf   ' Separator
        HLList = HLList & "URL: " & Hyperlink.URL & vbCrLf
        HLList = HLList & "URL Description: " & Hyperlink.URLDescription & vbCrLf
        HLList = HLList & "URL Named Location: " & Hyperlink.URLNamedLocation & vbCrLf
    Next

    MsgBox "The circle has " & Hyperlinks.count & " Hyperlink: " & vbCrLf & HLList
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_HyperLinks()
    ;; This example creates a Circle object in model space and
    ;; adds a new Hyperlink to its Hyperlink collection
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Circle object
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius 5)

    ;; Create the Circle object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))

    (vla-ZoomAll acadObj)

    ;; Get reference to the Circle's Hyperlinks collection
    (setq Hyperlinks (vla-get-Hyperlinks circleObj))

    ;; Add a new Hyperlink complete with all properties
    (setq Hyperlink (vla-Add Hyperlinks "Autodesk"))
    (vla-put-URL Hyperlink "www.autodesk.com")
    (vla-put-URLDescription Hyperlink "Autodesk Main Site")
    (vla-put-URLNamedLocation Hyperlink "MY_LOCATION")

    ;; Read and display a list of existing Hyperlinks and
    ;; their properties for this object
    (setq HLList "")
    (vlax-for Hyperlink Hyperlinks
        (setq HLList (strcat HLList "____________________________________"   ;; Separator
                             "\nURL: " (vla-get-URL Hyperlink)
                             "\nURL Description: " (vla-get-URLDescription Hyperlink)
                             "\nURL Named Location: " (vla-get-URLNamedLocation Hyperlink)))
    )

    (alert (strcat "The circle has " (itoa (vla-get-Count Hyperlinks)) " Hyperlink: \n"  HLList))
)


ImageFile Property (ActiveX)

Specifies the full path and file name of the raster image file.

Supported platforms: Windows only

Signature

VBA:

object.ImageFile
object

Type: GeomapImage, RasterImage, Wipeout

The objects this property applies to.

Property Value

Read-only: No

Type: String

The full path and file name of the raster image file.

Remarks

This property is similar to the Name property, except that this property contains the path information and the Name property does not.

You can use this property to load a new raster image into an existing raster object.

Examples

VBA:

Sub Example_ImageFile()
    ' This example inserts a raster image and then finds the
    ' ImageFile for the image.

    ' This example uses the "2d Projected Polylines.jpg" found in the Sample
    ' directory. If you do not have the image, or if it is located
    ' in a different directory, insert a valid path and name for the
    ' imageName variable below.
    Dim insertionPoint(0 To 2) As Double
    Dim scalefactor As Double
    Dim rotAngleInDegree As Double, rotAngle As Double
    Dim imageName As String
    Dim raster As AcadRasterImage
    imageName = "C:\AutoCAD\sample\2d Projected Polylines.jpg"
    insertionPoint(0) = 2#: insertionPoint(1) = 2#: insertionPoint(2) = 0#
    scalefactor = 1#
    rotAngleInDegree = 0#
    rotAngle = rotAngleInDegree * 3.141592 / 180#

    On Error Resume Next

    ' Creates a raster image in model space
    Set raster = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotAngle)
    If Err.Description = "File error" Then
        MsgBox imageName & " could not be found."
        Exit Sub
    End If

    ' Find the current ImageFile
    ThisDrawing.Regen True
    MsgBox "The ImageFile is currently set to: " & raster.ImageFile, vbInformation
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ImageFile()
    ;; This example inserts a raster image and then finds the
    ;; ImageFile for the image.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; This example uses the "2d Projected Polylines.jpg" found in the Sample
    ;; directory. If you do not have the image, or if it is located
    ;; in a different directory, insert a valid path and name for the
    ;; imageName variable below.
    (setq insertionPoint (vlax-3d-point 5 5 0)
          imageName ".\\Sample\\VBA\\2d Projected Polylines.jpg"
          scalefactor 1
          rotAngle (/ (* 0 3.141592) 180))

    ;; Creates a raster image in model space
    (if (/= (findfile imageName) nil)
        (progn
            (setq modelSpace (vla-get-ModelSpace doc))
            (setq raster (vla-AddRaster modelSpace (findfile imageName) insertionPoint scalefactor rotAngle))

            (vla-ZoomExtents acadObj)
        )
        (alert (strcat imageName " could not be found."))
    )

    ;; Find the current ImageFile
    (vla-Regen doc :vlax-true)
    (alert (strcat "The ImageFile is currently set to: " (vla-get-ImageFile raster)))
)


ImageFrameHighlight Property (ActiveX)

Controls the display of raster images during selection.

Supported platforms: Windows only

Signature

VBA:

object.ImageFrameHighlight
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Display raster image frame when the image is selected.
  • False: Display raster image content when the image is selected.

Remarks

The initial value for this property is True.

NoteThis value of this property is stored in the IMAGEHLT system variable.

Examples

VBA:

Sub Example_ImageFrameHighlight()
    ' This example reads and modifies the preference value that controls
    ' the display of raster images during selection. When finished, this example
    ' resets the preference value back to its original value.

    Dim ACADPref As AcadPreferencesDisplay
    Dim originalValue As Variant, newValue As Variant

    ' Get the display preferences object
    Set ACADPref = ThisDrawing.Application.preferences.DISPLAY

    ' Read and display the original value
    originalValue = ACADPref.ImageFrameHighlight
    MsgBox "The ImageFrameHighlight preference is set to: " & originalValue

    ' Modify the ImageFrameHighlight preference by toggling the value
    ACADPref.ImageFrameHighlight = Not (originalValue)
    newValue = ACADPref.ImageFrameHighlight
    MsgBox "The ImageFrameHighlight preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.ImageFrameHighlight = originalValue
    MsgBox "The ImageFrameHighlight preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ImageFrameHighlight()
    ;; This example reads and modifies the preference value that controls
    ;; the display of raster images during selection. When finished, this example
    ;; resets the preference value back to its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-ImageFrameHighlight (vla-get-Display preferences)))
    (alert (strcat "The ImageFrameHighlight preference is set to: " (if (= originalValue :vlax-true) "True"  "False")))

    ;; Modify the ImageFrameHighlight preference by toggling the value
    (vla-put-ImageFrameHighlight (vla-get-Display preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-ImageFrameHighlight (vla-get-Display preferences)))
    (alert (strcat "The ImageFrameHighlight preference has been set to: " (if (= newValue :vlax-true) "True"  "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-ImageFrameHighlight (vla-get-Display preferences) originalValue)
    (alert (strcat "The ImageFrameHighlight preference was reset back to: " (if (= originalValue :vlax-true) "True"  "False")))
)


ImageHeight Property (ActiveX)

Specifies the height of the raster image.

Supported platforms: Windows only

Signature

VBA:

object.ImageHeight
object

Type: GeomapImage, RasterImage, Wipeout

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The height of the raster image.

Remarks

This property is similar to the Height property. The Height property specifies the height of the image in pixels. This property specifies the height of the image in current units.

Examples

VBA:

Sub Example_ImageHeight()
    ' This example adds a raster image in model space and then finds
    ' the height and width of the image.

    ' This example uses the "2d Projected Polylines.jpg" found in the Sample
    ' directory. If you do not have this image, or if it is located
    ' in a different directory, insert a valid path and file name
    ' for the imageName variable below.

    Dim insertionPoint(0 To 2) As Double
    Dim scalefactor As Double
    Dim rotationAngle As Double
    Dim imageName As String
    Dim rasterObj As AcadRasterImage
    imageName = "C:/AutoCAD/sample/2d Projected Polylines.jpg"
    insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0#
    scalefactor = 1#
    rotationAngle = 0

    ' Creates a raster image in model space
    Set rasterObj = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotationAngle)

    ' Find the height and width of the raster image
    Dim height As Variant
    Dim width As Variant

    height = rasterObj.ImageHeight
    width = rasterObj.ImageWidth

    MsgBox "Raster image: " & rasterObj.ImageFile & vbCrLf & _
           "ImageHeight: " & Str(height) & vbCrLf & _
           "ImageWidth: " & Str(width)

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ImageHeight()
    ;; This example adds a raster image in model space and then finds
    ;; the height and width of the image.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; This example uses the "2d Projected Polylines.jpg" found in the Sample
    ;; directory. If you do not have this image, or if it is located
    ;; in a different directory, insert a valid path and file name
    ;; for the imageName variable below.
    (setq insertionPoint (vlax-3d-point 5 5 0)
          imageName ".\\Sample\\VBA\\2d Projected Polylines.jpg"
          scalefactor 1
          rotationAngle 0)

    ;; Creates a raster image in model space
    (if (/= (findfile imageName) nil)
        (progn
            (setq modelSpace (vla-get-ModelSpace doc))
            (setq rasterObj (vla-AddRaster modelSpace (findfile imageName) insertionPoint scalefactor rotationAngle))

        ;; Find the height and width of the raster image
        (setq height (vla-get-ImageHeight rasterObj)
              width (vla-get-ImageWidth rasterObj))

        (alert (strcat "Raster image: " (vla-get-ImageFile rasterObj)
                       "\nImageHeight: " (rtos height 2)
                       "\nImageWidth: " (rtos width 2)))
        )
        (alert (strcat imageName " could not be found."))
    )
)


ImageVisibility Property (ActiveX)

Specifies whether image visibility is on or off.

Supported platforms: Windows only

Signature

VBA:

object.ImageVisibility
object

Type: GeomapImage, RasterImage, Wipeout

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The image is visible.
  • False: The image is hidden.

Remarks

You can increase redrawing speed by turning the image visibility off when you do not need it in the current drawing session. Hidden images are not displayed or plotted; only the drawing boundary is displayed. You can choose to hide an image regardless of the current viewport coordinate system, or specifically when the image is not orthogonal (aligned) with the current viewport coordinate system.

Examples

VBA:

Sub Example_ImageVisibility()
    ' This example inserts a raster image and finds the current status
    ' of ImageVisibility for the image. It then changes the ImageVisibility
    ' status of the image.

    ' This example uses the "2d Projected Polylines.jpg" found in the Sample
    ' directory. If you do not have the image, or if it is located
    ' in a different directory, insert a valid path and name for the
    ' imageName variable below.
    Dim insertionPoint(0 To 2) As Double
    Dim scalefactor As Double
    Dim rotAngleInDegree As Double, rotAngle As Double
    Dim imageName As String
    Dim raster As AcadRasterImage
    imageName = "C:\AutoCAD\sample\2d Projected Polylines.jpg"
    insertionPoint(0) = 2#: insertionPoint(1) = 2#: insertionPoint(2) = 0#
    scalefactor = 1#
    rotAngleInDegree = 0#
    rotAngle = rotAngleInDegree * 3.141592 / 180#

    On Error Resume Next

    ' Creates a raster image in model space
    Set raster = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotAngle)
    If Err.Description = "File error" Then
        MsgBox imageName & " could not be found."
        Exit Sub
    End If

    ' Find the current ImageVisibility
    ThisDrawing.Regen True
    MsgBox "The ImageVisibility is currently set to: " & raster.ImageVisibility, vbInformation

    ' Change the ImageVisibility
    If (raster.ImageVisibility) Then
        raster.ImageVisibility = False
    Else
        raster.ImageVisibility = True
    End If
    ThisDrawing.Regen True
    MsgBox "The ImageVisibility is now set to: " & raster.ImageVisibility, vbInformation
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ImageVisibility()
    ;; This example inserts a raster image and finds the current status
    ;; of ImageVisibility for the image. It then changes the ImageVisibility
    ;; status of the image.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; This example uses the "2d Projected Polylines.jpg" found in the Sample
    ;; directory. If you do not have the image, or if it is located
    ;; in a different directory, insert a valid path and name for the
    ;; imageName variable below.
    (setq insertionPoint (vlax-3d-point 2 2 0)
          imageName ".\\Sample\\VBA\\2d Projected Polylines.jpg"
          scalefactor 1
          rotAngle (/ (* 0 3.141592 180)))

    ;; Creates a raster image in model space
    (if (/= (findfile imageName) nil)
        (progn
            (setq modelSpace (vla-get-ModelSpace doc))
            (setq raster (vla-AddRaster modelSpace (findfile imageName) insertionPoint scalefactor rotAngle))

               ;; Find the current ImageVisibility
               (vla-Regen doc :vlax-true)
               (alert (strcat "The ImageVisibility is currently set to: " (if (= (vla-get-ImageVisibility raster) :vlax-true) "True" "False")))

               ;; Change the ImageVisibility
               (if (= (vla-get-ImageVisibility raster) :vlax-true)
                   (vla-put-ImageVisibility raster :vlax-false)
                   (vla-put-ImageVisibility raster :vlax-true)
               )
               (vla-Regen doc :vlax-true)
               (alert (strcat "The ImageVisibility is now set to: " (if (= (vla-get-ImageVisibility raster) :vlax-true) "True" "False")))
        )
        (alert (strcat imageName " could not be found."))
    )
)


ImageWidth Property (ActiveX)

Specifies the width of the raster image.

Supported platforms: Windows only

Signature

VBA:

object.ImageWidth
object

Type: GeomapImage, RasterImage, Wipeout

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The width of the raster image.

Remarks

This property is similar to the Width property. The Width property specifies the width of the image in pixels. This property specifies the width of the image in the current units.

Examples

VBA:

Sub Example_ImageWidth()
    ' This example adds a raster image in model space and then finds
    ' the height and width of the image.

    ' This example uses the "2d Projected Polylines.jpg" found in the Sample
    ' directory. If you do not have this image, or if it is located
    ' in a different directory, insert a valid path and file name
    ' for the imageName variable below.

    Dim insertionPoint(0 To 2) As Double
    Dim scalefactor As Double
    Dim rotationAngle As Double
    Dim imageName As String
    Dim rasterObj As AcadRasterImage
    imageName = "C:/AutoCAD/sample/2d Projected Polylines.jpg"
    insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0#
    scalefactor = 1#
    rotationAngle = 0

    ' Creates a raster image in model space
    Set rasterObj = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotationAngle)

    ' Find the height and width of the raster image
    Dim height As Variant
    Dim width As Variant

    height = rasterObj.ImageHeight
    width = rasterObj.ImageWidth

    MsgBox "Raster image: " & rasterObj.ImageFile & vbCrLf & _
            "ImageHeight: " & Str(height) & vbCrLf & _
            "ImageWidth: " & Str(width)

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ImageWidth()
    ;; This example adds a raster image in model space and then finds
    ;; the height and width of the image.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; This example uses the "2d Projected Polylines.jpg" found in the Sample
    ;; directory. If you do not have this image, or if it is located
    ;; in a different directory, insert a valid path and file name
    ;; for the imageName variable below.
    (setq insertionPoint (vlax-3d-point 5 5 0)
          imageName ".\\Sample\\VBA\\2d Projected Polylines.jpg"
          scalefactor 1
          rotationAngle 0)

    ;; Creates a raster image in model space
    (if (/= (findfile imageName) nil)
        (progn
            (setq modelSpace (vla-get-ModelSpace doc))
            (setq rasterObj (vla-AddRaster modelSpace (findfile imageName) insertionPoint scalefactor rotationAngle))

               ;; Find the height and width of the raster image
               (setq height (vla-get-ImageHeight rasterObj)
                     width (vla-get-ImageWidth rasterObj))

               (alert (strcat "Raster image: " (vla-get-ImageFile rasterObj)
                              "\nImageHeight: " (rtos height 2)
                              "\nImageWidth: " (rtos width 2)))
        )
        (alert (strcat imageName " could not be found."))
    )
)


IncrementalSavePercent Property (ActiveX)

Specifies the percentage of wasted space allowed in a drawing file.

Supported platforms: Windows only

Signature

VBA:

object.IncrementalSavePercent
object

Type: PreferencesOpenSave

The object this property applies to.

Property Value

Read-only: No

Type: Integer

The valid range is 0 to 100.

Remarks

The initial value of this property is 50.

When the specified percentage is reached, AutoCAD performs a full save instead of an incremental save. Full saves eliminate wasted space. If you set this property to 0, every save is a full save.

Although incremental saves increase the size of your drawing, do not set a very low value. For optimum performance, set the value to 50. If memory becomes an issue, set the value to 25. If you set the value to 20 or less, performance slows significantly. Low values lower the program's performance because AutoCAD performs time-consuming full saves more often.

NoteThe value of this property is stored in the ISAVEPERCENT system variable.

Examples

VBA:

Sub Example_IncrementalSavePercent()
    ' This example returns the current setting of
    ' IncrementalSavePercent. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currIncrementalSavePercent As Integer
    Dim newIncrementalSavePercent As Integer

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current IncrementalSavePercent value
    currIncrementalSavePercent = preferences.OpenSave.IncrementalSavePercent
    MsgBox "The current value for IncrementalSavePercent is " & currIncrementalSavePercent, vbInformation, "IncrementalSavePercent Example"

    ' Change the value for IncrementalSavePercent
    newIncrementalSavePercent = 20
    preferences.OpenSave.IncrementalSavePercent = newIncrementalSavePercent
    MsgBox "The new value for IncrementalSavePercent is " & newIncrementalSavePercent, vbInformation, "IncrementalSavePercent Example"

    ' Reset IncrementalSavePercent to its original value
    preferences.OpenSave.IncrementalSavePercent = currIncrementalSavePercent
    MsgBox "The IncrementalSavePercent value is reset to " & currIncrementalSavePercent, vbInformation, "IncrementalSavePercent Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_IncrementalSavePercent()
    ;; This example returns the current setting of
    ;; IncrementalSavePercent. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current IncrementalSavePercent value
    (setq currIncrementalSavePercent (vla-get-IncrementalSavePercent (vla-get-OpenSave preferences)))
    (alert (strcat "The current value for IncrementalSavePercent is " (itoa currIncrementalSavePercent)))

    ;; Change the value for IncrementalSavePercent
    (setq newIncrementalSavePercent 20)
    (vla-put-IncrementalSavePercent (vla-get-OpenSave preferences) newIncrementalSavePercent)
    (alert (strcat "The new value for IncrementalSavePercent is " (itoa (vla-get-IncrementalSavePercent (vla-get-OpenSave preferences)))))

    ;; Reset IncrementalSavePercent to its original value
    (vla-put-IncrementalSavePercent (vla-get-OpenSave preferences) currIncrementalSavePercent)
    (alert (strcat "The IncrementalSavePercent value is reset to " (itoa currIncrementalSavePercent)))
)


Index Property (ActiveX)

Specifies the index of the menu, toolbar item, or an entry in the File Dependency List.

Supported platforms: Windows only

Signature

VBA:

object.Index
object

Type: FileDependency, PopupMenuItem, ToolbarItem

The objects this property applies to.

Property Value

Read-only: Yes

Type: Integer; except Long for a FileDependency object

The position of the menu or toolbar item; the first position in the index is 0. Index in the File Dependency List.

Remarks

No additional remarks.

Examples - FileDependency

VBA:

Sub Example_IndexFDL()
    ' This example reads information from a File Dependency List
    ' Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ' \Sample\Sheet Sets\Architectural\A-01.dwg

    Dim objFDLCol As AutoCAD.AcadFileDependencies
    Dim objFDL As AutoCAD.AcadFileDependency

    Set objFDLCol = ThisDrawing.FileDependencies
    MsgBox ("The number of entries in the File Dependency List is " & objFDLCol.count & ".")

    Dim strTemp As String
    For Each objFDL In objFDLCol
        strTemp = "Affects graphics?: " & vbTab & objFDL.AffectsGraphics
        strTemp = strTemp & vbCrLf & "Feature: " & vbTab & objFDL.Feature
        strTemp = strTemp & vbCrLf & "FileName: " & vbTab & objFDL.FileName
        strTemp = strTemp & vbCrLf & "FileSize: " & vbTab & objFDL.FileSize
        strTemp = strTemp & vbCrLf & "Fingerprint GUID: " & vbTab & objFDL.FingerprintGuid
        strTemp = strTemp & vbCrLf & "FoundPath: " & vbTab & objFDL.FoundPath
        strTemp = strTemp & vbCrLf & "FullFileName: " & vbTab & objFDL.FullFileName
        strTemp = strTemp & vbCrLf & "Index: " & vbTab & objFDL.Index
        strTemp = strTemp & vbCrLf & "Modified?: " & vbTab & objFDL.IsModified
        strTemp = strTemp & vbCrLf & "ReferenceCount: " & vbTab & objFDL.ReferenceCount
        strTemp = strTemp & vbCrLf & "Timestamp: " & vbTab & objFDL.TimeStamp
        strTemp = strTemp & vbCrLf & "Version GUID: " & vbTab & objFDL.VersionGuid
        MsgBox strTemp
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_IndexFDL()
    ;; This example reads information from a File Dependency List
    ;; Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ;; .\\Sample\\Sheet Sets\\Architectural\\A-01.dwg
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq objFDLCol (vla-get-FileDependencies doc))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))

    (setq strTemp "")
    (vlax-for each-objFDL objFDLCol
        (setq strTemp (strcat "Affects graphics?: " (if (= (vla-get-AffectsGraphics each-objFDL) :vlax-true) "True" "False")))
        (setq strTemp (strcat strTemp
                                       "\nFeature: " (vla-get-Feature each-objFDL)
                                       "\nFileName: " (vla-get-FileName each-objFDL)
                                       "\nFileSize: " (itoa (vla-get-FileSize each-objFDL))
                                       "\nFingerprint GUID: " (vla-get-FingerprintGuid each-objFDL)
                                       "\nFoundPath: " (vla-get-FoundPath each-objFDL)
                                       "\nFullFileName: " (vla-get-FullFileName each-objFDL)
                                       "\nIndex: " (itoa (vla-get-Index each-objFDL))
                                       "\nModified?: " (if (= (vla-get-IsModified each-objFDL) :vlax-true) "True" "False")
                                       "\nReferenceCount: " (itoa (vla-get-ReferenceCount each-objFDL))
                                       "\nTimeStamp: " (itoa (vla-get-TimeStamp each-objFDL))
                                       "\nVersion GUID: " (vla-get-VersionGuid each-objFDL)
                         )
           )
        (alert strTemp)
    )
)

Examples - PopupMenuItem

VBA:

Sub Example_Index()
    ' This example iterates through the first menu in the menu bar
    ' and displays the index for each menu item.

    Dim menuItem As AcadPopupMenuItem
    Dim menuIndex As String
    menuIndex = ""

    For Each menuItem In ThisDrawing.Application.MenuBar.Item(0)
        menuIndex = menuIndex & menuItem.TagString & " has the index: " & menuItem.index & vbCrLf
    Next menuItem
    MsgBox menuIndex

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Index()
    ;; This example iterates through the first menu in the menu bar
    ;; and displays the index for each menu item.
    (setq acadObj (vlax-get-acad-object))

    (setq menuIndex "")
    (vlax-for menuItem (vla-Item (vla-get-MenuBar acadObj) 0)
        (setq menuIndex (strcat menuIndex (vla-get-TagString menuItem) " has the index: " (itoa (vla-get-Index menuItem)) "\n"))
    )
    (alert menuIndex)
)


IndicatorFillColor Property (ActiveX)

Specifies color of section plane when shading is turned on.

Supported platforms: Windows only

Signature

VBA:

object.IndicatorFillColor
object

Type: Section

The object to which this property applies.

Property Value

Read-only: No

Type: AcCmColor

The color of the section plane when shading is turned on.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IndicatorTransparency Property (ActiveX)

Specifies transparency of section plane when shading is turned on.

Supported platforms: Windows only

Signature

VBA:

object.IndicatorTransparency
object

Type: Section

The object to which this property applies.

Property Value

Read-only: No

Type: Long

The transparency of the section plane when shading is turned on.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


InsertionPoint Property (ActiveX)

Insertion point for a tolerance, text, block, or shape, and the origin (upper-left corner) of an OLE object.

Supported platforms: Windows only

Signature

VBA:

object.InsertionPoint
object

Type: Attribute, AttributeReference, BlockReference, ExternalReference, MInsertBlock, MText, OLE, PointCloud, PointCloudEx, Shape, Table, Text, Tolerance

The objects this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

A 3D WCS coordinate representing the insertion or origin point.

Remarks

MText: Specifies the location for a corner of the text boundary. Use the AttachmentPoint property to specify which corner of the text boundary is to be positioned at this insertion point.

Text: This property is read-only except for text whose Alignment property is set to acAlignmentLeft, acAlignmentAligned, or acAlignmentFit. To position text whose justification is other than left, aligned, or fit, use the TextAlignmentPoint property.

Examples

VBA:

Sub Example_InsertionPoint()
    ' This example creates a text object in model space.
    ' It then changes the insertion point of the text object.

    Dim textObj As AcadText
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double

    ' Define the text object
    textString = "Hello, World."
    insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 0
    height = 0.5

    ' Create the text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)
    ZoomAll

    ' Return the current value of the insertion point
    Dim currInsertionPoint As Variant
    currInsertionPoint = textObj.insertionPoint
    MsgBox "The insertion point of the text is " & currInsertionPoint(0) & ", " & currInsertionPoint(1) & ", " & currInsertionPoint(2), vbInformation, "InsertionPoint Example"

    ' Change the insertion point of the text object and
    ' update the display of the text object.
    insertionPoint(0) = 3: insertionPoint(1) = 3: insertionPoint(2) = 0
    textObj.insertionPoint = insertionPoint
    textObj.Update
    MsgBox "The new insertion point of the text is " & textObj.insertionPoint(0) & ", " & textObj.insertionPoint(1) & ", " & textObj.insertionPoint(2), vbInformation, "InsertionPoint Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_InsertionPoint()
    ;; This example creates a text object in model space.
    ;; It then changes the insertion point of the text object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the text object
    (setq textString "Hello, World."
          insertionPoint (vlax-3d-point 2 2 0)
          height 0.5)

    ;; Create the text object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq textObj (vla-AddText modelSpace textString insertionPoint height))
    (vla-ZoomAll acadObj)

    ;; Return the current value of the insertion point
    (setq currInsertionPoint (vlax-safearray->list (vlax-variant-value (vla-get-InsertionPoint textObj))))
    (alert (strcat "The insertion point of the text is " (rtos (nth 0 currInsertionPoint) 2) ", "
                                                         (rtos (nth 1 currInsertionPoint) 2) ", "
                                                         (rtos (nth 2 currInsertionPoint) 2)))

    ;; Change the insertion point of the text object and
    ;; update the display of the text object.
    (setq insertionPoint (vlax-3d-point 3 3 0))
    (vla-put-insertionPoint textObj insertionPoint)
    (vla-Update textObj)
    (setq newInsertionPoint (vlax-safearray->list (vlax-variant-value (vla-get-InsertionPoint textObj))))
    (alert (strcat "The new insertion point of the text is " (rtos (nth 0 newInsertionPoint) 2) ", "
                                                             (rtos (nth 1 newInsertionPoint) 2) ", "
                                                             (rtos (nth 2 newInsertionPoint) 2)))
)


InsUnits Property (ActiveX)

Specifies the insert units saved with the block.

Supported platforms: Windows only

Signature

VBA:

object.InsUnits
object

Type: BlockReference, ExternalReference, MInsertBlock

The objects this property applies to.

Property Value

Read-only: Yes

Type: String

The InsUnits property specifies the native units for the block reference as defined by the block author. When a block is inserted in a drawing whose units have been defined, the block is automatically scaled proportional to the InsUnitsFactor, the conversion factor between the block units and the current drawing units.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


InsUnitsFactor Property (ActiveX)

Specifies the conversion factor between block units and drawing units.

Supported platforms: Windows only

Signature

VBA:

object.InsUnitsFactor
object

Type: BlockReference, ExternalReference, MInsertBlock

The objects this property applies to.

Property Value

Read-only: Yes

Type: Double

The conversion factor between block and drawing units.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntensityColorScheme Property (ActiveX)

Specifies the color scheme to use for displaying intensity values.

Supported platforms: Windows only

Signature

VBA:

object.IntensityColorScheme
object

Type: PointCloud

The object this property applies to.

Property Value

Read-only: No

Type: AcPointCloudIntensityStyle enum

  • acIntensityGrayscale
  • acIntensityRainbow
  • acIntensityRed
  • acIntensityGreen
  • acIntensityBlue
  • acIntensityEditableFlag

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionBoundaryColor Property (ActiveX)

Specifies the color of intersection boundary.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionBoundaryColor
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: AcCmColor

The color assigned to the intersection boundary.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionBoundaryDivisionLines Property (ActiveX)

Specifies whether division lines are shown in intersection boundary.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionBoundaryDivisionLines
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: Boolean

  • True: Division lines are shown.
  • False: Division lines are not shown.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionBoundaryLayer Property (ActiveX)

Specifies the layer of intersection boundary.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionBoundaryLayer
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: String

The layer assigned to the intersection boundary.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionBoundaryLinetype Property (ActiveX)

Specifies the linetype of intersection boundary.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionBoundaryLinetype
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: String

The linetype assigned to the intersection boundary.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionBoundaryLinetypeScale Property (ActiveX)

Specifies the linetype scale of intersection boundary.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionBoundaryLinetypeScale
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: ACAD_NOUNITS

The linetype scale of the intersection boundary.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionBoundaryLineweight Property (ActiveX)

Specifies the lineweight of intersection boundary.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionBoundaryLineweight
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: ACAD_LWEIGHT

The lineweight of the intersection boundary.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionBoundaryPlotStyleName Property (ActiveX)

Specifies the plot style name of intersection boundary.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionBoundaryPlotStyleName
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: String

The plot style name of the intersection boundary.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionBoundaryVisible Property (ActiveX)

Specifies the visibility of intersection boundary.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionBoundaryVisible
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: Boolean

  • True: The intersection boundary is visible.
  • False: The intersection boundary is not visible.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionFillColor Property (ActiveX)

Specifies the color of intersection fill.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionFillColor
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: AcCmColor

The color of intersection fill.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionFillFaceTransparency Property (ActiveX)

Specifies the face transparency of intersection fill.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionFillFaceTransparency
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: Long

The face transparency of intersection fill.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionFillHatchAngle Property (ActiveX)

Specifies the hatch angle for intersection fill.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionFillHatchAngle
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: ACAD_ANGLE

The hatch angle for intersection fill.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionFillHatchPatternName Property (ActiveX)

Specifies the hatch pattern name for intersection fill.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionFillHatchPatternName
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: String

The hatch pattern name for intersection fill.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionFillHatchPatternType Property (ActiveX)

Specifies the hatch pattern type for intersection fill.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionFillHatchPatternType
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: AcPatternType enum

  • acHatchPatternTypeCustomDefined
  • acHatchPatternTypePreDefined
  • acHatchPatternTypeUserDefined

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionFillHatchScale Property (ActiveX)

Specifies the hatch scale for intersection fill.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionFillHatchScale
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: ACAD_NOUNITS

The hatch scale for intersection fill.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionFillHatchSpacing Property (ActiveX)

Specifies the hatch spacing for intersection fill.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionFillHatchSpacing
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: Double

The hatch spacing for intersection fill.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionFillLayer Property (ActiveX)

Specifies the layer of intersection fill.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionFillLayer
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: String

The layer of intersection fill.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionFillLinetype Property (ActiveX)

Specifies the linetype of intersection fill.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionFillLinetype
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: String

The linetype of intersection fill.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionFillLinetypeScale Property (ActiveX)

Specifies the linetype scale of intersection fill.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionFillLinetypeScale
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: ACAD_NOUNITS

The linetype scale of intersection fill.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionFillLineweight Property (ActiveX)

Specifies the lineweight of intersection fill.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionFillLineweight
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: ACAD_LWEIGHT

The lineweight of intersection fill.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionFillPlotStyleName Property (ActiveX)

Specifies the plot style name of intersection fill.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionFillPlotStyleName
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: String

The plot style name of intersection fill.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IntersectionFillVisible Property (ActiveX)

Specifies the visibility of intersection fill.

Supported platforms: Windows only

Signature

VBA:

object.IntersectionFillVisible
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: Boolean

  • True: Intersection fill is visible.
  • False: Intersection fill is not visible.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Invisible Property (ActiveX)

Specifies whether the attribute or attribute reference is invisible.

Supported platforms: Windows only

Signature

VBA:

object.Invisible
object

Type: Attribute, AttributeReference

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The attribute is an invisible attribute.
  • False: The attribute is not an invisible attribute.

Remarks

An invisible attribute will not be displayed or plotted.

An attribute can exist as only one of four optional modes: constant, preset, invisible, or verify. The AFLAGS system variable stores the current mode settings. You can query the current mode using the Mode property.

Examples

VBA:

Sub Example_Invisible()
    ' This example creates an attribute definition in model space.
    ' It then queries the visibility of the attribute, changes
    ' the visibility, and queries the visibility again.

    Dim attributeObj As AcadAttribute
    Dim height As Double
    Dim mode As Long
    Dim prompt As String
    Dim insertionPoint(0 To 2) As Double
    Dim tag As String
    Dim value As String

    ' Define the attribute definition
    height = 1#
    mode = acAttributeModeVerify
    prompt = "New Prompt"
    insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0
    tag = "New_Tag"
    value = "New Value"

    ' Create the attribute definition object in model space
    Set attributeObj = ThisDrawing.ModelSpace.AddAttribute(height, mode, prompt, insertionPoint, tag, value)
    ZoomAll

    ' Find the current visibility for the attribute
    GoSub QUERYSTATUS

    ' Change the visibility of the attribute
    attributeObj.Invisible = Not attributeObj.Invisible
    ZoomAll

    GoSub QUERYSTATUS

    Exit Sub

QUERYSTATUS:
    If attributeObj.Invisible Then
        MsgBox "The attribute is invisible."
    Else
        MsgBox "The attribute is visible."
    End If
    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Invisible()
    ;; This example creates an attribute definition in model space.
    ;; It then queries the visibility of the attribute, changes
    ;; the visibility, and queries the visibility again.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the attribute definition
    (setq insertionPoint (vlax-3d-point 5 5 0)
          attHeight 1
          attMode acAttributeModeVerify
          attPrompt "New Prompt"
          attTag "NEW_TAG"
          attValue "New Value")

    ;; Create the attribute definition object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq attributeObj (vla-AddAttribute modelSpace attHeight attMode attPrompt insertionPoint attTag attValue))
    (vla-ZoomAll acadObj)

    ;; Find the current visibility for the attribute
    (if (= (vla-get-Invisible attributeObj) :vlax-true)
        (alert "The attribute is invisible.")
        (alert "The attribute is visible.")
    )

    ;; Change the visibility of the attribute
    (vla-put-Invisible attributeObj (if (= (vla-get-Invisible attributeObj) :vlax-true) :vlax-false :vlax-true))
    (vla-ZoomAll acadObj)

    (if (= (vla-get-Invisible attributeObj) :vlax-true)
        (alert "The attribute is invisible.")
        (alert "The attribute is visible.")
    )
)


IsCloned Property (ActiveX)

Determines whether the source object in a CopyObjects operation has been cloned.

Supported platforms: Windows only

Signature

VBA:

object.IsCloned
object

Type: IDPair

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: The source object has been cloned.
  • False: The source object has not been cloned.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_IsCloned()
    ' This example creates a Circle object and uses the CopyObjects
    ' method to copy the Circle. It then displays some information
    ' about the source objects used in the CopyObjects operation.

    Dim circleObj As AcadCircle, circleObjCopy As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius1 As Double, radius1Copy As Double
    Dim objCollection(0 To 0) As Object
    Dim retObjects As Variant
    Dim IDPairs As Variant
    Dim IsClonedState As String, IsPrimary As String, IsXLated As String

    ' Define the Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    radius1 = 5#: radius1Copy = 1#

    ' Add two circles to the drawing
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius1)
    ThisDrawing.Application.ZoomAll

    ' Copy objects
    '
    ' First put the objects to be copied into a form compatible with CopyObjects
    Set objCollection(0) = circleObj

    ' Copy object and get back a collection of the new objects
    retObjects = ThisDrawing.CopyObjects(objCollection, , IDPairs)

    ' Get newly created object and apply new properties to the copies
    Set circleObjCopy = retObjects(0)

    circleObjCopy.radius = radius1Copy

    ThisDrawing.Application.ZoomAll
    ThisDrawing.Regen acAllViewports

    ' Display whether the first source object has a clone
    IsClonedState = IIf(IDPairs(0).IsCloned, "is cloned.", "is not cloned.")
    IsPrimary = IIf(IDPairs(0).IsPrimary, "is a primary member of the objects being copied.", "is owned by a primary member of the objects being copied.")
    IsXLated = IIf(IDPairs(0).IsOwnerXlated, "has been translated.", "has not been translated.")

    MsgBox "The new Circle source object: " & IsClonedState & vbCrLf & _
           "The new Circle source object: " & IsPrimary & vbCrLf & _
           "The source of the new Circle object: " & IsXLated & vbCrLf, vbInformation

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_IsCloned()
    ;; This example creates a Circle object and uses the CopyObjects
    ;; method to make a copy of the Circle. It then displays some information
    ;; about the source objects used in the CopyObjects operation.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Circle object
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius1 5
          radius1Copy 1)

    ;; Add two circles to the drawing
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace centerPoint radius1))
    (vla-ZoomAll acadObj)

    ;; Copy objects
    ;;
    ;; First put the objects to be copied into a form compatible with CopyObjects
    (setq objCollection (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element objCollection 0 circleObj)

    ;; Copy object and get back a collection of the new objects (copies)
    (setq retObjects (vla-CopyObjects doc objCollection nil 'IDPairs))

    ;; Get newly created object and apply new properties to the copies
    (setq circleObjCopy (vlax-safearray-get-element (vlax-variant-value retObjects) 0))

    (vla-put-radius circleObjCopy radius1Copy)

    (vla-ZoomAll acadObj)
    (vla-Regen doc acAllViewports)

    ;; Display whether the first source object has a clone
    (setq IsClonedState (if (= (vla-get-IsCloned (vlax-safearray-get-element IDPairs 0)) :vlax-true) "is cloned."
                                                                                "is not cloned."))
    (setq IsPrimary (if (= (vla-get-IsPrimary (vlax-safearray-get-element IDPairs 0)) :vlax-true) "is a primary member of the objects being copied."
                                                                                "is owned by a primary member of the objects being copied."))
    (setq IsXLated (if (= (vla-get-IsOwnerXlated (vlax-safearray-get-element IDPairs 0)) :vlax-true) "has been translated."
                                                                                "has not been translated."))

    (alert (strcat "The new Circle source object: " IsClonedState
                   "\nThe new Circle source object: " IsPrimary
                   "\nThe source of the new Circle object: " IsXLated))
)


IsDynamicBlock Property (ActiveX)

Specifies whether this is a dynamic block.

Supported platforms: Windows only

Signature

VBA:

object.IsDynamicBlock
object

Type: Block, BlockReference, MInsertBlock

The objects this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: The block is a dynamic block.
  • False: The block is not a dynamic block.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IsLayout Property (ActiveX)

Determines whether the given block is a layout block.

Supported platforms: Windows only

Signature

VBA:

object.IsLayout
object

Type: Block

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: The block is a layout.
  • False: The block is not a layout.

Remarks

The IsLayout property works with the IsXRef property. If both properties are False, then the block is a simple block. If the IsXRef property is True, then the block is an external reference. If the IsLayout property is True, then the block contains all the geometry associated with a layout.

Examples

VBA:

Sub Example_IsLayout()
    ' This example cycles through each Block object in a drawing
    ' and determines whether style of each Block by accessing the
    ' IsLayout and IsXRef properties.  A Block
    ' object is also added at runtime so the results are mixed and do not only
    ' come from the default Blocks.

    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double, InsertPoint(0 To 2) As Double
    Dim radius As Double
    Dim newBlock As AcadBlock, insertedBlock As AcadBlockReference
    Dim tempBlock As AcadBlock
    Dim msg As String

    ' Define the Circle object that will be inserted into the block
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    InsertPoint(0) = 1: InsertPoint(1) = 1: InsertPoint(2) = 0
    radius = 0.5

    ' Create a new block to hold the Circle object
    Set newBlock = ThisDrawing.Blocks.Add(centerPoint, "CBlock")

    ' Add the Circle object to the new block object
    Set circleObj = ThisDrawing.Blocks("CBlock").AddCircle(centerPoint, radius)

    ' Add the new block to model space
    Set insertedBlock = ThisDrawing.ModelSpace.InsertBlock(InsertPoint, "CBlock", 1, 1, 1, 0)

    ThisDrawing.Application.ZoomAll

    msg = vbCrLf & vbCrLf

    For Each tempBlock In ThisDrawing.Blocks
        If Not (tempBlock.IsLayout) And Not (tempBlock.IsXRef) Then
            ' Block is simple
            msg = msg & tempBlock.name & ": Simple"
        ElseIf tempBlock.IsXRef Then
            ' Block is an external reference
            msg = msg & tempBlock.name & ": External Reference"
            If tempBlock.IsLayout Then
                ' Block also contains layout geometry
                msg = msg & tempBlock.name & " and Contains Layout Geometry"
            End If
        ElseIf tempBlock.IsLayout Then
            ' Block contains layout geometry
            msg = msg & tempBlock.name & ": Contains Layout Geometry"
        End If

        msg = msg & vbCrLf      ' Move to next line
    Next

    ' Display Block information for this drawing
    MsgBox "Blocks in this drawing have the following styles: " & msg

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_IsLayout()
    ;; This example cycles through each Block object in a drawing
    ;; and determines whether style of each Block by accessing the
    ;; IsLayout and IsXRef properties.  A Block
    ;; object is also added at runtime so the results are mixed and do not only
    ;; come from the default Blocks.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Circle object that will be inserted into the block
    (setq centerPoint (vlax-3d-point 0 0 0)
          insertPoint (vlax-3d-point 1 1 0)
          radius 0.5)

    ;; Create a new block to hold the Circle object
    (setq newBlock (vla-Add (vla-get-Blocks doc) centerPoint "CBlock"))

    ;; Add the Circle object to the new block object
    (setq circleObj (vla-AddCircle (vla-Item (vla-get-Blocks doc) "CBlock") centerPoint radius))

    ;; Add the new block to model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq insertedBlock (vla-InsertBlock modelSpace InsertPoint "CBlock" 1 1 1 0))

    (vla-ZoomAll acadObj)

    (setq msg "")

    (vlax-for tempBlock (vla-get-Blocks doc)
        (cond
            ((and (= (vla-get-IsLayout tempBlock) :vlax-false)
                  (= (vla-get-IsXRef tempBlock) :vlax-false))
                ;; Block is simple
                (setq msg (strcat msg (vla-get-Name tempBlock) ": Simple"))
            )
            ((= (vla-get-IsXRef tempBlock) :vlax-true)
                ;; Block is simple
                (setq msg (strcat msg (vla-get-Name tempBlock) ": External Reference"))
                (if (= (vla-get-IsLayout tempBlock) :vlax-true)
                    ;; Block also contains layout geometry
                    (setq msg (strcat msg (vla-get-Name tempBlock) " and Contains Layout Geometry"))
                )
            )
            ((= (vla-get-IsLayout tempBlock) :vlax-true)
                ;; Block is simple
                (setq msg (strcat msg (vla-get-Name tempBlock) ": Contains Layout Geometry"))
            )
        )
        (setq msg (strcat msg "\n"))
    )

    ;; Display Block information for this drawing
    (alert (strcat "Blocks in this drawing have the following styles: " msg))
)


IsModified Property (ActiveX)

Specifies whether an entry in the File Dependency List was modified.

Supported platforms: Windows only

Signature

VBA:

object.IsModified
object

Type: FileDependency

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: File is modified.
  • False: File is not modified.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_IsModified()
    ' This example reads information from a File Dependency List
    ' Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ' \Sample\Sheet Sets\Architectural\A-01.dwg

    Dim objFDLCol As AutoCAD.AcadFileDependencies
    Dim objFDL As AutoCAD.AcadFileDependency

    Set objFDLCol = ThisDrawing.FileDependencies
    MsgBox ("The number of entries in the File Dependency List is " & objFDLCol.count & ".")

    Dim strTemp As String
    For Each objFDL In objFDLCol
        strTemp = "Affects graphics?: " & vbTab & objFDL.AffectsGraphics
        strTemp = strTemp & vbCrLf & "Feature: " & vbTab & objFDL.Feature
        strTemp = strTemp & vbCrLf & "FileName: " & vbTab & objFDL.FileName
        strTemp = strTemp & vbCrLf & "FileSize: " & vbTab & objFDL.FileSize
        strTemp = strTemp & vbCrLf & "Fingerprint GUID: " & vbTab & objFDL.FingerprintGuid
        strTemp = strTemp & vbCrLf & "FoundPath: " & vbTab & objFDL.FoundPath
        strTemp = strTemp & vbCrLf & "FullFileName: " & vbTab & objFDL.FullFileName
        strTemp = strTemp & vbCrLf & "Index: " & vbTab & objFDL.Index
        strTemp = strTemp & vbCrLf & "Modified?: " & vbTab & objFDL.IsModified
        strTemp = strTemp & vbCrLf & "ReferenceCount: " & vbTab & objFDL.ReferenceCount
        strTemp = strTemp & vbCrLf & "Timestamp: " & vbTab & objFDL.TimeStamp
        strTemp = strTemp & vbCrLf & "Version GUID: " & vbTab & objFDL.VersionGuid
        MsgBox strTemp
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_IsModified()
    ;; This example reads information from a File Dependency List
    ;; Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ;; .\\Sample\\Sheet Sets\\Architectural\\A-01.dwg
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq objFDLCol (vla-get-FileDependencies doc))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))

    (setq strTemp "")
    (vlax-for each-objFDL objFDLCol
        (setq strTemp (strcat "Affects graphics?: " (if (= (vla-get-AffectsGraphics each-objFDL) :vlax-true) "True" "False")))
        (setq strTemp (strcat strTemp
                                       "\nFeature: " (vla-get-Feature each-objFDL)
                                       "\nFileName: " (vla-get-FileName each-objFDL)
                                       "\nFileSize: " (itoa (vla-get-FileSize each-objFDL))
                                       "\nFingerprint GUID: " (vla-get-FingerprintGuid each-objFDL)
                                       "\nFoundPath: " (vla-get-FoundPath each-objFDL)
                                       "\nFullFileName: " (vla-get-FullFileName each-objFDL)
                                       "\nIndex: " (itoa (vla-get-Index each-objFDL))
                                       "\nModified?: " (if (= (vla-get-IsModified each-objFDL) :vlax-true) "True" "False")
                                       "\nReferenceCount: " (itoa (vla-get-ReferenceCount each-objFDL))
                                       "\nTimeStamp: " (itoa (vla-get-TimeStamp each-objFDL))
                                       "\nVersion GUID: " (vla-get-VersionGuid each-objFDL)
                         )
           )
        (alert strTemp)
    )
)


ISOPenWidth Property (ActiveX)

Specifies the ISO pen width of an ISO hatch pattern.

Supported platforms: Windows only

Signature

VBA:

object.ISOPenWidth
object

Type: Hatch

The object this property applies to.

Property Value

Read-only: No

Type: acISOPenWidth enum

  • acPenWidth000: 0.00 mm
  • acPenWidth013: 0.13 mm
  • acPenWidth018: 0.18 mm
  • acPenWidth025: 0.25 mm
  • acPenWidth035: 0.35 mm
  • acPenWidth050: 0.50 mm
  • acPenWidth070: 0.70 mm
  • acPenWidth100: 1.00 mm
  • acPenWidth140: 1.40 mm
  • acPenWidth200: 2.00 mm
  • acPenWidthUnk: unknown

Remarks

The first ten values represent the pen width in hundredths of a millimeter.

The acPenWidthUnk value identifies an unknown, or non-standard, pen width. When you query a hatch and receive a value of acPenWidthUnk, use the PatternScale property to obtain the non-standard value. Setting the pen width of any hatch to acPenWidthUnk has no effect.

This property shares a relationship with the PatternScale property. When you work with ISO hatch patterns, the standard scale values can be entered through the PatternScale property or through this property. Non-standard pen widths can only be entered using the PatternScale property.

Examples

VBA:

Sub Example_ISOPenWidth()
    ' This example creates an associative hatch in model space.
    ' The ISOPenWidth of the hatch pattern is then returned and changed.

    Dim hatchObj As AcadHatch
    Dim patternName As String, PatternType As Long
    Dim bAssociativity As Boolean
    Dim outerLoop(0 To 1) As Object
    Dim center(0 To 2) As Double
    Dim radius As Double, startAngle As Double, endAngle As Double
    Dim innerLoop1(0) As Object, innerLoop2(0) As Object
    Dim PatternScale As Double

    ' Define the hatch
    patternName = "ANSI31": PatternType = 0: bAssociativity = True

    ' Create the associative Hatch object
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)

    ' Create the outer loop for the hatch.
    ' An arc and a line are used to create a closed loop.
    center(0) = 5: center(1) = 3: center(2) = 0
    radius = 3:  startAngle = 0:  endAngle = 3.141592

    Set outerLoop(0) = ThisDrawing.ModelSpace.AddArc(center, radius, startAngle, endAngle)
    Set outerLoop(1) = ThisDrawing.ModelSpace.AddLine(outerLoop(0).startPoint, outerLoop(0).endPoint)

    ' Append the outer loop to the hatch object
    hatchObj.AppendOuterLoop (outerLoop)

    ' Append the first circle as one inner loop
    center(0) = 5: center(1) = 4.5: center(2) = 0
    radius = 1

    Set innerLoop1(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop1)

    ' Append the second circle as the other inner loop
    radius = 0.5
    Set innerLoop2(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop2)

    ' Evaluate and display the hatch
    hatchObj.Evaluate
    ThisDrawing.Regen True

    ' Find the ISO pen width of the hatch pattern
    MsgBox "The ISO pen width of the hatch pattern is: " & hatchObj.ISOPenWidth, vbInformation

    ' Change the ISO pen width of the hatch pattern
    hatchObj.ISOPenWidth = acPenWidth050
    hatchObj.Evaluate
    ThisDrawing.Regen True

    ' Display new pen width for this hatch
    If hatchObj.ISOPenWidth = acPenWidthUnk Then
        ' Non-Standard pen widths
        MsgBox "The ISO pen width of the hatch pattern is now: " & hatchObj.PatternScale, vbInformation
    Else
        ' Standard pen widths
        MsgBox "The ISO pen width of the hatch pattern is now: " & hatchObj.ISOPenWidth, vbInformation
    End If

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ISOPenWidth()
    ;; This example creates an associative hatch in model space.
    ;; The ISOPenWidth of the hatch pattern is then returned and changed.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "ANSI31"
          patternType 0
          bAssociativity :vlax-true)

    ;; Create the associative Hatch object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acHatchObject))

    ;; Create the outer loop for the hatch.
    ;; An arc and a line are used to create a closed loop.
    (setq center (vlax-3d-point 5 3 0)
          radius 3
          startAngle 0
          endAngle 3.141592)

    (setq arc (vla-AddArc modelSpace center radius startAngle endAngle))
    (setq line (vla-AddLine modelSpace (vla-get-StartPoint arc) (vla-get-EndPoint arc)))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element outerLoop 0 arc)
    (vlax-safearray-put-element outerLoop 1 line)

    ;; Append the outer loop to the hatch object
    (vla-AppendOuterLoop hatchObj outerLoop)

    ;; Append the first circle as one inner loop
    (setq center (vlax-3d-point 5 4.5 0)
          radius 1)
    (setq circle1 (vla-AddCircle modelSpace center radius))

    (setq innerLoop1 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element innerLoop1 0 circle1)

    (vla-AppendInnerLoop hatchObj innerLoop1)

    ;; Append the second circle as the other inner loop
    (setq radius 0.5)
    (setq innerLoop2 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (setq circle2 (vla-AddCircle modelSpace center radius))
    (vlax-safearray-put-element innerLoop2 0 circle2)
    (vla-AppendInnerLoop hatchObj innerLoop2)

    ;; Evaluate and display the hatch
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)

    ;; Find the ISO pen width of the hatch pattern
    (alert (strcat "The ISO pen width of the hatch pattern is: " (itoa (vla-get-ISOPenWidth hatchObj))))

    ;; Change the ISO pen width of the hatch pattern
    (vla-put-ISOPenWidth hatchObj acPenWidth050)
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)

    ;; Display new pen width for this hatch
    (if (= (vla-get-ISOPenWidth hatchObj) acPenWidthUnk)
        ;; Non-Standard pen widths
        (alert (strcat "The ISO pen width of the hatch pattern is now: " (rtos (vla-get-PatternScale hatchObj) 2)))
        ;; Standard pen widths
        (alert (strcat "The ISO pen width of the hatch pattern is now: " (itoa (vla-get-ISOPenWidth hatchObj))))
    )
)


IsOwnerXlated Property (ActiveX)

Determines whether the owning object in a CopyObjects operation has been translated.

Supported platforms: Windows only

Signature

VBA:

object.IsOwnerXlated
object

Type: IDPair

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: The owning object has been translated.
  • False: The owning object has not been translated.

Remarks

When copying objects from one database to another, the owner of the object being copied may already exist in the new drawing. If this happens, the owning object is not copied, and this property is set to False.

Examples

VBA:

Sub Example_IsOwnerXlated()
    ' This example creates a Circle object and uses the CopyObjects
    ' method to copy the Circle. It then displays some information
    ' about the source objects used in the CopyObjects operation.

    Dim circleObj As AcadCircle, circleObjCopy As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius1 As Double, radius1Copy As Double
    Dim objCollection(0 To 0) As Object
    Dim retObjects As Variant
    Dim IDPairs As Variant
    Dim IsClonedState As String, IsPrimary As String, IsXLated As String

    ' Define the Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    radius1 = 5#: radius1Copy = 1#

    ' Add two circles to the drawing
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius1)
    ThisDrawing.Application.ZoomAll

    ' Copy objects
    '
    ' First put the objects to be copied into a form compatible with CopyObjects
    Set objCollection(0) = circleObj

    ' Copy object and get back a collection of the new objects (copies)
    retObjects = ThisDrawing.CopyObjects(objCollection, , IDPairs)

    ' Get newly created object and apply new properties to the copies
    Set circleObjCopy = retObjects(0)

    circleObjCopy.radius = radius1Copy

    ThisDrawing.Application.ZoomAll
    ThisDrawing.Regen acAllViewports

    ' Display whether the first source object has a clone
    IsClonedState = IIf(IDPairs(0).IsCloned, "is cloned.", "is not cloned.")
    IsPrimary = IIf(IDPairs(0).IsPrimary, "is a primary member of the objects being copied.", "is owned by a primary member of the objects being copied.")
    IsXLated = IIf(IDPairs(0).IsOwnerXlated, "has been translated.", "has not been translated.")

    MsgBox "The new Circle source object: " & IsClonedState & vbCrLf & _
           "The new Circle source object: " & IsPrimary & vbCrLf & _
           "The source of the new Circle object: " & IsXLated & vbCrLf, vbInformation

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_IsOwnerXlated()
    ;; This example creates a Circle object and uses the CopyObjects
    ;; method to make a copy of the Circle. It then displays some information
    ;; about the source objects used in the CopyObjects operation.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Circle object
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius1 5
          radius1Copy 1)

    ;; Add two circles to the drawing
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace centerPoint radius1))
    (vla-ZoomAll acadObj)

    ;; Copy objects
    ;;
    ;; First put the objects to be copied into a form compatible with CopyObjects
    (setq objCollection (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element objCollection 0 circleObj)

    ;; Copy object and get back a collection of the new objects (copies)
    (setq retObjects (vla-CopyObjects doc objCollection nil 'IDPairs))

    ;; Get newly created object and apply new properties to the copies
    (setq circleObjCopy (vlax-safearray-get-element (vlax-variant-value retObjects) 0))

    (vla-put-radius circleObjCopy radius1Copy)

    (vla-ZoomAll acadObj)
    (vla-Regen doc acAllViewports)

    ;; Display whether the first source object has a clone
    (setq IsClonedState (if (= (vla-get-IsCloned (vlax-safearray-get-element IDPairs 0)) :vlax-true) "is cloned."
                                                                                "is not cloned."))
    (setq IsPrimary (if (= (vla-get-IsPrimary (vlax-safearray-get-element IDPairs 0)) :vlax-true) "is a primary member of the objects being copied."
                                                                                "is owned by a primary member of the objects being copied."))
    (setq IsXLated (if (= (vla-get-IsOwnerXlated (vlax-safearray-get-element IDPairs 0)) :vlax-true) "has been translated."
                                                                                "has not been translated."))

    (alert (strcat "The new Circle source object: " IsClonedState
                   "\nThe new Circle source object: " IsPrimary
                   "\nThe source of the new Circle object: " IsXLated))
)


IsPartial Property (ActiveX)

Specifies whether the dimension is for a partial arc.

Supported platforms: Windows only

Signature

VBA:

object.IsPartial
object

Type: DimArcLength

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The dimension is for a partial arc.
  • False: The dimension is not for a partial arc.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


IsPeriodic Property (ActiveX)

Determines whether the given spline is periodic.

Supported platforms: Windows only

Signature

VBA:

object.IsPeriodic
object

Type: Spline

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: The spline is periodic.
  • False: The spline is not periodic.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_IsPeriodic()
    ' This example creates a Spline object in model space and
    ' determines if the Spline is periodic

    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double, endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double
    Dim UserMessage As String

    ' Define the Spline object
    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 0: fitPoints(1) = 0: fitPoints(2) = 0: fitPoints(3) = 5
    fitPoints(4) = 5: fitPoints(5) = 0: fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0

    ' Create new Spline object
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ThisDrawing.Application.ZoomAll

    ' Display whether or not new Spline is periodic
    UserMessage = IIf(splineObj.IsPeriodic, "is periodic", "is not periodic")

    MsgBox "The new Spline " & UserMessage

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_IsPeriodic()
    ;; This example creates a Spline object in model space and
    ;; determines if the Spline is periodic
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Spline object
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(0 0 0
                     5 5 0
                     10 0 0
                    )
    )

    ;; Create new Spline object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)

    ;; Display whether or not new Spline is periodic
    (setq UserMessage (if (= (vla-get-IsPeriodic splineObj) :vlax-true) "is periodic" "is not periodic"))

    (alert (strcat "The new Spline " UserMessage))
)


IsPlanar Property (ActiveX)

Determines whether the given spline is planar.

Supported platforms: Windows only

Signature

VBA:

object.IsPlanar
object

Type: Spline

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: The spline is planar.
  • False: The spline is not planar.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_IsPlanar()
    ' This example creates a Spline object in model space and
    ' determines whether the Spline is planar

    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double, endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double
    Dim UserMessage As String

    ' Define the Spline object
    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 0: fitPoints(1) = 0: fitPoints(2) = 0: fitPoints(3) = 5
    fitPoints(4) = 5: fitPoints(5) = 0: fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0

    ' Create new Spline object
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ThisDrawing.Application.ZoomAll

    ' Display whether or not new Spline is planar
    UserMessage = IIf(splineObj.IsPlanar, "is planar", "is not planar")

    MsgBox "The new Spline " & UserMessage

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_IsPlanar()
    ;; This example creates a Spline object in model space and
    ;; determines whether the Spline is planar
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Spline object
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(0 0 0
                     5 5 0
                     10 0 0
                    )
    )

    ;; Create new Spline object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)

    ;; Display whether or not new Spline is planar
    (setq UserMessage (if (= (vla-get-IsPlanar splineObj) :vlax-true) "is planar" "is not planar"))

    (alert (strcat "The new Spline " UserMessage))
)


IsPrimary Property (ActiveX)

Determines whether the source object in a CopyObjects operation was part of the primary set of objects being copied, or if it was simply owned by a member in the primary set.

Supported platforms: Windows only

Signature

VBA:

object.IsPrimary
object

Type: IDPair

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: The source object is part of the primary set of objects being cloned.
  • False: The source object is owned by a member in the primary set of objects being cloned.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_IsPrimary()
    ' This example creates a Circle object and uses the CopyObjects
    ' method to make a copy of the Circle. It then displays some information
    ' about the source objects used in the CopyObjects operation.

    Dim circleObj As AcadCircle, circleObjCopy As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius1 As Double, radius1Copy As Double
    Dim objCollection(0 To 0) As Object
    Dim retObjects As Variant
    Dim IDPairs As Variant
    Dim IsClonedState As String, IsPrimary As String, IsXLated As String

    ' Define the Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    radius1 = 5#: radius1Copy = 1#

    ' Add two circles to the drawing
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius1)
    ThisDrawing.Application.ZoomAll

    ' Copy objects
    '
    ' First put the objects to be copied into a form compatible with CopyObjects
    Set objCollection(0) = circleObj

    ' Copy object and get back a collection of the new objects (copies)
    retObjects = ThisDrawing.CopyObjects(objCollection, , IDPairs)

    ' Get newly created object and apply new properties to the copies
    Set circleObjCopy = retObjects(0)

    circleObjCopy.radius = radius1Copy

    ThisDrawing.Application.ZoomAll
    ThisDrawing.Regen acAllViewports

    ' Display whether the first source object has a clone
    IsClonedState = IIf(IDPairs(0).IsCloned, "is cloned.", "is not cloned.")
    IsPrimary = IIf(IDPairs(0).IsPrimary, "is a primary member of the objects being copied.", "is owned by a primary member of the objects being copied.")
    IsXLated = IIf(IDPairs(0).IsOwnerXlated, "has been translated.", "has not been translated.")

    MsgBox "The new Circle source object: " & IsClonedState & vbCrLf & _
           "The new Circle source object: " & IsPrimary & vbCrLf & _
           "The source of the new Circle object: " & IsXLated & vbCrLf, vbInformation

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_IsPrimary()
    ;; This example creates a Circle object and uses the CopyObjects
    ;; method to make a copy of the Circle. It then displays some information
    ;; about the source objects used in the CopyObjects operation.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Circle object
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius1 5
          radius1Copy 1)

    ;; Add two circles to the drawing
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace centerPoint radius1))
    (vla-ZoomAll acadObj)

    ;; Copy objects
    ;;
    ;; First put the objects to be copied into a form compatible with CopyObjects
    (setq objCollection (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element objCollection 0 circleObj)

    ;; Copy object and get back a collection of the new objects (copies)
    (setq retObjects (vla-CopyObjects doc objCollection nil 'IDPairs))

    ;; Get newly created object and apply new properties to the copies
    (setq circleObjCopy (vlax-safearray-get-element (vlax-variant-value retObjects) 0))

    (vla-put-radius circleObjCopy radius1Copy)

    (vla-ZoomAll acadObj)
    (vla-Regen doc acAllViewports)

    ;; Display whether the first source object has a clone
    (setq IsClonedState (if (= (vla-get-IsCloned (vlax-safearray-get-element IDPairs 0)) :vlax-true) "is cloned."
                                                                                "is not cloned."))
    (setq IsPrimary (if (= (vla-get-IsPrimary (vlax-safearray-get-element IDPairs 0)) :vlax-true) "is a primary member of the objects being copied."
                                                                                "is owned by a primary member of the objects being copied."))
    (setq IsXLated (if (= (vla-get-IsOwnerXlated (vlax-safearray-get-element IDPairs 0)) :vlax-true) "has been translated."
                                                                                "has not been translated."))

    (alert (strcat "The new Circle source object: " IsClonedState
                   "\nThe new Circle source object: " IsPrimary
                   "\nThe source of the new Circle object: " IsXLated))
)


IsQuiescent Property (ActiveX)

Checks whether AutoCAD is idle and ready to accept automation calls from out-of-process applications.

Supported platforms: Windows only

Signature

VBA:

object.IsQuiescent
object

Type: State

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: AutoCAD is idle.
  • False: AutoCAD is busy.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_IsQuiescent()
    ' This example gets the acadState object and checks to see whether
    ' AutoCAD is in a quiescent state.
    Dim State As AcadState
    Set State = GetAcadState

    If State.IsQuiescent Then
        MsgBox "AutoCAD is quiescent."
    Else
        MsgBox "AutoCAD is not quiescent."
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_IsQuiescent()
    ;; This example gets the acadState object and checks to see if
    ;; AutoCAD is in a quiescent state.
    (setq acadObj (vlax-get-acad-object))

    (setq State (vla-GetAcadState acadObj))
    (if (= (vla-get-IsQuiescent State) :vlax-true)
        (alert "AutoCAD is quiescent.")
        (alert "AutoCAD is not quiescent.")
    )
)


IsRational Property (ActiveX)

Determines whether the given spline is rational.

Supported platforms: Windows only

Signature

VBA:

object.IsRational
object

Type: Spline

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: The spline is rational.
  • False: The spline is not rational.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_IsRational()
    ' This example creates a spline object in model space.
    ' It then determines whether the spline is rational or non-rational
    ' based on the IsRational property.

    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ZoomAll

    ' Display a message according to the IsRational value for the spline.
    If splineObj.IsRational Then
        MsgBox "The newly created Spline is a rational Spline", , "IsRational Example"
    Else
        MsgBox "The newly created Spline is a non-rational Spline", , "IsRational Example"
    End If

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_IsRational()
    ;; This example creates a Spline object in model space and
    ;; determines whether the Spline is planar
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Spline object
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(0 0 0
                     5 5 0
                     10 0 0
                    )
    )

    ;; Create new Spline object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)

    ;; Display a message according to the IsRational value for the spline.
    (if (= (vla-get-IsRational splineObj) :vlax-true)
        (alert "The newly created Spline is a rational Spline")
        (alert "The newly created Spline is a non-rational Spline")
    )
)


Issuer Property (ActiveX)

Specifies the issuer name of the digital certificate.

Supported platforms: Windows only

Signature

VBA:

object.Issuer
object

Type: SecurityParams

The object this property applies to.

Property Value

Read-only: No

Type: String

The issuer name of the digital certificate.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Issuer()
    ' This example attaches a digital signature and accompanying data to a file,
    ' and saves the file.

    Dim sp As AcadSecurityParams
    Set sp = GetInterfaceObject("AutoCAD.SecurityParams.20")

    ' Attach a digital signature and timestamp it
    sp.Action = AcadSecurityParamsType.ACADSECURITYPARAMS_SIGN_DATA _
                + AcadSecurityParamsType.ACADSECURITYPARAMS_ADD_TIMESTAMP

    ' Certificate details follow
    sp.Subject = "Thawte Freemail Member"
    sp.Issuer = "Personal Freemail RSA 2000.8.30"
    sp.SerialNumber = "073848"
    sp.Comment = "This is now signed"
    sp.TimeServer = "NIST(time.nist.gov)"

    ThisDrawing.SaveAs "C:\MyDrawing.dwg", , sp
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Issuer()
    ;; This example attaches a digital signature and accompanying data to a file,
    ;; and saves the file.

    (setq acadObj (vlax-get-acad-object))
    (setq sp (vlax-create-object "AutoCAD.SecurityParams.20"))

    (vla-put-Visible acadObj :vlax-true)

    ;; Attach a digital signature and timestamp it
    (vla-put-Action sp (+ ACADSECURITYPARAMS_SIGN_DATA
                  ACADSECURITYPARAMS_ADD_TIMESTAMP))

    ;; Certificate details follow
    (vla-put-Subject sp "Thawte Freemail Member")
    (vla-put-Issuer sp "Personal Freemail RSA 2000.8.30")
    (vla-put-SerialNumber sp "073848")
    (vla-put-Comment sp "This is now signed")
    (vla-put-TimeServer sp "NIST(time.nist.gov)")

    (setq doc (vla-get-ActiveDocument acadObj))
    (vla-SaveAs doc "C:\\MyDrawing.dwg" acNative sp)

    (vlax-release-object sp)
)


IsXRef Property (ActiveX)

Determines whether the given block is an XRef block.

Supported platforms: Windows only

Signature

VBA:

object.IsXRef
object

Type: Block

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: The block is an XRef.
  • False: The block is not an XRef.

Remarks

The IsXRef property works with the IsLayout property. If both properties are False, then the block is a simple block. If the IsXRef property is True, then the block is an external reference. If the IsLayout property is True, then the block contains all the geometry associated with a layout.

Examples

VBA:

Sub Example_IsXRef()
    ' This example cycles through each Block object in a drawing
    ' and determines the style of each Block by accessing the
    ' IsLayout and IsXRef properties.  A Block
    ' object is also added at runtime so the results are mixed and do not only
    ' come from the default Blocks.

    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double, InsertPoint(0 To 2) As Double
    Dim radius As Double
    Dim newBlock As AcadBlock, insertedBlock As AcadBlockReference
    Dim tempBlock As AcadBlock
    Dim msg As String

    ' Define the Circle object that will be inserted into the block
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    InsertPoint(0) = 1: InsertPoint(1) = 1: InsertPoint(2) = 0
    radius = 0.5

    ' Create a new block to hold the Circle object
    Set newBlock = ThisDrawing.Blocks.Add(centerPoint, "CBlock")

    ' Add the Circle object to the new block object
    Set circleObj = ThisDrawing.Blocks("CBlock").AddCircle(centerPoint, radius)

    ' Add the new block to model space
    Set insertedBlock = ThisDrawing.ModelSpace.InsertBlock(InsertPoint, "CBlock", 1, 1, 1, 0)

    ThisDrawing.Application.ZoomAll

    msg = vbCrLf & vbCrLf

    For Each tempBlock In ThisDrawing.Blocks
        If Not (tempBlock.IsLayout) And Not (tempBlock.IsXRef) Then
            ' Block is simple
            msg = msg & tempBlock.name & ": Simple"
        ElseIf tempBlock.IsXRef Then
            ' Block is an external reference
            msg = msg & tempBlock.name & ": External Reference"
            If tempBlock.IsLayout Then
                ' Block also contains layout geometry
                msg = msg & tempBlock.name & " and Contains Layout Geometry"
            End If
        ElseIf tempBlock.IsLayout Then
            ' Block contains layout geometry
            msg = msg & tempBlock.name & ": Contains Layout Geometry"
        End If

        msg = msg & vbCrLf      ' Move to next line
    Next

    ' Display Block information for this drawing
    MsgBox "Blocks in this drawing have the following styles: " & msg

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_IsXref()
    ;; This example cycles through each Block object in a drawing
    ;; and determines whether style of each Block by accessing the
    ;; IsLayout and IsXRef properties.  A Block
    ;; object is also added at runtime so the results are mixed and do not only
    ;; come from the default Blocks.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Circle object that will be inserted into the block
    (setq centerPoint (vlax-3d-point 0 0 0)
          insertPoint (vlax-3d-point 1 1 0)
          radius 0.5)

    ;; Create a new block to hold the Circle object
    (setq newBlock (vla-Add (vla-get-Blocks doc) centerPoint "CBlock"))

    ;; Add the Circle object to the new block object
    (setq circleObj (vla-AddCircle (vla-Item (vla-get-Blocks doc) "CBlock") centerPoint radius))

    ;; Add the new block to model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq insertedBlock (vla-InsertBlock modelSpace InsertPoint "CBlock" 1 1 1 0))

    (vla-ZoomAll acadObj)

    (setq msg "")

    (vlax-for tempBlock (vla-get-Blocks doc)
        (cond
            ((and (= (vla-get-IsLayout tempBlock) :vlax-false)
                  (= (vla-get-IsXRef tempBlock) :vlax-false))
                ;; Block is simple
                (setq msg (strcat msg (vla-get-Name tempBlock) ": Simple"))
            )
            ((= (vla-get-IsXRef tempBlock) :vlax-true)
                ;; Block is simple
                (setq msg (strcat msg (vla-get-Name tempBlock) ": External Reference"))
                (if (= (vla-get-IsLayout tempBlock) :vlax-true)
                    ;; Block also contains layout geometry
                    (setq msg (strcat msg (vla-get-Name tempBlock) " and Contains Layout Geometry"))
                )
            )
            ((= (vla-get-IsLayout tempBlock) :vlax-true)
                ;; Block is simple
                (setq msg (strcat msg (vla-get-Name tempBlock) ": Contains Layout Geometry"))
            )
        )
        (setq msg (strcat msg "\n"))
    )

    ;; Display Block information for this drawing
    (alert (strcat "Blocks in this drawing have the following styles: " msg))
)


ItemName Property (ActiveX)

Specifies the item of the underlay file.

Supported platforms: Windows only

Signature

VBA:

object.ItemName
object

Type: DgnUnderlay, DwfUnderlay, PdfUnderlay

The object to which this property applies.

Property Value

Read-only: No

Type: String

The item of the underlay file.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


JogAngle Property (ActiveX)

Specifies the jog angle.

Supported platforms: Windows only

Signature

VBA:

object.JogAngle
object

Type: DimRadialLarge

The object this property applies to.

Property Value

Read-only: No

Type: ACAD_ANGLE

Jog angle of the radial dimension.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


JogLocation Property (ActiveX)

Specifies the jog location.

Supported platforms: Windows only

Signature

VBA:

object.JogLocation
object

Type: DimRadialLarge

The object this property applies to.

Property Value

Read-only: No

Type: Variant

Location of the jog for the radial dimension.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Justification Property (ActiveX)

Specifies the justification of the MLine.

Supported platforms: Windows only

Signature

VBA:

object.Justification
object

Type: MLine

The object this property applies to.

Property Value

Read-only: No

Type: AcMLineJustification enum

  • acBottom
  • acTop
  • acZero

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Key Property (ActiveX)

The object ID of the source object in the CopyObjects operation.

Supported platforms: Windows only

Signature

VBA:

object.Key
object

Type: IDPair

The object this property applies to.

Property Value

Read-only: Yes

Type: Long_PTR

The object ID of the source object.

Remarks

Use the Value property to get the object ID of the newly created cloned object.

Examples

VBA:

Sub Example_Key()
    ' This example creates two Circle objects and uses the CopyObjects
    ' method to copy them. It then returns the
    ' object IDs of the source objects using the Key property and uses these
    ' values to remove the original (source) objects

    Dim circleObj1 As AcadCircle, circleObj2 As AcadCircle
    Dim circleObj1Copy As AcadCircle, circleObj2Copy As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius1 As Double, radius2 As Double
    Dim radius1Copy As Double, radius2Copy As Double
    Dim objCollection(0 To 1) As Object
    Dim retObjects As Variant
    Dim IDPairs As Variant
    Dim SourceObject As AcadObject

    ' Define the Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    radius1 = 5#: radius2 = 7#
    radius1Copy = 1#: radius2Copy = 2#

    ' Add two circles to the drawing
    Set circleObj1 = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius1)
    Set circleObj2 = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius2)
    ThisDrawing.Application.ZoomAll

    ' Copy objects
    '
    ' First put the objects to be copied into a form compatible with CopyObjects
    Set objCollection(0) = circleObj1
    Set objCollection(1) = circleObj2

    ' Copy object and get back a collection of the new objects (copies)
    retObjects = ThisDrawing.CopyObjects(objCollection, , IDPairs)

    ' Get newly created object and apply new properties to the copies
    Set circleObj1Copy = retObjects(0)
    Set circleObj2Copy = retObjects(1)

    circleObj1Copy.radius = radius1Copy
    circleObj2Copy.radius = radius2Copy

    ThisDrawing.Application.ZoomAll
    ThisDrawing.Regen acAllViewports

    ' Display the object IDs of the source objects used for the copy
    MsgBox "The first source object ID is: " & IDPairs(0).key & vbCrLf & _
           "The second source object ID is: " & IDPairs(1).key

    ' This key can be used with objectIDtoObject to reference the source objects,
    ' which is handy if the user manually selected the source objects.
    '
    ' Delete the source objects from the ID obtained
    Set SourceObject = ThisDrawing.ObjectIdToObject(IDPairs(0).key)
    SourceObject.Delete
    Set SourceObject = ThisDrawing.ObjectIdToObject(IDPairs(1).key)
    SourceObject.Delete

    ThisDrawing.Regen acAllViewports

    MsgBox "The source objects have just been deleted!", vbInformation
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Key()
    ;; This example creates two Circle objects and uses the CopyObjects
    ;; method to copy them. It then returns the
    ;; object IDs of the source objects using the Key property and uses these
    ;; values to remove the original (source) objects
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Circle object
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius1 5
          radius2 7
          radius1Copy 1
          radius2Copy 2)

    ;; Add two circles to the drawing
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj1 (vla-AddCircle modelSpace centerPoint radius1))
    (setq circleObj2 (vla-AddCircle modelSpace centerPoint radius2))
    (vla-ZoomAll acadObj)

    ;; Copy objects
    ;;
    ;; First put the objects to be copied into a form compatible with CopyObjects
    (setq objCollection (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element objCollection 0 circleObj1)
    (vlax-safearray-put-element objCollection 1 circleObj2)

    ;; Copy object and get back a collection of the new objects (copies)
    (setq retObjects (vlax-variant-value (vla-CopyObjects doc objCollection nil 'IDPairs)))

    ;; Get newly created object and apply new properties to the copies
    (setq circleObj1Copy (vlax-safearray-get-element retObjects 0))
    (setq circleObj2Copy (vlax-safearray-get-element retObjects 1))

    (vla-put-Radius circleObj1Copy radius1Copy)
    (vla-put-Radius circleObj2Copy radius2Copy)

    (vla-ZoomAll acadObj)
    (vla-Regen doc acAllViewports)

    ;; Display the object IDs of the source objects used for the copy
    (alert (strcat "The first source object ID is: " (itoa (vla-get-Key (vlax-safearray-get-element IDPairs 0)))
                   "\nThe second source object ID is: " (itoa (vla-get-Key (vlax-safearray-get-element IDPairs 1)))))

    ;; This key can be used with objectIDtoObject to reference the source objects,
    ;; which is handy if the user manually selected the source objects.
    ;;
    ;; Delete the source objects from the ID obtained
    (setq SourceObject (vla-ObjectIdToObject doc (vla-get-Key (vlax-safearray-get-element IDPairs 0))))
    (vla-Delete SourceObject)
    (setq SourceObject (vla-ObjectIdToObject doc (vla-get-Key (vlax-safearray-get-element IDPairs 1))))
    (vla-Delete SourceObject)

    (vla-Regen doc acAllViewports)

    (alert "The source objects have just been deleted!")
)


KeyboardAccelerator Property (ActiveX)

Specifies the Windows standard or AutoCAD classic keyboard.

Supported platforms: Windows only

Signature

VBA:

object.KeyboardAccelerator
object

Type: PreferencesUser

The object this property applies to.

Property Value

Read-only: No

Type: acKeyboardAccelerator enum

  • acPreferenceClassic: Uses the AutoCAD classic keyboard.
  • acPreferenceCustom: Uses the Windows standard keyboard.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_KeyboardAccelerator()
    ' This example returns the current setting of
    ' KeyboardAccelerator. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currKeyboardAccelerator As Integer

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current KeyboardAccelerator value
    currKeyboardAccelerator = preferences.User.KeyboardAccelerator
    MsgBox "The current value for KeyboardAccelerator is " & currKeyboardAccelerator, vbInformation, "KeyboardAccelerator Example"

    ' Change the value for KeyboardAccelerator
    If currKeyboardAccelerator = acPreferenceClassic Then
        preferences.User.KeyboardAccelerator = acPreferenceCustom
    Else
        preferences.User.KeyboardAccelerator = acPreferenceClassic
    End If
    MsgBox "The new value for KeyboardAccelerator is " & preferences.User.KeyboardAccelerator, vbInformation, "KeyboardAccelerator Example"

    ' Reset KeyboardAccelerator to its original value
    preferences.User.KeyboardAccelerator = currKeyboardAccelerator
    MsgBox "The KeyboardAccelerator value is reset to " & preferences.User.KeyboardAccelerator, vbInformation, "KeyboardAccelerator Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_KeyboardAccelerator()
    ;; This example returns the current setting of
    ;; KeyboardAccelerator. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current KeyboardAccelerator value
    (setq currKeyboardAccelerator (vla-get-KeyboardAccelerator (vla-get-User preferences)))
    (alert (strcat "The current value for KeyboardAccelerator is " (if (= currKeyboardAccelerator acPreferenceClassic) "Classic" "Custom")))

    ;; Change the value for KeyboardAccelerator
    (if (= currKeyboardAccelerator acPreferenceClassic)
        (vla-put-KeyboardAccelerator (vla-get-User preferences) acPreferenceCustom)
        (vla-put-KeyboardAccelerator (vla-get-User preferences) acPreferenceClassic)
    )

    (alert (strcat "The new value for KeyboardAccelerator is " (if (= (vla-get-KeyboardAccelerator (vla-get-User preferences)) acPreferenceClassic) "Classic" "Custom")))

    ;; Reset KeyboardAccelerator to its original value
    (vla-put-KeyboardAccelerator (vla-get-User preferences) currKeyboardAccelerator)
    (alert (strcat "The KeyboardAccelerator value is reset to " (if (= (vla-get-KeyboardAccelerator (vla-get-User preferences)) acPreferenceClassic) "Classic" "Custom")))
)


KeyboardPriority Property (ActiveX)

Controls how AutoCAD responds to the input of coordinate data.

Supported platforms: Windows only

Signature

VBA:

object.KeyboardPriority
object

Type: PreferencesUser

The object this property applies to.

Property Value

Read-only: No

Type: acKeyboardPriority enum

  • acKeyboardRunningObjSnap: Object snaps are strictly adhered to when typing in coordinates.
  • acKeyboardEntry: Keyboard entry values are strictly adhered to when typing in coordinates.
  • acKeyboardEntryExceptScripts: Keyboard entry values are strictly adhered to when typing in coordinates. However, when coordinates are entered through a script, running object snaps are adhered to.

Remarks

The initial value for this property is acKeyboardEntryExceptScripts.

NoteThe value of this property is stored in the OSNAPCOORD system variable.

Examples

VBA:

Sub Example_KeyboardPriority()
    ' This example returns the current setting of
    ' KeyboardPriority. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currKeyboardPriority As Integer
    Dim constant As String
    Dim newConstant As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current KeyboardPriority value
    currKeyboardPriority = preferences.User.KeyboardPriority
    constant = Choose(currKeyboardPriority + 1, "acKeyboardRunningObjSnap", "acKeyboardEntry", "acKeyboardEntryExceptScripts")
    MsgBox "The current value for KeyboardPriority is " & constant, vbInformation, "KeyboardPriority Example"

    ' Change the value for KeyboardPriority
    newConstant = "acKeyboardEntry"
    preferences.User.KeyboardPriority = acKeyboardEntry
    MsgBox "The new value for KeyboardPriority is " & newConstant, vbInformation, "KeyboardPriority Example"

    ' Reset KeyboardPriority to its original value
    preferences.User.KeyboardPriority = currKeyboardPriority
    MsgBox "The KeyboardPriority value is reset to " & constant, vbInformation, "KeyboardPriority Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_KeyboardPriority()
    ;; This example returns the current setting of
    ;; KeyboardPriority. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current KeyboardPriority value
    (setq currKeyboardPriority (vla-get-KeyboardPriority (vla-get-User preferences)))
    (setq constant (cond
                     ((= currKeyboardPriority 0) "acKeyboardRunningObjSnap")
                     ((= currKeyboardPriority 1) "acKeyboardEntry")
                     ((= currKeyboardPriority 2) "acKeyboardEntryExceptScripts")))
    (alert (strcat "The current value for KeyboardPriority is " constant))

    ;; Change the value for KeyboardPriority
    (setq newConstant "acKeyboardEntry")
    (vla-put-KeyboardPriority (vla-get-User preferences) acKeyboardEntry)
    (alert (strcat "The new value for KeyboardPriority is " newConstant))

    ;; Reset KeyboardPriority to its original value
    (vla-put-KeyboardPriority (vla-get-User preferences) currKeyboardPriority)
    (alert (strcat "The KeyboardPriority value is reset to " constant))
)


KeyLength Property (ActiveX)

Specifies the length of the encryption key.

Supported platforms: Windows only

Signature

VBA:

object.KeyLength
object

Type: SecurityParams

The object this property applies to.

Property Value

Read-only: No

Type: Long

The length of the encryption key, which is based on the value of ProviderName.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_KeyLength()
    ' This example encrypts and saves a file.
    Dim sp As AcadSecurityParams
    Set sp = GetInterfaceObject("AutoCAD.SecurityParams.20")

    sp.Action = AcadSecurityParamsType.ACADSECURITYPARAMS_ENCRYPT_DATA
    sp.Algorithm = AcadSecurityParamsConstants.ACADSECURITYPARAMS_ALGID_RC4
    sp.KeyLength = 40
    sp.Password = UCase("mypassword") 'AutoCAD converts all passwords to uppercase before applying them
    sp.ProviderName = "Microsoft Base Cryptographic Provider v1.0"
    sp.ProviderType = 1

    ThisDrawing.SaveAs "C:\MyDrawing.dwg", , sp
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_KeyLength()
    ;; This example encrypts and saves a drawing file.

    (setq acadObj (vlax-get-acad-object))
    (setq sp (vlax-create-object "AutoCAD.SecurityParams.20"))

    (vla-put-Visible acadObj :vlax-true)

    (vla-put-Action sp ACADSECURITYPARAMS_ENCRYPT_DATA)
    (vla-put-Algorithm sp ACADSECURITYPARAMS_ALGID_RC4)
    (vla-put-KeyLength sp 40)
    (vla-put-Password sp (strcase "mypassword"))
    (vla-put-ProviderName sp "Microsoft Base Cryptographic Provider v1.0")
    (vla-put-ProviderType sp 1)

    (setq doc (vla-get-ActiveDocument acadObj))
    (vla-SaveAs doc "C:\\MyDrawing.dwg" acNative sp)

    (vlax-release-object sp)
)


Keywords Property (ActiveX)

Specifies the keywords you want to use to locate the drawing.

Supported platforms: Windows only

Signature

VBA:

object.Keywords
object

Type: SummaryInfo

The object this property applies to.

Property Value

Read-only: No

Type: String

The Keywords property of a drawing.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Keywords()
    ' This example shows how to access drawing properties

    ' Add and display standard properties
    ThisDrawing.SummaryInfo.Author = "John Doe"
    ThisDrawing.SummaryInfo.Comments = "Includes all ten levels of Building Five"
    ThisDrawing.SummaryInfo.HyperlinkBase = "http://www.autodesk.com"
    ThisDrawing.SummaryInfo.Keywords = "Building Complex"
    ThisDrawing.SummaryInfo.LastSavedBy = "JD"
    ThisDrawing.SummaryInfo.RevisionNumber = "4"
    ThisDrawing.SummaryInfo.Subject = "Plan for Building Five"
    ThisDrawing.SummaryInfo.Title = "Building Five"

    Author = ThisDrawing.SummaryInfo.Author
    Comments = ThisDrawing.SummaryInfo.Comments
    HLB = ThisDrawing.SummaryInfo.HyperlinkBase
    KW = ThisDrawing.SummaryInfo.Keywords
    LSB = ThisDrawing.SummaryInfo.LastSavedBy
    RN = ThisDrawing.SummaryInfo.RevisionNumber
    Subject = ThisDrawing.SummaryInfo.Subject
    Title = ThisDrawing.SummaryInfo.Title
    MsgBox "The standard drawing properties are " & vbCrLf & _
            "Author = " & Author & vbCrLf & _
            "Comments = " & Comments & vbCrLf & _
            "HyperlinkBase = " & HLB & vbCrLf & _
            "Keywords = " & KW & vbCrLf & _
            "LastSavedBy = " & LSB & vbCrLf & _
            "RevisionNumber = " & RN & vbCrLf & _
            "Subject = " & Subject & vbCrLf & _
            "Title = " & Title & vbCrLf

    ' Add and display custom properties
    Dim Key0 As String
    Dim Value0 As String
    Dim Key1 As String
    Dim Value1 As String
    Dim CustomPropertyBranch As String
    Dim PropertyBranchValue As String
    Dim CustomPropertyZone As String
    Dim PropertyZoneValue As String

    CustomPropertyBranch = "Branch"
    PropertyBranchValue = "Main"
    CustomPropertyZone = "Zone"
    PropertyZoneValue = "Industrial"

    ' Add custom properties
    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 1) Then
        ThisDrawing.SummaryInfo.SetCustomByIndex 0, CustomPropertyBranch, PropertyBranchValue
    Else
        ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyBranch, PropertyBranchValue
    End If

    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 2) Then
         ThisDrawing.SummaryInfo.SetCustomByKey CustomPropertyBranch, "Satellite"
    Else
         ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyZone, PropertyZoneValue
    End If

    'Get custom properties
    ThisDrawing.SummaryInfo.GetCustomByIndex 0, Key0, Value0
    Key1 = CustomPropertyZone
    ThisDrawing.SummaryInfo.GetCustomByKey Key1, Value1

    MsgBox "The custom drawing properties are " & vbCrLf & _
            "First property name = " & Key0 & vbCrLf & _
            "First property value = " & Value0 & vbCrLf & _
            "Second property name = " & Key1 & vbCrLf & _
            "Second property value = " & Value1 & vbCrLf
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Keywords()
    ;; This example shows how to access drawing properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq summaryInfo (vla-get-SummaryInfo doc))

    ;; Add and display standard properties
    (vla-put-Author summaryInfo "John Doe")
    (vla-put-Comments summaryInfo "Includes all ten levels of Building Five")
    (vla-put-HyperlinkBase summaryInfo "http://www.autodesk.com")
    (vla-put-Keywords summaryInfo "Building Complex")
    (vla-put-LastSavedBy summaryInfo "JD")
    (vla-put-RevisionNumber summaryInfo "4")
    (vla-put-Subject summaryInfo "Plan for Building Five")
    (vla-put-Title summaryInfo "Building Five")

    (setq author (vla-get-Author summaryInfo))
    (setq comments (vla-get-Comments summaryInfo))
    (setq HLB (vla-get-HyperlinkBase summaryInfo))
    (setq KW (vla-get-Keywords summaryInfo))
    (setq LSB (vla-get-LastSavedBy summaryInfo))
    (setq RN (vla-get-RevisionNumber summaryInfo))
    (setq subject (vla-get-Subject summaryInfo))
    (setq Title (vla-get-Title summaryInfo))
    (alert (strcat "The standard drawing properties are "
                   "\nAuthor = " author
                   "\nComments = " comments
                   "\nHyperlinkBase = " HLB
                   "\nKeywords = " KW
                   "\nLastSavedBy = " LSB
                   "\nRevisionNumber = " RN
                   "\nSubject = " Subject
                   "\nTitle = " Title
           )
    )

    ;; Add and display custom properties
    (setq CustomPropertyBranch "Branch")
    (setq PropertyBranchValue "Main")
    (setq CustomPropertyZone "Zone")
    (setq PropertyZoneValue "Industrial")

    ;; Add custom properties
    (if (>= (vla-NumCustomInfo summaryInfo) 1)
        (vla-SetCustomByIndex summaryInfo 0 CustomPropertyBranch PropertyBranchValue)
        (vla-AddCustomInfo summaryInfo CustomPropertyBranch PropertyBranchValue)
    )

    (if (>= (vla-NumCustomInfo summaryInfo) 2)
        (vla-SetCustomByKey summaryInfo CustomPropertyBranch "Satellite")
        (vla-AddCustomInfo summaryInfo CustomPropertyZone PropertyZoneValue)
    )

    ;; Get custom properties
    (vla-GetCustomByIndex summaryInfo 0 'Key0 'Value0)
    (setq Key1 CustomPropertyZone)
    (vla-GetCustomByKey summaryInfo Key1 'Value1)

    (alert (strcat "The custom drawing properties are "
                   "\nFirst property name = " Key0
                   "\nFirst property value = " Value0
                   "\nSecond property name = " Key1
                   "\nSecond property value = " Value1
           )
    )
)


KnotParameterization Property (ActiveX)

Specifies the knot parameterization for a spline created by fit points.

Supported platforms: Windows only

Signature

VBA:

object.KnotParameterization
object

Type: Spline

The object this property applies to.

Property Value

Read-only: No

Type: AcSplineKnotParameterizationType enum

  • acChord
  • acCustomParameterization
  • acSqrtChord
  • acUniformParam

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Knots Property (ActiveX)

Gets the knot vector for a spline.

Supported platforms: Windows only

Signature

VBA:

object.Knots
object

Type: Spline

The object this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

The knots vector of the spline.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Knots()
    ' This example creates a Spline object in model space and
    ' returns the knot vector for the new Spline

    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double, endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double
    Dim knotVector As Variant

    ' Define the Spline object
    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 0: fitPoints(1) = 0: fitPoints(2) = 0: fitPoints(3) = 5
    fitPoints(4) = 5: fitPoints(5) = 0: fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0

    ' Create new Spline object
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ThisDrawing.Application.ZoomAll

    ' Display the knot vector of the new Spline
    knotVector = splineObj.Knots
    MsgBox "The knot vector of the new Spline is: " & vbCrLf & _
           knotVector(0) & vbCrLf & _
           knotVector(1) & vbCrLf & _
           knotVector(2)
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Knots()
    ;; This example creates a Spline object in model space and
    ;; returns the knot vector for the new Spline
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Spline object
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(0 0 0
                     5 5 0
                     10 0 0
                    )
    )

    ;; Create new Spline object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)

    ;; Display the knot vector of the new Spline
    (setq knotVector (vlax-safearray->list (vlax-variant-value (vla-get-Knots splineObj))))
    (alert (strcat "The knot vector of the new Spline is: "
                   "\n" (rtos (nth 0 knotVector) 2)
                   "\n" (rtos (nth 1 knotVector) 2)
                   "\n" (rtos (nth 2 knotVector) 2)))
)


Label Property (ActiveX)

Specifies the content and formatting of menu items as they appear to the user.

Supported platforms: Windows only

Signature

VBA:

object.Label
object

Type: PopupMenuItem

The object this property applies to.

Property Value

Read-only: No

Type: String

The label for the popup menu item.

Remarks

Unlike the Caption property, this property can contain DIESEL string expressions that conditionally alter the labels each time they are displayed.

Examples

VBA:

Sub Example_Label()
    ' This example iterates through the first menu in the menu bar
    ' and displays the label for each menu item.

    Dim menuItem As AcadPopupMenuItem
    Dim menuLabel As String
    menuLabel = ""

    For Each menuItem In ThisDrawing.Application.MenuBar.Item(0)
        menuLabel = menuLabel & menuItem.Label & vbCrLf
    Next menuItem
    MsgBox menuLabel

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Label()
    ;; This example iterates through the first menu in the menu bar
    ;; and displays the label for each menu item.
    (setq acadObj (vlax-get-acad-object))

    (setq menuLabel "")

    (vlax-for menuItem (vla-Item (vla-get-MenuBar acadObj) 0)
        (setq menuLabel (strcat menuLabel (vla-get-Label menuItem) "\n"))
    )

    (alert menuLabel)
)


LabelBlockId Property (ActiveX)

Returns and sets the label block ID associated with the viewport.

Supported platforms: Windows only

Signature

VBA:

object.LabelBlockId
object

Type: PViewport

The object this property applies to.

Property Value

Read-only: No

Type: Long_PTR

The label block ID associated with the viewport.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


LandingGap Property (ActiveX)

Specifies the text landing gap.

Supported platforms: Windows only

Signature

VBA:

object.LandingGap
object

Type: GeoPositionMarker, MLeader, MLeaderStyle

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The text landing gap.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_LeaderLine()
    Dim oML As AcadMLeader
    Dim points(0 To 5) As Double
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 4: points(4) = 4: points(5) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    Dim r As Long
    r = oML.AddLeader()

    points(4) = 10
    Call oML.AddLeaderLine(r, points)

    MsgBox "LeaderCount = " & oML.LeaderCount
    ZoomExtents
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LeaderLine()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(1 1 0
                                  4 4 0
                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (setq r (vla-AddLeader oML))

    (vlax-safearray-put-element points 4 10)
    (vla-AddLeaderLine oML r points)

    (alert (strcat "LeaderCount = " (itoa (vla-get-LeaderCount oML))))
    (vla-ZoomExtents acadObj)
)


LargeButtons Property (ActiveX)

Specifies whether the toolbar button is large or small.

Supported platforms: Windows only

Signature

VBA:

object.LargeButtons
object

Type: Toolbar, Toolbars

The objects this property applies to.

Property Value

Read-only: Yes; except for the Toolbars collection which is read-write

Type: Boolean

  • True: The toolbar is large.
  • False: The toolbar is small.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_LargeButtons()
    ' This example uses MenuGroups to obtain a reference to the AutoCAD main menu.
    ' It then creates a new Toolbar (TestMenu) and inserts a ToolBarButton
    ' into it.  It then sets the LargeButtons property to change the visible style
    ' of all the system Toolbars

    Dim CurrSize As Boolean, ButtonSize As String
    Dim Toolbars As AcadToolbars

    ' Make the system Toolbar buttons bigger
    Set Toolbars = ThisDrawing.Application.MenuGroups("ACAD").Toolbars

    ' Get current size
    CurrSize = Toolbars.LargeButtons

    ' Display current Toolbar size
    GoSub DISPLAY

    ' Toggle Toolbar size
    Toolbars.LargeButtons = Not (Toolbars.LargeButtons)

    ' Display current Toolbar size
    GoSub DISPLAY

    ' Reset to original value
    Toolbars.LargeButtons = CurrSize

    ' Display current Toolbar size
    GoSub DISPLAY

    Exit Sub

DISPLAY:
    ' Display button style
    ButtonSize = IIf(Toolbars.LargeButtons, "Large", "Normal size")
    MsgBox "We are displaying " & ButtonSize & " buttons.", vbInformation

    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LargeButtons()
    ;; This example uses MenuGroups to obtain a reference to the AutoCAD main menu.
    ;; It then creates a new Toolbar (TestMenu) and inserts a ToolBarButton
    ;; into it.  It then sets the LargeButtons property to change the visible style
    ;; of all the system Toolbars
    (setq acadObj (vlax-get-acad-object))

    ;; Make the system Toolbar buttons bigger
    (setq Toolbars (vla-get-Toolbars (vla-Item (vla-get-MenuGroups acadObj) "ACAD")))

    ;; Get current size
    (setq CurrSize (vla-get-LargeButtons Toolbars))

    ;; Display current Toolbar size
    (setq ButtonSize (if (= CurrSize :vlax-true) "Large" "Normal size"))
    (alert (strcat "We are displaying " ButtonSize " buttons."))

    ;; Toggle Toolbar size
    (vla-put-LargeButtons Toolbars (if (= (vla-get-LargeButtons Toolbars) :vlax-true) :vlax-false :vlax-true))

    ;; Display current Toolbar size
    (setq ButtonSize (if (= (vla-get-LargeButtons Toolbars) :vlax-true) "Large" "Normal size"))
    (alert (strcat "We are displaying " ButtonSize " buttons."))

    ;; Reset to original value
    (vla-put-LargeButtons Toolbars CurrSize)

    ;; Display current Toolbar size
    (setq ButtonSize (if (= CurrSize :vlax-true) "Large" "Normal size"))
    (alert (strcat "We are displaying " ButtonSize " buttons."))
)


LastHeight Property (ActiveX)

Specifies the last text height used.

Supported platforms: Windows only

Signature

VBA:

object.LastHeight
object

Type: TextStyle

The object this property applies to.

Property Value

Read-only: No

Type: Double

The last text height used for the text style.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_LastHeight()
    ' This example finds the current value for LastHeight.
    ' It then changes that value, and resets it again.

    Dim txtStyleObj As AcadTextStyle
    Set txtStyleObj = ThisDrawing.ActiveTextStyle

    ' Set and retrieve the LastHeight property
    Dim currHeight As Double
    Dim newHeight As Double

    ' Retrieve current LastHeight property
    currHeight = txtStyleObj.lastHeight
    MsgBox "The current value for LastHeight is " & txtStyleObj.lastHeight, , "LastHeight Example"

    ' Set LastHeight to a new value
    txtStyleObj.lastHeight = 4#

    ' Retrieve the current LastHeight value
    newHeight = txtStyleObj.lastHeight
    MsgBox "The new value for LastHeight is " & txtStyleObj.lastHeight, , "LastHeight Example"

    ' Finally reset LastHeight to its default value
    txtStyleObj.lastHeight = currHeight
    MsgBox "The value for LastHeight has been reset to " & txtStyleObj.lastHeight, , "LastHeight Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LastHeight()
    ;; This example finds the current value for LastHeight.
    ;; It then changes that value, and resets it again.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq txtStyleObj (vla-get-ActiveTextStyle doc))

    ;; Set and retrieve the LastHeight property
    ;; Retrieve current LastHeight property
    (setq currHeight (vla-get-LastHeight txtStyleObj))
    (alert (strcat "The current value for LastHeight is " (rtos currHeight 2)))

    ;; Set LastHeight to a new value
    (vla-put-LastHeight txtStyleObj 4)

    ;; Retrieve the current LastHeight value
    (setq newHeight (vla-get-LastHeight txtStyleObj))
    (alert (strcat "The new value for LastHeight is " (rtos newHeight 2)))

    ;; Finally reset LastHeight to its default value
    (vla-put-LastHeight txtStyleObj currHeight)
    (alert (strcat "The value for LastHeight has been reset to " (rtos currHeight 2)))
)


LastSavedBy Property (ActiveX)

Specifies the name of the last person who modified the file.

Supported platforms: Windows only

Signature

VBA:

object.LastSavedBy
object

Type: SummaryInfo

The object this property applies to.

Property Value

Read-only: No

Type: String

The name of the last person who modified the file.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_LastSavedBy()
    ' This example shows how to access drawing properties

    ' Add and display standard properties
    ThisDrawing.SummaryInfo.Author = "John Doe"
    ThisDrawing.SummaryInfo.Comments = "Includes all ten levels of Building Five"
    ThisDrawing.SummaryInfo.HyperlinkBase = "http://www.autodesk.com"
    ThisDrawing.SummaryInfo.Keywords = "Building Complex"
    ThisDrawing.SummaryInfo.LastSavedBy = "JD"
    ThisDrawing.SummaryInfo.RevisionNumber = "4"
    ThisDrawing.SummaryInfo.Subject = "Plan for Building Five"
    ThisDrawing.SummaryInfo.Title = "Building Five"

    Author = ThisDrawing.SummaryInfo.Author
    Comments = ThisDrawing.SummaryInfo.Comments
    HLB = ThisDrawing.SummaryInfo.HyperlinkBase
    KW = ThisDrawing.SummaryInfo.Keywords
    LSB = ThisDrawing.SummaryInfo.LastSavedBy
    RN = ThisDrawing.SummaryInfo.RevisionNumber
    Subject = ThisDrawing.SummaryInfo.Subject
    Title = ThisDrawing.SummaryInfo.Title
    MsgBox "The standard drawing properties are " & vbCrLf & _
           "Author = " & Author & vbCrLf & _
           "Comments = " & Comments & vbCrLf & _
           "HyperlinkBase = " & HLB & vbCrLf & _
           "Keywords = " & KW & vbCrLf & _
           "LastSavedBy = " & LSB & vbCrLf & _
           "RevisionNumber = " & RN & vbCrLf & _
           "Subject = " & Subject & vbCrLf & _
           "Title = " & Title & vbCrLf

    ' Add and display custom properties
    Dim Key0 As String
    Dim Value0 As String
    Dim Key1 As String
    Dim Value1 As String
    Dim CustomPropertyBranch As String
    Dim PropertyBranchValue As String
    Dim CustomPropertyZone As String
    Dim PropertyZoneValue As String

    CustomPropertyBranch = "Branch"
    PropertyBranchValue = "Main"
    CustomPropertyZone = "Zone"
    PropertyZoneValue = "Industrial"

    ' Add custom properties
    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 1) Then
        ThisDrawing.SummaryInfo.SetCustomByIndex 0, CustomPropertyBranch, PropertyBranchValue
    Else
        ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyBranch, PropertyBranchValue
    End If

    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 2) Then
         ThisDrawing.SummaryInfo.SetCustomByKey CustomPropertyBranch, "Satellite"
    Else
         ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyZone, PropertyZoneValue
    End If

    'Get custom properties
    ThisDrawing.SummaryInfo.GetCustomByIndex 0, Key0, Value0
    Key1 = CustomPropertyZone
    ThisDrawing.SummaryInfo.GetCustomByKey Key1, Value1

    MsgBox "The custom drawing properties are " & vbCrLf & _
           "First property name = " & Key0 & vbCrLf & _
           "First property value = " & Value0 & vbCrLf & _
           "Second property name = " & Key1 & vbCrLf & _
           "Second property value = " & Value1 & vbCrLf
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LastSavedBy()
    ;; This example shows how to access drawing properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq summaryInfo (vla-get-SummaryInfo doc))

    ;; Add and display standard properties
    (vla-put-Author summaryInfo "John Doe")
    (vla-put-Comments summaryInfo "Includes all ten levels of Building Five")
    (vla-put-HyperlinkBase summaryInfo "http://www.autodesk.com")
    (vla-put-Keywords summaryInfo "Building Complex")
    (vla-put-LastSavedBy summaryInfo "JD")
    (vla-put-RevisionNumber summaryInfo "4")
    (vla-put-Subject summaryInfo "Plan for Building Five")
    (vla-put-Title summaryInfo "Building Five")

    (setq author (vla-get-Author summaryInfo))
    (setq comments (vla-get-Comments summaryInfo))
    (setq HLB (vla-get-HyperlinkBase summaryInfo))
    (setq KW (vla-get-Keywords summaryInfo))
    (setq LSB (vla-get-LastSavedBy summaryInfo))
    (setq RN (vla-get-RevisionNumber summaryInfo))
    (setq subject (vla-get-Subject summaryInfo))
    (setq Title (vla-get-Title summaryInfo))
    (alert (strcat "The standard drawing properties are "
                   "\nAuthor = " author
                   "\nComments = " comments
                   "\nHyperlinkBase = " HLB
                   "\nKeywords = " KW
                   "\nLastSavedBy = " LSB
                   "\nRevisionNumber = " RN
                   "\nSubject = " Subject
                   "\nTitle = " Title
           )
    )

    ;; Add and display custom properties
    (setq CustomPropertyBranch "Branch")
    (setq PropertyBranchValue "Main")
    (setq CustomPropertyZone "Zone")
    (setq PropertyZoneValue "Industrial")

    ;; Add custom properties
    (if (>= (vla-NumCustomInfo summaryInfo) 1)
        (vla-SetCustomByIndex summaryInfo 0 CustomPropertyBranch PropertyBranchValue)
        (vla-AddCustomInfo summaryInfo CustomPropertyBranch PropertyBranchValue)
    )

    (if (>= (vla-NumCustomInfo summaryInfo) 2)
        (vla-SetCustomByKey summaryInfo CustomPropertyBranch "Satellite")
        (vla-AddCustomInfo summaryInfo CustomPropertyZone PropertyZoneValue)
    )

    ;; Get custom properties
    (vla-GetCustomByIndex summaryInfo 0 'Key0 'Value0)
    (setq Key1 CustomPropertyZone)
    (vla-GetCustomByKey summaryInfo Key1 'Value1)

    (alert (strcat "The custom drawing properties are "
                   "\nFirst property name = " Key0
                   "\nFirst property value = " Value0
                   "\nSecond property name = " Key1
                   "\nSecond property value = " Value1
           )
    )
)


Latitude

Specifies the latitude of the position marker.

Supported platforms: Windows only

Signature

VBA:

object.Latitude
object

Type: GeoPositionMarker

The object this property applies to.

Property Value

Read-only: No

Type: String

The current latitude of the position marker.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Layer Property (ActiveX)

Specifies the layer for an object.

Supported platforms: Windows only

Signature

VBA:

object.Layer
object

Type: All drawing objects, AttributeReference, Group, SubDMeshEdge, SubDMeshFace, SubDMeshVertex, SubEntity, SubEntSolidEdge, SubEntSolidFace, SubEntSolidNode, SubEntSolidVertex

The objects this property applies to.

Property Value

Read-only: No; except for the Group object which is write-only

Type: String

The name of the layer.

Remarks

All objects have an associated layer. The document always contains at least one layer (layer 0). As with linetypes, you can specify a layer for an object. If you do not specify a layer, the current active layer is used for a new object. If a layer is specified for an object, the current active layer is ignored. Use the ActiveLayer property to set or query the current active layer.

Each layer has associated properties that can be set and queried through the Layer object.

Examples

VBA:

Sub Example_Layer()
    ' This example creates a new layer named "ABC" (colored blue).
    ' It then creates a circle and assigns it to layer "ABC"

    ' Create new layer
    Dim layerObj As AcadLayer
    Set layerObj = ThisDrawing.Layers.Add("ABC")
    Dim color As AcadAcCmColor
    Set color = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Call color.SetRGB(80, 100, 244)
    layerObj.TrueColor = color

    ' Create Circle
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 3: center(1) = 3: center(2) = 0
    radius = 1.5
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, radius)
    ZoomAll
    MsgBox "The circle has been created on layer " & circleObj.Layer, , "Layer Example"

    ' Set the layer of new circle to "ABC"
    circleObj.Layer = "ABC"

    ' Refresh view
    ThisDrawing.Regen (True)
    MsgBox "The circle is now on layer " & circleObj.Layer, , "Layer Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Layer()
    ;; This example creates a new layer named "ABC" (colored blue).
    ;; It then creates a circle and assigns it to layer "ABC"
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create new layer
    (setq layerObj (vla-Add (vla-get-Layers doc) "ABC"))
    (setq color (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB color 80 100 244)
    (vla-put-TrueColor layerObj color)

    ;; Create Circle
    (setq center (vlax-3d-point 3 3 0)
          radius 1.5)
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace center radius))
    (vla-ZoomAll acadObj)
    (alert (strcat "The circle has been created on layer " (vla-get-Layer circleObj)))

    ;; Set the layer of new circle to "ABC"
    (vla-put-Layer circleObj "ABC")

    ;; Refresh view
    (vla-Regen doc :vlax-true)
    (alert (strcat "The circle is now on layer " (vla-get-Layer circleObj)))

    (vlax-release-object color)
)


LayerOn Property (ActiveX)

Specifies the state of a layer.

Supported platforms: Windows only

Signature

VBA:

object.LayerOn
object

Type: Layer

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The layer is on.
  • False: The layer is off.

Remarks

Objects associated with a turned-off layer are not displayed on the screen or plotted. Unlike the Freeze property, layers that are turned off are generated during a regeneration but are not displayed.

AutoCAD surfaces and circles on a turned-off or frozen layer are invisible but they still hide objects when you use the HIDE, SHADEMODE, or RENDER commands.

Examples

VBA:

Sub Example_LayerOn()
    ' This example creates a new layer called "LayerOn".
    ' It then displays the status of the LayerOn property
    ' for the new layer, toggles the status of the
    ' LayerOn property, and again displays its status.
    ' After running this example, you can check the layer
    ' control on the Object Properties tool bar. It will
    ' show the new layer and the latest LayerOn status.

    Dim layerObj As AcadLayer

    ' Create the new layer
    Set layerObj = ThisDrawing.Layers.Add("LayerOn")

    ' Display the LayerOn status of the new layer
    GoSub DISPLAYSTATUS

    ' Toggle the status of the LayerOn property for the layer
    layerObj.LayerOn = Not (layerObj.LayerOn)

    ' Display the LayerOn status of the new layer
    GoSub DISPLAYSTATUS
    Exit Sub

DISPLAYSTATUS:
    If layerObj.LayerOn Then
        MsgBox "Layer " & layerObj.name & " is turned on.", , "LayerOn Example"
    Else
        MsgBox "Layer " & layerObj.name & " is turned off.", , "LayerOn Example"
    End If
    Return

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LayerOn()
    ;; This example creates a new layer called "LayerOn".
    ;; It then displays the status of the LayerOn property
    ;; for the new layer, toggles the status of the
    ;; LayerOn property, and again displays its status.
    ;; After running this example, you can check the layer
    ;; control on the Object Properties tool bar. It will
    ;; show the new layer and the latest LayerOn status.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the new layer
    (setq layerObj (vla-Add (vla-get-Layers doc) "LayerOn"))

    ;; Display the LayerOn status of the new layer
    (if (= (vla-get-LayerOn layerObj) :vlax-true)
        (alert (strcat "Layer " (vla-get-Name layerObj) " is turned on."))
        (alert (strcat "Layer " (vla-get-Name layerObj) " is turned off."))
    )

    ;; Toggle the status of the LayerOn property for the layer
    (vla-put-LayerOn layerObj (if (= (vla-get-LayerOn layerObj) :vlax-true) :vlax-false :vlax-true))

    ;; Display the LayerOn status of the new layer
    (if (= (vla-get-LayerOn layerObj) :vlax-true)
        (alert (strcat "Layer " (vla-get-Name layerObj) " is turned on."))
        (alert (strcat "Layer " (vla-get-Name layerObj) " is turned off."))
    )
)


LayerPropertyOverrides Property (ActiveX)

Specifies whether the viewport has layer property overrides.

Supported platforms: Windows only

Signature

VBA:

object.LayerPropertyOverrides
object

Type: PViewport

The object this method applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: Viewport has layer property overrides.
  • False: Viewport does not have layer property overrides.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Layer()
    ' This example creates a new layer named "ABC" (colored blue).
    ' It then creates a circle and assigns it to layer "ABC"

    ' Create new layer
    Dim layerObj As AcadLayer
    Set layerObj = ThisDrawing.Layers.Add("ABC")
    Dim color As AcadAcCmColor
    Set color = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Call color.SetRGB(80, 100, 244)
    layerObj.TrueColor = color

    ' Create Circle
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 3: center(1) = 3: center(2) = 0
    radius = 1.5
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, radius)
    ZoomAll
    MsgBox "The circle has been created on layer " & circleObj.Layer, , "Layer Example"

    ' Set the layer of new circle to "ABC"
    circleObj.Layer = "ABC"

    ' Refresh view
    ThisDrawing.Regen (True)
    MsgBox "The circle is now on layer " & circleObj.Layer, , "Layer Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Layer()
    ;; This example creates a new layer named "ABC" (colored blue).
    ;; It then creates a circle and assigns it to layer "ABC"
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create new layer
    (setq layerObj (vla-Add (vla-get-Layers doc) "ABC"))
    (setq color (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB color 80 100 244)
    (vla-put-TrueColor layerObj color)

    ;; Create Circle
    (setq center (vlax-3d-point 3 3 0)
          radius 1.5)
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace center radius))
    (vla-ZoomAll acadObj)
    (alert (strcat "The circle has been created on layer " (vla-get-Layer circleObj)))

    ;; Set the layer of new circle to "ABC"
    (vla-put-Layer circleObj "ABC")

    ;; Refresh view
    (vla-Regen doc :vlax-true)
    (alert (strcat "The circle is now on layer " (vla-get-Layer circleObj)))

    (vlax-release-object color)
)


Layers Property (ActiveX)

Gets the Layers collection for the document.

Supported platforms: Windows only

Signature

VBA:

object.Layers
object

Type: Database, Document

The objects this property applies to.

Property Value

Read-only: Yes

Type: Layers

The Layers collection for the document.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Layers()
    ' This example finds the current Layers collection and
    ' adds a new layer to that collection.

    Dim layerColl As AcadLayers
    Set layerColl = ThisDrawing.Layers

    ' Create a dimension style named "TEST" in current drawing
    Dim testlayer As AcadLayer
    Set testlayer = layerColl.Add("TEST")
    MsgBox "A new layer called " & testlayer.name & " has been added to the Layers collection.", vbInformation, "Layers Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Layers()
    ;; This example finds the current Layers collection and
    ;; adds a new layer to that collection.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq layerColl (vla-get-Layers doc))

    ;; Create a dimension style named "TEST" in current drawing
    (setq testlayer (vla-Add layerColl "TEST"))
    (alert (strcat "A new layer called " (vla-get-Name testlayer) " has been added to the Layers collection."))
)


LayerState Property (ActiveX)

Specifies the name of the layer state of the view.

Supported platforms: Windows only

Signature

VBA:

object.LayerState
object

Type: View

The object this property applies to.

Property Value

Read-only: No

Type: String

The name of the layer state.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_LayerState()
    ' This example demonstrates the
    ' CategoryName, LayoutId, LayerState,
    ' and HasVpAssociation properties of the View object

    Dim oLSM As AcadLayerStateManager

    ' Access the LayerStateManager object
    Set oLSM = ThisDrawing.Application. _
       GetInterfaceObject("AutoCAD.AcadLayerStateManager.20")

    ' Associate the current drawing database with LayerStateManager
    oLSM.SetDatabase ThisDrawing.Database

    oLSM.Save "ColorLinetype", acLsColor + acLsLineType

    ' Create a view named "New_View" in current drawing
    Dim viewObj As AcadView

    ' Add the view to the views collection
    Set viewObj = ThisDrawing.Views.Add("New_View")
    MsgBox viewObj.Name & " has been added." & vbCrLf & _
           "Height: " & viewObj.Height & vbCrLf & _
           "Width: " & viewObj.Width, , "Example"

    viewObj.CategoryName = "My View Category"
    viewObj.LayerState = "My Layer State"

    viewObj.LayoutId = ThisDrawing.Layouts(1).ObjectID

    MsgBox viewObj.CategoryName & " is the Category name." & vbCrLf & _
            viewObj.LayoutId & " is the Layout ID." & vbCrLf & _
            viewObj.LayerState & " is the Layer state."

    If viewObj.HasVpAssociation = True Then
        MsgBox "The view is associated with a paper space viewport."
    Else
        MsgBox "The view is not associated with a paper space viewport."

   End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LayerState()
    ;; This example demonstrates the
    ;; CategoryName, LayoutId, LayerState,
    ;; and HasVpAssociation properties of the View object
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Access the LayerStateManager object
    (setq oLSM (vla-GetInterfaceObject acadObj "AutoCAD.AcadLayerStateManager.20"))

    ;; Associate the current drawing database with LayerStateManager
    (vla-SetDatabase oLSM (vla-get-Database doc))

    (vla-Save oLSM "ColorLinetype" (+ acLsColor acLsLineType))

    ;; Create a view named "New_View" in current drawing
    ;; Add the view to the views collection
    (setq viewObj (vla-Add (vla-get-Views doc) "New_View"))
    (alert (strcat (vla-get-Name viewObj) " has been added."
                   "\nHeight: " (rtos (vla-get-Height viewObj) 2)
                   "\nWidth: " (rtos (vla-get-Width viewObj) 2)))

    (vla-put-CategoryName viewObj "My View Category")
    (vla-put-LayerState viewObj "ColorLinetype")

    (vla-put-LayoutId viewObj (vla-get-ObjectID (vla-Item (vla-get-Layouts doc) 1)))

    (alert (strcat (vla-get-CategoryName viewObj) " is the Category name."
                   "\n" (itoa (vla-get-LayoutId viewObj)) " is the Layout ID."
                   "\n" (vla-get-LayerState viewObj) " is the Layer state."))

    (if (= (vla-get-HasVpAssociation viewObj) :vlax-true)
        (alert "The view is associated with a paper space viewport.")
        (alert "The view is not associated with a paper space viewport.")
    )

    (vlax-release-object oLSM)
)


Layout Property (ActiveX)

Specifies the layout associated with the model space, paper space, or block object.

Supported platforms: Windows only

Signature

VBA:

object.Layout
object

Type: Block, ModelSpace, PaperSpace

The objects this property applies to.

Property Value

Read-only: No

Type: Layout

The layout that is associated with the model space, paper space, or block object.

Remarks

The Layout object contains the plot settings for the model space, paper space, or block object.

Named plot settings not associated with a given block are stored as PlotConfiguration objects.

Examples

VBA:

Sub Example_Layout()
    ' This example references the Layout object obtained from model space.
    ' We then display information from the Layout object.

    Dim Layout As ACADLayout

    ' Attach to Layout object
    Set Layout = ThisDrawing.ModelSpace.Layout
    MsgBox "We now have access to the properties and methods of the model space Layout object!"

    ' Retrieve the name of the model space Layout
    MsgBox "The name of the model space Layout is: " & Layout.name

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Layout()
    ;; This example references the Layout object obtained from model space.
    ;; We then display information from the Layout object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Attach to Layout object
    (setq Layout (vla-get-Layout (vla-get-ModelSpace doc)))
    (alert "We now have access to the properties and methods of the model space Layout object!")

    ;; Retrieve the name of the model space Layout
    (alert (strcat "The name of the model space Layout is: " (vla-get-Name Layout.name)))
)


LayoutCreateViewport Property (ActiveX)

Toggles the automatic creation of a viewport for new layouts.

Supported platforms: Windows only

Signature

VBA:

object.LayoutCreateViewport
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: A viewport is created for new layouts.
  • False: A viewport is not created for new layouts.

Remarks

The initial value for this property is True.

Examples

VBA:

Sub Example_LayoutCreateViewport()
    ' This example reads and modifies the preference value that controls
    ' the automatic creation of a viewport for new layouts. When finished, this example
    ' resets the preference value back to its original value.

    Dim ACADPref As AcadPreferencesDisplay
    Dim originalValue As Variant, newValue As Variant

    ' Get the display preferences object
    Set ACADPref = ThisDrawing.Application.preferences.DISPLAY

    ' Read and display the original value
    originalValue = ACADPref.LayoutCreateViewport
    MsgBox "The LayoutCreateViewport preference is set to: " & originalValue

    ' Modify the LayoutCreateViewport preference by toggling the value
    ACADPref.LayoutCreateViewport = Not (originalValue)
    newValue = ACADPref.LayoutCreateViewport
    MsgBox "The LayoutCreateViewport preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.LayoutCreateViewport = originalValue
    MsgBox "The LayoutCreateViewport preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LayoutCreateViewport()
    ;; This example reads and modifies the preference value that controls
    ;; the automatic creation of a viewport for new layouts. When finished, this example
    ;; resets the preference value back to its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-LayoutCreateViewport (vla-get-Display preferences)))
    (alert (strcat "The LayoutCreateViewport preference is set to: " (if (= originalValue :vlax-true) "True"  "False")))

    ;; Modify the LayoutCreateViewport preference by toggling the value
    (vla-put-LayoutCreateViewport (vla-get-Display preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-LayoutCreateViewport (vla-get-Display preferences)))
    (alert (strcat "The LayoutCreateViewport preference has been set to: " (if (= newValue :vlax-true) "True"  "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-LayoutCreateViewport (vla-get-Display preferences) originalValue)
    (alert (strcat "The LayoutCreateViewport preference was reset back to: " (if (= originalValue :vlax-true) "True"  "False")))
)


LayoutCrosshairColor Property (ActiveX)

Specifies the color of the crosshairs and text for paper space layouts.

Supported platforms: Windows only

Signature

VBA:

object.LayoutCrosshairColor
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: OLE_COLOR (constant)

  • vbBlack
  • vbRed
  • vbYellow
  • vbGreen
  • vbCyan
  • vbBlue
  • vbMagenta
  • vbWhite

Remarks

The initial value for this property is the Windows standard text color.

To specify the crosshairs color for the model space layout, use the ModelCrosshairColor property.

Examples

VBA:

Sub Example_LayoutCrosshairColor()
    ' This example reads and modifies the preference value that controls
    ' the color of the crosshairs and text for paper space layouts.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesDisplay
    Dim originalValue As Variant, newValue As Variant

    ' Get the display preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.Display

    ' Switch to paper space to view this change
    ThisDrawing.ActiveSpace = acPaperSpace

    ' Read and display the original value
    originalValue = ACADPref.LayoutCrosshairColor
    MsgBox "The LayoutCrosshairColor preference is: " & originalValue

    ' Modify the LayoutCrosshairColor preference by making it red
    ACADPref.LayoutCrosshairColor = vbRed
    newValue = ACADPref.LayoutCrosshairColor
    ThisDrawing.Regen acAllViewports

    MsgBox "The LayoutCrosshairColor preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.LayoutCrosshairColor = originalValue
    ThisDrawing.Regen acAllViewports

    MsgBox "The LayoutCrosshairColor preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LayoutCrosshairColor()
    ;; This example reads and modifies the preference value that controls
    ;; the color of the crosshairs and text for paper space layouts.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Switch to paper space to view this change
    (vla-put-ActiveSpace doc acPaperSpace)

    ;; Read and display the original value
    (setq originalValue (vlax-variant-change-type (vla-get-LayoutCrosshairColor (vla-get-Display preferences)) vlax-vbLong))
    (alert (strcat "The LayoutCrosshairColor preference is: " (itoa (vlax-variant-value originalValue))))

    ;; Modify the LayoutCrosshairColor preference by making it red
    (vla-put-LayoutCrosshairColor (vla-get-Display preferences) (vlax-make-variant acRed 19))
    (setq newValue (vlax-variant-change-type (vla-get-LayoutCrosshairColor (vla-get-Display preferences)) vlax-vbLong))
    (vla-Regen doc acAllViewports)

    (alert (strcat "The LayoutCrosshairColor preference has been set to: " (itoa (vlax-variant-value newValue))))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-LayoutCrosshairColor (vla-get-Display preferences) (vlax-variant-change-type originalValue 19))
    (vla-Regen doc acAllViewports)

    (alert (strcat "The LayoutCrosshairColor preference was reset back to: " (itoa (vlax-variant-value originalValue))))
)


LayoutDisplayMargins Property (ActiveX)

Toggles the display of margins in layouts.

Supported platforms: Windows only

Signature

VBA:

object.LayoutDisplayMargins
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Margins are displayed in layouts.
  • False: Margins are not displayed in layouts.

Remarks

The initial value for this property is True.

Examples

VBA:

Sub Example_LayoutDisplayMargins()
    ' This example reads and modifies the preference value that controls
    ' the display of margins in layouts. When finished, this example
    ' resets the preference value back to its original value.

    Dim ACADPref As AcadPreferencesDisplay
    Dim originalValue As Variant, newValue As Variant

    ' Get the display preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.Display

    ' Switch to paper space to view this change
    ThisDrawing.ActiveSpace = acPaperSpace

    ' Read and display the original value
    originalValue = ACADPref.LayoutDisplayMargins
    MsgBox "The LayoutDisplayMargins preference is set to: " & originalValue

    ' Modify the LayoutDisplayMargins preference by toggling the value
    ACADPref.LayoutDisplayMargins = Not (originalValue)
    newValue = ACADPref.LayoutDisplayMargins
    ThisDrawing.Regen acAllViewports

    MsgBox "The LayoutDisplayMargins preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.LayoutDisplayMargins = originalValue
    ThisDrawing.Regen acAllViewports

    MsgBox "The LayoutDisplayMargins preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LayoutDisplayMargins()
    ;; This example reads and modifies the preference value that controls
    ;; the display of margins in layouts. When finished, this example
    ;; resets the preference value back to its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Switch to paper space to view this change
    (vla-put-ActiveSpace doc acPaperSpace)

    ;; Read and display the original value
    (setq originalValue (vla-get-LayoutDisplayMargins (vla-get-Display preferences)))
    (alert (strcat "The LayoutDisplayMargins preference is set to: " (if (= originalValue :vlax-true) "True"  "False")))

    ;; Modify the LayoutDisplayMargins preference by toggling the value
    (vla-put-LayoutDisplayMargins (vla-get-Display preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-LayoutDisplayMargins (vla-get-Display preferences)))
    (vla-Regen doc acAllViewports)

    (alert (strcat "The LayoutDisplayMargins preference has been set to: " (if (= newValue :vlax-true) "True"  "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-LayoutDisplayMargins (vla-get-Display preferences) originalValue)
    (vla-Regen doc acAllViewports)

    (alert (strcat "The LayoutDisplayMargins preference was reset back to: " (if (= originalValue :vlax-true) "True"  "False")))
)


LayoutDisplayPaper Property (ActiveX)

Toggles the display of the paper background in layouts.

Supported platforms: Windows only

Signature

VBA:

object.LayoutDisplayPaper
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The paper background is displayed in layouts.
  • False: The paper background is not displayed in layouts.

Remarks

The initial value for this property is True.

Examples

VBA:

Sub Example_LayoutDisplayPaper()
    ' This example reads and modifies the preference value that controls
    ' the display of the paper background in layouts. When finished, this example
    ' resets the preference value back to its original value.

    Dim ACADPref As AcadPreferencesDisplay
    Dim originalValue As Variant, newValue As Variant

    ' Get the display preferences object
    Set ACADPref = ThisDrawing.Application.preferences.DISPLAY

    ' Switch to paper space to view this change
    ThisDrawing.ActiveSpace = acPaperSpace

    ' Read and display the original value
    originalValue = ACADPref.LayoutDisplayPaper
    MsgBox "The LayoutDisplayPaper preference is set to: " & originalValue

    ' Modify the LayoutDisplayPaper preference by toggling the value
    ACADPref.LayoutDisplayPaper = Not (originalValue)
    newValue = ACADPref.LayoutDisplayPaper
    ThisDrawing.Regen acAllViewports

    MsgBox "The LayoutDisplayPaper preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.LayoutDisplayPaper = originalValue
    ThisDrawing.Regen acAllViewports

    MsgBox "The LayoutDisplayPaper preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LayoutDisplayPaper()
    ;; This example reads and modifies the preference value that controls
    ;; the display of the paper background in layouts. When finished, this example
    ;; resets the preference value back to its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Switch to paper space to view this change
    (vla-put-ActiveSpace doc acPaperSpace)

    ;; Read and display the original value
    (setq originalValue (vla-get-LayoutDisplayPaper (vla-get-Display preferences)))
    (alert (strcat "The LayoutDisplayPaper preference is set to: " (if (= originalValue :vlax-true) "True"  "False")))

    ;; Modify the LayoutDisplayPaper preference by toggling the value
    (vla-put-LayoutDisplayPaper (vla-get-Display preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-LayoutDisplayPaper (vla-get-Display preferences)))
    (vla-Regen doc acAllViewports)

    (alert (strcat "The LayoutDisplayPaper preference has been set to: " (if (= newValue :vlax-true) "True"  "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-LayoutDisplayPaper (vla-get-Display preferences) originalValue)
    (vla-Regen doc acAllViewports)

    (alert (strcat "The LayoutDisplayPaper preference was reset back to: " (if (= originalValue :vlax-true) "True"  "False")))
)


LayoutDisplayPaperShadow Property (ActiveX)

Toggles the display of the paper background shadow in layouts.

Supported platforms: Windows only

Signature

VBA:

object.LayoutDisplayPaperShadow
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The shadow is displayed in layouts.
  • False: The shadow is not displayed in layouts.

Remarks

The initial value for this property is True.

Examples

VBA:

Sub Example_LayoutDisplayPaperShadow()
    ' This example reads and modifies the preference value that controls
    ' the display of the paper background shadow in layouts. When finished, this example
    ' resets the preference value back to its original value.

    Dim ACADPref As AcadPreferencesDisplay
    Dim originalValue As Variant, newValue As Variant

    ' Get the display preferences object
    Set ACADPref = ThisDrawing.Application.preferences.DISPLAY

    ' Switch to paper space to view this change
    ThisDrawing.ActiveSpace = acPaperSpace

    ' Read and display the original value
    originalValue = ACADPref.LayoutDisplayPaperShadow
    MsgBox "The LayoutDisplayPaperShadow preference is set to: " & originalValue

    ' Modify the LayoutDisplayPaperShadow preference by toggling the value
    ACADPref.LayoutDisplayPaperShadow = Not (originalValue)
    newValue = ACADPref.LayoutDisplayPaperShadow
    ThisDrawing.Regen acAllViewports

    MsgBox "The LayoutDisplayPaperShadow preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.LayoutDisplayPaperShadow = originalValue
    ThisDrawing.Regen acAllViewports

    MsgBox "The LayoutDisplayPaperShadow preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LayoutDisplayPaperShadow()
    ;; This example reads and modifies the preference value that controls
    ;; the display of the paper background shadow in layouts. When finished, this example
    ;; resets the preference value back to its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Switch to paper space to view this change
    (vla-put-ActiveSpace doc acPaperSpace)

    ;; Read and display the original value
    (setq originalValue (vla-get-LayoutDisplayPaperShadow (vla-get-Display preferences)))
    (alert (strcat "The LayoutDisplayPaperShadow preference is set to: " (if (= originalValue :vlax-true) "True"  "False")))

    ;; Modify the LayoutDisplayPaperShadow preference by toggling the value
    (vla-put-LayoutDisplayPaperShadow (vla-get-Display preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-LayoutDisplayPaperShadow (vla-get-Display preferences)))
    (vla-Regen doc acAllViewports)

    (alert (strcat "The LayoutDisplayPaperShadow preference has been set to: " (if (= newValue :vlax-true) "True"  "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-LayoutDisplayPaperShadow (vla-get-Display preferences) originalValue)
    (vla-Regen doc acAllViewports)

    (alert (strcat "The LayoutDisplayPaperShadow preference was reset back to: " (if (= originalValue :vlax-true) "True"  "False")))
)


LayoutID Property (ActiveX)

Specifies the layout of the view.

Supported platforms: Windows only

Signature

VBA:

object.LayoutID
object

Type: View

The object this property applies to.

Property Value

Read-only: Yes

Type: Long_PTR

The ObjectID of the layout.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_LayoutID()
    ' This example demonstrates the
    ' CategoryName, LayoutId, LayerState,
    ' and HasVpAssociation properties of the View object

    Dim oLSM As AcadLayerStateManager

    ' Access the LayerStateManager object
    Set oLSM = ThisDrawing.Application. _
       GetInterfaceObject("AutoCAD.AcadLayerStateManager.20")

    ' Associate the current drawing database with LayerStateManager
    oLSM.SetDatabase ThisDrawing.Database

    oLSM.Save "ColorLinetype", acLsColor + acLsLineType

    ' Create a view named "New_View" in current drawing
    Dim viewObj As AcadView

    ' Add the view to the views collection
    Set viewObj = ThisDrawing.Views.Add("New_View")
    MsgBox viewObj.Name & " has been added." & vbCrLf & _
           "Height: " & viewObj.Height & vbCrLf & _
           "Width: " & viewObj.Width, , "Example"

    viewObj.CategoryName = "My View Category"
    viewObj.LayerState = "My Layer State"

    viewObj.LayoutId = ThisDrawing.Layouts(1).ObjectID

    MsgBox viewObj.CategoryName & " is the Category name." & vbCrLf & _
            viewObj.LayoutId & " is the Layout ID." & vbCrLf & _
            viewObj.LayerState & " is the Layer state."

    If viewObj.HasVpAssociation = True Then
        MsgBox "The view is associated with a paper space viewport."
    Else
        MsgBox "The view is not associated with a paper space viewport."

   End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LayoutID()
    ;; This example demonstrates the
    ;; CategoryName, LayoutId, LayerState,
    ;; and HasVpAssociation properties of the View object
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Access the LayerStateManager object
    (setq oLSM (vla-GetInterfaceObject acadObj "AutoCAD.AcadLayerStateManager.20"))

    ;; Associate the current drawing database with LayerStateManager
    (vla-SetDatabase oLSM (vla-get-Database doc))

    (vla-Save oLSM "ColorLinetype" (+ acLsColor acLsLineType))

    ;; Create a view named "New_View" in current drawing
    ;; Add the view to the views collection
    (setq viewObj (vla-Add (vla-get-Views doc) "New_View"))
    (alert (strcat (vla-get-Name viewObj) " has been added."
                   "\nHeight: " (rtos (vla-get-Height viewObj) 2)
                   "\nWidth: " (rtos (vla-get-Width viewObj) 2)))

    (vla-put-CategoryName viewObj "My View Category")
    (vla-put-LayerState viewObj "ColorLinetype")

    (vla-put-LayoutId viewObj (vla-get-ObjectID (vla-Item (vla-get-Layouts doc) 1)))

    (alert (strcat (vla-get-CategoryName viewObj) " is the Category name."
                   "\n" (itoa (vla-get-LayoutId viewObj)) " is the Layout ID."
                   "\n" (vla-get-LayerState viewObj) " is the Layer state."))

    (if (= (vla-get-HasVpAssociation viewObj) :vlax-true)
        (alert "The view is associated with a paper space viewport.")
        (alert "The view is not associated with a paper space viewport.")
    )

    (vlax-release-object oLSM)
)


Layouts Property (ActiveX)

Gets the Layouts collection for the document.

Supported platforms: Windows only

Signature

VBA:

object.Layouts
object

Type: Database, Document

The object this property applies to.

Property Value

Read-only: Yes

Type: Layouts

The Layouts collection for the document.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Layouts()
    ' This example will access the Layouts collection for the current drawing
    ' and list basic information about the Layouts in the drawing.

    Dim Layouts As AcadLayouts, Layout As ACADLayout
    Dim msg As String

    ' Get layouts collection from document object
    Set Layouts = ThisDrawing.Layouts

    msg = vbCrLf    ' Start with a space

    ' Get the names of every layout in this drawing
    For Each Layout In Layouts
        msg = msg & Layout.name & vbCrLf
    Next

    ' Display a list of available layouts
    MsgBox "There are " & Layouts.count & " layouts in " & _
           ThisDrawing.WindowTitle & ":" & msg
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Layouts()
    ;; This example will access the Layouts collection for the current drawing
    ;; and list basic information about the Layouts in the drawing.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get layouts collection from document object
    (setq Layouts (vla-get-Layouts doc))

    (setq msg "")   ;; Start with a space

    ;; Get the names of every layout in this drawing
    (vlax-for Layout Layouts
        (setq msg (strcat msg (vla-get-Name Layout) "\n"))
    )

    ;; Display a list of available layouts
    (alert (strcat "There are " (itoa (vla-get-Count Layouts)) " layouts in "
                   (vla-get-WindowTitle doc) ":\n" msg))
)


LayoutShowPlotSetup Property (ActiveX)

Toggles the display of the Plot Setup dialog when a new layout is created.

Supported platforms: Windows only

Signature

VBA:

object.LayoutShowPlotSetup
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The dialog is displayed when a new layout is created.
  • False: The dialog is not displayed when a new layout is created.

Remarks

The initial value for this property is True.

Examples

VBA:

Sub Example_LayoutShowPlotSetup()
    ' This example reads and modifies the preference value that controls
    ' the display of the Plot Setup dialog when a new layout is created.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesDisplay
    Dim originalValue As Variant, newValue As Variant

    ' Get the display preferences object
    Set ACADPref = ThisDrawing.Application.preferences.DISPLAY

    ' Read and display the original value
    originalValue = ACADPref.LayoutShowPlotSetup
    MsgBox "The LayoutShowPlotSetup preference is set to: " & originalValue

    ' Modify the LayoutShowPlotSetup preference by toggling the value
    ACADPref.LayoutShowPlotSetup = Not (originalValue)
    newValue = ACADPref.LayoutShowPlotSetup
    MsgBox "The LayoutShowPlotSetup preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.LayoutShowPlotSetup = originalValue
    MsgBox "The LayoutShowPlotSetup preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LayoutShowPlotSetup()
    ;; This example reads and modifies the preference value that controls
    ;; the display of the Plot Setup dialog when a new layout is created.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-LayoutShowPlotSetup (vla-get-Display preferences)))
    (alert (strcat "The LayoutShowPlotSetup preference is set to: " (if (= originalValue :vlax-true) "True"  "False")))

    ;; Modify the LayoutShowPlotSetup preference by toggling the value
    (vla-put-LayoutShowPlotSetup (vla-get-Display preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-LayoutShowPlotSetup (vla-get-Display preferences)))
    (alert (strcat "The LayoutShowPlotSetup preference has been set to: " (if (= newValue :vlax-true) "True"  "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-LayoutShowPlotSetup (vla-get-Display preferences) originalValue)
    (alert (strcat "The LayoutShowPlotSetup preference was reset back to: " (if (= originalValue :vlax-true) "True"  "False")))
)


Leader1Point Property (ActiveX)

Specifies the origin of leader 1.

Supported platforms: Windows only

Signature

VBA:

object.Leader1Point
object

Type: DimArcLength

The object this property applies to.

Property Value

Read-only: No

Type: Variant

The origin of leader 1.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Leader2Point Property (ActiveX)

Specifies the origin of leader 2.

Supported platforms: Windows only

Signature

VBA:

object.Leader2Point
object

Type: DimArcLength

The object this property applies to.

Property Value

Read-only: No

Type: Variant

The origin of leader 2.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


LeaderCount Property (ActiveX)

Gets the number of leaderLine clusters in this Mleader object.

Supported platforms: Windows only

Signature

VBA:

object.LeaderLineColor
object

Type: MLeader

The object this property applies to.

Property Value

Read-only: Yes

Type: Long

A value which stands for the leader line cluster count.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_LeaderLine()
    Dim oML As AcadMLeader
    Dim points(0 To 5) As Double
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 4: points(4) = 4: points(5) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    Dim r As Long
    r = oML.AddLeader()

    points(4) = 10
    Call oML.AddLeaderLine(r, points)

    MsgBox "LeaderCount = " & oML.LeaderCount
    ZoomExtents
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LeaderLine()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(1 1 0
                                  4 4 0
                                             )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (setq r (vla-AddLeader oML))

    (vlax-safearray-put-element points 4 10)
    (vla-AddLeaderLine oML r points)

    (alert (strcat "LeaderCount = " (itoa (vla-get-LeaderCount oML))))
    (vla-ZoomExtents acadObj)
)


LeaderLength Property (ActiveX)

Specifies the length of the leader on the diameter or radius dimension.

Supported platforms: Windows only

Signature

VBA:

object.LeaderLength
object

Type: DimDiametric, DimRadial

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The length of the leader.

Remarks

The LeaderLength is the distance from the ChordPoint dimension definition point out to where the dimension will do a horizontal dogleg to the annotation text (or stop if no dogleg is necessary). (See the AddDimDiametric or AddDimRadial method for more information.)

ImportantThe LeaderLength setting will be used only during the creation of the dimension. After the dimension has been saved, changing the LeaderLength value will not affect how the dimension displays. The LeaderLength property is used to calculate the leader location. The value is not saved, and therefore will always return a zero if read.

Examples

VBA:

Sub Example_LeaderLength()
    ' This example creates a diametric dimension
    ' and returns the LeaderLength for that dimension.

    Dim dimObj As AcadDimDiametric
    Dim chordPoint(0 To 2) As Double
    Dim farChordPoint(0 To 2) As Double
    Dim leaderLength As Double

    ' Define the dimension
    chordPoint(0) = 5#: chordPoint(1) = 3#: chordPoint(2) = 0#
    farChordPoint(0) = 5#: farChordPoint(1) = 5#: farChordPoint(2) = 0#
    leaderLength = 1#

    ' Create the diametric dimension in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimDiametric(chordPoint, farChordPoint, leaderLength)
    ZoomAll
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LeaderLength()
    ;; This example creates a diametric dimension
    ;; and returns the LeaderLength for that dimension.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq chordPoint (vlax-3d-point 5 3 0)
          farChordPoint (vlax-3d-point 5 5 0)
          leaderLength 1)

    ;; Create the diametric dimension in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimDiametric modelSpace chordPoint farChordPoint leaderLength))
    (vla-ZoomAll acadObj)
)


LeaderLineColor Property (ActiveX)

Specifies the color of the leader lines.

Supported platforms: Windows only

Signature

VBA:

object.LeaderLineColor
object

Type: MLeader, MLeaderLeader, MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: AcCmColor

A value which stands for the leader line color display.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_LeaderLine()
    Dim oML As AcadMLeader
    Dim points(0 To 5) As Double
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 4: points(4) = 4: points(5) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    Dim r As Long
    r = oML.AddLeader()

    points(4) = 10
    Call oML.AddLeaderLine(r, points)

    MsgBox "LeaderCount = " & oML.LeaderCount
    ZoomExtents
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LeaderLine()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(1 1 0
                                  4 4 0
                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (setq r (vla-AddLeader oML))

    (vlax-safearray-put-element points 4 10)
    (vla-AddLeaderLine oML r points)

    (alert (strcat "LeaderCount = " (itoa (vla-get-LeaderCount oML))))
    (vla-ZoomExtents acadObj)
)


LeaderLinetype Property (ActiveX)

Specifies the type of the leader lines.

Supported platforms: Windows only

Signature

VBA:

object.LeaderLinetype
object

Type: MLeader, MLeaderLeader, MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: ACAD_LTYPE

A value which stands for the leader line's linetype.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_LeaderLine()
    Dim oML As AcadMLeader
    Dim points(0 To 5) As Double
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 4: points(4) = 4: points(5) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    Dim r As Long
    r = oML.AddLeader()

    points(4) = 10
    Call oML.AddLeaderLine(r, points)

    MsgBox "LeaderCount = " & oML.LeaderCount
    ZoomExtents
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LeaderLine()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(1 1 0
                                  4 4 0
                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (setq r (vla-AddLeader oML))

    (vlax-safearray-put-element points 4 10)
    (vla-AddLeaderLine oML r points)

    (alert (strcat "LeaderCount = " (itoa (vla-get-LeaderCount oML))))
    (vla-ZoomExtents acadObj)
)


LeaderLineTypeId Property (ActiveX)

Specifies the linetype of leader lines of the mleaderstyle.

Supported platforms: Windows only

Signature

VBA:

object.LeaderLineTypeId
object

Type: MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: ACAD_LTYPE

The leader line type ID value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


LeaderLineWeight Property (ActiveX)

Specifies the lineweight of the leader lines.

Supported platforms: Windows only

Signature

VBA:

object.LeaderLineWeight
object

Type: MLeader, MLeaderLeader, MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: ACAD_LWEIGHT

A value which stands for the leader line's lineweight.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


LeaderType Property (ActiveX)

Specifies the type of the leader.

Supported platforms: Windows only

Signature

VBA:

object.LeaderType
object

Type: MLeader, MLeaderLeader

The object this property applies to.

Property Value

Read-only: No

Type: AcMLeaderType enum

  • acInVisibleLeader: No leader
  • acSplineLeader: Spline leader
  • acStraightLeader: Straight leader

Remarks

No additional remarks.

Examples

VBA:

Sub Example_LeaderLine()
    Dim oML As AcadMLeader
    Dim points(0 To 5) As Double
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 4: points(4) = 4: points(5) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    Dim r As Long
    r = oML.AddLeader()

    points(4) = 10
    Call oML.AddLeaderLine(r, points)

    MsgBox "LeaderCount = " & oML.LeaderCount
    ZoomExtents
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LeaderLine()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(1 1 0
                                  4 4 0
                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (setq r (vla-AddLeader oML))

    (vlax-safearray-put-element points 4 10)
    (vla-AddLeaderLine oML r points)

    (alert (strcat "LeaderCount = " (itoa (vla-get-LeaderCount oML))))
    (vla-ZoomExtents acadObj)
)


Left Property (ActiveX)

Specifies the left edge of a toolbar.

Supported platforms: Windows only

Signature

VBA:

object.Left
object

Type: Toolbar

The object this property applies to.

Property Value

Read-only: No

Type: Integer

The left edge of the toolbar.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Left()
    ' This example creates a new toolbar called "TestToolbar" and inserts a
    ' button into it. The toolbar is then displayed and the Left
    ' position is returned.
    ' To remove the toolbar after execution of this macro, use the Customize Menu
    ' option from the Tools menu.

    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    ' Create the new toolbar
    Dim newToolBar As AcadToolbar
    Set newToolBar = currMenuGroup.Toolbars.Add("TestToolbar")

    ' Add a button to the new toolbar.
    Dim newButton1 As AcadToolbarItem
    Dim openMacro As String

    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set newButton1 = newToolBar.AddToolbarButton("", "NewButton1", "Open a file.", openMacro)

    ' Display the toolbar
    newToolBar.Visible = True

    'Find the Left position
    Dim currLeft As Integer
    currLeft = newToolBar.Left
    MsgBox "The current value of Left is " & newToolBar.Left, , "Left Example"

    ' Change the value of Left
    newToolBar.Left = currLeft + 100
    MsgBox "The new value of Left is " & newToolBar.Left, , "Left Example"

    ' Reset the value of Left
    newToolBar.Left = currLeft
    MsgBox "The value of Left has been reset to " & newToolBar.Left, , "Left Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Left()
    ;; This example creates a new toolbar called "TestToolbar" and inserts a
    ;; button into it. The toolbar is then displayed and the Left
    ;; position is returned.
    ;; To remove the toolbar after execution of this macro, use the Customize Menu
    ;; option from the Tools menu.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new toolbar
    (setq newToolBar (vla-Add (vla-get-Toolbars currMenuGroup) "TestToolbar"))

    ;; Add a button to the new toolbar.
    ;; Assign the macro string the VB equivalent of "ESC ESC _open "
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))

    (setq newButton1 (vla-AddToolbarButton newToolBar "" "NewButton1" "Open a file." openMacro))

    ;; Display the toolbar
    (vla-put-Visible newToolBar :vlax-true)

    ;; Find the Left position
    (setq currLeft (vla-get-Left newToolBar))
    (alert (strcat "The current value of Left is " (itoa currLeft)))

    ;; Change the value of Left
    (vla-put-Left newToolBar (+ currLeft 100))
    (alert (strcat "The new value of Left is " (itoa (vla-get-Left newToolBar))))

    ;; Reset the value of Left
    (vla-put-Left newToolBar currLeft)
    (alert (strcat "The value of Left has been reset to " (itoa (vla-get-Left newToolBar))))
)


Length Property (ActiveX)

Gets the length of an object.

Supported platforms: Windows only

Signature

VBA:

object.Length
object

Type: 3DPolyline, Line, LWPolyline, PointCloud, Polyline, SweptSurface

The objects this property applies to.

Property Value

Read-only: Yes

Type: Double

The length of the line.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Length()
   ' This example adds a line in model space and returns the length of the new line

    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double, endPoint(0 To 2)  As Double

    ' Define the start and end points for the line
    startPoint(0) = 1: startPoint(1) = 1: startPoint(2) = 0
    endPoint(0) = 5: endPoint(1) = 5: endPoint(2) = 0

    ' Create the line in model space
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ThisDrawing.Application.ZoomAll

    MsgBox "The length of the new Line is: " & lineObj.length
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Length()
    ;; This example adds a line in model space and returns the length of the new line
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the start and end points for the line
    (setq startPoint (vlax-3d-point 1 1 0)
          endPoint (vlax-3d-point 5 5 0))

    ;; Create the line in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    (vla-ZoomAll acadObj)

    (alert (strcat "The length of the new Line is: " (rtos (vla-get-Length lineObj) 2)))
)


LensLength Property (ActiveX)

Specifies the lens length used in perspective viewing.

Supported platforms: Windows only

Signature

VBA:

object.LensLength
object

Type: PViewport

The object this property applies to.

Property Value

Read-only: No

Type: Double

The length of the lens in millimeters.

Remarks

NoteThe value of this property is stored in the LENSLENGTH system variable.

Examples

VBA:

Sub Example_LensLength()
    ' This example creates a new paper space viewport.
    ' It then displays the lens length of the viewport.

    Dim pviewportObj As AcadPViewport
    Dim center(0 To 2) As Double
    Dim width As Double
    Dim height As Double

    ' Define the paper space viewport
    center(0) = 3: center(1) = 3: center(2) = 0
    width = 40
    height = 40

    ' Change from model space to paper space
    ThisDrawing.ActiveSpace = acPaperSpace

    ' Create the paper space viewport
    Set pviewportObj = ThisDrawing.PaperSpace.AddPViewport(center, width, height)
    pviewportObj.DISPLAY True
    ThisDrawing.mspace = True
    ThisDrawing.ActivePViewport = pviewportObj
    ThisDrawing.Regen acAllViewports

    ' Find the Lens Length for the viewport
    Dim lenslgnth As Double
    lenslgnth = pviewportObj.LensLength
    MsgBox "The lens length of the paperspace viewport is " & pviewportObj.LensLength, , "LensLength Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LensLength()
    ;; This example creates a new paper space viewport.
    ;; It then displays the lens length of the viewport.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the paper space viewport
    (setq center (vlax-3d-point 3 3 0)
          width 40
          height 40)

    ;; Change from model space to paper space
    (vla-put-ActiveSpace doc acPaperSpace)

    ;; Create the paper space viewport
    (setq paperSpace (vla-get-PaperSpace doc))
    (setq pviewportObj (vla-AddPViewport paperSpace center width height))

    (vla-Display pviewportObj :vlax-true)
    (vla-put-MSpace doc :vlax-true)
    (vla-put-ActivePViewport doc pviewportObj)
    (vla-Regen doc acAllViewports)

    ;; Find the Lens Length for the viewport
    (setq lenslgnth (vla-get-LensLength pviewportObj))
    (alert (strcat "The lens length of the paperspace viewport is " (rtos lenslgnth 2)))
)


Limits Property (ActiveX)

Specifies the drawing limits.

Supported platforms: Windows only

Signature

VBA:

object.Limits
object

Type: Database, Document

The objects this property applies to.

Property Value

Read-only: No

Type: Variant (array of doubles)

An array of four values. The first pair of values define the X and Y coordinates of the lower-left limit, the second pair of values define the X and Y coordinates of the upper-right limit.

Remarks

The drawing limits are two-dimensional points in the World Coordinate System (WCS) that represent a lower-left and an upper-right limit. You cannot impose limits on the Z direction.

The drawing limits also govern the portion of the drawing covered by the visible grid and determine the minimum area that the ZoomAll method displays.

NoteThe lower-left limit controls the LIMMIN system variable. The upper-right limit controls the LIMMAX system variable. The LIMCHECK system variable turns limits checking on and off for the current space.

Examples

VBA:

Sub Example_Limits()
    ' This example finds the current limits for the drawing.
    ' It then changes the limits for the drawing. The grid
    ' is turned on to show the limits.

    ' Turn on the grid for the active viewport
    ThisDrawing.ActiveViewport.GridOn = True
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport

    ' Find the current limits
    Dim currLimits As Variant
    currLimits = ThisDrawing.Limits
    MsgBox "The current drawing limits are " & vbCrLf _
           & "Lower-left corner " & ThisDrawing.Limits(0) & ", " & ThisDrawing.Limits(1) & vbCrLf _
           & "Upper-right corner " & ThisDrawing.Limits(2) & ", " & ThisDrawing.Limits(3), , "Limits Example"

    ' Change the limits
    Dim newLimits(0 To 3) As Double
    newLimits(0) = 2#: newLimits(1) = 2#: newLimits(2) = 4#: newLimits(3) = 4#
    ThisDrawing.Limits = newLimits
    ThisDrawing.Regen acActiveViewport
    MsgBox "The new drawing limits are " & vbCrLf _
           & "Lower-left corner " & ThisDrawing.Limits(0) & ", " & ThisDrawing.Limits(1) & vbCrLf _
           & "Upper-right corner " & ThisDrawing.Limits(2) & ", " & ThisDrawing.Limits(3), , "Limits Example"

    ' Reset the drawing limits
    ThisDrawing.Limits = currLimits
    ThisDrawing.Regen acActiveViewport
    MsgBox "The drawing limits have been reset to " & vbCrLf _
           & "Lower-left corner " & ThisDrawing.Limits(0) & ", " & ThisDrawing.Limits(1) & vbCrLf _
           & "Upper-right corner " & ThisDrawing.Limits(2) & ", " & ThisDrawing.Limits(3), , "Limits Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Limits()
    ;; This example finds the current limits for the drawing.
    ;; It then changes the limits for the drawing. The grid
    ;; is turned on to show the limits.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Turn on the grid for the active viewport
    (vla-put-GridOn (vla-get-ActiveViewport doc) :vlax-true)
    (vla-put-ActiveViewport doc (vla-get-ActiveViewport doc))

    ;; Find the current limits
    (setq currLimits (vlax-variant-value (vla-get-Limits doc)))
    (setq tempLimits (vlax-safearray->list currLimits))
    (alert (strcat "The current drawing limits are"
                   "\nLower-left corner " (rtos (nth 0 tempLimits) 2) ", " (rtos (nth 1 tempLimits) 2)
                   "\nUpper-right corner " (rtos (nth 2 tempLimits) 2) ", " (rtos (nth 3 tempLimits) 2)))

    ;; Change the limits
    (setq newLimits (vlax-make-safearray vlax-vbDouble '(0 . 3)))
    (vlax-safearray-fill newLimits '(2 2 4 4))
    (vla-put-Limits doc newLimits)
    (vla-Regen doc acActiveViewport)
    (setq tempLimits (vlax-safearray->list newLimits))
    (alert (strcat "The new drawing limits are"
                   "\nLower-left corner " (rtos (nth 0 tempLimits) 2) ", " (rtos (nth 1 tempLimits) 2)
                   "\nUpper-right corner " (rtos (nth 2 tempLimits) 2) ", " (rtos (nth 3 tempLimits) 2)))

    ;; Reset the drawing limits
    (vla-put-Limits doc currLimits)
    (vla-Regen doc acActiveViewport)
    (setq tempLimits (vlax-safearray->list currLimits))
    (alert (strcat "The drawing limits have been reset to"
                   "\nLower-left corner " (rtos (nth 0 tempLimits) 2) ", " (rtos (nth 1 tempLimits) 2)
                   "\nUpper-right corner " (rtos (nth 2 tempLimits) 2) ", " (rtos (nth 3 tempLimits) 2)))
)


LinearScaleFactor Property (ActiveX)

Specifies a global scale factor for linear dimensioning measurements.

Supported platforms: Windows only

Signature

VBA:

object.LinearScaleFactor
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Double

A real number greater than 0.0.

Remarks

The initial value for this property is 1.0000.

When LinearScaleFactor is assigned a negative value, the factor is only applied in paper space. The paper space factor to be applied is the absolute value of this property.

NoteThis property overrides the value of the DIMLFAC system variable for the given dimension.

Examples

VBA:

Sub Example_LinearScaleFactor()
    ' This example creates an aligned dimension in model space and
    ' turns on the tolerance display for the new dimension.  The LinearScaleFactor
    ' of the tolerance is then read and modified.
    '
    ' * Note the change in the text of the dimension after the modification.

    Dim dimObj As AcadDimAligned
    Dim newText As AcadTextStyle
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim CurrentScale As Integer

    ' Define the dimension
    point1(0) = 1: point1(1) = 10: point1(2) = 0
    point2(0) = 10: point2(1) = 10: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Turn on the tolerance display
    dimObj.ToleranceDisplay = acTolSymmetrical
    ThisDrawing.Application.ZoomAll

    ' Display current scale factor
    MsgBox dimObj.LinearScaleFactor

    ' Change current scale factor
    dimObj.LinearScaleFactor = 10#      ' Multiply by ten
    ThisDrawing.Regen acAllViewports

    ' Display new scale factor
    MsgBox dimObj.LinearScaleFactor
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LinearScaleFactor()
    ;; This example creates an aligned dimension in model space and
    ;; turns on the tolerance display for the new dimension.  The LinearScaleFactor
    ;; of the tolerance is then read and modified.
    ;;
    ;; * Note the change in the text of the dimension after the modification.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 1 10 0)
          point2 (vlax-3d-point 10 10 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Turn on the tolerance display
    (vla-put-ToleranceDisplay dimObj acTolSymmetrical)
    (vla-ZoomAll acadObj)

    ;; Display current scale factor
    (alert (rtos (vla-get-LinearScaleFactor dimObj) 2))

    ;; Change current scale factor
    (vla-put-LinearScaleFactor dimObj 10)      ;; Multiply by ten
    (vla-Regen doc acAllViewports)

    ;; Display new scale factor
    (alert (rtos (vla-get-LinearScaleFactor dimObj) 2))
)


LineSpacingDistance Property (ActiveX)

Specifies the spacing of multiline text.

Supported platforms: Windows only

Signature

VBA:

object.LineSpacingDistance
object

Type: GeoPositionMarker, MText

The object this property applies to.

Property Value

Read-only: No

Type: Double

The spacing of multiline text.

Remarks

MText: The value contained in this property is the Line Space Distance property in the Properties palette.

Examples

VBA:

Sub Example_LineSpacingDistance()
    ' This example creates an MText object, displays the value of the LineSpacingDistance property,
    ' changes the value of the property, and then resets the value to the original value.

    Dim MTextObj As AcadMText
    Dim width As Double
    Dim text As String
    Dim CurrentDistance As Double
    Dim corner(0 To 2) As Double
    corner(0) = 0
    corner(1) = 10
    corner(2) = 0
    width = 10
    text = "This is the text for the MText object"

    ' Creates the MText Object
    Set MTextObj = ThisDrawing.ModelSpace.AddMText(corner, width, text)
    ZoomAll

    ' Find the current LineSpacingDistance
    CurrentDistance = MTextObj.LineSpacingDistance
    MsgBox "The LineSpacingDistance for the MText object is: " & CurrentDistance

    ' Change the LineSpacingDistance
    MTextObj.LineSpacingDistance = 0.7
    MsgBox "The LineSpacingDistance for the MText object is: " & MTextObj.LineSpacingDistance

    ' Reset the LineSpacingDistance
    MTextObj.LineSpacingDistance = CurrentDistance
    MsgBox "The LineSpacingDistance for the MText object is: " & MTextObj.LineSpacingDistance
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LineSpacingDistance()
    ;; This example creates an MText object, displays the value of the LineSpacingDistance property,
    ;; changes the value of the property, and then resets the value to the original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq corner (vlax-3d-point 0 10 0)
          width 10
          text "This is the text for the MText object")

    ;; Creates the MText Object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MTextObj (vla-AddMText modelSpace corner width text))
    (vla-ZoomAll acadObj)

    ;; Find the current LineSpacingDistance
    (setq CurrentDistance (vla-get-LineSpacingDistance MTextObj))
    (alert (strcat "The LineSpacingDistance for the MText object is: " (rtos CurrentDistance 2)))

    ;; Change the LineSpacingDistance
    (vla-put-LineSpacingDistance MTextObj 0.7)
    (alert (strcat "The LineSpacingDistance for the MText object is: " (rtos (vla-get-LineSpacingDistance MTextObj) 2)))

    ;; Reset the LineSpacingDistance
    (vla-put-LineSpacingDistance MTextObj CurrentDistance)
    (alert (strcat "The LineSpacingDistance for the MText object is: " (rtos (vla-get-LineSpacingDistance MTextObj) 2)))
)


LineSpacingFactor Property (ActiveX)

Specifies the relative line spacing factor for the MText object.

Supported platforms: Windows only

Signature

VBA:

object.LineSpacingFactor
object

Type: GeoPositionMarker, MText

The object this property applies to.

Property Value

Read-only: No

Type: Double

The relative line spacing factor for the MText object. Enter a value between 0.25 and 4 inclusive.

Remarks

The spacing factor is the vertical distance between the baseline of one text line and the baseline of the next text line. The spacing factor is set as a multiple of single line spacing.

You can set the line spacing to be either "At Least" the specified distance, or "Exactly" the specified distance by using the LineSpacingStyle property.

Examples

VBA:

Sub Example_LineSpacingFactor()
    ' This example creates an MText object in model space
    ' and then finds the LineSpacingFactor for the object.

    Dim MTextObj As AcadMText
    Dim corner(0 To 2) As Double
    Dim width As Double
    Dim text As String
    corner(0) = 0#: corner(1) = 10#: corner(2) = 0#
    width = 10
    text = "This is the text String for the mtext Object"

    ' Creates the MText Object
    Set MTextObj = ThisDrawing.ModelSpace.AddMText(corner, width, text)
    ZoomAll

    ' Find the current LineSpacingFactor
    Dim currFactor As Double
    currFactor = MTextObj.LineSpacingFactor
    MsgBox "The LineSpacingFactor for the MText object is: " & currFactor

    ' Change the LineSpacingFactor
    MTextObj.LineSpacingFactor = 4
    MsgBox "The LineSpacingFactor for the MText object is: " & MTextObj.LineSpacingFactor

    ' Reset the LineSpacingFactor
    MTextObj.LineSpacingFactor = currFactor
    MsgBox "The LineSpacingFactor for the MText object is: " & MTextObj.LineSpacingFactor

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LineSpacingFactor()
    ;; This example creates an MText object in model space
    ;; and then finds the LineSpacingFactor for the object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq corner (vlax-3d-point 0 10 0)
          width 10
          text "This is the text String for the mtext Object")

    ;; Creates the MText Object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MTextObj (vla-AddMText modelSpace corner width text))
    (vla-ZoomAll acadObj)

    ;; Find the current LineSpacingFactor
    (setq currFactor (vla-get-LineSpacingFactor MTextObj))
    (alert (strcat "The LineSpacingFactor for the MText object is: " (rtos currFactor 2)))

    ;; Change the LineSpacingFactor
    (vla-put-LineSpacingFactor MTextObj 0.7)
    (alert (strcat "The LineSpacingFactor for the MText object is: " (rtos (vla-get-LineSpacingFactor MTextObj) 2)))

    ;; Reset the LineSpacingFactor
    (vla-put-LineSpacingFactor MTextObj currFactor)
    (alert (strcat "The LineSpacingFactor for the MText object is: " (rtos (vla-get-LineSpacingFactor MTextObj) 2)))
)


LineSpacingStyle Property (ActiveX)

Specifies the line spacing style for the MText object.

Supported platforms: Windows only

Signature

VBA:

object.LineSpacingStyle
object

Type: GeoPositionMarker, MText

The object this property applies to.

Property Value

Read-only: No

Type: acLineSpacingStyle enum

  • acLineSpacingStyleAtLeast
  • acLineSpacingStyleExactly

Remarks

The acLineSpacingStyleAtLeast setting allows the spacing between different lines of text to adjust automatically, based on the height of the largest character in a line of text. The acLineSpacingStyleExactly setting forces the line spacing to be the same size for all the lines in the MText object regardless of formatting overrides.

Examples

VBA:

Sub Example_LineSpacingFactor()
    ' This example creates an MText object in model space
    ' and then finds the LineSpacingFactor for the object.

    Dim MTextObj As AcadMText
    Dim corner(0 To 2) As Double
    Dim width As Double
    Dim text As String
    corner(0) = 0#: corner(1) = 10#: corner(2) = 0#
    width = 10
    text = "This is the text String for the mtext Object"

    ' Creates the MText Object
    Set MTextObj = ThisDrawing.ModelSpace.AddMText(corner, width, text)
    ZoomAll

    ' Find the current LineSpacingFactor
    Dim currFactor As Double
    currFactor = MTextObj.LineSpacingFactor
    MsgBox "The LineSpacingFactor for the MText object is: " & currFactor

    ' Change the LineSpacingFactor
    MTextObj.LineSpacingFactor = 4
    MsgBox "The LineSpacingFactor for the MText object is: " & MTextObj.LineSpacingFactor

    ' Reset the LineSpacingFactor
    MTextObj.LineSpacingFactor = currFactor
    MsgBox "The LineSpacingFactor for the MText object is: " & MTextObj.LineSpacingFactor

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LineSpacingFactor()
    ;; This example creates an MText object in model space
    ;; and then finds the LineSpacingFactor for the object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq corner (vlax-3d-point 0 10 0)
          width 10
          text "This is the text String for the mtext Object")

    ;; Creates the MText Object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MTextObj (vla-AddMText modelSpace corner width text))
    (vla-ZoomAll acadObj)

    ;; Find the current LineSpacingFactor
    (setq currFactor (vla-get-LineSpacingFactor MTextObj))
    (alert (strcat "The LineSpacingFactor for the MText object is: " (rtos currFactor 2)))

    ;; Change the LineSpacingFactor
    (vla-put-LineSpacingFactor MTextObj 0.7)
    (alert (strcat "The LineSpacingFactor for the MText object is: " (rtos (vla-get-LineSpacingFactor MTextObj) 2)))

    ;; Reset the LineSpacingFactor
    (vla-put-LineSpacingFactor MTextObj currFactor)
    (alert (strcat "The LineSpacingFactor for the MText object is: " (rtos (vla-get-LineSpacingFactor MTextObj) 2)))
)


Linetype Property (ActiveX)

Specifies the linetype of an object.

Supported platforms: Windows only

Signature

VBA:

object.Linetype
object

Type: All drawing objects, AttributeReference, Group, Layer, SubDMeshEdge, SubDMeshFace, SubDMeshVertex, SubEntity, SubEntSolidEdge, SubEntSolidFace, SubEntSolidNode, SubEntSolidVertex

The objects this property applies to.

Property Value

Read-only: No; except for Group objects which are write-only

Type: String

The linetype of an object. The default linetype is the linetype of the layer (ByLayer).

  • Continuous: The default linetype, which is automatically created in the linetype symbol table.
  • ByLayer: The linetype value of the object's layer.
  • ByBlock: The linetype value of the object's surrounding block definition's current block reference.

Remarks

The linetype values identify the series of dots and dashes used for drawing lines. If you do not specify a linetype, the current active linetype is used for a new entity. If a linetype is specified for an entity, the current active linetype is ignored. Use the ActiveLinetype property to set or query the current active linetype.

NoteIt is not possible to create a linetype programmatically. An existing linetype may be added to a drawing by using the Load method to first load the linetype, and then the Add method to add it to the Linetypes collection.

Examples

VBA:

Sub Example_Linetype()
    ' This example searches for the linetype DashDot. If it is
    ' not found, it is added from the acad.lin file. Then a
    ' line is created and changed to the DashDot linetype.

    ' Search the linetypes collection for the DashDot linetype.
    Dim entry As AcadLineType
    Dim found As Boolean
    found = False
    For Each entry In ThisDrawing.Linetypes
        If StrComp(entry.name, "DASHDOT", 1) = 0 Then
            found = True
            Exit For
        End If
    Next
    If Not (found) Then ThisDrawing.Linetypes.Load "DASHDOT", "acad.lin"

    ' Create the line
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 1#: startPoint(1) = 1#: startPoint(2) = 0#
    endPoint(0) = 4#: endPoint(1) = 4#: endPoint(2) = 0#
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ' Change the linetype of the line
    lineObj.Linetype = "DASHDOT"
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Linetype()
    ;; This example searches for the linetype DashDot. If it is
    ;; not found, it is added from the acad.lin file. Then a
    ;; line is created and changed to the DashDot linetype.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Search the linetypes collection for the DashDot linetype.
    (setq found :vlax-false)
    (vlax-for entry (vla-get-Linetypes doc)
        (if (= (vla-get-Name entry) "DASHDOT")
            (setq found :vlax-true)
        )
    )

    (if (= found :vlax-false)
        (vla-Load (vla-get-Linetypes doc) "DASHDOT" "acad.lin")
    )

    ;; Create the line
    (setq startPoint (vlax-3d-point 1 1 0)
          endPoint (vlax-3d-point 4 4 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    ;; Change the linetype of the line
    (vla-put-Linetype lineObj "DASHDOT")
    (vla-ZoomAll acadObj)
)


LinetypeGeneration Property (ActiveX)

Specifies the linetype generation of a 2D polyline or a lightweight polyline.

Supported platforms: Windows only

Signature

VBA:

object.LinetypeGeneration
object

Type: LWPolyline, Polyline

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Generates the linetype in a continuous pattern through the polyline vertices.
  • False: Generates the linetype starting and ending with a dash at each polyline vertex.

Remarks

This property does not apply to polylines with tapered segments.

A polyline with linetype generation set to true (left) and set to false (right)

Examples

VBA:

Sub Example_LinetypeGeneration()
    ' This example creates a polyline in model space and
    ' queries and changes the linetype generation for
    ' the polyline.

    ' To see the effect of changing the linetype generation, set
    ' the linetype of the polyline to something other than continuous,
    ' ByBlock, or ByLayer.

    Dim plineObj As AcadPolyline
    Dim points(0 To 14) As Double

    ' Define the 2D polyline points
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 1: points(4) = 2: points(5) = 0
    points(6) = 2: points(7) = 2: points(8) = 0
    points(9) = 3: points(10) = 2: points(11) = 0
    points(12) = 4: points(13) = 4: points(14) = 0

    ' Create a lightweight Polyline object in model space
    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
    ZoomAll

    ' Find the current linetype generation for the polyline
    MsgBox "The linetype generation for the polyline is: " & plineObj.LinetypeGeneration

    ' Change the linetype generation
    plineObj.LinetypeGeneration = Not plineObj.LinetypeGeneration
    plineObj.Update
    MsgBox "The linetype generation for the polyline is now: " & plineObj.LinetypeGeneration

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LinetypeGeneration()
    ;; This example creates a polyline in model space and
    ;; queries and changes the linetype generation for
    ;; the polyline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; To see the effect of changing the linetype generation, set
    ;; the linetype of the polyline to something other than continuous,
    ;; ByBlock, or ByLayer.

    ;; Define the 2D polyline points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill points '(1 1 0
                  1 2 0
                  2 2 0
                  3 2 0
                  4 4 0
                 )
    )

    ;; Create a lightweight Polyline object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq plineObj (vla-AddPolyline modelSpace points))
    (vla-ZoomAll acadObj)

    ;; Find the current linetype generation for the polyline
    (alert (strcat "The linetype generation for the polyline is: " (if (= (vla-get-LinetypeGeneration plineObj) :vlax-true) "True" "False")))

    ;; Change the linetype generation
    (vla-put-LinetypeGeneration plineObj (if (= (vla-get-LinetypeGeneration plineObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Update plineObj)
    (alert (strcat "The linetype generation for the polyline is now: " (if (= (vla-get-LinetypeGeneration plineObj) :vlax-true) "True" "False")))
)


Linetypes Property (ActiveX)

Gets the Linetypes collection for the document.

Supported platforms: Windows only

Signature

VBA:

object.Linetypes
object

Type: Database, Document

The object this property applies to.

Property Value

Read-only: Yes

Type: Linetypes

The Linetypes collection for the document.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Linetypes()
    ' This example finds the linetypes collection and
    ' lists all the available linetypes in the collection.

    Dim linetypeColl As AcadLineTypes
    Dim entry As AcadLineType
    Dim msg As String

    ' Return the linetype collection object of the active document
    Set linetypeColl = ThisDrawing.Linetypes

    ' List all available linetypes
    For Each entry In linetypeColl
        msg = msg & entry.name & vbCrLf
    Next
    MsgBox "The linetypes available in this drawing are:" & vbCrLf & msg, vbInformation, "Linetypes Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Linetypes()
    ;; This example finds the linetypes collection and
    ;; lists all the available linetypes in the collection.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Return the linetype collection object of the active document
    (setq linetypeColl (vla-get-Linetypes doc))

    ;; List all available linetypes
    (setq msg "")
    (vlax-for entry linetypeColl
        (setq msg (strcat msg (vla-get-Name entry) "\n"))
    )

    (alert (strcat "The linetypes available in this drawing are:\n" msg))
)


LinetypeScale Property (ActiveX)

Specifies the linetype scale of an object.

Supported platforms: Windows only

Signature

VBA:

object.LinetypeScale
object

Type: All drawing objects, AttributeReference, Group, SubDMeshEdge, SubDMeshFace, SubDMeshVertex, SubEntity, SubEntSolidEdge, SubEntSolidFace, SubEntSolidNode, SubEntSolidVertex

The objects this property applies to.

Property Value

Read-only: No; except for a Group object which is write-only

Type: Double

This value must be a positive real number. The default is 1.0.

Remarks

The linetype scale of an object specifies the relative length of dash-dot linetypes per drawing unit.

  • : Linetype scale = 1.0
  • : Linetype scale = 0.5
  • : Linetype scale = 0.25

Examples

VBA:

Sub Example_LinetypeScale()
    ' This example creates a line and finds the linetype scale
    ' for the line. It then changes the linetype scale, and finally
    ' resets the linetype scale back to the original value.
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    Dim lineObj As AcadLine
    Dim currLTScale As Double

    ' Create a Line object in model space
    startPoint(0) = 2#: startPoint(1) = 2#: startPoint(2) = 0#
    endPoint(0) = 4#: endPoint(1) = 4#: endPoint(2) = 0#
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    lineObj.Update
    currLTScale = lineObj.LinetypeScale
    MsgBox "The linetype scale for the line is: " & lineObj.LinetypeScale, vbInformation, "Linetypes Example"

    ' Set the linetype scale of a Line to .5
    lineObj.LinetypeScale = 0.5
    lineObj.Update
    MsgBox "The new linetype scale for the line is: " & lineObj.LinetypeScale, vbInformation, "Linetypes Example"

    ' Reset the linetype scale of a Line to what is was before
    lineObj.LinetypeScale = currLTScale
    lineObj.Update
    MsgBox "The linetype scale for the line is reset to: " & lineObj.LinetypeScale, vbInformation, "Linetypes Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LinetypeScale()
    ;; This example creates a line and finds the linetype scale
    ;; for the line. It then changes the linetype scale, and finally
    ;; resets the linetype scale back to the original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create a Line object in model space
    (setq startPoint (vlax-3d-point 2 2 0)
          endPoint (vlax-3d-point 4 4 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-Update lineObj)

    (setq currLTScale (vla-get-LinetypeScale lineObj))
    (alert (strcat "The linetype scale for the line is: " (rtos currLTScale 2)))

    ;; Set the linetype scale of a Line to .5
    (vla-put-LinetypeScale lineObj 0.5)
    (vla-Update lineObj)
    (alert (strcat "The new linetype scale for the line is: " (rtos (vla-get-LinetypeScale lineObj) 2)))

    ;; Reset the linetype scale of a Line to what is was before
    (vla-put-LinetypeScale lineObj currLTScale)
    (vla-Update lineObj)
    (alert (strcat "The linetype scale for the line is reset to: " (rtos (vla-get-LinetypeScale lineObj) 2)))
)


Lineweight Property (ActiveX)

Specifies the lineweight of an individual object or the default lineweight for the drawing.

Supported platforms: Windows only

Signature

VBA:

object.Lineweight
object

Type: All drawing objects, DatabasePreferences, Layer, SubDMeshEdge, SubDMeshFace, SubDMeshVertex, SubEntity, SubEntSolidEdge, SubEntSolidFace, SubEntSolidNode, SubEntSolidVertex

The objects this property applies to.

Property Value

Read-only: No

Type: acLineWeight enum

  • acLnWtByLayer
  • acLnWtByBlock
  • acLnWtByLwDefault
  • acLnWt000
  • acLnWt005
  • acLnWt009
  • acLnWt013
  • acLnWt015
  • acLnWt018
  • acLnWt020
  • acLnWt025
  • acLnWt030
  • acLnWt035
  • acLnWt040
  • acLnWt050
  • acLnWt053
  • acLnWt060
  • acLnWt070
  • acLnWt080
  • acLnWt090
  • acLnWt100
  • acLnWt106
  • acLnWt120
  • acLnWt140
  • acLnWt158
  • acLnWt200
  • acLnWt211

Remarks

The initial value for this property is acLnWtByBlock.

Lineweight values consist of standard settings including BYLAYER, BYBLOCK, and DEFAULT. The DEFAULT value is set by the LWDEFAULT system variable and defaults to a value of 0.01 in. or 0.25 mm. All new objects and layers have a default setting of DEFAULT. The lineweight value of 0 plots at the thinnest lineweight available on the specified plotting device and is displayed at one pixel wide in model space.

Examples

VBA:

Sub Example_LineWeight()
    ' This example creates a circle in model space and then
    ' finds the current lineweight for the circle. The lineweight
    ' is then changed to a new value.

    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double

    ' Define the circle
    centerPoint(0) = 0#: centerPoint(1) = 0#: centerPoint(2) = 0#
    radius = 5#

    ' Create the Circle object in model space
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)
    ZoomAll

    ' Find the lineweight for the circle
    MsgBox "The current lineweight for the circle is " & circleObj.Lineweight

    ' Change the lineweight for the circle
    circleObj.Lineweight = acLnWt211
    circleObj.Update
    MsgBox "The current lineweight for the circle is " & circleObj.Lineweight
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LineWeight()
    ;; This example creates a circle in model space and then
    ;; finds the current lineweight for the circle. The lineweight
    ;; is then changed to a new value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the circle
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius 5)

    ;; Create the Circle object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))
    (vla-ZoomAll acadObj)

    ;; Find the lineweight for the circle
    (alert (strcat "The current lineweight for the circle is " (itoa (vla-get-Lineweight circleObj))))

    ;; Change the lineweight for the circle
    (vla-put-Lineweight circleObj acLnWt211)
    (vla-Update circleObj)
    (alert (strcat "The current lineweight for the circle is " (itoa (vla-get-Lineweight circleObj))))
)


LineweightDisplay Property (ActiveX)

Specifies whether lineweights are displayed in model space for the drawing.

Supported platforms: Windows only

Signature

VBA:

object.LineweightDisplay
object

Type: DatabasePreferences

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Lineweights are displayed in model space.
  • False: Lineweights are not displayed in model space.

Remarks

The initial value for this property is True.

AutoCAD regeneration time increases with lineweights that are represented by more than one pixel. Set this property to False if AutoCAD performance slows down when working with large lineweights.

Examples

VBA:

Sub Example_LineweightDisplay()
    ' This example reads and modifies the preference value that controls
    ' whether symbol names may include extended character sets, or more
    ' than 31 characters.
    '
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadDatabasePreferences
    Dim originalValue As Variant, newValue As Variant

    ' Get the user preferences object
    Set ACADPref = ThisDrawing.preferences

    ' Read and display the original value
    originalValue = ACADPref.LineWeightDisplay
    MsgBox "The LineweightDisplay preference is set to: " & originalValue

    ' Modify the LineweightDisplay preference by toggling the value
    ACADPref.LineWeightDisplay = Not (ACADPref.LineWeightDisplay)
    newValue = ACADPref.LineWeightDisplay
    MsgBox "The LineweightDisplay preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.LineWeightDisplay = originalValue
    MsgBox "The LineweightDisplay preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LineweightDisplay()
    ;; This example reads and modifies the preference value that controls
    ;; the display of lineweights in the drawing window.
    ;;
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences doc))

    ;; Read and display the original value
    (setq originalValue (vla-get-LineWeightDisplay preferences))
    (alert (strcat "The LineweightDisplay preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the LineweightDisplay preference by toggling the value
    (vla-put-LineWeightDisplay preferences (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-LineWeightDisplay preferences))
    (alert (strcat "The LineweightDisplay preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-LineWeightDisplay preferences originalValue)
    (alert (strcat "The LineweightDisplay preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


LiveSectionEnabled Property (ActiveX)

Turns live section on or off for this section object.

Supported platforms: Windows only

Signature

VBA:

object.LiveSectionEnabled
object

Type: Section

The object to which this property applies.

Property Value

Read-only: No

Type: Boolean

  • True: Live section is enabled for the section object.
  • False: Live section is not enabled for the section object.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


LoadAcadLspInAllDocuments Property (ActiveX)

Specifies whether acad.lsp is loaded at startup or with each drawing.

Supported platforms: Windows only

Signature

VBA:

object.LoadAcadLspInAllDocuments
object

Type: PreferencesSystem

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: acad.lsp is loaded with each drawing.
  • False: acad.lsp is loaded only with the first drawing at startup.

Remarks

The initial value for this property is True.

NoteThe value for this property is stored in the ACADLSPASDOC system variable.

Examples

VBA:

Sub Example_LoadAcadLspInAllDocuments()
    ' This example returns the current setting of
    ' LoadAcadLspInAllDocuments. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currLoadAcadLspInAllDocuments As Boolean

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current LoadAcadLspInAllDocuments value
    currLoadAcadLspInAllDocuments = preferences.System.LoadAcadLspInAllDocuments
    MsgBox "The current value for LoadAcadLspInAllDocuments is " & preferences.System.LoadAcadLspInAllDocuments, vbInformation, "LoadAcadLspInAllDocuments Example"

    ' Change the value for LoadAcadLspInAllDocuments
    preferences.System.LoadAcadLspInAllDocuments = Not (currLoadAcadLspInAllDocuments)
    MsgBox "The new value for LoadAcadLspInAllDocuments is " & preferences.System.LoadAcadLspInAllDocuments, vbInformation, "LoadAcadLspInAllDocuments Example"

    ' Reset LoadAcadLspInAllDocuments to its original value
    preferences.System.LoadAcadLspInAllDocuments = currLoadAcadLspInAllDocuments
    MsgBox "The LoadAcadLspInAllDocuments value is reset to " & preferences.System.LoadAcadLspInAllDocuments, vbInformation, "LoadAcadLspInAllDocuments Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LoadAcadLspInAllDocuments()
    ;; This example returns the current setting of
    ;; LoadAcadLspInAllDocuments. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current LoadAcadLspInAllDocuments value
    (setq currLoadAcadLspInAllDocuments (vla-get-LoadAcadLspInAllDocuments (vla-get-System preferences)))
    (alert (strcat "The current value for LoadAcadLspInAllDocuments is " (if (= currLoadAcadLspInAllDocuments :vlax-true) "True" "False")))

    ;; Change the value for LoadAcadLspInAllDocuments
    (vla-put-LoadAcadLspInAllDocuments (vla-get-System preferences) (if (= currLoadAcadLspInAllDocuments :vlax-true) :vlax-false :vlax-true))
    (alert (strcat "The new value for LoadAcadLspInAllDocuments is " (if (= (vla-get-LoadAcadLspInAllDocuments (vla-get-System preferences)) :vlax-true) "True" "False")))

    ;; Reset LoadAcadLspInAllDocuments to its original value
    (vla-put-LoadAcadLspInAllDocuments (vla-get-System preferences) currLoadAcadLspInAllDocuments)
    (alert (strcat "The LoadAcadLspInAllDocuments value is reset to " (if (= (vla-get-LoadAcadLspInAllDocuments (vla-get-System preferences)) :vlax-true) "True" "False")))
)


LocaleID Property (ActiveX)

Gets the locale ID of the current AutoCAD session.

Supported platforms: Windows only

Signature

VBA:

object.LocaleID
object

Type: Application

The object this property applies to.

Property Value

Read-only: Yes

Type: Long

The locale ID of the current AutoCAD session.

Remarks

The locale ID is defined by the operating system.

Examples

VBA:

Sub Example_LocaleID()
    ' This code retrieves the Locale ID and displays it in a message box
    MsgBox "The locale ID is " & ThisDrawing.Application.LocaleId, , "LocaleID Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LocaleId()
    ;; This code retrieves the Locale ID and displays it in a message box
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (alert (strcat "The locale ID is " (itoa (vla-get-LocaleId acadObj))))
)


Lock Property (ActiveX)

Locks or unlocks a layer.

Supported platforms: Windows only

Signature

VBA:

object.Lock
object

Type: Layer

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The layer is locked.
  • False: The layer is unlocked.

Remarks

You cannot edit objects on a locked layer; however, they are still visible if the layer is on and thawed. You can make a locked layer active and you can add objects to it. You can also apply object snap modes to objects on locked layers. You can freeze and turn off locked layers and change their associated colors.

Locking is useful when you want to edit objects that are associated with particular layers but also want to view objects on other layers.

Examples

VBA:

Sub Example_Lock()
    ' This example creates a new layer called "Lock".
    ' It then displays the status of the Lock property
    ' for the new layer, toggles the status of the
    ' Lock property, and again displays its status.
    ' After running this example, you can check the layer
    ' control on the Object Properties tool bar. It will
    ' show the new layer and the latest Lock status.

    Dim layerObj As AcadLayer

    ' Create the new layer
    Set layerObj = ThisDrawing.Layers.Add("Lock")

    ' Display the Lock status of the new layer
    GoSub DISPLAYSTATUS

    ' Toggle the status of the Lock property for the layer
    layerObj.Lock = Not (layerObj.Lock)

    ' Display the Lock status of the new layer
    GoSub DISPLAYSTATUS
    Exit Sub

DISPLAYSTATUS:
    If layerObj.Lock Then
        MsgBox "Layer " & layerObj.Name & " is locked.", , "Lock Example"
    Else
        MsgBox "Layer " & layerObj.Name & " is unlocked.", , "Lock Example"
    End If
    Return

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Lock()
    ;; This example creates a new layer called "Lock".
    ;; It then displays the status of the Lock property
    ;; for the new layer, toggles the status of the
    ;; Lock property, and again displays its status.
    ;; After running this example, you can check the layer
    ;; control on the Object Properties tool bar. It will
    ;; show the new layer and the latest Lock status.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the new layer
    (setq layerObj (vla-Add (vla-get-Layers doc) "Lock"))

    ;; Display the Lock status of the new layer
    (if (= (vla-get-Lock layerObj) :vlax-true)
        (alert (strcat "Layer " (vla-get-Name layerObj) " is locked."))
        (alert (strcat "Layer " (vla-get-Name layerObj) " is unlocked."))
    )

    ;; Toggle the status of the Lock property for the layer
    (vla-put-Lock layerObj (if (= (vla-get-Lock layerObj) :vlax-true) :vlax-false :vlax-true))

    ;; Display the Lock status of the new layer
    (if (= (vla-get-Lock layerObj) :vlax-true)
        (alert (strcat "Layer " (vla-get-Name layerObj) " is locked."))
        (alert (strcat "Layer " (vla-get-Name layerObj) " is unlocked."))
    )
)


LockAspectRatio Property (ActiveX)

Ensures that the width and height of the object stay in proportion.

Supported platforms: Windows only

Signature

VBA:

object.LockAspectRatio
object

Type: OLE

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The proportion of the width to the height of the object is locked.
  • False: The proportion of the width to the height of the object is not locked.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Locked Property (ActiveX)

Specifies if the point cloud is locked.

Supported platforms: Windows only

Signature

VBA:

object.Locked
object

Type: PointCloud, PointCloudEx

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Point cloud is locked.
  • False: Point cloud is not unlocked.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


LockPosition Property (ActiveX)

Specifies whether the attribute or attribute reference may be moved relative to the geometry in the block.

Supported platforms: Windows only

Signature

VBA:

object.LockPosition
object

Type: Attribute, AttributeReference

The objects this property applies to.

Property Value

Read-only: Yes; except an Attribute object

Type: Boolean

  • True: The attribute's position is locked.
  • False: The attribute's position is not locked.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


LogFileOn Property (ActiveX)

Specifies whether the contents of the text window are written to a log file.

Supported platforms: Windows only

Signature

VBA:

object.LogFileOn
object

Type: PreferencesOpenSave

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The log file is turned on.
  • False: The log file is turned off.

Remarks

The initial value of this property is True.

The log file records the contents of the text window in a text file. Use the LogFilePath property to specify the name of the log file.

NoteThe value for this property is stored in the LOGFILEMODE system variable.

Examples

VBA:

Sub Example_LogFileOn()
    ' This example returns the current setting of
    ' LogFileOn. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currLogFileOn As Boolean

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current LogFileOn value
    currLogFileOn = preferences.OpenSave.LogFileOn
    MsgBox "The current value for LogFileOn is " & preferences.OpenSave.LogFileOn, vbInformation, "LogFileOn Example"

    ' Change the value for LogFileOn
    preferences.OpenSave.LogFileOn = Not (currLogFileOn)
    MsgBox "The new value for LogFileOn is " & preferences.OpenSave.LogFileOn, vbInformation, "LogFileOn Example"

    ' Reset LogFileOn to its original value
    preferences.OpenSave.LogFileOn = currLogFileOn
    MsgBox "The LogFileOn value is reset to " & preferences.OpenSave.LogFileOn, vbInformation, "LogFileOn Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LogFileOn()
    ;; This example returns the current setting of
    ;; LogFileOn. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current LogFileOn value
    (setq currLogFileOn (vla-get-LogFileOn (vla-get-OpenSave preferences)))
    (alert (strcat "The current value for LogFileOn is " (if (= currLogFileOn :vlax-true) "True" "False")))

    ;; Change the value for LogFileOn
    (vla-put-LogFileOn (vla-get-OpenSave preferences) (if (= currLogFileOn :vlax-true) :vlax-false :vlax-true))
    (alert (strcat "The new value for LogFileOn is " (if (= (vla-get-LogFileOn (vla-get-OpenSave preferences)) :vlax-true) "True" "False")))

    ;; Reset LogFileOn to its original value
    (vla-put-LogFileOn (vla-get-OpenSave preferences) currLogFileOn)
    (alert (strcat "The LogFileOn value is reset to " (if (= (vla-get-LogFileOn (vla-get-OpenSave preferences)) :vlax-true) "True" "False")))
)


LogFilePath Property (ActiveX)

Specifies the location for the log file.

Supported platforms: Windows only

Signature

VBA:

object.LogFilePath
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The drive and path for the log file.

Remarks

Use the LogFileOn property to enable or disable log file capabilities.

NoteThe value for this property is stored in the LOGFILEPATH system variable.

Examples

VBA:

Sub Example_LogFilePath()
    ' This example returns the current setting of
    ' LogFilePath. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currLogFilePath As String
    Dim newLogFilePath As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current LogFilePath value
    currLogFilePath = preferences.Files.LogFilePath
    MsgBox "The current value for LogFilePath is " & currLogFilePath, vbInformation, "LogFilePath Example"

    ' Change the value for LogFilePath
    newLogFilePath = "C:/AutoCAD/"
    preferences.Files.LogFilePath = newLogFilePath
    MsgBox "The new value for LogFilePath is " & newLogFilePath, vbInformation, "LogFilePath Example"

    ' Reset LogFilePath to its original value
    preferences.Files.LogFilePath = currLogFilePath
    MsgBox "The LogFilePath value is reset to " & currLogFilePath, vbInformation, "LogFilePath Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LogFilePath()
    ;; This example returns the current setting of
    ;; LogFilePath. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current LogFilePath value
    (setq currLogFilePath (vla-get-LogFilePath (vla-get-Files preferences)))
    (alert (strcat "The current value for LogFilePath is " currLogFilePath))

    ;; Change the value for LogFilePath
    (setq newLogFilePath "C:/AutoCAD/")
    (vla-put-LogFilePath (vla-get-Files preferences) newLogFilePath)
    (alert (strcat "The new value for LogFilePath is " newLogFilePath))

    ;; Reset LogFilePath to its original value
    (vla-put-LogFilePath (vla-get-Files preferences) currLogFilePath)
    (alert (strcat "The LogFilePath value is reset to " currLogFilePath))
)


Longitude Property (ActiveX)

Specifies the longitude of the position marker.

Supported platforms: Windows only

Signature

VBA:

object.Longitude
object

Type: GeoPositionMarker

The object this property applies to.

Property Value

Read-only: No

Type: String

The current longitude of the position marker.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


LowerLeftCorner Property (ActiveX)

Gets the lower-left corner of the current active viewport.

Supported platforms: Windows only

Signature

VBA:

object.LowerLeftCorner
object

Type: Viewport

The object this property applies to.

Property Value

Read-only: Yes

Type: Variant (two-element array of doubles)

A 2D coordinate representing the lower-left corner of the current active viewport.

Remarks

The LowerLeftCorner and UpperRightCorner properties represent the graphic placement of the viewport on the display. These properties are defined as follows:

Viewport 1—LowerLeftCorner = (0, .5), UpperRightCorner = (.5, 1)

Viewport 2—LowerLeftCorner = (.5, .5), UpperRightCorner = (1, 1)

Viewport 3—LowerLeftCorner = (0, 0), UpperRightCorner = (.5, .5)

Viewport 4—LowerLeftCorner = (.5, 0), UpperRightCorner = (1, .5)

Examples

VBA:

Sub Example_LowerLeftCorner()
    ' This example creates a new viewport and makes it active.
    ' Then it splits the viewport into four windows.
    ' It then finds the lower-left corner of each of the
    ' windows.
    Dim newViewport As AcadViewport

    ' Create a new viewport and make it active
    Set newViewport = ThisDrawing.Viewports.Add("TESTVIEWPORT")
    ThisDrawing.ActiveViewport = newViewport

    ' Split the viewport in four windows
    newViewport.Split acViewport4

    ' Make the newly split viewport active
    ThisDrawing.ActiveViewport = newViewport

    ' Iterate through the viewports. For each viewport,
    ' make that viewport active and display the coordinates
    ' of the lower left corner.
    Dim entry As AcadViewport
    Dim lowerLeft As Variant
    For Each entry In ThisDrawing.Viewports
        entry.GridOn = True
        ThisDrawing.ActiveViewport = entry
        lowerLeft = entry.LowerLeftCorner
        MsgBox "The lower left corner of this viewport is " & lowerLeft(0) & ", " & lowerLeft(1), , "LowerLeftCorner Example"
        entry.GridOn = False
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LowerLeftCorner()
    ;; This example creates a new viewport and makes it active.
    ;; Then it splits the viewport into four windows.
    ;; It then finds the lower-left corner of each of the
    ;; windows.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create a new viewport and make it active
    (setq newViewport (vla-Add (vla-get-Viewports doc) "TESTVIEWPORT"))
    (vla-put-ActiveViewport doc newViewport)

    ;; Split the viewport in four windows
    (vla-Split newViewport acViewport4)

    ;; Make the newly split viewport active
    (vla-put-ActiveViewport doc newViewport)

    ;; Iterate through the viewports. For each viewport,
    ;; make that viewport active and display the coordinates
    ;; of the lower left corner.
    (vlax-for entry (vla-get-Viewports doc)
        (vla-put-GridOn entry :vlax-true)
        (vla-put-ActiveViewport doc entry)
        (setq lowerLeft (vlax-safearray->list (vlax-variant-value (vla-get-LowerLeftCorner entry))))
        (alert (strcat "The lower left corner of this viewport is " (rtos (nth 0 lowerLeft) 2) ", " (rtos (nth 1 lowerLeft) 2)))
        (vla-put-GridOn entry :vlax-false)
    )
)


Macro Property (ActiveX)

Specifies the macro for the menu or toolbar item.

Supported platforms: Windows only

Signature

VBA:

object.Macro
object

Type: PopupMenuItem, ToolbarItem

The objects this property applies to.

Property Value

Read-only: No

Type: String

The name of the macro associated with the menu or toolbar item.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Macro()
    ' This example creates a new menu called TestMenu and inserts a menu item
    ' into it. The menu is then displayed on the menu bar.
    ' To remove the menu after execution of this macro, use the Customize Menu
    ' option from the Tools menu.

    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    ' Create the new menu
    Dim newMenu As AcadPopupMenu
    Set newMenu = currMenuGroup.Menus.Add("TestMenu")

    ' Add a menu item to the new menu
    Dim newMenuItem As AcadPopupMenuItem
    Dim openMacro As String
    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set newMenuItem = newMenu.AddMenuItem(newMenu.count + 1, "Open", openMacro)

    ' Display the menu on the menu bar
    newMenu.InsertInMenuBar (ThisDrawing.Application.MenuBar.count + 1)

    MsgBox "The macro for the Open menu item is: " & newMenuItem.Macro

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Macro()
    ;; This example creates a new menu called TestMenu and inserts a menu item
    ;; into it. The menu is then displayed on the menu bar.
    ;; To remove the menu after execution of this macro, use the Customize Menu
    ;; option from the Tools menu.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new menu
    (setq newMenu (vla-Add (vla-get-Menus currMenuGroup) "TestMenu"))

    ;; Add a menu item to the new menu
    ;; Assign the macro string the VB equivalent of "ESC ESC _open "
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))
    (setq newMenuItem (vla-AddMenuItem newMenu (1+ (vla-get-Count newMenu)) "Open" openMacro))

    ;; Display the menu on the menu bar
    (vla-InsertInMenuBar newMenu (1+ (vla-get-Count (vla-get-MenuBar acadObj))))

    (alert (strcat "The macro for the Open menu item is: " (vla-get-Macro newMenuItem)))
)


MainDictionary Property (ActiveX)

Specifies the current dictionary to use for spell checking.

Supported platforms: Windows only

Signature

VBA:

object.MainDictionary
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The spell-checking dictionary to use.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_MainDictionary()
    ' This example returns the current setting of
    ' MainDictionary. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currMainDictionary As String
    Dim newMainDictionary As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current MainDictionary value
    currMainDictionary = preferences.Files.MainDictionary
    MsgBox "The current value for MainDictionary is " & currMainDictionary, vbInformation, "MainDictionary Example"

    ' Change the value for MainDictionary
    newMainDictionary = "TestMainDictionary"
    preferences.Files.MainDictionary = newMainDictionary
    MsgBox "The new value for MainDictionary is " & newMainDictionary, vbInformation, "MainDictionary Example"

    ' Reset MainDictionary to its original value
    preferences.Files.MainDictionary = currMainDictionary
    MsgBox "The MainDictionary value is reset to " & currMainDictionary, vbInformation, "MainDictionary Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MainDictionary()
    ;; This example returns the current setting of
    ;; MainDictionary. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current MainDictionary value
    (setq currMainDictionary (vla-get-MainDictionary (vla-get-Files preferences)))
    (alert (strcat "The current value for MainDictionary is " currMainDictionary))

    ;; Change the value for MainDictionary
    (setq newMainDictionary "TestMainDictionary")
    (vla-put-MainDictionary (vla-get-Files preferences) newMainDictionary)
    (alert (strcat "The new value for MainDictionary is " newMainDictionary))

    ;; Reset MainDictionary to its original value
    (vla-put-MainDictionary (vla-get-Files preferences) currMainDictionary)
    (alert (strcat "The MainDictionary value is reset to " currMainDictionary))
)


MaintainAssociativity Property (ActiveX)

Specifies if a surface maintains its associativity with another surface.

Supported platforms: Windows only

Signature

VBA:

object.MaintainAssociativity
object

Type: ExtrudedSurface, LoftedSurface, NurbSurface, PlaneSurface, RevolvedSurface, Surface, SweptSurface

The objects this property applies to.

Property Value

Read-only: No

Type: Long

  • 0: None; associativity it not maintained
  • 1: Remove; associativity is removed
  • 2: Yes; associativity is maintained

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


MajorAxis Property (ActiveX)

Specifies the direction of the major axis of the ellipse.

Supported platforms: Windows only

Signature

VBA:

object.MajorAxis
object

Type: Ellipse

The object this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

A 3D vector defining the major axis. The vector originates at the ellipse center.

Remarks

The longer axis of an ellipse is called the major axis; the shorter one is the minor axis.

Examples

VBA:

Sub Example_MajorAxis()
    ' This example creates an ellipse and finds the major axis
    ' for that ellipse. It then changes the major axis for the ellipse.
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double

    ' Create an ellipse in model space
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)
    ellObj.Update
    MsgBox "The ellipse has a major axis of " & majAxis(0) & ", " & majAxis(1) & ", " & majAxis(2), vbInformation, "MajorAxis Example"

    ' Change the major axis of the ellipse
    majAxis(0) = 5: majAxis(1) = 5: majAxis(2) = 0
    ellObj.MajorAxis = majAxis
    ellObj.Update

    ' Query the major axis of an Ellipse
    Dim retMajAxis As Variant
    retMajAxis = ellObj.MajorAxis
    MsgBox "The ellipse has been udpated with the major axis " & retMajAxis(0) & ", " & retMajAxis(1) & ", " & retMajAxis(2), vbInformation, "MajorAxis Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MajorAxis()
    ;; This example creates an ellipse and finds the major axis
    ;; for that ellipse. It then changes the major axis for the ellipse.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create an ellipse in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))
    (vla-ZoomAll acadObj)

    (vla-Update ellObj)
    (setq majAxis (vlax-variant-value majAxis))
    (alert (strcat "The ellipse has a major axis of " (rtos (vlax-safearray-get-element majAxis 0) 2) ", "
                                                      (rtos (vlax-safearray-get-element majAxis 1) 2) ", "
                                                      (rtos (vlax-safearray-get-element majAxis 2) 2)))

    ;; Change the major axis of the ellipse
    (setq majAxis (vlax-3d-point 5 5 0))
    (vla-put-MajorAxis ellObj majAxis)
    (vla-Update ellObj)

    ;; Query the major axis of an Ellipse
    (setq retMajAxis (vlax-variant-value (vla-get-MajorAxis ellObj)))
    (alert (strcat "The ellipse has been udpated with the major axis " (rtos (vlax-safearray-get-element retMajAxis 0) 2) ", "
                                                                       (rtos (vlax-safearray-get-element retMajAxis 1) 2) ", "
                                                                       (rtos (vlax-safearray-get-element retMajAxis 2) 2)))
)


MajorRadius Property (ActiveX)

Specifies the length of the major axis of the ellipse.

Supported platforms: Windows only

Signature

VBA:

object.MajorRadius
object

Type: Ellipse

The object this property applies to.

Property Value

Read-only: No

Type: Double

The length of the major axis for an ellipse.

Remarks

The longer axis of an ellipse is called the major axis; the shorter one is the minor axis.

Examples

VBA:

Sub Example_MajorRadius()
    ' This example creates an Ellipse in model space and displays
    ' both the Major radius and the Minor radius of the new Ellipse

    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double, center(0 To 2) As Double
    Dim radRatio As Double

    ' Create an ellipse in model space
    center(0) = 5: center(1) = 5: center(2) = 0
    majAxis(0) = 10: majAxis(1) = 20: majAxis(2) = 0
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    ThisDrawing.Application.ZoomAll

    ' Display radius information
    MsgBox "The major radius of the new Ellipse is: " & ellObj.majorRadius & vbCrLf & _
           "The minor radius of the new Ellipse is: " & ellObj.minorRadius
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MajorRadius()
    ;; This example creates an Ellipse in model space and displays
    ;; both the Major radius and the Minor radius of the new Ellipse
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create an ellipse in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

    (vla-ZoomAll acadObj)

    ;; Display radius information
    (alert (strcat "The major radius of the new Ellipse is: " (rtos (vla-get-majorRadius ellObj) 2)
                   "\nThe minor radius of the new Ellipse is: " (rtos (vla-get-minorRadius ellObj) 2)))
)


Mask Property (ActiveX)

Specifies the layer properties to be restored.

Supported platforms: Windows only

Signature

VBA:

object.Mask
object

Type: LayerStateManager

The object this property applies to.

Property Value

Read-only: No

Type: AcLayerStateMask enum

A number representing the layer properties to be restored. Use the constants in the following table to identify layer properties:

  • acLsAll: All layer properties
  • acLsColor: Color
  • acLsFrozen: Frozen or thawed
  • acLsLineType: Linetype
  • acLsLineWeight: Lineweight
  • acLsLocked: Locked or unlocked
  • acLsNewViewport: New viewport layers frozen or thawed
  • acLsNone: None
  • acLsOn: On or off
  • acLsPlot: Plotting on or off
  • acLsPlotStyle: Plot style

Remarks

The LayerStateManager Restore method uses the Mask property to identify which layer properties are to be restored. You first set the Mask property when saving layer settings with the LayerStateManager Save method. However, the Save method actually saves all properties of each drawing layer. You can update the Mask property any time prior to restoring layer settings, thereby changing which layer properties are restored.

To specify multiple layer properties in the Mask, add the constants representing those properties. For example, to save the Color and LineType properties, specify the following:

acLsColor + acLsLineType

Examples

VBA:

Sub Example_SetMask()
    ' The following code updates the Mask property of layer
    ' settings saved under the name "ColorLineType, so that
    ' Color, LineType, and LineWeight layer properties will
    ' be restored by a Restore operation.

    Dim oLSM As AcadLayerStateManager
    Dim settings As AcLayerStateMask

    Set oLSM = ThisDrawing.Application. _
       GetInterfaceObject("AutoCAD.AcadLayerStateManager.20")
    oLSM.SetDatabase ThisDrawing.Database

    oLSM.Save "ColorLinetype", acLsColor + acLsLineType

    ' Retrieve the current mask setting from ColorLinetype
    settings = oLSM.Mask("ColorLinetype")

    ' Set mask so that Color, LineType, and LineWeight
    ' properties will be restored by a Restore operation
    settings = acLsColor + acLsLineType + acLsLineWeight

    ' Commit the new settings mask to ColorLinetype
    oLSM.Mask("ColorLinetype") = settings

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Mask()
    ;; The following code updates the Mask property of layer
    ;; settings saved under the name "ColorLineType, so that
    ;; Color, LineType, and LineWeight layer properties will
    ;; be restored by a Restore operation.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq oLSM (vla-GetInterfaceObject acadObj "AutoCAD.AcadLayerStateManager.20"))

    (vla-SetDatabase oLSM (vla-get-Database doc))

    (vla-Save oLSM "ColorLinetype" (+ acLsColor acLsLineType))

    ;; Retrieve the current mask setting from ColorLinetype
    (setq settings (vla-get-Mask oLSM "ColorLinetype"))

    ;; Set mask so that Color, LineType, and LineWeight
    ;; properties will be restored by a Restore operation
    (setq settings (+ acLsColor acLsLineType acLsLineWeight))

    ;; Commit the new settings mask to ColorLinetype
    (vla-put-Mask oLSM "ColorLinetype" settings)

    (vlax-release-object oLSM)
)


Material Property (ActiveX)

Specifies the name of the material.

Supported platforms: Windows only

Signature

VBA:

object.Material
object

Type: All drawing objects, AttributeReference, Group, Layer, SubDMeshFace, SubEntSolidFace

The objects this property applies to.

Property Value

Read-only: No

Type: String

The name of the material.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddMaterial()
    Dim oMaterial As AcadMaterial
    Dim oMaterials As AcadMaterials
    Set oMaterial = ThisDrawing.Materials.Add("TestMaterial")
    oMaterial.Description = "This material demonstrates how to add a material to a database."
    ThisDrawing.ActiveMaterial = oMaterial

    ' Display the name and description of the layer
    MsgBox oMaterial.Name & " has been added." & vbCrLf & _
            "Name: " & vbCrLf & oMaterial.Name & vbCrLf & vbCrLf & _
            "Description: " & vbCrLf & _
            oMaterial.Description

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Materials()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq oMaterial (vla-Add (vla-get-Materials doc) "TestMaterial"))
    (vla-put-Description oMaterial "This material demonstrates how to add a material to a database.")
    (vla-put-ActiveMaterial doc oMaterial)
    ;; Display the status of the new layer
    (alert (strcat (vla-get-Name oMaterial) " has been added."
            "\nName: " (vla-get-Name oMaterial)
            "\nDescription: " (vla-get-Description oMaterial)))
)


Materials Property (ActiveX)

Returns the materials collection for the database.

Supported platforms: Windows only

Signature

VBA:

object.Materials
object

Type: Database, Document

The object to which this property applies.

Property Value

Read-only: Yes

Type: Materials

The Materials collection for the database.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddMaterial()
    Dim oMaterial As AcadMaterial
    Dim oMaterials As AcadMaterials
    Set oMaterial = ThisDrawing.Materials.Add("TestMaterial")
    oMaterial.Description = "This material demonstrates how to add a material to a database."
    ThisDrawing.ActiveMaterial = oMaterial

    ' Display the name and description of the layer
    MsgBox oMaterial.Name & " has been added." & vbCrLf & _
            "Name: " & vbCrLf & oMaterial.Name & vbCrLf & vbCrLf & _
            "Description: " & vbCrLf & _
            oMaterial.Description

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Materials()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq oMaterial (vla-Add (vla-get-Materials doc) "TestMaterial"))
    (vla-put-Description oMaterial "This material demonstrates how to add a material to a database.")
    (vla-put-ActiveMaterial doc oMaterial)
    ;; Display the status of the new layer
    (alert (strcat (vla-get-Name oMaterial) " has been added."
            "\nName: " (vla-get-Name oMaterial)
            "\nDescription: " (vla-get-Description oMaterial)))
)


MaxActiveViewports Property (ActiveX)

Specifies the maximum number of active viewports.

Supported platforms: Windows only

Signature

VBA:

object.MaxActiveViewports
object

Type: DatabasePreferences

The object this property applies to.

Property Value

Read-only: No

Type: Integer

The maximum number of active viewports; 2 <= MaxActiveViewports <= 48

Remarks

Inactive viewports are blank, so their contents are not regenerated. You can, therefore, improve performance by specifying a low value. The initial value is 48.

NoteThe value of this property is stored in the MAXACTVP system variable.

Examples

VBA:

Sub Example_MaxActiveViewports()
    ' This example returns the current setting of
    ' MaxActiveViewports. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim currMaxActiveViewports As Integer
    Dim newMaxActiveViewports As Integer

    ' Retrieve the current MaxActiveViewports value
    currMaxActiveViewports = ThisDrawing.preferences.MaxActiveViewports
    MsgBox "The current value for MaxActiveViewports is " & currMaxActiveViewports, vbInformation, "MaxActiveViewports Example"

    ' Change the value for MaxActiveViewports
    newMaxActiveViewports = 20
    ThisDrawing.preferences.MaxActiveViewports = newMaxActiveViewports
    MsgBox "The new value for MaxActiveViewports is " & newMaxActiveViewports, vbInformation, "MaxActiveViewports Example"

    ' Reset MaxActiveViewports to its original value
    ThisDrawing.preferences.MaxActiveViewports = currMaxActiveViewports
    MsgBox "The MaxActiveViewports value is reset to " & currMaxActiveViewports, vbInformation, "MaxActiveViewports Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MaxActiveViewports()
    ;; This example returns the current setting of
    ;; MaxActiveViewports. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences doc))

    ;; Retrieve the current MaxActiveViewports value
    (setq currMaxActiveViewports (vla-get-MaxActiveViewports preferences))
    (alert (strcat "The current value for MaxActiveViewports is " (itoa currMaxActiveViewports)))

    ;; Change the value for MaxActiveViewports
    (setq newMaxActiveViewports 20)
    (vla-put-MaxActiveViewports preferences newMaxActiveViewports)
    (alert (strcat "The new value for MaxActiveViewports is " (itoa newMaxActiveViewports)))

    ;; Reset MaxActiveViewports to its original value
    (vla-put-MaxActiveViewports preferences currMaxActiveViewports)
    (alert (strcat "The MaxActiveViewports value is reset to " (itoa currMaxActiveViewports)))
)


MaxAutoCADWindow Property (ActiveX)

Specifies whether the AutoCAD window should fill the entire screen area when you start.

Supported platforms: Windows only

Signature

VBA:

object.MaxAutoCADWindow
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Maximizes AutoCAD.
  • False: Does not maximize AutoCAD.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_MaxAutoCADWindow()
    ' This example returns the current setting of
    ' MaxAutoCADWindow. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currMaxAutoCADWindow As Boolean

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current MaxAutoCADWindow value
    currMaxAutoCADWindow = preferences.DISPLAY.MaxAutoCADWindow
    MsgBox "The current value for MaxAutoCADWindow is " & preferences.DISPLAY.MaxAutoCADWindow, vbInformation, "MaxAutoCADWindow Example"

    ' Change the value for MaxAutoCADWindow
    preferences.DISPLAY.MaxAutoCADWindow = Not (currMaxAutoCADWindow)
    MsgBox "The new value for MaxAutoCADWindow is " & preferences.DISPLAY.MaxAutoCADWindow, vbInformation, "MaxAutoCADWindow Example"

    ' Reset MaxAutoCADWindow to its original value
    preferences.DISPLAY.MaxAutoCADWindow = currMaxAutoCADWindow
    MsgBox "The MaxAutoCADWindow value is reset to " & preferences.DISPLAY.MaxAutoCADWindow, vbInformation, "MaxAutoCADWindow Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MaxAutoCADWindow()
    ;; This example returns the current setting of
    ;; MaxAutoCADWindow. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current MaxAutoCADWindow value
    (setq currMaxAutoCADWindow (vla-get-MaxAutoCADWindow (vla-get-Display preferences)))
    (alert (strcat "The current value for MaxAutoCADWindow is " (if (= currMaxAutoCADWindow :vlax-true) "True"  "False")))

    ;; Change the value for MaxAutoCADWindow
    (vla-put-MaxAutoCADWindow (vla-get-Display preferences) (if (= currMaxAutoCADWindow :vlax-true) :vlax-false :vlax-true))
    (alert (strcat "The new value for MaxAutoCADWindow is " (if (= (vla-get-MaxAutoCADWindow (vla-get-Display preferences)) :vlax-true) "True" "False")))

    ;; Reset MaxAutoCADWindow to its original value
    (vla-put-MaxAutoCADWindow (vla-get-Display preferences) currMaxAutoCADWindow)
    (alert (strcat "The MaxAutoCADWindow value is reset to " (if (= (vla-get-MaxAutoCADWindow (vla-get-Display preferences)) :vlax-true) "True" "False")))
)


MaxLeaderSegmentsPoints Property (ActiveX)

Specifies the maxLeaderSegmentsPoints of the mleaderstyle.

Supported platforms: Windows only

Signature

VBA:

object.MaxLeaderSegmentsPoints
object

Type: MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: Integer

The maximum number of leader segment points.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


MClose Property (ActiveX)

Specifies whether the PolygonMesh is closed in the M direction.

Supported platforms: Windows only

Signature

VBA:

object.MClose
object

Type: PolygonMesh

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The PolygonMesh is closed in the M direction.
  • False: The PolygonMesh is open in the M direction.

Remarks

If the PolygonMesh is closed, it will be treated as continuous from the last row on to the first row. If the PolygonMesh is open, it will be treated as discontinuous between the last row and the first row.

Examples

VBA:

Sub Example_MClose()
    ' This example creates a 4 X 4 polygonmesh in model space.
    ' It then closes the polymesh in the 'M' direction.
    Dim meshObj As AcadPolygonMesh
    Dim mSize, nSize, count As Integer
    Dim points(0 To 47) As Double

    ' Create the matrix of points
    points(0) = 2: points(1) = 2: points(2) = 1
    points(3) = 2.5: points(4) = 2: points(5) = 0
    points(6) = 5: points(7) = 2: points(8) = 0
    points(9) = 5.5: points(10) = 2: points(11) = 1
    points(12) = 2: points(13) = 4: points(14) = 0.5
    points(15) = 2.5: points(16) = 4: points(17) = 0
    points(18) = 5: points(19) = 4: points(20) = 0
    points(21) = 5.5: points(22) = 4: points(23) = 0.5
    points(24) = 2: points(25) = 6: points(26) = 0.5
    points(27) = 2.5: points(28) = 6: points(29) = 0
    points(30) = 5: points(31) = 6: points(32) = 0
    points(33) = 5.5: points(34) = 6: points(35) = 0.5
    points(36) = 2: points(37) = 8: points(38) = 1
    points(39) = 2.5: points(40) = 8: points(41) = 0
    points(42) = 5: points(43) = 8: points(44) = 0
    points(45) = 5.5: points(46) = 8: points(47) = 1

    mSize = 4: nSize = 4

    ' Create a 3Dmesh in model space
    Set meshObj = ThisDrawing.ModelSpace.Add3DMesh(mSize, nSize, points)

    ' Change the viewing direction of the viewport to better see the cylinder
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

    ' Close the polymesh in the 'M' direction
    MsgBox "The polymesh is " & IIf(meshObj.MClose, "closed", "open") & " in the 'M' direction.", , "MClose Example"
    meshObj.MClose = True
    ThisDrawing.Regen acActiveViewport
    MsgBox "The polymesh is " & IIf(meshObj.MClose, "closed", "open") & " in the 'M' direction.", , "MClose Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MClose()
    ;; This example creates a 4 X 4 polygonmesh in model space.
    ;; It then closes the polymesh in the 'M' direction.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the matrix of points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 47)))
    (vlax-safearray-fill points '(2 2 1
                  2.5 2 0
                  5 2 0
                  5.5 2 1
                  2 4 0.5
                  2.5 4 0
                  5 4 0
                  5.5 4 0.5
                  2 6 0.5
                  2.5 6 0
                  5 6 0
                  5.5 6 0.5
                  2 8 1
                  2.5 8 0
                  5 8 0
                  5.5 8 1
                 )
    )

    (setq mSize 4
          nSize 4)

    ;; Create a 3Dmesh in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq meshObj (vla-Add3DMesh modelSpace mSize nSize points))

    ;; Change the viewing direction of the viewport to better see the cylinder
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)

    ;; Close the polymesh in the 'M' direction
    (alert (strcat "The polymesh is " (if (= (vla-get-MClose meshObj) :vlax-true) "closed" "open") " in the 'M' direction."))
    (vla-put-MClose meshObj :vlax-true)
    (vla-Regen doc acActiveViewport)
    (alert (strcat "The polymesh is " (if (= (vla-get-MClose meshObj) :vlax-true) "closed" "open") " in the 'M' direction."))
)


MDensity Property (ActiveX)

Specifies the surface density of a PolygonMesh in the M direction.

Supported platforms: Windows only

Signature

VBA:

object.MDensity
object

Type: PolygonMesh

The object this property applies to.

Property Value

Read-only: No

Type: Integer

An integer value between 2 and 256.

Remarks

The M surface density is the number of vertices in the M direction for PolygonMesh objects that are of the following types: acQuadSurfaceMesh, acCubicSurfaceMesh, or acBezierSurfaceMesh.

The initial value for this property is derived from the value in the SURFU system variable + 1. Therefore, if the current value of SURFU is 6, the MDensity for a mesh after a surface fit operation would be 7. To perform a surface fit operation on a mesh, change the mesh type using the Type property.

Examples

VBA:

Sub Example_MDensity()
    ' This example creates a 4 X 4 polygonmesh in model space.
    ' It then changes the type of polymesh, and finds the
    ' number of points in the 'M' direction.
    Dim meshObj As AcadPolygonMesh
    Dim mSize, nSize, count As Integer
    Dim points(0 To 47) As Double

    ' Create the matrix of points
    points(0) = 0: points(1) = 0: points(2) = 0
    points(3) = 2: points(4) = 0: points(5) = 1
    points(6) = 4: points(7) = 0: points(8) = 0
    points(9) = 6: points(10) = 0: points(11) = 1
    points(12) = 0: points(13) = 2: points(14) = 0
    points(15) = 2: points(16) = 2: points(17) = 1
    points(18) = 4: points(19) = 2: points(20) = 0
    points(21) = 6: points(22) = 2: points(23) = 1
    points(24) = 0: points(25) = 4: points(26) = 0
    points(27) = 2: points(28) = 4: points(29) = 1
    points(30) = 4: points(31) = 4: points(32) = 0
    points(33) = 6: points(34) = 4: points(35) = 0
    points(36) = 0: points(37) = 6: points(38) = 0
    points(39) = 2: points(40) = 6: points(41) = 1
    points(42) = 4: points(43) = 6: points(44) = 0
    points(45) = 6: points(46) = 6: points(47) = 0

    mSize = 4: nSize = 4

    ' Create a 3Dmesh in model space
    Set meshObj = ThisDrawing.ModelSpace.Add3DMesh(mSize, nSize, points)

    ' Change the viewing direction of the viewport to better see the polymesh
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

    ' Change the type of mesh. (MDensity is not valid for acSimpleMesh type.)
    meshObj.Type = acQuadSurfaceMesh
    meshObj.Update
    ThisDrawing.Regen acActiveViewport

    ' Find the MDensity for the mesh
    Dim currDensity As Integer
    currDensity = meshObj.MDensity
    MsgBox "The MDensity for the mesh is " & meshObj.MDensity, , "MDensity Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MDensity()
    ;; This example creates a 4 X 4 polygonmesh in model space.
    ;; It then changes the type of polymesh, and finds the
    ;; number of points in the 'M' direction.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the matrix of points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 47)))
    (vlax-safearray-fill points '(0 0 0
                  2 0 1
                  4 0 0
                  6 0 1
                  0 2 0
                  2 2 1
                  4 2 0
                  6 2 1
                  0 4 0
                  2 4 1
                  4 4 0
                  6 4 0
                  0 6 0
                  2 6 1
                  4 6 0
                  6 6 0
                 )
    )

    (setq mSize 4
          nSize 4)

    ;; Create a 3Dmesh in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq meshObj (vla-Add3DMesh modelSpace mSize nSize points))

    ;; Change the viewing direction of the viewport to better see the polymesh
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)

    ;; Change the type of mesh. (MDensity is not valid for acSimpleMesh type.)
    (vla-put-Type meshObj acQuadSurfaceMesh)
    (vla-Update meshObj)
    (vla-Regen doc acActiveViewport)

    ;; Find the MDensity for the mesh
    (setq currDensity (vla-get-MDensity meshObj))
    (alert (strcat "The MDensity for the mesh is " (itoa currDensity)))
)


Measurement Property (ActiveX)

Gets the measurement for the dimension.

Supported platforms: Windows only

Signature

VBA:

object.Measurement
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: Yes

Type: Double

For linear dimensions this is a length, for angular dimensions it is an angle.

Remarks

For non-angular dimensions, this property overrides the value for the DIMLUNIT system variable.

For angular dimension, this property overrides the value for the DIMAUNIT system variable.

Examples

VBA:

Sub Example_Measurement()
    ' This example creates an aligned dimension in model space
    ' and returns the measurement of the dimension; in the case
    ' of a linear dimension, this measurement will be its length

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim CurrentValue As String

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 9: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ThisDrawing.Application.ZoomAll

    ' Read and display current measurement
    MsgBox "The current measurement of the new dimension is: " & dimObj.Measurement
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Measurement()
    ;; This example creates an aligned dimension in model space
    ;; and returns the measurement of the dimension; in the case
    ;; of a linear dimension, this measurement will be its length
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 9 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    ;; Read and display current measurement
    (alert (strcat "The current measurement of the new dimension is: " (rtos (vla-get-Measurement dimObj) 2)))
)


MenuBar Property (ActiveX)

Gets the MenuBar object for the session.

Supported platforms: Windows only

Signature

VBA:

object.MenuBar
object

Type: Application

The object this property applies to.

Property Value

Read-only: Yes

Type: MenuBar

The MenuBar object for the session.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_MenuBar()
    ' This example uses MenuBar to obtain a reference to the AutoCAD File menu.
    ' It then creates a new menu item and inserts it at the bottom of the File menu.
    '
    ' The menu item will be automatically removed when AutoCAD is restarted

    Dim menu As AcadPopupMenu, newMenuItem As AcadPopupMenuItem
    Dim openMacro As String

    On Error GoTo ERRORTRAP

    ' Use MenuBar property to obtain reference to the AutoCAD File menu
    Set menu = ThisDrawing.Application.MenuBar.Item("&File")

    ' Add a menu item to the new menu and
    ' assign an Open macro (VBA equivalent of: "ESC ESC _open ")
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    ' Add a menu separator
    menu.AddSeparator (menu.count + 1)

    ' Add new menu item to File menu
    Set newMenuItem = menu.AddMenuItem(menu.count + 1, "NEW MENU ITEM", openMacro)

    MsgBox "A new menu item has been added to the File menu!"

    Exit Sub

ERRORTRAP:
    MsgBox "The following error has occurred: " & Err.Description

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MenuBar()
    ;; This example uses MenuBar to obtain a reference to the AutoCAD File menu.
    ;; It then creates a new menu item and inserts it at the bottom of the File menu.
    ;;
    ;; The menu item will be automatically removed when AutoCAD is restarted
    (setq acadObj (vlax-get-acad-object))

    ;; Use MenuBar property to obtain reference to the AutoCAD File menu
    (setq menu (vla-Item (vla-get-MenuBar acadObj) "&File"))

    ;; Add a menu item to the new menu and
    ;; assign an Open macro (VBA equivalent of: "ESC ESC _open ")
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))

    ;; Add a menu separator
    (vla-AddSeparator menu (1+ (vla-get-Count menu)))

    ;; Add new menu item to File menu
    (setq newMenuItem (vla-AddMenuItem menu (1+ (vla-get-Count menu)) "Open File" openMacro))

    (alert "A new menu item has been added to the File menu!")
)


MenuFile Property (ActiveX)

Specifies the location of the AutoCAD customization file for the session.

Supported platforms: Windows only

Signature

VBA:

object.MenuFile
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The location of the AutoCAD customization file.

Remarks

This property contains the drive, path, and file name for a customization (CUIx) file.

Examples

VBA:

Sub Example_MenuFile()
    ' This example returns the current setting of
    ' MenuFile.

    Dim preferences As AcadPreferences
    Dim currMenuFile As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current MenuFile value
    currMenuFile = preferences.Files.MenuFile
    MsgBox "The current value for MenuFile is " & currMenuFile, vbInformation, "MenuFile Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MenuFile()
    ;; This example returns the current setting of
    ;; MenuFile.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current MenuFile value
    (setq currMenuFile (vla-get-MenuFile (vla-get-Files preferences)))
    (alert (strcat "The current value for MenuFile is " currMenuFile))
)


MenuFileName Property (ActiveX)

Gets the customization file name where the menu group is located.

Supported platforms: Windows only

Signature

VBA:

object.MenuFileName
object

Type: MenuGroup

The object this property applies to.

Property Value

Read-only: Yes

Type: String

A user-specified variable declared as a string type.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_MenuFileName()
    ' This example finds the file name for all loaded menu groups.

    Dim fileNames As String
    Dim menuGroup As acadMenuGroup

    fileNames = ""
    For Each menuGroup In ThisDrawing.Application.MenuGroups
        fileNames = fileNames & menuGroup.name & "  " & menuGroup.MenuFileName & vbCrLf
    Next menuGroup
    MsgBox fileNames
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MenuFileName()
    ;; This example finds the file name for all loaded menu groups.
    (setq acadObj (vlax-get-acad-object))

    (setq fileNames "")
    (vlax-for mnuGroup (vla-get-MenuGroups acadObj)
        (setq fileNames (strcat fileNames (vla-get-Name mnuGroup) "  " (vla-get-MenuFileName mnuGroup) "\n"))
    )
    (alert fileNames)
)


MenuGroups Property (ActiveX)

Gets the MenuGroups collection for the session.

Supported platforms: Windows only

Signature

VBA:

object.MenuGroups
object

Type: Application

The object this property applies to.

Property Value

Read-only: Yes

Type: MenuGroups

The MenuGroups collection for the session.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_MenuGroups()
    ' This example uses MenuGroups to obtain a reference to the AutoCAD main menu.
    ' It then creates a new menu called TestMenu and inserts a menu item
    ' into it. The menu is then displayed on the menu bar.
    '
    ' The menu item will be automatically removed when AutoCAD is restarted

    Dim currMenuGroup As acadMenuGroup
    Dim newMenu As AcadPopupMenu, newMenuItem As AcadPopupMenuItem
    Dim openMacro As String

    On Error GoTo ERRORTRAP

    ' Use MenuGroups property to obtain reference to main AutoCAD menu
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item("ACAD")

    ' Create the new menu in this group
    Set newMenu = currMenuGroup.Menus.Add("TestMenu")

    ' Add a menu item to the new menu and
    ' assign an Open macro (VBA equivalent of: "ESC ESC _open ")
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set newMenuItem = newMenu.AddMenuItem(newMenu.count + 1, "Open", openMacro)

    ' Display the menu on the menu bar
    newMenu.InsertInMenuBar (ThisDrawing.Application.MenuBar.count + 1)

    MsgBox "A new menu has been added to the ACAD menu system!"

    Exit Sub

ERRORTRAP:
    MsgBox "The following error has occurred: " & Err.Description
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MenuGroups()
    ;; This example uses MenuGroups to obtain a reference to the AutoCAD main menu.
    ;; It then creates a new menu called TestMenu and inserts a menu item
    ;; into it. The menu is then displayed on the menu bar.
    ;;
    ;; The menu item will be automatically removed when AutoCAD is restarted
    (setq acadObj (vlax-get-acad-object))

    ;; Use MenuGroups property to obtain reference to main AutoCAD menu
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) "ACAD"))

    ;; Create the new menu in this group
    (setq newMenu (vla-Add (vla-get-Menus currMenuGroup) "TestMenu"))

    ;; Add a menu item to the new menu and
    ;; assign an Open macro (VBA equivalent of: "ESC ESC _open ")
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))
    (setq newMenuItem (vla-AddMenuItem newMenu (1+ (vla-get-Count newMenu)) "Open" openMacro))

    ;; Display the menu on the menu bar
    (vla-InsertInMenuBar newMenu (1+ (vla-get-Count (vla-get-MenuBar acadObj))))

    (alert "A new menu has been added to the ACAD menu system!")
)


Menus Property (ActiveX)

Gets the PopupMenus collection.

Supported platforms: Windows only

Signature

VBA:

object.Menus
object

Type: MenuGroup

The object this property applies to.

Property Value

Read-only: Yes

Type: PopupMenus

A user-specified variable declared as a PopupMenus collection.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Menus()
    ' This example finds the names of all menus in the first menu group.

    Dim menuNames As String
    Dim menuCollection As AcadPopupMenus
    Dim menu As AcadPopupMenu

    Set menuCollection = ThisDrawing.Application.MenuGroups.Item(0).Menus
    menuNames = ""
    For Each menu In menuCollection
        menuNames = menuNames & menu.name & vbCrLf
    Next menu
    MsgBox menuNames
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Menus()
    ;; This example finds the names of all menus in the first menu group.
    (setq acadObj (vlax-get-acad-object))

    (setq menuCollection (vla-get-Menus (vla-Item (vla-get-MenuGroups acadObj) 0))
          menuNames "")

    (vlax-for menu menuCollection
        (setq menuNames (strcat menuNames (vla-get-Name menu) "\n"))
    )

    (alert menuNames)
)


MinimumTableHeight Property (ActiveX)

Specifies the minimum height of the table.

Supported platforms: Windows only

Signature

VBA:

object.MinimumTableHeight
object

Type: Table

The object this property applies to.

Property Value

Read-only: Yes

Type: Double

The minimum height of the table.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


MinimumTableWidth Property (ActiveX)

Specifies the minimum width of the table.

Supported platforms: Windows only

Signature

VBA:

object.MinimumTableWidth
object

Type: Table

The object this property applies to.

Property Value

Read-only: Yes

Type: Double

The minimum width of the table.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


MinorAxis Property (ActiveX)

Specifies the direction of the minor axis of an ellipse.

Supported platforms: Windows only

Signature

VBA:

object.MinorAxis
object

Type: Ellipse

The object this property applies to.

Property Value

Read-only: Yes

Type: Variant (three-element array of doubles)

A 3D vector defining the minor axis. The vector originates at the ellipse center.

Remarks

The longer axis of an ellipse is called the major axis; the shorter one is the minor axis.

Examples

VBA:

Sub Example_MinorAxis()
    ' This example creates an ellipse and returns the minor
    ' axis for that ellipse.
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double

    ' Create an ellipse in model space
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)
    ZoomAll

    ' Find the minor axis for the ellipse
    Dim minorAxis As Variant
    minorAxis = ellObj.minorAxis
    MsgBox "The ellipse has a minor axis of " & minorAxis(0) & ", " & minorAxis(1) & ", " & minorAxis(2), vbInformation, "MinorAxis Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MinorAxis()
    ;; This example creates an ellipse and returns the minor
    ;; axis for that ellipse.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create an ellipse in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))
    (vla-ZoomAll acadObj)

    ;; Find the minor axis for the ellipse
    (setq minorAxis (vlax-variant-value (vla-get-MinorAxis ellObj)))
    (alert (strcat "The ellipse has a minor axis of " (rtos (vlax-safearray-get-element minorAxis 0) 2) ", "
                                                      (rtos (vlax-safearray-get-element minorAxis 1) 2) ", "
                                                      (rtos (vlax-safearray-get-element minorAxis 2) 2)))
)


MinorRadius Property (ActiveX)

Specifies the length of the minor axis of the ellipse.

Supported platforms: Windows only

Signature

VBA:

object.MinorRadius
object

Type: Ellipse

The object this property applies to.

Property Value

Read-only: No

Type: Double

The length of the minor axis for an ellipse.

Remarks

The longer axis of an ellipse is called the major axis; the shorter one is the minor axis.

Examples

VBA:

Sub Example_MinorRadius()
    ' This example creates an Ellipse in model space and displays
    ' both the Major radius and the Minor radius of the new Ellipse

    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double, center(0 To 2) As Double
    Dim radRatio As Double

    ' Create an ellipse in model space
    center(0) = 5: center(1) = 5: center(2) = 0
    majAxis(0) = 10: majAxis(1) = 20: majAxis(2) = 0
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    ThisDrawing.Application.ZoomAll

    ' Display radius information
    MsgBox "The major radius of the new Ellipse is: " & ellObj.majorRadius & vbCrLf & _
           "The minor radius of the new Ellipse is: " & ellObj.minorRadius
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MinorRadius()
    ;; This example creates an Ellipse in model space and displays
    ;; both the Major radius and the Minor radius of the new Ellipse
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create an ellipse in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

    (vla-ZoomAll acadObj)

    ;; Display radius information
    (alert (strcat "The major radius of the new Ellipse is: " (rtos (vla-get-majorRadius ellObj) 2)
                   "\nThe minor radius of the new Ellipse is: " (rtos (vla-get-minorRadius ellObj) 2)))
)


MLineScale Property (ActiveX)

Specifies the scale of the MLine.

Supported platforms: Windows only

Signature

VBA:

object.MLineScale
object

Type: MLine

The object to which this property applies.

Property Value

Read-only: No

Type: Double

The scale of the MLine.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Mode Property (ActiveX)

Specifies the mode of the attribute definition.

Supported platforms: Windows only

Signature

VBA:

object.Mode
object

Type: Attribute

The object this property applies to.

Property Value

Read-only: No

Type: acAttributeMode enum

  • acAttributeModeNormal: Specifies that the current visibility of each attribute is retained.
  • acAttributeModeInvisible: Specifies that attribute values won't be shown when you insert the block. The ATTDISP command overrides Invisible mode.
  • acAttributeModeConstant: Gives attributes a fixed value for block insertions.
  • acAttributeModeVerify: Prompts you to verify that the attribute value is correct when you insert the block.
  • acAttributeModeLockPosition: Locks the position of the attributes.
  • acAttributeModeMultipleLine: Allows the attributes to carry-over onto multiple lines.
  • acAttributeModePreset: Sets the attribute to its default value when you insert a block containing a preset attribute.

Remarks

NoteThe value of this property is stored in the AFLAGS system variable.

Examples

VBA:

Sub Example_Mode()
    ' This example creates an attribute definition in model space.
    ' It then queries the initial value of the Mode property,
    ' changes that value, and finally resets the value.

    Dim attributeObj As AcadAttribute
    Dim height As Double
    Dim mode As Long
    Dim prompt As String
    Dim insertionPoint(0 To 2) As Double
    Dim tag As String
    Dim value As String

    ' Define the attribute definition
    height = 1#
    mode = acAttributeModeVerify
    prompt = "New Prompt"
    insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0
    tag = "New_Tag"
    value = "New Value"

    ' Create the attribute definition object in model space
    Set attributeObj = ThisDrawing.ModelSpace.AddAttribute(height, mode, prompt, insertionPoint, tag, value)
    ZoomAll

    ' Return the current field length of the attribute
    Dim currMode As Integer
    Dim constant As String
    currMode = attributeObj.mode
    GoSub GETCONSTANT
    MsgBox "The Mode of the attribute is " & constant, vbInformation, "Mode Example"

    ' Change the field length
    attributeObj.mode = acAttributeModeInvisible
    GoSub GETCONSTANT
    attributeObj.Update
    MsgBox "The new Mode of the attribute is " & constant, vbInformation, "Mode Example"

    ' Reset the field length to the original value
    attributeObj.mode = currMode
    GoSub GETCONSTANT
    attributeObj.Update
    MsgBox "The Mode of the attribute is reset to " & constant, vbInformation, "Mode Example"
    Exit Sub

GETCONSTANT:
    ' Get the constant that corresponds to the current mode
    constant = Choose(attributeObj.mode, "acAttributeModeInvisible", "acAttributeModeConstant", "", "acAttributeModeVerify", "", "", "", "acAttributeModePreset")
    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Mode()
    ;; This example creates an attribute definition in model space.
    ;; It then queries the initial value of the Mode property,
    ;; changes that value, and finally resets the value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the attribute definition
    (setq insertionPoint (vlax-3d-point 5 5 0)
          attHeight 1
          attMode acAttributeModeVerify
          attPrompt "New Prompt"
          attTag "NEW_TAG"
          attValue "New Value")

    ;; Create the attribute definition object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq attributeObj (vla-AddAttribute modelSpace attHeight attMode attPrompt insertionPoint attTag attValue))
    (vla-ZoomAll acadObj)

    ;; Return the current field length of the attribute
    (setq currMode (vla-get-Mode attributeObj))

    ;; Get the constant that corresponds to the current mode
    (setq constant (cond
                       ((= (vla-get-Mode attributeObj) 0) "acAttributeModeNormal")
                       ((= (vla-get-Mode attributeObj) 1) "acAttributeModeInvisible")
                       ((= (vla-get-Mode attributeObj) 2) "acAttributeModeConstant")
                       ((= (vla-get-Mode attributeObj) 4) "acAttributeModeVerify")
                       ((= (vla-get-Mode attributeObj) 8) "acAttributeModePreset")
                   ))

    (alert (strcat "The Mode of the attribute is " constant))

    ;; Change the field length
    (vla-put-Mode attributeObj acAttributeModeInvisible)

    (setq constant (cond
                       ((= (vla-get-Mode attributeObj) 0) "acAttributeModeNormal")
                       ((= (vla-get-Mode attributeObj) 1) "acAttributeModeInvisible")
                       ((= (vla-get-Mode attributeObj) 2) "acAttributeModeConstant")
                       ((= (vla-get-Mode attributeObj) 4) "acAttributeModeVerify")
                       ((= (vla-get-Mode attributeObj) 8) "acAttributeModePreset")
                   ))

    (vla-Update attributeObj)
    (alert (strcat "The new Mode of the attribute is " constant))

    ;; Reset the field length to the original value
    (vla-put-Mode attributeObj currMode)
    (setq constant (cond
                       ((= (vla-get-Mode attributeObj) 0) "acAttributeModeNormal")
                       ((= (vla-get-Mode attributeObj) 1) "acAttributeModeInvisible")
                       ((= (vla-get-Mode attributeObj) 2) "acAttributeModeConstant")
                       ((= (vla-get-Mode attributeObj) 4) "acAttributeModeVerify")
                       ((= (vla-get-Mode attributeObj) 8) "acAttributeModePreset")
                   ))

    (vla-Update attributeObj)
    (alert (strcat "The Mode of the attribute is reset to " constant))
)


ModelCrosshairColor Property (ActiveX)

Specifies the color of the crosshairs and text for model space.

Supported platforms: Windows only

Signature

VBA:

object.ModelCrosshairColor
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: OLE_COLOR (constant)

  • vbBlack
  • vbRed
  • vbYellow
  • vbGreen
  • vbCyan
  • vbBlue
  • vbMagenta
  • vbWhite

Remarks

The initial value of this property is vbWhite.

To specify the crosshair color for the paper space layouts, use the LayoutCrosshairColor property.

Examples

VBA:

Sub Example_ModelCrossHairColor()
    ' This example returns the current setting of
    ' Model space CrossHairColor. It then changes the value, and
    ' finally resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currCrossHairColor As OLE_COLOR

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current CrossHairColor value
    currCrossHairColor = preferences.DISPLAY.ModelCrosshairColor
    MsgBox "The current value for the model space CrossHairColor is " & preferences.DISPLAY.ModelCrosshairColor, vbInformation, "CrossHairColor Example"

    ' Change the value for CrossHairColor
    preferences.DISPLAY.ModelCrosshairColor = vbGreen
    MsgBox "The new value for CrossHairColor is " & preferences.DISPLAY.ModelCrosshairColor, vbInformation, "CrossHairColor Example"

    ' Reset CrossHairColor to its original value
    preferences.DISPLAY.ModelCrosshairColor = currCrossHairColor
    MsgBox "The CrossHairColor value is reset to " & preferences.DISPLAY.ModelCrosshairColor, vbInformation, "CrossHairColor Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ModelCrossHairColor()
    ;; This example returns the current setting of
    ;; Model space CrossHairColor. It then changes the value, and
    ;; finally resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the Display preferences object
    (setq ACADPref (vla-get-Display preferences))

    ;; Retrieve the current CrossHairColor value
    (setq currCrossHairColor (vlax-variant-change-type (vla-get-ModelCrosshairColor ACADPref) vlax-vbLong))
    (alert (strcat "The current value for the model space CrossHairColor is " (itoa (vlax-variant-value currCrossHairColor))))

    ;; Change the value for CrossHairColor
    (vla-put-ModelCrosshairColor ACADPref (vlax-make-variant acGreen 19))
    (setq newValue (vlax-variant-change-type (vla-get-ModelCrosshairColor ACADPref) vlax-vbLong))
    (alert (strcat "The new value for CrossHairColor is " (itoa (vlax-variant-value newValue))))

    ;; Reset CrossHairColor to its original value
    (vla-put-ModelCrosshairColor ACADPref (vlax-variant-change-type currCrossHairColor 19))
    (alert (strcat "The CrossHairColor value is reset to " (itoa (vlax-variant-value currCrossHairColor))))
)


ModelSpace Property (ActiveX)

Gets the ModelSpace collection for the document.

Supported platforms: Windows only

Signature

VBA:

object.ModelSpace
object

Type: Database, Document

The object this property applies to.

Property Value

Read-only: Yes

Type: ModelSpace

The ModelSpace collection for the document.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ModelSpace()
    ' This example adds a line and a circle to model space.
    ' The line is added using a user-defined variable representing
    ' the model space. The circle is added without using the
    ' user-defined variable. Either use of the ModelSpace
    ' property is valid.

    ' Define the line
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 4: endPoint(1) = 4: endPoint(2) = 0

    ' Add the line to model space using the mspace variable
    Dim mspace As AcadModelSpace
    Set mspace = ThisDrawing.ModelSpace
    Set lineObj = mspace.AddLine(startPoint, endPoint)

    ' Define a circle
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 4: center(1) = 4: center(2) = 0
    radius = 1

    ' Add the circle to model space without using the mspace variable
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, radius)

    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ModelSpace()
    ;; This example adds a line and a circle to model space.
    ;; The line is added using a user-defined variable representing
    ;; the model space. The circle is added without using the
    ;; user-defined variable. Either use of the ModelSpace
    ;; property is valid.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the line
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 4 4 0))

    ;; Add the line to model space using the mspace variable
    (setq mspace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine mspace startPoint endPoint))

    ;; Define a circle
    (setq center (vlax-3d-point 4 4 0)
          radius 1)

    ;; Add the circle to model space without using the mspace variable
    (setq circleObj (vla-AddCircle mspace center radius))

    (vla-ZoomAll acadObj)
)


ModelType Property (ActiveX)

Specifies whether a plot configuration applies to model space or to all layouts.

Supported platforms: Windows only

Signature

VBA:

object.ModelType
object

Type: Layout, PlotConfiguration

The objects this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: The plot configuration applies only to the Model Space tab, or the layout is the model space layout.
  • False: The plot configuration applies to all layouts, or the layout is a paper space layout.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ModelType()
    ' This example creates a plot configuration object
    ' and then finds the ModelType for the object.

    Dim PlotConfigObj As AcadPlotConfiguration

    ' Creates the MText Object
    Set PlotConfigObj = ThisDrawing.PlotConfigurations.Add("NewPlotConfiguration")

    ' Find the current ModelType
    Dim currModelType As Boolean
    currModelType = PlotConfigObj.ModelType
    MsgBox "The ModelType for the object is: " & currModelType

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ModelType()
    ;; This example creates a plot configuration object
    ;; and then finds the ModelType for the object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Creates the MText Object
    (setq PlotConfigObj (vla-Add (vla-get-PlotConfigurations doc) "NewPlotConfiguration"))

    ;; Find the current ModelType
    (setq currModelType (vla-get-ModelType PlotConfigObj))
    (alert (strcat "The ModelType for the object is: " (if (= currModelType :vlax-true) "True" "False")))
)


ModelView Property (ActiveX)

Returns and sets the model view associated with the viewport.

Supported platforms: Windows only

Signature

VBA:

object.ModelView
object

Type: PViewport

The object this property applies to.

Property Value

Read-only: No

Type: View

The model view associated with the viewport.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


MomentOfInertia Property (ActiveX)

Gets the moment of inertia for the solid.

Supported platforms: Windows only

Signature

VBA:

object.MomentOfInertia
object

Type: 3DSolid, Region

The objects this property applies to.

Property Value

Read-only: Yes

Type: Variant (three-element array of doubles)

A 3D coordinate based on the current coordinate system.

Remarks

The moment of inertia is returned as X, Y, and Z coordinates defined as a variant.

Examples

VBA:

Sub Example_MomentOfInertia()
    ' This example creates a box in model space.
    ' It then returns the MomentOfInertia for that box.

    Dim boxObj As Acad3DSolid
    Dim length As Double, width As Double, height As Double
    Dim center(0 To 2) As Double

    ' Define the box
    center(0) = 5#: center(1) = 5#: center(2) = 0
    length = 5#: width = 7: height = 10#

    ' Create the box (3DSolid) object in model space
    Set boxObj = ThisDrawing.ModelSpace.AddBox(center, length, width, height)

    ' Change the viewing direction of the viewport to better see the box
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

    ' Return the MomentOfInertia for the box
    Dim momentOfInertia As Variant
    momentOfInertia = boxObj.momentOfInertia
    MsgBox "The MomentOfInertia for the box is " & momentOfInertia(0) & ", " & momentOfInertia(1) & ", " & momentOfInertia(2), , "MomentOfInertia Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MomentOfInertia()
    ;; This example creates a box in model space.
    ;; It then returns the MomentOfInertia for that box.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the box
    (setq center (vlax-3d-point 5 5 0)
          boxLength 5
      boxWidth 7
      boxHeight 10)

    ;; Create the box (3DSolid) object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq boxObj (vla-AddBox modelSpace center boxLength boxWidth boxHeight))

    ;; Change the viewing direction of the viewport to better see the box
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)

    ;; Return the MomentOfInertia for the box
    (setq momentOfInertia (vlax-variant-value (vla-get-MomentOfInertia boxObj)))
    (alert (strcat "The MomentOfInertia for the box is " (rtos (vlax-safearray-get-element momentOfInertia 0) 2) ", "
                                                         (rtos (vlax-safearray-get-element momentOfInertia 1) 2) ", "
                                                         (rtos (vlax-safearray-get-element momentOfInertia 2) 2)))
)


Monochrome Property (ActiveX)

Determines whether underlay is monochrome.

Supported platforms: Windows only

Signature

VBA:

object.Monochrome
object

Type: DgnUnderlay, DwfUnderlay, PdfUnderlay

The object to which this property applies.

Property Value

Read-only: No

Type: Boolean

  • True: The underlay is displayed in monochrome.
  • False: The underlay is not displayed in monochrome.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


MRUNumber Property (ActiveX)

Specifies the number of most recently used files that is shown in the File menu.

Supported platforms: Windows only

Signature

VBA:

object.MRUNumber
object

Type: PreferencesOpenSave

The object this property applies to.

Property Value

Read-only: Yes

Type: Long

The number of most recently used files that is shown in the File menu.

Remarks

The default value for this property is 4.

Examples

VBA:

Sub Example_MRUNumber()
    ' This example reads the preference value containing
    ' the number of most recently used files that are shown in the File menu.

    Dim ACADPref As AcadPreferencesOpenSave
    Dim originalValue As Variant

    ' Get the OpenSave preferences object
    Set ACADPref = ThisDrawing.Application.preferences.OpenSave

    ' Read and display the preference value
    originalValue = ACADPref.MRUNumber
    MsgBox "The number of most recently used files that are shown is: " & originalValue

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MRUNumber()
    ;; This example reads the preference value containing
    ;; the number of most recently used files that are shown in the File menu.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the OpenSave preferences object
    (setq ACADPref (vla-get-OpenSave preferences))

    ;; Read and display the preference value
    (setq originalValue (vla-get-MRUNumber ACADPref))
    (alert (strcat "The number of most recently used files that are shown is: " (itoa originalValue)))
)


MSpace Property (ActiveX)

Allows editing of the model from floating paper space viewports.

Supported platforms: Windows only

Signature

VBA:

object.MSpace
object

Type: Document

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Allows editing of the model.
  • False: Does not allow editing of the model.

Remarks

AutoCAD operates in either model space or paper space. Use model space for drafting and design work and to create 2D drawings or 3D models. Use paper space to create a finished layout of a drawing for printing or plotting.

NoteBefore using the MSpace property, the ActiveSpace property must be set to acPaperSpace, and the display control of the PViewport object must be switched on by the Display property.

Examples

VBA:

Sub Example_MSpace()
    ' This example creates a new paper space viewport.
    ' It then toggles the ability to edit in model space using
    ' the MSpace property.

    Dim pviewportObj As AcadPViewport
    Dim center(0 To 2) As Double
    Dim width As Double
    Dim height As Double

    ' Define the paper space viewport
    center(0) = 3: center(1) = 3: center(2) = 0
    width = 40
    height = 40

    ' Change from model space to paperspace
    ThisDrawing.ActiveSpace = acPaperSpace

    ' Create the paper space viewport
    Set pviewportObj = ThisDrawing.PaperSpace.AddPViewport(center, width, height)
    pviewportObj.DISPLAY True
    ThisDrawing.mspace = True
    ThisDrawing.ActivePViewport = pviewportObj
    ThisDrawing.Regen acAllViewports

    ' Find the current MSpace value
    MsgBox "The ability to edit model space from this PViewport is " & IIf(ThisDrawing.mspace, "on.", "off."), , "MSpace Example"

    ' Toggle the setting of MSpace
    ThisDrawing.mspace = False
    MsgBox "The ability to edit model space from this PViewport is now " & IIf(ThisDrawing.mspace, "on.", "off."), , "MSpace Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MSpace()
    ;; This example creates a new paper space viewport.
    ;; It then toggles the ability to edit in model space using
    ;; the MSpace property.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the paper space viewport
    (setq center (vlax-3d-point 3 3 0)
          width 40
          height 40)

    ;; Change from model space to paperspace
    (vla-put-ActiveSpace doc acPaperSpace)

    ;; Create the paper space viewport
    (setq paperSpace (vla-get-PaperSpace doc))
    (setq pviewportObj (vla-AddPViewport paperSpace center width height))

    (vla-Display pviewportObj :vlax-true)
    (vla-put-MSpace doc :vlax-true)
    (vla-put-ActivePViewport doc pviewportObj)
    (vla-Regen doc acAllViewports)

    ;; Find the current MSpace value
    (alert (strcat "The ability to edit model space from this PViewport is " (if (= (vla-get-MSpace doc) :vlax-true) "on." "off.")))

    ;; Toggle the setting of MSpace
    (vla-put-MSpace doc :vlax-false)
    (alert (strcat "The ability to edit model space from this PViewport is now " (if (= (vla-get-MSpace doc) :vlax-true) "on." "off.")))
)


MTextAttribute Property (ActiveX)

Determines if the attribute is multiline.

Supported platforms: Windows only

Signature

VBA:

object.MTextAttribute
object

Type: Attribute, AttributeReference

The object this method applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The attribute is multiline.
  • False: The attribute is single-line.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_AddAttribute()
    ' This example creates an attribute definition in model space.

    Dim attributeObj As AcadAttribute
    Dim height As Double
    Dim mode As Long
    Dim prompt As String
    Dim insertionPoint(0 To 2) As Double
    Dim tag As String
    Dim value As String

    ' Define the attribute definition
    height = 1#
    mode = acAttributeModeVerify
    prompt = "New Prompt"
    insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0
    tag = "NEW_TAG"
    value = "New Value"

    ' Create the attribute definition object in model space
    Set attributeObj = ThisDrawing.ModelSpace.AddAttribute(height, mode, prompt, insertionPoint, tag, value)
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddAttribute()
    ;; This example creates an attribute definition in model space.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the attribute definition
    (setq insertionPoint (vlax-3d-point 5 5 0)
          attHeight 1
          attMode acAttributeModeVerify
          attPrompt "New Prompt"
          attTag "NEW_TAG"
          attValue "New Value")

    ;; Create the attribute definition object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq attributeObj (vla-AddAttribute modelSpace attHeight attMode attPrompt insertionPoint attTag attValue))
    (vla-ZoomAll acadObj)
)


MTextAttributeContent Property (ActiveX)

Gets the multiline attribute content.

Supported platforms: Windows only

Signature

VBA:

object.MTextAttributeContent
object

Type: Attribute, AttributeReference

The object this method applies to.

Property Value

Read-only: No

Type: String

The content of the attribute.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_MTextAttribute()
    ' This example creates an attribute definition in model space.
    ' It then manipulates its MText properties

    Dim attributeObj As IAcadAttribute
    Dim height As Double
    Dim mode As Long
    Dim prompt As String
    Dim insertionPoint(0 To 2) As Double
    Dim tag As String
    Dim value As String

    ' Define the attribute definition
    height = 1.4
    mode = acAttributeModeVerify
    prompt = "New Prompt"
    insertionPoint(0) = 5.2: insertionPoint(1) = 5.7: insertionPoint(2) = 0
    tag = "NEW_TAG"
    value = "New Value"

    ' Create the attribute definition object in model space
    Set attributeObj = ThisDrawing.ModelSpace.AddAttribute(height, mode, prompt, insertionPoint, tag, value)

    attributeObj.MTextAttribute = True
    attributeObj.MTextAttributeContent = "test content"
    attributeObj.MTextBoundaryWidth = 4.2
    attributeObj.UpdateMTextAttribute
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MTextAttribute()
    ;; This example creates an attribute definition in model space.
    ;; It then manipulates its MText properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the attribute definition
    (setq insertionPoint (vlax-3d-point 5.2 5.7 0)
          attHeight 1.4
          attMode (+ acAttributeModeVerify acAttributeModeMultipleLine)
          attPrompt "New Prompt"
          attTag "NEW_TAG"
          attValue "New Value")

    ;; Create the attribute definition object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq attributeObj (vla-AddAttribute modelSpace attHeight attMode attPrompt insertionPoint attTag attValue))

    (vla-put-MTextAttributeContent attributeObj "test content")
    (vla-put-MTextBoundaryWidth attributeObj 4.2)
    (vla-UpdateMTextAttribute attributeObj)
    (vla-ZoomAll acadObj)
)


MTextBoundaryWidth Property (ActiveX)

Determines the width of the text boundary for the multiline attribute.

Supported platforms: Windows only

Signature

VBA:

object.MTextBoundaryWidth
object

Type: Attribute, AttributeReference

The object this method applies to.

Property Value

Read-only: No

Type: Double

The width of the text boundary.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_MTextAttribute()
    ' This example creates an attribute definition in model space.
    ' It then manipulates its MText properties

    Dim attributeObj As IAcadAttribute
    Dim height As Double
    Dim mode As Long
    Dim prompt As String
    Dim insertionPoint(0 To 2) As Double
    Dim tag As String
    Dim value As String

    ' Define the attribute definition
    height = 1.4
    mode = acAttributeModeVerify
    prompt = "New Prompt"
    insertionPoint(0) = 5.2: insertionPoint(1) = 5.7: insertionPoint(2) = 0
    tag = "NEW_TAG"
    value = "New Value"

    ' Create the attribute definition object in model space
    Set attributeObj = ThisDrawing.ModelSpace.AddAttribute(height, mode, prompt, insertionPoint, tag, value)

    attributeObj.MTextAttribute = True
    attributeObj.MTextAttributeContent = "test content"
    attributeObj.MTextBoundaryWidth = 4.2
    attributeObj.UpdateMTextAttribute
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MTextAttribute()
    ;; This example creates an attribute definition in model space.
    ;; It then manipulates its MText properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the attribute definition
    (setq insertionPoint (vlax-3d-point 5.2 5.7 0)
          attHeight 1.4
          attMode (+ acAttributeModeVerify acAttributeModeMultipleLine)
          attPrompt "New Prompt"
          attTag "NEW_TAG"
          attValue "New Value")

    ;; Create the attribute definition object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq attributeObj (vla-AddAttribute modelSpace attHeight attMode attPrompt insertionPoint attTag attValue))

    (vla-put-MTextAttributeContent attributeObj "test content")
    (vla-put-MTextBoundaryWidth attributeObj 4.2)
    (vla-UpdateMTextAttribute attributeObj)
    (vla-ZoomAll acadObj)
)


MTextDrawingDirection Property (ActiveX)

Determines the drawing direction for the multiline attribute.

Supported platforms: Windows only

Signature

VBA:

object.MTextDrawingDirection
object

Type: Attribute, AttributeReference

The object this method applies to.

Property Value

Read-only: No

Type: AcDrawingDirection enum

  • acBottomToTop
  • acByStyle
  • acLeftToRight
  • acRightToLeft
  • acTopToBottom

Remarks

No additional remarks.

Examples

VBA:

Sub Example_MTextAttribute()
    ' This example creates an attribute definition in model space.
    ' It then manipulates its MText properties

    Dim attributeObj As IAcadAttribute
    Dim height As Double
    Dim mode As Long
    Dim prompt As String
    Dim insertionPoint(0 To 2) As Double
    Dim tag As String
    Dim value As String

    ' Define the attribute definition
    height = 1.4
    mode = acAttributeModeVerify
    prompt = "New Prompt"
    insertionPoint(0) = 5.2: insertionPoint(1) = 5.7: insertionPoint(2) = 0
    tag = "NEW_TAG"
    value = "New Value"

    ' Create the attribute definition object in model space
    Set attributeObj = ThisDrawing.ModelSpace.AddAttribute(height, mode, prompt, insertionPoint, tag, value)

    attributeObj.MTextAttribute = True
    attributeObj.MTextAttributeContent = "test content"
    attributeObj.MTextBoundaryWidth = 4.2
    attributeObj.UpdateMTextAttribute
    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MTextAttribute()
    ;; This example creates an attribute definition in model space.
    ;; It then manipulates its MText properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the attribute definition
    (setq insertionPoint (vlax-3d-point 5.2 5.7 0)
          attHeight 1.4
          attMode (+ acAttributeModeVerify acAttributeModeMultipleLine)
          attPrompt "New Prompt"
          attTag "NEW_TAG"
          attValue "New Value")

    ;; Create the attribute definition object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq attributeObj (vla-AddAttribute modelSpace attHeight attMode attPrompt insertionPoint attTag attValue))

    (vla-put-MTextAttributeContent attributeObj "test content")
    (vla-put-MTextBoundaryWidth attributeObj 4.2)
    (vla-UpdateMTextAttribute attributeObj)
    (vla-ZoomAll acadObj)
)


MVertexCount Property (ActiveX)

Gets the vertex count in the M direction for a PolygonMesh.

Supported platforms: Windows only

Signature

VBA:

object.MVertexCount
object

Type: PolygonMesh

The object this property applies to.

Property Value

Read-only: Yes

Type: Integer

A positive integer value between 2 and 256.

Remarks

This is the number of vertices that will be used to make up an M row in the PolygonMesh if the Type property is acSimpleMesh. For any other PolygonMesh type, the MDensity value will be used as the row size.

The number of vertices cannot be changed for a simple mesh.

Examples

VBA:

Sub Example_MVertexCount()
    ' This example creates a 4 X 4 polygonmesh in model space.
    ' It then finds the number of points in the 'M' direction.
    Dim meshObj As AcadPolygonMesh
    Dim mSize, nSize, count As Integer
    Dim points(0 To 47) As Double

    ' Create the matrix of points
    points(0) = 0: points(1) = 0: points(2) = 0
    points(3) = 2: points(4) = 0: points(5) = 1
    points(6) = 4: points(7) = 0: points(8) = 0
    points(9) = 6: points(10) = 0: points(11) = 1
    points(12) = 0: points(13) = 2: points(14) = 0
    points(15) = 2: points(16) = 2: points(17) = 1
    points(18) = 4: points(19) = 2: points(20) = 0
    points(21) = 6: points(22) = 2: points(23) = 1
    points(24) = 0: points(25) = 4: points(26) = 0
    points(27) = 2: points(28) = 4: points(29) = 1
    points(30) = 4: points(31) = 4: points(32) = 0
    points(33) = 6: points(34) = 4: points(35) = 0
    points(36) = 0: points(37) = 6: points(38) = 0
    points(39) = 2: points(40) = 6: points(41) = 1
    points(42) = 4: points(43) = 6: points(44) = 0
    points(45) = 6: points(46) = 6: points(47) = 0

    mSize = 4: nSize = 4

    ' Create a 3Dmesh in model space
    Set meshObj = ThisDrawing.ModelSpace.Add3DMesh(mSize, nSize, points)

    ' Change the viewing direction of the viewport to better see the polymesh
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

    ' Find the MVertexCount for the mesh
    Dim currVertexCount As Integer
    currVertexCount = meshObj.MVertexCount
    MsgBox "The MVertexCount for the mesh is " & meshObj.MVertexCount, , "MVertexCount Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_MVertexCount()
    ;; This example creates a 4 X 4 polygonmesh in model space.
    ;; It then finds the number of points in the 'M' direction.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the matrix of points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 47)))
    (vlax-safearray-fill points '(0 0 0
                  2 0 1
                  4 0 0
                  6 0 1
                  0 2 0
                  2 2 1
                  4 2 0
                  6 2 1
                  0 4 0
                  2 4 1
                  4 4 0
                  6 4 0
                  0 6 0
                  2 6 1
                  4 6 0
                  6 6 0
                 )
    )

    (setq mSize 4
          nSize 4)

    ;; Create a 3Dmesh in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq meshObj (vla-Add3DMesh modelSpace mSize nSize points))

    ;; Change the viewing direction of the viewport to better see the polymesh
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)

    ;; Find the MVertexCount for the mesh
    (setq currVertexCount (vla-get-MVertexCount meshObj))
    (alert (strcat "The MVertexCount for the mesh is " (itoa currVertexCount)))
)


Name Property (ActiveX)

Specifies the name of the object.

Supported platforms: Windows only

Signature

VBA:

object.Name
object

Type: Application, Block, BlockReference, Dictionary, DimStyle, Document, ExternalReference, GeomapImage, Group, Layer, Layout, Linetype, Material, MenuGroup, MInsertBlock, MLeaderStyle, ModelSpace, PaperSpace, PlotConfiguration, PointCloud, PointCloudEx, PopupMenu, RasterImage, RegisteredApplication, Section, SelectionSet, Shape, TableStyle, TextStyle, Toolbar, ToolbarItem, UCS, View, Viewport, Wipeout, XRecord

The objects this property applies to.

Property Value

Read-only: No (except for Application, Document, MenuGroup, ModelSpace, PaperSpace, SelectionSet, TextStyle objects)

Type: String

Name of the object.

Remarks

Application, Document: This property returns the file name only, not the path.

ToolbarItem: This name is used as the tooltip text.

MenuGroup: The name is limited to 32 characters and cannot contain spaces or punctuation marks.

Raster: This property is similar to the ImageFile property, except that this property does not contain path information.

XRecord: The name of the object within the dictionary in which it resides. This name does not represent the class name of the object.

BlockRef: A block reference can be assigned the name of only a valid block definition in the drawing. Assigning a block reference a unique name will not automatically create a new block definition. To create a new block definition, use the Add method to add a new Block object to the Blocks collection.

Examples

VBA:

Sub Example_Name()
    ' This example creates a new layer. It then
    ' changes the name of that layer.

    ' Add the new layer
    Dim layerObj As AcadLayer
    Set layerObj = ThisDrawing.Layers.Add("NewLayer")

    ' Find the name of the new layer
    Dim layerName As String
    layerName = layerObj.name
    MsgBox "A new layer was created with the name: " & layerObj.name, , "Name Example"

    ' Change the name of the layer to "TEST". Note that behavior of the
    ' following code will be different for different objects. In some cases such as
    ' Block reference, changing the name means referencing to a new Block and therefore
    ' a Block with named "TEST" should already exist: otherwise an error will be
    ' returned.
    layerObj.name = "TEST"
    layerName = layerObj.name
    MsgBox "The new name of the layer is: " & layerObj.name, , "Name Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Name()
    ;; This example creates a new layer. It then
    ;; changes the name of that layer.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Add the new layer
    (setq layerObj (vla-Add (vla-get-Layers doc) "NewLayer"))

    ;; Find the name of the new layer
    (setq layerName (vla-get-Name layerObj))
    (alert (strcat "A new layer was created with the name: " layerName))

    ;; Change the name of the layer to "TEST". Note that behavior of the
    ;; following code will be different for different objects. In some cases such as
    ;; Block reference, changing the name means referencing to a new Block and therefore
    ;; a Block with named "TEST" should already exist: otherwise an error will be
    ;; returned.
    (vla-put-Name layerObj "TEST")
    (setq layerName (vla-get-Name layerObj))
    (alert (strcat "The new name of the layer is: " layerName))
)


NameNoMnemonic Property (ActiveX)

Specifies the name of the popup menu without the underscore mnemonic.

Supported platforms: Windows only

Signature

VBA:

object.NameNoMnemonic
object

Type: PopupMenu

The object this property applies to.

Property Value

Read-only: Yes

Type: String

The popup menu name without the underscore mnemonic.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_NameNoMnemonic()
    ' This example iterates through the menus collection and
    ' displays the Name and NameNoMnemonic property for each menu.

    ' Note that depending on how many menus are currently loaded, the
    ' menuStatus string may not be displayed in full.

    Dim currMenu As AcadPopupMenu
    Dim menuStatus As String

    menuStatus = ""
    For Each currMenu In ThisDrawing.Application.MenuGroups.Item(0).Menus
        menuStatus = menuStatus & currMenu.name & " -- " & currMenu.NameNoMnemonic & vbCrLf
    Next currMenu
    MsgBox menuStatus

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_NameNoMnemonic()
    ;; This example iterates through the menus collection and
    ;; displays the Name and NameNoMnemonic property for each menu.
    (setq acadObj (vlax-get-acad-object))

    ;; Note that depending on how many menus are currently loaded, the
    ;; menuStatus string may not be displayed in full.

    (setq menuStatus "")
    (vlax-for currMenu (vla-get-Menus (vla-Item (vla-get-MenuGroups acadObj) 0))
        (setq menuStatus (strcat menuStatus (vla-get-Name currMenu) " -- " (vla-get-NameNoMnemonic currMenu) "\n"))
    )
    (alert menuStatus)
)


NClose Property (ActiveX)

Specifies whether the PolygonMesh is closed in the N direction.

Supported platforms: Windows only

Signature

VBA:

object.NClose
object

Type: PolygonMesh

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The PolygonMesh is closed in the N direction.
  • False: The PolygonMesh is open in the N direction.

Remarks

If the PolygonMesh is closed, it will be treated as continuous from the last column on to the first column. If the PolygonMesh is open, it will be treated as discontinuous between the last column and the first column.

Examples

VBA:

Sub Example_NClose()
    ' This example creates a 4 X 4 polygonmesh in model space.
    ' It then closes the polymesh in the 'N' direction.
    Dim meshObj As AcadPolygonMesh
    Dim mSize, nSize, count As Integer
    Dim points(0 To 47) As Double

    ' Create the matrix of points
    points(0) = 2: points(1) = 2: points(2) = 1
    points(3) = 2.5: points(4) = 2: points(5) = 0
    points(6) = 5: points(7) = 2: points(8) = 0
    points(9) = 5.5: points(10) = 2: points(11) = 1
    points(12) = 2: points(13) = 4: points(14) = 0.5
    points(15) = 2.5: points(16) = 4: points(17) = 0
    points(18) = 5: points(19) = 4: points(20) = 0
    points(21) = 5.5: points(22) = 4: points(23) = 0.5
    points(24) = 2: points(25) = 6: points(26) = 0.5
    points(27) = 2.5: points(28) = 6: points(29) = 0
    points(30) = 5: points(31) = 6: points(32) = 0
    points(33) = 5.5: points(34) = 6: points(35) = 0.5
    points(36) = 2: points(37) = 8: points(38) = 1
    points(39) = 2.5: points(40) = 8: points(41) = 0
    points(42) = 5: points(43) = 8: points(44) = 0
    points(45) = 5.5: points(46) = 8: points(47) = 1

    mSize = 4: nSize = 4

    ' Create a 3Dmesh in model space
    Set meshObj = ThisDrawing.ModelSpace.Add3DMesh(mSize, nSize, points)

    ' Change the viewing direction of the viewport to better see the cylinder
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

    ' Close the polymesh in the 'M' direction
    MsgBox "The polymesh is " & IIf(meshObj.NClose, "closed", "open") & " in the 'N' direction.", , "NClose Example"
    meshObj.NClose = True
    ThisDrawing.Regen acActiveViewport
    MsgBox "The polymesh is " & IIf(meshObj.NClose, "closed", "open") & " in the 'N' direction.", , "NClose Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_NClose()
    ;; This example creates a 4 X 4 polygonmesh in model space.
    ;; It then closes the polymesh in the 'N' direction.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the matrix of points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 47)))
    (vlax-safearray-fill points '(2 2 1
                  2.5 2 0
                  5 2 0
                  5.5 2 1
                  2 4 0.5
                  2.5 4 0
                  5 4 0
                  5.5 4 0.5
                  2 6 0.5
                  2.5 6 0
                  5 6 0
                  5.5 6 0.5
                  2 8 1
                  2.5 8 0
                  5 8 0
                  5.5 8 1
                 )
    )

    (setq mSize 4
          nSize 4)

    ;; Create a 3Dmesh in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq meshObj (vla-Add3DMesh modelSpace mSize nSize points))

    ;; Change the viewing direction of the viewport to better see the cylinder
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)

    ;; Close the polymesh in the 'N' direction
    (alert (strcat "The polymesh is " (if (= (vla-get-NClose meshObj) :vlax-true) "closed" "open") " in the 'N' direction."))
    (vla-put-NClose meshObj :vlax-true)
    (vla-Regen doc acActiveViewport)
    (alert (strcat "The polymesh is " (if (= (vla-get-NClose meshObj) :vlax-true) "closed" "open") " in the 'N' direction."))
)


NDensity Property (ActiveX)

Specifies the smooth surface density of a PolygonMesh in the N direction.

Supported platforms: Windows only

Signature

VBA:

object.NDensity
object

Type: PolygonMesh

The object this property applies to.

Property Value

Read-only: No

Type: Integer

The default is 6.

Remarks

The N surface density is the number of vertices in the N direction for PolygonMesh objects that are of the following types: acQuadSurfaceMesh, acCubicSurfaceMesh, or acBezierSurfaceMesh.

The initial value for this property is derived from the value in the SURFV system variable + 1. Therefore, if the current value of SURFV is 6, the NDensity for a mesh after a surface fit operation would be 7. To perform a surface fit operation on a mesh, change the mesh type using the Type property.

Examples

VBA:

Sub Example_NDensity()
    ' This example creates a 4 X 4 polygonmesh in model space.
    ' It then changes the type of polymesh, and finds the
    ' number of points in the 'N' direction.
    Dim meshObj As AcadPolygonMesh
    Dim mSize, nSize, count As Integer
    Dim points(0 To 47) As Double

    ' Create the matrix of points
    points(0) = 0: points(1) = 0: points(2) = 0
    points(3) = 2: points(4) = 0: points(5) = 1
    points(6) = 4: points(7) = 0: points(8) = 0
    points(9) = 6: points(10) = 0: points(11) = 1
    points(12) = 0: points(13) = 2: points(14) = 0
    points(15) = 2: points(16) = 2: points(17) = 1
    points(18) = 4: points(19) = 2: points(20) = 0
    points(21) = 6: points(22) = 2: points(23) = 1
    points(24) = 0: points(25) = 4: points(26) = 0
    points(27) = 2: points(28) = 4: points(29) = 1
    points(30) = 4: points(31) = 4: points(32) = 0
    points(33) = 6: points(34) = 4: points(35) = 0
    points(36) = 0: points(37) = 6: points(38) = 0
    points(39) = 2: points(40) = 6: points(41) = 1
    points(42) = 4: points(43) = 6: points(44) = 0
    points(45) = 6: points(46) = 6: points(47) = 0

    mSize = 4: nSize = 4

    ' Create a 3Dmesh in model space
    Set meshObj = ThisDrawing.ModelSpace.Add3DMesh(mSize, nSize, points)

    ' Change the viewing direction of the viewport to better see the polymesh
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

    ' Change the type of mesh. (NDensity is not valid for acSimpleMesh type.)
    meshObj.Type = acQuadSurfaceMesh
    meshObj.Update
    ThisDrawing.Regen acActiveViewport

    ' Find the NDensity for the mesh
    Dim currDensity As Integer
    currDensity = meshObj.NDensity
    MsgBox "The NDensity for the mesh is " & meshObj.NDensity, , "NDensity Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_NDensity()
    ;; This example creates a 4 X 4 polygonmesh in model space.
    ;; It then changes the type of polymesh, and finds the
    ;; number of points in the 'N' direction.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the matrix of points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 47)))
    (vlax-safearray-fill points '(0 0 0
                  2 0 1
                  4 0 0
                  6 0 1
                  0 2 0
                  2 2 1
                  4 2 0
                  6 2 1
                  0 4 0
                  2 4 1
                  4 4 0
                  6 4 0
                  0 6 0
                  2 6 1
                  4 6 0
                  6 6 0
                 )
    )

    (setq mSize 4
          nSize 4)

    ;; Create a 3Dmesh in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq meshObj (vla-Add3DMesh modelSpace mSize nSize points))

    ;; Change the viewing direction of the viewport to better see the polymesh
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)

    ;; Change the type of mesh. (NDensity is not valid for acSimpleMesh type.)
    (vla-put-Type meshObj acQuadSurfaceMesh)
    (vla-Update meshObj)
    (vla-Regen doc acActiveViewport)

    ;; Find the NDensity for the mesh
    (setq currDensity (vla-get-NDensity meshObj))
    (alert (strcat "The NDensity for the mesh is " (itoa currDensity)))
)


Normal Property (ActiveX)

Specifies the three-dimensional normal unit vector for the object.

Supported platforms: Windows only

Signature

VBA:

object.Normal
object

Type: Arc, Attribute, AttributeReference, BlockReference, Circle, Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated, Ellipse, ExternalReference, Hatch, Leader, Line, LWPolyline, MInsertBlock, MText, Point, Polyline, Region, Section, Shape, Solid, Text, Tolerance, Trace

The objects this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

A 3D normal unit vector in WCS.

Remarks

This normal vector defines the Z axis for the given object. Although the normal is returned in WCS, it can be used to determine the OCS for the object. Use this property as the OCSNormal in the TranslateCoordinates method when converting coordinates to and from OCS.

Note that this property specifies a vector, not a point. The vector defines the direction of the normal, not a location in space. You can add this normal vector to a point to obtain another point.

Tolerance: The normal vector must be perpendicular to the direction of the Tolerance object. A normal that is not perpendicular to the Tolerance object will generate an error.

Examples

VBA:

Sub Example_Normal()
    ' This example creates a circle in model space.
    ' It then finds the current normal to that circle
    ' and changes the normal.

    ' Define a circle
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 4: center(1) = 4: center(2) = 0
    radius = 1

    ' Add the circle to model space
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, radius)
    ZoomAll

    ' Find the normal for the circle
    Dim currNormal As Variant
    currNormal = circleObj.Normal
    MsgBox "The current normal for the circle is " & circleObj.Normal(0) & ", " & circleObj.Normal(1) & ", " & circleObj.Normal(2), , "Normal Example"

    ' Change the normal for the circle
    Dim newNormal(0 To 2) As Double
    newNormal(0) = 1: newNormal(1) = 1: newNormal(2) = -1
    circleObj.Normal = newNormal
    circleObj.Update
    MsgBox "The current normal for the circle is " & circleObj.Normal(0) & ", " & circleObj.Normal(1) & ", " & circleObj.Normal(2), , "Normal Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Normal()
    ;; This example creates a circle in model space.
    ;; It then finds the current normal to that circle
    ;; and changes the normal.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define a circle
    (setq center (vlax-3d-point 4 4 0)
          radius 1)

    ;; Add the circle to model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace center radius))
    (vla-ZoomAll acadObj)

    ;; Find the normal for the circle
    (setq currNormal (vlax-variant-value (vla-get-Normal circleObj)))
    (alert (strcat "The current normal for the circle is " (rtos (vlax-safearray-get-element currNormal 0) 2) ", "
                                                           (rtos (vlax-safearray-get-element currNormal 1) 2) ", "
                                                           (rtos (vlax-safearray-get-element currNormal 2) 2)))

    ;; Change the normal for the circle
    (setq newNormal (vlax-3d-point 1 1 -1))
    (vla-put-Normal circleObj newNormal)
    (vla-Update circleObj)
    (setq newNormal (vlax-variant-value newNormal))
    (alert (strcat "The current normal for the circle is " (rtos (vlax-safearray-get-element newNormal 0) 2) ", "
                                                           (rtos (vlax-safearray-get-element newNormal 1) 2) ", "
                                                           (rtos (vlax-safearray-get-element newNormal 2) 2)))
)


Notes Property (ActiveX)

Specifies the notes for the position marker.

Supported platforms: Windows only

Signature

VBA:

object.Notes
object

Type: GeoPositionMarker

The object this property applies to.

Property Value

Read-only: No

Type: String

The current notes attached to the position marker.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


NumberOfControlPoints Property (ActiveX)

Gets the number of control points of the spline.

Supported platforms: Windows only

Signature

VBA:

object.NumberOfControlPoints
object

Type: Spline

The object this property applies to.

Property Value

Read-only: Yes

Type: Integer

The number of control points of the spline.

Remarks

Control points fine-tune a spline definition by adding weight to a portion of the spline curve.

You can query the current position of a control point by using the GetControlPoint method. You can set a new coordinate location for a control point by using the SetControlPoint method. You can set a new weight for a control point by using the SetWeight method.

Examples

VBA:

Sub Example_NumberOfControlPoints()
    ' This example creates a spline object in model space.
    ' It then finds the number of control points for that spline.

    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ZoomAll

    MsgBox "The Spline has " & splineObj.NumberOfControlPoints & " control points.", , "NumberOfControlPoints Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_NumberOfControlPoints()
    ;; This example creates a spline object in model space.
    ;; It then finds the number of control points for that spline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the spline
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(1 1 0
                     5 5 0
                     10 0 0
                    )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)

    (alert (strcat "The Spline has " (itoa (vla-get-NumberOfControlPoints splineObj)) " control points."))
)


NumberOfCopies Property (ActiveX)

Specifies the number of copies to plot.

Supported platforms: Windows only

Signature

VBA:

object.NumberOfCopies
object

Type: Plot

The object this property applies to.

Property Value

Read-only: No

Type: Long

The number of copies to plot.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_NumberOfCopies()
    ' This example plots the layouts of a drawing.

    Dim oPlot As AcadPlot
    Dim AddedLayouts() As String
    Dim LayoutList As Variant
    Dim oLayout As AcadLayout
    Dim ArraySize As Integer, BatchCount As Integer

    For Each oLayout In ThisDrawing.Layouts
        ArraySize = ArraySize + 1
        ReDim Preserve AddedLayouts(1 To ArraySize)
        AddedLayouts(ArraySize) = oLayout.Name
    Next

    LayoutList = AddedLayouts
    Set oPlot = ThisDrawing.Plot
    oPlot.SetLayoutsToPlot LayoutList
    oPlot.PlotToDevice "DWF6 ePlot.pc3"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_NumberOfCopies()
    ;; This example plots the layouts of a drawing.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq AddedLayouts (vlax-make-safearray vlax-vbString (cons 0 (1- (vla-get-Count (vla-get-Layouts doc)))))
          ArraySize 0)

    (vlax-for oLayout (vla-get-Layouts doc)
        (vlax-safearray-put-element AddedLayouts ArraySize (vla-get-Name oLayout))
        (setq ArraySize (1+ ArraySize))
    )

    (setq oPlot (vla-get-Plot doc))
    (vla-SetLayoutsToPlot oPlot AddedLayouts)
    (vla-PlotToDevice oPlot "DWF6 ePlot.pc3")
)


NumberOfFaces Property (ActiveX)

Gets the number of faces for the PolyfaceMesh.

Supported platforms: Windows only

Signature

VBA:

object.NumberOfFaces
object

Type: PolyFaceMesh

The object this property applies to.

Property Value

Read-only: Yes

Type: Long

Number of faces for the PolyfaceMesh.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_NumberOfFaces()
    ' This example creates a PolyFaceMesh and displays the number of faces it contains

    Dim vertexList(0 To 17) As Double
    Dim FaceList(0 To 7) As Integer
    Dim NewPolyFaceMeshObj As AcadPolyfaceMesh
    Dim direction(0 To 2) As Double

    'Data for new PolyFaceMesh object
    vertexList(0) = 4: vertexList(1) = 7: vertexList(2) = 0
    vertexList(3) = 5: vertexList(4) = 7: vertexList(5) = 0
    vertexList(6) = 6: vertexList(7) = 7: vertexList(8) = 0
    vertexList(9) = 4: vertexList(10) = 6: vertexList(11) = 0
    vertexList(12) = 5: vertexList(13) = 6: vertexList(14) = 0
    vertexList(15) = 6: vertexList(16) = 6: vertexList(17) = 6

    FaceList(0) = 1:    FaceList(1) = 2:    FaceList(2) = 5
    FaceList(3) = 4:    FaceList(4) = 2:    FaceList(5) = 3
    FaceList(6) = 6:    FaceList(7) = 5

    ' Create new PolyFaceMesh object
    Set NewPolyFaceMeshObj = ModelSpace.AddPolyfaceMesh(vertexList, FaceList)
    NewPolyFaceMeshObj.Update

    ' Change the viewing direction of the viewport to
    ' better see the polyface mesh
    direction(0) = -1: direction(1) = -1: direction(2) = 1
    ThisDrawing.ActiveViewport.direction = direction
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ThisDrawing.Application.ZoomAll

    ' Display number of faces in this PolyFaceMesh
    MsgBox "The new PolyFaceMesh contains " & NewPolyFaceMeshObj.NumberOfFaces & " faces."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_NumberOfFaces()
    ;; This example creates a PolyFaceMesh and displays the number of faces it contains
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Data for new PolyFaceMesh object
    (setq vertexList (vlax-make-safearray vlax-vbDouble '(0 . 17)))
    (vlax-safearray-fill vertexList '(4 7 0
                      5 7 0
                      6 7 0
                      4 6 0
                      5 6 0
                      6 6 6
                     )
    )

    (setq FaceList (vlax-make-safearray vlax-vbInteger '(0 . 7)))
    (vlax-safearray-fill FaceList '(1
                    2
                    5
                    4
                    2
                    3
                    6
                    5
                   )
    )

    ;; Create new PolyFaceMesh object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq NewPolyFaceMeshObj (vla-AddPolyfaceMesh modelSpace vertexList FaceList))
    (vla-Update NewPolyFaceMeshObj)

    ;; Change the viewing direction of the viewport to
    ;; better see the polyface mesh
    (setq direction (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport direction)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)

    ;; Display number of faces in this PolyFaceMesh
    (alert (strcat "The new PolyFaceMesh contains " (itoa (vla-get-NumberOfFaces NewPolyFaceMeshObj)) " faces."))
)


NumberOfFitPoints Property (ActiveX)

Gets the number of fit points of the spline.

Supported platforms: Windows only

Signature

VBA:

object.NumberOfFitPoints
object

Type: Spline

The object this property applies to.

Property Value

Read-only: Yes

Type: Integer

Number of fit points of the spline.

Remarks

The fit points define the path of the spline. You can change the tolerance of a given fit point by using the FitTolerance property. You can add a fit point by using the AddFitPoint method. You can delete a fit point by using the DeleteFitPoint method. You can query the location of a fit point by using the GetFitPoint method. You can change the location of a given fit point by using the SetFitPoint method.

Examples

VBA:

Sub Example_NumberOfFitPoints()
    ' This example creates a spline object in model space.
    ' It then finds the number of control points for that spline.

    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ZoomAll

    MsgBox "The Spline has " & splineObj.NumberOfFitPoints & " fit points.", , "NumberOfFitPoints Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_NumberOfFitPoints()
    ;; This example creates a spline object in model space.
    ;; It then finds the number of control points for that spline.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the spline
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(1 1 0
                     5 5 0
                     10 0 0
                    )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)

    (alert (strcat "The Spline has " (itoa (vla-get-NumberOfFitPoints splineObj)) " fit points."))
)


NumberOfLoops Property (ActiveX)

Gets the number of loops in the hatch boundary.

Supported platforms: Windows only

Signature

VBA:

object.NumberOfLoops
object

Type: Hatch

The object this property applies to.

Property Value

Read-only: Yes

Type: Integer

The number of loops in the hatch boundary.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_NumberOfLoops()
    ' This example creates an associative hatch in model space.
    ' The number of loops in the hatch is then returned.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "ANSI31"
    PatternType = 0
    bAssociativity = True

    ' Create the associative Hatch object
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)

    ' Create the outer loop for the hatch.
    ' An arc and a line are used to create a closed loop.

    Dim outerLoop(0 To 1) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    center(0) = 5: center(1) = 3: center(2) = 0
    radius = 3
    startAngle = 0
    endAngle = 3.141592
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddArc(center, radius, startAngle, endAngle)
    Set outerLoop(1) = ThisDrawing.ModelSpace.AddLine(outerLoop(0).startPoint, outerLoop(0).endPoint)

    ' Append the outer loop to the hatch object
    hatchObj.AppendOuterLoop (outerLoop)

    ' Append the first circle as one inner loop
    Dim innerLoop1(0) As AcadEntity
    center(0) = 5: center(1) = 4.5: center(2) = 0
    radius = 1
    Set innerLoop1(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop1)

    ' Append the second circle as the other inner loop
    Dim innerLoop2(0) As AcadEntity
    radius = 0.5
    Set innerLoop2(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop2)

    ' Evaluate and display the hatch
    hatchObj.Evaluate
    ThisDrawing.Regen True

    ' Find the number of loops in the hatch
    Dim numOfLoops As Integer
    numOfLoops = hatchObj.NumberOfLoops
    MsgBox "The number of loops in the hatch is " & hatchObj.NumberOfLoops, , "NumberOfLoops Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_NumberOfLoops()
    ;; This example creates an associative hatch in model space.
    ;; The number of loops in the hatch is then returned.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "ANSI31"
          patternType 0
          bAssociativity :vlax-true)

    ;; Create the associative Hatch object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acHatchObject))

    ;; Create the outer loop for the hatch.
    ;; An arc and a line are used to create a closed loop.
    (setq center (vlax-3d-point 5 3 0)
          radius 3
          startAngle 0
          endAngle 3.141592)

    (setq arc (vla-AddArc modelSpace center radius startAngle endAngle))
    (setq line (vla-AddLine modelSpace (vla-get-StartPoint arc) (vla-get-EndPoint arc)))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element outerLoop 0 arc)
    (vlax-safearray-put-element outerLoop 1 line)

    ;; Append the outer loop to the hatch object
    (vla-AppendOuterLoop hatchObj outerLoop)

    ;; Append the first circle as one inner loop
    (setq center (vlax-3d-point 5 4.5 0)
          radius 1)

    (setq circle1 (vla-AddCircle modelSpace center radius))

    (setq innerLoop1 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element innerLoop1 0 circle1)

    (vla-AppendInnerLoop hatchObj innerLoop1)

    ;; Append the second circle as the other inner loop
    (setq radius 0.5)
    (setq innerLoop2 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (setq circle2 (vla-AddCircle modelSpace center radius))
    (vlax-safearray-put-element innerLoop2 0 circle2)

    (vla-AppendInnerLoop hatchObj innerLoop2)
    (vla-ZoomAll acadObj)

    ;; Evaluate and display the hatch
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)

    ;; Find the number of loops in the hatch
    (setq numOfLoops (vla-get-NumberOfLoops hatchObj))
    (alert (strcat "The number of loops in the hatch is " (itoa numOfLoops)))
)


NumberOfVertices Property (ActiveX)

Gets the number of vertices for the PolyfaceMesh.

Supported platforms: Windows only

Signature

VBA:

object.NumberOfVertices
object

Type: PolyFaceMesh

The object this property applies to.

Property Value

Read-only: Yes

Type: Long

The number of vertices in the PolyfaceMesh.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_NumberOfVertices()
    ' This example creates a PolyFaceMesh and displays the number of vertices it contains

    Dim vertexList(0 To 17) As Double
    Dim FaceList(0 To 7) As Integer
    Dim NewPolyFaceMeshObj As AcadPolyfaceMesh
    Dim direction(0 To 2) As Double

    'Data for new PolyFaceMesh object
    vertexList(0) = 4: vertexList(1) = 7: vertexList(2) = 0
    vertexList(3) = 5: vertexList(4) = 7: vertexList(5) = 0
    vertexList(6) = 6: vertexList(7) = 7: vertexList(8) = 0
    vertexList(9) = 4: vertexList(10) = 6: vertexList(11) = 0
    vertexList(12) = 5: vertexList(13) = 6: vertexList(14) = 0
    vertexList(15) = 6: vertexList(16) = 6: vertexList(17) = 6

    FaceList(0) = 1:    FaceList(1) = 2:    FaceList(2) = 5
    FaceList(3) = 4:    FaceList(4) = 2:    FaceList(5) = 3
    FaceList(6) = 6:    FaceList(7) = 5

    ' Create new PolyFaceMesh object
    Set NewPolyFaceMeshObj = ModelSpace.AddPolyfaceMesh(vertexList, FaceList)
    NewPolyFaceMeshObj.Update

    ' Change the viewing direction of the viewport to
    ' better see the polyface mesh
    direction(0) = -1: direction(1) = -1: direction(2) = 1
    ThisDrawing.ActiveViewport.direction = direction
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ThisDrawing.Application.ZoomAll

    ' Display number of vertices in this PolyFaceMesh
    MsgBox "The new PolyFaceMesh contains " & NewPolyFaceMeshObj.NumberOfVertices & " vertices."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_NumberOfVertices()
    ;; This example creates a PolyFaceMesh and displays the number of vertices it contains
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Data for new PolyFaceMesh object
    (setq vertexList (vlax-make-safearray vlax-vbDouble '(0 . 17)))
    (vlax-safearray-fill vertexList '(4 7 0
                      5 7 0
                      6 7 0
                      4 6 0
                      5 6 0
                      6 6 6
                     )
    )

    (setq FaceList (vlax-make-safearray vlax-vbInteger '(0 . 7)))
    (vlax-safearray-fill FaceList '(1
                    2
                    5
                    4
                    2
                    3
                    6
                    5
                   )
    )

    ;; Create new PolyFaceMesh object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq NewPolyFaceMeshObj (vla-AddPolyfaceMesh modelSpace vertexList FaceList))
    (vla-Update NewPolyFaceMeshObj)

    ;; Change the viewing direction of the viewport to
    ;; better see the polyface mesh
    (setq direction (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport direction)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)

    ;; Display number of vertices in this PolyFaceMesh
    (alert (strcat "The new PolyFaceMesh contains " (itoa (vla-get-NumberOfVertices NewPolyFaceMeshObj)) " vertices."))
)


NumCellStyles Property (ActiveX)

Gets the number of cell styles a table has.

Supported platforms: Windows only

Signature

VBA:

object.NumCellStyles
object

Type: TableStyle

The object this property applies to.

Property Value

Read-only: Yes

Type: Long

Location for the value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_CellStyle()
    ' This example creates a TableStyle object and sets values for
    ' the style name and formatting.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As IAcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.CreateCellStyle ("NewTestStyle")
    Dim cellTestFormat As String

    customObj.SetFormat2 "NewTestStyle", "test format"
    customObj.GetFormat2 "NewTestStyle", cellTestFormat

    MsgBox "Cell Style Name = " & cellTestFormat

    customObj.RenameCellStyle "NewTestStyle", "NewTestStyle2"
    customObj.GetFormat2 "NewTestStyle2", cellTestFormat

    MsgBox "Cell Style Name = " & cellTestFormat

    Dim uniqueStyleName As String

    uniqueStyleName = customObj.GetUniqueCellStyleName("testbase")

    MsgBox "Cell Style Name = " & uniqueStyleName

    If customObj.GetIsCellStyleInUse("testbase") = False Then
        MsgBox "That cell style is not being used!"
    End If

    customObj.CreateCellStyleFromStyle "TestStyleFromStyle", "NewTestStyle2"

    customObj.DeleteCellStyle "NewTestStyle2"

    Dim numOfStyles As Long
    numOfStyles = customObj.NumCellStyles
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CellStyle()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and formatting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-CreateCellStyle customObj "NewTestStyle")

    (setq cellTestFormat "")
    (vla-SetFormat2 customObj "NewTestStyle" "test format")
    (vla-GetFormat2 customObj "NewTestStyle" 'cellTestFormat)

    (alert (strcat "Cell Style Name = " cellTestFormat))

    (vla-RenameCellStyle customObj "NewTestStyle" "NewTestStyle2")
    (vla-GetFormat2 customObj "NewTestStyle2" 'cellTestFormat)

    (alert (strcat "Cell Style Name = " cellTestFormat))

    (setq uniqueStyleName (vla-GetUniqueCellStyleName customObj "testbase"))

    (alert (strcat "Cell Style Name = " uniqueStyleName))

    (if (= (vla-GetIsCellStyleInUse customObj "testbase") :vlax-false)
        (alert "That cell style is not being used!")
    )

    (vla-CreateCellStyleFromStyle customObj "TestStyleFromStyle" "NewTestStyle2")

    (vla-DeleteCellStyle customObj "NewTestStyle2")

    (setq numOfStyles (vla-get-NumCellStyles customObj))
    (alert (strcat "Number of Cell Styles = " (itoa numOfStyles)))
)


NumCrossSections Property (ActiveX)

Gets the number of cross-section curves used.

Supported platforms: Windows only

Signature

VBA:

object.NumCrossSections
object

Type: LoftedSurface

The object to which this property applies.

Property Value

Read-only: No (write-only)

Type: Long

The number of cross-section curves used for the lofted surface.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


NumGuidePaths Property (ActiveX)

Gets the number of guide paths used.

Supported platforms: Windows only

Signature

VBA:

object.NumGuidePaths
object

Type: LoftedSurface

The object to which this property applies.

Property Value

Read-only: No (write-only)

Type: Long

The number of guide paths used for the lofted surface.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


NumVertices Property (ActiveX)

Gets the number of vertices in the section line.

Supported platforms: Windows only

Signature

VBA:

object.NumVertices
object

Type: Section

The object to which this property applies.

Property Value

Read-only: No

Type: Integer

The number of vertices in the section line.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


NVertexCount Property (ActiveX)

Gets the vertex count in the N direction for a PolygonMesh.

Supported platforms: Windows only

Signature

VBA:

object.NVertexCount
object

Type: PolygonMesh

The object this property applies to.

Property Value

Read-only: Yes

Type: Integer

A positive integer between 2 and 256.

Remarks

This is the number of vertices that will be used to make up an N column in the PolygonMesh if the Type property is acSimpleMesh. For any other PolygonMesh type, the NDensity value will be used as the column size.

The number of vertices cannot be changed for a simple mesh.

Examples

VBA:

Sub Example_NVertexCount()
    ' This example creates a 4 X 4 polygonmesh in model space.
    ' It then finds the number of points in the 'N' direction.
    Dim meshObj As AcadPolygonMesh
    Dim mSize, nSize, count As Integer
    Dim points(0 To 47) As Double

    ' Create the matrix of points
    points(0) = 0: points(1) = 0: points(2) = 0
    points(3) = 2: points(4) = 0: points(5) = 1
    points(6) = 4: points(7) = 0: points(8) = 0
    points(9) = 6: points(10) = 0: points(11) = 1
    points(12) = 0: points(13) = 2: points(14) = 0
    points(15) = 2: points(16) = 2: points(17) = 1
    points(18) = 4: points(19) = 2: points(20) = 0
    points(21) = 6: points(22) = 2: points(23) = 1
    points(24) = 0: points(25) = 4: points(26) = 0
    points(27) = 2: points(28) = 4: points(29) = 1
    points(30) = 4: points(31) = 4: points(32) = 0
    points(33) = 6: points(34) = 4: points(35) = 0
    points(36) = 0: points(37) = 6: points(38) = 0
    points(39) = 2: points(40) = 6: points(41) = 1
    points(42) = 4: points(43) = 6: points(44) = 0
    points(45) = 6: points(46) = 6: points(47) = 0

    mSize = 4: nSize = 4

    ' Create a 3Dmesh in model space
    Set meshObj = ThisDrawing.ModelSpace.Add3DMesh(mSize, nSize, points)

    ' Change the viewing direction of the viewport to better see the polymesh
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

    ' Find the NVertexCount for the mesh
    Dim currVertexCount As Integer
    currVertexCount = meshObj.NVertexCount
    MsgBox "The NVertexCount for the mesh is " & meshObj.NVertexCount, , "NVertexCount Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_NVertexCount()
    ;; This example creates a 4 X 4 polygonmesh in model space.
    ;; It then finds the number of points in the 'N' direction.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the matrix of points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 47)))
    (vlax-safearray-fill points '(0 0 0
                  2 0 1
                  4 0 0
                  6 0 1
                  0 2 0
                  2 2 1
                  4 2 0
                  6 2 1
                  0 4 0
                  2 4 1
                  4 4 0
                  6 4 0
                  0 6 0
                  2 6 1
                  4 6 0
                  6 6 0
                 )
    )

    (setq mSize 4
          nSize 4)

    ;; Create a 3Dmesh in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq meshObj (vla-Add3DMesh modelSpace mSize nSize points))

    ;; Change the viewing direction of the viewport to better see the polymesh
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)

    ;; Find the NVertexCount for the mesh
    (setq currVertexCount (vla-get-NVertexCount meshObj))
    (alert (strcat "The NVertexCount for the mesh is " (itoa currVertexCount)))
)


ObjectID Property (ActiveX)

Gets the object ID.

Supported platforms: Windows only

Signature

VBA:

object.ObjectID
object

Type: All drawing objects, AttributeReference, Block, Blocks, Dictionary, Dictionaries, Dimension, DimStyle, DimStyles, Group, Groups, Layer, Layers, Layout, Layouts, Linetype, Linetypes, Material, Materials, MLeaderStyle, ModelSpace, PaperSpace, PlotConfiguration, PlotConfigurations, RegisteredApplication, RegisteredApplications, SectionManager, SectionSettings, SortentsTable, TableStyle, TextStyle, TextStyles, UCS, UCSs, View, Views, Viewport, Viewports, XRecord

The objects this property applies to.

Property Value

Read-only: Yes

Type: Long_PTR

The object ID of an object.

Remarks

An object ID and a unique handle are both ways of referencing an object.

In general, use a handle unless you plan to work with certain ObjectARX functions that require an object ID.

Examples

VBA:

Sub Example_ObjectID()
    ' This example creates several objects in model space.
    ' It then iterates through model space and displays the
    ' ObjectID for each object found.

    ' Create a Ray object in model space
    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)

    ' Create a Polyline object in model space
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True

    ' Create a Line object in model space
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ' Create a Circle object in model space
    Dim circObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 5: centerPt(1) = 3: centerPt(2) = 0
    radius = 3
    Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)

    ' Create an Ellipse object in model space
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    ZoomAll

    ' Iterate through the model space collection and display
    ' the ObjectID of each object found.
    Dim entObjectID As Long
    Dim entry As AcadEntity

    For Each entry In ThisDrawing.ModelSpace
        entObjectID = entry.ObjectID
        entry.Highlight (True)
        MsgBox "The ObjectID of this object is " & entObjectID, vbInformation, "ObjectID Example"
        entry.Highlight (False)
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ObjectID()
    ;; This example creates several objects in model space.
    ;; It then iterates through model space and displays the
    ;; ObjectID for each object found.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Create a Ray object in model space
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 1 3 0))
    (setq rayObj (vla-AddRay modelSpace basePoint SecondPoint))

    ;; Create a Polyline object in model space
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
                                  9 2
                  3 5
                 )
    )
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)

    ;; Create a Line object in model space
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 2 2 0))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    ;; Create a Circle object in model space
    (setq centerPt (vlax-3d-point 5 3 0)
          radius 3)
    (setq circObj (vla-AddCircle modelSpace centerPt radius))

    ;; Create an Ellipse object in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

    (vla-ZoomAll acadObj)

    ;; Iterate through the model space collection and display
    ;; the ObjectID of each object found.
    (vlax-for entry (vla-get-ModelSpace doc)
        (setq entObjectID (vla-get-objectID entry))
        (vla-Highlight entry :vlax-true)
        (alert (strcat "The ObjectID of this object is " (itoa entObjectID)))
        (vla-Highlight entry :vlax-false)
    )
)


ObjectName Property (ActiveX)

Gets the AutoCAD class name of the object.

Supported platforms: Windows only

Signature

VBA:

object.ObjectName
object

Type: All drawing objects, AttributeReference, Block, Blocks, Dictionary, Dictionaries, Dimension, DimStyle, DimStyles, Group, Groups, Layer, Layers, Layout, Layouts, Linetype, Linetypes, Material, Materials, MLeaderStyle, ModelSpace, PaperSpace, PlotConfiguration, PlotConfigurations, RegisteredApplication, RegisteredApplications, SectionManager, SectionSettings, SortentsTable, SubDMeshEdge, SubDMeshFace, SubDMeshVertex, SubEntity, SubEntSolidEdge, SubEntSolidFace, SubEntSolidNode, SubEntSolidVertex, TableStyle, TextStyle, TextStyles, UCS, UCSs, View, Views, Viewport, Viewports, XRecord

The objects this property applies to.

Property Value

Read-only: Yes

Type: String

The AutoCAD class name of an object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ObjectName()
    ' This example creates several objects in model space.
    ' It then iterates through model space and displays the
    ' Object Name for each object found.

    ' Create a Ray object in model space
    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)

    ' Create a Polyline object in model space
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True

    ' Create a Line object in model space
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ' Create a Circle object in model space
    Dim circObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 20: centerPt(1) = 30: centerPt(2) = 0
    radius = 3
    Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)

    ' Create an Ellipse object in model space
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    ZoomAll

    ' Iterate through the model space collection and display
    ' the object name of each object found.

    Dim objName As String
    Dim entry As AcadEntity
    For Each entry In ThisDrawing.ModelSpace
        objName = entry.ObjectName
        entry.Highlight (True)
        MsgBox "The name of this object is " & objName, vbInformation, "ObjectName Example"
        entry.Highlight (False)
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ObjectName()
    ;; This example creates several objects in model space.
    ;; It then iterates through model space and displays the
    ;; Object Name for each object found.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Create a Ray object in model space
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 1 3 0))
    (setq rayObj (vla-AddRay modelSpace basePoint SecondPoint))

    ;; Create a Polyline object in model space
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
                                  9 2
                  3 5
                 )
    )
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)

    ;; Create a Line object in model space
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 2 2 0))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    ;; Create a Circle object in model space
    (setq centerPt (vlax-3d-point 20 30 0)
          radius 3)
    (setq circObj (vla-AddCircle modelSpace centerPt radius))

    ;; Create an Ellipse object in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

    (vla-ZoomAll acadObj)

    ;; Iterate through the model space collection and display
    ;; the object name of each object found.
    (vlax-for entry (vla-get-ModelSpace doc)
        (setq objName (vla-get-ObjectName entry))
        (vla-Highlight entry :vlax-true)
        (alert (strcat "The name of this object is " objName))
        (vla-Highlight entry :vlax-false)
    )
)


ObjectSnapMode Property (ActiveX)

Specifies the setting of the object snap mode.

Supported platforms: Windows only

Signature

VBA:

object.ObjectSnapMode
object

Type: Document

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Snap mode is on.
  • False: Snap mode is off.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ObjectSnapMode()
    ' This example toggles the setting of the Object Snap Mode.

    Dim currObjSnapMode As Boolean

    ' Get the current ObjectSnapMode value
    currObjSnapMode = ThisDrawing.ObjectSnapMode
    MsgBox "The object snap mode is currently " & IIf(ThisDrawing.ObjectSnapMode, "on.", "off."), , "ObjectSnapMode Example"

    ' Change the default ObjectSnapMode value
    ThisDrawing.ObjectSnapMode = Not (currObjSnapMode)
    MsgBox "The object snap mode is now " & IIf(ThisDrawing.ObjectSnapMode, "on.", "off."), , "ObjectSnapMode Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ObjectSnapMode()
    ;; This example toggles the setting of the Object Snap Mode.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get the current ObjectSnapMode value
    (setq currObjSnapMode (vla-get-ObjectSnapMode doc))
    (alert (strcat "The object snap mode is currently " (if (= (vla-get-ObjectSnapMode doc) :vlax-true) "on." "off.")))

    ;; Change the default ObjectSnapMode value
    (vla-put-ObjectSnapMode doc (if (= (vla-get-ObjectSnapMode doc) :vlax-true) :vlax-false :vlax-true))
    (alert (strcat "The object snap mode is now " (if (= (vla-get-ObjectSnapMode doc) :vlax-true) "on." "off.")))
)


ObjectSortByPlotting Property (ActiveX)

Toggles sorting of drawing objects by plotting order.

Supported platforms: Windows only

Signature

VBA:

object.ObjectSortByPlotting
object

Type: DatabasePreferences

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Enable sort by plotting order.
  • False: Disable sort by plotting order.

Remarks

The initial value of this property is True.

AutoCAD initially enables sorting for plotting and PostScript output only. Setting additional sorting options can result in slower regeneration and redrawing times.

NoteThe value of this property is stored in the SORTENTS system variable.

Examples

VBA:

Sub Example_ObjectSortByPlotting()
    ' This example reads and modifies the preference value that controls
    ' the sorting of drawing objects by plotting order.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadDatabasePreferences
    Dim originalValue As Variant, newValue As Variant

    ' Get the user preferences object
    Set ACADPref = ThisDrawing.preferences

    ' Read and display the original value
    originalValue = ACADPref.ObjectSortByPlotting
    MsgBox "The ObjectSortByPlotting preference is set to: " & originalValue

    ' Modify the ObjectSortByPlotting preference by toggling the value
    ACADPref.ObjectSortByPlotting = Not (ACADPref.ObjectSortByPlotting)
    newValue = ACADPref.ObjectSortByPlotting
    MsgBox "The ObjectSortByPlotting preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.ObjectSortByPlotting = originalValue
    MsgBox "The ObjectSortByPlotting preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ObjectSortByPlotting()
    ;; This example reads and modifies the preference value that controls
    ;; the sorting of drawing objects by plotting order.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences doc))

    ;; Read and display the original value
    (setq originalValue (vla-get-ObjectSortByPlotting preferences))
    (alert (strcat "The ObjectSortByPlotting preference is set to: " (if (= originalValue :vlax-true) "True"  "False")))

    ;; Modify the ObjectSortByPlotting preference by toggling the value
    (vla-put-ObjectSortByPlotting preferences (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-ObjectSortByPlotting preferences))
    (alert (strcat "The ObjectSortByPlotting preference has been set to: " (if (= newValue :vlax-true) "True"  "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-ObjectSortByPlotting preferences originalValue)
    (alert (strcat "The ObjectSortByPlotting preference was reset back to: " (if (= originalValue :vlax-true) "True"  "False")))
)


ObjectSortByPSOutput Property (ActiveX)

Toggles sorting of drawing objects by PostScript output order.

Supported platforms: Windows only

Signature

VBA:

object.ObjectSortByPSOutput
object

Type: DatabasePreferences

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Enable sort by PostScript output order.
  • False: Disable sort by PostScript output order.

Remarks

The initial value of this property is True.

AutoCAD initially enables sorting for plotting and PostScript output only. Setting additional sorting options can result in slower regeneration and redrawing times.

NoteThe value of this property is stored in the SORTENTS system variable.

Examples

VBA:

Sub Example_ObjectSortByPSOutput()
    ' This example reads and modifies the preference value which controls
    ' the sorting of drawing objects by PostScript output order.
    ' When finished, this example resets the preference value back to
    ' it's original value.

    Dim ACADPref As AcadDatabasePreferences
    Dim originalValue As Variant, newValue As Variant

    ' Get the user preferences object
    Set ACADPref = ThisDrawing.preferences

    ' Read and display the original value
    originalValue = ACADPref.ObjectSortByPSOutput
    MsgBox "The ObjectSortByPSOutput preference is set to: " & originalValue

    ' Modify the ObjectSortByPSOutput preference by toggling the value
    ACADPref.ObjectSortByPSOutput = Not (ACADPref.ObjectSortByPSOutput)
    newValue = ACADPref.ObjectSortByPSOutput
    MsgBox "The ObjectSortByPSOutput preference has been set to: " & newValue

    ' Reset the preference back to it's original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.ObjectSortByPSOutput = originalValue
    MsgBox "The ObjectSortByPSOutput preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ObjectSortByPSOutput()
    ;; This example reads and modifies the preference value which controls
    ;; the sorting of drawing objects by PostScript output order.
    ;; When finished, this example resets the preference value back to
    ;; it's original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences doc))

    ;; Read and display the original value
    (setq originalValue (vla-get-ObjectSortByPSOutput preferences))
    (alert (strcat "The ObjectSortByPSOutput preference is set to: " (if (= originalValue :vlax-true) "True"  "False")))

    ;; Modify the ObjectSortByPSOutput preference by toggling the value
    (vla-put-ObjectSortByPSOutput preferences (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-ObjectSortByPSOutput preferences))
    (alert (strcat "The ObjectSortByPSOutput preference has been set to: " (if (= newValue :vlax-true) "True"  "False")))

    ;; Reset the preference back to it's original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-ObjectSortByPSOutput preferences originalValue)
    (alert (strcat "The ObjectSortByPSOutput preference was reset back to: " (if (= originalValue :vlax-true) "True"  "False")))
)


ObjectSortByRedraws Property (ActiveX)

Toggles sorting of drawing objects by redraw order.

Supported platforms: Windows only

Signature

VBA:

object.ObjectSortByRedraws
object

Type: DatabasePreferences

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Enable sort by redraw order.
  • False: Disable sort by redraw order.

Remarks

The initial value of this property is False.

AutoCAD initially enables sorting for plotting and PostScript output only. Setting additional sorting options can result in slower regeneration and redrawing times.

NoteThe value of this property is stored in the SORTENTS system variable.

Examples

VBA:

Sub Example_ObjectSortByRedraws()
    ' This example reads and modifies the preference value that controls
    ' the sorting of drawing objects by redraw order.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadDatabasePreferences
    Dim originalValue As Variant, newValue As Variant

    ' Get the user preferences object
    Set ACADPref = ThisDrawing.preferences

    ' Read and display the original value
    originalValue = ACADPref.ObjectSortByRedraws
    MsgBox "The ObjectSortByRedraws preference is set to: " & originalValue

    ' Modify the ObjectSortByRedraws preference by toggling the value
    ACADPref.ObjectSortByRedraws = Not (ACADPref.ObjectSortByRedraws)
    newValue = ACADPref.ObjectSortByRedraws
    MsgBox "The ObjectSortByRedraws preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.ObjectSortByRedraws = originalValue
    MsgBox "The ObjectSortByRedraws preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ObjectSortByRedraws()
    ;; This example reads and modifies the preference value that controls
    ;; the sorting of drawing objects by redraw order.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences doc))

    ;; Read and display the original value
    (setq originalValue (vla-get-ObjectSortByRedraws preferences))
    (alert (strcat "The ObjectSortByRedraws preference is set to: " (if (= originalValue :vlax-true) "True"  "False")))

    ;; Modify the ObjectSortByRedraws preference by toggling the value
    (vla-put-ObjectSortByRedraws preferences (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-ObjectSortByRedraws preferences))
    (alert (strcat "The ObjectSortByRedraws preference has been set to: " (if (= newValue :vlax-true) "True"  "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-ObjectSortByRedraws preferences originalValue)
    (alert (strcat "The ObjectSortByRedraws preference was reset back to: " (if (= originalValue :vlax-true) "True"  "False")))
)


ObjectSortByRegens Property (ActiveX)

Toggles sorting of drawing objects by regeneration order.

Supported platforms: Windows only

Signature

VBA:

object.ObjectSortByRegens
object

Type: DatabasePreferences

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Enable sort by regeneration order.
  • False: Disable sort by regeneration order.

Remarks

The initial value of this property is False.

AutoCAD initially enables sorting for plotting and PostScript output only. Setting additional sorting options can result in slower regeneration and redrawing times.

NoteThe value of this property is stored in the SORTENTS system variable.

Examples

VBA:

Sub Example_ObjectSortByRegens()
    ' This example reads and modifies the preference value that controls
    ' the sorting of drawing objects by regeneration order.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadDatabasePreferences
    Dim originalValue As Variant, newValue As Variant

    ' Get the user preferences object
    Set ACADPref = ThisDrawing.preferences

    ' Read and display the original value
    originalValue = ACADPref.ObjectSortByRegens
    MsgBox "The ObjectSortByRegens preference is set to: " & originalValue

    ' Modify the ObjectSortByRegens preference by toggling the value
    ACADPref.ObjectSortByRegens = Not (ACADPref.ObjectSortByRegens)
    newValue = ACADPref.ObjectSortByRegens
    MsgBox "The ObjectSortByRegens preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.ObjectSortByRegens = originalValue
    MsgBox "The ObjectSortByRegens preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ObjectSortByRegens()
    ;; This example reads and modifies the preference value that controls
    ;; the sorting of drawing objects by regeneration order.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences doc))

    ;; Read and display the original value
    (setq originalValue (vla-get-ObjectSortByRegens preferences))
    (alert (strcat "The ObjectSortByRegens preference is set to: " (if (= originalValue :vlax-true) "True"  "False")))

    ;; Modify the ObjectSortByRegens preference by toggling the value
    (vla-put-ObjectSortByRegens preferences (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-ObjectSortByRegens preferences))
    (alert (strcat "The ObjectSortByRegens preference has been set to: " (if (= newValue :vlax-true) "True"  "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-ObjectSortByRegens preferences originalValue)
    (alert (strcat "The ObjectSortByRegens preference was reset back to: " (if (= originalValue :vlax-true) "True"  "False")))
)


ObjectSortBySelection Property (ActiveX)

Toggles sorting of drawing objects by object selection.

Supported platforms: Windows only

Signature

VBA:

object.ObjectSortBySelection
object

Type: DatabasePreferences

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Enable sort by object selection.
  • False: Disable sort by object selection.

Remarks

The initial value of this property is False.

AutoCAD initially enables sorting for plotting and PostScript output only. Setting additional sorting options can result in slower regeneration and redrawing times.

NoteThe value of this property is stored in the SORTENTS system variable.

Examples

VBA:

Sub Example_ObjectSortBySelection()
    ' This example reads and modifies the preference value that controls
    ' the sorting of drawing objects by object selection.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadDatabasePreferences
    Dim originalValue As Variant, newValue As Variant

    ' Get the user preferences object
    Set ACADPref = ThisDrawing.preferences

    ' Read and display the original value
    originalValue = ACADPref.ObjectSortBySelection
    MsgBox "The ObjectSortBySelection preference is set to: " & originalValue

    ' Modify the ObjectSortBySelection preference by toggling the value
    ACADPref.ObjectSortBySelection = Not (ACADPref.ObjectSortBySelection)
    newValue = ACADPref.ObjectSortBySelection
    MsgBox "The ObjectSortBySelection preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.ObjectSortBySelection = originalValue
    MsgBox "The ObjectSortBySelection preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ObjectSortBySelection()
    ;; This example reads and modifies the preference value that controls
    ;; the sorting of drawing objects by object selection.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences doc))

    ;; Read and display the original value
    (setq originalValue (vla-get-ObjectSortBySelection preferences))
    (alert (strcat "The ObjectSortBySelection preference is set to: " (if (= originalValue :vlax-true) "True"  "False")))

    ;; Modify the ObjectSortBySelection preference by toggling the value
    (vla-put-ObjectSortBySelection preferences (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-ObjectSortBySelection preferences))
    (alert (strcat "The ObjectSortBySelection preference has been set to: " (if (= newValue :vlax-true) "True"  "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-ObjectSortBySelection preferences originalValue)
    (alert (strcat "The ObjectSortBySelection preference was reset back to: " (if (= originalValue :vlax-true) "True"  "False")))
)


ObjectSortBySnap Property (ActiveX)

Toggles sorting of drawing objects by object snap.

Supported platforms: Windows only

Signature

VBA:

object.ObjectSortBySnap
object

Type: DatabasePreferences

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Enable sort by object snap.
  • False: Disable sort by object snap.

Remarks

The initial value of this property is False.

AutoCAD initially enables sorting for plotting and PostScript output only. Setting additional sorting options can result in slower regeneration and redrawing times.

NoteThe value of this property is stored in the SORTENTS system variable.

Examples

VBA:

Sub Example_ObjectSortBySnap()
    ' This example reads and modifies the preference value that controls
    ' the sorting of drawing objects by object snap.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadDatabasePreferences
    Dim originalValue As Variant, newValue As Variant

    ' Get the user preferences object
    Set ACADPref = ThisDrawing.preferences

    ' Read and display the original value
    originalValue = ACADPref.ObjectSortBySnap
    MsgBox "The ObjectSortBySnap preference is set to: " & originalValue

    ' Modify the ObjectSortBySnap preference by toggling the value
    ACADPref.ObjectSortBySnap = Not (ACADPref.ObjectSortBySnap)
    newValue = ACADPref.ObjectSortBySnap
    MsgBox "The ObjectSortBySnap preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.ObjectSortBySnap = originalValue
    MsgBox "The ObjectSortBySnap preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ObjectSortBySnap()
    ;; This example reads and modifies the preference value that controls
    ;; the sorting of drawing objects by object snap.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences doc))

    ;; Read and display the original value
    (setq originalValue (vla-get-ObjectSortBySnap preferences))
    (alert (strcat "The ObjectSortBySnap preference is set to: " (if (= originalValue :vlax-true) "True"  "False")))

    ;; Modify the ObjectSortBySnap preference by toggling the value
    (vla-put-ObjectSortBySnap preferences (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-ObjectSortBySnap preferences))
    (alert (strcat "The ObjectSortBySnap preference has been set to: " (if (= newValue :vlax-true) "True"  "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-ObjectSortBySnap preferences originalValue)
    (alert (strcat "The ObjectSortBySnap preference was reset back to: " (if (= originalValue :vlax-true) "True"  "False")))
)


ObliqueAngle Property (ActiveX)

Specifies the oblique angle of the object.

Supported platforms: Windows only

Signature

VBA:

object.ObliqueAngle
object

Type: Attribute, AttributeReference, Shape, Text, TextStyle

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The angle in radians within the range of -85 to +85 degrees. A positive angle denotes a lean to the right; a negative value will have 2*PI added to it to convert it to its positive equivalent.

Remarks

The oblique angle is the object's "angle of slant" away from its vertical axis.

Examples

VBA:

Sub Example_ObliqueAngle()
    ' This example creates a text object in model space.
    ' It then changes the ObliqueAngle of the text object.

    Dim textObj As AcadText
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double

    ' Define the text object
    textString = "Hello, World."
    insertionPoint(0) = 3: insertionPoint(1) = 3: insertionPoint(2) = 0
    height = 0.5

    ' Create the text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)
    ZoomAll
    MsgBox "The ObliqueAngle is " & textObj.ObliqueAngle, vbInformation, "ObliqueAngle Example"

    ' Change the value of the ObliqueAngle to 45 degrees (.707 radians)
    textObj.ObliqueAngle = 0.707
    ZoomAll
    MsgBox "The ObliqueAngle is set to " & textObj.ObliqueAngle, vbInformation, "ObliqueAngle Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ObliqueAngle()
    ;; This example creates a text object in model space.
    ;; It then changes the ObliqueAngle of the text object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the text object
    (setq insertionPoint (vlax-3d-point 3 3 0)
          textString "Hello, World."
          height 0.5)

    ;; Create the text object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq textObj (vla-AddText modelSpace textString insertionPoint height))
    (vla-ZoomAll acadObj)

    (alert (strcat "The ObliqueAngle is " (rtos (vla-get-ObliqueAngle textObj) 2)))

    ;; Change the value of the ObliqueAngle to 45 degrees (.707 radians)
    (vla-put-ObliqueAngle textObj 0.707)
    (vla-ZoomAll acadObj)
    (alert (strcat "The ObliqueAngle is set to " (rtos (vla-get-ObliqueAngle textObj) 2)))
)


OleItemType Property (ActiveX)

Specifies whether the OLE object is linked to the original pasted file when opening the object for editing.

Supported platforms: Windows only

Signature

VBA:

object.OleItemType
object

Type: OLE

The object this property applies to.

Property Value

Read-only: No

Type: AcOleType enum

  • acOTEmbedded
  • acOTLink
  • acOTStatic

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


OLELaunch Property (ActiveX)

Determines whether to launch the parent application when plotting OLE objects.

Supported platforms: Windows only

Signature

VBA:

object.OLELaunch
object

Type: DatabasePreferences

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The parent application of an OLE object is launched to print it.
  • False: The OLE object is printed from AutoCAD.

Remarks

The initial value of this property is False.

Plotting from the parent application achieves a higher quality plot; however, the speed of the plot is decreased.

NoteThe value of this property is stored in the OLESTARTUP system variable.

Examples

VBA:

Sub Example_OLELaunch()
    ' This example reads and modifies the preference value that controls
    ' whether to launch the parent application when plotting OLE objects.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadDatabasePreferences
    Dim originalValue As Variant, newValue As Variant

    ' Get the user preferences object
    Set ACADPref = ThisDrawing.preferences

    ' Read and display the original value
    originalValue = ACADPref.OLELaunch
    MsgBox "The OLELaunch preference is set to: " & originalValue

    ' Modify the OLELaunch preference by toggling the value
    ACADPref.OLELaunch = Not (ACADPref.OLELaunch)
    newValue = ACADPref.OLELaunch
    MsgBox "The OLELaunch preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.OLELaunch = originalValue
    MsgBox "The OLELaunch preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_OLELaunch()
    ;; This example reads and modifies the preference value that controls
    ;; whether to launch the parent application when plotting OLE objects.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences doc))

    ;; Read and display the original value
    (setq originalValue (vla-get-OLELaunch preferences))
    (alert (strcat "The OLELaunch preference is set to: " (if (= originalValue :vlax-true) "True"  "False")))

    ;; Modify the OLELaunch preference by toggling the value
    (vla-put-OLELaunch preferences (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-OLELaunch preferences))
    (alert (strcat "The OLELaunch preference has been set to: " (if (= newValue :vlax-true) "True"  "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-OLELaunch preferences originalValue)
    (alert (strcat "The OLELaunch preference was reset back to: " (if (= originalValue :vlax-true) "True"  "False")))
)


OlePlotQuality Property (ActiveX)

Controls the plot quality of an OLE object based on the file type selected from the list.

Supported platforms: Windows only

Signature

VBA:

object.OlePlotQuality
object

Type: OLE

The object this property applies to.

Property Value

Read-only: No

Type: AcOlePlotQuality enum

  • acOPQHighGraphics
  • acOPQLowGraphics
  • acOPQMonochrome

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


OLEQuality Property (ActiveX)

Specifies the plot quality of OLE objects.

Supported platforms: Windows only

Signature

VBA:

object.OLEQuality
object

Type: PreferencesOutput

The object this property applies to.

Property Value

Read-only: No

Type: acOleQuality enum

  • acOQLineArt
  • acOQText
  • acOQGraphics
  • acOQPhoto
  • acOQHighPhoto

Remarks

The initial value for this property is acOQText.

NoteThe value for this property is stored in the OLEQUALITY system variable.

Examples

VBA:

Sub Example_OLEQuality()
    ' This example reads and modifies the preference value that controls
    ' the plot quality of OLE objects. When finished, this example resets
    ' the preference value back to its original value.

    Dim ACADPref As AcadPreferencesOutput
    Dim originalValue As Variant, DisplayValue As String

    ' Get the output preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Output

    ' Store original value
    originalValue = ACADPref.OLEQuality

    ' Read and display the original value
    GoSub GETVALUE
    MsgBox "The OLEQuality preference is currently set to: " & DisplayValue

    ' Modify the OLEQuality preference by changing it to High Quality Photographic
    ACADPref.OLEQuality = acOQHighPhoto
    GoSub GETVALUE
    MsgBox "The OLEQuality preference has been set to: " & DisplayValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.OLEQuality = originalValue
    GoSub GETVALUE
    MsgBox "The OLEQuality preference was reset back to: " & DisplayValue

    Exit Sub

GETVALUE:
    ' Convert the value of this setting to a meaningful text string
    DisplayValue = ACADPref.OLEQuality
    Select Case DisplayValue
        Case acOQLineArt: DisplayValue = "Line Art"
        Case acOQText: DisplayValue = "Text"
        Case acOQGraphics: DisplayValue = "Graphics"
        Case acOQPhoto: DisplayValue = "Photo"
        Case acOQHighPhoto: DisplayValue = "High Photo"
    End Select

    Return

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_OLEQuality()
    ;; This example reads and modifies the preference value that controls
    ;; the plot quality of OLE objects. When finished, this example resets
    ;; the preference value back to its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Store original value
    (setq originalValue (vla-get-OLEQuality (vla-get-Output preferences)))

    ;; Read and display the original value
    (setq DisplayValue (cond
                           ((= (vla-get-OLEQuality (vla-get-Output preferences)) acOQLineArt) "Line Art")
                           ((= (vla-get-OLEQuality (vla-get-Output preferences)) acOQText) "Text")
                           ((= (vla-get-OLEQuality (vla-get-Output preferences)) acOQGraphics) "Graphics")
                           ((= (vla-get-OLEQuality (vla-get-Output preferences)) acOQPhoto) "Photo")
                           ((= (vla-get-OLEQuality (vla-get-Output preferences)) acOQHighPhoto) "High Photo")
                       ))
    (alert (strcat "The OLEQuality preference is currently set to: " DisplayValue))

    ;; Modify the OLEQuality preference by changing it to High Quality Photographic
    (vla-put-OLEQuality (vla-get-Output preferences) acOQHighPhoto)
    (setq DisplayValue (cond
                           ((= (vla-get-OLEQuality (vla-get-Output preferences)) acOQLineArt) "Line Art")
                           ((= (vla-get-OLEQuality (vla-get-Output preferences)) acOQText) "Text")
                           ((= (vla-get-OLEQuality (vla-get-Output preferences)) acOQGraphics) "Graphics")
                           ((= (vla-get-OLEQuality (vla-get-Output preferences)) acOQPhoto) "Photo")
                           ((= (vla-get-OLEQuality (vla-get-Output preferences)) acOQHighPhoto) "High Photo")
                       ))
    (alert (strcat "The OLEQuality preference has been set to: " DisplayValue))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-OLEQuality (vla-get-Output preferences) originalValue)
    (setq DisplayValue (cond
                           ((= (vla-get-OLEQuality (vla-get-Output preferences)) acOQLineArt) "Line Art")
                           ((= (vla-get-OLEQuality (vla-get-Output preferences)) acOQText) "Text")
                           ((= (vla-get-OLEQuality (vla-get-Output preferences)) acOQGraphics) "Graphics")
                           ((= (vla-get-OLEQuality (vla-get-Output preferences)) acOQPhoto) "Photo")
                           ((= (vla-get-OLEQuality (vla-get-Output preferences)) acOQHighPhoto) "High Photo")
                       ))
    (alert (strcat "The OLEQuality preference was reset back to: " DisplayValue))
)


OleSourceApp Property (ActiveX)

Specifies the application for editing the OLE object.

Supported platforms: Windows only

Signature

VBA:

object.OleSourceApp
object

Type: OLE

The object this property applies to.

Property Value

Read-only: No

Type: String

The application for editing the OLE object.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


OnMenuBar Property (ActiveX)

Determines if the specified popup menu is on the menu bar.

Supported platforms: Windows only

Signature

VBA:

object.OnMenuBar
object

Type: PopupMenu

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: This menu is on the menu bar.
  • False: This menu is not on the menu bar.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_OnMenuBar()
    ' This example creates a new menu called TestMenu and inserts a menu item
    ' into it. The menu is then displayed on the menu bar, and then
    ' removed from the menu bar.

    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    ' Create the new menu
    Dim newMenu As AcadPopupMenu
    Set newMenu = currMenuGroup.Menus.Add("TestMenu")

    ' Add a menu item to the new menu
    Dim newMenuItem As AcadPopupMenuItem
    Dim openMacro As String
    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set newMenuItem = newMenu.AddMenuItem(newMenu.count + 1, "Open", openMacro)

    ' Display the menu on the menu bar
    newMenu.InsertInMenuBar (ThisDrawing.Application.MenuBar.count + 1)
    GoSub QUERYMENU

    ' Remove the menu from the menu bar
    currMenuGroup.Menus.RemoveMenuFromMenuBar ("TestMenu")
    GoSub QUERYMENU
    Exit Sub

QUERYMENU:
    If newMenu.OnMenuBar Then
        MsgBox "The menu called " & newMenu.name & " is on the menu bar."
    Else
        MsgBox "The menu called " & newMenu.name & " is not on the menu bar."
    End If
    Return

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_OnMenuBar()
    ;; This example creates a new menu called TestMenu and inserts a menu item
    ;; into it. The menu is then displayed on the menu bar, and then
    ;; removed from the menu bar.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new menu
    (setq newMenu (vla-Add (vla-get-Menus currMenuGroup) "TestMenu"))

    ;; Add a menu item to the new menu
    ;; Assign the macro string the VB equivalent of "ESC ESC _open "
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))
    (setq newMenuItem (vla-AddMenuItem newMenu (1+ (vla-get-Count newMenu)) "Open" openMacro))

    ;; Display the menu on the menu bar
    (vla-InsertInMenuBar newMenu (1+ (vla-get-Count (vla-get-MenuBar acadObj))))
    (if (= (vla-get-OnMenuBar newMenu) :vlax-true)
        (alert (strcat "The menu called " (vla-get-Name newMenu) " is on the menu bar."))
        (alert (strcat "The menu called " (vla-get-Name newMenu) " is not on the menu bar."))
    )

    ;; Remove the menu from the menu bar
    (vla-RemoveMenuFromMenuBar (vla-get-Menus currMenuGroup) "TestMenu")
    (if (= (vla-get-OnMenuBar newMenu) :vlax-true)
        (alert (strcat "The menu called " (vla-get-Name newMenu) " is on the menu bar."))
        (alert (strcat "The menu called " (vla-get-Name newMenu) " is not on the menu bar."))
    )
)


OpenSave Property (ActiveX)

Gets the PreferencesOpenSave object.

Supported platforms: Windows only

Signature

VBA:

object.OpenSave
object

Type: Preferences

The object this property applies to.

Property Value

Read-only: Yes

Type: PreferencesOpenSave

Gets the PreferencesOpenSave object.

Remarks

The PreferencesOpenSave object holds all the options from the Open and Save tab on the Options dialog stored in the registry. All options that are stored with the drawing can be found on the DatabasePreferences object.

Examples

VBA:

Sub Example_OpenSave()
    ' This example obtains a reference to the OpenSave Preferences object
    ' from the Application Preferences object, and reads one of the OpenSave
    ' preferences

    Dim ACADPref As AcadPreferencesOpenSave

    ' Obtain a reference to the OpenSave Preferences object
    Set ACADPref = ThisDrawing.Application.preferences.OpenSave

    MsgBox "You now have access to the properties and methods of the OpenSave Preferences object!"
    MsgBox "The OpenSave preference TempFileExtension is set to: " & ACADPref.TempFileExtension

End Sub

Visual LISP:

Not available


Origin Property (ActiveX)

Specifies the origin of the UCS, block, hatch, or raster image in WCS coordinates.

Supported platforms: Windows only

Signature

VBA:

object.Origin
object

Type: Block, GeomapImage, Hatch, ModelSpace, PaperSpace, RasterImage, UCS, Wipeout

The objects this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles) or Variant (two-element array of doubles) for Layout and PlotConfiguration objects

3D Point: A 3D WCS coordinate specifying the origin of the object.

2D Point: The X and Y values representing the origin relative to the lower-left corner of the media.

Remarks

Hatch: This property is the origin coordinates for the pattern of the hatch entity.

Examples

VBA:

Sub Example_Origin()
    ' This example creates a UCS and returns its origin.

    Dim viewportObj As AcadViewport

    ' Set the viewportObj variable to the activeviewport
    Set viewportObj = ThisDrawing.ActiveViewport

    ' Create a new UCS with origin 2, 2, 0
    Dim ucsObj As AcadUCS
    Dim origin(0 To 2) As Double
    Dim xAxisPoint(0 To 2) As Double
    Dim yAxisPoint(0 To 2) As Double

    origin(0) = 2: origin(1) = 2: origin(2) = 0
    xAxisPoint(0) = 3: xAxisPoint(1) = 2: xAxisPoint(2) = 0
    yAxisPoint(0) = 2: yAxisPoint(1) = 3: yAxisPoint(2) = 0

    Set ucsObj = ThisDrawing.UserCoordinateSystems.Add(origin, xAxisPoint, yAxisPoint, "UCS1")
    ThisDrawing.ActiveUCS = ucsObj
    viewportObj.UCSIconOn = True
    viewportObj.UCSIconAtOrigin = True
    ThisDrawing.ActiveViewport = viewportObj

    ' Display the current origin for the new UCS
    MsgBox "The origin of the UCS is: " & ucsObj.origin(0) & ", " & ucsObj.origin(1) & ", " & ucsObj.origin(2), , "Origin Example"

    ' Change the origin of the UCS
    origin(0) = 4: origin(1) = 4: origin(2) = 0
    ucsObj.origin = origin

    ' Reset the active UCS and viewport to see the change
    ThisDrawing.ActiveUCS = ucsObj
    ThisDrawing.ActiveViewport = viewportObj

    MsgBox "The origin of the UCS is now: " & ucsObj.origin(0) & ", " & ucsObj.origin(1) & ", " & ucsObj.origin(2), , "Origin Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Origin()
    ;; This example creates a UCS and returns its origin.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Set the viewportObj variable to the activeviewport
    (setq viewportObj (vla-get-ActiveViewport doc))

    ;; Create a new UCS with origin 2, 2, 0
    (setq origin (vlax-3d-point 2 2 0)
          xAxisPoint (vlax-3d-point 3 2 0)
          yAxisPoint (vlax-3d-point 2 3 0))

    (setq ucsObj (vla-Add (vla-get-UserCoordinateSystems doc) origin xAxisPoint yAxisPoint "UCS1"))
    (vla-put-ActiveUCS doc ucsObj)
    (vla-put-UCSIconOn viewportObj :vlax-true)
    (vla-put-UCSIconAtOrigin viewportObj :vlax-true)
    (vla-put-ActiveViewport doc viewportObj)

    ;; Display the current origin for the new UCS
    (alert (strcat "The origin of the UCS is: " (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-Origin ucsObj)) 0) 2) ", "
                                                (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-Origin ucsObj)) 1) 2) ", "
                                                (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-Origin ucsObj)) 2) 2)))

    ;; Change the origin of the UCS
    (setq origin (vlax-3d-point 4 4 0))
    (vla-put-Origin ucsObj origin)

    ;; Reset the active UCS and viewport to see the change
    (vla-put-ActiveUCS doc ucsObj)
    (vla-put-ActiveViewport doc viewportObj)

    (alert (strcat "The origin of the UCS is now: " (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-Origin ucsObj)) 0) 2) ", "
                                                    (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-Origin ucsObj)) 1) 2) ", "
                                                    (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-Origin ucsObj)) 2) 2)))
)


OrthoOn Property (ActiveX)

Specifies the status of the Isometric snap mode for the viewport.

Supported platforms: Windows only

Signature

VBA:

object.OrthoOn
object

Type: Viewport

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Isometric snap mode is on.
  • False: Isometric snap mode is off.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_OrthoOn()
    ' This example toggles the setting of OrthoOn.

    Dim viewportObj As AcadViewport

    ' Set the viewportObj variable to the activeviewport
    Set viewportObj = ThisDrawing.ActiveViewport

    ' Display the current setting of OrthoOn
    MsgBox "Isometric snap mode is: " & IIf(viewportObj.OrthoOn, "On", "Off"), , "OrthoOn Example"

    ' Toggle the setting of OrthoOn
    viewportObj.OrthoOn = Not (viewportObj.OrthoOn)

    ' Reset the active viewport to see the change on the AutoCAD status bar
    ThisDrawing.ActiveViewport = viewportObj

    MsgBox "Isometric snap mode is now: " & IIf(viewportObj.OrthoOn, "On", "Off"), , "OrthoOn Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_OrthoOn()
    ;; This example toggles the setting of OrthoOn.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Set the viewportObj variable to the activeviewport
    (setq viewportObj (vla-get-ActiveViewport doc))

    ;; Display the current setting of OrthoOn
    (alert (strcat "Isometric snap mode is: " (if (= (vla-get-OrthoOn viewportObj) :vlax-true) "On" "Off")))

    ;; Toggle the setting of OrthoOn
    (vla-put-OrthoOn viewportObj (if (= (vla-get-OrthoOn viewportObj) :vlax-true) :vlax-false :vlax-true))

    ;; Reset the active viewport to see the change on the AutoCAD status bar
    (vla-put-ActiveViewport doc viewportObj)

    (alert (strcat "Isometric snap mode is now: " (if (= (vla-get-OrthoOn viewportObj) :vlax-true) "On" "Off")))
)


Output Property (ActiveX)

Gets the PreferencesOutput object.

Supported platforms: Windows only

Signature

VBA:

object.Output
object

Type: Preferences

The object this property applies to.

Property Value

Read-only: Yes

Type: PreferencesOutput

Gets the PreferencesOutput object.

Remarks

The PreferencesOutput object holds all the options from the Output tab on the Options dialog stored in the registry. All options that are stored with the drawing can be found on the DatabasePreferences object.

Examples

VBA:

Sub Example_Output()
    ' This example obtains a reference to the Output Preferences object
    ' from the Application Preferences object, and reads one of the Output
    ' preferences

    Dim ACADPref As AcadPreferencesOutput

    ' Obtain a reference to the Output Preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Output

    MsgBox "You now have access to the properties and methods of the Output Preferences object!"
    MsgBox "The Output preference DefaultOutputDevice is set to: " & ACADPref.DefaultOutputDevice

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Output()
    ;; This example obtains a reference to the Output Preferences object
    ;; from the Application Preferences object, and reads one of the Output
    ;; preferences
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Obtain a reference to the Output Preferences object
    (alert (strcat "You now have access to the properties and methods of the Output Preferences object!"
                   "\nThe Output preference DefaultOutputDevice is set to: " (vla-get-DefaultOutputDevice (vla-get-Output preferences))))
)


OverrideCenter Property (ActiveX)

Specifies the override center location.

Supported platforms: Windows only

Signature

VBA:

object.OverrideCenter
object

Type: DimRadialLarge

The object this property applies to.

Property Value

Read-only: No

Type: Variant

The override center location.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


OverwritePropChanged Property (ActiveX)

Indicates whether properties were changed.

Supported platforms: Windows only

Signature

VBA:

object.OverwritePropChanged
object

Type: MLeaderStyle

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: Properties were changed.
  • False: Properties were not changed.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


OwnerID Property (ActiveX)

Gets the object ID of the owner (parent) object.

Supported platforms: Windows only

Signature

VBA:

object.OwnerID
object

Type: All drawing objects, AttributeReference, Block, Blocks, Dictionary, Dictionaries, Dimension, DimStyle, DimStyles, Group, Groups, Layer, Layers, Layout, Layouts, Linetype, Linetypes, Material, Materials, MLeaderStyle, ModelSpace, PaperSpace, PlotConfiguration, PlotConfigurations, RegisteredApplication, RegisteredApplications, SectionManager, SectionSettings, SortentsTable, TableStyle, TextStyle, TextStyles, UCS, UCSs, View, Views, Viewport, Viewports, XRecord

The objects this property applies to.

Property Value

Read-only: Yes

Type: Long_PTR

The object ID of an object's owner.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_OwnerID()
    ' This example creates an MText object in model space
    ' and then finds the OwnerID for the object.

    Dim MTextObj As AcadMText
    Dim corner(0 To 2) As Double
    Dim width As Double
    Dim text As String
    corner(0) = 0#: corner(1) = 10#: corner(2) = 0#
    width = 10
    text = "This is the text string for the MText object"

    ' Creates the MText object
    Set MTextObj = ThisDrawing.ModelSpace.AddMText(corner, width, text)
    ZoomAll

    MsgBox "The OwnerID for the MText object is: " & MTextObj.OwnerID

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_OwnerID()
    ;; This example creates an MText object in model space
    ;; and then finds the OwnerID for the object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq corner (vlax-3d-point 0 10 0)
          width 10
          text "This is the text string for the MText object")

    ;; Creates the MText object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MTextObj (vla-AddMText modelSpace corner width text))
    (vla-ZoomAll acadObj)

    (alert (strcat "The OwnerID for the MText object is: " (itoa (vla-get-OwnerID MTextObj))))
)


PageSetupOverridesTemplateFile Property (ActiveX)

Specifies the default template for Page Setup overrides.

Supported platforms: Windows only

Signature

VBA:

object.PageSetupOverridesTemplateFile
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The default drawing template file that contains page setup overrides.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_PageSetupOverridesTemplateFile()

    ' Note: Change the file path and name to a valid file on your system.

    Dim MyFiles As AcadPreferencesFiles
    Set MyFiles = AcadApplication.Preferences.Files
    MyFiles.PageSetupOverridesTemplateFile = "C:\MyTemplate.dwt"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PageSetupOverridesTemplateFile()
    ; Note: Change the file path and name to a valid file on your system.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    (setq MyFiles (vla-get-Files preferences))
    (vla-put-PageSetupOverridesTemplateFile MyFiles "C:\\MyTemplate.dwt")
)


PaperSpace Property (ActiveX)

Gets the PaperSpace collection for the document.

Supported platforms: Windows only

Signature

VBA:

object.PaperSpace
object

Type: Database, Document

The objects this property applies to.

Property Value

Read-only: Yes

Type: PaperSpace

The PaperSpace collection for the document.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_PaperSpace()
    ' This example sets the variable pspace to the paper space object collection.

    Dim pspace As AcadPaperSpace
    Set pspace = ThisDrawing.PaperSpace

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PaperSpace()
    ;; This example sets the variable pspace to the paper space object collection.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq pspace (vla-get-PaperSpace doc))
)


PaperUnits Property (ActiveX)

Specifies the units for the display of layout or plot configuration properties.

Supported platforms: Windows only

Signature

VBA:

object.PaperUnits
object

Type: Layout, PlotConfiguration

The objects this property applies to.

Property Value

Read-only: No

Type: acPlotPaperUnits enum

  • acInches
  • acMillimeters
  • acPixels

Remarks

This property determines the units for the display of the layout or plot configuration in the user interface. This property does not determine the units for input or query of the ActiveX Automation properties. All ActiveX Automation properties are represented in millimeters or radians, regardless of the units settings.

Changes to this property will not be visible until after a regeneration of the drawing. Use the Regen method to regenerate the drawing.

Examples

VBA:

Sub Example_PaperUnits()
    ' This example will access the Layouts collection for the current drawing
    ' and list basic information about the paper units used for each Layout.

    Dim Layouts As AcadLayouts, Layout As ACADLayout
    Dim msg As String
    Dim Measurement As String

    ' Get layouts collection from document object
    Set Layouts = ThisDrawing.Layouts

    msg = vbCrLf   ' Start with a space

    ' Get the paper units information of every layout in this drawing
    For Each Layout In Layouts
        ' Using inches or millimeters?
        Measurement = IIf(Layout.PaperUnits = acInches, " inches", " millimeters")

        ' Format for display
        msg = msg & Layout.name & " is using" & Measurement & vbCrLf
    Next

    ' Display paper units information
    MsgBox "The paper units used in the current drawing are: " & msg
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PaperUnits()
    ;; This example will access the Layouts collection for the current drawing
    ;; and list basic information about the paper units used for each Layout.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get layouts collection from document object
    (setq Layouts (vla-get-Layouts doc))

    (setq msg ""
          Measurement "")

    ;; Get the paper units information of every layout in this drawing
    (vlax-for Layout Layouts
        ;; Using inches or millimeters?
        (setq Measurement (if (= (vla-get-PaperUnits Layout) acInches) " inches" " millimeters"))

        ;; Format for display
        (setq msg (strcat msg (vla-get-Name Layout) " is using" Measurement "\n"))
    )

    ;; Display paper units information
    (alert (strcat "The paper units used in the current drawing are: \n" msg))
)


Parent Property (ActiveX)

Gets the parent of the object.

Supported platforms: Windows only

Signature

VBA:

object.Parent
object

Type: MenuBar, MenuGroup, MenuGroups, PopupMenu, PopupMenuItem, PopupMenus, Toolbar, ToolbarItem, Toolbars

The objects this property applies to.

Property Value

Read-only: Yes / No

Type: Object

The user-specified variable must be declared as an appropriate object type. The valid object types are: Application, MenuBar, MenuGroup, MenuGroups, PopupMenu, PopupMenus, Toolbar, Toolbars

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Parent()
    ' This example creates a new toolbar and then finds the parent toolbar.
    ' To remove the toolbar after execution of this macro, use the Customize Menu
    ' option from the Tools menu.

    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    ' Create the new toolbar
    Dim newToolBar As AcadToolbar
    Set newToolBar = currMenuGroup.Toolbars.Add("MyTools")

    ' Add a button to the new toolbar.
    ' All three buttons will have the same macro attached.
    Dim newButton1 As AcadToolbarItem
    Dim openMacro As String

    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set newButton1 = newToolBar.AddToolbarButton("", "OpenFile", "Open a file.", openMacro)

    ' Display the toolbar
    newToolBar.Visible = True

    ' Find the parent toolbar for the toolbar button
    MsgBox "The " & newButton1.name & " button is on the " & newButton1.Parent.name & " toolbar."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Parent()
    ;; This example creates a new toolbar and then finds the parent toolbar.
    ;; To remove the toolbar after execution of this macro, use the Customize Menu
    ;; option from the Tools menu.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new toolbar
    (setq newToolBar (vla-Add (vla-get-Toolbars currMenuGroup) "MyTools"))

    ;; Add a button to the new toolbar.
    ;; All three buttons will have the same macro attached.
    ;; Assign the macro string the VB equivalent of "ESC ESC _open "
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))
    (setq newButton1 (vla-AddToolbarButton newToolBar "" "OpenFile" "Open a file." openMacro))

    ;; Display the toolbar
    (vla-put-Visible newToolBar :vlax-true)

    ;; Find the parent toolbar for the toolbar button
    (alert (strcat "The " (vla-get-Name newButton1) " button is on the " (vla-get-Name (vla-get-Parent newButton1)) " toolbar."))
)


Password Property (ActiveX)

Specifies the encryption password.

Supported platforms: Windows only

Signature

VBA:

object.Password
object

Type: SecurityParams

The object this property applies to.

Property Value

Read-only: No

Type: String

The encryption password.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Password()
    ' This example opens a password-protected file, closes it, and then opens another
    ' password-protected file.

    ThisDrawing.Application.Documents.Open "C:\MyDrawing.dwg", , "MYPASSWORD"
    'AutoCAD converts all passwords to uppercase before applying them

    ThisDrawing.Close

    ThisDrawing.Application.Documents.Open "C:\MyDrawing2.dwg", , "MYSECONDPASSWORD"
End Sub

Visual LISP:

Not available


Path Property (ActiveX)

Gets the path of the block, document, application, or external reference.

Supported platforms: Windows only

Signature

VBA:

object.Path
object

Type: Application, Block, Document, ExternalReference, PointCloud, PointCloudEx

The objects this property applies to.

Property Value

Read-only: Yes; except for the ExternalReference and Block objects

Type: String

The path of the application, document, or external reference.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Path()
    ' This example returns the path of the drawing and application.

    ' If the drawing has not been saved, the path of the
    ' document will be blank.
    Dim docPath As String
    docPath = ThisDrawing.Path
    MsgBox "The Path of the current drawing is " & docPath, , "Path Example"

    Dim appPath As String
    appPath = ThisDrawing.Application.Path
    MsgBox "The Path of the current appication is " & appPath, , "Path Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Path()
    ;; This example returns the path of the drawing and application.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; If the drawing has not been saved, the path of the
    ;; document will be blank.
    (setq docPath (vla-get-Path doc))
    (alert (strcat "The Path of the current drawing is " docPath))

    (setq appPath (vla-get-Path acadObj))
    (alert (strcat "The Path of the current appication is " appPath))
)


PatternAngle Property (ActiveX)

Specifies the angle of the hatch pattern.

Supported platforms: Windows only

Signature

VBA:

object.PatternAngle
object

Type: Hatch

The object this property applies to.

Property Value

Read-only: No

Type: Double

The angle in radians. The valid range is 0 to 6.28.

Remarks

NoteThe value of this property is stored in the HPANG system variable.

Examples

VBA:

Sub Example_PatternAngle()
    ' This example creates an associative hatch in model space.
    ' The angle of the hatch pattern is returned, and updated.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "ANSI31"
    PatternType = 0
    bAssociativity = True

    ' Create the associative Hatch object
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)

    ' Create the outer loop for the hatch
    ' An arc and a line are used to create a closed loop

    Dim outerLoop(0 To 1) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    center(0) = 5: center(1) = 3: center(2) = 0
    radius = 3
    startAngle = 0
    endAngle = 3.141592
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddArc(center, radius, startAngle, endAngle)
    Set outerLoop(1) = ThisDrawing.ModelSpace.AddLine(outerLoop(0).startPoint, outerLoop(0).endPoint)

    ' Append the outer loop to the hatch object
    hatchObj.AppendOuterLoop (outerLoop)

    ' Append the first circle as one inner loop
    Dim innerLoop1(0) As AcadEntity
    center(0) = 5: center(1) = 4.5: center(2) = 0
    radius = 1
    Set innerLoop1(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop1)

    ' Append the second circle as the other inner loop
    Dim innerLoop2(0) As AcadEntity
    radius = 0.5
    Set innerLoop2(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop2)

    ' Evaluate and display the hatch
    hatchObj.Evaluate
    ThisDrawing.Regen True

    ' Find the angle of the hatch pattern
    Dim patternAngle As Double
    patternAngle = hatchObj.patternAngle
    MsgBox "The angle of the hatch pattern is " & hatchObj.patternAngle, , "PatternAngle Example"

    ' Change the angle of the hatch pattern
    hatchObj.patternAngle = 5.25
    hatchObj.Evaluate
    ThisDrawing.Regen True
    MsgBox "The angle of the hatch pattern is now " & hatchObj.patternAngle, , "PatternAngle Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PatternAngle()
    ;; This example creates an associative hatch in model space.
    ;; The angle of the hatch pattern is returned, and updated.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "ANSI31"
          patternType 0
          bAssociativity :vlax-true)

    ;; Create the associative Hatch object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acHatchObject))

    ;; Create the outer loop for the hatch
    ;; An arc and a line are used to create a closed loop
    (setq center (vlax-3d-point 5 3 0)
          radius 3
          startAngle 0
          endAngle 3.141592)

    (setq arc (vla-AddArc modelSpace center radius startAngle endAngle))
    (setq line (vla-AddLine modelSpace (vla-get-StartPoint arc) (vla-get-EndPoint arc)))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element outerLoop 0 arc)
    (vlax-safearray-put-element outerLoop 1 line)

    ;; Append the outer loop to the hatch object
    (vla-AppendOuterLoop hatchObj outerLoop)

    ;; Append the first circle as one inner loop
    (setq center (vlax-3d-point 5 4.5 0)
          radius 1)
    (setq circle1 (vla-AddCircle modelSpace center radius))

    (setq innerLoop1 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element innerLoop1 0 circle1)

    (vla-AppendInnerLoop hatchObj innerLoop1)

    ;; Append the second circle as the other inner loop
    (setq radius 0.5)
    (setq innerLoop2 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (setq circle2 (vla-AddCircle modelSpace center radius))
    (vlax-safearray-put-element innerLoop2 0 circle2)

    (vla-AppendInnerLoop hatchObj innerLoop2)

    ;; Evaluate and display the hatch
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)

    ;; Find the angle of the hatch pattern
    (setq patternAngle (vla-get-PatternAngle hatchObj))
    (alert (strcat "The angle of the hatch pattern is " (rtos (vla-get-PatternAngle hatchObj) 2)))

    ;; Change the angle of the hatch pattern
    (vla-put-PatternAngle hatchObj 5.25)
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)
    (alert (strcat "The angle of the hatch pattern is now " (rtos (vla-get-PatternAngle hatchObj) 2)))
)


PatternDouble Property (ActiveX)

Specifies if the user-defined hatch is double-hatched.

Supported platforms: Windows only

Signature

VBA:

object.PatternDouble
object

Type: Hatch

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Double pattern is on.
  • False: Double pattern is off.

Remarks

If the PatternType property is set to acHatchPatternTypePreDefined or acHatchPatternTypeCustomDefined, then the PatternDouble property is not used.

NoteThe value of this property is stored in the HPDOUBLE system variable.

Examples

VBA:

Sub Example_PatternDouble()
    ' This example creates an associative hatch in model space.
    ' It then returns whether or not the pattern is doubled, and
    ' then changes that value.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "ansi31"
    PatternType = acHatchPatternTypePreDefined
    bAssociativity = True

    ' Create the associative Hatch object
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)

    ' Create the outer loop for the hatch.
    ' An arc and a line are used to create a closed loop.

    Dim outerLoop(0 To 1) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    center(0) = 5: center(1) = 3: center(2) = 0
    radius = 3
    startAngle = 0
    endAngle = 3.141592
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddArc(center, radius, startAngle, endAngle)
    Set outerLoop(1) = ThisDrawing.ModelSpace.AddLine(outerLoop(0).startPoint, outerLoop(0).endPoint)

    ' Append the outer loop to the hatch object
    hatchObj.AppendOuterLoop (outerLoop)

    ' Append the first circle as one inner loop
    Dim innerLoop1(0) As AcadEntity
    center(0) = 5: center(1) = 4.5: center(2) = 0
    radius = 1
    Set innerLoop1(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop1)

    ' Append the second circle as the other inner loop
    Dim innerLoop2(0) As AcadEntity
    radius = 0.5
    Set innerLoop2(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop2)

    ' Evaluate and display the hatch
    hatchObj.Evaluate
    ThisDrawing.Regen True

    ' Determine if the pattern is doubled
    Dim patternDouble As Boolean
    patternDouble = hatchObj.patternDouble
    MsgBox "Pattern doubling: " & hatchObj.patternDouble, , "PatternDouble Example"

    ' Change the angle of the hatch pattern
    hatchObj.patternDouble = Not (hatchObj.patternDouble)
    hatchObj.Evaluate
    ThisDrawing.Regen True
    MsgBox "Pattern doubling: " & hatchObj.patternDouble, , "PatternDouble Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PatternDouble()
    ;; This example creates an associative hatch in model space.
    ;; It then returns whether or not the pattern is doubled, and
    ;; then changes that value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "ANSI31"
          patternType acHatchPatternTypePreDefined
          bAssociativity :vlax-true)

    ;; Create the associative Hatch object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acHatchObject))

    ;; Create the outer loop for the hatch.
    ;; An arc and a line are used to create a closed loop.
    (setq center (vlax-3d-point 5 3 0)
          radius 3
          startAngle 0
          endAngle 3.141592)

    (setq arc (vla-AddArc modelSpace center radius startAngle endAngle))
    (setq line (vla-AddLine modelSpace (vla-get-StartPoint arc) (vla-get-EndPoint arc)))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element outerLoop 0 arc)
    (vlax-safearray-put-element outerLoop 1 line)

    ;; Append the outer loop to the hatch object
    (vla-AppendOuterLoop hatchObj outerLoop)

    ;; Append the first circle as one inner loop
    (setq center (vlax-3d-point 5 4.5 0)
          radius 1)
    (setq circle1 (vla-AddCircle modelSpace center radius))

    (setq innerLoop1 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element innerLoop1 0 circle1)

    (vla-AppendInnerLoop hatchObj innerLoop1)

    ;; Append the second circle as the other inner loop
    (setq radius 0.5)
    (setq innerLoop2 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (setq circle2 (vla-AddCircle modelSpace center radius))
    (vlax-safearray-put-element innerLoop2 0 circle2)

    (vla-AppendInnerLoop hatchObj innerLoop2)

    ;; Evaluate and display the hatch
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)

    ;; Determine if the pattern is doubled
    (setq patternDouble (vla-get-PatternDouble hatchObj))
    (alert (strcat "Pattern doubling: " (if (= patternDouble :vlax-true) "True" "False")))

    ;; Change the angle of the hatch pattern
    (vla-put-PatternDouble hatchObj (if (= patternDouble :vlax-true) :vlax-false :vlax-true))
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)
    (alert (strcat "Pattern doubling: " (if (= (vla-get-PatternDouble hatchObj) :vlax-true) "True" "False")))
)


PatternName Property (ActiveX)

Specifies the hatch pattern name.

Supported platforms: Windows only

Signature

VBA:

object.PatternName
object

Type: Hatch

The object this property applies to.

Property Value

Read-only: No

Type: String

The hatch pattern name.

Remarks

The default hatch pattern name can be up to 34 characters, no spaces allowed. Returns "" if there is no default. Enter a period (.) to set no default.

If the PatternType property is set to acHatchPatternTypePreDefined, then the PatternName property refers to the name of a hatch pattern in acad.pat.

If the PatternType property is set to acHatchPatternTypeCustomDefined, then the PatternName property refers to the name of a hatch pattern in a custom .pat file.

If the PatternType property is set to acHatchPatternTypeUserDefined, then the PatternName property is not used.

NoteThe value of this property is stored in the HPNAME system variable.

Examples

VBA:

Sub Example_PatternName()
    ' This example creates an associative hatch in model space.
    ' The name of the hatch pattern is then returned.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "ANSI31"
    PatternType = 0
    bAssociativity = True

    ' Create the associative Hatch object
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)

    ' Create the outer loop for the hatch.
    ' An arc and a line are used to create a closed loop.

    Dim outerLoop(0 To 1) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    center(0) = 5: center(1) = 3: center(2) = 0
    radius = 3
    startAngle = 0
    endAngle = 3.141592
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddArc(center, radius, startAngle, endAngle)
    Set outerLoop(1) = ThisDrawing.ModelSpace.AddLine(outerLoop(0).startPoint, outerLoop(0).endPoint)

    ' Append the outer loop to the hatch object
    hatchObj.AppendOuterLoop (outerLoop)

    ' Append the first circle as one inner loop
    Dim innerLoop1(0) As AcadEntity
    center(0) = 5: center(1) = 4.5: center(2) = 0
    radius = 1
    Set innerLoop1(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop1)

    ' Append the second circle as the other inner loop
    Dim innerLoop2(0) As AcadEntity
    radius = 0.5
    Set innerLoop2(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop2)

    ' Evaluate and display the hatch
    hatchObj.Evaluate
    ThisDrawing.Regen True

    ' Find the name of the hatch pattern
    patternName = hatchObj.patternName
    MsgBox "The name of the hatch pattern is " & hatchObj.patternName, , "patternName Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PatternName()
    ;; This example creates an associative hatch in model space.
    ;; The name of the hatch pattern is then returned.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "ANSI31"
          patternType 0
          bAssociativity :vlax-true)

    ;; Create the associative Hatch object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acHatchObject))

    ;; Create the outer loop for the hatch.
    ;; An arc and a line are used to create a closed loop.
    (setq center (vlax-3d-point 5 3 0)
          radius 3
          startAngle 0
          endAngle 3.141592)

    (setq arc (vla-AddArc modelSpace center radius startAngle endAngle))
    (setq line (vla-AddLine modelSpace (vla-get-StartPoint arc) (vla-get-EndPoint arc)))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element outerLoop 0 arc)
    (vlax-safearray-put-element outerLoop 1 line)

    ;; Append the outer loop to the hatch object
    (vla-AppendOuterLoop hatchObj outerLoop)

    ;; Append the first circle as one inner loop
    (setq center (vlax-3d-point 5 4.5 0)
          radius 1)
    (setq circle1 (vla-AddCircle modelSpace center radius))

    (setq innerLoop1 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element innerLoop1 0 circle1)

    (vla-AppendInnerLoop hatchObj innerLoop1)

    ;; Append the second circle as the other inner loop
    (setq radius 0.5)
    (setq innerLoop2 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (setq circle2 (vla-AddCircle modelSpace center radius))
    (vlax-safearray-put-element innerLoop2 0 circle2)

    (vla-AppendInnerLoop hatchObj innerLoop2)

    ;; Evaluate and display the hatch
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)

    ;; Find the name of the hatch pattern
    (setq patternName (vla-get-PatternName hatchObj))
    (alert (strcat "The name of the hatch pattern is " patternName))
)


PatternScale Property (ActiveX)

Specifies the hatch pattern scale.

Supported platforms: Windows only

Signature

VBA:

object.PatternScale
object

Type: Hatch

The object this property applies to.

Property Value

Read-only: No

Type: Double

Must be non-zero.

Remarks

If the PatternType property is set to acHatchPatternTypeUserDefined, then PatternScale is not used.

NoteThe value of this property is stored in the HPSCALE system variable.

Examples

VBA:

Sub Example_PatternScale()
    ' This example creates an associative hatch in model space.
    ' The scale of the hatch pattern is then returned and changed.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "ANSI31"
    PatternType = 0
    bAssociativity = True

    ' Create the associative Hatch object
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)

    ' Create the outer loop for the hatch.
    ' An arc and a line are used to create a closed loop.
    Dim outerLoop(0 To 1) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    center(0) = 5: center(1) = 3: center(2) = 0
    radius = 3
    startAngle = 0
    endAngle = 3.141592
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddArc(center, radius, startAngle, endAngle)
    Set outerLoop(1) = ThisDrawing.ModelSpace.AddLine(outerLoop(0).startPoint, outerLoop(0).endPoint)

    ' Append the outer loop to the hatch object
    hatchObj.AppendOuterLoop (outerLoop)

    ' Append the first circle as one inner loop
    Dim innerLoop1(0) As AcadEntity
    center(0) = 5: center(1) = 4.5: center(2) = 0
    radius = 1
    Set innerLoop1(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop1)

    ' Append the second circle as the other inner loop
    Dim innerLoop2(0) As AcadEntity
    radius = 0.5
    Set innerLoop2(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop2)

    ' Evaluate and display the hatch
    hatchObj.Evaluate
    ThisDrawing.Regen True

    ' Find the scale of the hatch pattern
    Dim PatternScale As Double
    PatternScale = hatchObj.PatternScale
    MsgBox "The scale of the hatch pattern is " & hatchObj.PatternScale, , "PatternScale Example"

    ' Change the scale of the hatch pattern
    hatchObj.PatternScale = PatternScale + 2
    hatchObj.Evaluate
    ThisDrawing.Regen True
    MsgBox "The scale of the hatch pattern is now " & hatchObj.PatternScale, , "PatternScale Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PatternScale()
    ;; This example creates an associative hatch in model space.
    ;; The scale of the hatch pattern is then returned and changed.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "ANSI31"
          patternType 0
          bAssociativity :vlax-true)

    ;; Create the associative Hatch object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acHatchObject))

    ;; Create the outer loop for the hatch.
    ;; An arc and a line are used to create a closed loop.
    (setq center (vlax-3d-point 5 3 0)
          radius 3
          startAngle 0
          endAngle 3.141592)

    (setq arc (vla-AddArc modelSpace center radius startAngle endAngle))
    (setq line (vla-AddLine modelSpace (vla-get-StartPoint arc) (vla-get-EndPoint arc)))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element outerLoop 0 arc)
    (vlax-safearray-put-element outerLoop 1 line)

    ;; Append the outer loop to the hatch object
    (vla-AppendOuterLoop hatchObj outerLoop)

    ;; Append the first circle as one inner loop
    (setq center (vlax-3d-point 5 4.5 0)
          radius 1)
    (setq circle1 (vla-AddCircle modelSpace center radius))

    (setq innerLoop1 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element innerLoop1 0 circle1)

    (vla-AppendInnerLoop hatchObj innerLoop1)

    ;; Append the second circle as the other inner loop
    (setq radius 0.5)
    (setq innerLoop2 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (setq circle2 (vla-AddCircle modelSpace center radius))
    (vlax-safearray-put-element innerLoop2 0 circle2)

    (vla-AppendInnerLoop hatchObj innerLoop2)

    ;; Evaluate and display the hatch
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)

    ;; Find the scale of the hatch pattern
    (setq patternScale (vla-get-PatternScale hatchObj))
    (alert (strcat "The scale of the hatch pattern is " (rtos patternScale 2)))

    ;; Change the scale of the hatch pattern
    (vla-put-PatternScale hatchObj (+ patternScale 2))
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)
    (alert (strcat "The scale of the hatch pattern is now " (rtos (vla-get-PatternScale hatchObj) 2)))
)


PatternSpace Property (ActiveX)

Specifies the user-defined hatch pattern spacing.

Supported platforms: Windows only

Signature

VBA:

object.PatternSpace
object

Type: Hatch

The object this property applies to.

Property Value

Read-only: No

Type: Double

The hatch pattern spacing.

Remarks

If the PatternType property is set to acHatchPatternTypePreDefined or acHatchPatternTypeCustomDefined, then the PatternSpace property is not used.

NoteThis value is also controlled by the HPSPACE system variable.

Examples

VBA:

Sub Example_PatternSpace()
    ' This example creates an associative hatch in model space.
    ' The spacing of the hatch pattern is then returned and changed.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "ANSI31"
    PatternType = 0
    bAssociativity = True

    ' Create the associative Hatch object
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)

    ' Create the outer loop for the hatch.
    ' An arc and a line are used to create a closed loop.
    Dim outerLoop(0 To 1) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    center(0) = 5: center(1) = 3: center(2) = 0
    radius = 3
    startAngle = 0
    endAngle = 3.141592
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddArc(center, radius, startAngle, endAngle)
    Set outerLoop(1) = ThisDrawing.ModelSpace.AddLine(outerLoop(0).startPoint, outerLoop(0).endPoint)

    ' Append the outer loop to the hatch object
    hatchObj.AppendOuterLoop (outerLoop)

    ' Append the first circle as one inner loop
    Dim innerLoop1(0) As AcadEntity
    center(0) = 5: center(1) = 4.5: center(2) = 0
    radius = 1
    Set innerLoop1(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop1)

    ' Append the second circle as the other inner loop
    Dim innerLoop2(0) As AcadEntity
    radius = 0.5
    Set innerLoop2(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop2)

    ' Evaluate and display the hatch
    hatchObj.Evaluate
    ThisDrawing.Regen True

    ' Find the space of the hatch pattern
    Dim patternSpace As Double
    patternSpace = hatchObj.patternSpace
    MsgBox "The spacing of the hatch pattern is " & hatchObj.patternSpace, , "PatternSpace Example"

    ' Change the spacing of the hatch pattern
    hatchObj.patternSpace = patternSpace + 2
    hatchObj.Evaluate
    ThisDrawing.Regen True
    MsgBox "The spacing of the hatch pattern is now " & hatchObj.patternSpace, , "PatternSpace Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PatternSpace()
    ;; This example creates an associative hatch in model space.
    ;; The spacing of the hatch pattern is then returned and changed.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "ANSI31"
          patternType 0
          bAssociativity :vlax-true)

    ;; Create the associative Hatch object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acHatchObject))

    ;; Create the outer loop for the hatch.
    ;; An arc and a line are used to create a closed loop.
    (setq center (vlax-3d-point 5 3 0)
          radius 3
          startAngle 0
          endAngle 3.141592)

    (setq arc (vla-AddArc modelSpace center radius startAngle endAngle))
    (setq line (vla-AddLine modelSpace (vla-get-StartPoint arc) (vla-get-EndPoint arc)))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element outerLoop 0 arc)
    (vlax-safearray-put-element outerLoop 1 line)

    ;; Append the outer loop to the hatch object
    (vla-AppendOuterLoop hatchObj outerLoop)

    ;; Append the first circle as one inner loop
    (setq center (vlax-3d-point 5 4.5 0)
          radius 1)
    (setq circle1 (vla-AddCircle modelSpace center radius))

    (setq innerLoop1 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element innerLoop1 0 circle1)

    (vla-AppendInnerLoop hatchObj innerLoop1)

    ;; Append the second circle as the other inner loop
    (setq radius 0.5)
    (setq innerLoop2 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (setq circle2 (vla-AddCircle modelSpace center radius))
    (vlax-safearray-put-element innerLoop2 0 circle2)

    (vla-AppendInnerLoop hatchObj innerLoop2)

    ;; Evaluate and display the hatch
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)

    ;; Find the space of the hatch pattern
    (setq patternSpace (vla-get-PatternSpace hatchObj))
    (alert (strcat "The spacing of the hatch pattern is " (rtos patternSpace 2)))

    ;; Change the spacing of the hatch pattern
    (vla-put-PatternSpace hatchObj (+ patternSpace 2))
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)
    (alert (strcat "The spacing of the hatch pattern is now " (rtos (vla-get-PatternSpace hatchObj) 2)))
)


PatternType Property (ActiveX)

Gets the pattern type used for the hatch.

Supported platforms: Windows only

Signature

VBA:

object.PatternType
object

Type: Hatch

The object this property applies to.

Property Value

Read-only: Yes

Type: acPatternType enum

  • acHatchPatternTypePreDefined: Selects the pattern name from those defined in the acad.pat file.
  • acHatchPatternTypeUserDefined: Defines a pattern of lines using the current linetype.
  • acHatchPatternTypeCustomDefined: Selects the pattern name from a PAT file other than the acad.pat file.

Remarks

The pattern type for a hatch can only be set by the AddHatch method for hatch creation, or by the SetPattern method.

Examples

VBA:

Sub Example_PatternType()
    ' This example creates an associative hatch in model space.
    ' The type of the hatch pattern is then returned.

    Dim hatchObj As AcadHatch
    Dim patternName As String
    Dim PatternType As Long
    Dim bAssociativity As Boolean

    ' Define the hatch
    patternName = "ANSI31"
    PatternType = acHatchPatternTypePreDefined
    bAssociativity = True

    ' Create the associative Hatch object
    Set hatchObj = ThisDrawing.ModelSpace.AddHatch(PatternType, patternName, bAssociativity)

    ' Create the outer loop for the hatch.
    ' An arc and a line are used to create a closed loop.
    Dim outerLoop(0 To 1) As AcadEntity
    Dim center(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    center(0) = 5: center(1) = 3: center(2) = 0
    radius = 3
    startAngle = 0
    endAngle = 3.141592
    Set outerLoop(0) = ThisDrawing.ModelSpace.AddArc(center, radius, startAngle, endAngle)
    Set outerLoop(1) = ThisDrawing.ModelSpace.AddLine(outerLoop(0).startPoint, outerLoop(0).endPoint)

    ' Append the outer loop to the hatch object
    hatchObj.AppendOuterLoop (outerLoop)

    ' Append the first circle as one inner loop
    Dim innerLoop1(0) As AcadEntity
    center(0) = 5: center(1) = 4.5: center(2) = 0
    radius = 1
    Set innerLoop1(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop1)

    ' Append the second circle as the other inner loop
    Dim innerLoop2(0) As AcadEntity
    radius = 0.5
    Set innerLoop2(0) = ThisDrawing.ModelSpace.AddCircle(center, radius)
    hatchObj.AppendInnerLoop (innerLoop2)

    ' Evaluate and display the hatch
    hatchObj.Evaluate
    ThisDrawing.Regen True

    ' Find the type of hatch
    PatternType = hatchObj.PatternType
    MsgBox "The type of hatch pattern is " & Choose(hatchObj.PatternType + 1, "acHatchPatternTypeUserDefined", "acHatchPatternTypePreDefined", "acHatchPatternTypeCustomDefined"), , "PatternType Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PatternType()
    ;; This example creates an associative hatch in model space.
    ;; The type of the hatch pattern is then returned.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the hatch
    (setq patternName "ANSI31"
          patternType acHatchPatternTypePreDefined
          bAssociativity :vlax-true)

    ;; Create the associative Hatch object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq hatchObj (vla-AddHatch modelSpace patternType patternName bAssociativity acHatchObject))

    ;; Create the outer loop for the hatch.
    ;; An arc and a line are used to create a closed loop.
    (setq center (vlax-3d-point 5 3 0)
          radius 3
          startAngle 0
          endAngle 3.141592)

    (setq arc (vla-AddArc modelSpace center radius startAngle endAngle))
    (setq line (vla-AddLine modelSpace (vla-get-StartPoint arc) (vla-get-EndPoint arc)))

    (setq outerLoop (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element outerLoop 0 arc)
    (vlax-safearray-put-element outerLoop 1 line)

    ;; Append the outer loop to the hatch object
    (vla-AppendOuterLoop hatchObj outerLoop)

    ;; Append the first circle as one inner loop
    (setq center (vlax-3d-point 5 4.5 0)
          radius 1)
    (setq circle1 (vla-AddCircle modelSpace center radius))

    (setq innerLoop1 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (vlax-safearray-put-element innerLoop1 0 circle1)

    (vla-AppendInnerLoop hatchObj innerLoop1)

    ;; Append the second circle as the other inner loop
    (setq radius 0.5)
    (setq innerLoop2 (vlax-make-safearray vlax-vbObject '(0 . 0)))
    (setq circle2 (vla-AddCircle modelSpace center radius))
    (vlax-safearray-put-element innerLoop2 0 circle2)

    (vla-AppendInnerLoop hatchObj innerLoop2)

    ;; Evaluate and display the hatch
    (vla-Evaluate hatchObj)
    (vla-Regen doc :vlax-true)

    ;; Find the type of hatch
    (setq patternType (vla-get-PatternType hatchObj))
    (alert (strcat "The type of hatch pattern is " (cond
                                                       ((= patternType acHatchPatternTypeUserDefined) "acHatchPatternTypeUserDefined")
                                                       ((= patternType acHatchPatternTypePreDefined) "acHatchPatternTypePreDefined")
                                                       ((= patternType acHatchPatternTypeCustomDefined) "acHatchPatternTypeCustomDefined")
                                                   )))
)


Perimeter Property (ActiveX)

Gets the total length of the inner and outer region loops.

Supported platforms: Windows only

Signature

VBA:

object.Perimeter
object

Type: Region

The object this property applies to.

Property Value

Read-only: Yes

Type: Double

The perimeter is returned in drawing units.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Perimeter()
    ' This example creates a region from an arc and a line.
    ' It then returns the length of the perimeter of the region.
    Dim curves(0 To 1) As AcadEntity
    Dim arcObj As AcadArc
    Dim lineObj As AcadLine

    ' Create the arc and line
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    Dim startAngle As Double
    Dim endAngle As Double
    centerPoint(0) = 5#: centerPoint(1) = 3#: centerPoint(2) = 0#
    radius = 2#
    startAngle = 0
    endAngle = 3.141592
    Set arcObj = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngle, endAngle)
    Set lineObj = ThisDrawing.ModelSpace.AddLine(arcObj.startPoint, arcObj.endPoint)
    Set curves(0) = arcObj
    Set curves(1) = lineObj

    ' Create the region
    Dim regionObj As Variant
    regionObj = ThisDrawing.ModelSpace.AddRegion(curves)
    ZoomAll

    ' Find the perimeter of the region.
    Dim perimeter As Double
    perimeter = regionObj(0).perimeter
    MsgBox "The perimeter of the region is " & regionObj(0).perimeter, , "Perimeter Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Perimeter()
    ;; This example creates a region from an arc and a line.
    ;; It then returns the length of the perimeter of the region.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Create the arc and line
    (setq centerPoint (vlax-3d-point 5 3 0)
          radius 2
          startAngle 0
          endAngle 3.141592)
    (setq arcObj (vla-AddArc modelSpace centerPoint radius startAngle endAngle))
    (setq lineObj (vla-AddLine modelSpace (vla-get-StartPoint arcObj) (vla-get-EndPoint arcObj)))

    (setq curves (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element curves 0 arcObj)
    (vlax-safearray-put-element curves 1 lineObj)

    ;; Create the region
    (setq regionObj (vla-AddRegion modelSpace curves))
    (vla-ZoomAll acadObj)

    ;; Find the perimeter of the region.
    (setq perimeter (vla-get-Perimeter (vlax-safearray-get-element (vlax-variant-value regionObj) 0)))
    (alert (strcat "The perimeter of the region is " (rtos perimeter 2)))
)


Periodic Property (ActiveX)

Specifies that a smooth and closed surface is created without a kink if it is reshaped.

Supported platforms: Windows only

Signature

VBA:

object.Periodic
object

Type: LoftedSurface

The object to which this property applies.

Property Value

Read-only: No

Type: Boolean

  • True: A kink can be created when reshaping the object.
  • False: A kink cannot be created when reshaping the object.

Remarks

This property only affects lofts that are ruled or smooth fit, and the loft is a closed surface or solid.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


PickAdd Property (ActiveX)

Determines if objects are added to the selection set using the Shift key.

Supported platforms: Windows only

Signature

VBA:

object.PickAdd
object

Type: PreferencesSelection

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Adds objects to the current selection set by holding down Shift while selecting.
  • False: Removes objects from the selection set by holding down Shift while selecting.

Remarks

The initial value of this property is False.

NoteThe value for this property is stored in the PICKADD system variable.

Examples

VBA:

Sub Example_PickAdd()
    ' This example reads and modifies the preference value that controls
    ' whether objects are added to the selection set using the SHIFT key.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesSelection
    Dim originalValue As Variant, newValue As Variant

    ' Get the selection preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.Selection

    ' Read and display the original value
    originalValue = ACADPref.PickAdd
    MsgBox "The PickAdd preference is set to: " & originalValue

    ' Modify the PickAdd preference by toggling the value
    ACADPref.PickAdd = Not (ACADPref.PickAdd)
    newValue = ACADPref.PickAdd
    MsgBox "The PickAdd preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.PickAdd = originalValue
    MsgBox "The PickAdd preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PickAdd()
    ;; This example reads and modifies the preference value that controls
    ;; whether objects are added to the selection set using the SHIFT key.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-PickAdd (vla-get-Selection preferences)))
    (alert (strcat "The PickAdd preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the PickAdd preference by toggling the value
    (vla-put-PickAdd (vla-get-Selection preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-PickAdd (vla-get-Selection preferences)))
    (alert (strcat "The PickAdd preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-PickAdd (vla-get-Selection preferences) originalValue)
    (alert (strcat "The PickAdd preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


PickAuto Property (ActiveX)

Controls automatic windowing at the Select Objects prompt.

Supported platforms: Windows only

Signature

VBA:

object.PickAuto
object

Type: PreferencesSelection

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Draws a selection window (for either window or crossing selection) automatically at the Select Objects prompt.
  • False: Disables PickAuto.

Remarks

The initial value of this property is True.

NoteThe value for this property is stored in the PICKAUTO system variable.

Examples

VBA:

Sub Example_PickAuto()
    ' This example reads and modifies the preference value that controls
    ' automatic windowing at the Select Objects prompt.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesSelection
    Dim originalValue As Variant, newValue As Variant

    ' Get the selection preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.Selection

    ' Read and display the original value
    originalValue = ACADPref.PickAuto
    MsgBox "The PickAuto preference is set to: " & originalValue

    ' Modify the PickAuto preference by toggling the value
    ACADPref.PickAuto = Not (ACADPref.PickAuto)
    newValue = ACADPref.PickAuto
    MsgBox "The PickAuto preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.PickAuto = originalValue
    MsgBox "The PickAuto preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PickAuto()
    ;; This example reads and modifies the preference value that controls
    ;; automatic windowing at the Select Objects prompt.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-PickAuto (vla-get-Selection preferences)))
    (alert (strcat "The PickAuto preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the PickAuto preference by toggling the value
    (vla-put-PickAuto (vla-get-Selection preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-PickAuto (vla-get-Selection preferences)))
    (alert (strcat "The PickAuto preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-PickAuto (vla-get-Selection preferences) originalValue)
    (alert (strcat "The PickAuto preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


PickBoxSize Property (ActiveX)

Specifies the size of the object selection target.

Supported platforms: Windows only

Signature

VBA:

object.PickBoxSize
object

Type: PreferencesSelection

The object this property applies to.

Property Value

Read-only: No

Type: Long

The height of the object selection target in pixels. You can enter a value from 0 to 50.

Remarks

The initial value of this property is 3.

NoteThe value for this property is stored in the PICKBOX system variable.

Examples

VBA:

Sub Example_PickBoxSize()
    ' This example reads and modifies the preference value that controls
    ' the size of the object selection target.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesSelection
    Dim originalValue As Variant, newValue As Variant

    ' Get the selection preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.Selection

    ' Read and display the original value
    originalValue = ACADPref.PickBoxSize
    MsgBox "The PickBoxSize preference is set to: " & originalValue

    ' Modify the PickBoxSize preference by setting it to 5
    ACADPref.PickBoxSize = 5
    newValue = ACADPref.PickBoxSize
    MsgBox "The PickBoxSize preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.PickBoxSize = originalValue
    MsgBox "The PickBoxSize preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PickBoxSize()
    ;; This example reads and modifies the preference value that controls
    ;; the size of the object selection target.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-PickBoxSize (vla-get-Selection preferences)))
    (alert (strcat "The PickBoxSize preference is set to: " (itoa originalValue)))

    ;; Modify the PickBoxSize preference by setting it to 5
    (vla-put-PickBoxSize (vla-get-Selection preferences) 5)
    (setq newValue (vla-get-PickBoxSize (vla-get-Selection preferences)))
    (alert (strcat "The PickBoxSize preference has been set to: " (itoa newValue)))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-PickBoxSize (vla-get-Selection preferences) originalValue)
    (alert (strcat "The PickBoxSize preference was reset back to: " (itoa originalValue)))
)


PickDrag Property (ActiveX)

Controls the method of drawing a selection window.

Supported platforms: Windows only

Signature

VBA:

object.PickDrag
object

Type: PreferencesSelection

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Draws the selection window by dragging. Click at one corner, hold down the pick button on the pointing device, drag and release the button at the other corner.
  • False: Draws the selection window using two points. Click the pointing device at one corner and then at the other corner.

Remarks

The initial value of this property is False.

NoteThe value for this property is stored in the PICKDRAG system variable.

Examples

VBA:

Sub Example_PickDrag()
    ' This example reads and modifies the preference value that controls
    ' the method of drawing a selection window.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesSelection
    Dim originalValue As Variant, newValue As Variant

    ' Get the selection preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.Selection

    ' Read and display the original value
    originalValue = ACADPref.PickDrag
    MsgBox "The PickDrag preference is set to: " & originalValue

    ' Modify the PickDrag preference by toggling the value
    ACADPref.PickDrag = Not (ACADPref.PickDrag)
    newValue = ACADPref.PickDrag
    MsgBox "The PickDrag preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.PickDrag = originalValue
    MsgBox "The PickDrag preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PickDrag()
    ;; This example reads and modifies the preference value that controls
    ;; the method of drawing a selection window.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-PickDrag (vla-get-Selection preferences)))
    (alert (strcat "The PickDrag preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the PickDrag preference by toggling the value
    (vla-put-PickDrag (vla-get-Selection preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-PickDrag (vla-get-Selection preferences)))
    (alert (strcat "The PickDrag preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-PickDrag (vla-get-Selection preferences) originalValue)
    (alert (strcat "The PickDrag preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


PickFirst Property (ActiveX)

Determines if you select objects before (noun-verb selection) or after you issue a command.

Supported platforms: Windows only

Signature

VBA:

object.PickFirst
object

Type: PreferencesSelection

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Turns on PICKFIRST.
  • False: Turns off PICKFIRST.

Remarks

The initial value of this property is True.

NoteThe value for this property is stored in the PICKFIRST system variable.

Examples

VBA:

Sub Example_PickFirst()
    ' This example reads and modifies the preference value that controls
    ' whether you select objects before (noun-verb selection) or after
    ' you issue a command.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesSelection
    Dim originalValue As Variant, newValue As Variant

    ' Get the selection preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.Selection

    ' Read and display the original value
    originalValue = ACADPref.PickFirst
    MsgBox "The PickFirst preference is set to: " & originalValue

    ' Modify the PickFirst preference by toggling the value
    ACADPref.PickFirst = Not (ACADPref.PickFirst)
    newValue = ACADPref.PickFirst
    MsgBox "The PickFirst preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.PickFirst = originalValue
    MsgBox "The PickFirst preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PickFirst()
    ;; This example reads and modifies the preference value that controls
    ;; whether you select objects before (noun-verb selection) or after
    ;; you issue a command.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-PickFirst (vla-get-Selection preferences)))
    (alert (strcat "The PickFirst preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the PickFirst preference by toggling the value
    (vla-put-PickFirst (vla-get-Selection preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-PickFirst (vla-get-Selection preferences)))
    (alert (strcat "The PickFirst preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-PickFirst (vla-get-Selection preferences) originalValue)
    (alert (strcat "The PickFirst preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


PickfirstSelectionSet Property (ActiveX)

Gets the pickfirst selection set.

Supported platforms: Windows only

Signature

VBA:

object.PickfirstSelectionSet
object

Type: Document

The object this property applies to.

Property Value

Read-only: Yes

Type: SelectionSet

The pickfirst selection set.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_PickfirstSelectionSet()
    ' This example lists all the objects in the pickfirst selection set.
    ' Before running this example, create some objects in the active
    ' drawing and select those objects. The objects currently selected
    ' in the active drawing will be returned in the pickfirst selection set.

    Dim pfSS As AcadSelectionSet
    Dim ssobject As AcadEntity
    Dim msg As String
    msg = ""

    Set pfSS = ThisDrawing.PickfirstSelectionSet
    For Each ssobject In pfSS
        msg = msg & vbCrLf & ssobject.ObjectName
    Next ssobject
    MsgBox "The Pickfirst selection set contains: " & msg

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PickfirstSelectionSet()
    ;; This example lists all the objects in the pickfirst selection set.
    ;; Before running this example, create some objects in the active
    ;; drawing and select those objects. The objects currently selected
    ;; in the active drawing will be returned in the pickfirst selection set.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq msg ""
          pfSS (vla-get-PickfirstSelectionSet doc))

    (vlax-for ssobject pfSS
        (setq msg (strcat msg "\n" (vla-get-ObjectName ssobject)))
    )

    (alert (strcat "The Pickfirst selection set contains: " msg))
)


PickGroup Property (ActiveX)

Determines if picking a single object in a group selects the entire group.

Supported platforms: Windows only

Signature

VBA:

object.PickGroup
object

Type: PreferencesSelection

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Picking one object in a group results in the entire group being selected.
  • False: Picking one object in a group results in only that object being selected.

Remarks

The initial value of this property is False.

Examples

VBA:

Sub Example_PickGroup()
    ' This example reads and modifies the preference value that
    ' determines if picking a single object in a group selects the entire group.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesSelection
    Dim originalValue As Variant, newValue As Variant

    ' Get the user preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.Selection

    ' Read and display the original value
    originalValue = ACADPref.PickGroup
    MsgBox "The PickGroup preference is set to: " & originalValue

    ' Modify the PickGroup preference by toggling the value
    ACADPref.PickGroup = Not (ACADPref.PickGroup)
    newValue = ACADPref.PickGroup
    MsgBox "The PickGroup preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.PickGroup = originalValue
    MsgBox "The PickGroup preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PickGroup()
    ;; This example reads and modifies the preference value that
    ;; determines if picking a single object in a group selects the entire group.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-PickGroup (vla-get-Selection preferences)))
    (alert (strcat "The PickGroup preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the PickGroup preference by toggling the value
    (vla-put-PickGroup (vla-get-Selection preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-PickGroup (vla-get-Selection preferences)))
    (alert (strcat "The PickGroup preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-PickGroup (vla-get-Selection preferences) originalValue)
    (alert (strcat "The PickGroup preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


Plot Property (ActiveX)

Gets the Plot object for the document.

Supported platforms: Windows only

Signature

VBA:

object.Plot
object

Type: Document

The object this property applies to.

Property Value

Read-only: Yes

Type: Plot

The Plot object of the document.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Plot()
    ' This example sends a plot of the current drawing
    ' to a file.

    ThisDrawing.ActiveLayout.ConfigName = "DWF6 ePlot.pc3"

    ' Define the plot variable
    Dim currentPlot As AcadPlot
    Set currentPlot = ThisDrawing.Plot

    ' Define the output file name.
    ' Use "" to use the drawing name as the file name.
    ' Note: if the file name exists an error will be generated.
    Dim plotFileName As String
    plotFileName = "MyPlot"

    currentPlot.PlotToFile plotFileName

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Plot()
    ;; This example sends a plot of the current drawing
    ;; to a file.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Set a device current that outputs to a file
    (vla-put-ConfigName (vla-get-ActiveLayout doc) "DWF6 ePlot.pc3")

    ;; Define the plot variable
    (setq currentPlot (vla-get-Plot doc))

    ;; Define the output file name.
    ;; Use "" to use the drawing name as the file name.
    ;; Note: if the file name exists an error will be generated.
    (setq plotFileName "MyPlot")

    (vla-PlotToFile currentPlot plotFileName)
)


PlotConfigurations Property (ActiveX)

Gets the PlotConfigurations collection for the document.

Supported platforms: Windows only

Signature

VBA:

object.PlotConfigurations
object

Type: Database, Document

The object this property applies to.

Property Value

Read-only: Yes

Type: PlotConfigurations

The PlotConfigurations collection for the document.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_PlotConfigurations()
    ' This example will access the PlotConfigurations collection for the current drawing,
    ' add a plot configuration, and list basic information about the
    ' plot configurations in the drawing.

    Dim PlotConfigurations As AcadPlotConfigurations
    Dim PlotConfiguration As AcadPlotConfiguration
    Dim msg As String

    ' Get PlotConfigurations collection from document object
    Set PlotConfigurations = ThisDrawing.PlotConfigurations

    ' If there aren't any plot configurations, then add one
    If PlotConfigurations.count = 0 Then
        '*** Customize the new configuration to your satisfaction ***
        PlotConfigurations.Add "NEW_CONFIGURATION"
    End If

    msg = vbCrLf     ' Start with a space

    ' Get the names of the plot configurations in this drawing
    For Each PlotConfiguration In PlotConfigurations
        msg = msg & PlotConfiguration.name & vbCrLf
    Next

    ' Display a list of available plot configurations
    MsgBox "There are " & PlotConfigurations.count & " plot configuration(s) in " & _
           ThisDrawing.WindowTitle & ":" & msg
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PlotConfigurations()
    ;; This example will access the PlotConfigurations collection for the current drawing,
    ;; add a plot configuration, and list basic information about the
    ;; plot configurations in the drawing.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get PlotConfigurations collection from document object
    (setq PlotConfigurations (vla-get-PlotConfigurations doc))

    ;; If there aren't any plot configurations, then add one
    (if (= (vla-get-Count PlotConfigurations) 0)
        ;; *** Customize the new configuration to your satisfaction ***
        (vla-Add PlotConfigurations "NEW_CONFIGURATION")
    )

    (setq msg "")

    ;; Get the names of the plot configurations in this drawing
    (vlax-for PlotConfiguration PlotConfigurations
        (setq msg (strcat msg (vla-get-Name PlotConfiguration) "\n"))
    )

    ;; Display a list of available plot configurations
    (alert (strcat "There are " (itoa (vla-get-Count PlotConfigurations)) " plot configuration(s) in "
                   (vla-get-WindowTitle doc) ": \n" msg))
)


PlotHidden Property (ActiveX)

Specifies if objects are to be hidden during a plot.

Supported platforms: Windows only

Signature

VBA:

object.PlotHidden
object

Type: Layout, PlotConfiguration

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Hide objects during the plot.
  • False: Do not hide objects during the plot.

Remarks

This property specifies if the objects in paper space are processed through the hidden line algorithm. Note that this property does not affect objects inside floating model space viewports.

Examples

VBA:

Sub Example_PlotHidden()
    ' This example will access the Layouts collection for the current drawing
    ' and display whether the objects for each layout are to be hidden during a plot.
    ' It will then toggle the state of PlotHidden for "Layout1" and re-display the
    ' PlotHidden state for each Layout.

    Dim Layouts As AcadLayouts, Layout As ACADLayout
    Dim msg As String
    Dim IsHidden As String

    ' Get layouts collection from document object
    Set Layouts = ThisDrawing.Layouts

    ' Display current hidden information
    GoSub DISPLAY

    ' Toggle object hidden state for Layout1
    Layouts("Layout1").PlotHidden = Not (Layouts("Layout1").PlotHidden)

    ' Display new hidden information
    GoSub DISPLAY

    Exit Sub

DISPLAY:
    msg = ""    ' Clear message

    ' Determine whether the objects for each layout are hidden during a plot
    For Each Layout In Layouts
        ' Are these objects hidden?
        IsHidden = IIf(Layout.PlotHidden, " are hidden ", " are not hidden ")

        ' Format for display
        msg = msg & "Objects for " & Layout.name & IsHidden & "during a plot." & vbCrLf
    Next

    ' Display layout information
    MsgBox msg

    Return
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PlotHidden()
    ;; This example will access the Layouts collection for the current drawing
    ;; and display whether the objects for each layout are to be hidden during a plot.
    ;; It will then toggle the state of PlotHidden for "Layout1" and re-display the
    ;; PlotHidden state for each Layout.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get layouts collection from document object
    (setq Layouts (vla-get-Layouts doc))

    ;; Display current hidden information
    (setq msg "")

    ;; Determine whether the objects for each layout are hidden during a plot
    (vlax-for Layout Layouts
        ;; Are these objects hidden?
        (setq IsHidden (if (= (vla-get-PlotHidden Layout) :vlax-true) " are hidden " " are not hidden "))

        ;; Format for display
        (setq msg (strcat msg "Objects for " (vla-get-Name Layout) IsHidden "during a plot.\n"))
    )

    ;; Display layout information
    (alert msg)

    ;; Toggle object hidden state for Layout1
    (vla-put-PlotHidden (vla-item Layouts "Layout1") (if (= (vla-get-PlotHidden (vla-item Layouts "Layout1")) :vlax-true) :vlax-false :vlax-true))

    ;; Display new hidden information
    (setq msg "")

    ;; Determine whether the objects for each layout are hidden during a plot
    (vlax-for Layout Layouts
        ;; Are these objects hidden?
        (setq IsHidden (if (= (vla-get-PlotHidden Layout) :vlax-true) " are hidden " " are not hidden "))

        ;; Format for display
        (setq msg (strcat msg "Objects for " (vla-get-Name Layout) IsHidden "during a plot.\n"))
    )

    ;; Display layout information
    (alert msg)
)


PlotLegacy Property (ActiveX)

Toggles whether legacy plot scripts are allowed to run.

Supported platforms: Windows only

Signature

VBA:

object.PlotLegacy
object

Type: PreferencesOutput

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Allow legacy plot scripts to run.
  • False: Do not allow legacy plot scripts to run.

Remarks

The initial value for this property is False.

Examples

VBA:

Sub Example_PlotLegacy()
    ' This example reads and modifies the PlotLegacy
    ' preference value.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesOutput
    Dim originalValue As Boolean

    ' Get the user preferences object

    Set ACADPref = ThisDrawing.Application.Preferences.Output

    ' Read and display the original value
    originalValue = ACADPref.PlotLegacy
    MsgBox "The PlotLegacy preference is set to: " & originalValue

    ' Modify the PlotLegacy preference by toggling the value
    ACADPref.PlotLegacy = Not ACADPref.PlotLegacy

    MsgBox "The PlotLegacy preference has been set to: " & ACADPref.PlotLegacy

    ' Reset the preference back to its original value
    ACADPref.PlotLegacy = originalValue
    MsgBox "The PlotLegacy preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PlotLegacy()
    ;; This example reads and modifies the PlotLegacy
    ;; preference value.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-PlotLegacy (vla-get-Output preferences)))
    (alert (strcat "The PlotLegacy preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the PlotLegacy preference by toggling the value
    (vla-put-PlotLegacy (vla-get-Output preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-PlotLegacy (vla-get-Output preferences)))
    (alert (strcat "The PlotLegacy preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    (vla-put-PlotLegacy (vla-get-Output preferences) originalValue)
    (alert (strcat "The PlotLegacy preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


PlotLogFilePath Property (ActiveX)

Specifies the path of the Plot log file.

Supported platforms: Windows only

Signature

VBA:

object.PlotLogFilePath
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The path of the Plot log file.

Remarks

This property is equivalent to the AutoCAD Options dialog box setting "Plot and Publish Log File Location."

Examples

VBA:

Sub Example_PlotLogFilePath()
    ' Note: Change the path to a valid folder on your system.

    Dim MyPreference As AcadPreferencesFiles
    Set MyPreference = AcadApplication.Preferences.Files
    MyPreference.PlotLogFilePath = "C:\Plots"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PlotLogFilePath()
    ;; Note: Change the path to a valid folder on your system.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    (setq MyPreference (vla-get-Files preferences))
    (vla-put-PlotLogFilePath MyPreference "C:\\Plots")
)


PlotOrigin Property (ActiveX)

Specifies the origin of the UCS, block, layout, or raster image in WCS coordinates.

Supported platforms: Windows only

Signature

VBA:

object.PlotOrigin
object

Type: Layout, PlotConfiguration

The objects this property applies to.

Property Value

Read-only: No

Type: Variant (two-element array of doubles)

The X and Y values representing the origin relative to the lower-left corner of the media.

Remarks

The origin is offset from the media edge by the paper margin. Use the GetPaperMargins method to query the margins. The origin is given in millimeters.

Changes to this property will not be visible until after a regeneration of the drawing. Use the Regen method to regenerate the drawing.

Examples

VBA:

Sub Example_PlotOrigin()
    ' This example reads and modifies the PlotOrigin
    ' Layout value.
    ' When finished, this example resets the  value back to
    ' its original value.

    Dim ACADLayout As ACADLayout
    Dim originalValue As Variant
    Dim newValue(0 To 1) As Double

    ' Get the layout object
    Set ACADLayout = ThisDrawing.ActiveLayout

    ' Read and display the original value
    originalValue = ACADLayout.PlotOrigin
    MsgBox "The PlotOrigin value is set to: " & originalValue(0) & " ," & originalValue(1)

    ' Modify the PlotOrigin preference by toggling the value
    newValue(0) = originalValue(0) + 20
    newValue(1) = originalValue(1) - 20
    ACADLayout.PlotOrigin = newValue
    MsgBox "The PlotOrigin value is set to: " & newValue(0) & " ," & newValue(1)

    ' Reset the preference back to its original value
    ACADLayout.PlotOrigin = originalValue
    MsgBox "The PlotOrigin value is set to: " & originalValue(0) & " ," & originalValue(1)
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PlotOrigin()
    ;; This example reads and modifies the PlotOrigin
    ;; Layout value.
    ;; When finished, this example resets the  value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get the layout object
    (setq ACADLayout (vla-get-ActiveLayout doc))

    ;; Read and display the original value
    (setq originalValue (vlax-variant-value (vla-get-PlotOrigin ACADLayout)))
    (alert (strcat "The PlotOrigin value is set to: " (rtos (vlax-safearray-get-element originalValue 0) 2) " ,"
                                                      (rtos (vlax-safearray-get-element originalValue 1) 2)))

    ;; Modify the PlotOrigin preference by toggling the value
    (setq newValue (vlax-make-safearray vlax-vbDouble '(0 . 1)))
    (vlax-safearray-fill newValue (list (+ (vlax-safearray-get-element originalValue 0) 20)
                                        (- (vlax-safearray-get-element originalValue 1) 20)))
    (vla-put-PlotOrigin ACADLayout newValue)
    (alert (strcat "The PlotOrigin value is set to: " (rtos (vlax-safearray-get-element newValue 0) 2) " ,"
                                                      (rtos (vlax-safearray-get-element newValue 1) 2)))

    ;; Reset the preference back to its original value
    (vla-put-PlotOrigin ACADLayout originalValue)
    (alert (strcat "The PlotOrigin value is set to: " (rtos (vlax-safearray-get-element originalValue 0) 2) " ,"
                                                      (rtos (vlax-safearray-get-element originalValue 1) 2)))
)


PlotPolicy Property (ActiveX)

Determines whether an object's color property is associated with its plot style name when a new drawing is created.

Supported platforms: Windows only

Signature

VBA:

object.PlotPolicy
object

Type: PreferencesOutput

The object this property applies to.

Property Value

Read-only: No

Type: acPlotPolicy enum

  • acPolicyLegacy: Specifies color-dependent plot styles in both new drawings and drawings created in earlier versions of AutoCAD. Color-dependent plot styles use the numbers from the AutoCAD color index to create a plot style table with a .ctb file extension. Each color is defined by a name or number ranging from 1 to 255. You can assign each color number to a different pen on a pen plotter to achieve different property settings in the plotted drawing. If this option is entered, a plot style is created for each color setting.
  • acPolicyNamed: Specifies named plot styles in both new drawings and drawings created in earlier versions of AutoCAD. AutoCAD plots the drawing according to the property settings you specify in the plot style definition. The plot style is defined in the plot style table attached to the layout or viewport. Named plot style tables are files with the file extension .stb.

Remarks

The initial value for this property is acPolicyNamed.

If you want to change the default plot style behavior for a drawing, enter either acPolicyLegacy or acPolicyNamed before opening or creating the drawing. Changing the default plot style behavior using this property only affects new drawings or drawings created in a previous release of AutoCAD that have never been saved in AutoCAD 2000 or later format. This setting is saved with the drawing. You can change the default behavior for a drawing from acPolicyLegacy to acPolicyNamed once it is saved by using a migration utility. However, once a drawing is saved with acPolicyNamed as the default behavior, you cannot change it to acPolicyLegacy.

Examples

VBA:

Sub Example_PlotPolicy()
    ' This example reads and modifies the PlotPolicy
    ' preference value.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesOutput
    Dim originalValue As Integer

    ' Get the user preferences object

    Set ACADPref = ThisDrawing.Application.Preferences.Output

    ' Read and display the original value
    originalValue = ACADPref.PlotPolicy
    MsgBox "The PlotPolicy preference is set to: " & originalValue

    ' Modify the PlotPolicy preference by toggling the value
    ACADPref.PlotPolicy = acPolicyNamed
    MsgBox "The PlotPolicy preference has been set to: " & ACADPref.PlotPolicy

    ' Reset the preference back to its original value
    ACADPref.PlotPolicy = originalValue
    MsgBox "The PlotPolicy preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PlotPolicy()
    ;; This example reads and modifies the PlotPolicy
    ;; preference value.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-PlotPolicy (vla-get-Output preferences)))
    (alert (strcat "The PlotPolicy preference is set to: " (itoa originalValue)))

    ;; Modify the PlotPolicy preference by toggling the value
    (vla-put-PlotPolicy (vla-get-Output preferences) acPolicyNamed)
    (alert (strcat "The PlotPolicy preference has been set to: " (itoa (vla-get-PlotPolicy (vla-get-Output preferences)))))

    ;; Reset the preference back to its original value
    (vla-put-PlotPolicy (vla-get-Output preferences) originalValue)
    (alert (strcat "The PlotPolicy preference was reset back to: " (itoa originalValue)))
)


PlotRotation Property (ActiveX)

Specifies the rotation angle for the layout or plot configuration.

Supported platforms: Windows only

Signature

VBA:

object.PlotRotation
object

Type: Layout, PlotConfiguration

The objects this property applies to.

Property Value

Read-only: No

Type: acPlotRotation enum

  • ac0degrees
  • ac90degrees
  • ac180degrees
  • ac270degrees

Remarks

The rotation angle is relative to the X axis of the object's WCS with positive angles going counterclockwise when looking down from the Z axis toward the origin.

Changes to this property will not be visible until after a regeneration of the drawing. Use the Regen method to regenerate the drawing.

Examples

VBA:

Sub Example_PlotRotation()
    ' This example reads and modifies the PlotRotation
    ' Layout value.
    ' When finished, this example resets the  value back to
    ' its original value.

    Dim ACADLayout As ACADLayout
    Dim originalValue As Integer

    ' Get the layout object
    Set ACADLayout = ThisDrawing.ActiveLayout

    ' Read and display the original value
    originalValue = ACADLayout.PlotRotation
    MsgBox "The PlotRotation value is set to: " & originalValue

    ' Modify the PlotRotation preference by toggling the value
    ACADLayout.PlotRotation = ac180degrees
    MsgBox "The PlotRotation preference has been set to: " & ACADLayout.PlotRotation

    ' Reset the preference back to its original value
    ACADLayout.PlotRotation = originalValue
    MsgBox "The PlotRotation preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PlotRotation()
    ;; This example reads and modifies the PlotRotation
    ;; Layout value.
    ;; When finished, this example resets the  value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get the layout object
    (setq ACADLayout (vla-get-ActiveLayout doc))

    ;; Read and display the original value
    (setq originalValue (vla-get-PlotRotation ACADLayout))
    (alert (strcat "The PlotRotation value is set to: " (itoa originalValue)))

    ;; Modify the PlotRotation preference by toggling the value
    (vla-put-PlotRotation ACADLayout ac180degrees)
    (alert (strcat "The PlotRotation preference has been set to: " (itoa (vla-get-PlotRotation ACADLayout))))

    ;; Reset the preference back to its original value
    (vla-put-PlotRotation ACADLayout originalValue)
    (alert (strcat "The PlotRotation preference was reset back to: " (itoa originalValue)))
)


PlotStyleName Property (ActiveX)

Specifies the plot style name for an object, group of objects, or layer.

Supported platforms: Windows only

Signature

VBA:

object.PlotStyleName
object

Type: All drawing objects, AttributeReference, Dimension, Group, Layer, MLeaderLeader, SubDMeshEdge, SubDMeshFace, SubDMeshVertex, SubEntity, SubEntSolidEdge, SubEntSolidFace, SubEntSolidNode, SubEntSolidVertex

The objects this property applies to.

Property Value

Read-only: No; except the Group object which is write-only

Type: String

The plot style name for the object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_PlotStyleName()
    ' This example creates a circle in model space and then
    ' finds the current PlotStyleName for the circle.

    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double

    ' Define the circle
    centerPoint(0) = 0#: centerPoint(1) = 0#: centerPoint(2) = 0#
    radius = 5#

    ' Create the Circle object in model space
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)
    ZoomAll

    ' Find the PlotStyleName for the circle
    MsgBox "The current PlotStyleName for the circle is " & circleObj.PlotStyleName

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PlotStyleName()
    ;; This example creates a circle in model space and then
    ;; finds the current PlotStyleName for the circle.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the circle
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius 5)

    ;; Create the Circle object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))
    (vla-ZoomAll acadObj)

    ;; Find the PlotStyleName for the circle
    (alert (strcat "The current PlotStyleName for the circle is " (vla-get-PlotStyleName circleObj)))
)


Plottable Property (ActiveX)

Specifies if the layer is plottable.

Supported platforms: Windows only

Signature

VBA:

object.Plottable
object

Type: Layer

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The layer is plottable.
  • False: The layer is not plottable.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Plottable()
    ' This example creates a new layer called "New_Layer".  It then uses
    ' the Plottable property of each Layer to display whether or not that layer
    ' is plottable.  The user has the ability to toggle the plottable state
    ' for each layer, and the final plottable status for all layers is displayed.

    Dim layerObj As AcadLayer, tempLayer As AcadLayer
    Dim msg As String

    ' Add the layer to the layers collection
    Set layerObj = ThisDrawing.Layers.Add("New_Layer")

    ' Make the new layer the active layer for the drawing
    ThisDrawing.ActiveLayer = layerObj

    ' Cycle through the layers and allow user to make them plottable or not

    For Each tempLayer In ThisDrawing.Layers
        If tempLayer.Plottable Then     ' Determine if this layer is plottable
            If MsgBox("The layer '" & tempLayer.name & "' will plot.  Would you like to turn off plotting for this layer?", vbYesNo & vbQuestion) = vbYes Then
                tempLayer.Plottable = False     ' Change plottable state
            End If
        Else
            If MsgBox("The layer '" & tempLayer.name & "' will not plot.  Would you like to turn on plotting for this layer?", vbYesNo & vbQuestion) = vbYes Then
                tempLayer.Plottable = True      ' Change plottable state
            End If
        End If
    Next

    ' Display the new plottable status of the layers in this drawing

    For Each tempLayer In ThisDrawing.Layers
        ' Determine if this layer is plottable
        If tempLayer.Plottable Then
            msg = msg & "The layer '" & tempLayer.name & "' will plot." & vbCrLf
        Else
            msg = msg & "The layer '" & tempLayer.name & "' will not plot." & vbCrLf
        End If
    Next

    MsgBox msg
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Plottable()
    ;; This example creates a new layer called "New_Layer".  It then uses
    ;; the Plottable property of each Layer to display whether or not that layer
    ;; is plottable.  The user has the ability to toggle the plottable state
    ;; for each layer, and the final plottable status for all layers is displayed.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Add the layer to the layers collection
    (setq layerObj (vla-Add (vla-get-Layers doc) "New_Layer"))

    ;; Make the new layer the active layer for the drawing
    (vla-put-ActiveLayer doc layerObj)

    ;; Cycle through the layers and allow user to make them plottable or not
    (vlax-for tempLayer (vla-get-Layers doc)
        (if (= (vla-get-Plottable tempLayer) :vlax-true)     ;; Determine if this layer is plottable
            (progn
                (alert (strcat "The layer '" (vla-get-Name tempLayer) "' set to plot."))
                (vla-put-Plottable tempLayer :vlax-false)     ;; Change plottable state
                (alert (strcat "The layer '" (vla-get-Name tempLayer) "' now set not to plot."))
            )
            (progn
                (alert (strcat "The layer '" (vla-get-Name tempLayer) "' set not to plot."))
                (vla-put-Plottable tempLayer :vlax-true)     ;; Change plottable state
                (alert (strcat "The layer '" (vla-get-Name tempLayer) "' now set to plot."))
            )
        )
    )

    (setq msg "")

    ;; Display the new plottable status of the layers in this drawing
    (vlax-for tempLayer (vla-get-Layers doc)
        ;; Determine if this layer is plottable
        (if (= (vla-get-Plottable tempLayer) :vlax-true)
            (setq msg (strcat msg "The layer '" (vla-get-Name tempLayer) "' will plot.\n"))
            (setq msg (strcat msg "The layer '" (vla-get-Name tempLayer) "' will not plot.\n"))
        )
    )

    (alert msg)
)


PlotType Property (ActiveX)

Specifies the type of layout or plot configuration.

Supported platforms: Windows only

Signature

VBA:

object.PlotType
object

Type: Layout, PlotConfiguration

The objects this property applies to.

Property Value

Read-only: No

Type: acPlotType enum

  • acDisplay: Prints everything that is in the current display.
  • acExtents: Prints everything that falls within the extents of the currently selected space.
  • acLimits: Prints everything that is in the limits of the current space.
  • acView: Prints the view named by the ViewToPlot property.
  • acWindow: Prints everything in the window specified by the SetWindowToPlot method.
  • acLayout: Prints everything that falls within the margins of the specified paper size with the origin being calculated from 0,0 coordinate location in the Layout tab. This option is not available when printing from model space.

Remarks

Changes to this property will not be visible until after a regeneration of the drawing. Use the Regen method to regenerate the drawing.

The ViewToPlot property or SetWindowToPlot method must be called before you can set the PlotType to acView or acWindow.

Examples

VBA:

Sub Example_PlotType()
    ' This example reads and modifies the PlotType
    ' Layout value.
    ' When finished, this example resets the  value back to
    ' its original value.

    Dim ACADLayout As ACADLayout
    Dim originalValue As Integer

    ' Get the layout object
    Set ACADLayout = ThisDrawing.ActiveLayout

    ' Read and display the original value
    originalValue = ACADLayout.PlotType
    MsgBox "The PlotType value is set to: " & originalValue

    ' Modify the PlotType preference by toggling the value
    ACADLayout.PlotType = acExtents
    MsgBox "The PlotType preference has been set to: " & ACADLayout.PlotType

    ' Reset the preference back to its original value
    ACADLayout.PlotType = originalValue
    MsgBox "The PlotType preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PlotType()
    ;; This example reads and modifies the PlotType
    ;; Layout value.
    ;; When finished, this example resets the  value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get the layout object
    (setq ACADLayout (vla-get-ActiveLayout doc))

    ;; Read and display the original value
    (setq originalValue (vla-get-PlotType ACADLayout))
    (alert (strcat "The PlotType value is set to: " (itoa originalValue)))

    ;; Modify the PlotType preference by toggling the value
    (vla-put-PlotType ACADLayout acExtents)
    (alert (strcat "The PlotType preference has been set to: " (itoa (vla-get-PlotType ACADLayout))))

    ;; Reset the preference back to its original value
    (vla-put-PlotType ACADLayout originalValue)
    (alert (strcat "The PlotType preference was reset back to: " (itoa originalValue)))
)


PlotViewportBorders Property (ActiveX)

Specifies if the viewport borders are to be plotted.

Supported platforms: Windows only

Signature

VBA:

object.PlotViewportBorders
object

Type: Layout, PlotConfiguration

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Plot the viewport borders.
  • False: Do not plot the viewport borders.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_PlotViewportBorders()
    ' This example reads and modifies the PlotViewportBorders
    ' Layout value.
    ' When finished, this example resets the  value back to
    ' its original value.

    Dim ACADLayout As ACADLayout
    Dim originalValue As Boolean

    ' Get the layout object
    Set ACADLayout = ThisDrawing.ActiveLayout

    ' Read and display the original value
    originalValue = ACADLayout.PlotViewportBorders
    MsgBox "The PlotViewportBorders value is set to: " & originalValue

    ' Modify the PlotViewportBorders preference by toggling the value
    ACADLayout.PlotViewportBorders = Not ACADLayout.PlotViewportBorders
    MsgBox "The PlotViewportBorders preference has been set to: " & ACADLayout.PlotViewportBorders

    ' Reset the preference back to its original value
    ACADLayout.PlotViewportBorders = originalValue
    MsgBox "The PlotViewportBorders preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PlotViewportBorders()
    ;; This example reads and modifies the PlotViewportBorders
    ;; Layout value.
    ;; When finished, this example resets the  value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get the layout object
    (setq ACADLayout (vla-get-ActiveLayout doc))

    ;; Read and display the original value
    (setq originalValue (vla-get-PlotViewportBorders ACADLayout))
    (alert (strcat "The PlotViewportBorders value is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the PlotViewportBorders preference by toggling the value
    (vla-put-PlotViewportBorders ACADLayout (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-PlotViewportBorders ACADLayout))
    (alert (strcat "The PlotViewportBorders preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    (vla-put-PlotViewportBorders ACADLayout originalValue)
    (alert (strcat "The PlotViewportBorders preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


PlotViewportsFirst Property (ActiveX)

Specifies if all geometry in paper space viewports is plotted first.

Supported platforms: Windows only

Signature

VBA:

object.PlotViewportsFirst
object

Type: Layout, PlotConfiguration

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Geometry in paper space viewports is plotted first, and the geometry in paper space is plotted last.
  • False: Paper space geometry is plotted first, and the geometry in paper space viewports is plotted last.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_PlotViewportsFirst()
    ' This example reads and modifies the PlotViewportsFirst
    ' Layout value.
    ' When finished, this example resets the  value back to
    ' its original value.

    Dim ACADLayout As ACADLayout
    Dim originalValue As Boolean

    ' Get the layout object
    Set ACADLayout = ThisDrawing.ActiveLayout

    ' Read and display the original value
    originalValue = ACADLayout.PlotViewportsFirst
    MsgBox "The PlotViewportsFirst value is set to: " & originalValue

    ' Modify the PlotViewportsFirst preference by toggling the value
    ACADLayout.PlotViewportsFirst = Not ACADLayout.PlotViewportsFirst
    MsgBox "The PlotViewportsFirst preference has been set to: " & ACADLayout.PlotViewportsFirst

    ' Reset the preference back to its original value
    ACADLayout.PlotViewportsFirst = originalValue
    MsgBox "The PlotViewportsFirst preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PlotViewportsFirst()
    ;; This example reads and modifies the PlotViewportsFirst
    ;; Layout value.
    ;; When finished, this example resets the  value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get the layout object
    (setq ACADLayout (vla-get-ActiveLayout doc))

    ;; Read and display the original value
    (setq originalValue (vla-get-PlotViewportsFirst ACADLayout))
    (alert (strcat "The PlotViewportsFirst value is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the PlotViewportsFirst preference by toggling the value
    (vla-put-PlotViewportsFirst ACADLayout (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-PlotViewportsFirst ACADLayout))
    (alert (strcat "The PlotViewportsFirst preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    (vla-put-PlotViewportsFirst ACADLayout originalValue)
    (alert (strcat "The PlotViewportsFirst preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


PlotWithLineweights Property (ActiveX)

Specifies whether objects plot with the lineweights they are assigned in the plot file, or with the lineweights in the drawing file.

Supported platforms: Windows only

Signature

VBA:

object.PlotWithLineweights
object

Type: Layout, PlotConfiguration

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Plot using the lineweights in the plot style.
  • False: Plot using the lineweights in the drawing file.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_PlotWithLineweights()
    ' This example reads and modifies the PlotWithLineweights
    ' Layout value.
    ' When finished, this example resets the  value back to
    ' its original value.

    Dim ACADLayout As ACADLayout
    Dim originalValue As Boolean

    ' Get the layout object
    Set ACADLayout = ThisDrawing.ActiveLayout

    ' Read and display the original value
    originalValue = ACADLayout.PlotWithLineweights
    MsgBox "The PlotWithLineweights value is set to: " & originalValue

    ' Modify the PlotWithLineweights preference by toggling the value
    ACADLayout.PlotWithLineweights = Not ACADLayout.PlotWithLineweights
    MsgBox "The PlotWithLineweights preference has been set to: " & ACADLayout.PlotWithLineweights

    ' Reset the preference back to its original value
    ACADLayout.PlotWithLineweights = originalValue
    MsgBox "The PlotWithLineweights preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PlotWithLineweights()
    ;; This example reads and modifies the PlotWithLineweights
    ;; Layout value.
    ;; When finished, this example resets the  value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get the layout object
    (setq ACADLayout (vla-get-ActiveLayout doc))

    ;; Read and display the original value
    (setq originalValue (vla-get-PlotWithLineweights ACADLayout))
    (alert (strcat "The PlotWithLineweights value is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the PlotWithLineweights preference by toggling the value
    (vla-put-PlotWithLineweights ACADLayout (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-PlotWithLineweights ACADLayout))
    (alert (strcat "The PlotWithLineweights preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    (vla-put-PlotWithLineweights ACADLayout originalValue)
    (alert (strcat "The PlotWithLineweights preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


PlotWithPlotStyles Property (ActiveX)

Specifies whether or not to plot using the plot styles that are applied to objects and defined in the plot style table.

Supported platforms: Windows only

Signature

VBA:

object.PlotWithPlotStyles
object

Type: Layout, PlotConfiguration

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Use the plot styles applied to objects when plotting.
  • False: Do not use plot styles applied to objects when plotting.

Remarks

The PlotWithPlotStyles property is equivalent to the Plot with Plot Styles option in AutoCAD.

Examples

VBA:

Sub Example_PlotWithPlotStyles()
    ' This example reads and changes the PlotWithPlotStyles
    ' value, and shows a plot preview so the user can see the change.

    Dim ACADLayout As ACADLayout
    Dim originalValue As Boolean

    ' Get the layout object
    Set ACADLayout = ThisDrawing.ActiveLayout

    ' Read and display the original value
    originalValue = ACADLayout.PlotWithPlotStyles
    MsgBox "The PlotWithPlotStyles value is set to: " & originalValue

    ' Modify the PlotWithPlotStyles preference by changing the value
    ACADLayout.PlotWithPlotStyles = Not ACADLayout.PlotWithPlotStyles
    MsgBox "The PlotWithPlotStyles preference has been set to: " & ACADLayout.PlotWithPlotStyles

    ThisDrawing.ActiveLayout.ConfigName = "DWF6 ePlot.pc3"

    'Show plot preview
    ThisDrawing.Plot.DisplayPlotPreview acFullPreview

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PlotWithPlotStyles()
    ;; This example reads and changes the PlotWithPlotStyles
    ;; value, and shows a plot preview so the user can see the change.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get the layout object
    (setq ACADLayout (vla-get-ActiveLayout doc))

    ;; Read and display the original value
    (setq originalValue (vla-get-PlotWithPlotStyles ACADLayout))
    (alert (strcat "The PlotWithPlotStyles value is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the PlotWithPlotStyles preference by changing the value
    (vla-put-PlotWithPlotStyles ACADLayout (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-PlotWithPlotStyles ACADLayout))
    (alert (strcat "The PlotWithPlotStyles preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Set an output device current
    (if (= (strcase (vla-get-ConfigName (vla-get-ActiveLayout doc))) "NONE")
        (vla-put-ConfigName (vla-get-ActiveLayout doc) "DWF6 ePlot.pc3")
    )

    ;; Show plot preview
    (vla-DisplayPlotPreview (vla-get-Plot doc) acFullPreview)
)


PolarTrackingVector Property (ActiveX)

Toggles the display of polar tracking vectors.

Supported platforms: Windows only

Signature

VBA:

object.PolarTrackingVector
object

Type: PreferencesDrafting

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Enables polar tracking vectors.
  • False: Disables polar tracking vectors.

Remarks

The initial value for this property is True.

NoteThe value of this property is stored in the TRACKPATH system variable.

Examples

VBA:

Sub Example_PolarTrackingVector()
    ' This example reads and modifies the preference value that controls
    ' the display of polar tracking vectors.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesDrafting
    Dim originalValue As Variant, newValue As Variant

    ' Get the drafting preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.Drafting

    ' Read and display the original value
    originalValue = ACADPref.PolarTrackingVector
    MsgBox "The PolarTrackingVector preference is set to: " & originalValue

    ' Modify the PolarTrackingVector preference by toggling the value
    ACADPref.PolarTrackingVector = Not (originalValue)
    newValue = ACADPref.PolarTrackingVector
    MsgBox "The PolarTrackingVector preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.PolarTrackingVector = originalValue
    MsgBox "The PolarTrackingVector preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PolarTrackingVector()
    ;; This example reads and modifies the preference value that controls
    ;; the display of polar tracking vectors.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ' Get the drafting preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Drafting

    ;; Read and display the original value
    (setq originalValue (vla-get-PolarTrackingVector (vla-get-Drafting preferences)))
    (alert (strcat "The PolarTrackingVector preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the PolarTrackingVector preference by toggling the value
    (vla-put-PolarTrackingVector (vla-get-Drafting preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-PolarTrackingVector (vla-get-Drafting preferences)))
    (alert (strcat "The PolarTrackingVector preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-PolarTrackingVector (vla-get-Drafting preferences) originalValue)
    (alert (strcat "The PolarTrackingVector preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


Position Property (ActiveX)

Specifies the X, Y, Z coordinate for center of the base or center of the solid, or the origin for the position marker, helix, or underlay.

Supported platforms: Windows only

Signature

VBA:

object.Position
object

Type: 3DSolid, DgnUnderlay, DwfUnderlay, GeoPositionMarker, Helix, PdfUnderlay

The objects this property applies to.

Property Value

Read-only: No

Type: Variant

The X, Y, Z coordinate for the base, center, or origin of the object.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


PostScriptPrologFile Property (ActiveX)

Specifies a name for a customized prolog section in the acad.psf file.

Supported platforms: Windows only

Signature

VBA:

object.PostScriptPrologFile
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The name of the postscript prolog section of the acad.psf file to use when performing a PSOUT.

Remarks

The prolog section is used with the PSOUT AutoCAD command to customize the resulting output. For more information, see the AutoCAD documentation.

NoteThe value of this property is stored in the PSPROLOG system variable.

Examples

VBA:

Sub Example_PostScriptPrologFile()
    ' This example returns the current setting of
    ' PostScriptPrologFile. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currPostScriptPrologFile As String
    Dim newPostScriptPrologFile As String

    Set preferences = ThisDrawing.Application.Preferences

    ' Retrieve the current PostScriptPrologFile value
    currPostScriptPrologFile = preferences.Files.PostScriptPrologFile
    If currPostScriptPrologFile = "" Then
        MsgBox "PostScriptPrologFile is not currently set.", vbInformation, "PostScriptPrologFile Example"
    Else
        MsgBox "The current value for PostScriptPrologFile is " & currPostScriptPrologFile, vbInformation, "PostScriptPrologFile Example"
    End If

    ' Change the value for PostScriptPrologFile
    newPostScriptPrologFile = "TestPostScriptPrologFile"
    preferences.Files.PostScriptPrologFile = newPostScriptPrologFile
    MsgBox "The new value for PostScriptPrologFile is " & newPostScriptPrologFile, vbInformation, "PostScriptPrologFile Example"

    ' Reset PostScriptPrologFile to its original value
    preferences.Files.PostScriptPrologFile = currPostScriptPrologFile
    If currPostScriptPrologFile = "" Then
        MsgBox "PostScriptPrologFile is reset to NULL.", vbInformation, "PostScriptPrologFile Example"
    Else
        MsgBox "The PostScriptPrologFile value is reset to " & currPostScriptPrologFile, vbInformation, "PostScriptPrologFile Example"
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PostScriptPrologFile()
    ;; This example returns the current setting of
    ;; PostScriptPrologFile. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current PostScriptPrologFile value
    (setq currPostScriptPrologFile (vla-get-PostScriptPrologFile (vla-get-Files preferences)))
    (if (= currPostScriptPrologFile "")
        (alert "PostScriptPrologFile is not currently set.")
        (alert (strcat "The current value for PostScriptPrologFile is " currPostScriptPrologFile))
    )

    ;; Change the value for PostScriptPrologFile
    (setq newPostScriptPrologFile "TestPostScriptPrologFile")
    (vla-put-PostScriptPrologFile (vla-get-Files preferences) newPostScriptPrologFile)
    (alert (strcat "The new value for PostScriptPrologFile is " newPostScriptPrologFile))

    ;; Reset PostScriptPrologFile to its original value
    (vla-put-PostScriptPrologFile (vla-get-Files preferences) currPostScriptPrologFile)
    (if (= currPostScriptPrologFile "")
        (alert "PostScriptPrologFile is reset to NULL.")
        (alert (strcat "The PostScriptPrologFile value is reset to " currPostScriptPrologFile))
    )
)


Preferences Property (ActiveX)

Gets the Preferences object.

Supported platforms: Windows only

Signature

VBA:

object.Preferences
object

Type: Application, Database, Document

The objects this property applies to.

Property Value

Read-only: Yes

Type: DatabasePreferences, Preferences

The DatabasePreferences or Preferences object.

Remarks

The Preferences object holds the options from the Options dialog that reside in the registry. Options that reside in the drawing can be found through the DatabasePreferences object.

Examples

VBA:

Sub Example_Preferences()
    ' This example returns the current setting of
    ' LogFilePath from the preferences object.

    Dim preferences As AcadPreferences
    Set preferences = ThisDrawing.Application.Preferences

    ' Retrieve the current LogFilePath value
    MsgBox "The current value for LogFilePath is " & preferences.Files.LogFilePath, , "Preferences Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Preferences()
    ;; This example returns the current setting of
    ;; LogFilePath from the preferences object.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current LogFilePath value
    (alert (strcat "The current value for LogFilePath is " (vla-get-LogFilePath (vla-get-Files preferences))))
)


Preset Property (ActiveX)

Specifies if the attribute is preset.

Supported platforms: Windows only

Signature

VBA:

object.Preset
object

Type: Attribute

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The attribute is a preset attribute.
  • False: The attribute is not a preset attribute.

Remarks

A preset attribute sets the attribute to its default, or preset, value when the user inserts the block.

An attribute may exist as only one of four optional modes: constant, preset, invisible, or verify. The AFLAGS system variable stores the current mode settings. You can query the current mode using the Mode property.

Examples

VBA:

Sub Example_Preset()
    ' This example creates a block containing an attribute definition.
    ' Initially, the attribute has the preset flag turned on and will display a preset
    ' value for the attribute when the parent block is inserted as a reference.
    '
    ' Every time the example is run, attempt to find the attribute and
    ' toggle the Preset value.
    '
    ' * Note: After running this example for the first time, select the menu "Insert/Block..."
    ' and create a block reference from "Block-PRESET".  You will see
    ' the preset value display for the attribute when the blockref is displayed.
    '
    ' Then run the example again and repeat the block insert.  Notice this time that the
    ' preset has been turned off, and you are now prompted for the attribute value.

    Dim attributeObj As AcadAttribute
    Dim height As Double, mode As Long, prompt As String, tag As String, value As String
    Dim AttrInsertionPoint(0 To 2) As Double
    Dim BlockInsertionPoint(0 To 2) As Double
    Dim newBlock As AcadBlock
    Dim IsPreset As String

    ' Determine if this block has already been created.  If so, get the block and
    ' the attribute inside; otherwise, create a new block containing an
    ' attribute.
    On Error Resume Next

    Set newBlock = ThisDrawing.Blocks("Block-PRESET")

    If Err = 0 Then         ' The example block has been created
        Set attributeObj = newBlock.Item(0)                 ' Get only object in example block

        attributeObj.Preset = Not attributeObj.Preset     ' Toggle the attribute preset value

    ElseIf Err <> 0 Then    ' The example block has not been created

        ' Create a new block to hold the Attribute object
        BlockInsertionPoint(0) = 0: BlockInsertionPoint(1) = 0: BlockInsertionPoint(2) = 0
        Set newBlock = ThisDrawing.Blocks.Add(BlockInsertionPoint, "Block-PRESET")

        ' Define the attribute definition
        AttrInsertionPoint(0) = 0: AttrInsertionPoint(1) = 0: AttrInsertionPoint(2) = 0
        height = 1#
        mode = acAttributeModePreset
        prompt = "New Prompt"
        tag = "New_Tag"
        value = "Preset"

        ' Add attribute definition object to new block
        Set attributeObj = newBlock.AddAttribute(height, mode, prompt, AttrInsertionPoint, tag, value)

    End If

    On Error GoTo 0

    ' Read the attribute back and display information
    IsPreset = IIf(attributeObj.Preset, "has a preset value of: " & attributeObj.textString, _
                   "does not have a preset value")

    MsgBox "The block attribute " & IsPreset, vbInformation
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Preset()
    ;; This example creates a block containing an attribute definition.
    ;; Initially, the attribute has the preset flag turned on and will display a preset
    ;; value for the attribute when the parent block is inserted as a reference.
    ;;
    ;; Every time the example is run, attempt to find the attribute and
    ;; toggle the Preset value.
    ;;
    ;; * Note: After running this example for the first time, select the menu "Insert/Block..."
    ;; and create a block reference from "Block-PRESET".  You will see
    ;; the preset value display for the attribute when the blockref is displayed.
    ;;
    ;; Then run the example again and repeat the block insert.  Notice this time that the
    ;; preset has been turned off, and you are now prompted for the attribute value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Determine if this block has already been created.  If so, get the block and
    ;; the attribute inside; otherwise, create a new block containing an
    ;; attribute.

    (setq err (vl-catch-all-apply 'vla-Item (list (vla-get-Blocks doc) "Block-PRESET")))

    (if (/= (type err) 'VL-CATCH-ALL-APPLY-ERROR)             ;; The example block has been created
        (progn
            (setq newBlock err)
            (setq attributeObj (vla-Item newBlock 0))         ;; Get only object in example block

            (vla-put-Preset attributeObj (if (= (vla-get-Preset attributeObj) :vlax-true) :vlax-false :vlax-true))     ;; Toggle the attribute preset value
        )
        (progn
               ;; Create a new block to hold the Attribute object
            (setq BlockInsertionPoint (vlax-3d-point 0 0 0))

            (setq newBlock (vla-Add (vla-get-Blocks doc) BlockInsertionPoint "Block-PRESET"))

               ;; Define the attribute definition
            (setq attrInsertionPoint (vlax-3d-point 0 0 0)
                     attHeight 1
                     attMode acAttributeModePreset
                     attPrompt "New Prompt"
                     attTag "New_Tag"
                  attValue "Preset")

               ;; Add attribute definition object to new block
               (setq attributeObj (vla-AddAttribute newBlock attHeight attMode attPrompt attrInsertionPoint attTag attValue))
        )
    )

    ;; Read the attribute back and display information
    (setq IsPreset (if (= (vla-get-Preset attributeObj) :vlax-true)
                             (strcat "has a preset value of: " (vla-get-TextString attributeObj))
                                     "does not have a preset value"))

    (alert (strcat "The block attribute " IsPreset))
)


PrimaryUnitsPrecision Property (ActiveX)

Specifies the number of decimal places displayed for the primary units of a dimension or tolerance.

Supported platforms: Windows only

Signature

VBA:

object.PrimaryUnitsPrecision
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: acDimPrecision enum

  • acDimPrecisionZero: 0.
  • acDimPrecisionOne: 0.0
  • acDimPrecisionTwo: 0.00
  • acDimPrecisionThree: 0.000
  • acDimPrecisionFour: 0.0000
  • acDimPrecisionFive: 0.00000
  • acDimPrecisionSix: 0.000000
  • acDimPrecisionSeven: 0.0000000
  • acDimPrecisionEight: 0.00000000

Remarks

NoteThis property overrides the value of the DIMDEC system variable for the given dimension.

Examples

VBA:

Sub Example_PrimaryUnitsPrecision()
    ' This example creates an aligned dimension in model space and
    ' uses PrimaryUnitsPrecision to allow the user to change
    ' the number of decimal places displayed for the primary units and tolerance
    ' units of the dimension.

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim oldPrecision As String, newPrecision As String

    ' Define the dimension
    point1(0) = 0: point1(1) = 5: point1(2) = 0
    point2(0) = 5.12345678: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Enable and setup tolerance display
    dimObj.ToleranceDisplay = acTolSymmetrical
    dimObj.ToleranceLowerLimit = -0.0001
    dimObj.ToleranceUpperLimit = 0.005

    ThisDrawing.Application.ZoomAll

    ' Store old precision value as default for input box
    oldPrecision = dimObj.PrimaryUnitsPrecision

    ' Allow the user to change the precision for the dimension and dimension tolerance
    newPrecision = InputBox("Enter a new precision for the dimension and tolerances.  The value must range from 0 to 8.", "Change Precision", oldPrecision)

    Select Case newPrecision
        Case 0: newPrecision = acDimPrecisionZero
        Case 1: newPrecision = acDimPrecisionOne
        Case 2: newPrecision = acDimPrecisionTwo
        Case 3: newPrecision = acDimPrecisionThree
        Case 4: newPrecision = acDimPrecisionFour
        Case 5: newPrecision = acDimPrecisionFive
        Case 6: newPrecision = acDimPrecisionSix
        Case 7: newPrecision = acDimPrecisionSeven
        Case 8: newPrecision = acDimPrecisionEight
        Case Else
            MsgBox "The precision has not been changed."
            Exit Sub
    End Select

    ' Change the dimension and tolerance precision
    dimObj.TolerancePrecision = newPrecision
    dimObj.PrimaryUnitsPrecision = newPrecision

    ThisDrawing.Regen acAllViewports

    ' Read back and display the dimension and dimension tolerance precision
    newPrecision = dimObj.PrimaryUnitsPrecision
    MsgBox "The precision has been set to " & newPrecision & " decimal places"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PrimaryUnitsPrecision()
    ;; This example creates an aligned dimension in model space and
    ;; uses PrimaryUnitsPrecision to allow the user to change
    ;; the number of decimal places displayed for the primary units and tolerance
    ;; units of the dimension.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 0 5 0)
          point2 (vlax-3d-point 5.12345678 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Enable and setup tolerance display
    (vla-put-ToleranceDisplay dimObj acTolSymmetrical)
    (vla-put-ToleranceLowerLimit dimObj -0.0001)
    (vla-put-ToleranceUpperLimit dimObj 0.005)

    (vla-ZoomAll acadObj)

    ;; Store old precision value as default for input box
    (setq oldPrecision (vla-get-PrimaryUnitsPrecision dimObj))

    ;; Allow the user to change the precision for the dimension and dimension tolerance
    (setq newPrecision (vla-GetInteger (vla-get-Utility doc) "\nEnter a new precision for the dimension and tolerances (0 - 8): "))

    (setq newPrecision (cond
                           ((= 0 newPrecision) acDimPrecisionZero)
                           ((= 1 newPrecision) acDimPrecisionOne)
                           ((= 2 newPrecision) acDimPrecisionTwo)
                           ((= 3 newPrecision) acDimPrecisionThree)
                           ((= 4 newPrecision) acDimPrecisionFour)
                           ((= 5 newPrecision) acDimPrecisionFive)
                           ((= 6 newPrecision) acDimPrecisionSix)
                           ((= 7 newPrecision) acDimPrecisionSeven)
                           ((= 8 newPrecision) acDimPrecisionEight)
                           (nil)
                       ))

    ;; Change the dimension and tolerance precision
    (if (/= newPrecision nil)
        (progn
            (vla-put-TolerancePrecision dimObj newPrecision)
            (vla-put-PrimaryUnitsPrecision dimObj newPrecision)

            (vla-Regen doc acAllViewports)

            ;; Read back and display the dimension and dimension tolerance precision
            (setq newPrecision (vla-get-PrimaryUnitsPrecision dimObj))
            (alert (strcat "The precision has been set to " (itoa newPrecision) " decimal places"))
        )
        (alert "The precision has not been changed.")
    )
)


PrincipalDirections Property (ActiveX)

Gets the principal directions of the solid or region.

Supported platforms: Windows only

Signature

VBA:

object.PrincipalDirections
object

Type: 3DSolid, Region

The objects this property applies to.

Property Value

Read-only: Yes

Type: Variant (three-element array of doubles)

The X, Y, and Z coordinates calculated on the current coordinate system.

Remarks

The principal directions are returned as X, Y, and Z coordinates defined as a variant. They are calculated based on the current coordinate system.

Examples

VBA:

Sub Example_PrincipalDirections()
    ' This example creates a box in model space.
    ' It then returns the PrincipalDirections for that box.

    Dim boxObj As Acad3DSolid
    Dim length As Double, width As Double, height As Double
    Dim center(0 To 2) As Double

    ' Define the box
    center(0) = 5#: center(1) = 5#: center(2) = 0
    length = 5#: width = 7: height = 10#

    ' Create the box (3DSolid) object in model space
    Set boxObj = ThisDrawing.ModelSpace.AddBox(center, length, width, height)

    ' Change the viewing direction of the viewport to better see the box
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

    ' Return the PrincipalDirections for the box
    Dim PrincipalDirections As Variant
    PrincipalDirections = boxObj.PrincipalDirections
    MsgBox "The PrincipalDirections for the box are " & PrincipalDirections(0) & ", " & PrincipalDirections(1) & ", " & PrincipalDirections(2), , "PrincipalDirections Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PrincipalDirections()
    ;; This example creates a box in model space.
    ;; It then returns the PrincipalDirections for that box.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the box
    (setq center (vlax-3d-point 5 5 0)
          boxLength 5
             boxWidth 7
             boxHeight 10)

    ;; Create the box (3DSolid) object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq boxObj (vla-AddBox modelSpace center boxLength boxWidth boxHeight))

    ;; Change the viewing direction of the viewport to better see the box
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)

    ;; Return the PrincipalDirections for the box
    (setq PrincipalDirections (vlax-variant-value (vla-get-PrincipalDirections boxObj)))
    (alert (strcat "The PrincipalDirections for the box are "
                   (rtos (vlax-safearray-get-element PrincipalDirections 0) 2) ", "
                   (rtos (vlax-safearray-get-element PrincipalDirections 1) 2) ", "
                   (rtos (vlax-safearray-get-element PrincipalDirections 2) 2)))
)


PrincipalMoments Property (ActiveX)

Gets the principal moments property of the solid or region.

Supported platforms: Windows only

Signature

VBA:

object.PrincipalMoments
object

Type: 3DSolid, Region

The objects this property applies to.

Property Value

Read-only: Yes

Type: Variant (three-element array of doubles)

The X, Y, and Z coordinates calculated on the current coordinate system.

Remarks

The principal moments are returned as X, Y, and Z coordinates defined as a variant. They are calculated based on the current coordinate system.

Examples

VBA:

Sub Example_PrincipalMoments()
    ' This example creates a box in model space.
    ' It then returns the PrincipalMoments for that box.

    Dim boxObj As Acad3DSolid
    Dim length As Double, width As Double, height As Double
    Dim center(0 To 2) As Double

    ' Define the box
    center(0) = 5#: center(1) = 5#: center(2) = 0
    length = 5#: width = 7: height = 10#

    ' Create the box (3DSolid) object in model space
    Set boxObj = ThisDrawing.ModelSpace.AddBox(center, length, width, height)

    ' Change the viewing direction of the viewport to better see the box
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

    ' Return the PrincipalMoments for the box
    Dim PrincipalMoments As Variant
    PrincipalMoments = boxObj.PrincipalMoments
    MsgBox "The PrincipalMoments for the box are " & PrincipalMoments(0) & ", " & PrincipalMoments(1) & ", " & PrincipalMoments(2), , "PrincipalMoments Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PrincipalMoments()
    ;; This example creates a box in model space.
    ;; It then returns the PrincipalMoments for that box.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the box
    (setq center (vlax-3d-point 5 5 0)
          boxLength 5
             boxWidth 7
             boxHeight 10)

    ;; Create the box (3DSolid) object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq boxObj (vla-AddBox modelSpace center boxLength boxWidth boxHeight))

    ;; Change the viewing direction of the viewport to better see the box
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)

    ;; Return the PrincipalMoments for the box
    (setq PrincipalMoments (vlax-variant-value (vla-get-PrincipalMoments boxObj)))
    (alert (strcat "The PrincipalMoments for the box are "
                   (rtos (vlax-safearray-get-element PrincipalMoments 0) 2) ", "
                   (rtos (vlax-safearray-get-element PrincipalMoments 1) 2) ", "
                   (rtos (vlax-safearray-get-element PrincipalMoments 2) 2)))
)


PrinterConfigPath Property (ActiveX)

Specifies the location for printer configuration files.

Supported platforms: Windows only

Signature

VBA:

object.PrinterConfigPath
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The drive and path for printer configuration files.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_PrinterConfigPath()
    ' This example reads and modifies the preference value that controls
    ' the location for printer configuration files.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesFiles
    Dim originalValue As Variant, newValue As Variant

    ' Get the files preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.Files

    ' Read and display the original value
    originalValue = ACADPref.PrinterConfigPath
    MsgBox "The PrinterConfigPath preference is set to: " & originalValue

    ' Modify the PrinterConfigPath preference by changing the path to "C:\"
    ACADPref.PrinterConfigPath = "C:\"
    newValue = ACADPref.PrinterConfigPath
    MsgBox "The PrinterConfigPath preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.PrinterConfigPath = originalValue
    MsgBox "The PrinterConfigPath preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PrinterConfigPath()
    ;; This example reads and modifies the preference value that controls
    ;; the location for printer configuration files.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-PrinterConfigPath (vla-get-Files preferences)))
    (alert (strcat "The PrinterConfigPath preference is set to: " originalValue))

    ;; Modify the PrinterConfigPath preference by changing the path to "C:\\"
    (vla-put-PrinterConfigPath (vla-get-Files preferences) "C:\\")
    (setq newValue (vla-get-PrinterConfigPath (vla-get-Files preferences)))
    (alert (strcat "The PrinterConfigPath preference has been set to: " newValue))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-PrinterConfigPath (vla-get-Files preferences) originalValue)
    (alert (strcat "The PrinterConfigPath preference was reset back to: " originalValue))
)


PrinterDescPath Property (ActiveX)

Specifies the location for printer description files.

Supported platforms: Windows only

Signature

VBA:

object.PrinterDescPath
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The drive and path for printer description files.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_PrinterDescPath()
    ' This example reads and modifies the preference value that controls
    ' the location for printer description files.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesFiles
    Dim originalValue As Variant, newValue As Variant

    ' Get the files preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.Files

    ' Read and display the original value
    originalValue = ACADPref.PrinterDescPath
    MsgBox "The PrinterDescPath preference is set to: " & originalValue

    ' Modify the PrinterDescPath preference by changing the path to "C:\"
    ACADPref.PrinterDescPath = "C:\"
    newValue = ACADPref.PrinterDescPath
    MsgBox "The PrinterDescPath preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.PrinterDescPath = originalValue
    MsgBox "The PrinterDescPath preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PrinterDescPath()
    ;; This example reads and modifies the preference value that controls
    ;; the location for printer description files.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-PrinterDescPath (vla-get-Files preferences)))
    (alert (strcat "The PrinterDescPath preference is set to: " originalValue))

    ;; Modify the PrinterDescPath preference by changing the path to "C:\\"
    (vla-put-PrinterDescPath (vla-get-Files preferences) "C:\\")
    (setq newValue (vla-get-PrinterDescPath (vla-get-Files preferences)))
    (alert (strcat "The PrinterDescPath preference has been set to: " newValue))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-PrinterDescPath (vla-get-Files preferences) originalValue)
    (alert (strcat "The PrinterDescPath preference was reset back to: " originalValue))
)


PrinterPaperSizeAlert Property (ActiveX)

Specifies whether to alert the user when a layout is configured with a paper size that is different than the default setting for the PC3 file.

Supported platforms: Windows only

Signature

VBA:

object.PrinterPaperSizeAlert
object

Type: PreferencesOutput

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Alert the user.
  • False: Do not alert the user.

Remarks

The initial value for this property is True.

Examples

VBA:

Sub Example_PrinterPaperSizeAlert()
    ' This example reads and modifies the PrinterPaperSizeAlert
    ' preference value.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesOutput
    Dim originalValue As Boolean

    ' Get the user preferences object

    Set ACADPref = ThisDrawing.Application.Preferences.Output

    ' Read and display the original value
    originalValue = ACADPref.PrinterPaperSizeAlert
    MsgBox "The PrinterPaperSizeAlert preference is set to: " & originalValue

    ' Modify the PrinterPaperSizeAlert preference by toggling the value
    ACADPref.PrinterPaperSizeAlert = Not ACADPref.PrinterPaperSizeAlert

    MsgBox "The PrinterPaperSizeAlert preference has been set to: " & ACADPref.PrinterPaperSizeAlert

    ' Reset the preference back to its original value
    ACADPref.PrinterPaperSizeAlert = originalValue
    MsgBox "The PrinterPaperSizeAlert preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PrinterPaperSizeAlert()
    ;; This example reads and modifies the PrinterPaperSizeAlert
    ;; preference value.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-PrinterPaperSizeAlert (vla-get-Output preferences)))
    (alert (strcat "The PrinterPaperSizeAlert preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the PrinterPaperSizeAlert preference by toggling the value
    (vla-put-PrinterPaperSizeAlert (vla-get-Output preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (alert (strcat "The PrinterPaperSizeAlert preference has been set to: " (if (= (vla-get-PrinterPaperSizeAlert (vla-get-Output preferences)) :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    (vla-put-PrinterPaperSizeAlert (vla-get-Output preferences) originalValue)
    (alert (strcat "The PrinterPaperSizeAlert preference was reset back to: " (if (= (vla-get-PrinterPaperSizeAlert (vla-get-Output preferences)) :vlax-true) "True" "False")))
)


PrinterSpoolAlert Property (ActiveX)

Specifies whether to alert the user when the output to a device must be spooled through a system printer due to a conflict with the I/O port.

Supported platforms: Windows only

Signature

VBA:

object.PrinterSpoolAlert
object

Type: PreferencesOutput

The object this property applies to.

Property Value

Read-only: No

Type: acPrinterSpoolAlert enum

  • acPrinterAlwaysAlert: Always alert and log errors.
  • acPrinterAlertOnce: Alert only the first error and log all errors.
  • acPrinterNeverAlertLogOnce: Never alert, but log all errors.
  • acPrinterNeverAlert: Never alert and do not log any errors.

Remarks

The initial value for this property is acPrinterAlwaysAlert.

Examples

VBA:

Sub Example_PrinterSpoolAlert()
    ' This example reads and modifies the PrinterSpoolAlert
    ' preference value.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesOutput
    Dim originalValue As Integer

    ' Get the user preferences object

    Set ACADPref = ThisDrawing.Application.Preferences.Output

    ' Read and display the original value
    originalValue = ACADPref.PrinterSpoolAlert
    MsgBox "The PrinterSpoolAlert preference is set to: " & originalValue

    ' Modify the PrinterSpoolAlert preference by toggling the value
    ACADPref.PrinterSpoolAlert = acPrinterNeverAlert
    MsgBox "The PrinterSpoolAlert preference has been set to: " & ACADPref.PrinterSpoolAlert

    ' Reset the preference back to its original value
    ACADPref.PrinterSpoolAlert = originalValue
    MsgBox "The PrinterSpoolAlert preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PrinterSpoolAlert()
    ;; This example reads and modifies the PrinterSpoolAlert
    ;; preference value.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-PrinterSpoolAlert (vla-get-Output preferences)))
    (alert (strcat "The PrinterSpoolAlert preference is set to: " (itoa originalValue)))

    ;; Modify the PrinterSpoolAlert preference by toggling the value
    (vla-put-PrinterSpoolAlert (vla-get-Output preferences) acPrinterNeverAlert)
    (alert (strcat "The PrinterSpoolAlert preference has been set to: " (itoa (vla-get-PrinterSpoolAlert (vla-get-Output preferences)))))

    ;; Reset the preference back to its original value
    (vla-put-PrinterSpoolAlert (vla-get-Output preferences) originalValue)
    (alert (strcat "The PrinterSpoolAlert preference was reset back to: " (itoa (vla-get-PrinterSpoolAlert (vla-get-Output preferences)))))
)


PrinterStyleSheetPath Property (ActiveX)

Specifies the location for printer style sheet files.

Supported platforms: Windows only

Signature

VBA:

object.PrinterStyleSheetPath
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The drive and path for printer style sheet files.

Remarks

Use a semicolon (;) to separate multiple directories; however, do not end the string with a semicolon.

Examples

VBA:

Sub Example_PrinterStyleSheetPath()
    ' This example reads and modifies the preference value that controls
    ' the location for printer style sheet files.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesFiles
    Dim originalValue As Variant, newValue As Variant

    ' Get the files preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.Files

    ' Read and display the original value
    originalValue = ACADPref.PrinterStyleSheetPath
    MsgBox "The PrinterStyleSheetPath preference is set to: " & originalValue

    ' Modify the PrinterStyleSheetPath preference by changing the path to "C:\"
    ACADPref.PrinterStyleSheetPath = "C:\"
    newValue = ACADPref.PrinterStyleSheetPath
    MsgBox "The PrinterStyleSheetPath preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.PrinterStyleSheetPath = originalValue
    MsgBox "The PrinterStyleSheetPath preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PrinterStyleSheetPath()
    ;; This example reads and modifies the preference value that controls
    ;; the location for printer style sheet files.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-PrinterStyleSheetPath (vla-get-Files preferences)))
    (alert (strcat "The PrinterStyleSheetPath preference is set to: " originalValue))

    ;; Modify the PrinterStyleSheetPath preference by changing the path to "C:\\"
    (vla-put-PrinterStyleSheetPath (vla-get-Files preferences) "C:\\")
    (setq newValue (vla-get-PrinterStyleSheetPath (vla-get-Files preferences)))
    (alert (strcat "The PrinterStyleSheetPath preference has been set to: " newValue))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-PrinterStyleSheetPath (vla-get-Files preferences) originalValue)
    (alert (strcat "The PrinterStyleSheetPath preference was reset back to: " originalValue))
)


PrintFile Property (ActiveX)

Specifies an alternate name to use for the temporary plot file name.

Supported platforms: Windows only

Signature

VBA:

object.PrintFile
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The alternate name for plot files. Enter "." to use default (the current drawing name). Enter the drive, path, and file name for the alternate plot file.

Remarks

The default name is the name of the drawing, plus the file extension .plt.

Examples

VBA:

Sub Example_PrintFile()
    ' This example returns the current setting of
    ' PrintFile. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currPrintFile As String
    Dim newPrintFile As String

    Set preferences = ThisDrawing.Application.Preferences

    ' Retrieve the current PrintFile value
    currPrintFile = preferences.Files.PrintFile
    MsgBox "The current value for PrintFile is " & currPrintFile, vbInformation, "PrintFile Example"

    ' Change the value for PrintFile
    newPrintFile = "TestPrintFile.plt"
    preferences.Files.PrintFile = newPrintFile
    MsgBox "The new value for PrintFile is " & newPrintFile, vbInformation, "PrintFile Example"

    ' Reset PrintFile to its original value
    preferences.Files.PrintFile = currPrintFile
    MsgBox "The PrintFile value is reset to " & currPrintFile, vbInformation, "PrintFile Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PrintFile()
    ;; This example returns the current setting of
    ;; PrintFile. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current PrintFile value
    (setq currPrintFile (vla-get-PrintFile (vla-get-Files preferences)))
    (alert (strcat "The current value for PrintFile is " currPrintFile))

    ;; Change the value for PrintFile
    (setq newValue "TestPrintFile.plt")
    (vla-put-PrintFile (vla-get-Files preferences) newValue)
    (alert (strcat "The new value for PrintFile is " newValue))

    ;; Reset PrintFile to its original value
    (vla-put-PrintFile (vla-get-Files preferences) currPrintFile)
    (alert (strcat "The PrintFile value is reset to " currPrintFile))
)


PrintSpoolerPath Property (ActiveX)

Specifies the directory for the print spool files. AutoCAD writes the plot to this location.

Supported platforms: Windows only

Signature

VBA:

object.PrintSpoolerPath
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The directory for the print spool files.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_PrintSpoolerPath()
    ' This example returns the current setting of
    ' PrintSpoolerPath. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currPrintSpoolerPath As String
    Dim newPrintSpoolerPath As String

    Set preferences = ThisDrawing.Application.Preferences

    ' Retrieve the current PrintSpoolerPath value
    currPrintSpoolerPath = preferences.Files.PrintSpoolerPath
    MsgBox "The current value for PrintSpoolerPath is " & currPrintSpoolerPath, vbInformation, "PrintSpoolerPath Example"

    ' Change the value for PrintSpoolerPath
    newPrintSpoolerPath = "TestPrintSpoolerPath"
    preferences.Files.PrintSpoolerPath = newPrintSpoolerPath
    MsgBox "The new value for PrintSpoolerPath is " & newPrintSpoolerPath, vbInformation, "PrintSpoolerPath Example"

    ' Reset PrintSpoolerPath to its original value
    preferences.Files.PrintSpoolerPath = currPrintSpoolerPath
    MsgBox "The PrintSpoolerPath value is reset to " & currPrintSpoolerPath, vbInformation, "PrintSpoolerPath Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PrintSpoolerPath()
    ;; This example returns the current setting of
    ;; PrintSpoolerPath. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current PrintSpoolerPath value
    (setq currPrintSpoolerPath (vla-get-PrintSpoolerPath (vla-get-Files preferences)))
    (alert (strcat "The current value for PrintSpoolerPath is " currPrintSpoolerPath))

    ;; Change the value for PrintSpoolerPath
    (setq newPrintSpoolerPath "TestPrintSpoolerPath")
    (vla-put-PrintSpoolerPath (vla-get-Files preferences) newPrintSpoolerPath)
    (alert (strcat "The new value for PrintSpoolerPath is " newPrintSpoolerPath))

    ;; Reset PrintSpoolerPath to its original value
    (vla-put-PrintSpoolerPath (vla-get-Files preferences) currPrintSpoolerPath)
    (alert (strcat "The PrintSpoolerPath value is reset to " currPrintSpoolerPath))
)


PrintSpoolExecutable Property (ActiveX)

Specifies the application to use for print spooling.

Supported platforms: Windows only

Signature

VBA:

object.PrintSpoolExecutable
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The print spooling application.

Remarks

This property contains the drive, path, and application name of the print spooling executable to use with AutoSpool.

Examples

VBA:

Sub Example_PrintSpoolExecutable()
    ' This example returns the current setting of
    ' PrintSpoolExecutable. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currPrintSpoolExecutable As String
    Dim newPrintSpoolExecutable As String

    Set preferences = ThisDrawing.Application.Preferences

    ' Retrieve the current PrintSpoolExecutable value
    currPrintSpoolExecutable = preferences.Files.PrintSpoolExecutable
    MsgBox "The current value for PrintSpoolExecutable is " & currPrintSpoolExecutable, vbInformation, "PrintSpoolExecutable Example"

    ' Change the value for PrintSpoolExecutable
    newPrintSpoolExecutable = "TestPrintSpoolExecutable"
    preferences.Files.PrintSpoolExecutable = newPrintSpoolExecutable
    MsgBox "The new value for PrintSpoolExecutable is " & newPrintSpoolExecutable, vbInformation, "PrintSpoolExecutable Example"

    ' Reset PrintSpoolExecutable to its original value
    preferences.Files.PrintSpoolExecutable = currPrintSpoolExecutable
    MsgBox "The PrintSpoolExecutable value is reset to " & currPrintSpoolExecutable, vbInformation, "PrintSpoolExecutable Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PrintSpoolExecutable()
    ;; This example returns the current setting of
    ;; PrintSpoolExecutable. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current PrintSpoolExecutable value
    (setq currPrintSpoolExecutable (vla-get-PrintSpoolExecutable (vla-get-Files preferences)))
    (alert (strcat "The current value for PrintSpoolExecutable is " currPrintSpoolExecutable))

    ;; Change the value for PrintSpoolExecutable
    (setq newPrintSpoolExecutable "TestPrintSpoolExecutable")
    (vla-put-PrintSpoolExecutable (vla-get-Files preferences) newPrintSpoolExecutable)
    (alert (strcat "The new value for PrintSpoolExecutable is " newPrintSpoolExecutable))

    ;; Reset PrintSpoolExecutable to its original value
    (vla-put-PrintSpoolExecutable (vla-get-Files preferences) currPrintSpoolExecutable)
    (alert (strcat "The PrintSpoolExecutable value is reset to " currPrintSpoolExecutable))
)


ProductOfInertia Property (ActiveX)

Gets the product of inertia of the solid or region.

Supported platforms: Windows only

Signature

VBA:

object.ProductOfInertia
object

Type: 3DSolid, Region

The objects this property applies to.

Property Value

Read-only: Yes

Type: Variant (three-element array of doubles)

The X, Y, and Z coordinates calculated on the current coordinate system.

Remarks

The product of inertia is returned as X, Y, and Z coordinates defined as a variant. It is calculated based on the current coordinate system.

Examples

VBA:

Sub Example_ProductOfInertia()
    ' This example creates a box in model space.
    ' It then returns the ProductOfInertia for that box.

    Dim boxObj As Acad3DSolid
    Dim length As Double, width As Double, height As Double
    Dim center(0 To 2) As Double

    ' Define the box
    center(0) = 5#: center(1) = 5#: center(2) = 0
    length = 5#: width = 7: height = 10#

    ' Create the box (3DSolid) object in model space
    Set boxObj = ThisDrawing.ModelSpace.AddBox(center, length, width, height)

    ' Change the viewing direction of the viewport to better see the box
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

    ' Return the ProductOfInertia for the box
    Dim ProductOfInertia As Variant
    ProductOfInertia = boxObj.ProductOfInertia
    MsgBox "The ProductOfInertia for the box is " & ProductOfInertia(0) & ", " & ProductOfInertia(1) & ", " & ProductOfInertia(2), , "ProductOfInertia Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ProductOfInertia()
    ;; This example creates a box in model space.
    ;; It then returns the ProductOfInertia for that box.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the box
    (setq center (vlax-3d-point 5 5 0)
          boxLength 5
             boxWidth 7
             boxHeight 10)

    ;; Create the box (3DSolid) object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq boxObj (vla-AddBox modelSpace center boxLength boxWidth boxHeight))

    ;; Change the viewing direction of the viewport to better see the box
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)

    ;; Return the ProductOfInertia for the box
    (setq ProductOfInertia (vlax-variant-value (vla-get-ProductOfInertia boxObj)))
    (alert (strcat "The ProductOfInertia for the box is "
                   (rtos (vlax-safearray-get-element ProductOfInertia 0) 2) ", "
                   (rtos (vlax-safearray-get-element ProductOfInertia 1) 2) ", "
                   (rtos (vlax-safearray-get-element ProductOfInertia 2) 2)))
)


ProfileRotation Property (ActiveX)

Specifies the rotation of the sweep profile.

Supported platforms: Windows only

Signature

VBA:

object.ProfileRotation
object

Type: SweptSurface

The object this property applies to.

Property Value

Read-only: No

Type: ACAD_ANGLE

The rotation of the swept profile.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


Profiles Property (ActiveX)

Gets the PreferencesProfiles object.

Supported platforms: Windows only

Signature

VBA:

object.Profiles
object

Type: Preferences

The object this property applies to.

Property Value

Read-only: Yes

Type: PreferencesProfiles

Gets the PreferencesProfiles object.

Remarks

The PreferencesProfiles object holds all the options from the Profiles tab on the Options dialog stored in the registry. All options that are stored with the drawing can be found on the DatabasePreferences object.

Examples

VBA:

Sub Example_Profiles()
    ' This example obtains a reference to the Profiles Preferences object
    ' from the Application Preferences object, and reads one of the Profiles
    ' preferences

    Dim ACADPref As AcadPreferencesProfiles

    ' Obtain a reference to the Profiles Preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.Profiles

    MsgBox "You now have access to the properties and methods of the Profiles Preferences object!"
    MsgBox "The Profiles preference ActiveProfile is set to: " & ACADPref.ActiveProfile

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Profiles()
    ;; This example obtains a reference to the Profiles Preferences object
    ;; from the Application Preferences object, and reads one of the Profiles
    ;; preferences
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Obtain a reference to the Profiles Preferences object
    (alert "You now have access to the properties and methods of the Profiles Preferences object!")
    (alert (strcat "The Profiles preference ActiveProfile is set to: " (vla-get-ActiveProfile (vla-get-Profiles preferences))))
)


PromptString Property (ActiveX)

Specifies the prompt string for an attribute.

Supported platforms: Windows only

Signature

VBA:

object.PromptString
object

Type: Attribute

The object this property applies to.

Property Value

Read-only: No

Type: String

The prompt string for the attribute.

Remarks

This string appears when a block containing this attribute is inserted. The default for this string is the TagString property. Entering acAttributeModeConstant for the Mode property disables the prompt.

Examples

VBA:

Sub Example_PromptString()
    ' This example creates an attribute definition in a block.
    ' It then inserts the block. Then it changes the prompt string
    ' of the attribute definition, and inserts the block again.

    ' Create the block
    Dim blockObj As AcadBlock
    Dim insertionPnt(0 To 2) As Double
    insertionPnt(0) = 0#: insertionPnt(1) = 0#: insertionPnt(2) = 0#
    Set blockObj = ThisDrawing.Blocks.Add(insertionPnt, "TEST")

    ' Add a circle to block
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 0: center(1) = 0: center(2) = 0
    radius = 1
    Set circleObj = blockObj.AddCircle(center, radius)

    ' Define the attribute definition
    Dim attributeObj As AcadAttribute
    Dim height As Double
    Dim mode As Integer
    Dim prompt As String
    Dim tag As String
    Dim value As String

    height = 1#
    mode = acAttributeModeVerify
    prompt = "Enter value:"
    insertionPnt(0) = 0#: insertionPnt(1) = 0#: insertionPnt(2) = 0
    tag = "Tag1"
    value = "Circle1"

    ' Create the attribute definition on the block
    Set attributeObj = blockObj.AddAttribute(height, mode, prompt, insertionPnt, tag, value)

    ' Insert the block
    Dim blockRefObj1 As AcadBlockReference
    insertionPnt(0) = 2#: insertionPnt(1) = 2#: insertionPnt(2) = 0
    Set blockRefObj1 = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, "TEST", 1#, 1#, 1#, 0)

    ' Change the prompt string and tag of the attribute definition
    attributeObj.PromptString = "Verify value:"

    ' Insert the block again
    Dim blockRefObj2 As AcadBlockReference
    insertionPnt(0) = 4#: insertionPnt(1) = 4#: insertionPnt(2) = 0
    Set blockRefObj2 = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, "TEST", 1#, 1#, 1#, 0)

    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_PromptString()
    ;; This example creates an attribute definition in a block.
    ;; It then inserts the block. Then it changes the prompt string
    ;; of the attribute definition, and inserts the block again.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the block
    (setq insertionPnt (vlax-3d-point 0 0 0))
    (setq blockObj (vla-Add (vla-get-Blocks doc) insertionPnt "TEST"))

    ;; Add a circle to block
    (setq center (vlax-3d-point 0 0 0)
          radius 1)
    (setq circleObj (vla-AddCircle blockObj center radius))

    ;; Define the attribute definition
    (setq insertionPoint (vlax-3d-point 0 0 0)
          attHeight 1
          attMode acAttributeModeVerify
          attPrompt "Enter value:"
          attTag "Tag1"
          attValue "Circle1")

    ;; Create the attribute definition on the block
    (setq attributeObj (vla-AddAttribute blockObj attHeight attMode attPrompt insertionPoint attTag attValue))

    ;; Insert the block
    (setq insertionPnt (vlax-3d-point 2 2 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq blockRefObj1 (vla-InsertBlock modelSpace insertionPnt "TEST" 1 1 1 0))

    ;; Change the prompt string and tag of the attribute definition
    (vla-put-PromptString attributeObj "Verify value:")

    ;; Insert the block again
    (setq insertionPnt (vlax-3d-point 4 4 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq blockRefObj2 (vla-InsertBlock modelSpace insertionPnt "TEST" 1 1 1 0))

    (vla-ZoomAll acadObj)
)


PropertyName Property (ActiveX)

Specifies the name for the property.

Supported platforms: Windows only

Signature

VBA:

object.PropertyName
object

Type: DynamicBlockReferenceProperty

The object this property applies to.

Property Value

Read-only: Yes

Type: String

The property name.

Remarks

Property names are guaranteed to be unique among all properties on a given block reference.

Examples

VBA:

Not available

Visual LISP:

Not available


ProviderName Property (ActiveX)

Specifies the encryption provider name.

Supported platforms: Windows only

Signature

VBA:

object.ProviderName
object

Type: SecurityParams

The object this property applies to.

Property Value

Read-only: No

Type: String

The encryption provider name. More information about cryptography providers is available on MSDN (http://msdn.microsoft.com).

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ProviderName()
    ' This example encrypts and saves a file.
    Dim sp As AcadSecurityParams
    Set sp = GetInterfaceObject("AutoCAD.SecurityParams.20")

    sp.Action = AcadSecurityParamsType.ACADSECURITYPARAMS_ENCRYPT_DATA
    sp.Algorithm = AcadSecurityParamsConstants.ACADSECURITYPARAMS_ALGID_RC4
    sp.KeyLength = 40
    sp.Password = UCase("mypassword") 'AutoCAD converts all passwords to uppercase before applying them
    sp.ProviderName = "Microsoft Base Cryptographic Provider v1.0"
    sp.ProviderType = 1

    ThisDrawing.SaveAs "C:\MyDrawing.dwg", , sp
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ProviderName()
    ;; This example encrypts and saves a drawing file.

    (setq acadObj (vlax-get-acad-object))
    (setq sp (vlax-create-object "AutoCAD.SecurityParams.20"))

    (vla-put-Visible acadObj :vlax-true)

    (vla-put-Action sp ACADSECURITYPARAMS_ENCRYPT_DATA)
    (vla-put-Algorithm sp ACADSECURITYPARAMS_ALGID_RC4)
    (vla-put-KeyLength sp 40)
    (vla-put-Password sp (strcase "mypassword"))
    (vla-put-ProviderName sp "Microsoft Base Cryptographic Provider v1.0")
    (vla-put-ProviderType sp 1)

    (setq doc (vla-get-ActiveDocument acadObj))
    (vla-SaveAs doc "C:\\MyDrawing.dwg" acNative sp)

    (vlax-release-object sp)
)


ProviderType Property (ActiveX)

Specifies the encryption provider type.

Supported platforms: Windows only

Signature

VBA:

object.ProviderType
object

Type: SecurityParams

The object this property applies to.

Property Value

Read-only: No

Type: Long

The encryption provider type. More information about cryptography providers is available on MSDN (http://msdn.microsoft.com).

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ProviderType()
    ' This example encrypts and saves a file.
    Dim sp As AcadSecurityParams
    Set sp = GetInterfaceObject("AutoCAD.SecurityParams.20")

    sp.Action = AcadSecurityParamsType.ACADSECURITYPARAMS_ENCRYPT_DATA
    sp.Algorithm = AcadSecurityParamsConstants.ACADSECURITYPARAMS_ALGID_RC4
    sp.KeyLength = 40
    sp.Password = UCase("mypassword") 'AutoCAD converts all passwords to uppercase before applying them
    sp.ProviderName = "Microsoft Base Cryptographic Provider v1.0"
    sp.ProviderType = 1

    ThisDrawing.SaveAs "C:\MyDrawing.dwg", , sp
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ProviderType()
    ;; This example encrypts and saves a drawing file.

    (setq acadObj (vlax-get-acad-object))
    (setq sp (vlax-create-object "AutoCAD.SecurityParams.20"))

    (vla-put-Visible acadObj :vlax-true)

    (vla-put-Action sp ACADSECURITYPARAMS_ENCRYPT_DATA)
    (vla-put-Algorithm sp ACADSECURITYPARAMS_ALGID_RC4)
    (vla-put-KeyLength sp 40)
    (vla-put-Password sp (strcase "mypassword"))
    (vla-put-ProviderName sp "Microsoft Base Cryptographic Provider v1.0")
    (vla-put-ProviderType sp 1)

    (setq doc (vla-get-ActiveDocument acadObj))
    (vla-SaveAs doc "C:\\MyDrawing.dwg" acNative sp)

    (vlax-release-object sp)
)


ProxyImage Property (ActiveX)

Controls the display of objects in a drawing that were created in a third-party application.

Supported platforms: Windows only

Signature

VBA:

object.ProxyImage
object

Type: PreferencesOpenSave

The object this property applies to.

Property Value

Read-only: No

Type: acProxyImage enum

  • acProxyNotShow
  • acProxyShow
  • acProxyBoundingBox

Remarks

The initial value for this property is acProxyShow.

Examples

VBA:

Sub Example_ProxyImage()
    ' This example returns the current setting of
    ' ProxyImage. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currProxyImage As Integer
    Dim constant As String
    Dim newConstant As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current ProxyImage value
    currProxyImage = preferences.OpenSave.ProxyImage
    constant = Choose(currProxyImage + 1, "acProxyNotShow", "acProxyShow", "acProxyBoundingBox")
    MsgBox "The current value for ProxyImage is " & constant, vbInformation, "ProxyImage Example"

    ' Change the value for ProxyImage
    newConstant = "acProxyBoundingBox"
    preferences.OpenSave.ProxyImage = acProxyBoundingBox
    MsgBox "The new value for ProxyImage is " & newConstant, vbInformation, "ProxyImage Example"

    ' Reset ProxyImage to its original value
    preferences.OpenSave.ProxyImage = currProxyImage
    MsgBox "The ProxyImage value is reset to " & constant, vbInformation, "ProxyImage Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ProxyImage()
    ;; This example returns the current setting of
    ;; ProxyImage. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current ProxyImage value
    (setq currProxyImage (vla-get-ProxyImage (vla-get-OpenSave preferences)))
    (setq constant (cond
                       ((= currProxyImage 0) "acProxyNotShow")
                       ((= currProxyImage 1) "acProxyShow")
                       ((= currProxyImage 2) "acProxyBoundingBox")
                   ))

    (alert (strcat "The current value for ProxyImage is " constant))

    ;; Change the value for ProxyImage
    (setq newConstant "acProxyBoundingBox")
    (vla-put-ProxyImage (vla-get-OpenSave preferences) acProxyBoundingBox)
    (alert (strcat "The new value for ProxyImage is " newConstant))

    ;; Reset ProxyImage to its original value
    (vla-put-ProxyImage (vla-get-OpenSave preferences) currProxyImage)
    (alert (strcat "The ProxyImage value is reset to " constant))
)


QNewTemplateFile Property (ActiveX)

Sets the default template file name for the QNEW command.

Supported platforms: Windows only

Signature

VBA:

object.QNewTemplateFile
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

File name of the default drawing template to use.

Remarks

The value of this property controls the default template used with the QNEW command. To use this property, you must declare an object as an PrefrencesFiles object.

Examples

VBA:

Sub Example_QNewTemplateFile()
    ' This example uses a template file named MyTemplate.dwt to
    ' set a default template for the QNEW command.
    ' You should change the example to use
    ' a template file on your computer.

    Dim MyTemplate As AcadPreferencesFiles
    Set MyTemplate = AcadApplication.Preferences.Files
    MyTemplate.QNewTemplateFile = "C:\MainTemplate.dwt"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_QNewTemplateFile()
    ;; This example uses a template file named MyTemplate.dwt to
    ;; set a default template for the QNEW command.
    ;; You should change the example to use
    ;; a template file on your computer.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    (vla-put-QNewTemplateFile (vla-get-Files preferences) "C:\\MainTemplate.dwt")
)


QuietErrorMode Property (ActiveX)

Toggles the quiet error mode for plot-error reporting.

Supported platforms: Windows only

Signature

VBA:

object.QuietErrorMode
object

Type: Plot

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Enables quiet error mode.
  • False: Disables quiet error mode.

Remarks

Quiet error mode logs all plot-related error messages into a log file.

When the quiet error mode is disabled, the normal error reporting mechanisms (alert boxes) are used.

Examples

VBA:

Sub Example_QuietErrorMode()
    ' This example plots the layouts of a drawing.

    Dim oPlot As AcadPlot
    Dim AddedLayouts() As String
    Dim LayoutList As Variant
    Dim oLayout As ACADLayout
    Dim ArraySize As Integer, BatchCount As Integer

    For Each oLayout In ThisDrawing.Layouts
        ArraySize = ArraySize + 1
        ReDim Preserve AddedLayouts(1 To ArraySize)
        AddedLayouts(ArraySize) = oLayout.Name
    Next

    LayoutList = AddedLayouts
    Set oPlot = ThisDrawing.Plot
    oPlot.SetLayoutsToPlot LayoutList
    oPlot.PlotToDevice "DWF6 ePlot.pc3"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_QuietErrorMode()
    ;; This example plots the layouts of a drawing.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq AddedLayouts (vlax-make-safearray vlax-vbString (cons 0 (1- (vla-get-Count (vla-get-Layouts doc)))))
          ArraySize 0)

    (vlax-for oLayout (vla-get-Layouts doc)
        (vlax-safearray-put-element AddedLayouts ArraySize (vla-get-Name oLayout))
        (setq ArraySize (1+ ArraySize))
    )

    (setq oPlot (vla-get-Plot doc))
    (setq currMode (vla-get-QuietErrorMode oPlot))
    (vla-put-QuietErrorMode oPlot :vlax-true)
    (vla-SetLayoutsToPlot oPlot AddedLayouts)
    (vla-PlotToDevice oPlot "DWF6 ePlot.pc3")
    (vla-put-QuietErrorMode oPlot currMode)
)


Rows Property (ActiveX)

Specifies the number of rows in a block array or table.

Supported platforms: Windows only

Signature

VBA:

object.Rows
object

Type: MInsertBlock, Table

The object this property applies to.

Property Value

Read-only: No

Type: Long

The number of rows in the block array or table.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Rows()
    ' This example creates a new MInsertBlock in the current drawing and
    ' displays the column and row information for the new MInsertBlock

    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double, InsertPoint(0 To 2) As Double
    Dim radius As Double
    Dim newMBlock As AcadMInsertBlock
    Dim newBlock As AcadBlock

    ' Define the Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    InsertPoint(0) = 1: InsertPoint(1) = 1: InsertPoint(2) = 0
    radius = 0.5

    ' Create a new block to hold the Circle
    Set newBlock = ThisDrawing.Blocks.Add(centerPoint, "CBlock")

    ' Add the Circle object to the new block
    Set circleObj = ThisDrawing.Blocks("CBlock").AddCircle(centerPoint, radius)

    ' Create a rectangular array of Circles using the new block containing the Circle
    ' and the AddMInsertBlock method
    Set newMBlock = ThisDrawing.ModelSpace.AddMInsertBlock(InsertPoint, "CBlock", 1, 1, 1, 1, 2, 2, 1, 1)

    ThisDrawing.Application.ZoomAll

    ' Display information about the Columns and Rows defined by the MInsertBlock
    MsgBox "The new rectangular array is comprised of: " & vbCrLf & _
            newMBlock.Columns & " columns with a spacing of " & newMBlock.ColumnSpacing & " and" & vbCrLf & _
            newMBlock.Rows & " rows with a spacing of " & newMBlock.RowSpacing

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Rows()
    ;; This example creates a new MInsertBlock in the current drawing and
    ;; displays the column and row information for the new MInsertBlock
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Circle object
    (setq centerPoint (vlax-3d-point 0 0 0)
          InsertPoint (vlax-3d-point 1 1 0)
          radius 0.5)

    ;; Create a new block to hold the Circle
    (setq newBlock (vla-Add (vla-get-Blocks doc) centerPoint "CBlock"))

    ;; Add the Circle object to the new block
    (setq circleObj (vla-AddCircle newBlock centerPoint radius))

    ;; Create a rectangular array of Circles using the new block containing the Circle
    ;; and the AddMInsertBlock method
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq newMBlock (vla-AddMInsertBlock modelSpace InsertPoint "CBlock" 1 1 1 1 2 2 1 1))

    (vla-ZoomAll acadObj)

    ;; Display information about the Columns and Rows defined by the MInsertBlock
    (alert (strcat "The new rectangular array comprises: \n"
                   (itoa (vla-get-Columns newMBlock)) " columns with a spacing of " (rtos (vla-get-ColumnSpacing newMBlock) 2) " and\n"
                   (itoa (vla-get-Rows newMBlock)) " rows with a spacing of " (rtos (vla-get-RowSpacing newMBlock) 2) "."))
)


RadiiOfGyration Property (ActiveX)

Gets the radius of gyration of the solid or region.

Supported platforms: Windows only

Signature

VBA:

object.RadiiOfGyration
object

Type: 3DSolid, Region

The objects this property applies to.

Property Value

Read-only: Yes

Type: Variant (three-element array of doubles)

The X, Y, and Z coordinates calculated on the current coordinate system.

Remarks

The radius of gyration is returned as X, Y, and Z coordinates defined as a variant. It is calculated based on the current coordinate system.

Examples

VBA:

Sub Example_RadiiOfGyration()
    ' This example creates a box in model space.
    ' It then returns the RadiiOfGyration for that box.

    Dim boxObj As Acad3DSolid
    Dim length As Double, width As Double, height As Double
    Dim center(0 To 2) As Double

    ' Define the box
    center(0) = 5#: center(1) = 5#: center(2) = 0
    length = 5#: width = 7: height = 10#

    ' Create the box (3DSolid) object in model space
    Set boxObj = ThisDrawing.ModelSpace.AddBox(center, length, width, height)

    ' Change the viewing direction of the viewport for a better view of the box
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

    ' Return the RadiiOfGyration for the box
    Dim RadiiOfGyration As Variant
    RadiiOfGyration = boxObj.RadiiOfGyration
    MsgBox "The RadiiOfGyration for the box is " & RadiiOfGyration(0) & ", " & RadiiOfGyration(1) & ", " & RadiiOfGyration(2), , "RadiiOfGyration Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_RadiiOfGyration()
    ;; This example creates a box in model space.
    ;; It then returns the RadiiOfGyration for that box.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the box
    (setq center (vlax-3d-point 5 5 0)
          boxLength 5
      boxWidth 7
      boxHeight 10)

    ;; Create the box (3DSolid) object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq boxObj (vla-AddBox modelSpace center boxLength boxWidth boxHeight))

    ;; Change the viewing direction of the viewport for a better view of the box
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)

    ;; Return the RadiiOfGyration for the box
    (setq RadiiOfGyration (vlax-variant-value (vla-get-RadiiOfGyration boxObj)))
    (alert (strcat "The RadiiOfGyration for the box is "
                             (rtos (vlax-safearray-get-element RadiiOfGyration 0) 2) ", "
                             (rtos (vlax-safearray-get-element RadiiOfGyration 1) 2) ", "
                             (rtos (vlax-safearray-get-element RadiiOfGyration 2) 2)))
)


Radius Property (ActiveX)

Specifies the radius of an arc, circle, or position marker.

Supported platforms: Windows only

Signature

VBA:

object.Radius
object

Type: Arc, Circle, GeoPositionMarker

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The radius of the arc, circle, or position marker.

Remarks

Radius of a circle

Examples

VBA:

Sub Example_Radius()
    ' This example creates an arc in model space.
    ' It then returns the radius of the arc.
    Dim arcObj As AcadArc
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    Dim startAngleInDegree As Double
    Dim endAngleInDegree As Double

    ' Define the circle
    centerPoint(0) = 0#: centerPoint(1) = 0#: centerPoint(2) = 0#
    radius = 5#
    startAngleInDegree = 10#
    endAngleInDegree = 230#

    ' Convert the angles in degrees to angles in radians
    Dim startAngleInRadian As Double
    Dim endAngleInRadian As Double
    startAngleInRadian = startAngleInDegree * 3.141592 / 180#
    endAngleInRadian = endAngleInDegree * 3.141592 / 180#

    ' Create the arc object in model space
    Set arcObj = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngleInRadian, endAngleInRadian)
    ZoomAll

    ' Find the radius of the arc
    radius = arcObj.radius
    MsgBox "The radius of the arc is " & arcObj.radius, , "Radius Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Radius()
    ;; This example creates an arc in model space.
    ;; It then returns the radius of the arc.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the circle
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius 5
          startAngleInDegree 10
          endAngleInDegree 230)

    ;; Convert the angles in degrees to angles in radians
    (setq startAngleInRadian (/ (* startAngleInDegree 3.141592) 180))
    (setq endAngleInRadian (/ (* endAngleInDegree 3.141592) 180))

    ;; Create the arc object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq arcObj (vla-AddArc modelSpace centerPoint radius startAngleInRadian endAngleInRadian))
    (vla-ZoomAll acadObj)

    ;; Find the radius of the arc
    (alert (strcat "The radius of the arc is " (rtos (vla-get-Radius arcObj))))
)


RadiusRatio Property (ActiveX)

Specifies the major to minor axis ratio of an ellipse.

Supported platforms: Windows only

Signature

VBA:

object.RadiusRatio
object

Type: Ellipse

The object this property applies to.

Property Value

Read-only: No

Type: Double

The radius ratio of the arc or circle.

Remarks

If the minor axis is entered longer than the major axis, the ellipse will be round because the radius ratio cannot be greater than 1.0. (A radius ratio of 1.0 defines a circle.)

Radius ratio = 0.25

Radius ratio = 0.75

Examples

VBA:

Sub Example_RadiusRatio()
    ' This example creates an ellipse and finds the radius ratio
    ' for that ellipse. It then changes the radius ratio to 0.75.
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double

    ' Create an ellipse in model space
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)
    ZoomAll
    MsgBox "This ellipse has a radius ratio of " & ellObj.RadiusRatio, vbInformation, "RadiusRatio Example"

    ' Change the radius ratio of the ellipse
    radRatio = 0.75
    ellObj.RadiusRatio = radRatio
    ellObj.Update
    MsgBox "The ellipse has been udpated with the radius ratio of " & ellObj.RadiusRatio, vbInformation, "RadiusRatio Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_RadiusRatio()
    ;; This example creates an ellipse and finds the radius ratio
    ;; for that ellipse. It then changes the radius ratio to 0.75.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create an ellipse in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))
    (vla-ZoomAll acadObj)

    (alert (strcat "This ellipse has a radius ratio of " (rtos (vla-get-RadiusRatio ellObj) 2)))

    ;; Change the radius ratio of the ellipse
    (vla-put-RadiusRatio ellObj 0.75)
    (vla-Update ellObj)
    (alert (strcat "The ellipse has been udpated with the radius ratio of " (rtos (vla-get-RadiusRatio ellObj) 2)))
)


ReadOnly Property (ActiveX)

Specifies if the document or property is read-only or read-write.

Supported platforms: Windows only

Signature

VBA:

object.ReadOnly
object

Type: Document, DynamicBlockReferenceProperty

The objects this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: The document or property is read-only.
  • False: The document or property is read-write.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ReadOnly()
    ' This example shows if current drawing file is read only or not

    If ThisDrawing.ReadOnly Then
        MsgBox "The current drawing file is read only.", , "ReadOnly Example"
    Else
        MsgBox "The current drawing file is read-write.", , "ReadOnly Example"
    End If

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ReadOnly()
    ;; This example shows if current drawing file is read only or not
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (if (= (vla-get-ReadOnly doc) :vlax-true)
        (alert "The current drawing file is read only.")
        (alert "The current drawing file is read-write.")
    )
)


Red Property (ActiveX)

Specifies the red component of the True Color.

Supported platforms: Windows only

Signature

VBA:

object.Red
object

Type: AcCmColor

The object this property applies to.

Property Value

Read-only: Yes

Type: Long

The red component, from 0-255, of AcCmColor.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Red()
    ' This example draws a line and returns the RGB values
    Dim color As AcadAcCmColor
    Set color = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    color.SetRGB 80, 100, 244

    Dim line As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double

    startPoint(0) = 1#: startPoint(1) = 1#: startPoint(2) = 0#
    endPoint(0) = 5#: endPoint(1) = 5#: endPoint(2) = 0#

    Set line = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    ZoomAll

    line.TrueColor = color
    Dim retcolor As AcadAcCmColor
    Set retcolor = line.TrueColor

    MsgBox "Red = " & retcolor.Red & vbLf & _
           "Green = " & retcolor.Green & vbLf & _
           "Blue = " & retcolor.Blue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Red()
    ;; This example draws a line and returns the RGB values
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq color (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB color 80 100 244)

    (setq startPoint (vlax-3d-point 1 1 0)
          endPoint (vlax-3d-point 5 5 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq line (vla-AddLine modelSpace startPoint endPoint))
    (vla-ZoomAll acadObj)

    (vla-put-TrueColor line color)
    (setq retcolor (vla-get-TrueColor line))

    (alert (strcat "Red = " (itoa (vla-get-Red retcolor))
                   "\nGreen = " (itoa (vla-get-Green retcolor))
                   "\nBlue = " (itoa (vla-get-Blue retcolor))
           )
    )

    (vlax-release-object color)
)


ReferenceCount Property (ActiveX)

Specifies the reference count of an entry in the File Dependency List.

Supported platforms: Windows only

Signature

VBA:

object.ReferenceCount
object

Type: FileDependency

The object this property applies to.

Property Value

Read-only: Yes

Type: Long

Current reference count for the entry.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ReferenceCount()
    ' This example reads information from a File Dependency List
    ' Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ' \Sample\Sheet Sets\Architectural\A-01.dwg

    Dim objFDLCol As AutoCAD.AcadFileDependencies
    Dim objFDL As AutoCAD.AcadFileDependency

    Set objFDLCol = ThisDrawing.FileDependencies
    MsgBox ("The number of entries in the File Dependency List is " & objFDLCol.count & ".")

    Dim strTemp As String
    For Each objFDL In objFDLCol
        strTemp = "Affects graphics?: " & vbTab & objFDL.AffectsGraphics
        strTemp = strTemp & vbCrLf & "Feature: " & vbTab & objFDL.Feature
        strTemp = strTemp & vbCrLf & "FileName: " & vbTab & objFDL.FileName
        strTemp = strTemp & vbCrLf & "FileSize: " & vbTab & objFDL.FileSize
        strTemp = strTemp & vbCrLf & "Fingerprint GUID: " & vbTab & objFDL.FingerprintGuid
        strTemp = strTemp & vbCrLf & "FoundPath: " & vbTab & objFDL.FoundPath
        strTemp = strTemp & vbCrLf & "FullFileName: " & vbTab & objFDL.FullFileName
        strTemp = strTemp & vbCrLf & "Index: " & vbTab & objFDL.Index
        strTemp = strTemp & vbCrLf & "Modified?: " & vbTab & objFDL.IsModified
        strTemp = strTemp & vbCrLf & "ReferenceCount: " & vbTab & objFDL.ReferenceCount
        strTemp = strTemp & vbCrLf & "Timestamp: " & vbTab & objFDL.TimeStamp
        strTemp = strTemp & vbCrLf & "Version GUID: " & vbTab & objFDL.VersionGuid
        MsgBox strTemp
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ReferenceCount()
    ;; This example reads information from a File Dependency List
    ;; Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ;; .\\Sample\\Sheet Sets\\Architectural\\A-01.dwg
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq objFDLCol (vla-get-FileDependencies doc))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))

    (setq strTemp "")
    (vlax-for each-objFDL objFDLCol
        (setq strTemp (strcat "Affects graphics?: " (if (= (vla-get-AffectsGraphics each-objFDL) :vlax-true) "True" "False")))
        (setq strTemp (strcat strTemp
                  "\nFeature: " (vla-get-Feature each-objFDL)
                  "\nFileName: " (vla-get-FileName each-objFDL)
                  "\nFileSize: " (itoa (vla-get-FileSize each-objFDL))
                  "\nFingerprint GUID: " (vla-get-FingerprintGuid each-objFDL)
                  "\nFoundPath: " (vla-get-FoundPath each-objFDL)
                  "\nFullFileName: " (vla-get-FullFileName each-objFDL)
                  "\nIndex: " (itoa (vla-get-Index each-objFDL))
                  "\nModified?: " (if (= (vla-get-IsModified each-objFDL) :vlax-true) "True" "False")
                  "\nReferenceCount: " (itoa (vla-get-ReferenceCount each-objFDL))
                  "\nTimeStamp: " (itoa (vla-get-TimeStamp each-objFDL))
                  "\nVersion GUID: " (vla-get-VersionGuid each-objFDL)
                  )
    )
        (alert strTemp)
    )
)


RegenerateTableSuppressed Property (ActiveX)

Enables or disables regeneration of the table block.

Supported platforms: Windows only

Signature

VBA:

object.RegenerateTableSuppressed
object

Type: Table

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Regeneration of the table is suppressed.
  • False: Regeneration of the table is not suppressed.

Remarks

All methods that change the Table object do the following:

  1. Open the Table object in write mode
  2. Modify the Table object based on the input parameters
  3. Close the Table object, which recomputes the Table

Recomputing large tables consumes a lot of time and memory because the Table object is reconstructed from scratch.

To avoid performance problems, you should temporarily disable the regeneration of the Table object when modifying large tables through the API, then apply the modifications and re-enable regeneration.

Examples

VBA:

Sub Example_RegenerateTableSuppressed()
    Dim MyModelSpace As AcadModelSpace
    Dim MyTable As IAcadTable
    Dim pt(2) As Double
    Set MyModelSpace = ThisDrawing.ModelSpace
    Set MyTable = MyModelSpace.AddTable(pt, 100, 5, 5, 10)

    'Temporarily disable the recomputing of table block
    MyTable.RegenerateTableSuppressed = True

    Dim i As Integer, j As Integer
    For i = 0 To 99
        For j = 0 To 4
            Call MyTable.SetText(i, j, "my string " & i & ", " & j)
        Next j
    Next i

    'Now force the recomputing of table block
    'so that we can see the update table results
    MyTable.RegenerateTableSuppressed = False

    'You can also call RecomputeTableBlock(true) instead
    'to force the regeneration of table
    'MyTable.RecomputeTableBlock(True)

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_RegenerateTableSuppressed()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq pt (vlax-3d-point 0 0 0))

    (setq MyModelSpace (vla-get-ModelSpace doc))
    (setq MyTable (vla-AddTable MyModelSpace pt 100 5 5 10))

    ;; Temporarily disable the recomputing of table block
    (vla-put-RegenerateTableSuppressed MyTable :vlax-true)

    (setq i 1
          j 0)

    (while (>= 99 i)
        (while (>= 4 j)
            (vla-SetText MyTable i j (strcat "my string " (itoa i) ", " (itoa j)))

            (setq j (1+ j))
        )

        (setq i (1+ i)
              j 0)
    )

    ;; Now force the recomputing of table block
    ;; so that we can see the update table results
    (vla-put-RegenerateTableSuppressed MyTable :vlax-false)

    ;; You can also call (vla-RecomputeTableBlock obj :vl;ax-true) instead
    ;; to force the regeneration of table
    ;;(vla-RecomputeTableBlock MyTable :vlax-true)
)


RegisteredApplications Property (ActiveX)

Gets the RegisteredApplications collection for the document.

Supported platforms: Windows only

Signature

VBA:

object.RegisteredApplications
object

Type: Database, Document

The object this property applies to.

Property Value

Read-only: Yes

Type: RegisteredApplications

The RegisteredApplications collection for the document.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_RegisteredApplications()
    ' This example finds the current RegisteredApplications collection and
    ' adds a new RegisteredApplication to that collection.

    Dim RegAppColl As AcadRegisteredApplications
    Set RegAppColl = ThisDrawing.RegisteredApplications

    ' Create a RegisteredApp named "TEST" in the current drawing
    Dim RegAppObj As AcadRegisteredApplication
    Set RegAppObj = RegAppColl.Add("TEST")
    MsgBox "A new registered application called " & RegAppObj.name & " has been added to the Registered Applications collection.", vbInformation, "RegisteredApplications Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_RegisteredApplications()
    ;; This example finds the current RegisteredApplications collection and
    ;; adds a new RegisteredApplication to that collection.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq RegAppColl (vla-get-RegisteredApplications doc))

    ;; Create a RegisteredApp named "TEST" in the current drawing
    (setq RegAppObj (vla-Add RegAppColl "TEST"))
    (alert (strcat "A new registered application called " (vla-get-Name RegAppObj) " has been added to the Registered Applications collection."))
)


RemoveHiddenLines Property (ActiveX)

Specifies if hidden lines are to be plotted on a paper space viewport. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.RemoveHiddenLines
object

Type: PViewport

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Removes hidden lines in the plot.
  • False: Does not remove hidden lines in the plot.

Remarks

This property is obsolete and will be removed in a future version.

Examples

VBA:

Sub Example_RemoveHiddenLines()
    ' This example creates a new paper space viewport.
    ' It then displays the value of RemoveHiddenLines for the viewport.

    Dim pviewportObj As AcadPViewport
    Dim center(0 To 2) As Double
    Dim width As Double
    Dim height As Double

    ' Define the paper space viewport
    center(0) = 3: center(1) = 3: center(2) = 0
    width = 40
    height = 40

    ' Change from model space to paper space
    ThisDrawing.ActiveSpace = acPaperSpace

    ' Create the paper space viewport
    Set pviewportObj = ThisDrawing.PaperSpace.AddPViewport(center, width, height)
    pviewportObj.DISPLAY True
    ThisDrawing.mspace = True
    ThisDrawing.ActivePViewport = pviewportObj
    ThisDrawing.Regen acAllViewports

    ' Find the value for RemoveHiddenLines for the viewport
    Dim removeHidden As Boolean
    removeHidden = pviewportObj.RemoveHiddenLines
    MsgBox "The value of the RemoveHiddenLines property for the paperspace viewport is " & pviewportObj.RemoveHiddenLines, , "RemoveHiddenLines Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_RemoveHiddenLines()
    ;; This example creates a new paper space viewport.
    ;; It then displays the value of ShadePlot for the viewport.
    ;; ShadePlot replaces RemoveHiddenLines.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the paper space viewport
    (setq center (vlax-3d-point 3 3 0)
          width 40
          height 40)

    ;; Change from model space to paper space
    (vla-put-ActiveSpace doc acPaperSpace)

    ;; Create the paper space viewport
    (setq paperSpace (vla-get-PaperSpace doc))
    (setq pviewportObj (vla-AddPViewport paperSpace center width height))

    (vla-Display pviewportObj :vlax-true)
    (vla-put-MSpace doc :vlax-true)
    (vla-put-ActivePViewport doc pviewportObj)
    (vla-Regen doc acAllViewports)

    ;; Find the value for ShadePlot for the viewport
    (alert (strcat "The value of the ShadePlot property for the paperspace viewport is " (itoa (vla-get-ShadePlot pviewportObj))))
)


RenderSmoothness Property (ActiveX)

Specifies the smoothness of shaded, rendered, and hidden line-removed objects.

Supported platforms: Windows only

Signature

VBA:

object.RenderSmoothness
object

Type: DatabasePreferences

The object this property applies to.

Property Value

Read-only: No

Type: Double

The valid range is 0.01 to 10.0.

Remarks

The initial value for this property is 0.5. To improve performance, set this value to 1 or less when drawing.

NoteThe value of this property is stored in the FACETRES system variable.

Examples

VBA:

Sub Example_RenderSmoothness()
    ' This example returns the current setting of
    ' RenderSmoothness. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim currRenderSmoothness As Double
    Dim newRenderSmoothness As Double

    ' Retrieve the current RenderSmoothness value
    currRenderSmoothness = ThisDrawing.preferences.RenderSmoothness
    MsgBox "The current value for RenderSmoothness is " & currRenderSmoothness, vbInformation, "RenderSmoothness Example"

    ' Change the value for RenderSmoothness
    newRenderSmoothness = 2.5
    ThisDrawing.preferences.RenderSmoothness = newRenderSmoothness
    MsgBox "The new value for RenderSmoothness is " & newRenderSmoothness, vbInformation, "RenderSmoothness Example"

    ' Reset RenderSmoothness to its original value
    ThisDrawing.preferences.RenderSmoothness = currRenderSmoothness
    MsgBox "The RenderSmoothness value is reset to " & currRenderSmoothness, vbInformation, "RenderSmoothness Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_RenderSmoothness()
    ;; This example returns the current setting of
    ;; RenderSmoothness. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences doc))

    ;; Retrieve the current RenderSmoothness value
    (setq currRenderSmoothness (vla-get-RenderSmoothness preferences))
    (alert (strcat "The current value for RenderSmoothness is " (rtos currRenderSmoothness 2)))

    ;; Change the value for RenderSmoothness
    (setq newRenderSmoothness 2.5)
    (vla-put-RenderSmoothness preferences newRenderSmoothness)
    (alert (strcat "The new value for RenderSmoothness is " (rtos newRenderSmoothness 2)))

    ;; Reset RenderSmoothness to its original value
    (vla-put-RenderSmoothness preferences currRenderSmoothness)
    (alert (strcat "The RenderSmoothness value is reset to " (rtos currRenderSmoothness 2)))
)


RepeatBottomLabels Property (ActiveX)

Determines whether the bottom set of label rows is repeated at the bottom of each broken table part.

Supported platforms: Windows only

Signature

VBA:

object.RepeatBottomLabels
object

Type: Table

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

Flag indicating how bottom labels ought to display.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


RepeatTopLabels Property (ActiveX)

Determines whether the first set of label rows will be repeated at the top of each broken table part.

Supported platforms: Windows only

Signature

VBA:

object.RepeatTopLabels
object

Type: Table

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

Flag indicating how top labels ought to display.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


RevisionNumber Property (ActiveX)

Specifies the revision number.

Supported platforms: Windows only

Signature

VBA:

object.RevisionNumber
object

Type: SummaryInfo

The object this property applies to.

Property Value

Read-only: No

Type: String

The revision number assigned to the drawing.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_RevisionNumber()
    ' This example shows how to access drawing properties

    ' Add and display standard properties
    ThisDrawing.SummaryInfo.Author = "John Doe"
    ThisDrawing.SummaryInfo.Comments = "Includes all ten levels of Building Five"
    ThisDrawing.SummaryInfo.HyperlinkBase = "http://www.autodesk.com"
    ThisDrawing.SummaryInfo.Keywords = "Building Complex"
    ThisDrawing.SummaryInfo.LastSavedBy = "JD"
    ThisDrawing.SummaryInfo.RevisionNumber = "4"
    ThisDrawing.SummaryInfo.Subject = "Plan for Building Five"
    ThisDrawing.SummaryInfo.Title = "Building Five"

    Author = ThisDrawing.SummaryInfo.Author
    Comments = ThisDrawing.SummaryInfo.Comments
    HLB = ThisDrawing.SummaryInfo.HyperlinkBase
    KW = ThisDrawing.SummaryInfo.Keywords
    LSB = ThisDrawing.SummaryInfo.LastSavedBy
    RN = ThisDrawing.SummaryInfo.RevisionNumber
    Subject = ThisDrawing.SummaryInfo.Subject
    Title = ThisDrawing.SummaryInfo.Title
    MsgBox "The standard drawing properties are " & vbCrLf & _
            "Author = " & Author & vbCrLf & _
            "Comments = " & Comments & vbCrLf & _
            "HyperlinkBase = " & HLB & vbCrLf & _
            "Keywords = " & KW & vbCrLf & _
            "LastSavedBy = " & LSB & vbCrLf & _
            "RevisionNumber = " & RN & vbCrLf & _
            "Subject = " & Subject & vbCrLf & _
            "Title = " & Title & vbCrLf

    ' Add and display custom properties
    Dim Key0 As String
    Dim Value0 As String
    Dim Key1 As String
    Dim Value1 As String
    Dim CustomPropertyBranch As String
    Dim PropertyBranchValue As String
    Dim CustomPropertyZone As String
    Dim PropertyZoneValue As String

    CustomPropertyBranch = "Branch"
    PropertyBranchValue = "Main"
    CustomPropertyZone = "Zone"
    PropertyZoneValue = "Industrial"

    ' Add custom properties
    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 1) Then
        ThisDrawing.SummaryInfo.SetCustomByIndex 0, CustomPropertyBranch, PropertyBranchValue
    Else
        ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyBranch, PropertyBranchValue
    End If

    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 2) Then
         ThisDrawing.SummaryInfo.SetCustomByKey CustomPropertyBranch, "Satellite"
    Else
         ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyZone, PropertyZoneValue
    End If

    'Get custom properties
    ThisDrawing.SummaryInfo.GetCustomByIndex 0, Key0, Value0
    Key1 = CustomPropertyZone
    ThisDrawing.SummaryInfo.GetCustomByKey Key1, Value1

    MsgBox "The custom drawing properties are " & vbCrLf & _
            "First property name = " & Key0 & vbCrLf & _
            "First property value = " & Value0 & vbCrLf & _
            "Second property name = " & Key1 & vbCrLf & _
            "Second property value = " & Value1 & vbCrLf
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_RevisionNumber()
    ;; This example shows how to access drawing properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq summaryInfo (vla-get-SummaryInfo doc))

    ;; Add and display standard properties
    (vla-put-Author summaryInfo "John Doe")
    (vla-put-Comments summaryInfo "Includes all ten levels of Building Five")
    (vla-put-HyperlinkBase summaryInfo "http://www.autodesk.com")
    (vla-put-Keywords summaryInfo "Building Complex")
    (vla-put-LastSavedBy summaryInfo "JD")
    (vla-put-RevisionNumber summaryInfo "4")
    (vla-put-Subject summaryInfo "Plan for Building Five")
    (vla-put-Title summaryInfo "Building Five")

    (setq author (vla-get-Author summaryInfo))
    (setq comments (vla-get-Comments summaryInfo))
    (setq HLB (vla-get-HyperlinkBase summaryInfo))
    (setq KW (vla-get-Keywords summaryInfo))
    (setq LSB (vla-get-LastSavedBy summaryInfo))
    (setq RN (vla-get-RevisionNumber summaryInfo))
    (setq subject (vla-get-Subject summaryInfo))
    (setq Title (vla-get-Title summaryInfo))
    (alert (strcat "The standard drawing properties are "
                   "\nAuthor = " author
                   "\nComments = " comments
                   "\nHyperlinkBase = " HLB
                   "\nKeywords = " KW
                   "\nLastSavedBy = " LSB
                   "\nRevisionNumber = " RN
                   "\nSubject = " Subject
                   "\nTitle = " Title
           )
    )

    ;; Add and display custom properties
    (setq CustomPropertyBranch "Branch")
    (setq PropertyBranchValue "Main")
    (setq CustomPropertyZone "Zone")
    (setq PropertyZoneValue "Industrial")

    ;; Add custom properties
    (if (>= (vla-NumCustomInfo summaryInfo) 1)
        (vla-SetCustomByIndex summaryInfo 0 CustomPropertyBranch PropertyBranchValue)
        (vla-AddCustomInfo summaryInfo CustomPropertyBranch PropertyBranchValue)
    )

    (if (>= (vla-NumCustomInfo summaryInfo) 2)
        (vla-SetCustomByKey summaryInfo CustomPropertyBranch "Satellite")
        (vla-AddCustomInfo summaryInfo CustomPropertyZone PropertyZoneValue)
    )

    ;; Get custom properties
    (vla-GetCustomByIndex summaryInfo 0 'Key0 'Value0)
    (setq Key1 CustomPropertyZone)
    (vla-GetCustomByKey summaryInfo Key1 'Value1)

    (alert (strcat "The custom drawing properties are "
                   "\nFirst property name = " Key0
                   "\nFirst property value = " Value0
                   "\nSecond property name = " Key1
                   "\nSecond property value = " Value1
           )
    )
)


RevolutionAngle Property (ActiveX)

Specifies the angle of revolution.

Supported platforms: Windows only

Signature

VBA:

object.RevolutionAngle
object

Type: RevolvedSurface

The object to which this property applies.

Property Value

Read-only: No

Type: ACAD_ANGLE

The angle of revolution for the revolved surface.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


Rotation Property (ActiveX)

Specifies the rotation angle for the object.

Supported platforms: Windows only

Signature

VBA:

object.Rotation
object

Type: Attribute, AttributeReference, BlockReference, DgnUnderlay, Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated, DwfUnderlay, ExternalReference, GeomapImage, GeoPositionMarker, MInsertBlock, MText, OLE, PdfUnderlay, PointCloud, PointCloudEx, RasterImage, Shape, Text, Wipeout

The objects this property applies to.

Property Value

Read-only: No

Type: Double (except an OLE object which is of the ACAD_ANGLE type)

The rotation angle in radians.

Remarks

The rotation angle is relative to the X axis of the object's WCS with positive angles going counterclockwise when looking down from the Z axis toward the origin.

Raster: To display the raster image at the specified rotation, set the ShowRotation property to True.

Text: The rotation angle is read-only for text whose Alignment property is set to acAlignmentAligned or acAlignmentFit.

Text rotation angle

Dimension line angle

Examples

VBA:

Sub Example_Rotation()
    ' This example creates a text object in model space.
    ' It then changes the Rotation of the text object.

    Dim textObj As AcadText
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double

    ' Define the text object
    textString = "Hello, World."
    insertionPoint(0) = 3: insertionPoint(1) = 3: insertionPoint(2) = 0
    height = 0.5

    ' Create the text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)
    ZoomAll
    MsgBox "The Rotation is " & textObj.rotation, vbInformation, "Rotation Example"

    ' Change the value of the Rotation to 45 degrees (.707 radians)
    textObj.rotation = 0.707
    ZoomAll
    MsgBox "The Rotation is set to " & textObj.rotation, vbInformation, "Rotation Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Rotation()
    ;; This example creates a text object in model space.
    ;; It then changes the Rotation of the text object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the text object
    (setq textString "Hello, World."
          insertionPoint (vlax-3d-point 3 3 0)
          height 0.5)

    ;; Create the text object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq textObj (vla-AddText modelSpace textString insertionPoint height))
    (vla-ZoomAll acadObj)

    (alert (strcat "The Rotation is " (rtos (vla-get-Rotation textObj) 2)))

    ;; Change the value of the Rotation to 45 degrees (.707 radians)
    (vla-put-Rotation textObj 0.707)
    (vla-ZoomAll acadObj)
    (alert (strcat "The Rotation is set to " (rtos (vla-get-Rotation textObj) 2)))
)


RoundDistance Property (ActiveX)

Specifies the rounding of dimension units.

Supported platforms: Windows only

Signature

VBA:

object.RoundDistance
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Double

A positive real number representing the value to round distances to. The initial value is 0.00.

Remarks

This property rounds all dimensioning distances to the specified value. For instance, if this property is set to 0.25, the distance is rounded to the nearest 0.25 unit. If you set this property to 1.0, the distance for the dimension is rounded to the nearest integer. Note that the number of digits edited after the decimal point depends on the precision set by the PrimaryUnitsPrecision property or DIMDEC system variable. This property does not apply to angular dimensions.

NoteThis property overrides the value of the DIMRND system variable for the given dimension.

Examples

VBA:

Sub Example_RoundDistance()
    ' This example creates an aligned dimension in model space and
    ' uses RoundDistance to set the unit display
    ' of the dimension to rounded values

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 10.123: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ThisDrawing.Application.ZoomAll

    MsgBox "Press any key to round the dimension unit display to .5"

    ' Round the distance of the dimension to 0.50 of a unit
    dimObj.RoundDistance = 0.5
    ThisDrawing.Regen acAllViewports

    MsgBox "Dimension units have been rounded to: " & dimObj.RoundDistance

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_RoundDistance()
    ;; This example creates an aligned dimension in model space and
    ;; uses RoundDistance to set the unit display
    ;; of the dimension to rounded values
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 10.123 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    (vla-ZoomAll acadObj)

    (alert "Dimensions value will now be rounded to the nearest 0.50 of a unit")

    ;; Round the distance of the dimension to 0.50 of a unit
    (vla-put-RoundDistance dimObj 0.5)
    (vla-Regen doc acAllViewports)

    (alert (strcat "Dimension units have been rounded to: " (rtos (vla-get-RoundDistance dimObj) 2)))
)


RowHeight Property (ActiveX)

Specifies a uniform height for all rows in the table.

Supported platforms: Windows only

Signature

VBA:

object.RowHeight
object

Type: Table

The object this property applies to.

Property Value

Read-only: No

Type: Double

The uniform height for all rows in the table.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


RowSpacing Property (ActiveX)

Specifies the spacing of the rows in a block array.

Supported platforms: Windows only

Signature

VBA:

object.RowSpacing
object

Type: MInsertBlock

The object this property applies to.

Property Value

Read-only: No

Type: Double

The spacing of the rows in the block array.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_RowSpacing()
    ' This example creates a new MInsertBlock in the current drawing and
    ' displays the column and row information for the new MInsertBlock

    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double, InsertPoint(0 To 2) As Double
    Dim radius As Double
    Dim newMBlock As AcadMInsertBlock
    Dim newBlock As AcadBlock

    ' Define the Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    InsertPoint(0) = 1: InsertPoint(1) = 1: InsertPoint(2) = 0
    radius = 0.5

    ' Create a new block to hold the Circle
    Set newBlock = ThisDrawing.Blocks.Add(centerPoint, "CBlock")

    ' Add the Circle object to the new block
    Set circleObj = ThisDrawing.Blocks("CBlock").AddCircle(centerPoint, radius)

    ' Create a rectangular array of Circles using the new block containing the Circle
    ' and the AddMInsertBlock method
    Set newMBlock = ThisDrawing.ModelSpace.AddMInsertBlock(InsertPoint, "CBlock", 1, 1, 1, 1, 2, 2, 1, 1)

    ThisDrawing.Application.ZoomAll

    ' Display information about the Columns and Rows defined by the MInsertBlock
    MsgBox "The new rectangular array is comprised of: " & vbCrLf & _
            newMBlock.Columns & " columns with a spacing of " & newMBlock.ColumnSpacing & " and" & vbCrLf & _
            newMBlock.Rows & " rows with a spacing of " & newMBlock.RowSpacing

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_RowSpacing()
    ;; This example creates a new MInsertBlock in the current drawing and
    ;; displays the column and row information for the new MInsertBlock
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Circle object
    (setq centerPoint (vlax-3d-point 0 0 0)
          InsertPoint (vlax-3d-point 1 1 0)
          radius 0.5)

    ;; Create a new block to hold the Circle
    (setq newBlock (vla-Add (vla-get-Blocks doc) centerPoint "CBlock"))

    ;; Add the Circle object to the new block
    (setq circleObj (vla-AddCircle newBlock centerPoint radius))

    ;; Create a rectangular array of Circles using the new block containing the Circle
    ;; and the AddMInsertBlock method
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq newMBlock (vla-AddMInsertBlock modelSpace InsertPoint "CBlock" 1 1 1 1 2 2 1 1))

    (vla-ZoomAll acadObj)

    ;; Display information about the Columns and Rows defined by the MInsertBlock
    (alert (strcat "The new rectangular array comprises: \n"
                   (itoa (vla-get-Columns newMBlock)) " columns with a spacing of " (rtos (vla-get-ColumnSpacing newMBlock) 2) " and\n"
                   (itoa (vla-get-Rows newMBlock)) " rows with a spacing of " (rtos (vla-get-RowSpacing newMBlock) 2) "."))
)


SaveAsType Property (ActiveX)

Specifies the drawing type for saving the drawing.

Supported platforms: Windows only

Signature

VBA:

object.SaveAsType
object

Type: PreferencesOpenSave

The object this property applies to.

Property Value

Read-only: No

Type: acSaveAsType enum

  • acR12_dxf: AutoCAD R12 DXF (*.dxf)
  • acR14_dwg: AutoCAD R14 DWG (*.dwg)
  • ac2000_dwg: AutoCAD 2000 DWG (*.dwg)
  • ac2000_dxf: AutoCAD 2000 DXF (*.dxf)
  • ac2000_Template: AutoCAD 2000 Drawing Template File (*.dwt)
  • ac2004_dwg: AutoCAD 2004 DWG (*.dwg)
  • ac2004_dxf: AutoCAD 2004 DXF (*.dxf)
  • ac2004_Template: AutoCAD 2004 Drawing Template File (*.dwt)
  • ac2007_dwg: AutoCAD 2007 DWG (*.dwg)
  • ac2007_dxf: AutoCAD 2007 DXF (*.dxf)
  • ac2007_Template: AutoCAD 2007 Drawing Template File (*.dwt)
  • ac2010_dwg: AutoCAD 2010 DWG (*.dwg)
  • ac2010_dxf: AutoCAD 2010 DXF (*.dxf)
  • ac2010_Template: AutoCAD 2010 Drawing Template File (*.dwt)
  • ac2013_dwg: AutoCAD 2013 DWG (*.dwg)
  • ac2013_dxf: AutoCAD 2013 DXF (*.dxf)
  • ac2013_Template: AutoCAD 2013 Drawing Template File (*.dwt)
  • acNative: A synonym for the current drawing release format. If you want your application to save the drawing in the format of whatever version of AutoCAD the application is running on, then use the acNative format.
  • acUnknown: Read-only. The drawing type is unknown or invalid.

Remarks

The initial value for this property is ac2013_dwg. The following values are obsolete:

  • acR13_DWG
  • acR13_DXF
  • acR14_DXF

Examples

VBA:

Sub Example_SaveAsType()
    ' This example reads and modifies the preference value that controls
    ' the drawing type to save the drawing as.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesOpenSave
    Dim originalValue As Variant, DisplayValue As String

    ' Get the OpenSave preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.OpenSave

    ' Store current setting
    originalValue = ACADPref.SaveAsType

    ' Read and display the original value
    GoSub GETVALUE
    MsgBox "The SaveAsType preference is: " & DisplayValue

    ' Modify the SaveAsType preference by changing it to AutoCAD 2000 DWG
    ACADPref.SaveAsType = ac2000_dwg
    GoSub GETVALUE
    MsgBox "The SaveAsType preference has been set to: " & DisplayValue

    ' Reset the preference back to its original value
    '
    ' Comment out this last section to leave the change to
    '         the preference in effect
    ACADPref.SaveAsType = originalValue

    GoSub GETVALUE
    MsgBox "The SaveAsType preference was reset back to: " & DisplayValue

    Exit Sub

GETVALUE:
    ' Convert the value of this setting to a meaningful text string
    DisplayValue = ACADPref.SaveAsType
    Select Case DisplayValue
        Case ac2000_dwg:  DisplayValue = "AutoCAD 2000 DWG (*.dwg)"
        Case acR15_dwg:  DisplayValue = "AutoCAD 2000 DWG (*.dwg)"
        Case ac2000_dxf:  DisplayValue = "AutoCAD 2000 DXF (*.dxf)"
        Case acR15_dxf:  DisplayValue = "AutoCAD 2000 DXF (*.dxf)"
        Case ac2000_Template: DisplayValue = "AutoCAD 2000 Drawing Template File (*.dwt)"

        Case ac2004_dwg:  DisplayValue = "AutoCAD 2004 DWG (*.dwg)"
        Case acR18_dwg:  DisplayValue = "AutoCAD 2004 DWG (*.dwg)"
        Case ac2004_dxf:  DisplayValue = "AutoCAD 2004 DXF (*.dxf)"
        Case acR18_dxf:  DisplayValue = "AutoCAD 2004 DXF (*.dxf)"
        Case ac2004_Template: DisplayValue = "AutoCAD 2004 Drawing Template File (*.dwt)"

        Case ac2007_dwg:  DisplayValue = "AutoCAD 2007 DWG (*.dwg)"
        Case ac2007_dxf:  DisplayValue = "AutoCAD 2007 DXF (*.dxf)"
        Case ac2007_Template: DisplayValue = "AutoCAD 2007 Drawing Template File (*.dwt)"

        Case ac2010_dwg:  DisplayValue = "AutoCAD 2010 DWG (*.dwg)"
        Case ac2010_dxf:  DisplayValue = "AutoCAD 2010 DXF (*.dxf)"
        Case ac2010_Template: DisplayValue = "AutoCAD 2010 Drawing Template File (*.dwt)"

        Case ac2013_dwg:  DisplayValue = "AutoCAD 2013 DWG (*.dwg)"
        Case ac2013_dxf:  DisplayValue = "AutoCAD 2013 DXF (*.dxf)"
        Case ac2013_Template: DisplayValue = "AutoCAD 2013 Drawing Template File (*.dwt)"

        Case acR12_dxf:  DisplayValue = "AutoCAD R12 DXF (*.dxf)"

        Case acR13_dwg:  DisplayValue = "AutoCAD R13 DWG (*.dwg)"
        Case acR13_dxf:  DisplayValue = "AutoCAD R13 DXF (*.dxf)"

        Case acR14_dwg:  DisplayValue = "AutoCAD R14 DWG (*.dwg)"
        Case acR14_dxf:  DisplayValue = "AutoCAD R14 DXF (*.dxf)"
        Case acNative:   DisplayValue = "Latest drawing release"
        Case acUnknown:  DisplayValue = "The drawing type is unknown"
    End Select

    Return
End Sub

Visual LISP:

(defun c:Example_SaveAsType()
    ;; This example reads and modifies the preference value that controls
    ;; the drawing type to save the drawing as.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Store current setting
    (setq originalValue (vla-get-SaveAsType (vla-get-OpenSave preferences)))

    ;; Read and display the original value
    (setq DisplayValue (SaveAsTypeMsg (vla-get-SaveAsType (vla-get-OpenSave preferences))))

    (alert (strcat "The SaveAsType preference is: " DisplayValue))

    ;; Modify the SaveAsType preference by changing it to AutoCAD 2000 DWG
    (vla-put-SaveAsType (vla-get-OpenSave preferences) ac2000_dwg)

    (setq DisplayValue (SaveAsTypeMsg (vla-get-SaveAsType (vla-get-OpenSave preferences))))

    (alert (strcat "The SaveAsType preference has been set to: " DisplayValue))

    ;; Reset the preference back to its original value
    ;;
    ;; Comment out this last section to leave the change to
    ;;         the preference in effect
    (vla-put-SaveAsType (vla-get-OpenSave preferences) originalValue)

    (setq DisplayValue (SaveAsTypeMsg (vla-get-SaveAsType (vla-get-OpenSave preferences))))

    (alert (strcat "The SaveAsType preference was reset back to: " DisplayValue))
)

(defun SaveAsTypeMsg (DisplayValue / )

    ;; Convert the value of this setting to a meaningful text string
    (cond
        ((or (= DisplayValue ac2000_dwg)
             (= DisplayValue acR15_dwg)) (setq DisplayValue "AutoCAD 2000 DWG (*.dwg)"))
        ((or (= DisplayValue ac2000_dxf)
             (= DisplayValue acR15_dxf)) (setq DisplayValue "AutoCAD 2000 DXF (*.dxf)"))
        ((= DisplayValue ac2000_Template) (setq DisplayValue "AutoCAD 2000 Drawing Template File (*.dwt)"))

        ((or (= DisplayValue ac2004_dwg)
             (= DisplayValue acR18_dwg)) (setq DisplayValue "AutoCAD 2004 DWG (*.dwg)"))
        ((or (= DisplayValue ac2004_dxf)
             (= DisplayValue acR18_dxf)) (setq DisplayValue "AutoCAD 2004 DXF (*.dxf)"))
        ((= DisplayValue ac2004_Template) (setq DisplayValue "AutoCAD 2004 Drawing Template File (*.dwt)"))

        ((= DisplayValue ac2007_dwg) (setq DisplayValue "AutoCAD 2007 DWG (*.dwg)"))
        ((= DisplayValue ac2007_dxf) (setq DisplayValue "AutoCAD 2007 DXF (*.dxf)"))
        ((= DisplayValue ac2007_Template) (setq DisplayValue "AutoCAD 2007 Drawing Template File (*.dwt)"))

        ((= DisplayValue ac2010_dwg) (setq DisplayValue "AutoCAD 2010 DWG (*.dwg)"))
        ((= DisplayValue ac2010_dxf) (setq DisplayValue "AutoCAD 2010 DXF (*.dxf)"))
        ((= DisplayValue ac2010_Template) (setq DisplayValue "AutoCAD 2010 Drawing Template File (*.dwt)"))

        ((= DisplayValue ac2013_dwg) (setq DisplayValue "AutoCAD 2013 DWG (*.dwg)"))
        ((= DisplayValue ac2013_dxf) (setq DisplayValue "AutoCAD 2013 DXF (*.dxf)"))
        ((= DisplayValue ac2013_Template) (setq DisplayValue "AutoCAD 2013 Drawing Template File (*.dwt)"))

        ((= DisplayValue acR12_dxf) (setq DisplayValue "AutoCAD R12 DXF (*.dxf)"))

        ((= DisplayValue acR13_dwg) (setq DisplayValue "AutoCAD R13 DWG (*.dwg)"))
        ((= DisplayValue acR13_dxf) (setq DisplayValue "AutoCAD R13 DXF (*.dxf)"))

        ((= DisplayValue acR14_dwg) (setq DisplayValue "AutoCAD R14 DWG (*.dwg)"))
        ((= DisplayValue acR14_dxf) (setq DisplayValue "AutoCAD R14 DXF (*.dxf)"))

        ((= DisplayValue acNative) (setq DisplayValue "Latest drawing release"))
        ((= DisplayValue acUnknown) (setq DisplayValue "The drawing type is unknown"))
    )

  DisplayValue
)


Saved Property (ActiveX)

Specifies if the document has any unsaved changes.

Supported platforms: Windows only

Signature

VBA:

object.Saved
object

Type: Document

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: The document has no unsaved changes.
  • False: The document has unsaved changes.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Saved()
    ' This example checks to see if the current drawing has been modified.

    If Not ThisDrawing.Saved Then
        MsgBox "Drawing has been modified! Use the Save or SaveAs method to save the drawing.", , "Saved Example"
    Else
        MsgBox "Drawing has not been modified since the last save.", , "Saved Example"
    End If

End Sub

Visual LISP:

(defun c:Example_Saved()
    ;; This example checks to see if the current drawing has been modified.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (if (= (vla-get-Saved doc) :vlax-false)
        (alert "Drawing has been modified! Use the Save or SaveAs method to save the drawing.")
        (alert "Drawing has not been modified since the last save.")
    )
)


SavePreviewThumbnail Property (ActiveX)

Specifies if BMP preview images are saved with the drawing.

Supported platforms: Windows only

Signature

VBA:

object.SavePreviewThumbnail
object

Type: PreferencesOpenSave

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: No preview image is created.
  • False: Preview image is created.

Remarks

The initial value for this property is True.

NoteThe value for this property is saved in the THUMBSAVE system variable.

Examples

VBA:

Sub Example_SavePreviewThumbnail()
    ' This example returns the current setting of
    ' SavePreviewThumbnail. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currSavePreviewThumbnail As Boolean

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current SavePreviewThumbnail value
    currSavePreviewThumbnail = preferences.OpenSave.SavePreviewThumbnail
    MsgBox "The current value for SavePreviewThumbnail is " & preferences.OpenSave.SavePreviewThumbnail, vbInformation, "SavePreviewThumbnail Example"

    ' Change the value for SavePreviewThumbnail
    preferences.OpenSave.SavePreviewThumbnail = Not (currSavePreviewThumbnail)
    MsgBox "The new value for SavePreviewThumbnail is " & preferences.OpenSave.SavePreviewThumbnail, vbInformation, "SavePreviewThumbnail Example"

    ' Reset SavePreviewThumbnail to its original value
    preferences.OpenSave.SavePreviewThumbnail = currSavePreviewThumbnail
    MsgBox "The SavePreviewThumbnail value is reset to " & currSavePreviewThumbnail, vbInformation, "SavePreviewThumbnail Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SavePreviewThumbnail()
    ;; This example returns the current setting of
    ;; SavePreviewThumbnail. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current SavePreviewThumbnail value
    (setq currSavePreviewThumbnail (vla-get-SavePreviewThumbnail (vla-get-OpenSave preferences)))
    (alert (strcat "The current value for SavePreviewThumbnail is " (if (= currSavePreviewThumbnail :vlax-true) "True" "False")))

    ;; Change the value for SavePreviewThumbnail
    (vla-put-SavePreviewThumbnail (vla-get-OpenSave preferences) (if (= currSavePreviewThumbnail :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-SavePreviewThumbnail (vla-get-OpenSave preferences)))
    (alert (strcat "The new value for SavePreviewThumbnail is " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset SavePreviewThumbnail to its original value
    (vla-put-SavePreviewThumbnail (vla-get-OpenSave preferences) currSavePreviewThumbnail)
    (alert (strcat "The SavePreviewThumbnail value is reset to " (if (= currSavePreviewThumbnail :vlax-true) "True" "False")))
)


Scale Property (ActiveX)

Specifies the scale factor from start to the end of the sweep path.

Supported platforms: Windows only

Signature

VBA:

object.Scale
object

Type: PointCloud, PointCloudEx, SweptSurface

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The scale factor applied to the object or swept path.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


ScaleFactor Property (ActiveX)

Specifies the scale factor for the object.

Supported platforms: Windows only

Signature

VBA:

object.ScaleFactor
object

Type: Attribute, AttributeReference, DgnUnderlay, Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated, DwfUnderlay, GeomapImage, Leader, MLeader, MLeaderStyle, PdfUnderlay, RasterImage, Shape, Text, Tolerance, Wipeout

The objects this property applies to.

Property Value

Read-only: No

Type: Double (ACAD_NOUNITS)

A real number greater than 0.0. A scale factor greater than 1 enlarges the object. A scale factor between 0 and 1 shrinks the object.

Remarks

The initial value for this property is 1.0000.

The scale factor is often referred to as the relative X scale factor. The scale factor is applied to the object's width to allow the width to be adjusted independently of the height. For example, if the scale factor value is 0.8, then the object will be drawn with a width that is 80 percent of its normal unadjusted width.

Dimension, leader, and tolerance objects: This property overrides the DIMSCALE system variable.

If you are working in paper space, the scale factor for dimensions will equal 0.0 and AutoCAD will compute a reasonable default value based on the scaling between the current model space viewport and paper space. You will not be able to change the scale factor for a dimension in paper space.

Examples

VBA:

Sub Example_ScaleFactor()
    ' This example creates a text object in model space.
    ' It then finds the current scale factor and changes it.
    Dim textObj As AcadText
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double

    ' Define the text object
    textString = "Hello, World."
    insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 0
    height = 0.5

    ' Create the text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)
    ZoomAll

    ' Find the current scale factor for the text object
    Dim currScaleFactor As Double
    currScaleFactor = textObj.scalefactor
    MsgBox "The scale factor of the text is " & textObj.scalefactor, , "ScaleFactor Example"

    ' Change the scale factor for the text object
    textObj.scalefactor = currScaleFactor + 1
    ThisDrawing.Regen True
    MsgBox "The scale factor of the text is now " & textObj.scalefactor, , "ScaleFactor Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ScaleFactor()
    ;; This example creates a text object in model space.
    ;; It then finds the current scale factor and changes it.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the text object
    (setq textString "Hello, World."
          insertionPoint (vlax-3d-point 2 2 0)
          height 0.5)

    ;; Create the text object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq textObj (vla-AddText modelSpace textString insertionPoint height))
    (vla-ZoomAll acadObj)

    ;; Find the current scale factor for the text object
    (setq currScaleFactor (vla-get-Scalefactor textObj))
    (alert (strcat "The scale factor of the text is " (rtos currScaleFactor 2)))

    ;; Change the scale factor for the text object
    (vla-put-Scalefactor textObj (1+ currScaleFactor))
    (vla-Regen doc :vlax-true)
    (alert (strcat "The scale factor of the text is now " (rtos (vla-get-Scalefactor textObj) 2)))
)


ScaleHeight Property (ActiveX)

Specifies the height of the object as a percentage of its original height.

Supported platforms: Windows only

Signature

VBA:

object.ScaleHeight
object

Type: OLE

The object this property applies to.

Property Value

Read-only: No

Type: Double

The percentage of the object's original height.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ScaleLineweights Property (ActiveX)

Specifies if the lineweight is scaled with the rest of the geometry when a layout is printed.

Supported platforms: Windows only

Signature

VBA:

object.ScaleLineweights
object

Type: Layout, PlotConfiguration

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Scale lineweights.
  • False: Do not scale lineweights.

Remarks

By default, lineweights are printed at absolute size (not scaled).

The property disabled for the model space layout.

Examples

VBA:

Sub Example_ScaleLineweights()
    ' This example reads and modifies the ScaleLineweights
    ' Layout value.
    ' When finished, this example resets the  value back to
    ' its original value.

    Dim ACADLayout As ACADLayout
    Dim originalValue As Boolean

    ' Get the layout object
    Set ACADLayout = ThisDrawing.ActiveLayout

    ' Read and display the original value
    originalValue = ACADLayout.ScaleLineweights
    MsgBox "The ScaleLineweights value is set to: " & originalValue

    ' Modify the ScaleLineweights preference by toggling the value
    ACADLayout.ScaleLineweights = Not ACADLayout.ScaleLineweights
    MsgBox "The ScaleLineweights preference has been set to: " & ACADLayout.ScaleLineweights

    ' Reset the preference back to its original value
    ACADLayout.ScaleLineweights = originalValue
    MsgBox "The ScaleLineweights preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ScaleLineweights()
    ;; This example reads and modifies the ScaleLineweights
    ;; Layout value.
    ;; When finished, this example resets the  value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get the layout object
    (setq ACADLayout (vla-get-ActiveLayout doc))

    ;; Read and display the original value
    (setq originalValue (vla-get-ScaleLineweights ACADLayout))
    (alert (strcat "The ScaleLineweights value is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the ScaleLineweights preference by toggling the value
    (vla-put-ScaleLineweights ACADLayout (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (alert (strcat "The ScaleLineweights preference has been set to: " (if (= (vla-get-ScaleLineweights ACADLayout) :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    (vla-put-ScaleLineweights ACADLayout originalValue)
    (alert (strcat "The ScaleLineweights preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


ScaleWidth Property (ActiveX)

Specifies the width of the object as a percentage of its original width.

Supported platforms: Windows only

Signature

VBA:

object.ScaleWidth
object

Type: OLE

The object this property applies to.

Property Value

Read-only: No

Type: Double

The percentage of the object's original width.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SCMCommandMode Property (ActiveX)

Determines right-click functionality in the drawing area while in Command mode, which means that a command is currently in progress.

Supported platforms: Windows only

Signature

VBA:

object.SCMCommandMode
object

Type: PreferencesUser

The object this property applies to.

Property Value

Read-only: No

Type: AcDrawingAreaSCMCommand enum

  • acEnter: Disables the Command shortcut menu. As a result, right-clicking in the drawing area when a command is in progress issues Enter.
  • acEnableSCM: Enables the Command shortcut menu.
  • acEnableSCMOptions: Enables the Command shortcut menu only when options are currently available from the command line prompt. In a command line prompt, options are enclosed in square brackets. If no options are available, right-clicking issues Enter.

Remarks

The initial value for this property is acEnableSCMOptions.

This property can only be set when the ShortcutMenuDisplay property is set to True.

NoteThe value of this property is stored in the SHORTCUTMENU system variable.

Examples

VBA:

Sub Example_SCMCommandMode()
    ' This example reads and modifies the SCMCommandMode
    ' preference value.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesUser
    Dim originalValue As Integer, newValue As Integer

    ' Get the user preferences object

    Set ACADPref = ThisDrawing.Application.Preferences.User

    ' Read and display the original value
    originalValue = ACADPref.SCMCommandMode
    MsgBox "The SCMCommandMode preference is set to: " & originalValue

    ' Modify the SCMCommandMode preference by toggling the value
    ACADPref.SCMCommandMode = acEnter

    MsgBox "The SCMCommandMode preference has been set to: " & ACADPref.SCMCommandMode

    ' Reset the preference back to its original value
    ACADPref.SCMCommandMode = originalValue
    MsgBox "The SCMCommandMode preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SCMCommandMode()
    ;; This example reads and modifies the SCMCommandMode
    ;; preference value.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-SCMCommandMode (vla-get-User preferences)))
    (alert (strcat "The SCMCommandMode preference is set to: " (itoa originalValue)))

    ;; Modify the SCMCommandMode preference by toggling the value
    (vla-put-SCMCommandMode (vla-get-User preferences) acEnter)
    (alert (strcat "The SCMCommandMode preference has been set to: " (itoa (vla-get-SCMCommandMode (vla-get-User preferences)))))

    ;; Reset the preference back to its original value
    (vla-put-SCMCommandMode (vla-get-User preferences) originalValue)
    (alert (strcat "The SCMCommandMode preference was reset back to: " (itoa originalValue)))
)


SCMDefaultMode Property (ActiveX)

Determines right-click functionality in the drawing area while in Default mode, which means that no objects are selected and no commands are in progress.

Supported platforms: Windows only

Signature

VBA:

object.SCMDefaultMode
object

Type: PreferencesUser

The object this property applies to.

Property Value

Read-only: No

Type: AcDrawingAreaSCMDefault enum

  • acRepeatLastCommand: Disables the Default shortcut menu. As a result, right-clicking in the drawing area when no objects are selected and no commands are in progress issues Enter, which repeats the last issued command.
  • acSCM: Enables the Default shortcut menu.

Remarks

The initial value for this property is acSCM.

This property can only be set when the ShortcutMenuDisplay property is set to True.

NoteThe value of this property is stored in the SHORTCUTMENU system variable.

Examples

VBA:

Sub Example_SCMDefaultMode()
    ' This example reads and modifies the SCMDefaultMode
    ' preference value.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesUser
    Dim originalValue As Integer, newValue As Integer

    ' Get the user preferences object

    Set ACADPref = ThisDrawing.Application.Preferences.User

    ' Read and display the original value
    originalValue = ACADPref.SCMDefaultMode
    MsgBox "The SCMDefaultMode preference is set to: " & originalValue

    ' Modify the SCMDefaultMode preference by toggling the value
    ACADPref.SCMDefaultMode = acRepeatLastCommand

    MsgBox "The SCMDefaultMode preference has been set to: " & ACADPref.SCMDefaultMode

    ' Reset the preference back to its original value
    ACADPref.SCMDefaultMode = originalValue
    MsgBox "The SCMDefaultMode preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SCMDefaultMode()
    ;; This example reads and modifies the SCMDefaultMode
    ;; preference value.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-SCMDefaultMode (vla-get-User preferences)))
    (alert (strcat "The SCMDefaultMode preference is set to: " (itoa originalValue)))

    ;; Modify the SCMDefaultMode preference by toggling the value
    (vla-put-SCMDefaultMode (vla-get-User preferences) acRepeatLastCommand)
    (alert (strcat "The SCMDefaultMode preference has been set to: " (itoa (vla-get-SCMDefaultMode (vla-get-User preferences)))))

    ;; Reset the preference back to its original value
    (vla-put-SCMDefaultMode (vla-get-User preferences) originalValue)
    (alert (strcat "The SCMDefaultMode preference was reset back to: " (itoa originalValue)))
)


SCMEditMode Property (ActiveX)

Determines right-click functionality in the drawing area while in Edit mode, which means that one or more objects are selected and no commands are in progress.

Supported platforms: Windows only

Signature

VBA:

object.SCMEditMode
object

Type: PreferencesUser

The object this property applies to.

Property Value

Read-only: No

Type: AcDrawingAreaSCMEdit enum

  • acEdRepeatLastCommand: Disables the Edit shortcut menu. As a result, right-clicking in the drawing area when one or more objects are selected and no commands are in progress issues Enter, which repeats the last issued command.
  • acEdSCM: Enables the Edit shortcut menu.

Remarks

The initial value for this property is acEdSCM.

This property can only be set when the ShortcutMenuDisplay property is set to True.

NoteThe value of this property is stored in the SHORTCUTMENU system variable.

Examples

VBA:

Sub Example_SCMEditMode()
    ' This example reads and modifies the SCMEditMode
    ' preference value.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesUser
    Dim originalValue As Integer, newValue As Integer

    ' Get the user preferences object

    Set ACADPref = ThisDrawing.Application.Preferences.User

    ' Read and display the original value
    originalValue = ACADPref.SCMEditMode
    MsgBox "The SCMEditMode preference is set to: " & originalValue

    ' Modify the SCMEditMode preference by toggling the value
    ACADPref.SCMEditMode = acEdRepeatLastCommand

    MsgBox "The SCMEditMode preference has been set to: " & ACADPref.SCMEditMode

    ' Reset the preference back to its original value
    ACADPref.SCMEditMode = originalValue
    MsgBox "The SCMEditMode preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SCMEditMode()
    ;; This example reads and modifies the SCMEditMode
    ;; preference value.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-SCMEditMode (vla-get-User preferences)))
    (alert (strcat "The SCMEditMode preference is set to: " (itoa originalValue)))

    ;; Modify the SCMEditMode preference by toggling the value
    (vla-put-SCMEditMode (vla-get-User preferences) acEdRepeatLastCommand)
    (alert (strcat "The SCMEditMode preference has been set to: " (itoa (vla-get-SCMEditMode (vla-get-User preferences)))))

    ;; Reset the preference back to its original value
    (vla-put-SCMEditMode (vla-get-User preferences) originalValue)
    (alert (strcat "The SCMEditMode preference was reset back to: " (itoa originalValue)))
)


SCMTimeMode Property (ActiveX)

Controls time-sensitive right-click behavior.

Supported platforms: Windows only

Signature

VBA:

object.SCMTimeMode
object

Type: PreferencesUser

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Time-sensitive right-click is enabled.
  • False: Time-sensitive right-click is disabled.

Remarks

This property is for setting time-sensitive right-click behavior. A quick click is the same as pressing Enter. A longer click displays a shortcut menu. This property can only be set when the ShortcutMenuDisplay property is set to True.

You can set a duration for the right-click using the SCMTimeValue property.

NoteThe value of this property is stored in the SHORTCUTMENU system variable.

Examples

VBA:

Sub Example_SCMTimeMode()
    ' This example reads and modifies the SCMTimeMode property.
    ' Then the property is reset to its original value.

    Dim ACADPref As AcadPreferencesUser
    Dim originalValue As Boolean, newValue As Boolean

    ' Get the UserPreferences object
    Set ACADPref = ThisDrawing.Application.Preferences.User

    originalValue = ACADPref.SCMTimeMode
    MsgBox "The SCMTimeMode property is currently: " & originalValue

    newValue = IIf(originalValue, False, True)
    ACADPref.SCMTimeMode = newValue

    MsgBox "The SCMTimeMode property has been set to: " & ACADPref.SCMTimeMode

    ' Reset the preference back to its original value
    ACADPref.SCMTimeMode = originalValue
    MsgBox "The SCMTimeMode property was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SCMTimeMode()
    ;; This example reads and modifies the SCMTimeMode property.
    ;; Then the property is reset to its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-SCMTimeMode (vla-get-User preferences)))
    (alert (strcat "The SCMTimeMode property is currently: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the SCMTimeMode preference by toggling the value
    (setq newValue (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (vla-put-SCMTimeMode (vla-get-User preferences) newValue)
    (alert (strcat "The SCMTimeMode property has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    (vla-put-SCMTimeMode (vla-get-User preferences) originalValue)
    (alert (strcat "The SCMTimeMode property was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


SCMTimeValue Property (ActiveX)

Controls time-sensitive right-click behavior by setting the duration of the long click that displays a shortcut menu.

Supported platforms: Windows only

Signature

VBA:

object.SCMTimeValue
object

Type: PreferencesUser

The object this property applies to.

Property Value

Read-only: No

Type: Long

A number in milliseconds between 100 and 10,000. The initial value is 250.

Remarks

This property affects right-click behavior when the SCMTimeMode property is set to True.

Examples

VBA:

Sub Example_SCMTimeValue()
    ' This example reads and modifies the SCMTimeValue property.
    ' Then the property is reset to its original value.

    Dim ACADPref As AcadPreferencesUser
    Dim originalValue As Integer, newValue As Integer

    ' Get the UserPreferences object and set the SCMTimeMode property to True
    Set ACADPref = ThisDrawing.Application.Preferences.User
    ACADPref.SCMTimeMode = True

    originalValue = ACADPref.SCMTimeValue
    MsgBox "The SCMTimeValue property is currently: " & originalValue

    newValue = 1000
    ACADPref.SCMTimeValue = newValue

    MsgBox "The SCMTimeValue property has been set to: " & ACADPref.SCMTimeValue

    ' Reset the preference back to its original value
    ACADPref.SCMTimeValue = originalValue
    MsgBox "The SCMTimeValue property was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SCMTimeValue()
    ;; This example reads and modifies the SCMTimeValue property.
    ;; Then the property is reset to its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the UserPreferences object and set the SCMTimeMode property to True
    (vla-put-SCMTimeMode (vla-get-User preferences) :vlax-true)

    (setq originalValue (vla-get-SCMTimeValue (vla-get-User preferences)))
    (alert (strcat "The SCMTimeValue property is currently: " (itoa originalValue)))

    (setq newValue 1000)
    (vla-put-SCMTimeValue (vla-get-User preferences) newValue)

    (alert (strcat "The SCMTimeValue property has been set to: " (itoa (vla-get-SCMTimeValue (vla-get-User preferences)))))

    ;; Reset the preference back to its original value
    (vla-put-SCMTimeValue (vla-get-User preferences) originalValue)
    (alert (strcat "The SCMTimeValue property was reset back to: " (itoa originalValue)))
)


SecondPoint Property (ActiveX)

Specifies the second point of the ray or xline.

Supported platforms: Windows only

Signature

VBA:

object.SecondPoint
object

Type: Ray, XLine

The objects this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

The 3D WCS coordinate representing the second point of the ray or xline.

Remarks

You cannot set the second point of a ray equal to its base point.

Examples

VBA:

Sub Example_SecondPoint()
    ' This example creates a ray object. It then finds the
    ' second point of the ray, changes the second point, and
    ' queries the new second point.

    Dim basePoint(0 To 2) As Double
    Dim directionVec(0 To 2) As Double
    Dim rayObj As AcadRay
    Dim currSecondPoint As Variant
    Dim msg As String
    Dim newSecondPoint(0 To 2) As Double

    ' Establish the base point and directional vector for the ray
    basePoint(0) = 3: basePoint(1) = 3: basePoint(2) = 0
    directionVec(0) = 1:    directionVec(1) = 1: directionVec(2) = 0

    ' Create a Ray object in model space
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, directionVec)

    ThisDrawing.Regen True
    MsgBox "A new Ray has been added.", vbInformation

    ' Define a new second point
    newSecondPoint(0) = 4: newSecondPoint(1) = 2: newSecondPoint(2) = 0

    ' Update the ray using the new second point
    rayObj.SecondPoint = newSecondPoint

    ' Query the new second point for the Ray
    currSecondPoint = rayObj.SecondPoint
    msg = currSecondPoint(0) & vbCrLf & _
          currSecondPoint(1) & vbCrLf & _
          currSecondPoint(2)

    ThisDrawing.Regen True
    MsgBox "We've just changed the second point of the new Ray to: " & vbCrLf & msg, vbInformation

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SecondPoint()
    ;; This example creates a ray object. It then finds the
    ;; second point of the ray, changes the second point, and
    ;; queries the new second point.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Establish the base point and directional vector for the ray
    (setq basePoint (vlax-3d-point 3 3 0)
          directionVec (vlax-3d-point 1 1 0))

    ;; Create a Ray object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq rayObj (vla-AddRay modelSpace basePoint directionVec))

    (vla-Regen doc :vlax-true)
    (alert "A new Ray has been added.")

    ;; Define a new second point
    (setq newSecondPoint (vlax-3d-point 4 2 0))

    ;; Update the ray using the new second point
    (vla-put-SecondPoint rayObj newSecondPoint)

    ;; Query the new second point for the Ray
    (setq currSecondPoint (vlax-safearray->list (vlax-variant-value (vla-get-SecondPoint rayObj))))
    (setq msg (strcat (rtos (nth 0 currSecondPoint) 2) ", "
              (rtos (nth 1 currSecondPoint) 2) ", "
              (rtos (nth 2 currSecondPoint) 2)))

    (vla-Regen doc :vlax-true)
    (alert (strcat "We've just changed the second point of the new Ray to: " msg))
)


SecondSegmentAngleConstraint Property (ActiveX)

Specifies the SecondSegmentAngleConstraint of the mleaderstyle.

Supported platforms: Windows only

Signature

VBA:

object.SecondSegmentAngleConstraint
object

Type: MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: Long

The second segment's angle constraint value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SectionManager Property (ActiveX)

Returns the section manager object.

Supported platforms: Windows only

Signature

VBA:

object.SectionManager
object

Type: Database, Document

The object to which this property applies.

Property Value

Read-only: Yes

Type: SectionManager

The document object's section manager.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SegmentPerPolyline Property (ActiveX)

Specifies the number of line segments to be generated for each polyline curve.

Supported platforms: Windows only

Signature

VBA:

object.SegmentPerPolyline
object

Type: DatabasePreferences

The object this property applies to.

Property Value

Read-only: No

Type: Long

The number of line segments to be generated for each polyline curve.

0 < SegmentPerPolyline <= 42950

Remarks

The initial value is 8. The higher the number you specify, the greater the performance impact.

NoteThe value of this property is stored in the SPLINESEGS system variable.

Examples

VBA:

Sub Example_SegmentPerPolyline()
    ' This example returns the current setting of
    ' SegmentPerPolyline. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim currSegmentPerPolyline As Integer
    Dim newSegmentPerPolyline As Integer

    ' Retrieve the current SegmentPerPolyline value
    currSegmentPerPolyline = ThisDrawing.preferences.SegmentPerPolyline
    MsgBox "The current value for SegmentPerPolyline is " & currSegmentPerPolyline, vbInformation, "SegmentPerPolyline Example"

    ' Change the value for SegmentPerPolyline
    newSegmentPerPolyline = 2001
    ThisDrawing.preferences.SegmentPerPolyline = newSegmentPerPolyline
    MsgBox "The new value for SegmentPerPolyline is " & newSegmentPerPolyline, vbInformation, "SegmentPerPolyline Example"

    ' Reset SegmentPerPolyline to its original value
    ThisDrawing.preferences.SegmentPerPolyline = currSegmentPerPolyline
    MsgBox "The SegmentPerPolyline value is reset to " & currSegmentPerPolyline, vbInformation, "SegmentPerPolyline Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SegmentPerPolyline()
    ;; This example returns the current setting of
    ;; SegmentPerPolyline. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences doc))

    ;; Retrieve the current SegmentPerPolyline value
    (setq currSegmentPerPolyline (vla-get-SegmentPerPolyline preferences))
    (alert (strcat "The current value for SegmentPerPolyline is " (itoa currSegmentPerPolyline)))

    ;; Change the value for SegmentPerPolyline
    (setq newSegmentPerPolyline 2001)
    (vla-put-SegmentPerPolyline preferences newSegmentPerPolyline)
    (alert (strcat "The new value for SegmentPerPolyline is " (itoa newSegmentPerPolyline)))

    ;; Reset SegmentPerPolyline to its original value
    (vla-put-SegmentPerPolyline preferences currSegmentPerPolyline)
    (alert (strcat "The SegmentPerPolyline value is reset to " (itoa currSegmentPerPolyline)))
)


Selection Property (ActiveX)

Gets the PreferencesSelection object.

Supported platforms: Windows only

Signature

VBA:

object.Selection
object

Type: Preferences

The object this property applies to.

Property Value

Read-only: Yes

Type: PreferencesSelection

Gets the PreferencesSelection object.

Remarks

The PreferencesSelection object holds all the options from the Selection tab on the Options dialog stored in the registry. All options that are stored with the drawing can be found on the DatabasePreferences object.

Examples

VBA:

Sub Example_Selection()
    ' This example obtains a reference to the Selection Preferences object
    ' from the Application Preferences object, and reads one of the Selection
    ' preferences

    Dim ACADPref As AcadPreferencesSelection

    ' Obtain a reference to the Selection Preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.Selection

    MsgBox "We now have access to the properties and methods of the Selection Preferences object!"
    MsgBox "The Selection preference GripSize is set to: " & ACADPref.GripSize

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Selection()
    ;; This example obtains a reference to the Selection Preferences object
    ;; from the Application Preferences object, and reads one of the Selection
    ;; preferences
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    (alert "We now have access to the properties and methods of the Selection Preferences object!")
    (alert (strcat "The Selection preference GripSize is set to: " (itoa (vla-get-GripSize (vla-get-Selection preferences)))))
)


SelectionSets Property (ActiveX)

Gets the SelectionSets collection for the document.

Supported platforms: Windows only

Signature

VBA:

object.SelectionSets
object

Type: Document

The object this property applies to.

Property Value

Read-only: Yes

Type: SelectionSets

The selection set collection for the drawing.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SelectionSets()
    ' This example finds the current SelectionSets collection and
    ' adds a new SelectionSet to that collection.

    Dim SSetColl As AcadSelectionSets
    Set SSetColl = ThisDrawing.SelectionSets

    ' Create a SelectionSet named "TEST" in the current drawing
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = SSetColl.Add("TEST")
    MsgBox "A new SelectionSet called " & ssetObj.name & " has been added to the SelectionSets collection.", vbInformation, "SelectionSets Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SelectionSets()
    ;; This example finds the current SelectionSets collection and
    ;; adds a new SelectionSet to that collection.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq SSetColl (vla-get-SelectionSets doc))

    ;; Create a SelectionSet named "TEST" in the current drawing
    (setq ssetObj (vla-Add SSetColl "TEST"))
    (alert (strcat "A new SelectionSet called " (vla-get-Name ssetObj) " has been added to the SelectionSets collection."))

    (vla-Delete ssetObj)
)


SerialNumber Property (ActiveX)

Specifies the serial number of the digital certificate.

Supported platforms: Windows only

Signature

VBA:

object.SerialNumber
object

Type: SecurityParams

The object this property applies to.

Property Value

Read-only: No

Type: String

The serial number of the digital certificate.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_SerialNumber()
    ' This example attaches a digital signature and accompanying data to a file,
    ' and saves the file.

    Dim sp As AcadSecurityParams
    Set sp = GetInterfaceObject("AutoCAD.SecurityParams.20")

    ' Attach a digital signature and timestamp it
    sp.Action = AcadSecurityParamsType.ACADSECURITYPARAMS_SIGN_DATA _
                + AcadSecurityParamsType.ACADSECURITYPARAMS_ADD_TIMESTAMP

    ' Certificate details follow
    sp.Subject = "Thawte Freemail Member"
    sp.Issuer = "Personal Freemail RSA 2000.8.30"
    sp.SerialNumber = "073848"
    sp.Comment = "This is now signed"
    sp.TimeServer = "NIST(time.nist.gov)"

    ThisDrawing.SaveAs "C:\MyDrawing.dwg", , sp
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SerialNumber()
    ;; This example attaches a digital signature and accompanying data to a file,
    ;; and saves the file.

    (setq acadObj (vlax-get-acad-object))
    (setq sp (vlax-create-object "AutoCAD.SecurityParams.20"))

    (vla-put-Visible acadObj :vlax-true)

    ;; Attach a digital signature and timestamp it
    (vla-put-Action sp (+ ACADSECURITYPARAMS_SIGN_DATA ACADSECURITYPARAMS_ADD_TIMESTAMP))

    ;; Certificate details follow
    (vla-put-Subject sp "Thawte Freemail Member")
    (vla-put-Issuer sp "Personal Freemail RSA 2000.8.30")
    (vla-put-SerialNumber sp "073848")
    (vla-put-Comment sp "This is now signed")
    (vla-put-TimeServer sp "NIST(time.nist.gov)")

    (setq doc (vla-get-ActiveDocument acadObj))
    (vla-SaveAs doc "C:\\MyDrawing.dwg" acNative sp)

    (vlax-release-object sp)
)


Settings Property (ActiveX)

Retrieves the section geometry settings for the Section object.

Supported platforms: Windows only

Signature

VBA:

object.Settings
object

Type: Section

The object this property applies to.

Property Value

Read-only: Yes

Type: SectionSettings

The section geometry settings of the Section object.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ShadePlot Property (ActiveX)

Specifies the shaded viewport plotting mode of a viewport.

Supported platforms: Windows only

Signature

VBA:

object.ShadePlot
object

Type: PViewport

The object this property applies to.

Property Value

Read-only: No

Type: AcShadePlot enum

  • acShadePlotAsDisplayed: Model space view plots the same way it is displayed.
  • acShadePlotHidden: Model space view plots with hidden lines removed, regardless of display.
  • acShadePlotRendered: Model space view plots as rendered regardless of display.
  • acShadePlotWireframe: Model space view plots as wireframe regardless of display.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ShadePlot()
    ' This example creates a paper space viewport,
    ' makes it active, and then sets it to plot as displayed.

    Dim newPViewport As AcadPViewport
    Dim centerPoint(0 To 2) As Double
    Dim height As Double
    Dim width As Double
    height = 30#
    width = 40#
    centerPoint(0) = 30#: centerPoint(1) = 30#: centerPoint(2) = 0#

    ' Create a paper space Viewport object
    ThisDrawing.ActiveSpace = acPaperSpace
    Set newPViewport = ThisDrawing.PaperSpace.AddPViewport(centerPoint, width, height)
    ZoomAll
    newPViewport.Display True
    ThisDrawing.MSpace = True

    ' Set the viewport to plot as displayed
    ThisDrawing.ActivePViewport = newPViewport
    newPViewport.ShadePlot = acShadePlotAsDisplayed
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ShadePlot()
    ;; This example creates a paper space viewport,
    ;; makes it active, and then sets it to plot as displayed.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq centerPoint (vlax-3d-point 30 30 0)
          width 40
          height 40)

    ;; Create a paper space Viewport object
    (vla-put-ActiveSpace doc acPaperSpace)

    (setq paperSpace (vla-get-PaperSpace doc))
    (setq newPViewport (vla-AddPViewport paperSpace centerPoint width height))

    (vla-ZoomAll acadObj)
    (vla-Display newPViewport :vlax-true)
    (vla-put-MSpace doc :vlax-true)

    ;; Set the viewport to plot as displayed
    (vla-put-ActivePViewport doc newPViewport)
    (vla-put-ShadePlot newPViewport acShadePlotAsDisplayed)
)


ShadowDisplay Property (ActiveX)

Specifies the shadow display property of the object.

Supported platforms: Windows only

Signature

VBA:

object.ShadowDisplay
object

Type: ShadowDisplay

The object to which this property applies.

Property Value

Read-only: No

Type: AcShadowDisplayType enum

  • acCastsAndReceivesShadows
  • acCastsShadows
  • acReceivesShadows
  • acIgnoreShadows

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ShadowDisplay()

    ' This example creates a cone in model space and changes its shadow display setting.

    Dim coneObj As Acad3DSolid
    Dim centerPoint(0 To 2) As Double
    Set coneObj = ThisDrawing.ModelSpace.AddCone(centerPoint, 5, 20)

    Dim shadowObj As IAcadShadowDisplay
    Dim EnableShadowDisplayStatus As Long
    Dim ShadowDisplay As AcShadowDisplayType
    Dim displaySettingDesc As String
    Set shadowObj = coneObj

    EnableShadowDisplayStatus = shadowObj.EnableShadowDisplay
    ShadowDisplay = shadowObj.ShadowDisplay

    displaySettingDesc = DescribeShadowDisplay(ShadowDisplay)
    If EnableShadowDisplayStatus = 1 Then
        MsgBox "Shadow display is currently enabled for this object." & vbCr & _
            "Current shadow display setting is: " & displaySettingDesc
    Else
        MsgBox "Shadow display is disabled for this object."
    End If

    shadowObj.ShadowDisplay = acCastsShadows
    displaySettingDesc = DescribeShadowDisplay(shadowObj.ShadowDisplay)
    MsgBox "New shadow display setting is: " & displaySettingDesc
End Sub

Private Function DescribeShadowDisplay(acShadow As AcShadowDisplayType) As String
    Select Case acShadow
        Case acCastsAndReceivesShadows:
            DescribeShadowDisplay = "cast and receive shadows."
        Case acCastsShadows:
            DescribeShadowDisplay = "cast shadows only."
        Case acReceivesShadows:
            DescribeShadowDisplay = "receive shadows only."
        Case acIgnoreShadows:
            DescribeShadowDisplay = "ignore shadows."
    End Select
End Function

Visual LISP:

(vl-load-com)
(defun c:Example_ShadowDisplay()
    ;; This example creates a cone in model space and changes its shadow display setting.
    ;; AutoLISP cannot cast COM objects to different types, so you must change the Shadow Display
    ;; property via DXF code values.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq centerPoint (vlax-3d-point 0 0 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq coneObj (vla-AddCone modelSpace centerPoint 5 20))

    (setq ed (entget (vlax-vla-object->ename coneObj)))
    (setq shadowDisplay (assoc 284 ed))
    (if (= shadowDisplay nil)
        (setq shadowDisplay 0)
        (setq shadowDisplay (cdr shadowDisplay))
    )

    (setq displaySettingDesc (DescribeShadowDisplay ShadowDisplay))

    (alert (strcat "Shadow display is currently enabled for this object."
                   "\nCurrent shadow display setting is: " displaySettingDesc))

    ;; Before changing the value, you should validate the object is not a Line or some other
    ;; 2D object that does not support shadows.
    (setq newShadowDisplay acCastsShadows)
    (if (/= (assoc 284 ed) nil)
        (setq ed (subst (cons 284 acCastsShadows) (assoc 284 ed) ed))
        (setq ed (append ed (list (cons 284 acCastsShadows))))
    )

    (entmod ed)
    (entupd (vlax-vla-object->ename coneObj))
    (setq displaySettingDesc (DescribeShadowDisplay newShadowDisplay))
    (alert (strcat "New shadow display setting is: " displaySettingDesc))
)

(defun DescribeShadowDisplay (acShadow / )
    (cond
        ((= acShadow acCastsAndReceivesShadows) "cast and receive shadows.")
        ((= acShadow acCastsShadows) "cast shadows only.")
        ((= acShadow acReceivesShadows) "receive shadows only.")
        ((= acShadow acIgnoreShadows) "ignore shadows.")
    )
)


SheetView Property (ActiveX)

Returns and sets the sheet view associated with the viewport.

Supported platforms: Windows only

Signature

VBA:

object.SheetView
object

Type: PViewport

The object this property applies to.

Property Value

Read-only: No

Type: View

The sheet view associated with the viewport.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ShortcutMenu Property (ActiveX)

Determines if the specified popup menu is the shortcut menu.

Supported platforms: Windows only

Signature

VBA:

object.ShortcutMenu
object

Type: PopupMenu

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: This is the shortcut menu.
  • False: This is not the shortcut menu.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ShortcutMenu()
    ' This example iterates through the menus collection and
    ' determines if each menu is the shortcut menu.

    ' Note that depending on how many menus are currently loaded, the
    ' menuStatus string may not be displayed in full.

    Dim currMenu As AcadPopupMenu
    Dim menuStatus As String

    menuStatus = ""
    For Each currMenu In ThisDrawing.Application.MenuGroups.Item(0).Menus
    If currMenu.shortcutMenu Then
        menuStatus = menuStatus & currMenu.name & " is the shortcut menu." & vbCrLf
    Else
        menuStatus = menuStatus & currMenu.name & " is not the shortcut menu." & vbCrLf
    End If
    Next currMenu
    MsgBox menuStatus

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ShortcutMenu()
    ;; This example iterates through the menus collection and
    ;; determines if each menu is the shortcut menu.
    (setq acadObj (vlax-get-acad-object))

    ;; Note that depending on how many menus are currently loaded, the
    ;; menuStatus string may not be displayed in full.

    (setq menuStatus "")
    (vlax-for currMenu (vla-get-Menus (vla-Item (vla-get-MenuGroups acadObj) 0))
        (if (= (vla-get-ShortcutMenu currMenu) :vlax-true)
            (setq menuStatus (strcat menuStatus (vla-get-Name currMenu) " is a shortcut menu.\n"))
            (setq menuStatus (strcat menuStatus (vla-get-Name currMenu) " is not a shortcut menu.\n"))
        )
    )

    (alert menuStatus)
)


ShortCutMenuDisplay Property (ActiveX)

Controls whether right-clicking in the drawing area displays a shortcut menu or issues Enter.

Supported platforms: Windows only

Signature

VBA:

object.ShortCutMenuDisplay
object

Type: PreferencesUser

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Shortcut menus are enabled in the drawing area.
  • False: Shortcut menus are disabled in the drawing area. A right-click in the drawing area will be interpreted as an Enter.

Remarks

The initial value for this property is True.

When this property is set to True, you can customize the functionality of right-clicking in the drawing area using properties in the PreferencesUser object.

NoteThe value of this property is stored in the SHORTCUTMENU system variable.

Examples

VBA:

Sub Example_ShortCutMenuDisplay()
    ' This example reads and toggles the preference value which controls
    ' whether right-clicking in the drawing area displays a shortcut menu
    ' or issues ENTER.

    Dim ACADPref As AcadPreferencesUser
    Dim originalValue As Variant, newValue As Variant
    Dim newAction As String

    ' Get the drafting preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.User

    ' Read and display the original value
    originalValue = ACADPref.ShortCutMenuDisplay
    newAction = IIf(originalValue, "displays the shortcut menu", "sends an ENTER keystroke to ACAD")
    MsgBox "Right-clicking the mouse CURRENTLY " & newAction, vbInformation

    ' Modify the AutoSnapMarker preference by toggling the value
    ACADPref.ShortCutMenuDisplay = Not (originalValue)
    newValue = ACADPref.ShortCutMenuDisplay
    newAction = IIf(newValue, "display the shortcut menu", "send an ENTER keystroke to ACAD")
    MsgBox "Right-clicking the mouse over the drawing WILL NOW " & newAction, vbInformation
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ShortCutMenuDisplay()
    ;; This example reads and toggles the preference value which controls
    ;; whether right-clicking in the drawing area displays a shortcut menu
    ;; or issues ENTER.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-ShortCutMenuDisplay (vla-get-User preferences)))
    (setq newAction (if (= originalValue :vlax-true) "displays the shortcut menu" "sends an ENTER keystroke to ACAD"))
    (alert (strcat "Right-clicking the mouse CURRENTLY " newAction))

    ;; Modify the AutoSnapMarker preference by toggling the value
    (vla-put-ShortCutMenuDisplay (vla-get-User preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-ShortCutMenuDisplay (vla-get-User preferences)))
    (setq newAction (if (= newValue :vlax-true) "displays the shortcut menu" "sends an ENTER keystroke to ACAD"))
    (alert (strcat "Right-clicking the mouse over the drawing WILL NOW " newAction))
)


Show Property (ActiveX)

Specifies whether the property is shown in the user interface.

Supported platforms: Windows only

Signature

VBA:

object.Show
object

Type: DynamicBlockReferenceProperty

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: The property is shown in the user interface.
  • False: The property is not shown in the user interface.

Remarks

If this property is True, the dynamic block reference property is displayed in the Properties palette when the block reference containing it is selected.

Examples

VBA:

Not available

Visual LISP:

Not available


ShowAssociativity Property (ActiveX)

Specifies if dependent surfaces are highlighted when the surface is selected.

Supported platforms: Windows only

Signature

VBA:

object.ShowAssociativity
object

Type: ExtrudedSurface, LoftedSurface, NurbSurface, PlaneSurface, RevolvedSurface, Surface, SweptSurface

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Dependent surfaces are highlighted
  • False: Dependent surfaces are not highlighted

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


ShowClipped Property (ActiveX)

Enables or disables the clipping boundary.

Supported platforms: Windows only

Signature

VBA:

object.ShowClipped
object

Type: PointCloud

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Clipping boundary is enabled
  • False: Clipping boundary is not enabled

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ShowCropped Property (ActiveX)

Specifies if the point cloud is shown cropped.

Supported platforms: Windows only

Signature

VBA:

object.ShowCropped
object

Type: PointCloudEx

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The point cloud's cropping region filters out displayed points.
  • False: All points are displayed regardless of any cropping regions attached to the point cloud.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ShowHistory Property (ActiveX)

Specifies whether to show history of the solid.

Supported platforms: Windows only

Signature

VBA:

object.ShowHistory
object

Type: 3DSolid

The object to which this property applies.

Property Value

Read-only: No

Type: Boolean

  • True: Solid history is shown
  • False: Solid history is not shown

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ShowIntensity Property (ActiveX)

Specifies if the point cloud is displayed using a shaded color scheme.

Supported platforms: Windows only

Signature

VBA:

object.ShowIntensity
object

Type: PointCloud

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Intensity is turned on
  • False: Intensity is turned off

Remarks

You can only see the intensity color mapping effect when a 3D visual style is current and hardware acceleration is on.

Examples

VBA:

Not available

Visual LISP:

Not available


ShowPlotStyles Property (ActiveX)

Specifies whether or not plot styles and plot style names are displayed in the drawing.

Supported platforms: Windows only

Signature

VBA:

object.ShowPlotStyles
object

Type: Layout, PlotConfiguration

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Plot styles and plot style names are displayed and plotted.
  • False: Plot styles and plot style names are not displayed.

Remarks

The ShowPlotStyles property is equivalent to the Display Plot Styles option in AutoCAD.

Examples

VBA:

Sub Example_ShowPlotStyles()
    ' This example reads and modifies the ShowPlotStyles
    ' value, and then regenerates all viewports.

    Dim ACADLayout As ACADLayout
    Dim originalValue As Boolean

    ' Get the layout object
    Set ACADLayout = ThisDrawing.ActiveLayout

    ' Read and display the original value
    originalValue = ACADLayout.ShowPlotStyles
    MsgBox "The ShowPlotStyles value is set to: " & originalValue

    ' Modify the ShowPlotStyles preference by changing the value
    ACADLayout.ShowPlotStyles = Not ACADLayout.ShowPlotStyles
    MsgBox "The ShowPlotStyles value has been set to: " & ACADLayout.ShowPlotStyles

    ' Regenerate viewports
    ThisDrawing.Regen acAllViewports

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ShowPlotStyles()
    ;; This example reads and modifies the ShowPlotStyles
    ;; value, and then regenerates all viewports.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get the layout object
    (setq ACADLayout (vla-get-ActiveLayout doc))

    ;; Read and display the original value
    (setq originalValue (vla-get-ShowPlotStyles ACADLayout))
    (alert (strcat "The ShowPlotStyles value is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the ShowPlotStyles preference by changing the value
    (vla-put-ShowPlotStyles ACADLayout (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (alert (strcat "The ShowPlotStyles value has been set to: " (if (= (vla-get-ShowPlotStyles ACADLayout) :vlax-true) "True" "False")))

    ;; Regenerate viewports
    (vla-Regen doc acAllViewports)
)


ShowProxyDialogBox Property (ActiveX)

Specifies if AutoCAD displays a warning message when you open a drawing that contains custom objects.

Supported platforms: Windows only

Signature

VBA:

object.ShowProxyDialogBox
object

Type: PreferencesOpenSave

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Displays a warning.
  • False: Does not display a warning.

Remarks

The initial value of this property is True.

NoteThe value of this property is stored in the PROXYNOTICE system variable.

Examples

VBA:

Sub Example_ShowProxyDialogBox()
    ' This example returns the current setting of
    ' ShowProxyDialogBox. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currShowProxyDialogBox As Boolean

    Set preferences = ThisDrawing.Application.Preferences

    ' Retrieve the current ShowProxyDialogBox value
    currShowProxyDialogBox = preferences.OpenSave.ShowProxyDialogBox
    MsgBox "The current value for ShowProxyDialogBox is " & preferences.OpenSave.ShowProxyDialogBox, vbInformation, "ShowProxyDialogBox Example"

    ' Change the value for ShowProxyDialogBox
    preferences.OpenSave.ShowProxyDialogBox = Not (currShowProxyDialogBox)
    MsgBox "The new value for ShowProxyDialogBox is " & preferences.OpenSave.ShowProxyDialogBox, vbInformation, "ShowProxyDialogBox Example"

    ' Reset ShowProxyDialogBox to its original value
    preferences.OpenSave.ShowProxyDialogBox = currShowProxyDialogBox
    MsgBox "The ShowProxyDialogBox value is reset to " & preferences.OpenSave.ShowProxyDialogBox, vbInformation, "ShowProxyDialogBox Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ShowProxyDialogBox()
    ;; This example returns the current setting of
    ;; ShowProxyDialogBox. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current ShowProxyDialogBox value
    (setq currShowProxyDialogBox (vla-get-ShowProxyDialogBox (vla-get-OpenSave preferences)))
    (alert (strcat "The current value for ShowProxyDialogBox is " (if (= currShowProxyDialogBox :vlax-true) "True" "False")))

    ;; Change the value for ShowProxyDialogBox
    (vla-put-ShowProxyDialogBox (vla-get-OpenSave preferences) (if (= currShowProxyDialogBox :vlax-true) :vlax-false :vlax-true))
    (alert (strcat "The new value for ShowProxyDialogBox is " (if (= (vla-get-ShowProxyDialogBox (vla-get-OpenSave preferences)) :vlax-true) "True" "False")))

    ;; Reset ShowProxyDialogBox to its original value
    (vla-put-ShowProxyDialogBox (vla-get-OpenSave preferences) currShowProxyDialogBox)
    (alert (strcat "The ShowProxyDialogBox value is reset to " (if (= (vla-get-ShowProxyDialogBox (vla-get-OpenSave preferences)) :vlax-true) "True" "False")))
)


ShowRasterImage Property (ActiveX)

Controls the display of raster images during real-time pan and zooms.

Supported platforms: Windows only

Signature

VBA:

object.ShowRasterImage
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Display raster image content during pans and zooms.
  • False: Display raster image outlines during pans and zooms.

Remarks

The initial value for this property is False.

If dragging display is turned on, and you enable ShowRasterImage, a copy of the image moves with the cursor as you reposition the original image.

NoteThis value of this property is stored in the RTDISPLAY system variable.

Examples

VBA:

Sub Example_ShowRasterImage()
    ' This example returns the current setting of
    ' ShowRasterImage. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currShowRasterImage As Boolean

    Set preferences = ThisDrawing.Application.Preferences

    ' Retrieve the current ShowRasterImage value
    currShowRasterImage = preferences.DISPLAY.ShowRasterImage
    MsgBox "The current value for ShowRasterImage is " & preferences.DISPLAY.ShowRasterImage, vbInformation, "ShowRasterImage Example"

    ' Change the value for ShowRasterImage
    preferences.DISPLAY.ShowRasterImage = Not (currShowRasterImage)
    MsgBox "The new value for ShowRasterImage is " & preferences.DISPLAY.ShowRasterImage, vbInformation, "ShowRasterImage Example"

    ' Reset ShowRasterImage to its original value
    preferences.DISPLAY.ShowRasterImage = currShowRasterImage
    MsgBox "The ShowRasterImage value is reset to " & preferences.DISPLAY.ShowRasterImage, vbInformation, "ShowRasterImage Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ShowRasterImage()
    ;; This example returns the current setting of
    ;; ShowRasterImage. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current ShowRasterImage value
    (setq currShowRasterImage (vla-get-ShowRasterImage (vla-get-Display preferences)))
    (alert (strcat "The current value for ShowRasterImage is " (if (= currShowRasterImage :vlax-true) "True" "False")))

    ;; Change the value for ShowRasterImage
    (vla-put-ShowRasterImage (vla-get-Display preferences) (if (= currShowRasterImage :vlax-true) :vlax-false :vlax-true))
    (alert (strcat "The new value for ShowRasterImage is " (if (= (vla-get-ShowRasterImage (vla-get-Display preferences)) :vlax-true) "True" "False")))

    ;; Reset ShowRasterImage to its original value
    (vla-put-ShowRasterImage (vla-get-Display preferences) currShowRasterImage)
    (alert (strcat "The ShowRasterImage value is reset to " (if (= (vla-get-ShowRasterImage (vla-get-Display preferences)) :vlax-true) "True" "False")))
)


ShowRotation Property (ActiveX)

Determines if a raster image is displayed at its rotation value.

Supported platforms: Windows only

Signature

VBA:

object.ShowRotation
object

Type: GeomapImage, RasterImage, Wipeout

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Display the raster image at the rotation value stored in the Rotation property.
  • False: Do not display the raster image at the rotation value stored in the Rotation property.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ShowRotation()
    ' This example adds a raster image in model space and rotates the image.
    ' One rotation is done without angle limits, one is done with ShowRotation,
    ' which limits rotations to 90 degrees

    ' This example uses the "downtown.jpg" found in the sample
    ' directory. If you do not have this image, or it is located
    ' in a different directory, insert a valid path and file name
    ' for the imageName variable below.

    Dim insertionPoint(0 To 2) As Double
    Dim scalefactor As Double, rotationAngle As Double
    Dim imageName As String
    Dim rasterObj As AcadRasterImage

    imageName = "c:\Autocad\sample\downtown.jpg"

    ' Define Raster object
    insertionPoint(0) = 5: insertionPoint(1) = 5: insertionPoint(2) = 0
    scalefactor = 1#: rotationAngle = 0

    On Error GoTo ERRORTRAP

    ' Loads a raster image into model space
    Set rasterObj = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotationAngle)

    ' Limit the raster image rotations to 90 degrees
    rasterObj.ShowRotation = True

    ' Rotate the raster image 180 degrees
    rasterObj.Rotate insertionPoint, 180
    ThisDrawing.Application.ZoomAll

    Exit Sub

    ' If you get an error (most likely a problem with the file path),
    ' then display an error message
ERRORTRAP:
    If Err.Description <> "" Then
        MsgBox Err.Description
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ShowRotation()
    ;; This example adds a raster image in model space and rotates the image.
    ;; One rotation is done without angle limits, one is done with ShowRotation,
    ;; which limits rotations to 90 degrees
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; This example uses the "2d Projected Polylines.jpg" found in the sample
    ;; directory. If you do not have this image, or it is located
    ;; in a different directory, insert a valid path and file name
    ;; for the imageName variable below.

    ;; Define Raster object
    (setq insertionPoint (vlax-3d-point 5 5 0)
          imageName ".\\Sample\\VBA\\2d Projected Polylines.jpg"
          scalefactor 1
          rotationAngle 0)

    ;; Loads a raster image into model space
    (if (/= (findfile imageName) nil)
        (progn
            (setq modelSpace (vla-get-ModelSpace doc))
            (setq rasterObj (vla-AddRaster modelSpace (findfile imageName) insertionPoint scalefactor rotationAngle))

            ;; Limit the raster image rotations to 90 degrees
            (vla-put-ShowRotation rasterObj :vlax-true)

            ;; Rotate the raster image 180 degrees
            (vla-Rotate rasterObj insertionPoint 180)
            (vla-ZoomExtents acadObj)
        )
        (alert (strcat imageName " could not be found."))
    )
)


ShowWarningMessages Property (ActiveX)

Resets all dialog boxes that have the "Don't Display This Warning Again" check box so they display again.

Supported platforms: Windows only

Signature

VBA:

object.ShowWarningMessages
object

Type: PreferencesSystem

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Resets the warning dialog boxes.
  • False: Does not reset the warning dialog boxes.

Remarks

The initial value for this property is False.

Examples

VBA:

Sub Example_ShowWarningMessages()
    ' This example reads and modifies the preference value that
    ' resets all dialog boxes that have the
    ' "Don't Display This Warning Again" check box so they display again.
    '
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesSystem
    Dim originalValue As Variant, newValue As Variant

    ' Get the system preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.System

    ' Read and display the original value
    originalValue = ACADPref.ShowWarningMessages
    MsgBox "The ShowWarningMessages preference is set to: " & originalValue

    ' Modify the ShowWarningMessages preference by toggling the value
    ACADPref.ShowWarningMessages = Not (ACADPref.ShowWarningMessages)
    newValue = ACADPref.ShowWarningMessages
    MsgBox "The ShowWarningMessages preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.ShowWarningMessages = originalValue
    MsgBox "The ShowWarningMessages preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ShowWarningMessages()
    ;; This example reads and modifies the preference value that
    ;; resets all dialog boxes that have the
    ;; "Don't Display This Warning Again" check box so they display again.
    ;;
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-ShowWarningMessages (vla-get-System preferences)))
    (alert (strcat "The ShowWarningMessages preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the ShowWarningMessages preference by toggling the value
    (vla-put-ShowWarningMessages (vla-get-System preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (alert (strcat "The ShowWarningMessages preference has been set to: " (if (= (vla-get-ShowWarningMessages (vla-get-System preferences)) :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-ShowWarningMessages (vla-get-System preferences) originalValue)
    (alert (strcat "The ShowWarningMessages preference was reset back to: " (if (= (vla-get-ShowWarningMessages (vla-get-System preferences)) :vlax-true) "True" "False")))
)


SingleDocumentMode Property (ActiveX)

Determines if AutoCAD runs in single- or multiple-document mode.

Supported platforms: Windows only

Signature

VBA:

object.SingleDocumentMode
object

Type: PreferencesSystem

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Single-drawing mode enabled.
  • False: Single-drawing mode disabled.

Remarks

The initial value for this property is False.

This property helps third-party developers update applications to work smoothly with the AutoCAD multiple-drawing mode. It may become obsolete in future releases of AutoCAD.

NoteThe value for this property is stored in the SDI system variable.

Examples

VBA:

Sub Example_SingleDocumentMode()
    ' This example reads and modifies the preference value that controls
    ' whether AutoCAD runs in single- or multiple-document mode.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesSystem
    Dim originalValue As Variant, newValue As Variant

    ' Get the system preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.System

    ' Read and display the original value
    originalValue = ACADPref.SingleDocumentMode
    MsgBox "The SingleDocumentMode preference is set to: " & originalValue

    ' Modify the SingleDocumentMode preference by toggling the value
    ACADPref.SingleDocumentMode = Not (ACADPref.SingleDocumentMode)
    newValue = ACADPref.SingleDocumentMode
    MsgBox "The SingleDocumentMode preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.SingleDocumentMode = originalValue
    MsgBox "The SingleDocumentMode preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SingleDocumentMode()
    ;; This example reads the preference value that lists
    ;; whether AutoCAD is running in single- or multiple-document mode.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read the current value
    (setq currValue (vla-get-SingleDocumentMode (vla-get-System preferences)))
    (alert (strcat "The SingleDocumentMode preference is set to: " (if (= currValue :vlax-true) "True" "False")))
)


Smoothness Property (ActiveX)

Specifies the level of smoothness for the SubD mesh.

Supported platforms: Windows only

Signature

VBA:

object.Smoothness
object

Type: SubDMesh

The objects this property applies to.

Property Value

Read-only: No

Type:Long

The level of smoothness of the SubD mesh.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SnapBasePoint Property (ActiveX)

Specifies the snap base point for the viewport.

Supported platforms: Windows only

Signature

VBA:

object.SnapBasePoint
object

Type: PViewport, Viewport

The objects this property applies to.

Property Value

Read-only: No

Type: Variant (two-element array of doubles)

A 2D WCS coordinate representing the snap base point for the viewport.

Remarks

You cannot change the snap base point for the active paper space viewport.

Changes to this property are not reflected in the display until a call to either the Update or Regen method is performed.

NoteThe value of this property is stored in the SNAPBASE system variable.

Examples

VBA:

Sub Example_SnapBasePoint()
    ' This example changes the snap base point for a
    ' model space and paper space viewport.

    ' Create a new model space viewport
    Dim viewportObj As AcadViewport
    Set viewportObj = ThisDrawing.Viewports.Add("NewViewport")

    ' Find the current snap base point
    Dim currSnapPnt As Variant
    currSnapPnt = viewportObj.SnapBasePoint
    MsgBox "The current model space snap base point is " & viewportObj.SnapBasePoint(0) & ", " & viewportObj.SnapBasePoint(1), , "SnapBasePoint Example"

    ' Change the snap base point
    Dim newSnapPnt(0 To 1) As Double
    newSnapPnt(0) = 5#: newSnapPnt(1) = 5#
    viewportObj.SnapBasePoint = newSnapPnt
    MsgBox "The new model space snap base point is " & viewportObj.SnapBasePoint(0) & ", " & viewportObj.SnapBasePoint(1), , "SnapBasePoint Example"

    ' Create a new paper space viewport
    Dim pviewportObj As AcadPViewport
    Dim center(0 To 2) As Double
    Dim width As Double
    Dim height As Double

    center(0) = 3: center(1) = 3: center(2) = 0
    width = 40
    height = 40
    ThisDrawing.ActiveSpace = acPaperSpace
    Set pviewportObj = ThisDrawing.PaperSpace.AddPViewport(center, width, height)

    ' Find the current snap base point
    currSnapPnt = pviewportObj.SnapBasePoint
    MsgBox "The current paper space snap base point is " & pviewportObj.SnapBasePoint(0) & ", " & pviewportObj.SnapBasePoint(1), , "SnapBasePoint Example"

    ' Change the snap base point
    newSnapPnt(0) = 2#: newSnapPnt(1) = 2#
    pviewportObj.SnapBasePoint = newSnapPnt
    MsgBox "The new paper space snap base point is " & pviewportObj.SnapBasePoint(0) & ", " & pviewportObj.SnapBasePoint(1), , "SnapBasePoint Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SnapBasePoint()
    ;; This example changes the snap base point for a
    ;; model space and paper space viewport.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create a new model space viewport
    (setq viewportObj (vla-Add (vla-get-Viewports doc) "NewViewport"))

    ;; Find the current snap base point
    (setq currSnapPnt (vlax-variant-value (vla-get-SnapBasePoint viewportObj)))
    (alert (strcat "The current model space snap base point is " (rtos (vlax-safearray-get-element currSnapPnt 0) 2) ", "
                                                                 (rtos (vlax-safearray-get-element currSnapPnt 1) 2)))

    ;; Change the snap base point
    (setq newSnapPnt (vlax-make-safearray vlax-vbDouble '(0 . 1)))
    (vlax-safearray-fill newSnapPnt '(5 5))
    (vla-put-SnapBasePoint viewportObj newSnapPnt)

    (alert (strcat "The new model space snap base point is " (rtos (vlax-safearray-get-element newSnapPnt 0) 2) ", "
                                                             (rtos (vlax-safearray-get-element newSnapPnt 1) 2)))

    ;; Create a new paper space viewport
    (setq center (vlax-3d-point 3 3 0)
          width 40
             height 40)

    (vla-put-ActiveSpace doc acPaperSpace)
    (setq paperSpace (vla-get-PaperSpace doc))
    (setq pviewportObj (vla-AddPViewport paperSpace center width height))

    ;; Find the current snap base point
    (setq currSnapPnt (vlax-variant-value (vla-get-SnapBasePoint pviewportObj)))
    (alert (strcat "The current paper space snap base point is " (rtos (vlax-safearray-get-element currSnapPnt 0) 2) ", "
                                                                 (rtos (vlax-safearray-get-element currSnapPnt 1) 2)))

    ;; Change the snap base point
    (setq newSnapPnt (vlax-make-safearray vlax-vbDouble '(0 . 1)))
    (vlax-safearray-fill newSnapPnt '(2 2))
    (vla-put-SnapBasePoint pviewportObj newSnapPnt)

    (alert (strcat "The new paper space snap base point is " (rtos (vlax-safearray-get-element newSnapPnt 0) 2) ", "
                                                             (rtos (vlax-safearray-get-element newSnapPnt 1) 2)))
)


SnapOn Property (ActiveX)

Specifies the status of snap.

Supported platforms: Windows only

Signature

VBA:

object.SnapOn
object

Type: PViewport, Viewport

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Snap is on.
  • False: Snap is off.

Remarks

SnapOn activates Snap mode using the current snap grid resolution, rotation, and style. To change the snap grid resolution, use the SetSnapSpacing method. To change the snap rotation, use the SnapRotationAngle property.

The snap grid is invisible. Use the GridOn property to display a separate visible grid.

AutoCAD ignores the Snap mode in perspective views.

NoteThe value of this property is stored in the SNAPMODE system variable. To change the snap style, use the SNAPSTYL system variable.

Examples

VBA:

Sub Example_SnapOn()
    ' This example toggles the setting of SnapOn.

    Dim viewportObj As AcadViewport

    ' Set the viewportObj variable to the activeviewport
    Set viewportObj = ThisDrawing.ActiveViewport

    ' Display the current setting of SnapOn
    MsgBox "Snap mode is: " & IIf(viewportObj.SnapOn, "On", "Off"), , "SnapOn Example"

    ' Toggle the setting of SnapOn
    viewportObj.SnapOn = Not (viewportObj.SnapOn)

    ' Reset the active viewport to see the change on the AutoCAD status bar
    ThisDrawing.ActiveViewport = viewportObj

    MsgBox "Snap mode is now: " & IIf(viewportObj.SnapOn, "On", "Off"), , "SnapOn Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SnapOn()
    ;; This example toggles the setting of SnapOn.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Set the viewportObj variable to the activeviewport
    (setq viewportObj (vla-get-ActiveViewport doc))

    ;; Display the current setting of SnapOn
    (alert (strcat "Snap mode is: " (if (= (vla-get-SnapOn viewportObj) :vlax-true) "On" "Off")))

    ;; Toggle the setting of SnapOn
    (vla-put-SnapOn viewportObj (if (= (vla-get-SnapOn viewportObj) :vlax-true) :vlax-false :vlax-true))

    ;; Reset the active viewport to see the change on the AutoCAD status bar
    (vla-put-ActiveViewport doc viewportObj)

    (alert (strcat "Snap mode is now: " (if (= (vla-get-SnapOn viewportObj) :vlax-true) "On" "Off")))
)


SnapRotationAngle Property (ActiveX)

Specifies the snap rotation angle of the viewport relative to the current UCS.

Supported platforms: Windows only

Signature

VBA:

object.SnapRotationAngle
object

Type: PViewport, Viewport

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The angle in radians. The valid range is 0 to 6.28.

Remarks

You cannot change the snap base point for the active paper space viewport.

Changes to this property are not reflected in the drawing until a call to either the Update or Regen method is performed.

NoteThe value of this property is stored in the SNAPANG system variable.

Examples

VBA:

Sub Example_SnapRotationAngle()
    ' This example changes the snap rotation angle for a
    ' model space and paper space viewport.

    ' Create a new model space viewport
    Dim viewportObj As AcadViewport
    Set viewportObj = ThisDrawing.Viewports.Add("NewViewport")

    ' Find the current snap rotation angle
    Dim currSnapAngle As Double
    currSnapAngle = viewportObj.SnapRotationAngle
    MsgBox "The current model space snap rotation angle is " & viewportObj.SnapRotationAngle, , "SnapRotationAngle Example"

    ' Change the snap rotation angle
    viewportObj.SnapRotationAngle = 1.5
    MsgBox "The new model space snap rotation angle is " & viewportObj.SnapRotationAngle, , "SnapRotationAngle Example"

    ' Create a new paper space viewport
    Dim pviewportObj As AcadPViewport
    Dim center(0 To 2) As Double
    Dim width As Double
    Dim height As Double

    center(0) = 3: center(1) = 3: center(2) = 0
    width = 40
    height = 40
    ThisDrawing.ActiveSpace = acPaperSpace
    Set pviewportObj = ThisDrawing.PaperSpace.AddPViewport(center, width, height)

    ' Find the current snap rotation angle
    currSnapAngle = pviewportObj.SnapRotationAngle
    MsgBox "The current paper space snap rotation angle is " & pviewportObj.SnapRotationAngle, , "SnapRotationAngle Example"

    ' Change the snap rotation angle
    pviewportObj.SnapRotationAngle = 1.5
    MsgBox "The new paper space snap base point is " & pviewportObj.SnapRotationAngle, , "SnapRotationAngle Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SnapRotationAngle()
    ;; This example changes the snap rotation angle for a
    ;; model space and paper space viewport.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create a new model space viewport
    (setq viewportObj (vla-Add (vla-get-Viewports doc) "NewViewport"))

    ;; Find the current snap rotation angle
    (setq currSnapAngle (vla-get-SnapRotationAngle viewportObj))
    (alert (strcat "The current model space snap rotation angle is " (rtos currSnapAngle 2)))

    ;; Change the snap rotation angle
    (vla-put-SnapRotationAngle viewportObj 1.5)
    (alert (strcat "The new model space snap rotation angle is " (rtos (vla-get-SnapRotationAngle viewportObj) 2)))

    ;; Create a new paper space viewport
    (setq center (vlax-3d-point 3 3 0)
          width 40
             height 40)

    (vla-put-ActiveSpace doc acPaperSpace)
    (setq paperSpace (vla-get-PaperSpace doc))
    (setq pviewportObj (vla-AddPViewport paperSpace center width height))

    ;; Find the current snap rotation angle
    (setq currSnapAngle (vla-get-SnapRotationAngle pviewportObj))
    (alert (strcat "The current paper space snap rotation angle is " (rtos currSnapAngle 2)))

    ;; Change the snap rotation angle
    (vla-put-SnapRotationAngle pviewportObj 1.5)
    (alert (strcat "The new paper space snap base point is " (rtos (vla-get-SnapRotationAngle pviewportObj) 2)))
)


SolidFill Property (ActiveX)

Specifies if multilines, traces, solids, all hatches (including solid-fill), and wide polylines are filled in.

Supported platforms: Windows only

Signature

VBA:

object.SolidFill
object

Type: DatabasePreferences

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Displays solid fills.
  • False: Does not display solid fills.

Remarks

The initial value of this property is True.

NoteThe value of this property is stored in the FILLMODE system variable.

Examples

VBA:

Sub Example_SolidFill()
    ' This example reads and modifies the preference value that controls
    ' whether multilines, traces, solids, all hatches (including solid-fill)
    ' and wide polylines are filled in.
    '
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadDatabasePreferences
    Dim originalValue As Variant, newValue As Variant

    ' Get the user preferences object
    Set ACADPref = ThisDrawing.Preferences

    ' Read and display the original value
    originalValue = ACADPref.SolidFill
    MsgBox "The SolidFill preference is set to: " & originalValue

    ' Modify the SolidFill preference by toggling the value
    ACADPref.SolidFill = Not (ACADPref.SolidFill)
    newValue = ACADPref.SolidFill
    MsgBox "The SolidFill preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.SolidFill = originalValue
    MsgBox "The SolidFill preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SolidFill()
    ;; This example reads and modifies the preference value that controls
    ;; whether multilines, traces, solids, all hatches (including solid-fill)
    ;; and wide polylines are filled in.
    ;;
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences doc))

    ;; Read and display the original value
    (setq originalValue (vla-get-SolidFill preferences))
    (alert (strcat "The SolidFill preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the SolidFill preference by toggling the value
    (vla-put-SolidFill preferences (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (setq newValue (vla-get-SolidFill preferences))
    (alert (strcat "The SolidFill preference has been set to: " (if (= newValue :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-SolidFill preferences originalValue)
    (alert (strcat "The SolidFill preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


SolidType Property (ActiveX)

Indicates the type of solid.

Supported platforms: Windows only

Signature

VBA:

object.SolidType
object

Type: 3DSolid

The object to which this property applies.

Property Value

Read-only: Yes / No

Type: String

The type of solid.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SourceObjects Property (ActiveX)

Specifies the source objects for section generation.

Supported platforms: Windows only

Signature

VBA:

object.SourceObjects
object

Type: SectionTypeSettings

The object to which this property applies.

Property Value

Read-only: No

Type: Variant

The source objects for section generation.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SplineFrame Property (ActiveX)

Specifies the display of the control vertices (CVs) for a spline.

Supported platforms: Windows only

Signature

VBA:

object.SplineFrame
object

Type: Spline

The object this property applies to.

Property Value

Read-only: No

Type: AcSplineFrameType enum

  • acHide
  • acShow

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SplineMethod Property (ActiveX)

Specifies the type of the spline.

Supported platforms: Windows only

Signature

VBA:

object.SplineMethod
object

Type: Spline

The object this property applies to.

Property Value

Read-only: No

Type: AcSplineMethodType enum

  • acFit
  • acControlVertices

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


StandardScale Property (ActiveX)

Specifies the standard scale for the layout, viewport, or plot configuration.

Supported platforms: Windows only

Signature

VBA:

object.StandardScale
object

Type: Layout, PlotConfiguration, PViewport

The object this property applies to.

Property Value

Read-only: No

Type: acPlotScale enum; Layout and PlotConfiguration objects, acViewportScale enum; PViewport objects

acPlotScale enum

  • acScaleToFit: Scale to Fit
  • ac1_128in_1ft: 1/128"= 1'
  • ac1_64in_1ft: 1/64"= 1'
  • ac1_32in_1ft: 1/32"= 1'
  • ac1_16in_1ft: 1/16"= 1'
  • ac3_32in_1ft: 3/32"= 1'
  • ac1_8in_1ft: 1/8" = 1'
  • ac3_16in_1ft: 3/16"= 1'
  • ac1_4in_1ft: 1/4" = 1'
  • ac3_8in_1ft: 3/8" = 1'
  • ac1_2in_1ft: 1/2" = 1'
  • ac3_4in_1ft: 3/4" = 1'
  • ac1in_1ft: 1"= 1'
  • ac3in_1ft: 3"= 1'
  • ac6in_1ft: 6"= 1'
  • ac1ft_1ft: 1'= 1'
  • ac1_1: 1:1
  • ac1_2: 1:2
  • ac1_4: 1:4
  • ac1_8: 1:8
  • ac1_10: 1:10
  • ac1_16: 1:16
  • ac1_20: 1:20
  • ac1_30: 1:30
  • ac1_40: 1:40
  • ac1_50: 1:50
  • ac1_100: 1:100
  • ac2_1: 2:1
  • ac4_1: 4:1
  • ac8_1: 8:1
  • ac10_1: 10:1
  • ac100_1: 100:1

acViewportScale enum

  • acVpScaleToFit: Scale to fit
  • acVpCustomScale: Custom
  • acVp1_128in_1ft: 1/128"= 1'
  • acVp1_64in_1ft: 1/64"= 1'
  • acVp1_32in_1ft: 1/32"= 1'
  • acVp1_16in_1ft: 1/16"= 1'
  • acVp3_32in_1ft: 3/32"= 1'
  • acVp1_8in_1ft: 1/8" = 1'
  • acVp3_16in_1ft: 3/16"= 1'
  • acVp1_4in_1ft: 1/4" = 1'
  • acVp3_8in_1ft: 3/8" = 1'
  • acVp1_2in_1ft: 1/2" = 1'
  • acVp3_4in_1ft: 3/4" = 1'
  • acVp1and1_2in_1ft: 1-1/2"= 1'
  • acVp3in_1ft: 3"= 1'
  • acVp6in_1ft: 6"= 1'
  • acVp1ft_1ft: 1'= 1'
  • acVp1_1: 1:1
  • acVp1_2: 1:2
  • acVp1_4: 1:4
  • acVp1_8: 1:8
  • acVp1_10: 1:10
  • acVp1_16: 1:16
  • acVp1_20: 1:20
  • acVp1_30: 1:30
  • acVp1_40: 1:40
  • acVp1_50: 1:50
  • acVp1_100: 1:100
  • acVp2_1: 2:1
  • acVp4_1: 4:1
  • acVp8_1: 8:1
  • acVp10_1: 10:1
  • acVp100_1: 100:1

Remarks

To set the viewport to a custom scale, set this property to acVpCustomScale and then use the CustomScale property to define the custom scale value.

Changes to this property will not be visible until after a regeneration of the drawing. Use the Regen method to regenerate the drawing.

Examples

VBA:

Sub Example_StandardScale()
    ' This example will access the active layout for the current drawing
    ' and list the standard scale for that Layout.
    ' It then changes the standard scale for the layout, and finally
    ' resets the scale back to its original value.

    Dim Layout As ACADLayout
    Dim currScale As Integer

    ' Get the activeLayout
    Set Layout = ThisDrawing.ActiveLayout

    ' Find the current standard scale
    currScale = Layout.StandardScale
    MsgBox "The current standard scale is : " & Layout.StandardScale

    ' Change the standard scale to 100:1
    Layout.StandardScale = ac100_1
    MsgBox "The new standard scale is : " & Layout.StandardScale

    ' Reset the original standard scale
    Layout.StandardScale = currScale
    MsgBox "The new standard scale is : " & Layout.StandardScale

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_StandardScale()
    ;; This example will access the active layout for the current drawing
    ;; and list the standard scale for that Layout.
    ;; It then changes the standard scale for the layout, and finally
    ;; resets the scale back to its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get the activeLayout
    (setq Layout (vla-get-ActiveLayout doc))

    ;; Find the current standard scale
    (setq currScale (vla-get-StandardScale Layout))
    (alert (strcat "The current standard scale is : " (itoa currScale)))

    ;; Change the standard scale to 100:1
    (vla-put-StandardScale Layout ac100_1)
    (alert (strcat "The new standard scale is : " (itoa (vla-get-StandardScale Layout))))

    ;; Reset the original standard scale
    (vla-put-StandardScale Layout currScale)
    (alert (strcat "The new standard scale is : " (itoa (vla-get-StandardScale Layout))))
)


StandardScale2 Property (ActiveX)

Specifies a standard scale for the viewport.

Supported platforms: Windows only

Signature

VBA:

object.StandardScale2
object

Type: PViewport

The object this property applies to.

Property Value

Read-only: No

Type: Long

A standard scale value of the viewport.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_StandardScale()
    ' This example will access the active layout for the current drawing
    ' and list the standard scale for that Layout.
    ' It then changes the standard scale for the layout, and finally
    ' resets the scale back to its original value.

    Dim Layout As ACADLayout
    Dim currScale As Integer

    ' Get the activeLayout
    Set Layout = ThisDrawing.ActiveLayout

    ' Find the current standard scale
    currScale = Layout.StandardScale
    MsgBox "The current standard scale is : " & Layout.StandardScale

    ' Change the standard scale to 100:1
    Layout.StandardScale = ac100_1
    MsgBox "The new standard scale is : " & Layout.StandardScale

    ' Reset the original standard scale
    Layout.StandardScale = currScale
    MsgBox "The new standard scale is : " & Layout.StandardScale

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_StandardScale()
    ;; This example will access the active layout for the current drawing
    ;; and list the standard scale for that Layout.
    ;; It then changes the standard scale for the layout, and finally
    ;; resets the scale back to its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get the activeLayout
    (setq Layout (vla-get-ActiveLayout doc))

    ;; Find the current standard scale
    (setq currScale (vla-get-StandardScale Layout))
    (alert (strcat "The current standard scale is : " (itoa currScale)))

    ;; Change the standard scale to 100:1
    (vla-put-StandardScale Layout ac100_1)
    (alert (strcat "The new standard scale is : " (itoa (vla-get-StandardScale Layout))))

    ;; Reset the original standard scale
    (vla-put-StandardScale Layout currScale)
    (alert (strcat "The new standard scale is : " (itoa (vla-get-StandardScale Layout))))
)


StartAngle Property (ActiveX)

Specifies the start angle of an arc or an ellipse.

Supported platforms: Windows only

Signature

VBA:

object.StartAngle
object

Type: Arc, Ellipse

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The start angle in radians.

Remarks

Examples

VBA:

Sub Example_StartAngle()
    ' This example creates an ellipse and enters the start and
    ' end angles to create an elliptical arc.
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double

    ' Create an ellipse in model space
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    'Enter a start angle of 45 degrees, and an end angle of 270 degrees
    ellObj.startAngle = 45 * (3.14 / 180)
    ellObj.endAngle = 270 * (3.14 / 180)
    ZoomAll
    MsgBox "The ellipse has a start angle of " & ellObj.startAngle * (180 / 3.14) & " and the end angle of " & ellObj.endAngle * (180 / 3.14) & " degrees.", vbInformation, "StartAngle Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_StartAngle()
    ;; This example creates an ellipse and enters the start and
    ;; end angles to create an elliptical arc.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create an ellipse in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

    ;; Enter a start angle of 45 degrees, and an end angle of 270 degrees
    (vla-put-StartAngle ellObj (* 45 (/ 3.14 180)))
    (vla-put-EndAngle ellObj (* 270 (/ 3.14 180)))
    (vla-ZoomAll acadObj)
    (alert (strcat "This ellipse has a start angle of " (rtos (* (vla-get-StartAngle ellObj) (/ 180 3.14)) 2) " and the end angle of " (rtos (* (vla-get-EndAngle ellObj) (/ 180 3.14)) 2) " degrees."))
)


StartDraftAngle Property (ActiveX)

Specifies the draft angle of the surface for the first cross section.

Supported platforms: Windows only

Signature

VBA:

object.StartDraftAngle
object

Type: LoftedSurface

The object to which this property applies.

Property Value

Read-only: No

Type: Long

The draft angle of the first cross section.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


StartDraftMagnitude Property (ActiveX)

Specifies the draft magnitude of the surface for the first cross section.

Supported platforms: Windows only

Signature

VBA:

object.StartDraftMagnitude
object

Type: LoftedSurface

The object to which this property applies.

Property Value

Read-only: No

Type: Long

The draft magnitude of the first cross section.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


StartParameter Property (ActiveX)

Specifies the start parameter for an ellipse.

Supported platforms: Windows only

Signature

VBA:

object.StartParameter
object

Type: Ellipse

The object this property applies to.

Property Value

Read-only: No

Type: Double

The valid range is 0 to 2*PI.

Remarks

The start and end parameters of the ellipse are calculated based on the following equation:

P(Theta) = A * cos(Theta) + B * sin(Theta)

where A and B are the semimajor and -minor axes respectively.

For example, if your start angle is Theta1, the corresponding start parameter is P(Theta1) calculated based on the above formula. Similarly, if your end angle is Theta2, the corresponding end parameter is P(Theta2) calculated based on the above formula.

You can use either angle or parameter to create the ellipse.

Examples

VBA:

Sub Example_StartParameter()
    ' This example creates an ellipse and enters the start and
    ' end parameters to create an elliptical arc.
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double

    ' Create an ellipse in model space
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    ' Enter a start parameter of 1.57, and an end parameter of 6.28
    ellObj.StartParameter = 1.57
    ellObj.EndParameter = 6.28
    ZoomAll

    ' Find the start and end parameters for the ellipse
    MsgBox "The ellipse has a start parameter of " & ellObj.StartParameter & " and an end parameter of " & ellObj.EndParameter, vbInformation, "StartParameter Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_StartParameter()
    ;; This example creates an ellipse and enters the start and
    ;; end parameters to create an elliptical arc.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create an ellipse in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

    ;; Enter a start parameter of 1.57, and an end parameter of 6.28
    (vla-put-StartParameter ellObj 1.57)
    (vla-put-EndParameter ellObj 6.28)
    (vla-ZoomAll acadObj)

    ;; Find the start and end parameters for the ellipse
    (alert (strcat "The ellipse has a start parameter of " (rtos (vla-get-StartParameter ellObj) 2) " and an end parameter of " (rtos (vla-get-EndParameter ellObj) 2)))
)


StartPoint Property (ActiveX)

Specifies the start point for the arc, line, or ellipse.

Supported platforms: Windows only

Signature

VBA:

object.StartPoint
object

Type: Arc, Ellipse, Line

The objects this property applies to.

Property Value

Read-only: Yes, except the Line object which is read-write

Type: Variant (three-element array of doubles)

A 3D coordinate representing the start point of the object.

Remarks

The start point for an arc, ellipse, and line

You cannot change the start point of an arc or ellipse. To edit an arc, use the EndAngle and Radius properties. To edit an ellipse, use the EndAngle, MajorAxis, and RadiusRatio properties.

Examples

VBA:

Sub Example_StartPoint()
    ' This example creates an elliptical arc and then
    ' finds the coordinates of its start point and endpoint.
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    Dim startPoint As Variant
    Dim endPoint As Variant

    ' Create an ellipse in model space
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    ' Enter a start angle of 45 degrees, and an end angle of 270 degrees
    ellObj.startAngle = 45 * (3.14 / 180)
    ellObj.endAngle = 270 * (3.14 / 180)
    ZoomAll

    ' Find the start and endpoints for the ellipse
    startPoint = ellObj.startPoint
    endPoint = ellObj.endPoint
    MsgBox "This ellipse has a start point of " & _
           startPoint(0) & ", " & startPoint(1) & ", " & _
           startPoint(2) & " and an endpoint of " & _
           endPoint(0) & ", " & endPoint(1) & ", " & _
           endPoint(2), vbInformation, "StartPoint Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_StartPoint()
    ;; This example creates an elliptical arc and then
    ;; finds the coordinates of its start and end points.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create an ellipse in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

    ;; Enter a start angle of 45 degrees, and an end angle of 270 degrees
    (vla-put-StartAngle ellObj (* 45 (/ 3.14 180)))
    (vla-put-EndAngle ellObj (* 270 (/ 3.14 180)))
    (vla-ZoomAll acadObj)

    ;; Find the start and endpoints for the ellipse
    (setq startPoint (vlax-safearray->list (vlax-variant-value (vla-get-StartPoint ellObj))))
    (setq endPoint (vlax-safearray->list (vlax-variant-value (vla-get-EndPoint ellObj))))
    (alert (strcat "This ellipse has a start point of " (rtos (nth 0 startPoint) 2) ", "
                                                (rtos (nth 1 startPoint) 2) ", "
                                                (rtos (nth 2 startPoint) 2) " and an endpoint of "
                                                (rtos (nth 0 endPoint) 2) ", "
                                                (rtos (nth 1 endPoint) 2) ", "
                                                (rtos (nth 2 endPoint) 2)))
)


StartSmoothContinuity Property (ActiveX)

Specifies the tangency and curvature of the first cross section.

Supported platforms: Windows only

Signature

VBA:

object.StartSmoothContinuity
object

Type: LoftedSurface

The object to which this property applies.

Property Value

Read-only: No

Type: Long

The tangency and curvature of the first cross section.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


StartSmoothMagnitude Property (ActiveX)

Specifies the size of the curve of the first cross section.

Supported platforms: Windows only

Signature

VBA:

object.StartSmoothMagnitude
object

Type: LoftedSurface

The object to which this property applies.

Property Value

Read-only: No

Type: Double

The size of the curve of the first cross section.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


State Property (ActiveX)

Specifies section object type.

Supported platforms: Windows only

Signature

VBA:

object.State
object

Type: Section

The object to which this property applies.

Property Value

Read-only: No

Type: AcSectionState enum

  • acSectionStateBoundary
  • acSectionStatePlane
  • acSectionStateVolume

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


StatusID Property (ActiveX)

Gets the current active status of the viewport.

Supported platforms: Windows only

Signature

VBA:

object.StatusID(VportObj)
object

Type: Application

The object this property applies to.

VportObj

Type: Viewport

The viewport to query the status of.

Property Value

Read-only: Yes

Type: Boolean

  • True: The specified viewport is the current active viewport.
  • False: The specified viewport is not the current active viewport.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_StatusID()
    ' This example displays the setting of StatusID.

    Dim currStatusID As Boolean

    ' Display the current setting of statusID
    currStatusID = ThisDrawing.Application.statusID(ThisDrawing.ActiveViewport)
    MsgBox "The statusID of the active viewport is: " & currStatusID, , "StatusID Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_StatusID()
    ;; This example displays the setting of StatusID.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Display the current setting of statusID
    (setq currStatusID (vla-get-statusID acadObj (vla-get-ActiveViewport doc)))
    (alert (strcat "The statusID of the active viewport is: " (if (= currStatusID :vlax-true) "True" "False")))
)


StoreSQLIndex Property (ActiveX)

Determines if the SQL index is stored in the drawing.

Supported platforms: Windows only

Signature

VBA:

object.StoreSQLIndex
object

Type: PreferencesSystem

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Stores the SQL index in the drawing.
  • False: Does not store the SQL index in the drawing.

Remarks

The initial value for this property is True.

Examples

VBA:

Sub Example_StoreSQLIndex()
    ' This example reads and modifies the preference value that controls
    ' whether the SQL index is stored in the drawing.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesSystem
    Dim originalValue As Variant, newValue As Variant

    ' Get the system preferences object
    Set ACADPref = ThisDrawing.Application.preferences.System

    ' Read and display the original value
    originalValue = ACADPref.StoreSQLIndex
    MsgBox "The StoreSQLIndex preference is set to: " & originalValue

    ' Modify the StoreSQLIndex preference by toggling the value
    ACADPref.StoreSQLIndex = Not (ACADPref.StoreSQLIndex)
    newValue = ACADPref.StoreSQLIndex
    MsgBox "The StoreSQLIndex preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.StoreSQLIndex = originalValue
    MsgBox "The StoreSQLIndex preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_StoreSQLIndex()
    ;; This example reads and modifies the preference value that controls
    ;; whether the SQL index is stored in the drawing.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-StoreSQLIndex (vla-get-System preferences)))
    (alert (strcat "The StoreSQLIndex preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the StoreSQLIndex preference by toggling the value
    (vla-put-StoreSQLIndex (vla-get-System preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (alert (strcat "The StoreSQLIndex preference has been set to: " (if (= (vla-get-StoreSQLIndex (vla-get-System preferences)) :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-StoreSQLIndex (vla-get-System preferences) originalValue)
    (alert (strcat "The StoreSQLIndex preference was reset back to: " (if (= (vla-get-StoreSQLIndex (vla-get-System preferences)) :vlax-true) "True" "False")))
)


StyleName Property (ActiveX)

Specifies the name of the style used with the object.

Supported platforms: Windows only

Signature

VBA:

object.StyleName
object

Type: Attribute, AttributeReference, Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated, Leader, MLeader, MLine, MText, Table, Text, Tolerance

The objects this property applies to.

Property Value

Read-only: No; except MLine objects which are read-only

Type: String

The default equals the current style.

Remarks

Use the TextStyle object to change the attributes of a given text style. Use the DimStyle object to change the attributes of a given dimension style.

The name given must already be defined in the drawing.

NoteFor dimensions, the value of this property is stored in the DIMSTYLE system variable.

Examples

VBA:

Sub Example_StyleName()
    ' This example creates an aligned dimension and then changes the
    ' StyleName property for that dimension.

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim currStyleName As String

    ' Define the dimension
    point1(0) = 5#: point1(1) = 3#: point1(2) = 0#
    point2(0) = 10#: point2(1) = 3#: point2(2) = 0#
    location(0) = 7.5: location(1) = 5#: location(2) = 0#

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ZoomAll
    currStyleName = dimObj.styleName
    MsgBox "The initial StyleName for the dimension is " & dimObj.styleName, vbInformation, "TextString Example"

    ' Create a new dimension style
    ThisDrawing.DimStyles.Add ("NewDimensionStyle")

    ' Change the text string for the dimension
    dimObj.styleName = "NewDimensionStyle"
    dimObj.Update
    MsgBox "The new StyleName for the dimension is " & dimObj.styleName, vbInformation, "TextString Example"

    ' Reset the text string for the dimension
    dimObj.styleName = currStyleName
    dimObj.Update
    MsgBox "The StyleName for the dimension has been reset to " & dimObj.styleName, vbInformation, "TextString Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_StyleName()
    ;; This example creates an aligned dimension and then changes the
    ;; StyleName property for that dimension.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 3 0)
          point2 (vlax-3d-point 10 3 0)
          location (vlax-3d-point 7.5 5 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    (setq currStyleName (vla-get-StyleName dimObj))
    (alert (strcat "The initial StyleName for the dimension is " currStyleName))

    ;; Create a new dimension style
    (vla-Add (vla-get-DimStyles doc) "NewDimensionStyle")

    ;; Change the text string for the dimension
    (vla-put-StyleName dimObj "NewDimensionStyle")
    (vla-Update dimObj)
    (alert (strcat "The new StyleName for the dimension is " (vla-get-StyleName dimObj)))

    ;; Reset the text string for the dimension
    (vla-put-StyleName dimObj currStyleName)
    (vla-Update dimObj)
    (alert (strcat "The StyleName for the dimension has been reset to " (vla-get-StyleName dimObj)))
)


StyleSheet Property (ActiveX)

Specifies the style sheet for the layout or plot configuration.

Supported platforms: Windows only

Signature

VBA:

object.StyleSheet
object

Type: Layout, PlotConfiguration

The objects this property applies to.

Property Value

Read-only: No

Type: String

The name of the style sheet.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_StyleSheet()
    ' This example finds the name of the style sheet for the active layout

    Dim styleSheetName As String
    styleSheetName = ThisDrawing.ActiveLayout.StyleSheet

    If styleSheetName = "" Then
        MsgBox "There is no style sheet set for the active layout."
    Else
        MsgBox "The style sheet for the active layout is: " & styleSheetName
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_StyleSheet()
    ;; This example finds the name of the plot style for the active layout
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq styleSheetName (vla-get-StyleSheet (vla-get-ActiveLayout doc)))

    (if (= styleSheetName "")
        (alert "There is no style sheet set for the active layout.")
        (alert (strcat "The style sheet for the active layout is: " styleSheetName))
    )
)


Stylization Property (ActiveX)

Specifies color stylization for selected point cloud.

Supported platforms: Windows only

Signature

VBA:

object.Stylization
object

Type: PointCloud, PointCloudEx

The object this property applies to.

Property Value

Read-only: No

Type: AcPointCloudStylizationType enum; PointCloud objects or AcPointCloudExStylizationType enum; PointCloudEx objects

AcPointCloudStylizationType enum

  • acIntensity
  • acNormal
  • acObjectColor
  • acScanColor

AcPointCloudExStylizationType enum

  • acClassification
  • acElevation
  • acIntensities
  • acNormals
  • acObject
  • acRGB

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Subject Property (ActiveX)

Specifies the subject name of the digital ID (certificate) or drawing.

Supported platforms: Windows only

Signature

VBA:

object.Subject
object

Type: SecurityParams, SummaryInfo

The object this property applies to.

Property Value

Read-only: No

Type: String

The subject name of the digital certificate or drawing.

Remarks

SummaryInfo: You can use the subject name to group drawings that have the same subject.

Examples

VBA:

Sub Example_AddCustomInfoSubject()
    ' This example shows how to access drawing properties

    ' Add and display standard properties
    ThisDrawing.SummaryInfo.Author = "John Doe"
    ThisDrawing.SummaryInfo.Comments = "Includes all ten levels of Building Five"
    ThisDrawing.SummaryInfo.HyperlinkBase = "http://www.autodesk.com"
    ThisDrawing.SummaryInfo.Keywords = "Building Complex"
    ThisDrawing.SummaryInfo.LastSavedBy = "JD"
    ThisDrawing.SummaryInfo.RevisionNumber = "4"
    ThisDrawing.SummaryInfo.Subject = "Plan for Building Five"
    ThisDrawing.SummaryInfo.Title = "Building Five"

    Author = ThisDrawing.SummaryInfo.Author
    Comments = ThisDrawing.SummaryInfo.Comments
    HLB = ThisDrawing.SummaryInfo.HyperlinkBase
    KW = ThisDrawing.SummaryInfo.Keywords
    LSB = ThisDrawing.SummaryInfo.LastSavedBy
    RN = ThisDrawing.SummaryInfo.RevisionNumber
    Subject = ThisDrawing.SummaryInfo.Subject
    Title = ThisDrawing.SummaryInfo.Title
    MsgBox "The standard drawing properties are " & vbCrLf & _
           "Author = " & Author & vbCrLf & _
           "Comments = " & Comments & vbCrLf & _
           "HyperlinkBase = " & HLB & vbCrLf & _
           "Keywords = " & KW & vbCrLf & _
           "LastSavedBy = " & LSB & vbCrLf & _
           "RevisionNumber = " & RN & vbCrLf & _
           "Subject = " & Subject & vbCrLf & _
           "Title = " & Title & vbCrLf

    ' Add and display custom properties
    Dim Key0 As String
    Dim Value0 As String
    Dim Key1 As String
    Dim Value1 As String
    Dim CustomPropertyBranch As String
    Dim PropertyBranchValue As String
    Dim CustomPropertyZone As String
    Dim PropertyZoneValue As String

    CustomPropertyBranch = "Branch"
    PropertyBranchValue = "Main"
    CustomPropertyZone = "Zone"
    PropertyZoneValue = "Industrial"

    ' Add custom properties
    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 1) Then
        ThisDrawing.SummaryInfo.SetCustomByIndex 0, CustomPropertyBranch, PropertyBranchValue
    Else
        ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyBranch, PropertyBranchValue
    End If

    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 2) Then
         ThisDrawing.SummaryInfo.SetCustomByKey CustomPropertyBranch, "Satellite"
    Else
         ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyZone, PropertyZoneValue
    End If

    'Get custom properties
    ThisDrawing.SummaryInfo.GetCustomByIndex 0, Key0, Value0
    Key1 = CustomPropertyZone
    ThisDrawing.SummaryInfo.GetCustomByKey Key1, Value1

    MsgBox "The custom drawing properties are " & vbCrLf & _
           "First property name = " & Key0 & vbCrLf & _
           "First property value = " & Value0 & vbCrLf & _
           "Second property name = " & Key1 & vbCrLf & _
           "Second property value = " & Value1 & vbCrLf
End Sub

Sub Example_DigitalSignatureSubject()
    ' This example attaches a digital signature and accompanying data to a file,
    ' and saves the file.

    Dim sp As AcadSecurityParams
    Set sp = GetInterfaceObject("AutoCAD.SecurityParams.19")

    ' Attach a digital signature and timestamp it
    sp.Action = AcadSecurityParamsType.ACADSECURITYPARAMS_SIGN_DATA _
                + AcadSecurityParamsType.ACADSECURITYPARAMS_ADD_TIMESTAMP

    ' Certificate details follow
    sp.Subject = "Thawte Freemail Member"
    sp.Issuer = "Personal Freemail RSA 2000.8.30"
    sp.SerialNumber = "073848"
    sp.Comment = "This is now signed"
    sp.TimeServer = "NIST(time.nist.gov)"

    ThisDrawing.SaveAs "C:\MyDrawing.dwg", , sp
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_AddCustomInfoSubject()
    ;; This example shows how to access drawing properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq summaryInfo (vla-get-SummaryInfo doc))

    ;; Add and display standard properties
    (vla-put-Author summaryInfo "John Doe")
    (vla-put-Comments summaryInfo "Includes all ten levels of Building Five")
    (vla-put-HyperlinkBase summaryInfo "http://www.autodesk.com")
    (vla-put-Keywords summaryInfo "Building Complex")
    (vla-put-LastSavedBy summaryInfo "JD")
    (vla-put-RevisionNumber summaryInfo "4")
    (vla-put-Subject summaryInfo "Plan for Building Five")
    (vla-put-Title summaryInfo "Building Five")

    (setq author (vla-get-Author summaryInfo))
    (setq comments (vla-get-Comments summaryInfo))
    (setq HLB (vla-get-HyperlinkBase summaryInfo))
    (setq KW (vla-get-Keywords summaryInfo))
    (setq LSB (vla-get-LastSavedBy summaryInfo))
    (setq RN (vla-get-RevisionNumber summaryInfo))
    (setq subject (vla-get-Subject summaryInfo))
    (setq Title (vla-get-Title summaryInfo))
    (alert (strcat "The standard drawing properties are "
                   "\nAuthor = " author
                   "\nComments = " comments
                   "\nHyperlinkBase = " HLB
                   "\nKeywords = " KW
                   "\nLastSavedBy = " LSB
                   "\nRevisionNumber = " RN
                   "\nSubject = " Subject
                   "\nTitle = " Title
           )
    )

    ;; Add and display custom properties
    (setq CustomPropertyBranch "Branch")
    (setq PropertyBranchValue "Main")
    (setq CustomPropertyZone "Zone")
    (setq PropertyZoneValue "Industrial")

    ;; Add custom properties
    (if (>= (vla-NumCustomInfo summaryInfo) 1)
        (vla-SetCustomByIndex summaryInfo 0 CustomPropertyBranch PropertyBranchValue)
        (vla-AddCustomInfo summaryInfo CustomPropertyBranch PropertyBranchValue)
    )

    (if (>= (vla-NumCustomInfo summaryInfo) 2)
        (vla-SetCustomByKey summaryInfo CustomPropertyBranch "Satellite")
        (vla-AddCustomInfo summaryInfo CustomPropertyZone PropertyZoneValue)
    )

    ;; Get custom properties
    (vla-GetCustomByIndex summaryInfo 0 'Key0 'Value0)
    (setq Key1 CustomPropertyZone)
    (vla-GetCustomByKey summaryInfo Key1 'Value1)

    (alert (strcat "The custom drawing properties are "
                   "\nFirst property name = " Key0
                   "\nFirst property value = " Value0
                   "\nSecond property name = " Key1
                   "\nSecond property value = " Value1
           )
    )
)

(defun c:Example_DigitalSignatureSubject()
    ;; This example attaches a digital signature and accompanying data to a file,
    ;; and saves the file.
    (setq acadObj (vlax-get-acad-object))
    (setq sp (vlax-create-object "AutoCAD.SecurityParams.19"))

    (vla-put-Visible acadObj :vlax-true)

    ;; Attach a digital signature and timestamp it
    (vla-put-Action sp (+ ACADSECURITYPARAMS_SIGN_DATA ACADSECURITYPARAMS_ADD_TIMESTAMP))

    ;; Certificate details follow
    (vla-put-Subject sp "Thawte Freemail Member")
    (vla-put-Issuer sp "Personal Freemail RSA 2000.8.30")
    (vla-put-SerialNumber sp "073848")
    (vla-put-Comment sp "This is now signed")
    (vla-put-TimeServer sp "NIST(time.nist.gov)")

    (setq doc (vla-get-ActiveDocument acadObj))
    (vla-SaveAs doc "C:\\MyDrawing.dwg" acNative sp)

    (vlax-release-object sp)
)


SubMenu Property (ActiveX)

Gets the popup menu associated with a sub menu.

Supported platforms: Windows only

Signature

VBA:

object.SubMenu
object

Type: PopupMenuItem

The object this property applies to.

Property Value

Read-only: Yes

Type: PopupMenu

The popup menu associated with the sub menu.

Remarks

If the popup menu item is not a sub menu, this property returns an error.

Examples

VBA:

Sub Example_SubMenu()
    ' This example finds the menu used as the sub menu for the
    ' "Additional Resources" menu item in the Help menu.

    Dim acadMenuGroup As acadMenuGroup
    Set acadMenuGroup = ThisDrawing.Application.MenuGroups.Item("ACAD")

    Dim helpMenu As AcadPopupMenu
    Set helpMenu = acadMenuGroup.Menus.Item("&Help")

    Dim menuItem As AcadPopupMenuItem
    Set menuItem = helpMenu.Item(4)

    Dim subMenu As AcadPopupMenu
    Set subMenu = menuItem.subMenu

    MsgBox "The name of the submenu is " & subMenu.TagString
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SubMenu()
    ;; This example finds the menu used as the sub menu for the
    ;; "Additional Resources" menu item in the Help menu.
    (setq acadObj (vlax-get-acad-object))

    (setq acadMenuGroup (vla-Item (vla-get-MenuGroups acadObj) "ACAD"))

    (setq helpMenu (vla-Item (vla-get-Menus acadMenuGroup) "&Help"))

    (setq menuItem (vla-Item helpMenu 4))

    (setq subMenu (vla-get-SubMenu menuItem))

    (alert (strcat "The name of the submenu is " (vla-get-TagString subMenu)))
)


SubUnitsFactor Property (ActiveX)

Specifies the sub-units scale factor for dimension when unit changes to sub-unit.

Supported platforms: Windows only

Signature

VBA:

object.SubUnitsFactor
object

Type: DimAligned, DimArcLength, DimOrdinate, DimRotated

The object this property applies to.

Property Value

Read-only: No

Type: Double

The sub-units scale factor.

Remarks

The SubUnitsFactor property will only take affect when leading zeros are suppressed.

SubUnitsFactor affects all linear dimension types that allow a suffix. The sub-unit scale factor replaces the dimension scale factor when unit changes to sub-unit. When units are less than 1, the sub-units factor controls the location of the decimal separator.

Examples

VBA:

Not available

Visual LISP:

Not available


SubUnitsSuffix Property (ActiveX)

Specifies the sub-units suffix for dimensions when unit changes to sub-unit.

Supported platforms: Windows only

Signature

VBA:

object.SubUnitsSuffix
object

Type: DimAligned, DimArcLength, DimOrdinate, DimRotated

The object this property applies to.

Property Value

Read-only: No

Type: String

The sub-units suffix.

Remarks

The SubUnitsSuffix property will only take affect when leading zeros are suppressed.

SubUnitsSuffix affects all linear dimension types that allow a suffix. The sub-unit suffix replaces the dimension suffix when unit changes to sub-unit.

Examples

VBA:

Not available

Visual LISP:

Not available


SummaryInfo Property (ActiveX)

Specifies the properties of a drawing.

Supported platforms: Windows only

Signature

VBA:

object.SummaryInfo
object

Type: Database, Document

The object this property applies to.

Property Value

Read-only: Yes

Type: SummaryInfo

The SummaryInfo object of the drawing.

Remarks

This property is used to change the properties of a drawing.

Examples

VBA:

Sub Example_SummaryInfo()
    ' This example shows how to access drawing properties

    ' Add and display standard properties
    ThisDrawing.SummaryInfo.Author = "John Doe"
    ThisDrawing.SummaryInfo.Comments = "Includes all ten levels of Building Five"
    ThisDrawing.SummaryInfo.HyperlinkBase = "http://www.autodesk.com"
    ThisDrawing.SummaryInfo.Keywords = "Building Complex"
    ThisDrawing.SummaryInfo.LastSavedBy = "JD"
    ThisDrawing.SummaryInfo.RevisionNumber = "4"
    ThisDrawing.SummaryInfo.Subject = "Plan for Building Five"
    ThisDrawing.SummaryInfo.Title = "Building Five"

    Author = ThisDrawing.SummaryInfo.Author
    Comments = ThisDrawing.SummaryInfo.Comments
    HLB = ThisDrawing.SummaryInfo.HyperlinkBase
    KW = ThisDrawing.SummaryInfo.Keywords
    LSB = ThisDrawing.SummaryInfo.LastSavedBy
    RN = ThisDrawing.SummaryInfo.RevisionNumber
    Subject = ThisDrawing.SummaryInfo.Subject
    Title = ThisDrawing.SummaryInfo.Title
    MsgBox "The standard drawing properties are " & vbCrLf & _
           "Author = " & Author & vbCrLf & _
           "Comments = " & Comments & vbCrLf & _
           "HyperlinkBase = " & HLB & vbCrLf & _
           "Keywords = " & KW & vbCrLf & _
           "LastSavedBy = " & LSB & vbCrLf & _
           "RevisionNumber = " & RN & vbCrLf & _
           "Subject = " & Subject & vbCrLf & _
           "Title = " & Title & vbCrLf

    ' Add and display custom properties
    Dim Key0 As String
    Dim Value0 As String
    Dim Key1 As String
    Dim Value1 As String
    Dim CustomPropertyBranch As String
    Dim PropertyBranchValue As String
    Dim CustomPropertyZone As String
    Dim PropertyZoneValue As String

    CustomPropertyBranch = "Branch"
    PropertyBranchValue = "Main"
    CustomPropertyZone = "Zone"
    PropertyZoneValue = "Industrial"

    ' Add custom properties
    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 1) Then
        ThisDrawing.SummaryInfo.SetCustomByIndex 0, CustomPropertyBranch, PropertyBranchValue
    Else
        ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyBranch, PropertyBranchValue
    End If

    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 2) Then
         ThisDrawing.SummaryInfo.SetCustomByKey CustomPropertyBranch, "Satellite"
    Else
         ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyZone, PropertyZoneValue
    End If

    'Get custom properties
    ThisDrawing.SummaryInfo.GetCustomByIndex 0, Key0, Value0
    Key1 = CustomPropertyZone
    ThisDrawing.SummaryInfo.GetCustomByKey Key1, Value1

    MsgBox "The custom drawing properties are " & vbCrLf & _
           "First property name = " & Key0 & vbCrLf & _
           "First property value = " & Value0 & vbCrLf & _
           "Second property name = " & Key1 & vbCrLf & _
           "Second property value = " & Value1 & vbCrLf
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SummaryInfo()
    ;; This example shows how to access drawing properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq summaryInfo (vla-get-SummaryInfo doc))

    ;; Add and display standard properties
    (vla-put-Author summaryInfo "John Doe")
    (vla-put-Comments summaryInfo "Includes all ten levels of Building Five")
    (vla-put-HyperlinkBase summaryInfo "http://www.autodesk.com")
    (vla-put-Keywords summaryInfo "Building Complex")
    (vla-put-LastSavedBy summaryInfo "JD")
    (vla-put-RevisionNumber summaryInfo "4")
    (vla-put-Subject summaryInfo "Plan for Building Five")
    (vla-put-Title summaryInfo "Building Five")

    (setq author (vla-get-Author summaryInfo))
    (setq comments (vla-get-Comments summaryInfo))
    (setq HLB (vla-get-HyperlinkBase summaryInfo))
    (setq KW (vla-get-Keywords summaryInfo))
    (setq LSB (vla-get-LastSavedBy summaryInfo))
    (setq RN (vla-get-RevisionNumber summaryInfo))
    (setq subject (vla-get-Subject summaryInfo))
    (setq Title (vla-get-Title summaryInfo))
    (alert (strcat "The standard drawing properties are "
                   "\nAuthor = " author
                   "\nComments = " comments
                   "\nHyperlinkBase = " HLB
                   "\nKeywords = " KW
                   "\nLastSavedBy = " LSB
                   "\nRevisionNumber = " RN
                   "\nSubject = " Subject
                   "\nTitle = " Title
           )
    )

    ;; Add and display custom properties
    (setq CustomPropertyBranch "Branch")
    (setq PropertyBranchValue "Main")
    (setq CustomPropertyZone "Zone")
    (setq PropertyZoneValue "Industrial")

    ;; Add custom properties
    (if (>= (vla-NumCustomInfo summaryInfo) 1)
        (vla-SetCustomByIndex summaryInfo 0 CustomPropertyBranch PropertyBranchValue)
        (vla-AddCustomInfo summaryInfo CustomPropertyBranch PropertyBranchValue)
    )

    (if (>= (vla-NumCustomInfo summaryInfo) 2)
        (vla-SetCustomByKey summaryInfo CustomPropertyBranch "Satellite")
        (vla-AddCustomInfo summaryInfo CustomPropertyZone PropertyZoneValue)
    )

    ;; Get custom properties
    (vla-GetCustomByIndex summaryInfo 0 'Key0 'Value0)
    (setq Key1 CustomPropertyZone)
    (vla-GetCustomByKey summaryInfo Key1 'Value1)

    (alert (strcat "The custom drawing properties are "
                   "\nFirst property name = " Key0
                   "\nFirst property value = " Value0
                   "\nSecond property name = " Key1
                   "\nSecond property value = " Value1
           )
    )
)


SupportPath Property (ActiveX)

Specifies the directories where AutoCAD searches for support files.

Supported platforms: Windows only

Signature

VBA:

object.SupportPath
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The directories in which support files are located. Specify a drive letter and path for support, fonts, help, and bonus files.

Remarks

Use a semicolon (;) to separate multiple directories; however, do not end the string with a semicolon.

Examples

VBA:

Sub Example_SupportPath()
    ' This example returns the current setting of
    ' SupportPath. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currSupportPath As String
    Dim newSupportPath As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current SupportPath value
    currSupportPath = preferences.Files.SupportPath
    MsgBox "The current value for SupportPath is " & currSupportPath, vbInformation, "SupportPath Example"

    ' Change the value for SupportPath
    newSupportPath = "TestSupportPath"
    preferences.Files.SupportPath = newSupportPath
    MsgBox "The new value for SupportPath is " & newSupportPath, vbInformation, "SupportPath Example"

    ' Reset SupportPath to its original value
    preferences.Files.SupportPath = currSupportPath
    MsgBox "The SupportPath value is reset to " & currSupportPath, vbInformation, "SupportPath Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SupportPath()
    ;; This example returns the current setting of
    ;; SupportPath. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current SupportPath value
    (setq currSupportPath (vla-get-SupportPath (vla-get-Files preferences)))
    (alert (strcat "The current value for SupportPath is " currSupportPath))

    ;; Change the value for SupportPath
    (setq newSupportPath "TestSupportPath")
    (vla-put-SupportPath (vla-get-Files preferences) newSupportPath)
    (alert (strcat "The new value for SupportPath is " newSupportPath))

    ;; Reset SupportPath to its original value
    (vla-put-SupportPath (vla-get-Files preferences) currSupportPath)
    (alert (strcat "The SupportPath value is reset to " currSupportPath))
)


SuppressLeadingZeros Property (ActiveX)

Specifies the suppression of leading zeros in dimension values.

Supported platforms: Windows only

Signature

VBA:

object.SuppressLeadingZeros
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress leading zeros in decimal dimensions. For example, 0.5000 becomes .5000.
  • False: Do not suppress leading zeros in decimal dimensions.

Remarks

The initial value for this property is False.

NoteThis value overrides the value for the DIMZIN system variable.

Examples

VBA:

Sub Example_SuppressLeadingZeros()
   ' This example creates an aligned dimension in model space and
   ' uses the SuppressLeadingZeros property to toggle the display of leading zeros
   ' in the dimension display

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 5.01: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ThisDrawing.Application.ZoomAll

Toggle:
    Select Case MsgBox("Press OK to toggle the display of leading zeros in the dimension", vbOKCancel)
        Case vbOK
            ' Toggle the display of leading zeros for the dimension value
            dimObj.SuppressLeadingZeros = Not (dimObj.SuppressLeadingZeros)
            ThisDrawing.Regen acAllViewports

        Case vbCancel
            Exit Sub
    End Select

    GoTo Toggle
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SuppressLeadingZeros()
    ;; This example creates an aligned dimension in model space and
    ;; uses the SuppressLeadingZeros property to toggle the display of leading zeros
    ;; in the dimension display
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 5.01 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    ;; Toggle the display of leading zeros for the dimension value
    (vla-put-SuppressLeadingZeros dimObj (if (= (vla-get-SuppressLeadingZeros dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of leading zeros toggled.")

    ;; Toggle the display of leading zeros for the dimension value back to previous state
    (vla-put-SuppressLeadingZeros dimObj (if (= (vla-get-SuppressLeadingZeros dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of leading zeros toggled back.")
)


SuppressTrailingZeros Property (ActiveX)

Specifies the suppression of trailing zeros in dimension values.

Supported platforms: Windows only

Signature

VBA:

object.SuppressTrailingZeros
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress trailing zeros in decimal dimensions. For example, 12.5000 becomes 12.5.
  • False: Do not suppress trailing zeros in decimal dimensions.

Remarks

The initial value for this property is False.

NoteThis value overrides the value for the DIMZIN system variable.

Examples

VBA:

Sub Example_SuppressTrailingZeros()
   ' This example creates an aligned dimension in model space and
   ' uses the SuppressTrailingZeros property to toggle the display of trailing zeros
   ' in the dimension display

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 7: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ThisDrawing.Application.ZoomAll

Toggle:
    Select Case MsgBox("Press OK to toggle the display of trailing zeros in the dimension", vbOKCancel)
        Case vbOK
            ' Toggle the display of trailing zeros for the dimension value
            dimObj.SuppressTrailingZeros = Not (dimObj.SuppressTrailingZeros)
            ThisDrawing.Regen acAllViewports

        Case vbCancel
            Exit Sub
    End Select

    GoTo Toggle
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SuppressTrailingZeros()
    ;; This example creates an aligned dimension in model space and
    ;; uses the SuppressTrailingZeros property to toggle the display of trailing zeros
    ;; in the dimension display
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 7 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    ;; Toggle the display of trailing zeros for the dimension value
    (vla-put-SuppressTrailingZeros dimObj (if (= (vla-get-SuppressTrailingZeros dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of trailing zeros toggled.")

    ;; Toggle the display of trailing zeros for the dimension value back to previous state
    (vla-put-SuppressTrailingZeros dimObj (if (= (vla-get-SuppressTrailingZeros dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of trailing zeros toggled back.")
)


SuppressZeroFeet Property (ActiveX)

Specifies the suppression of a zero foot measurement in dimension values.

Supported platforms: Windows only

Signature

VBA:

object.SuppressZeroFeet
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress the display of a zero foot measurement.
  • False: Do not suppress the display of a zero foot measurement.

Remarks

The initial value for this property is False.

NoteThis property overrides the value for the DIMZIN system variable for the given dimension.

Examples

VBA:

Sub Example_SuppressZeroFeet()
   ' This example creates an aligned dimension in model space and
   ' uses SuppressZeroFeet to suppress or view the display of
   ' zero feet in the alternate dimension display

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 0: point1(1) = 5: point1(2) = 0
    point2(0) = 5: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Set the dimension display to a style that works with SuppressZeroFeet
    dimObj.UnitsFormat = acDimLArchitectural

    ThisDrawing.Application.ZoomAll

Toggle:
    Select Case MsgBox("Press OK to suppress or view the display of zero feet in the dimension", vbOKCancel)
        Case vbOK
            ' Toggle the display of zero feet for the dimension value
            dimObj.SuppressZeroFeet = Not (dimObj.SuppressZeroFeet)
            ThisDrawing.Regen acAllViewports
        Case vbCancel
            Exit Sub
    End Select

    GoTo Toggle
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SuppressZeroFeet()
    ;; This example creates an aligned dimension in model space and
    ;; uses SuppressZeroFeet to suppress or view the display of
    ;; zero feet in the alternate dimension display
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 0 5 0)
          point2 (vlax-3d-point 5 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    ;; Set the dimension display to a style that works with SuppressZeroFeet
    (vla-put-UnitsFormat dimObj acDimLArchitectural)

    ;; Toggle the display of zero feet for the dimension value
    (vla-put-SuppressZeroFeet dimObj (if (= (vla-get-SuppressZeroFeet dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of zero feet toggled.")

    ;; Toggle the display of zero feet for the dimension value back to previous state
    (vla-put-SuppressZeroFeet dimObj (if (= (vla-get-SuppressZeroFeet dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of zero feet toggled back.")
)


SuppressZeroInches Property (ActiveX)

Specifies the suppression of a zero inch measurement in dimension values.

Supported platforms: Windows only

Signature

VBA:

object.SuppressZeroInches
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress the display of a zero inch measurement.
  • False: Do not suppress the display of a zero inch measurement.

Remarks

The initial value for this property is False.

NoteThis property overrides the value for the DIMZIN system variable for the given dimension.

Examples

VBA:

Sub Example_SuppressZeroInches()
   ' This example creates an aligned dimension in model space and
   ' uses SuppressZeroInches to suppress or view the display of
   ' zero inches in the dimension display

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 0: point1(1) = 5: point1(2) = 0
    point2(0) = 12: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Set the dimension display to a style that works with SuppressZeroInches
    dimObj.UnitsFormat = acDimLArchitectural

    ThisDrawing.Application.ZoomAll

Toggle:
    Select Case MsgBox("Press OK to suppress or view the display of zero inches in the dimension", vbOKCancel)
        Case vbOK
            ' Toggle the display of zero inches for the dimension value
            dimObj.SuppressZeroInches = Not (dimObj.SuppressZeroInches)
            ThisDrawing.Regen acAllViewports
        Case vbCancel
            Exit Sub
    End Select

    GoTo Toggle
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SuppressZeroInches()
    ;; This example creates an aligned dimension in model space and
    ;; uses SuppressZeroInches to suppress or view the display of
    ;; zero inches in the dimension display
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 0 5 0)
          point2 (vlax-3d-point 12 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    ;; Set the dimension display to a style that works with SuppressZeroInches
    (vla-put-UnitsFormat dimObj acDimLArchitectural)

    ;; Toggle the display of zero inches for the dimension value
    (vla-put-SuppressZeroInches dimObj (if (= (vla-get-SuppressZeroInches dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of zero inches toggled.")

    ;; Toggle the display of zero inches for the dimension value back to previous state
    (vla-put-SuppressZeroInches dimObj (if (= (vla-get-SuppressZeroInches dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of zero inches toggled back.")
)


SurfaceNormals Property (ActiveX)

Specifies for which cross-section curves the surface is normal to the cross section.

Supported platforms: Windows only

Signature

VBA:

object.SurfaceNormals
object

Type: LoftedSurface

The object this property applies to.

Property Value

Read-only: No

Type: Long

The cross-section curves that are normal to the surface.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


SurfaceType Property (ActiveX)

Indicates the type of surface.

Supported platforms: Windows only

Signature

VBA:

object.SurfaceType
object

Type: ExtrudedSurface, LoftedSurface, NurbSurface, PlaneSurface, RevolvedSurface, Surface, SweptSurface

The objects this property applies to.

Property Value

Read-only: Yes

Type: String

  • AcadExtrudedSurface: Extrusion
  • AcadRevolvedSurface: Revolve
  • AcadLoftedSurface: Loft with cross sections only
  • AcadLoftedSurface: Loft with guide curves
  • AcadLoftedSurface: Loft with path
  • AcadSweptSurface: Sweep
  • AcadPlaneSurface: Planar
  • AcadNetworkSurface: Network
  • AcadNurbSurface: NURBS

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


SurfTrimAssociativity Property (ActiveX)

Specifies if associativity is maintained between the surface and the objects used to trim the object.

Supported platforms: Windows only

Signature

VBA:

object.SurfTrimAssociativity
object

Type: ExtrudedSurface, LoftedSurface, NurbSurface, PlaneSurface, RevolvedSurface, Surface, SweptSurface

The objects this property applies to.

Property Value

Read-only: No

Type: Variant

  • True: Associativity is maintained between the surface and the trim objects.
  • False: Associativity is not maintained between the surface and the trim objects.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


SymbolPosition Property (ActiveX)

Specifies placement of the arc length dimension symbol.

Supported platforms: Windows only

Signature

VBA:

object.SymbolPosition
object

Type: DimArcLength

The object this property applies to.

Property Value

Read-only: No

Type: AcDimArcLengthSymbol enum

  • acSymAbove
  • acSymInFront
  • acSymNone

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


System Property (ActiveX)

Gets the PreferencesSystem object.

Supported platforms: Windows only

Signature

VBA:

object.System
object

Type: Preferences

The object this property applies to.

Property Value

Read-only: Yes

Type: PreferencesSystem

Gets the PreferencesSystem object.

Remarks

The PreferencesSystem object holds all the options from the System tab on the Options dialog stored in the registry. All options that are stored with the drawing can be found on the DatabasePreferences object.

Examples

VBA:

Sub Example_System()
    ' This example obtains a reference to the System Preferences object
    ' from the Application Preferences object, and reads one of the System
    ' preferences

    Dim ACADPref As AcadPreferencesSystem

    ' Obtain a reference to the System Preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.System

    MsgBox "You now have access to the properties and methods of the System Preferences object!"
    MsgBox "The System preference BeepOnError is set to: " & ACADPref.BeepOnError

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_System()
    ;; This example obtains a reference to the System Preferences object
    ;; from the Application Preferences object, and reads one of the System
    ;; preferences
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    (alert "You now have access to the properties and methods of the System Preferences object!")
    (alert (strcat "The System preference BeepOnError is set to: " (if (= (vla-get-BeepOnError (vla-get-System preferences)) :vlax-true) "True" "False")))
)


TableBreakFlowDirection Property (ActiveX)

Determines the direction that parts of the table flow.

Supported platforms: Windows only

Signature

VBA:

object.TableBreakFlowDirection
object

Type: Table

The object this property applies to.

Property Value

Read-only: No

Type: AcTableFlowDirection enum

  • acTableFlowDownOrUp
  • acTableFlowLeft
  • acTableFlowRight

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


TableBreakHeight Property (ActiveX)

Sets the breaking height for the initial table part and any other table parts that do not have manual heights set.

Supported platforms: Windows only

Signature

VBA:

object.TableBreakHeight
object

Type: Table

The object this property applies to.

Property Value

Read-only: No

Type: Double

Value for the break height.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_BreakHeight()
    ' This example creates a table object and then breaks it into
    ' two tables.

    ' Create a new table objetc in model space
    Dim pt(2) As Double

    Dim modelSpace As AcadModelSpace
    Set modelSpace = ThisDrawing.modelSpace

    Dim table As AcadTable
    Set table = modelSpace.AddTable(pt, 5, 5, 10, 30)

    table.EnableBreak = True
    table.BreakSpacing = 3.5
    table.TableBreakHeight = 35#
    table.AllowManualHeights = True
    table.SetBreakHeight 0, 20#
    table.SetBreakHeight 1, 35#

    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_BreakHeight()
    ;; This example creates a table object and then breaks it into
    ;; two tables.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create a new table objetc in model space
    (setq pt (vlax-3d-point 0 0 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq table (vla-Addtable modelSpace pt 5 5 10 30))

    (vla-put-EnableBreak table :vlax-true)
    (vla-put-BreakSpacing table 3.5)
    (vla-put-TableBreakHeight table 35.0)
    (vla-put-AllowManualHeights table :vlax-true)
    (vla-SetBreakHeight table 0 20.0)
    (vla-SetBreakHeight table 1 35.0)

    (vla-ZoomExtents acadObj)
)


TablesReadOnly Property (ActiveX)

Determines whether to open database tables in read-only mode.

Supported platforms: Windows only

Signature

VBA:

object.TablesReadOnly
object

Type: PreferencesSystem

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Open database tables in read-only mode.
  • False: Open database tables in read-write mode.

Remarks

The initial value for this property is False.

Examples

VBA:

Sub Example_TablesReadOnly()
    ' This example reads and modifies the preference value that controls
    ' whether to open database tables in read-only mode.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesSystem
    Dim originalValue As Variant, newValue As Variant

    ' Get the system preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.System

    ' Read and display the original value
    originalValue = ACADPref.TablesReadOnly
    MsgBox "The TablesReadOnly preference is set to: " & originalValue

    ' Modify the TablesReadOnly preference by toggling the value
    ACADPref.TablesReadOnly = Not (ACADPref.TablesReadOnly)
    newValue = ACADPref.TablesReadOnly
    MsgBox "The TablesReadOnly preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.TablesReadOnly = originalValue
    MsgBox "The TablesReadOnly preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TablesReadOnly()
    ;; This example reads and modifies the preference value that controls
    ;; whether to open database tables in read-only mode.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-TablesReadOnly (vla-get-System preferences)))
    (alert (strcat "The TablesReadOnly preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the TablesReadOnly preference by toggling the value
    (vla-put-TablesReadOnly (vla-get-System preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (alert (strcat "The TablesReadOnly preference has been set to: " (if (= (vla-get-TablesReadOnly (vla-get-System preferences)) :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-TablesReadOnly (vla-get-System preferences) originalValue)
    (alert (strcat "The TablesReadOnly preference was reset back to: " (if (= (vla-get-TablesReadOnly (vla-get-System preferences)) :vlax-true) "True" "False")))
)


TableStyleOverrides Property (ActiveX)

Specifies the table style overrides.

Supported platforms: Windows only

Signature

VBA:

object.TableStyleOverrides
object

Type: Table

The object this property applies to.

Property Value

Read-only: Yes

Type: Variant; acTableStyleOverrides enum

  • acCellAlign
  • acCellBackgroundColor
  • acCellBackgroundFillNone
  • acCellBottomGridColor
  • acCellBottomGridLineWeight
  • acCellBottomVisibility
  • acCellContentColor
  • acCellDataType
  • acCellLeftGridColor
  • acCellLeftGridLineWeight
  • acCellLeftVisibility
  • acCellRightGridColor
  • acCellRightGridLineWeight
  • acCellRightVisibility
  • acCellTextHeight
  • acCellTextStyle
  • acCellTopGridColor
  • acCellTopGridLineWeight
  • acCellTopVisibility
  • acDataHorzBottomColor
  • acDataHorzBottomLineWeight
  • acDataHorzBottomVisibility
  • acDataHorzInsideColor
  • acDataHorzInsideLineWeight
  • acDataHorzInsideVisibility
  • acDataHorzTopColor
  • acDataHorzTopLineWeight
  • acDataHorzTopVisibility
  • acDataRowAlignment
  • acDataRowColor
  • acDataRowDataType
  • acDataRowFillColor
  • acDataRowFillNone
  • acDataRowTextHeight
  • acDataRowTextStyle
  • acDataVertInsideColor
  • acDataVertInsideLineWeight
  • acDataVertInsideVisibility
  • acDataVertLeftColor
  • acDataVertLeftLineWeight
  • acDataVertLeftVisibility
  • acDataVertRightColor
  • acDataVertRightLineWeight
  • acDataVertRightVisibility
  • acFlowDirection
  • acHeaderHorzBottomColor
  • acHeaderHorzBottomLineWeight
  • acHeaderHorzBottomVisibility
  • acHeaderHorzInsideColor
  • acHeaderHorzInsideLineWeight
  • acHeaderHorzInsideVisibility
  • acHeaderHorzTopColor
  • acHeaderHorzTopLineWeight
  • acHeaderHorzTopVisibility
  • acHeaderRowAlignment
  • acHeaderRowColor
  • acHeaderRowDataType
  • acHeaderRowFillColor
  • acHeaderRowFillNone
  • acHeaderRowTextHeight
  • acHeaderRowTextStyle
  • acHeaderSuppressed
  • acHeaderVertInsideColor
  • acHeaderVertInsideLineWeight
  • acHeaderVertInsideVisibility
  • acHeaderVertLeftColor
  • acHeaderVertLeftLineWeight
  • acHeaderVertLeftVisibility
  • acHeaderVertRightColor
  • acHeaderVertRightLineWeight
  • acHeaderVertRightVisibility
  • acHorzCellMargin
  • acTitleHorzBottomColor
  • acTitleHorzBottomLineWeight
  • acTitleHorzBottomVisibility
  • acTitleHorzInsideColor
  • acTitleHorzInsideLineWeight
  • acTitleHorzInsideVisibility
  • acTitleHorzTopColor
  • acTitleHorzTopLineWeight
  • acTitleHorzTopVisibility
  • acTitleRowAlignment
  • acTitleRowColor
  • acTitleRowDataType
  • acTitleRowFillColor
  • acTitleRowFillNone
  • acTitleRowTextHeight
  • acTitleRowTextStyle
  • acTitleSuppressed
  • acTitleVertInsideColor
  • acTitleVertInsideLineWeight
  • acTitleVertInsideVisibility
  • acTitleVertLeftColor
  • acTitleVertLeftLineWeight
  • acTitleVertLeftVisibility
  • acTitleVertRightColor
  • acTitleVertRightLineWeight
  • acTitleVertRightVisibility
  • acVertCellMargin

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


TabOrder Property (ActiveX)

Specifies the tab order of a layout.

Supported platforms: Windows only

Signature

VBA:

object.TabOrder
object

Type: Layout

The object this property applies to.

Property Value

Read-only: No

Type: Long

The tab order for the layout.

Remarks

This property controls the order in which the layouts are displayed in the tab control. The tab order should be unique and sequential among all layouts in the database.

The model space tab must have a tab order of zero (0). Paper space tabs must have a tab order of 1 or greater.

Examples

VBA:

Sub Example_TabOrder()
    ' This example creates two new Layouts, sets the TabOrder of the Layouts to be
    ' in alphabetic order, and displays a list of Layouts in the order they appear
    ' in the tabs.

    Dim Layout1 As ACADLayout, Layout2 As ACADLayout
    Dim SortLayoutRight As ACADLayout, SortLayoutLeft As ACADLayout
    Dim SortIt As New Collection
    Dim TabCount As Long, SortCount As Long, TabOrder As Long
    Dim TabName As String, SortText As String, msg As String
    Dim tempLayout As ACADLayout
    Dim AddedTab As Boolean

    ' Create new Layouts
    On Error Resume Next
    Set Layout1 = ThisDrawing.Layouts.Add("Z VIEW")
    Set Layout2 = ThisDrawing.Layouts.Add("A VIEW")
    On Error GoTo 0

    ' Alphabetize internally
    For TabCount = 0 To (ThisDrawing.Layouts.count - 1)
        AddedTab = False

        TabName = ThisDrawing.Layouts(TabCount).name

        If TabName = "Model" Then GoTo SKIP                 ' Skip modelspace

        If SortIt.count = 0 Then
            SortIt.Add TabName                              ' Add to beginning of list
        Else
            For SortCount = 1 To SortIt.count               ' Add to list by string
                SortText = SortIt(SortCount)
                If StrComp(TabName, SortText, vbTextCompare) = -1 Then
                    If SortCount = 1 Then
                        SortIt.Add TabName                  ' Add as first item
                    Else
                        SortIt.Add TabName, , SortCount     ' Add as previous item
                    End If
                    AddedTab = True
                    Exit For
                End If
            Next

            If Not (AddedTab) Then SortIt.Add TabName, , , SortIt.count  ' Add if we haven't yet
        End If
SKIP:
    Next

    ' Write new ACAD tab order
    For SortCount = 1 To SortIt.count
        Set tempLayout = ThisDrawing.Layouts(SortIt(SortCount))
        tempLayout.TabOrder = SortCount
    Next

    '-------------------------------
    ' Read and display New Tab Order
    '-------------------------------
    msg = "The tab order is now set to: " & vbCrLf & vbCrLf
    For TabCount = 0 To (ThisDrawing.Layouts.count - 1)
        TabName = ThisDrawing.Layouts(TabCount).name
        If TabName = "Model" Then GoTo SKIP2                ' Don't show modelspace
        TabOrder = ThisDrawing.Layouts(TabCount).TabOrder
        msg = msg & "(" & TabOrder & ")" & vbTab & TabName & vbCrLf
SKIP2:
    Next

    MsgBox msg, vbInformation

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TabOrder()
    ;; This example creates two new Layouts, sets the TabOrder of the Layouts to be
    ;; in alphabetic order, and displays a list of Layouts in the order they appear
    ;; in the tabs.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create new Layouts
    (setq Layout1 (vla-Add (vla-get-Layouts doc) "Z VIEW"))
    (setq Layout2 (vla-Add (vla-get-Layouts doc) "A VIEW"))

    (setq SortIt (list)
          TabCount 0)

    ;; Alphabetize internally
    (while (>= (1- (vla-get-Count (vla-get-Layouts doc))) TabCount)
        (setq AddedTab :vlax-false)

        (setq TabName (vla-get-Name (vla-Item (vla-get-Layouts doc) TabCount)))

        (if (/= (strcase TabName) "MODEL")                  ;; Skip modelspace
            (progn
                   (setq SortIt (append SortIt (list TabName)))        ;; Add to beginning of list
            )
        )

        (setq TabCount (1+ TabCount))
    )

    ;; Sort layout names
    (setq SortIt (acad_strlsort SortIt)
          SortCount 1)

    ;; Update tab order
    (foreach name SortIt
        (progn
            (setq tempLayout (vla-Item (vla-get-Layouts doc) name))
            (vla-put-TabOrder tempLayout SortCount)
            (setq SortCount (1+ SortCount))
        )
    )

    ;;-------------------------------
    ;; Read and display New Tab Order
    ;;-------------------------------
    (setq msg "The tab order is now set to: \n"
          TabCount 0)

    (while (>= (1- (vla-get-Count (vla-get-Layouts doc))) TabCount)
        (setq TabName (vla-get-Name (vla-Item (vla-get-Layouts doc) TabCount)))

        (if (/= (strcase TabName) "MODEL")                  ;; Skip modelspace
            (progn
                (setq TabOrder (vla-get-TabOrder (vla-Item (vla-get-Layouts doc) TabCount)))
                (setq msg (strcat msg "(" (itoa TabOrder) ")    " TabName "\n"))
            )
        )
        (setq TabCount (1+ TabCount))
    )

    (alert msg)
)


TagString Property (ActiveX)

Specifies the tag string of the object.

Supported platforms: Windows only

Signature

VBA:

object.TagString
object

Type: Attribute, AttributeReference, PopupMenu, PopupMenuItem, Toolbar, ToolbarItem

The objects this property applies to.

Property Value

Read-only: No; except for PopupMenu and Toolbar objects

Type: String

The tag string of the object.

Remarks

Attribute, AttributeReference: This string identifies each occurrence of the attribute. Enter any characters except spaces or exclamation points. AutoCAD changes lowercase letters to uppercase.

PopupMenu, PopupMenuItem, Toolbar, ToolbarItem: A tag, or name tag, is a string consisting of alphanumeric and underscore (_) characters. This string uniquely identifies the item within a given customization file. This string is automatically assigned when the object is created and is used internally by AutoCAD for toolbar and menu identification. Most developers do not need this level of identification and can safely ignore the TagString property.

Examples

VBA:

Sub Example_TagString()
    ' This example creates an attribute definition in model space.
    ' It then queries the tag string for the attribute, changes
    ' the tag string, and displays the new tag string.

    Dim attributeObj As AcadAttribute
    Dim height As Double
    Dim mode As Long
    Dim prompt As String
    Dim insertionPoint(0 To 2) As Double
    Dim tag As String
    Dim value As String

    ' Define the attribute definition
    height = 1#
    mode = acAttributeModeVerify
    prompt = "New Prompt"
    insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0
    tag = "NEW_TAG"
    value = "New Value"

    ' Create the attribute definition object in model space
    Set attributeObj = ThisDrawing.ModelSpace.AddAttribute(height, mode, prompt, insertionPoint, tag, value)
    ZoomAll

    ' Find the current tag string for the attribute
    tag = attributeObj.TagString
    MsgBox "The current tag string for the attribute is " & tag, , "TagString Example"

    ' Change the tag string for the attribute
    attributeObj.TagString = "UPDATED_TAG"
    attributeObj.Update
    tag = attributeObj.TagString
    MsgBox "The new tag string for the attribute is " & tag, , "TagString Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TagString()
    ;; This example creates an attribute definition in model space.
    ;; It then queries the tag string for the attribute, changes
    ;; the tag string, and displays the new tag string.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the attribute definition
    (setq insertionPoint (vlax-3d-point 5 5 0)
          attHeight 1
          attMode acAttributeModeVerify
          attPrompt "New Prompt"
          attTag "NEW_TAG"
          attValue "New Value")

    ;; Create the attribute definition object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq attributeObj (vla-AddAttribute modelSpace attHeight attMode attPrompt insertionPoint attTag attValue))
    (vla-ZoomAll acadObj)

    ;; Find the current tag string for the attribute
    (setq tag (vla-get-TagString attributeObj))
    (alert (strcat "The current tag string for the attribute is " tag))

    ;; Change the tag string for the attribute
    (vla-put-TagString attributeObj "UPDATED_TAG")
    (vla-Update attributeObj)
    (setq tag (vla-get-TagString attributeObj))
    (alert (strcat "The new tag string for the attribute is " tag))
)


TaperAngle Property (ActiveX)

Specifies the taper angle of the extrusion.

Supported platforms: Windows only

Signature

VBA:

object.TaperAngle
object

Type: ExtrudedSurface

The object this property applies to.

Property Value

Read-only: No

Type: ACAD_ANGLE

The taper angle of the extrusion.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


Target Property (ActiveX)

Specifies the target point for the view or viewport.

Supported platforms: Windows only

Signature

VBA:

object.Target
object

Type: PViewport, View, Viewport

The objects this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

A 3D WCS coordinate representing the target point.

Remarks

The line of sight is drawn from the center to the target point.

Examples

VBA:

Sub Example_Target()
    ' This example changes the target for a model space viewport.

    ' Create a new model space viewport
    Dim viewportObj As AcadViewport
    Set viewportObj = ThisDrawing.Viewports.Add("NewViewport")

    ' Add a circle
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 0: center(1) = 0: center(2) = 0
    radius = 1
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, radius)

    ' Find the current target
    Dim currTarget As Variant
    currTarget = viewportObj.target
    MsgBox "The current target is " & viewportObj.target(0) & ", " & viewportObj.target(1) & ", " & viewportObj.target(2), , "Target Example"

    ' Change the target
    Dim newTarget(0 To 2) As Double
    newTarget(0) = 2#: newTarget(1) = 2#: newTarget(2) = 0
    viewportObj.target = newTarget
    ThisDrawing.ActiveViewport = viewportObj
    ThisDrawing.Regen acAllViewports
    MsgBox "The new target is " & viewportObj.target(0) & ", " & viewportObj.target(1) & ", " & viewportObj.target(2), , "Target Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Target()
    ;; This example changes the target for a model space viewport.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create a new model space viewport
    (setq viewportObj (vla-Add (vla-get-Viewports doc) "NewViewport"))

    ;; Add a circle
    (setq center (vlax-3d-point 0 0 0)
          radius 1)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace center radius))

    ;; Find the current target
    (setq currTarget (vlax-variant-value (vla-get-Target viewportObj)))
    (alert (strcat "The current target is " (rtos (vlax-safearray-get-element currTarget 0) 2) ", "
                                            (rtos (vlax-safearray-get-element currTarget 1) 2) ", "
                                            (rtos (vlax-safearray-get-element currTarget 2) 2)))

    ;; Change the target
    (setq newTarget (vlax-3d-point 2 2 0))
    (vla-put-Target viewportObj newTarget)
    (vla-put-ActiveViewport doc viewportObj)
    (vla-Regen doc acAllViewports)

    (setq currTarget (vlax-variant-value (vla-get-Target viewportObj)))
    (alert (strcat "The new target is " (rtos (vlax-safearray-get-element currTarget 0) 2) ", "
                                        (rtos (vlax-safearray-get-element currTarget 1) 2) ", "
                                        (rtos (vlax-safearray-get-element currTarget 2) 2)))
)


TempFileExtension Property (ActiveX)

Specifies the extension for temporary files.

Supported platforms: Windows only

Signature

VBA:

object.TempFileExtension
object

Type: PreferencesOpenSave

The object this property applies to.

Property Value

Read-only: No

Type: String

This string must be between one and three characters inclusive.

Remarks

The default value for this property is ac$.

The temporary file extension is a one to three character extension that is used for temporary files. In a multiuser environment, you can avoid confusion by specifying a different name for each user.

Examples

VBA:

Sub Example_TempFileExtension()
    ' This example returns the current setting of
    ' TempFileExtension. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currTempFileExtension As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current TempFileExtension value
    currTempFileExtension = preferences.OpenSave.TempFileExtension
    MsgBox "The current value for TempFileExtension is " & preferences.OpenSave.TempFileExtension, vbInformation, "TempFileExtension Example"

    ' Change the value for TempFileExtension
    preferences.OpenSave.TempFileExtension = "@@@"
    MsgBox "The new value for TempFileExtension is " & preferences.OpenSave.TempFileExtension, vbInformation, "TempFileExtension Example"

    ' Reset TempFileExtension to its original value
    preferences.OpenSave.TempFileExtension = currTempFileExtension
    MsgBox "The TempFileExtension value is reset to " & preferences.OpenSave.TempFileExtension, vbInformation, "TempFileExtension Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TempFileExtension()
    ;; This example returns the current setting of
    ;; TempFileExtension. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current TempFileExtension value
    (setq currTempFileExtension (vla-get-TempFileExtension (vla-get-OpenSave preferences)))
    (alert (strcat "The current value for TempFileExtension is " currTempFileExtension))

    ;; Change the value for TempFileExtension
    (vla-put-TempFileExtension (vla-get-OpenSave preferences) "@@@")
    (alert (strcat "The new value for TempFileExtension is " (vla-get-TempFileExtension (vla-get-OpenSave preferences))))

    ;; Reset TempFileExtension to its original value
    (vla-put-TempFileExtension (vla-get-OpenSave preferences) currTempFileExtension)
    (alert (strcat "The TempFileExtension value is reset to " (vla-get-TempFileExtension (vla-get-OpenSave preferences))))
)


TempFilePath Property (ActiveX)

Specifies the directory AutoCAD uses to store temporary files.

Supported platforms: Windows only

Signature

VBA:

object.TempFilePath
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The drive and path of the directory used for temporary files.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_TempFilePath()
    ' This example returns the current setting of
    ' TempFilePath. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currTempFilePath As String
    Dim newTempFilePath As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current TempFilePath value
    currTempFilePath = preferences.Files.TempFilePath
    MsgBox "The current value for TempFilePath is " & currTempFilePath, vbInformation, "TempFilePath Example"

    ' Change the value for TempFilePath
    newTempFilePath = "C:\AutoCAD\"
    preferences.Files.TempFilePath = newTempFilePath
    MsgBox "The new value for TempFilePath is " & newTempFilePath, vbInformation, "TempFilePath Example"

    ' Reset TempFilePath to its original value
    preferences.Files.TempFilePath = currTempFilePath
    MsgBox "The TempFilePath value is reset to " & currTempFilePath, vbInformation, "TempFilePath Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TempFilePath()
    ;; This example returns the current setting of
    ;; TempFilePath. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current TempFilePath value
    (setq currTempFilePath (vla-get-TempFilePath (vla-get-Files preferences)))
    (alert (strcat "The current value for TempFilePath is " currTempFilePath))

    ;; Change the value for TempFilePath
    (setq newTempFilePath "C:\\AutoCAD\\")
    (vla-put-TempFilePath (vla-get-Files preferences) newTempFilePath)
    (alert (strcat "The new value for TempFilePath is " newTempFilePath))

    ;; Reset TempFilePath to its original value
    (vla-put-TempFilePath (vla-get-Files preferences) currTempFilePath)
    (alert (strcat "The TempFilePath value is reset to " currTempFilePath))
)


TemplateDWGPath Property (ActiveX)

Specifies the path for the template files used by the start-up wizards.

Supported platforms: Windows only

Signature

VBA:

object.TemplateDWGPath
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The drive and path for the template files.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_TemplateDWGPath()
    ' This example returns the current setting of
    ' TemplateDWGPath. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currTemplateDWGPath As String
    Dim newTemplateDWGPath As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current TemplateDWGPath value
    currTemplateDWGPath = preferences.Files.TemplateDwgPath
    MsgBox "The current value for TemplateDWGPath is " & currTemplateDWGPath, vbInformation, "TemplateDWGPath Example"

    ' Change the value for TemplateDWGPath
    newTemplateDWGPath = "TestTemplateDWGPath"
    preferences.Files.TemplateDwgPath = newTemplateDWGPath
    MsgBox "The new value for TemplateDWGPath is " & newTemplateDWGPath, vbInformation, "TemplateDWGPath Example"

    ' Reset TemplateDWGPath to its original value
    preferences.Files.TemplateDwgPath = currTemplateDWGPath
    MsgBox "The TemplateDWGPath value is reset to " & currTemplateDWGPath, vbInformation, "TemplateDWGPath Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TemplateDwgPath()
    ;; This example returns the current setting of
    ;; TemplateDwgPath. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current TemplateDWGPath value
    (setq currTemplateDWGPath (vla-get-TemplateDwgPath (vla-get-Files preferences)))
    (alert (strcat "The current value for TemplateDwgPath is " currTemplateDWGPath))

    ;; Change the value for TemplateDWGPath
    (setq newTemplateDWGPath "TestTemplateDWGPath")
    (vla-put-TemplateDwgPath (vla-get-Files preferences) newTemplateDWGPath)
    (alert (strcat "The new value for TemplateDwgPath is " newTemplateDWGPath))

    ;; Reset TemplateDWGPath to its original value
    (vla-put-TemplateDwgPath (vla-get-Files preferences) currTemplateDWGPath)
    (alert (strcat "The TemplateDwgPath value is reset to " currTemplateDWGPath))
)


TemplateId Property (ActiveX)

Specifies the template ID for the table style.

Supported platforms: Windows only

Signature

VBA:

object.TemplateId
object

Type: TableStyle

The object this property applies to.

Property Value

Read-only: No

Type: LONG_PTR

The template ID for the table style.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


TempXRefPath Property (ActiveX)

Specifies the location of external reference files.

Supported platforms: Windows only

Signature

VBA:

object.TempXRefPath
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The drive and path of the directory to search for external reference files.

Remarks

This location is used for the copy of the external reference if you choose acEnableWithCopy demand loading on the XRefDemandLoad property.

Examples

VBA:

Sub Example_TempXRefPath()
    ' This example returns the current setting of
    ' TempXRefPath. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currTempXRefPath As String
    Dim newTempXRefPath As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current TempXRefPath value
    currTempXRefPath = preferences.Files.TempXrefPath
    MsgBox "The current value for TempXRefPath is " & currTempXRefPath, vbInformation, "TempXRefPath Example"

    ' Change the value for TempXRefPath
    newTempXRefPath = "TestTempXRefPath"
    preferences.Files.TempXrefPath = newTempXRefPath
    MsgBox "The new value for TempXRefPath is " & newTempXRefPath, vbInformation, "TempXRefPath Example"

    ' Reset TempXRefPath to its original value
    preferences.Files.TempXrefPath = currTempXRefPath
    MsgBox "The TempXRefPath value is reset to " & currTempXRefPath, vbInformation, "TempXRefPath Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TempXRefPath()
    ;; This example returns the current setting of
    ;; TempXRefPath. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current TempXRefPath value
    (setq currTempXRefPath (vla-get-TempXrefPath (vla-get-Files preferences)))
    (alert (strcat "The current value for TempXRefPath is " currTempXRefPath))

    ;; Change the value for TempXRefPath
    (setq newTempXRefPath "TestTempXRefPath")
    (vla-put-TempXrefPath (vla-get-Files preferences) newTempXRefPath)
    (alert (strcat "The new value for TempXRefPath is " newTempXRefPath))

    ;; Reset TempXRefPath to its original value
    (vla-put-TempXrefPath (vla-get-Files preferences) currTempXRefPath)
    (alert (strcat "The TempXRefPath value is reset to " currTempXRefPath))
)


TextAlignmentPoint Property (ActiveX)

Specifies the alignment point for text and attributes.

Supported platforms: Windows only

Signature

VBA:

object.TextAlignmentPoint
object

Type: Attribute, AttributeReference, Text

The object this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

A 3D WCS coordinate representing the alignment point of the object.

Remarks

Text: This property will be reset to 0, 0, 0 and will become read-only when the Alignment property is set to acAlignmentLeft. To position text whose justification is left, fit, or aligned, use the InsertionPoint property.

Examples

VBA:

Sub Example_TextAlignmentPoint()
    ' This example creates a text object in model space.
    ' It then changes the TextAlignmentPoint and HorizontalAlignment
    ' properties of the text object.

    Dim textObj As AcadText
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double

    ' Define the text object
    textString = "Hello, World."
    insertionPoint(0) = 3: insertionPoint(1) = 3: insertionPoint(2) = 0
    height = 0.5

    ' Create the text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)
    ZoomAll
    MsgBox "The TextAlignmentPoint is set to the default " & _
           textObj.TextAlignmentPoint(0) & ", " & _
           textObj.TextAlignmentPoint(1) & ", " & _
           textObj.TextAlignmentPoint(2), vbInformation, _
           "TextAlignmentPoint Example"

    ' Change the value of the HorizontalAlignment and
    ' TextAlignmentPoint properties.
    ' Note that the HorizontalAlignment property must be changed first,
    ' and to a value that requires the TextAlignmentPoint, before the
    ' TextAlignmentPoint property will allow a value to be set.
    Dim alignmentPoint(0 To 2) As Double
    alignmentPoint(0) = 5: alignmentPoint(1) = 3: alignmentPoint(2) = 0
    textObj.HorizontalAlignment = acHorizontalAlignmentFit
    textObj.TextAlignmentPoint = alignmentPoint
    ZoomAll
    MsgBox "The TextAlignmentPoint is set to " & _
           textObj.TextAlignmentPoint(0) & ", " & _
           textObj.TextAlignmentPoint(1) & ", " & _
           textObj.TextAlignmentPoint(2) & vbCrLf & _
           "The HorizontalAlignment is set to acHorizontalAlignmentFit", _
           vbInformation, "TextAlignmentPoint Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextAlignmentPoint()
    ;; This example creates a text object in model space.
    ;; It then changes the TextAlignmentPoint and HorizontalAlignment
    ;; properties of the text object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the text object
    (setq insertionPoint (vlax-3d-point 3 3 0)
          textString "Hello, World."
          height 0.5)

    ;; Create the text object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq textObj (vla-AddText modelSpace textString insertionPoint height))
    (vla-ZoomAll acadObj)

    (setq alignmentPoint (vlax-variant-value (vla-get-TextAlignmentPoint textObj)))
    (alert (strcat "The TextAlignmentPoint is set to the default " (rtos (vlax-safearray-get-element alignmentPoint 0) 2) ", "
                                                                   (rtos (vlax-safearray-get-element alignmentPoint 1) 2) ", "
                                                                   (rtos (vlax-safearray-get-element alignmentPoint 2) 2)))

    ;; Change the value of the HorizontalAlignment and
    ;; TextAlignmentPoint properties.
    ;; Note that the HorizontalAlignment property must be changed first,
    ;; and to a value that requires the TextAlignmentPoint, before the
    ;; TextAlignmentPoint property will allow a value to be set.
    (setq alignmentPoint (vlax-3d-point 5 3 0))
    (vla-put-Alignment textObj acHorizontalAlignmentFit)
    (vla-put-TextAlignmentPoint textObj alignmentPoint)
    (vla-ZoomAll acadObj)

    (setq alignmentPoint (vlax-variant-value (vla-get-TextAlignmentPoint textObj)))
    (alert (strcat "The TextAlignmentPoint is set to " (rtos (vlax-safearray-get-element alignmentPoint 0) 2) ", "
                                                       (rtos (vlax-safearray-get-element alignmentPoint 1) 2) ", "
                                                       (rtos (vlax-safearray-get-element alignmentPoint 2) 2)))
)


TextAlignmentType Property (ActiveX)

Specifies the TextAlignmentType of the mleaderstyle.

Supported platforms: Windows only

Signature

VBA:

object.TextAlignmentType
object

Type: MLeaderStyle

The object this property applies to.

Property Value

Read-only: No

Type: AcTextAlignmentType enum

The text alignment type.

  • acCenterAlignment
  • acLeftAlignment
  • acRightAlignment

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


TextAttachmentDirection Property (ActiveX)

Specifies if the text content uses a horizontal or vertical attachment direction.

Supported platforms: Windows only

Signature

VBA:

object.TextAttachmentDirection
object

Type: MLeader, MLeaderStyle

The objects this property applies to.

Property Value

Read-only: No

Type: AcTextAttachmentDirection enum

  • acAttachmentHorizontal: Horizontal attachment inserts the leader to the left or right of the text content. A horizontal attachment includes a landing line between the text and the leader.
  • acAttachmentVertical: Inserts the leader at the top or bottom of the text content. A vertical attachment does not include a landing line between the text and the leader.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_TextManipulation()
    Dim oML As AcadMLeader
    Dim points(0 To 14) As Double

    ' Define the leader points
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 1: points(4) = 2: points(5) = 0
    points(6) = 2: points(7) = 2: points(8) = 0
    points(9) = 3: points(10) = 2: points(11) = 0
    points(12) = 4: points(13) = 4: points(14) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    oML.TextLeftAttachmentType = acAttachmentBottomLine
    oML.TextRightAttachmentType = acAttachmentMiddleOfBottom
    oML.TextBackgroundFill = False
    oML.TextDirection = acLeftToRight
    oML.TextHeight = 2.3
    oML.TextJustify = acAttachmentPointMiddleLeft
    oML.TextLineSpacingDistance = 2.4
    oML.TextLineSpacingFactor = 1.2
    oML.TextLineSpacingStyle = acLineSpacingStyleExactly
    oML.TextWidth = 7.4

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextManipulation()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the leader points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill points '(1 1 0
                                              1 2 0
                                              2 2 0
                                              3 2 0
                                              4 4 0
                                             )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (vla-put-TextLeftAttachmentType oML acAttachmentBottomLine)
    (vla-put-TextRightAttachmentType oML acAttachmentMiddleOfBottom)
    (vla-put-TextBackgroundFill oML :vlax-false)
    (vla-put-TextDirection oML acLeftToRight)
    (vla-put-TextHeight oML 2.3)
    (vla-put-TextJustify oML acAttachmentPointMiddleLeft)
    (vla-put-TextLineSpacingDistance oML 2.4)
    (vla-put-TextLineSpacingFactor oML 1.2)
    (vla-put-TextLineSpacingStyle oML acLineSpacingStyleExactly)
    (vla-put-TextWidth oML 7.4)
)


TextAttachmentType Property (ActiveX)

Specify how leaders connect with the text.

Supported platforms: Windows only

Signature

VBA:

object.TextAttachmentType
object

Type: MLeader

The object this property applies to.

Property Value

Read-only: No

Type: AcTextAttachmentType enum

  • acAttachmentAllLine
  • acAttachmentBottomLine
  • acAttachmentBottomOfBottom
  • acAttachmentBottomOfTop
  • acAttachmentBottomOfTopLine
  • acAttachmentMiddle
  • acAttachmentMiddleOfBottom
  • acAttachmentMiddleOfTop
  • acAttachmentTopOfTop

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


TextBackgroundFill Property (ActiveX)

Specifies if background mask ought to be used.

Supported platforms: Windows only

Signature

VBA:

object.TextBackgroundFill
object

Type: MLeader

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Background mask is applied.
  • False: Background mask is not applied.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_TextManipulation()
    Dim oML As AcadMLeader
    Dim points(0 To 14) As Double

    ' Define the leader points
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 1: points(4) = 2: points(5) = 0
    points(6) = 2: points(7) = 2: points(8) = 0
    points(9) = 3: points(10) = 2: points(11) = 0
    points(12) = 4: points(13) = 4: points(14) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    oML.TextLeftAttachmentType = acAttachmentBottomLine
    oML.TextRightAttachmentType = acAttachmentMiddleOfBottom
    oML.TextBackgroundFill = False
    oML.TextDirection = acLeftToRight
    oML.TextHeight = 2.3
    oML.TextJustify = acAttachmentPointMiddleLeft
    oML.TextLineSpacingDistance = 2.4
    oML.TextLineSpacingFactor = 1.2
    oML.TextLineSpacingStyle = acLineSpacingStyleExactly
    oML.TextWidth = 7.4

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextManipulation()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the leader points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill points '(1 1 0
                                              1 2 0
                                              2 2 0
                                              3 2 0
                                              4 4 0
                                             )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (vla-put-TextLeftAttachmentType oML acAttachmentBottomLine)
    (vla-put-TextRightAttachmentType oML acAttachmentMiddleOfBottom)
    (vla-put-TextBackgroundFill oML :vlax-false)
    (vla-put-TextDirection oML acLeftToRight)
    (vla-put-TextHeight oML 2.3)
    (vla-put-TextJustify oML acAttachmentPointMiddleLeft)
    (vla-put-TextLineSpacingDistance oML 2.4)
    (vla-put-TextLineSpacingFactor oML 1.2)
    (vla-put-TextLineSpacingStyle oML acLineSpacingStyleExactly)
    (vla-put-TextWidth oML 7.4)
)


TextBottomAttachmentType Property (ActiveX)

Specifies the attachment of the leader to the bottom of the text content.

Supported platforms: Windows only

Signature

VBA:

object.TextBottomAttachmentType
object

Type: MLeader, MLeaderStyle

The objects this property applies to.

Property Value

Read-only: No

Type: AcVerticalTextAttachmentType enum

  • acAttachmentCenter: Leader attachment is centered with the text content
  • acAttachmentLinedCenter: Inserts an underline between the leader attachment and the text content

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


TextColor Property (ActiveX)

Specifies the color of the text for dimension and tolerance objects.

Supported platforms: Windows only

Signature

VBA:

object.TextColor
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated, MLeaderStyle, Tolerance, PreferencesDisplay

The objects this property applies to.

Property Value

Read-only: No

Type: acColor enum

Use a color index number from 0 to 256, or one of the constants listed here:

  • acByBlock
  • acByLayer
  • acRed
  • acYellow
  • acGreen
  • acCyan
  • acBlue
  • acMagenta
  • acWhite

Remarks

Colors can be set and read as numeric index values ranging from 0 to 256. Constants have been provided for the standard seven colors, as well as the BYBLOCK and BYLAYER designations.

If you use acByBlock, AutoCAD draws new objects in the default color (white or black, depending on your configuration) until they are grouped into the block. When the block is inserted in the drawing, the objects in the block inherit the current setting of the color property.

If you use acByLayer, new objects assume the color of the layer upon which they are drawn.

NoteThis property overrides the value of the DIMCLRT system variable for the given dimension or tolerance object.

Examples

VBA:

Sub Example_TextColor()
   ' This example creates an aligned dimension in model space and
   ' uses the TextColor property to toggle the dimension text color to red

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 7: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ThisDrawing.Application.ZoomAll

    ' Read and display current dimension text color
    MsgBox "The dimension text color for this object is currently set to: " & dimObj.TextColor

    ' Change the dimension text color
    dimObj.TextColor = acRed
    ThisDrawing.Regen acAllViewports

    ' Read and display current dimension text color
    MsgBox "The dimension text color for this object is now set to: " & dimObj.TextColor & " (Red)"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextColor()
    ;; This example creates an aligned dimension in model space and
    ;; uses the TextColor property to toggle the dimension text color to red
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 7 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    ;; Read and display current dimension text color
    (alert (strcat "The dimension text color for this object is currently set to: " (itoa (vla-get-TextColor dimObj))))

    ;; Change the dimension text color
    (vla-put-TextColor dimObj acRed)
    (vla-Regen doc acAllViewports)

    ;; Read and display current dimension text color
    (alert (strcat "The dimension text color for this object is now set to: " (itoa (vla-get-TextColor dimObj)) " (Red)"))
)


TextDirection Property (ActiveX)

Specifies the drawing direction of the MText.

Supported platforms: Windows only

Signature

VBA:

object.TextDirection
object

Type: MLeader

The object this property applies to.

Property Value

Read-only: No

Type: AcDrawingDirection enum

  • acBottomToTop
  • acByStyle
  • acLeftToRight
  • acRightToLeft
  • acTopToBottom

Remarks

No additional remarks.

Examples

VBA:

Sub Example_TextManipulation()
    Dim oML As AcadMLeader
    Dim points(0 To 14) As Double

    ' Define the leader points
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 1: points(4) = 2: points(5) = 0
    points(6) = 2: points(7) = 2: points(8) = 0
    points(9) = 3: points(10) = 2: points(11) = 0
    points(12) = 4: points(13) = 4: points(14) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    oML.TextLeftAttachmentType = acAttachmentBottomLine
    oML.TextRightAttachmentType = acAttachmentMiddleOfBottom
    oML.TextBackgroundFill = False
    oML.TextDirection = acLeftToRight
    oML.TextHeight = 2.3
    oML.TextJustify = acAttachmentPointMiddleLeft
    oML.TextLineSpacingDistance = 2.4
    oML.TextLineSpacingFactor = 1.2
    oML.TextLineSpacingStyle = acLineSpacingStyleExactly
    oML.TextWidth = 7.4

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextManipulation()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the leader points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill points '(1 1 0
                                  1 2 0
                                  2 2 0
                                  3 2 0
                                  4 4 0
                                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (vla-put-TextLeftAttachmentType oML acAttachmentBottomLine)
    (vla-put-TextRightAttachmentType oML acAttachmentMiddleOfBottom)
    (vla-put-TextBackgroundFill oML :vlax-false)
    (vla-put-TextDirection oML acLeftToRight)
    (vla-put-TextHeight oML 2.3)
    (vla-put-TextJustify oML acAttachmentPointMiddleLeft)
    (vla-put-TextLineSpacingDistance oML 2.4)
    (vla-put-TextLineSpacingFactor oML 1.2)
    (vla-put-TextLineSpacingStyle oML acLineSpacingStyleExactly)
    (vla-put-TextWidth oML 7.4)
)


TextEditor Property (ActiveX)

Specifies the name of the text editor for the MTEXT command.

Supported platforms: Windows only

Signature

VBA:

object.TextEditor
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The name of the multiline text editor.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_TextEditor()
    ' This example returns the current setting of
    ' TextEditor. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currTextEditor As String
    Dim newTextEditor As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current TextEditor value
    currTextEditor = preferences.Files.TextEditor
    MsgBox "The current value for TextEditor is " & currTextEditor, vbInformation, "TextEditor Example"

    ' Change the value for TextEditor
    newTextEditor = "TestTextEditor"
    preferences.Files.TextEditor = newTextEditor
    MsgBox "The new value for TextEditor is " & newTextEditor, vbInformation, "TextEditor Example"

    ' Reset TextEditor to its original value
    preferences.Files.TextEditor = currTextEditor
    MsgBox "The TextEditor value is reset to " & currTextEditor, vbInformation, "TextEditor Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextEditor()
    ;; This example returns the current setting of
    ;; TextEditor. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current TextEditor value
    (setq currTextEditor (vla-get-TextEditor (vla-get-Files preferences)))
    (alert (strcat "The current value for TextEditor is " currTextEditor))

    ;; Change the value for TextEditor
    (setq newTextEditor "TestTextEditor")
    (vla-put-TextEditor (vla-get-Files preferences) newTextEditor)
    (alert (strcat "The new value for TextEditor is " newTextEditor))

    ;; Reset TextEditor to its original value
    (vla-put-TextEditor (vla-get-Files preferences) currTextEditor)
    (alert (strcat "The TextEditor value is reset to " currTextEditor))
)


TextFill Property (ActiveX)

Sets fill color On or Off.

Supported platforms: Windows only

Signature

VBA:

object.TextFill
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Fill color is enabled
  • False: Fill color is disabled

Remarks

NoteThis property overrides the value of the DIMTFILL system variable.

Examples

VBA:

Not available

Visual LISP:

Not available


TextFillColor Property (ActiveX)

Sets text fill color.

Supported platforms: Windows only

Signature

VBA:

object.TextFillColor
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: ACAD_COLOR

The text fill color assigned to the object.

Remarks

NoteThis property overrides the value of the DIMTFILLCLR system variable.

Examples

VBA:

Not available

Visual LISP:

Not available


TextFont Property (ActiveX)

Specifies the font for new text.

Supported platforms: Windows only

Signature

VBA:

object.TextFont
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: String

The name of the new font.

Remarks

The initial value for this property is Courier.

Examples

VBA:

Sub Example_TextFont()
    ' This example returns the current setting of
    ' TextFont. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currTextFont As String

    Set preferences = ThisDrawing.Application.Preferences

    ' Retrieve the current TextFont value
    currTextFont = preferences.Display.TextFont
    MsgBox "The current value for TextFont is " & preferences.Display.TextFont, vbInformation, "TextFont Example"

    ' Change the value for TextFont
    preferences.Display.TextFont = "TestTextFont"
    MsgBox "The new value for TextFont is " & preferences.Display.TextFont, vbInformation, "TextFont Example"

    ' Reset TextFont to its original value
    preferences.Display.TextFont = currTextFont
    MsgBox "The TextFont value is reset to " & preferences.Display.TextFont, vbInformation, "TextFont Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextFont()
    ;; This example returns the current setting of
    ;; TextFont. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current TextFont value
    (setq currTextFont (vla-get-TextFont (vla-get-Display preferences)))
    (alert (strcat "The current value for TextFont is " currTextFont))

    ;; Change the value for TextFont
    (vla-put-TextFont (vla-get-Display preferences) "TestTextFont")
    (alert (strcat "The new value for TextFont is " (vla-get-TextFont (vla-get-Display preferences))))

    ;; Reset TextFont to its original value
    (vla-put-TextFont (vla-get-Display preferences) currTextFont)
    (alert (strcat "The TextFont value is reset to " (vla-get-TextFont (vla-get-Display preferences))))
)


TextFontSize Property (ActiveX)

Specifies the font size for new text.

Supported platforms: Windows only

Signature

VBA:

object.TextFontSize
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: Integer

The font size for new text. The limit for the font size is determined by the font.

Remarks

The initial value for this property is 10.

Examples

VBA:

Sub Example_TextFontSize()
    ' This example returns the current setting of
    ' TextFontSize. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currTextFontSize As Integer

    Set preferences = ThisDrawing.Application.Preferences

    ' Retrieve the current TextFontSize value
    currTextFontSize = preferences.Display.TextFontSize
    MsgBox "The current value for TextFontSize is " & preferences.Display.TextFontSize, vbInformation, "TextFontSize Example"

    ' Change the value for TextFontSize
    preferences.Display.TextFontSize = 12
    MsgBox "The new value for TextFontSize is " & preferences.Display.TextFontSize, vbInformation, "TextFontSize Example"

    ' Reset TextFontSize to its original value
    preferences.Display.TextFontSize = currTextFontSize
    MsgBox "The TextFontSize value is reset to " & preferences.Display.TextFontSize, vbInformation, "TextFontSize Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextFontSize()
    ;; This example returns the current setting of
    ;; TextFontSize. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current TextFontSize value
    (setq currTextFontSize (vla-get-TextFontSize (vla-get-Display preferences)))
    (alert (strcat "The current value for TextFontSize is " (itoa currTextFontSize)))

    ;; Change the value for TextFontSize
    (vla-put-TextFontSize (vla-get-Display preferences) 12)
    (alert (strcat "The new value for TextFontSize is " (itoa (vla-get-TextFontSize (vla-get-Display preferences)))))

    ;; Reset TextFontSize to its original value
    (vla-put-TextFontSize (vla-get-Display preferences) currTextFontSize)
    (alert (strcat "The TextFontSize value is reset to " (itoa (vla-get-TextFontSize (vla-get-Display preferences)))))
)


TextFontStyle Property (ActiveX)

Specifies the font style for new text.

Supported platforms: Windows only

Signature

VBA:

object.TextFontStyle
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: acTextFontStyle enum

  • acFontRegular
  • acFontItalic
  • acFontBold
  • acFontBoldItalic

Remarks

The initial value for this property is acFontRegular.

Examples

VBA:

Sub Example_TextFontStyle()
    ' This example returns the current setting of
    ' TextFontStyle. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currTextFontStyle As Integer
    Dim constant As String
    Dim newConstant As String

    Set preferences = ThisDrawing.Application.Preferences

    ' Retrieve the current TextFontStyle value
    currTextFontStyle = preferences.Display.TextFontStyle
    constant = Choose(currTextFontStyle + 1, "acFontRegular", "acFontItalic", "acFontBold", "acFontBoldItalic")
    MsgBox "The current value for TextFontStyle is " & constant, vbInformation, "TextFontStyle Example"

    ' Change the value for TextFontStyle
    newConstant = "acFontBoldItalic"
    preferences.Display.TextFontStyle = acFontBoldItalic
    MsgBox "The new value for TextFontStyle is " & newConstant, vbInformation, "TextFontStyle Example"

    ' Reset TextFontStyle to its original value
    preferences.Display.TextFontStyle = currTextFontStyle
    MsgBox "The TextFontStyle value is reset to " & constant, vbInformation, "TextFontStyle Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextFontStyle()
    ;; This example returns the current setting of
    ;; TextFontStyle. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current TextFontStyle value
    (setq currTextFontStyle (vla-get-TextFontStyle (vla-get-Display preferences)))
    (setq constant (cond
                       ((= currTextFontStyle acFontRegular) "acFontRegular")
                       ((= currTextFontStyle acFontItalic) "acFontItalic")
                       ((= currTextFontStyle acFontBold) "acFontBold")
                       ((= currTextFontStyle acFontBoldItalic) "acFontBoldItalic")
                   ))

    (alert (strcat "The current value for TextFontStyle is " constant))

    ;; Change the value for TextFontStyle
    (vla-put-TextFontStyle (vla-get-Display preferences) acFontBoldItalic)
    (setq newTextFontStyle (vla-get-TextFontStyle (vla-get-Display preferences)))
    (setq newConstant (cond
                       ((= newTextFontStyle acFontRegular) "acFontRegular")
                       ((= newTextFontStyle acFontItalic) "acFontItalic")
                       ((= newTextFontStyle acFontBold) "acFontBold")
                       ((= newTextFontStyle acFontBoldItalic) "acFontBoldItalic")
                   ))
    (alert (strcat "The new value for TextFontStyle is " newConstant))

    ;; Reset TextFontStyle to its original value
    (vla-put-TextFontStyle (vla-get-Display preferences) currTextFontStyle)
    (alert (strcat "The TextFontStyle value is reset to " constant))
)


TextFrameDisplay Property (ActiveX)

Toggles the display of frames around the multileader text content with a text box or for text objects instead of displaying the text itself.

Supported platforms: Windows only

Signature

VBA:

object.TextFrameDisplay
object

Type: DatabasePreferences, GeoPositionMarker, MLeader

The objects this property applies to.

Property Value - DatabasePreferences

Read-only: No

Type: Boolean

  • True: Displays the frame around the extents of the text, but does not display the text itself.
  • False: Displays the full text.

Property Value - GeoPositionMarker, MLeader

Read-only: No

Type: Boolean

  • True: Frame is displayed
  • False: Frame is not displayed

Remarks

The initial value for this property is False.

DatabasePreferences: After you enable or disable this option, you must use the Regen method to update the display.

NoteThe value of this property for the DatabasePreferences object is stored in the QTEXTMODE system variable.

Examples

VBA:

Sub Example_TextFrameDisplay()
    ' This example returns the current setting of
    ' TextFrameDisplay. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim currTextFrameDisplay As Boolean

    ' Retrieve the current TextFrameDisplay value
    currTextFrameDisplay = ThisDrawing.Preferences.TextFrameDisplay
    MsgBox "The current value for TextFrameDisplay is " & Preferences.TextFrameDisplay, vbInformation, "TextFrameDisplay Example"

    ' Change the value for TextFrameDisplay
    ThisDrawing.Preferences.TextFrameDisplay = Not (currTextFrameDisplay)
    MsgBox "The new value for TextFrameDisplay is " & Preferences.TextFrameDisplay, vbInformation, "TextFrameDisplay Example"

    ' Reset TextFrameDisplay to its original value
    ThisDrawing.Preferences.TextFrameDisplay = currTextFrameDisplay
    MsgBox "The TextFrameDisplay value is reset to " & Preferences.TextFrameDisplay, vbInformation, "TextFrameDisplay Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextFrameDisplay()
    ;; This example returns the current setting of
    ;; TextFrameDisplay. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences doc))

    ;; Retrieve the current TextFrameDisplay value
    (setq currTextFrameDisplay (vla-get-TextFrameDisplay preferences))
    (alert (strcat "The current value for TextFrameDisplay is " (if (= currTextFrameDisplay :vlax-true) "True" "False")))

    ;; Change the value for TextFrameDisplay
    (vla-put-TextFrameDisplay preferences (if (= currTextFrameDisplay :vlax-true) :vlax-false :vlax-true))
    (alert (strcat "The new value for TextFrameDisplay is " (if (= (vla-get-TextFrameDisplay preferences) :vlax-true) "True" "False")))

    ;; Reset TextFrameDisplay to its original value
    (vla-put-TextFrameDisplay preferences currTextFrameDisplay)
    (alert (strcat "The TextFrameDisplay value is reset to " (if (= (vla-get-TextFrameDisplay preferences) :vlax-true) "True" "False")))
)


TextGap Property (ActiveX)

Specifies the distance between the dimension text and the dimension line when you break the dimension line to accommodate dimension text.

Supported platforms: Windows only

Signature

VBA:

object.TextGap
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated, Leader

The objects this property applies to.

Property Value

Read-only: No

Type: Double

A real number specifying the gap distance.

Remarks

This property also sets the gap between the annotation and a hook line on a Leader object.

A negative value creates basic dimensioning (dimension text with a box around the text).

NoteThis property overrides the value of the DIMGAP system variable for the given dimension.

Examples

VBA:

Sub Example_TextGap()
   ' This example creates an aligned dimension in model space and
   ' uses the TextGap property to increase the distance between the
   ' dimension line and the dimension text

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 5.5: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ThisDrawing.Application.ZoomAll

    ' Read and display current dimension gap
    MsgBox "The dimension gap for this object is currently set to: " & dimObj.TextGap

    ' Increase the distance of the dimension gap
    dimObj.TextGap = 0.5
    ThisDrawing.Regen acAllViewports

    ' Read and display current dimension gap
    MsgBox "The dimension gap for this object is now set to: " & dimObj.TextGap

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextGap()
    ;; This example creates an aligned dimension in model space and
    ;; uses the TextGap property to increase the distance between the
    ;; dimension line and the dimension text
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 5.5 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    ;; Read and display current dimension gap
    (alert (strcat "The dimension gap for this object is currently set to: " (rtos (vla-get-TextGap dimObj) 2)))

    ;; Increase the distance of the dimension gap
    (vla-put-TextGap dimObj 0.5)
    (vla-Regen doc acAllViewports)

    ;; Read and display current dimension gap
    (alert (strcat "The dimension gap for this object is now set to: " (rtos (vla-get-TextGap dimObj) 2)))
)


TextGenerationFlag Property (ActiveX)

Specifies the attribute text generation flag.

Supported platforms: Windows only

Signature

VBA:

object.TextGenerationFlag
object

Type: Attribute, AttributeReference, Text, TextStyle

The objects this property applies to.

Property Value

Read-only: No

Type: acTextGenerationFlag enum

  • acTextFlagBackward
  • acTextFlagUpsideDown

Remarks

To specify both flags, add them together.

Examples

VBA:

Sub Example_TextGenerationFlag()
    ' This example creates a text object in model space.
    ' It then changes the TextGenerationFlag of the text object.

    Dim textObj As AcadText
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double

    ' Define the text object
    textString = "Hello, World."
    insertionPoint(0) = 3: insertionPoint(1) = 3: insertionPoint(2) = 0
    height = 0.5

    ' Create the text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)
    ZoomAll
    MsgBox "The TextGenerationFlag has not been set.", vbInformation, "TextGenerationFlag Example"

    ' Change the value of the TextGenerationFlag
    textObj.TextGenerationFlag = acTextFlagBackward
    ZoomAll
    MsgBox "The TextGenerationFlag is set to acTextFlagBackward.", vbInformation, "TextGenerationFlag Example"

    textObj.TextGenerationFlag = acTextFlagUpsideDown
    ZoomAll
    MsgBox "The TextGenerationFlag is set to acTextFlagUpsideDown.", vbInformation, "TextGenerationFlag Example"

    textObj.TextGenerationFlag = acTextFlagBackward + acTextFlagUpsideDown
    ZoomAll
    MsgBox "The TextGenerationFlag is set to acTextFlagBackward + acTextFlagUpsideDown.", vbInformation, "TextGenerationFlag Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextGenerationFlag()
    ;; This example creates a text object in model space.
    ;; It then changes the TextGenerationFlag of the text object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the text object
    (setq insertionPoint (vlax-3d-point 3 3 0)
          textString "Hello, World."
          height 0.5)

    ;; Create the text object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq textObj (vla-AddText modelSpace textString insertionPoint height))
    (vla-ZoomAll acadObj)

    (alert "The TextGenerationFlag has not been set.")

    ;; Change the value of the TextGenerationFlag
    (vla-put-TextGenerationFlag textObj acTextFlagBackward)
    (vla-ZoomAll acadObj)
    (alert "The TextGenerationFlag is set to acTextFlagBackward.")

    (vla-put-TextGenerationFlag textObj acTextFlagUpsideDown)
    (vla-ZoomAll acadObj)
    (alert "The TextGenerationFlag is set to acTextFlagUpsideDown.")

    (vla-put-TextGenerationFlag textObj (+ acTextFlagBackward acTextFlagUpsideDown))
    (vla-ZoomAll acadObj)
    (alert "The TextGenerationFlag is set to acTextFlagBackward + acTextFlagUpsideDown.")
)


TextHeight Property (ActiveX)

Specifies the height for the dimension or tolerance text.

Supported platforms: Windows only

Signature

VBA:

object.TextHeight
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated, MLeader, MLeaderStyle, Tolerance

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The height for the dimension text.

Remarks

The initial value for this property is 0.1800.

If the current text style has a fixed text height, this property is ignored.

NoteThis property overrides the value of the DIMTXT system variable for the given dimension.

Examples

VBA:

Sub Example_TextHeight()
    ' This example creates an aligned dimension in model space and
    ' uses the TextHeight property to increase the height of the
    ' dimension text

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 5.5: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ThisDrawing.Application.ZoomAll

    ' Read and display current dimension text height
    MsgBox "The dimension text height for this object is currently set to: " & dimObj.textHeight

    ' Increase the distance of the dimension gap
    dimObj.TextHeight = 1
    ThisDrawing.Regen acAllViewports

    ' Read and display current dimension text height
    MsgBox "The dimension text height for this object is now set to: " & dimObj.textHeight

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextHeight()
    ;; This example creates an aligned dimension in model space and
    ;; uses the TextHeight property to increase the height of the
    ;; dimension text
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 5.5 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    ;; Read and display current dimension text height
    (alert (strcat "The dimension text height for this object is currently set to: " (rtos (vla-get-TextHeight dimObj) 2)))

    ;; Increase the distance of the dimension gap
    (vla-put-TextHeight dimObj 1)
    (vla-Regen doc acAllViewports)

    ;; Read and display current dimension text height
    (alert (strcat "The dimension text height for this object is now set to: " (rtos (vla-get-TextHeight dimObj) 2)))
)


TextInside Property (ActiveX)

Specifies if the dimension text is to be drawn inside the extension lines.

Supported platforms: Windows only

Signature

VBA:

object.TextInside
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Force the dimension text between the extension lines.
  • False: Draw dimension text inside the extension lines only if there is sufficient room.

Remarks

The initial value for this property is True.

Setting this property to False has varying results. For linear and angular dimensions, AutoCAD places text inside the extension lines if there is sufficient room. For radius and diameter dimensions that do not fit inside the circle or arc, this property has no effect and always forces the text outside the circle or arc.

NoteThis property overrides the value of the DIMTIX system variable for the given dimension.

Examples

VBA:

Sub Example_TextInside()
    ' This example creates an aligned dimension in model space and
    ' allows the user to toggle, forcing the dimension text between the extension lines
    ' using the TextInside property

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim CurrentValue As String

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 5.5: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ThisDrawing.Application.ZoomAll

Toggle:
    Select Case MsgBox("Press OK to toggle forcing the dimension text inside the extension lines", vbOKCancel)
        Case vbOK
            ' Toggle forcing the dimension text inside the extension lines
            dimObj.TextInside = Not (dimObj.TextInside)
            ThisDrawing.Regen acAllViewports

            ' Read and display the new dimension TextInside value
            CurrentValue = IIf(dimObj.TextInside, "is now", "is not")
            MsgBox "The dimension text " & CurrentValue & " forced inside the extension lines"

        Case vbCancel
            Exit Sub
    End Select

    GoTo Toggle

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextInside()
    ;; This example creates an aligned dimension in model space and
    ;; allows the user to toggle, forcing the dimension text between the extension lines
    ;; using the TextInside property
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 5.5 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    ;; Toggle forcing the dimension text inside the extension lines
    (vla-put-TextInside dimObj (if (= (vla-get-TextInside dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)

    ;; Read and display the new dimension TextInside value
    (setq CurrentValue (if (= (vla-get-TextInside dimObj) :vlax-true) "is now" "is not"))
    (alert (strcat "The dimension text " CurrentValue " forced inside the extension lines"))

    ;; Toggle forcing the dimension text inside the extension lines
    (vla-put-TextInside dimObj (if (= (vla-get-TextInside dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)

    ;; Read and display the new dimension TextInside value
    (setq CurrentValue (if (= (vla-get-TextInside dimObj) :vlax-true) "is now" "is not"))
    (alert (strcat "The dimension text " CurrentValue " forced inside the extension lines"))
)


TextInsideAlign Property (ActiveX)

Specifies the position of dimension text inside the extension lines for all dimension types except ordinate.

Supported platforms: Windows only

Signature

VBA:

object.TextInsideAlign
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Align the text horizontally.
  • False: Align the text with the dimension line.

Remarks

The initial value for this property is True.

This property is only available when the TextInside property is set to True.

NoteThis property overrides the value of the DIMTIH system variable for the given dimension.

Examples

VBA:

Sub Example_TextInsideAlign()
    ' This example creates an aligned dimension in model space and
    ' allows the user to toggle the TextInsideAlign value for the dimension

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 5.5: point2(1) = 6: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    dimObj.TextInside = True    ' The TextInsideAlign property will only work
                                ' when this property is active

    ThisDrawing.Application.ZoomAll

Toggle:
    Select Case MsgBox("Press OK to toggle the TextInsideAlign value for this dimension", vbOKCancel)
        Case vbOK
            ' Toggle the TextInsideAlign value for this dimension
            dimObj.TextInsideAlign = Not (dimObj.TextInsideAlign)
            ThisDrawing.Regen acAllViewports

            ' Read and display the new dimension TextInsideAlign value
            MsgBox "TextInsideAlign is currently set to: " & dimObj.TextInsideAlign

        Case vbCancel
            Exit Sub
    End Select

    GoTo Toggle

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextInsideAlign()
    ;; This example creates an aligned dimension in model space and
    ;; allows the user to toggle the TextInsideAlign value for the dimension
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 5.5 6 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    (vla-put-TextInside dimObj :vlax-true)    ;; The TextInsideAlign property will only work
                                              ;; when this property is active

    (vla-ZoomAll acadObj)

    ;; Toggle the TextInsideAlign value for this dimension
    (vla-put-TextInsideAlign dimObj (if (= (vla-get-TextInsideAlign dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)

    ;; Read and display the new dimension TextInsideAlign value
    (alert (strcat "TextInsideAlign is currently set to: " (if (= (vla-get-TextInsideAlign dimObj) :vlax-true) "True" "False")))

    ;; Toggle the TextInsideAlign value for this dimension
    (vla-put-TextInsideAlign dimObj (if (= (vla-get-TextInsideAlign dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)

    ;; Read and display the new dimension TextInsideAlign value
    (alert (strcat "TextInsideAlign is currently set to: " (if (= (vla-get-TextInsideAlign dimObj) :vlax-true) "True" "False")))
)


TextJustify Property (ActiveX)

Specifies the attachment point of the MText.

Supported platforms: Windows only

Signature

VBA:

object.TextJustify
object

Type: GeoPositionMarker, MLeader

The object this property applies to.

Property Value

Read-only: No

Type: AcAttachmentPoint enum

  • acAttachmentPointBottomCenter
  • acAttachmentPointBottomLeft
  • acAttachmentPointBottomRight
  • acAttachmentPointMiddleCenter
  • acAttachmentPointMiddleLeft
  • acAttachmentPointMiddleRight
  • acAttachmentPointTopCenter
  • acAttachmentPointTopLeft
  • acAttachmentPointTopRight

Remarks

No additional remarks.

Examples

VBA:

Sub Example_TextManipulation()
    Dim oML As AcadMLeader
    Dim points(0 To 14) As Double

    ' Define the leader points
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 1: points(4) = 2: points(5) = 0
    points(6) = 2: points(7) = 2: points(8) = 0
    points(9) = 3: points(10) = 2: points(11) = 0
    points(12) = 4: points(13) = 4: points(14) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    oML.TextLeftAttachmentType = acAttachmentBottomLine
    oML.TextRightAttachmentType = acAttachmentMiddleOfBottom
    oML.TextBackgroundFill = False
    oML.TextDirection = acLeftToRight
    oML.TextHeight = 2.3
    oML.TextJustify = acAttachmentPointMiddleLeft
    oML.TextLineSpacingDistance = 2.4
    oML.TextLineSpacingFactor = 1.2
    oML.TextLineSpacingStyle = acLineSpacingStyleExactly
    oML.TextWidth = 7.4

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextManipulation()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the leader points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill points '(1 1 0
                                  1 2 0
                                  2 2 0
                                  3 2 0
                                  4 4 0
                                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (vla-put-TextLeftAttachmentType oML acAttachmentBottomLine)
    (vla-put-TextRightAttachmentType oML acAttachmentMiddleOfBottom)
    (vla-put-TextBackgroundFill oML :vlax-false)
    (vla-put-TextDirection oML acLeftToRight)
    (vla-put-TextHeight oML 2.3)
    (vla-put-TextJustify oML acAttachmentPointMiddleLeft)
    (vla-put-TextLineSpacingDistance oML 2.4)
    (vla-put-TextLineSpacingFactor oML 1.2)
    (vla-put-TextLineSpacingStyle oML acLineSpacingStyleExactly)
    (vla-put-TextWidth oML 7.4)
)


TextLeftAttachmentType Property (ActiveX)

Specify how leaders on the left side connect with the text.

Supported platforms: Windows only

Signature

VBA:

object.TextLeftAttachmentType
object

Type: MLeader, MLeaderStyle

The objects this property applies to.

Property Value

Read-only: No

Type: AcTextAttachmentType enum

  • acAttachmentAllLine
  • acAttachmentBottomLine
  • acAttachmentBottomOfBottom
  • acAttachmentBottomOfTop
  • acAttachmentBottomOfTopLine
  • acAttachmentMiddle
  • acAttachmentMiddleOfBottom
  • acAttachmentMiddleOfTop
  • acAttachmentTopOfTop

Remarks

No additional remarks.

Examples

VBA:

Sub Example_TextManipulation()
    Dim oML As AcadMLeader
    Dim points(0 To 14) As Double

    ' Define the leader points
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 1: points(4) = 2: points(5) = 0
    points(6) = 2: points(7) = 2: points(8) = 0
    points(9) = 3: points(10) = 2: points(11) = 0
    points(12) = 4: points(13) = 4: points(14) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    oML.TextLeftAttachmentType = acAttachmentBottomLine
    oML.TextRightAttachmentType = acAttachmentMiddleOfBottom
    oML.TextBackgroundFill = False
    oML.TextDirection = acLeftToRight
    oML.TextHeight = 2.3
    oML.TextJustify = acAttachmentPointMiddleLeft
    oML.TextLineSpacingDistance = 2.4
    oML.TextLineSpacingFactor = 1.2
    oML.TextLineSpacingStyle = acLineSpacingStyleExactly
    oML.TextWidth = 7.4

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextManipulation()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the leader points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill points '(1 1 0
                                  1 2 0
                                  2 2 0
                                  3 2 0
                                  4 4 0
                                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (vla-put-TextLeftAttachmentType oML acAttachmentBottomLine)
    (vla-put-TextRightAttachmentType oML acAttachmentMiddleOfBottom)
    (vla-put-TextBackgroundFill oML :vlax-false)
    (vla-put-TextDirection oML acLeftToRight)
    (vla-put-TextHeight oML 2.3)
    (vla-put-TextJustify oML acAttachmentPointMiddleLeft)
    (vla-put-TextLineSpacingDistance oML 2.4)
    (vla-put-TextLineSpacingFactor oML 1.2)
    (vla-put-TextLineSpacingStyle oML acLineSpacingStyleExactly)
    (vla-put-TextWidth oML 7.4)
)


TextLineSpacingDistance Property (ActiveX)

Specifies the line spacing distance of the MText content in the multileader object.

Supported platforms: Windows only

Signature

VBA:

object.TextLineSpacingDistance
object

Type: MLeader

The object this property applies to.

Property Value

Read-only: No

Type: Double

The line spacing distance of the MText content.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_TextManipulation()
    Dim oML As AcadMLeader
    Dim points(0 To 14) As Double

    ' Define the leader points
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 1: points(4) = 2: points(5) = 0
    points(6) = 2: points(7) = 2: points(8) = 0
    points(9) = 3: points(10) = 2: points(11) = 0
    points(12) = 4: points(13) = 4: points(14) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    oML.TextLeftAttachmentType = acAttachmentBottomLine
    oML.TextRightAttachmentType = acAttachmentMiddleOfBottom
    oML.TextBackgroundFill = False
    oML.TextDirection = acLeftToRight
    oML.TextHeight = 2.3
    oML.TextJustify = acAttachmentPointMiddleLeft
    oML.TextLineSpacingDistance = 2.4
    oML.TextLineSpacingFactor = 1.2
    oML.TextLineSpacingStyle = acLineSpacingStyleExactly
    oML.TextWidth = 7.4

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextManipulation()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the leader points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill points '(1 1 0
                                  1 2 0
                                  2 2 0
                                  3 2 0
                                  4 4 0
                                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (vla-put-TextLeftAttachmentType oML acAttachmentBottomLine)
    (vla-put-TextRightAttachmentType oML acAttachmentMiddleOfBottom)
    (vla-put-TextBackgroundFill oML :vlax-false)
    (vla-put-TextDirection oML acLeftToRight)
    (vla-put-TextHeight oML 2.3)
    (vla-put-TextJustify oML acAttachmentPointMiddleLeft)
    (vla-put-TextLineSpacingDistance oML 2.4)
    (vla-put-TextLineSpacingFactor oML 1.2)
    (vla-put-TextLineSpacingStyle oML acLineSpacingStyleExactly)
    (vla-put-TextWidth oML 7.4)
)


TextLineSpacingFactor Property (ActiveX)

Specifies the line spacing factor of the MText content in the multileader object.

Supported platforms: Windows only

Signature

VBA:

object.TextLineSpacingFactor
object

Type: MLeader

The object this property applies to.

Property Value

Read-only: No

Type: Double

The line spacing factor of the MText content.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_TextManipulation()
    Dim oML As AcadMLeader
    Dim points(0 To 14) As Double

    ' Define the leader points
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 1: points(4) = 2: points(5) = 0
    points(6) = 2: points(7) = 2: points(8) = 0
    points(9) = 3: points(10) = 2: points(11) = 0
    points(12) = 4: points(13) = 4: points(14) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    oML.TextLeftAttachmentType = acAttachmentBottomLine
    oML.TextRightAttachmentType = acAttachmentMiddleOfBottom
    oML.TextBackgroundFill = False
    oML.TextDirection = acLeftToRight
    oML.TextHeight = 2.3
    oML.TextJustify = acAttachmentPointMiddleLeft
    oML.TextLineSpacingDistance = 2.4
    oML.TextLineSpacingFactor = 1.2
    oML.TextLineSpacingStyle = acLineSpacingStyleExactly
    oML.TextWidth = 7.4

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextManipulation()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the leader points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill points '(1 1 0
                                  1 2 0
                                  2 2 0
                                  3 2 0
                                  4 4 0
                                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (vla-put-TextLeftAttachmentType oML acAttachmentBottomLine)
    (vla-put-TextRightAttachmentType oML acAttachmentMiddleOfBottom)
    (vla-put-TextBackgroundFill oML :vlax-false)
    (vla-put-TextDirection oML acLeftToRight)
    (vla-put-TextHeight oML 2.3)
    (vla-put-TextJustify oML acAttachmentPointMiddleLeft)
    (vla-put-TextLineSpacingDistance oML 2.4)
    (vla-put-TextLineSpacingFactor oML 1.2)
    (vla-put-TextLineSpacingStyle oML acLineSpacingStyleExactly)
    (vla-put-TextWidth oML 7.4)
)


TextLineSpacingStyle Property (ActiveX)

Specifies the line spacing style of the MText content in the multileader object.

Supported platforms: Windows only

Signature

VBA:

object.TextLineSpacingStyle
object

Type: MLeader

The object this property applies to.

Property Value

Read-only: No

Type: AcLineSpacingStyle enum

The line spacing style of the MText content.

  • acLineSpacingStyleAtLeast
  • acLineSpacingStyleExactly

Remarks

No additional remarks.

Examples

VBA:

Sub Example_TextManipulation()
    Dim oML As AcadMLeader
    Dim points(0 To 14) As Double

    ' Define the leader points
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 1: points(4) = 2: points(5) = 0
    points(6) = 2: points(7) = 2: points(8) = 0
    points(9) = 3: points(10) = 2: points(11) = 0
    points(12) = 4: points(13) = 4: points(14) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    oML.TextLeftAttachmentType = acAttachmentBottomLine
    oML.TextRightAttachmentType = acAttachmentMiddleOfBottom
    oML.TextBackgroundFill = False
    oML.TextDirection = acLeftToRight
    oML.TextHeight = 2.3
    oML.TextJustify = acAttachmentPointMiddleLeft
    oML.TextLineSpacingDistance = 2.4
    oML.TextLineSpacingFactor = 1.2
    oML.TextLineSpacingStyle = acLineSpacingStyleExactly
    oML.TextWidth = 7.4

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextManipulation()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the leader points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill points '(1 1 0
                                  1 2 0
                                  2 2 0
                                  3 2 0
                                  4 4 0
                                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (vla-put-TextLeftAttachmentType oML acAttachmentBottomLine)
    (vla-put-TextRightAttachmentType oML acAttachmentMiddleOfBottom)
    (vla-put-TextBackgroundFill oML :vlax-false)
    (vla-put-TextDirection oML acLeftToRight)
    (vla-put-TextHeight oML 2.3)
    (vla-put-TextJustify oML acAttachmentPointMiddleLeft)
    (vla-put-TextLineSpacingDistance oML 2.4)
    (vla-put-TextLineSpacingFactor oML 1.2)
    (vla-put-TextLineSpacingStyle oML acLineSpacingStyleExactly)
    (vla-put-TextWidth oML 7.4)
)


TextMovement Property (ActiveX)

Specifies how dimension text is drawn when text is moved.

Supported platforms: Windows only

Signature

VBA:

object.TextMovement
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: acDimTextMovement enum

  • acDimLineWithText: The dimension line follows the text.
  • acMoveTextAddLeader: The text moves independently of the dimension line, with a leader drawn from the text to the dimension line.
  • acMoveTextNoLeader: The text moves independently of the dimension line, with no leader drawn from the text to the dimension line.

Remarks

The initial value for this property is acMoveTextNoLeader.

NoteThis property overrides the value of the DIMTMOVE system variable for the given dimension.

Examples

VBA:

Sub Example_TextMovement()
    ' This example creates two aligned dimensions in model space and
    ' sets the TextMovement property of each one differently to allow
    ' the user to see the differences this property makes when moving
    ' dimension text
    '
    ' To see the effects of this property:
    ' 1) Run this sample
    ' 2) Enter the drawing and move the dimension text of the leftmost object
    '    on the screen with the mouse or keyboard.
    ' 3) Notice the position of the dimension lines
    ' 4) Repeat with the rightmost object

    Dim dimObj1 As AcadDimAligned, dimObj2 As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim point3(0 To 2) As Double, point4(0 To 2) As Double
    Dim location1(0 To 2) As Double, location2(0 To 2) As Double

    ' Define the two dimensions
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 6: point2(1) = 5: point2(2) = 0
    location1(0) = 5: location1(1) = 7: location1(2) = 0

    point3(0) = 7: point3(1) = 5: point3(2) = 0
    point4(0) = 8: point4(1) = 5: point4(2) = 0
    location2(0) = 5: location2(1) = 7: location2(2) = 0

    ' Create the aligned dimension objects in model space
    Set dimObj1 = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location1)
    Set dimObj2 = ThisDrawing.ModelSpace.AddDimAligned(point3, point4, location2)

    ThisDrawing.Application.ZoomAll

    ' Set the text movement of the new dimensions to different values
    dimObj1.TextMovement = acMoveTextNoLeader
    location1(0) = 5.5: location1(1) = 7.5: location1(2) = 0
    dimObj1.TextPosition = location1
    dimObj2.TextMovement = acDimLineWithText
    location2(0) = 7.5: location2(1) = 7.5: location2(2) = 0
    dimObj2.TextPosition = location2

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextMovement()
    ;; This example creates two aligned dimensions in model space and
    ;; sets the TextMovement property of each one differently to allow
    ;; the user to see the differences this property makes when moving
    ;; dimension text
    ;;
    ;; To see the effects of this property:
    ;; 1) Run this sample
    ;; 2) Enter the drawing and move the dimension text of the leftmost object
    ;;    on the screen with the mouse or keyboard.
    ;; 3) Notice the position of the dimension lines
    ;; 4) Repeat with the rightmost object
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the two dimensions
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 6 5 0)
          location1 (vlax-3d-point 5 7 0))

    (setq point3 (vlax-3d-point 7 5 0)
          point4 (vlax-3d-point 8 5 0)
          location2 (vlax-3d-point 5 7 0))

    ;; Create the aligned dimension objects in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj1 (vla-AddDimAligned modelSpace point1 point2 location1))
    (setq dimObj2 (vla-AddDimAligned modelSpace point3 point4 location2))
    (vla-ZoomAll acadObj)

    ;; Set the text movement of the new dimensions to different values
    (vla-put-TextMovement dimObj1 acMoveTextNoLeader)
    (setq location1 (vlax-3d-point 5.5 7.5 0))
    (vla-put-TextPosition dimObj1 location1)
    (vla-put-TextMovement dimObj2 acDimLineWithText)
    (setq location2 (vlax-3d-point 7.5 7.5 0))
    (vla-put-TextPosition dimObj2 location2)
)


TextOutsideAlign Property (ActiveX)

Specifies the position of dimension text outside the extension lines for all dimension types except ordinate.

Supported platforms: Windows only

Signature

VBA:

object.TextOutsideAlign
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Align the text horizontally.
  • False: Align the text with the dimension line.

Remarks

The initial value for this property is True.

NoteThis property overrides the value of the DIMTOH system variable for the given dimension.

Examples

VBA:

Sub Example_TextOutsideAlign()
    ' This example creates an aligned dimension in model space and
    ' allows the user to toggle the TextOutsideAlign value for the dimension

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 5.5: point2(1) = 5.5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ThisDrawing.Application.ZoomAll

Toggle:
    Select Case MsgBox("Press OK to toggle the TextOutsideAlign value for this dimension", vbOKCancel)
        Case vbOK
            ' Toggle the TextOutsideAlign value for this dimension
            dimObj.TextOutsideAlign = Not (dimObj.TextOutsideAlign)
            dimObj.Update
            ThisDrawing.Regen acActiveViewport

            ' Read and display the new dimension TextOutsideAlign value
            MsgBox "TextOutsideAlign is currently set to: " & dimObj.TextOutsideAlign

        Case vbCancel
            Exit Sub
    End Select

    GoTo Toggle

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextOutsideAlign()
    ;; This example creates an aligned dimension in model space and
    ;; allows the user to toggle the TextOutsideAlign value for the dimension
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 5.5 5.5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    (vla-ZoomAll acadObj)

    ;; Toggle the TextOutsideAlign value for this dimension
    (vla-put-TextOutsideAlign dimObj (if (= (vla-get-TextOutsideAlign dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Update dimObj)
    (vla-Regen doc acActiveViewport)

    ;; Read and display the new dimension TextOutsideAlign value
    (alert (strcat "TextOutsideAlign is currently set to: " (if (= (vla-get-TextOutsideAlign dimObj) :vlax-true) "True" "False")))

    ;; Toggle the TextOutsideAlign value for this dimension
    (vla-put-TextOutsideAlign dimObj (if (= (vla-get-TextOutsideAlign dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Update dimObj)
    (vla-Regen doc acActiveViewport)

    ;; Read and display the new dimension TextOutsideAlign value
    (alert (strcat "TextOutsideAlign is currently set to: " (if (= (vla-get-TextOutsideAlign dimObj) :vlax-true) "True" "False")))
)


TextOverride Property (ActiveX)

Specifies the text string for the dimension.

Supported platforms: Windows only

Signature

VBA:

object.TextOverride
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: String

The maximum length is 256 characters.

Remarks

The user string replaces the calculated dimension value. You can revert to the calculated dimension value by setting the text to a NULL string (""). You can append or prefix text to the primary dimension value by using a closed set of brackets (<>) to represent the value. The primary dimension value will replace the brackets when the string is displayed. For example, TextString = "<> mm" will result in a displayed string of "3.5 mm" where the value of the dimension is 3.5. You can also include the secondary dimension value using square brackets ( [] ).

Examples

VBA:

Sub Example_TextOverride()
    ' This example creates an aligned dimension and then changes the
    ' TextOverride property for that dimension.

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5#: point1(1) = 3#: point1(2) = 0#
    point2(0) = 10#: point2(1) = 3#: point2(2) = 0#
    location(0) = 7.5: location(1) = 5#: location(2) = 0#

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ZoomAll
    MsgBox "The initial text string for the dimension contains only the dimension value.", vbInformation, "TextOverride Example"

    ' Change the text string for the dimension
    dimObj.TextOverride = "The value is <>"
    dimObj.Update
    MsgBox "The text string for the dimension has been replaced. However, the dimension value is still represented.", vbInformation, "TextOverride Example"

    ' Reset the text string for the dimension
    dimObj.TextOverride = ""
    dimObj.Update

    MsgBox "The text string for the dimension is reset.", vbInformation, "TextOverride Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextOverride()
    ;; This example creates an aligned dimension and then changes the
    ;; TextOverride property for that dimension.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 3 0)
          point2 (vlax-3d-point 10 3 0)
          location (vlax-3d-point 7.5 5 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    (vla-ZoomAll acadObj)
    (alert "The initial text string for the dimension contains only the dimension value.")

    ;; Change the text string for the dimension
    (vla-put-TextOverride dimObj "The value is <>")
    (vla-Update dimObj)
    (alert "The text string for the dimension has been replaced. However, the dimension value is still represented.")

    ;; Reset the text string for the dimension
    (vla-put-TextOverride dimObj "")
    (vla-Update dimObj)

    (alert "The text string for the dimension is reset.")
)


TextPosition Property (ActiveX)

Specifies the dimension text position.

Supported platforms: Windows only

Signature

VBA:

object.TextPosition
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

A 3D WCS coordinate representing the text position of the dimension.

Remarks

Examples

VBA:

Sub Example_TextPosition()
    ' This example creates an aligned dimension and then changes the
    ' TextPosition property for that dimension.

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5#: point1(1) = 3#: point1(2) = 0#
    point2(0) = 10#: point2(1) = 3#: point2(2) = 0#
    location(0) = 7.5: location(1) = 5#: location(2) = 0#

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ZoomAll
    MsgBox "The current text position for the dimension is " & dimObj.TextPosition(0) & ", " & dimObj.TextPosition(1) & ", " & dimObj.TextPosition(2), vbInformation, "TextPosition Example"

    ' Change the text position location
    location(0) = 8.5: location(1) = 7: location(2) = 0
    dimObj.TextPosition = location
    dimObj.Update

    ' Return the endpoint of the first extension line
    ' Note that the return value is a Variant
    Dim retPoint As Variant
    retPoint = dimObj.TextPosition

    MsgBox "The new text position for the dimension is " & dimObj.TextPosition(0) & ", " & dimObj.TextPosition(1) & ", " & dimObj.TextPosition(2), vbInformation, "TextPosition Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextPosition()
    ;; This example creates an aligned dimension and then changes the
    ;; TextPosition property for that dimension.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 3 0)
          point2 (vlax-3d-point 10 3 0)
          location (vlax-3d-point 7.5 5 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    (vla-ZoomAll acadObj)
    (setq textPosition (vlax-variant-value (vla-get-TextPosition dimObj)))
    (alert (strcat "The current text position for the dimension is " (rtos (vlax-safearray-get-element textPosition 0) 2) ", "
                                                                     (rtos (vlax-safearray-get-element textPosition 1) 2) ", "
                                                                     (rtos (vlax-safearray-get-element textPosition 2) 2)))

    ;; Change the text position location
    (setq location (vlax-3d-point 8.5 7 0))
    (vla-put-TextPosition dimObj location)
    (vla-Update dimObj)

    ;; Return the endpoint of the first extension line
    ;; Note that the return value is a Variant
    (setq retPoint (vlax-variant-value (vla-get-TextPosition dimObj)))

    (alert (strcat "The new text position for the dimension is " (rtos (vlax-safearray-get-element retPoint 0) 2) ", "
                                                                 (rtos (vlax-safearray-get-element retPoint 1) 2) ", "
                                                                 (rtos (vlax-safearray-get-element retPoint 2) 2)))
)


TextPrecision Property (ActiveX)

Specifies the precision of angular dimension text.

Supported platforms: Windows only

Signature

VBA:

object.TextPrecision
object

Type: Dim3PointAngular, DimAngular

The objects this property applies to.

Property Value

Read-only: No

Type: acDimPrecision enum

  • acDimPrecisionZero: 0.
  • acDimPrecisionOne: 0.0
  • acDimPrecisionTwo: 0.00
  • acDimPrecisionThree: 0.000
  • acDimPrecisionFour: 0.0000
  • acDimPrecisionFive: 0.00000
  • acDimPrecisionSix: 0.000000
  • acDimPrecisionSeven: 0.0000000
  • acDimPrecisionEight: 0.00000000

Remarks

NoteThis property overrides the value of the DIMADEC system variable for the given dimension.

Examples

VBA:

Sub Example_TextPrecision()
    ' This example creates a Dim3PointAngular object in model space and
    ' uses the TextPrecision property to set the precision of
    ' the dimension text to 4 decimal places

    Dim DimPointAngularObj As AcadDim3PointAngular
    Dim AngleVertex(0 To 2) As Double
    Dim FirstPoint(0 To 2) As Double, SecondPoint(0 To 2) As Double
    Dim TextPoint(0 To 2) As Double

    ' Define the new Dim3PointAngular object
    AngleVertex(0) = 0: AngleVertex(1) = 0: AngleVertex(2) = 0
    FirstPoint(0) = 2: FirstPoint(1) = 2: FirstPoint(2) = 0
    SecondPoint(0) = 1: SecondPoint(1) = 4: SecondPoint(2) = 0
    TextPoint(0) = 6: TextPoint(1) = 6: TextPoint(2) = 0

    ' Create the new Dim3PointAngular object in model space
    Set DimPointAngularObj = ThisDrawing.ModelSpace.AddDim3PointAngular(AngleVertex, FirstPoint, SecondPoint, TextPoint)
    ThisDrawing.Application.ZoomAll

    ' Read and display current dimension text precision
    MsgBox "The dimension text precision is currently set to: " & DimPointAngularObj.TextPrecision

    ' Increase the distance of the dimension gap
    DimPointAngularObj.TextPrecision = acDimPrecisionFour
    ThisDrawing.Regen acAllViewports

    ' Read and display current dimension text precision
    MsgBox "The dimension text precision is now set to: " & DimPointAngularObj.TextPrecision

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextPrecision()
    ;; This example creates a Dim3PointAngular object in model space and
    ;; uses the TextPrecision property to set the precision of
    ;; the dimension text to 4 decimal places
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Dim3PointAngular object
    (setq AngleVertex (vlax-3d-point 0 0 0)
          FirstPoint (vlax-3d-point 2 2 0)
          SecondPoint (vlax-3d-point 1 4 0)
          TextPoint (vlax-3d-point 6 6 0))

    ;; Create the new Dim3PointAngular object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimPointAngularObj (vla-AddDim3PointAngular modelSpace AngleVertex FirstPoint SecondPoint TextPoint))
    (vla-ZoomAll acadObj)

    ;; Read and display current dimension text precision
    (alert (strcat "The dimension text precision is currently set to: " (itoa (vla-get-TextPrecision dimPointAngularObj))))

    ;; Increase the distance of the dimension gap
    (vla-put-TextPrecision dimPointAngularObj acDimPrecisionFour)
    (vla-Regen doc acAllViewports)

    ;; Read and display current dimension text precision
    (alert (strcat "The dimension text precision is now set to: " (rtos (vla-get-TextPrecision dimPointAngularObj) 2)))
)


TextPrefix Property (ActiveX)

Specifies the dimension value prefix.

Supported platforms: Windows only

Signature

VBA:

object.TextPrefix
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: String

The prefix for the dimension value.

Remarks

The initial value for this property is "".

NoteThis property overrides the value of the DIMPOST system variable for the given dimension.

Examples

VBA:

Sub Example_TextPrefix()
    ' This example creates an aligned dimension in model space and
    ' uses TextPrefix to allow the user to change the text prefix for the
    ' dimension

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim prefix As String

    ' Define the dimension
    point1(0) = 0: point1(1) = 5: point1(2) = 0
    point2(0) = 5: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ThisDrawing.Application.ZoomAll

    ' Allow the user to change the text prefix for the dimension
    prefix = InputBox("Enter a new text prefix for the dimension", "Set Dimension Prefix", "PREFIX:")
    dimObj.TextPrefix = prefix   ' Commit changes to prefix

    ThisDrawing.Regen acAllViewports

    ' Read back and display the dimension text prefix
    prefix = dimObj.TextPrefix
    If prefix <> "" Then
        MsgBox "The prefix of the dimension has been changed to: " & prefix
    Else
        MsgBox "The prefix of the dimension has been removed"
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextPrefix()
    ;; This example creates an aligned dimension in model space and
    ;; uses TextPrefix to allow the user to change the text prefix for the
    ;; dimension
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 0 5 0)
          point2 (vlax-3d-point 5 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    (vla-ZoomAll acadObj)

    ;; Allow the user to change the text prefix for the dimension
    (setq prefix (vla-GetString (vla-get-Utility doc) :vlax-false "\nEnter a new text prefix for the dimension: "))
    (vla-put-TextPrefix dimObj prefix)   ;; Commit changes to prefix

    (vla-Regen doc acAllViewports)

    ;; Read back and display the dimension text prefix
    (setq prefix (vla-get-TextPrefix dimObj))
    (if (/= prefix "")
        (alert (strcat "The prefix of the dimension has been changed to: " prefix))
        (alert "The prefix of the dimension has been removed")
    )
)


TextRightAttachmentType Property (ActiveX)

Specify how leaders on the right side connect with the text.

Supported platforms: Windows only

Signature

VBA:

object.TextRightAttachmentType
object

Type: MLeader, MLeaderStyle

The objects this property applies to.

Property Value

Read-only: No

Type: AcTextAttachmentType enum

  • acAttachmentAllLine
  • acAttachmentBottomLine
  • acAttachmentBottomOfBottom
  • acAttachmentBottomOfTop
  • acAttachmentBottomOfTopLine
  • acAttachmentMiddle
  • acAttachmentMiddleOfBottom
  • acAttachmentMiddleOfTop
  • acAttachmentTopOfTop

Remarks

No additional remarks.

Examples

VBA:

Sub Example_TextManipulation()
    Dim oML As AcadMLeader
    Dim points(0 To 14) As Double

    ' Define the leader points
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 1: points(4) = 2: points(5) = 0
    points(6) = 2: points(7) = 2: points(8) = 0
    points(9) = 3: points(10) = 2: points(11) = 0
    points(12) = 4: points(13) = 4: points(14) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    oML.TextLeftAttachmentType = acAttachmentBottomLine
    oML.TextRightAttachmentType = acAttachmentMiddleOfBottom
    oML.TextBackgroundFill = False
    oML.TextDirection = acLeftToRight
    oML.TextHeight = 2.3
    oML.TextJustify = acAttachmentPointMiddleLeft
    oML.TextLineSpacingDistance = 2.4
    oML.TextLineSpacingFactor = 1.2
    oML.TextLineSpacingStyle = acLineSpacingStyleExactly
    oML.TextWidth = 7.4

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextManipulation()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the leader points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill points '(1 1 0
                                  1 2 0
                                  2 2 0
                                  3 2 0
                                  4 4 0
                                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (vla-put-TextLeftAttachmentType oML acAttachmentBottomLine)
    (vla-put-TextRightAttachmentType oML acAttachmentMiddleOfBottom)
    (vla-put-TextBackgroundFill oML :vlax-false)
    (vla-put-TextDirection oML acLeftToRight)
    (vla-put-TextHeight oML 2.3)
    (vla-put-TextJustify oML acAttachmentPointMiddleLeft)
    (vla-put-TextLineSpacingDistance oML 2.4)
    (vla-put-TextLineSpacingFactor oML 1.2)
    (vla-put-TextLineSpacingStyle oML acLineSpacingStyleExactly)
    (vla-put-TextWidth oML 7.4)
)


TextRotation Property (ActiveX)

Specifies the rotation angle of the dimension text.

Supported platforms: Windows only

Signature

VBA:

object.TextRotation
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated, MLeader

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The angle in radians of the dimension text. The valid range is 0 to 6.28.

Remarks

By default, this value is equal to either 0 degrees, or to the Rotation property, as specified by the dimension style.

Text with 0 degree angle

Text with angle equal to the dimension rotation

Examples

VBA:

Sub Example_TextRotation()
    ' This example creates an aligned dimension and then changes the
    ' TextRotation property for that dimension.

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5#: point1(1) = 3#: point1(2) = 0#
    point2(0) = 10#: point2(1) = 3#: point2(2) = 0#
    location(0) = 7.5: location(1) = 5#: location(2) = 0#

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ZoomAll
    MsgBox "The current text rotation angle for the dimension is " & dimObj.TextRotation & " radians.", vbInformation, "TextRotation Example"

    ' Change the text rotation angle to 45 degrees (.707 radians)
    dimObj.TextRotation = 0.707
    dimObj.Update

    MsgBox "The new text rotation angle for the dimension is " & dimObj.TextRotation & " radians.", vbInformation, "TextRotation Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextRotation()
    ;; This example creates an aligned dimension and then changes the
    ;; TextRotation property for that dimension.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 3 0)
          point2 (vlax-3d-point 10 3 0)
          location (vlax-3d-point 7.5 5 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)
    (alert (strcat "The current text rotation angle for the dimension is " (rtos (vla-get-TextRotation dimObj) 2) " radians."))

    ;; Change the text rotation angle to 45 degrees (.707 radians)
    (vla-put-TextRotation dimObj 0.707)
    (vla-Update dimObj)

    (alert (strcat "The new text rotation angle for the dimension is " (rtos (vla-get-TextRotation dimObj) 2) " radians."))
)


TextString Property (ActiveX)

Specifies the text string for the entity.

Supported platforms: Windows only

Signature

VBA:

object.TextString
object

Type: Attribute, AttributeReference, GeoPositionMarker, MLeader, MLeaderStyle, MText, Text, Tolerance

The objects this property applies to.

Property Value

Read-only: No

Type: String

The maximum length is 256 characters.

Remarks

AttributeReference: This is equivalent to the value of the attribute in AutoCAD.

GeoPositionMarker, MText: The text string may contain format codes. You can underline, add a line over text, and create stacked text. You can also change color, font, and text height. You can change the spaces between text characters or increase the width of the characters themselves. To apply formatting, or parse existing text strings for their formatting.

Examples

VBA:

Sub Example_TextString()
    ' This example creates a text object in model space.
    ' It then returns the text string for that object.

    Dim textObj As AcadText
    Dim text As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double

    ' Define the text object
    text = "Hello, World."
    insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 0
    height = 0.5

    ' Create the text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(text, insertionPoint, height)
    ZoomAll

    ' Return the current text string for the object
    text = textObj.textString
    MsgBox "The TextString property equals: " & text, vbInformation, "TextString Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextString()
    ;; This example creates a text object in model space.
    ;; It then returns the text string for that object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the text object
    (setq insertionPoint (vlax-3d-point 2 2 0)
          textString "Hello, World."
          height 0.5)

    ;; Create the text object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq textObj (vla-AddText modelSpace textString insertionPoint height))
    (vla-ZoomAll acadObj)

    ;; Return the current text string for the object
    (setq text (vla-get-TextString textObj))
    (alert (strcat "The TextString property equals: " text))
)


TextStyle Property (ActiveX)

Specifies the text style for the dimension or tolerance text.

Supported platforms: Windows only

Signature

VBA:

object.TextStyle
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated, MLeaderStyle, Tolerance

The objects this property applies to.

Property Value

Read-only: No

Type: String

The style for the dimension value.

Remarks

The initial value for this property is STANDARD.

NoteThis property overrides the value of the DIMTXSTY system variable for the given dimension.

Examples

VBA:

Sub Example_TextStyle()
    ' This example creates an aligned dimension in model space and
    ' creates a new system text style.  The new text style is then assigned to
    ' the new dimension

    Dim dimObj As AcadDimAligned
    Dim newText As AcadTextStyle
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 5.5: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Create new text style
    Set newText = ThisDrawing.TextStyles.Add("MYSTYLE")
    newText.height = 0.5    ' Just set the height of the new style so we can differentiate

    ThisDrawing.Application.ZoomAll

    ' Read and display the current text style for this dimension
    MsgBox "The text style is currently set to: " & dimObj.textStyle

    ' Change the text style to use the new style we created
    dimObj.textStyle = "MYSTYLE"
    ThisDrawing.Regen acAllViewports

    ' Read and display the current text style for this dimension
    MsgBox "The text style is now set to: " & dimObj.textStyle

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextStyle()
    ;; This example creates an aligned dimension in model space and
    ;; creates a new system text style.  The new text style is then assigned to
    ;; the new dimension
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 5.5 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Create new text style
    (setq newText (vla-Add (vla-get-TextStyles doc) "MYSTYLE"))
    (vla-put-Height newText 0.5)    ;; Just set the height of the new style so we can differentiate

    (vla-ZoomAll acadObj)
    (vla-Regen doc acAllViewports)

    ;; Read and display the current text style for this dimension
    (alert (strcat "The text style is currently set to: " (vla-get-TextStyle dimObj)))

    ;; Change the text style to use the new style we created
    (vla-put-TextStyle dimObj "MYSTYLE")
    (vla-Regen doc acAllViewports)

    ;; Read and display the current text style for this dimension
    (alert (strcat "The text style is now set to: " (vla-get-TextStyle dimObj)))
)


TextStyleName Property (ActiveX)

Specifies the style name of the MText.

Supported platforms: Windows only

Signature

VBA:

object.TextStyleName
object

Type: GeoPositionMarker, MLeader

The object this property applies to.

Property Value

Read-only: No

Type: String

The name of the style for the object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_TextManipulation()
    Dim oML As AcadMLeader
    Dim points(0 To 14) As Double

    ' Define the leader points
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 1: points(4) = 2: points(5) = 0
    points(6) = 2: points(7) = 2: points(8) = 0
    points(9) = 3: points(10) = 2: points(11) = 0
    points(12) = 4: points(13) = 4: points(14) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    oML.TextLeftAttachmentType = acAttachmentBottomLine
    oML.TextRightAttachmentType = acAttachmentMiddleOfBottom
    oML.TextBackgroundFill = False
    oML.TextDirection = acLeftToRight
    oML.TextHeight = 2.3
    oML.TextJustify = acAttachmentPointMiddleLeft
    oML.TextLineSpacingDistance = 2.4
    oML.TextLineSpacingFactor = 1.2
    oML.TextLineSpacingStyle = acLineSpacingStyleExactly
    oML.TextWidth = 7.4

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextManipulation()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the leader points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill points '(1 1 0
                                  1 2 0
                                  2 2 0
                                  3 2 0
                                  4 4 0
                                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (vla-put-TextLeftAttachmentType oML acAttachmentBottomLine)
    (vla-put-TextRightAttachmentType oML acAttachmentMiddleOfBottom)
    (vla-put-TextBackgroundFill oML :vlax-false)
    (vla-put-TextDirection oML acLeftToRight)
    (vla-put-TextHeight oML 2.3)
    (vla-put-TextJustify oML acAttachmentPointMiddleLeft)
    (vla-put-TextLineSpacingDistance oML 2.4)
    (vla-put-TextLineSpacingFactor oML 1.2)
    (vla-put-TextLineSpacingStyle oML acLineSpacingStyleExactly)
    (vla-put-TextWidth oML 7.4)
)


TextStyles Property (ActiveX)

Gets the TextStyles collection for the document.

Supported platforms: Windows only

Signature

VBA:

object.TextStyles
object

Type: Database, Document

The objects this property applies to.

Property Value

Read-only: Yes

Type: TextStyles

The TextStyles collection for the document.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_TextStyles()
    ' This example finds the current Textstyles collection and
    ' adds a new Text style to that collection.

    Dim TextColl As AcadTextStyles
    Set TextColl = ThisDrawing.TextStyles

    ' Create a Text style named "TEST" in the current drawing
    Dim textStyle As AcadTextStyle
    Set textStyle = TextColl.Add("TEST")
    MsgBox "A new Text style called " & textStyle.name & " has been added to the Textstyles collection.", vbInformation, "Textstyles Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextStyles()
    ;; This example finds the current Textstyles collection and
    ;; adds a new Text style to that collection.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq TextColl (vla-get-TextStyles doc))

    ;; Create a Text style named "TEST" in the current drawing
    (setq textStyle (vla-Add TextColl "TEST"))
    (alert (strcat "A new Text style called " (vla-get-Name textStyle) " has been added to the Textstyles collection."))
)


TextSuffix Property (ActiveX)

Specifies the dimension value suffix.

Supported platforms: Windows only

Signature

VBA:

object.TextSuffix
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: String

The suffix for the dimension value.

Remarks

The initial value for this property is "".

NoteThis property overrides the value of the DIMPOST system variable for the given dimension.

Examples

VBA:

Sub Example_TextSuffix()
    ' This example creates an aligned dimension in model space and
    ' uses TextSuffix to allow the user to change the text suffix for the
    ' dimension

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim suffix As String

    ' Define the dimension
    point1(0) = 0: point1(1) = 5: point1(2) = 0
    point2(0) = 5: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ThisDrawing.Application.ZoomAll

    ' Allow the user to change the text suffix for the dimension
    suffix = InputBox("Enter a new text suffix for the dimension", "Set Dimension Suffix", ":SUFFIX")
    dimObj.TextSuffix = suffix   ' Commit changes to suffix

    ThisDrawing.Regen acAllViewports

    ' Read back and display the dimension text suffix
    suffix = dimObj.TextSuffix
    If suffix <> "" Then
        MsgBox "The suffix of the dimension has been changed to: " & suffix
    Else
        MsgBox "The suffix of the dimension has been removed"
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextSuffix()
    ;; This example creates an aligned dimension in model space and
    ;; uses TextSuffix to allow the user to change the text suffix for the
    ;; dimension
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 0 5 0)
          point2 (vlax-3d-point 5 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    (vla-ZoomAll acadObj)

    ;; Allow the user to change the text suffix for the dimension
    (setq suffix (vla-GetString (vla-get-Utility doc) :vlax-false "\nEnter a new text suffix for the dimension: "))
    (vla-put-TextSuffix dimObj suffix)   ;; Commit changes to suffix

    (vla-Regen doc acAllViewports)

    ;; Read back and display the dimension text suffix
    (setq suffix (vla-get-TextSuffix dimObj))
    (if (/= suffix "")
        (alert (strcat "The suffix of the dimension has been changed to: " suffix))
        (alert "The suffix of the dimension has been removed")
    )
)


TextureMapPath Property (ActiveX)

Specifies the directory in which AutoCAD searches for rendering texture maps.

Supported platforms: Windows only

Signature

VBA:

object.TextureMapPath
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The location of the directory for rendering texture maps.

Remarks

Multiple paths can be entered by using a semicolon (;) to paths.

Examples

VBA:

Sub Example_TextureMapPath()
    ' This example returns the current setting of
    ' TextureMapPath. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currTextureMapPath As String
    Dim newTextureMapPath As String

    Set preferences = ThisDrawing.Application.Preferences

    ' Retrieve the current TextureMapPath value
    currTextureMapPath = preferences.Files.TextureMapPath
    MsgBox "The current value for TextureMapPath is " & currTextureMapPath, vbInformation, "TextureMapPath Example"

    ' Change the value for TextureMapPath
    newTextureMapPath = "TestTextureMapPath"
    preferences.Files.TextureMapPath = newTextureMapPath
    MsgBox "The new value for TextureMapPath is " & newTextureMapPath, vbInformation, "TextureMapPath Example"

    ' Reset TextureMapPath to its original value
    preferences.Files.TextureMapPath = currTextureMapPath
    MsgBox "The TextureMapPath value is reset to " & currTextureMapPath, vbInformation, "TextureMapPath Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextureMapPath()
    ;; This example returns the current setting of
    ;; TextureMapPath. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current TextureMapPath value
    (setq currTextureMapPath (vla-get-TextureMapPath (vla-get-Files preferences)))
    (alert (strcat "The current value for TextureMapPath is " currTextureMapPath))

    ;; Change the value for TextureMapPath
    (setq newTextureMapPath "TestTextureMapPath")
    (vla-put-TextureMapPath (vla-get-Files preferences) newTextureMapPath)
    (alert (strcat "The new value for TextureMapPath is " newTextureMapPath))

    ;; Reset TextureMapPath to its original value
    (vla-put-TextureMapPath (vla-get-Files preferences) currTextureMapPath)
    (alert (strcat "The TextureMapPath value is reset to " currTextureMapPath))
)


TextWidth Property (ActiveX)

Specifies the width of the MText.

Supported platforms: Windows only

Signature

VBA:

object.TextWidth
object

Type: GeoPositionMarker, MLeader

The object this property applies to.

Property Value

Read-only: No

Type: Double

The boundary width of the object.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_TextManipulation()
    Dim oML As AcadMLeader
    Dim points(0 To 14) As Double

    ' Define the leader points
    points(0) = 1: points(1) = 1: points(2) = 0
    points(3) = 1: points(4) = 2: points(5) = 0
    points(6) = 2: points(7) = 2: points(8) = 0
    points(9) = 3: points(10) = 2: points(11) = 0
    points(12) = 4: points(13) = 4: points(14) = 0
    Dim i As Long
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    oML.TextLeftAttachmentType = acAttachmentBottomLine
    oML.TextRightAttachmentType = acAttachmentMiddleOfBottom
    oML.TextBackgroundFill = False
    oML.TextDirection = acLeftToRight
    oML.TextHeight = 2.3
    oML.TextJustify = acAttachmentPointMiddleLeft
    oML.TextLineSpacingDistance = 2.4
    oML.TextLineSpacingFactor = 1.2
    oML.TextLineSpacingStyle = acLineSpacingStyleExactly
    oML.TextWidth = 7.4

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextManipulation()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the leader points
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 14)))
    (vlax-safearray-fill points '(1 1 0
                                  1 2 0
                                  2 2 0
                                  3 2 0
                                  4 4 0
                                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (vla-put-TextLeftAttachmentType oML acAttachmentBottomLine)
    (vla-put-TextRightAttachmentType oML acAttachmentMiddleOfBottom)
    (vla-put-TextBackgroundFill oML :vlax-false)
    (vla-put-TextDirection oML acLeftToRight)
    (vla-put-TextHeight oML 2.3)
    (vla-put-TextJustify oML acAttachmentPointMiddleLeft)
    (vla-put-TextLineSpacingDistance oML 2.4)
    (vla-put-TextLineSpacingFactor oML 1.2)
    (vla-put-TextLineSpacingStyle oML acLineSpacingStyleExactly)
    (vla-put-TextWidth oML 7.4)
)


TextWinBackgrndColor Property (ActiveX)

Specifies the background color for the text window.

Supported platforms: Windows only

Signature

VBA:

object.TextWinBackgrndColor
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: OLE_COLOR (constant)

  • vbBlack
  • vbRed
  • vbYellow
  • vbGreen
  • vbCyan
  • vbBlue
  • vbMagenta
  • vbWhite

Remarks

The default color for this property is the Windows standard window color.

Examples

VBA:

Sub Example_TextWinBackgrndColor()
    ' This example returns the current setting of
    ' TextWinBackgrndColor. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currTextWinBackgrndColor As OLE_COLOR

    Set preferences = ThisDrawing.Application.Preferences

    ' Retrieve the current TextWinBackgrndColor value
    currTextWinBackgrndColor = preferences.Display.TextWinBackgrndColor
    MsgBox "The current value for TextWinBackgrndColor is " _
           & preferences.Display.TextWinBackgrndColor, vbInformation, "TextWinBackgrndColor Example"

    ' Change the value for TextWinBackgrndColor
    preferences.Display.TextWinBackgrndColor = vbBlue
    MsgBox "The new value for TextWinBackgrndColor is " _
           & preferences.Display.TextWinBackgrndColor, vbInformation, "TextWinBackgrndColor Example"

    ' Reset TextWinBackgrndColor to its original value
    preferences.Display.TextWinBackgrndColor = currTextWinBackgrndColor
    MsgBox "The TextWinBackgrndColor value is reset to " _
           & preferences.Display.TextWinBackgrndColor, vbInformation, "TextWinBackgrndColor Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextWinBackgrndColor()
    ;; This example returns the current setting of
    ;; TextWinBackgrndColor. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the Display preferences object
    (setq ACADPref (vla-get-Display preferences))

    ;; Retrieve the current TextWinBackgrndColor value
    (setq currTextWinBackgrndColor (vlax-variant-change-type (vla-get-TextWinBackgrndColor ACADPref) vlax-vbLong))
    (alert (strcat "The current value for TextWinBackgrndColor is " (itoa (vlax-variant-value currTextWinBackgrndColor))))

    ;; Change the value for TextWinBackgrndColor
    (vla-put-TextWinBackgrndColor ACADPref (vlax-make-variant acBlue 19))
    (setq newValue (vlax-variant-change-type (vla-get-TextWinBackgrndColor ACADPref) vlax-vbLong))
    (alert (strcat "The new value for TextWinBackgrndColor is " (itoa (vlax-variant-value newValue))))

    ;; Reset TextWinBackgrndColor to its original value
    (vla-put-TextWinBackgrndColor ACADPref (vlax-variant-change-type currTextWinBackgrndColor 19))
    (alert (strcat "The TextWinBackgrndColor value is reset to " (itoa (vlax-variant-value currTextWinBackgrndColor))))
)


TextWinTextColor Property (ActiveX)

Specifies the text color for the text window.

Supported platforms: Windows only

Signature

VBA:

object.TextWinTextColor
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: Yes / No

Type: OLE_COLOR (constant)

  • vbBlack
  • vbRed
  • vbYellow
  • vbGreen
  • vbCyan
  • vbBlue
  • vbMagenta
  • vbWhite

Remarks

The default color for this property is the Windows standard window text color.

Examples

VBA:

Sub Example_TextWinTextColor()
    ' This example returns the current setting of
    ' TextWinTextColor. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currTextWinTextColor As Long

    Set preferences = ThisDrawing.Application.Preferences

    ' Retrieve the current TextWinTextColor value
    currTextWinTextColor = preferences.Display.TextWinTextColor
    MsgBox "The current value for TextWinTextColor is " _
           & preferences.Display.TextWinTextColor, vbInformation, "TextWinTextColor Example"

    ' Change the value for TextWinTextColor
    preferences.Display.TextWinTextColor = vbGreen
    MsgBox "The new value for TextWinTextColor is " _
           & preferences.Display.TextWinTextColor, vbInformation, "TextWinTextColor Example"

    ' Reset TextWinTextColor to its original value
    preferences.Display.TextWinTextColor = currTextWinTextColor
    MsgBox "The TextWinTextColor value is reset to " _
           & preferences.Display.TextWinTextColor, vbInformation, "TextWinTextColor Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TextWinTextColor()
    ;; This example returns the current setting of
    ;; TextWinTextColor. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the Display preferences object
    (setq ACADPref (vla-get-Display preferences))

    ;; Retrieve the current TextWinTextColor value
    (setq currTextWinTextColor (vlax-variant-change-type (vla-get-TextWinTextColor ACADPref) vlax-vbLong))
    (alert (strcat "The current value for TextWinTextColor is " (itoa (vlax-variant-value currTextWinTextColor))))

    ;; Change the value for TextWinTextColor
    (vla-put-TextWinTextColor ACADPref (vlax-make-variant acGreen 19))
    (setq newValue (vlax-variant-change-type (vla-get-TextWinTextColor ACADPref) vlax-vbLong))
    (alert (strcat "The new value for TextWinTextColor is " (itoa (vlax-variant-value newValue))))

    ;; Reset TextWinTextColor to its original value
    (vla-put-TextWinTextColor ACADPref (vlax-variant-change-type currTextWinTextColor 19))
    (alert (strcat "The TextWinTextColor value is reset to " (itoa (vlax-variant-value currTextWinTextColor))))
)


Thickness Property (ActiveX)

Specifies the distance a 2D AutoCAD object is extruded above or below its elevation.

Supported platforms: Windows only

Signature

VBA:

object.Thickness
object

Type: Arc, Attribute, AttributeReference, Circle, Line, LWPolyline, Point, Polyline, Shape, Solid, Text, Trace

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The default is 0.0.

Remarks

Changing the thickness of an object changes its Z direction thickness.

Changing the thickness of a 3D polyline, dimension, or floating viewport has no effect.

Examples

VBA:

Sub Example_Thickness()
    ' This example creates a circle in model space
    ' and changes the thickness of the circle.

    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double

    ' Define the circle
    centerPoint(0) = 0#: centerPoint(1) = 0#: centerPoint(2) = 0#
    radius = 5#

    ' Create the Circle object in model space
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)
    ZoomAll

    ' Find the current thickness of the circle
    Dim currThickness As Double
    currThickness = circleObj.Thickness
    MsgBox "The thickness of the circle is " & circleObj.Thickness, vbInformation, "Thickness Example"

    ' Change the thickness of the circle
    circleObj.Thickness = currThickness + 3
    circleObj.Update

    ' Change the direction of the viewport so that you can
    ' view the change made to the thickness. Once you change
    ' the direction, you must reset the active viewport.
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    MsgBox "The thickness of the circle is now " & circleObj.Thickness, vbInformation, "Thickness Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Thickness()
    ;; This example creates a circle in model space
    ;; and changes the thickness of the circle.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the circle
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius 5)

    ;; Create the Circle object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))
    (vla-ZoomAll acadObj)

    ;; Find the current thickness of the circle
    (setq currThickness (vla-get-Thickness circleObj))
    (alert (strcat "The thickness of the circle is " (rtos currThickness 2)))

    ;; Change the thickness of the circle
    (vla-put-Thickness circleObj (+ currThickness 3))
    (vla-Update circleObj)

    ;; Change the direction of the viewport so that you can
    ;; view the change made to the thickness. Once you change
    ;; the direction, you must reset the active viewport.
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)

    (alert (strcat "The thickness of the circle is now " (rtos (vla-get-Thickness circleObj) 2)))

)


TimeServer Property (ActiveX)

Specifies the name of the time server to be used for a digital signature.

Supported platforms: Windows only

Signature

VBA:

object.TimeServer
object

Type: SecurityParams

The object this property applies to.

Property Value

Read-only: No

Type: String

The name of the time server to be used for a digital signature.

Remarks

If you do not set this property, the time from the local machine is used as the time stamp for the digital signature.

Examples

VBA:

Sub Example_TimeServer()
    ' This example attaches a digital signature and accompanying data to a file,
    ' and saves the file.

    Dim sp As AcadSecurityParams
    Set sp = GetInterfaceObject("AutoCAD.SecurityParams.20")

    ' Attach a digital signature and timestamp it
    sp.Action = AcadSecurityParamsType.ACADSECURITYPARAMS_SIGN_DATA _
                + AcadSecurityParamsType.ACADSECURITYPARAMS_ADD_TIMESTAMP

    ' Certificate details follow
    sp.Subject = "Thawte Freemail Member"
    sp.Issuer = "Personal Freemail RSA 2000.8.30"
    sp.SerialNumber = "073848"
    sp.Comment = "This is now signed"
    sp.TimeServer = "NIST(time.nist.gov)"
    ' To set the TimeServer property, use a description followed by the Internet address in parentheses

    ThisDrawing.SaveAs "C:\MyDrawing.dwg", , sp
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TimeServer()
    ;; This example attaches a digital signature and accompanying data to a file,
    ;; and saves the file.
    (setq acadObj (vlax-get-acad-object))
    (setq sp (vlax-create-object "AutoCAD.SecurityParams.20"))

    (vla-put-Visible acadObj :vlax-true)

    ;; Attach a digital signature and timestamp it
    (vla-put-Action sp (+ ACADSECURITYPARAMS_SIGN_DATA ACADSECURITYPARAMS_ADD_TIMESTAMP))

    ;; Certificate details follow
    (vla-put-Subject sp "Thawte Freemail Member")
    (vla-put-Issuer sp "Personal Freemail RSA 2000.8.30")
    (vla-put-SerialNumber sp "073848")
    (vla-put-Comment sp "This is now signed")
    (vla-put-TimeServer sp "NIST(time.nist.gov)")
    ;; To set the TimeServer property, use a description followed by the Internet address in parentheses

    (setq doc (vla-get-ActiveDocument acadObj))
    (vla-SaveAs doc "C:\\MyDrawing.dwg" acNative sp)

    (vlax-release-object sp)
)


TimeStamp Property (ActiveX)

Specifies the timestamp of an entry in the File Dependency List.

Supported platforms: Windows only

Signature

VBA:

object.TimeStamp
object

Type: FileDependency

The object this property applies to.

Property Value

Read-only: Yes

Type: Long

Current time/date, in number of seconds since 1/1/1980.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_TimeStamp()
    ' This example reads information from a File Dependency List
    ' Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ' \Sample\Sheet Sets\Architectural\A-01.dwg

    Dim objFDLCol As AutoCAD.AcadFileDependencies
    Dim objFDL As AutoCAD.AcadFileDependency

    Set objFDLCol = ThisDrawing.FileDependencies
    MsgBox ("The number of entries in the File Dependency List is " & objFDLCol.count & ".")

    Dim strTemp As String
    For Each objFDL In objFDLCol
        strTemp = "Affects graphics?: " & vbTab & objFDL.AffectsGraphics
        strTemp = strTemp & vbCrLf & "Feature: " & vbTab & objFDL.Feature
        strTemp = strTemp & vbCrLf & "FileName: " & vbTab & objFDL.FileName
        strTemp = strTemp & vbCrLf & "FileSize: " & vbTab & objFDL.FileSize
        strTemp = strTemp & vbCrLf & "Fingerprint GUID: " & vbTab & objFDL.FingerprintGuid
        strTemp = strTemp & vbCrLf & "FoundPath: " & vbTab & objFDL.FoundPath
        strTemp = strTemp & vbCrLf & "FullFileName: " & vbTab & objFDL.FullFileName
        strTemp = strTemp & vbCrLf & "Index: " & vbTab & objFDL.Index
        strTemp = strTemp & vbCrLf & "Modified?: " & vbTab & objFDL.IsModified
        strTemp = strTemp & vbCrLf & "ReferenceCount: " & vbTab & objFDL.ReferenceCount
        strTemp = strTemp & vbCrLf & "Timestamp: " & vbTab & objFDL.TimeStamp
        strTemp = strTemp & vbCrLf & "Version GUID: " & vbTab & objFDL.VersionGuid
        MsgBox strTemp
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TimeStamp()
    ;; This example reads information from a File Dependency List
    ;; Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ;; .\\Sample\\Sheet Sets\\Architectural\\A-01.dwg
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq objFDLCol (vla-get-FileDependencies doc))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))

    (setq strTemp "")
    (vlax-for each-objFDL objFDLCol
        (setq strTemp (strcat "Affects graphics?: " (if (= (vla-get-AffectsGraphics each-objFDL) :vlax-true) "True" "False")))
        (setq strTemp (strcat strTemp
                              "\nFeature: " (vla-get-Feature each-objFDL)
                              "\nFileName: " (vla-get-FileName each-objFDL)
                              "\nFileSize: " (itoa (vla-get-FileSize each-objFDL))
                              "\nFingerprint GUID: " (vla-get-FingerprintGuid each-objFDL)
                              "\nFoundPath: " (vla-get-FoundPath each-objFDL)
                              "\nFullFileName: " (vla-get-FullFileName each-objFDL)
                              "\nIndex: " (itoa (vla-get-Index each-objFDL))
                              "\nModified?: " (if (= (vla-get-IsModified each-objFDL) :vlax-true) "True" "False")
                              "\nReferenceCount: " (itoa (vla-get-ReferenceCount each-objFDL))
                              "\nTimeStamp: " (itoa (vla-get-TimeStamp each-objFDL))
                              "\nVersion GUID: " (vla-get-VersionGuid each-objFDL)
                  )
           )
        (alert strTemp)
    )
)


Title Property (ActiveX)

Specifies the title you want to use to locate the drawing.

Supported platforms: Windows only

Signature

VBA:

object.Title
object

Type: SummaryInfo

The object this property applies to.

Property Value

Read-only: No

Type: String

The Title property of a drawing.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Title()
    ' This example shows how to access drawing properties

    ' Add and display standard properties
    ThisDrawing.SummaryInfo.Author = "John Doe"
    ThisDrawing.SummaryInfo.Comments = "Includes all ten levels of Building Five"
    ThisDrawing.SummaryInfo.HyperlinkBase = "http://www.autodesk.com"
    ThisDrawing.SummaryInfo.Keywords = "Building Complex"
    ThisDrawing.SummaryInfo.LastSavedBy = "JD"
    ThisDrawing.SummaryInfo.RevisionNumber = "4"
    ThisDrawing.SummaryInfo.Subject = "Plan for Building Five"
    ThisDrawing.SummaryInfo.Title = "Building Five"

    Author = ThisDrawing.SummaryInfo.Author
    Comments = ThisDrawing.SummaryInfo.Comments
    HLB = ThisDrawing.SummaryInfo.HyperlinkBase
    KW = ThisDrawing.SummaryInfo.Keywords
    LSB = ThisDrawing.SummaryInfo.LastSavedBy
    RN = ThisDrawing.SummaryInfo.RevisionNumber
    Subject = ThisDrawing.SummaryInfo.Subject
    Title = ThisDrawing.SummaryInfo.Title
    MsgBox "The standard drawing properties are " & vbCrLf & _
           "Author = " & Author & vbCrLf & _
           "Comments = " & Comments & vbCrLf & _
           "HyperlinkBase = " & HLB & vbCrLf & _
           "Keywords = " & KW & vbCrLf & _
           "LastSavedBy = " & LSB & vbCrLf & _
           "RevisionNumber = " & RN & vbCrLf & _
           "Subject = " & Subject & vbCrLf & _
           "Title = " & Title & vbCrLf

    ' Add and display custom properties
    Dim Key0 As String
    Dim Value0 As String
    Dim Key1 As String
    Dim Value1 As String
    Dim CustomPropertyBranch As String
    Dim PropertyBranchValue As String
    Dim CustomPropertyZone As String
    Dim PropertyZoneValue As String

    CustomPropertyBranch = "Branch"
    PropertyBranchValue = "Main"
    CustomPropertyZone = "Zone"
    PropertyZoneValue = "Industrial"

    ' Add custom properties
    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 1) Then
        ThisDrawing.SummaryInfo.SetCustomByIndex 0, CustomPropertyBranch, PropertyBranchValue
    Else
        ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyBranch, PropertyBranchValue
    End If

    If (ThisDrawing.SummaryInfo.NumCustomInfo >= 2) Then
         ThisDrawing.SummaryInfo.SetCustomByKey CustomPropertyBranch, "Satellite"
    Else
         ThisDrawing.SummaryInfo.AddCustomInfo CustomPropertyZone, PropertyZoneValue
    End If

    'Get custom properties
    ThisDrawing.SummaryInfo.GetCustomByIndex 0, Key0, Value0
    Key1 = CustomPropertyZone
    ThisDrawing.SummaryInfo.GetCustomByKey Key1, Value1

    MsgBox "The custom drawing properties are " & vbCrLf & _
           "First property name = " & Key0 & vbCrLf & _
           "First property value = " & Value0 & vbCrLf & _
           "Second property name = " & Key1 & vbCrLf & _
           "Second property value = " & Value1 & vbCrLf
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Title()
    ;; This example shows how to access drawing properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq summaryInfo (vla-get-SummaryInfo doc))

    ;; Add and display standard properties
    (vla-put-Author summaryInfo "John Doe")
    (vla-put-Comments summaryInfo "Includes all ten levels of Building Five")
    (vla-put-HyperlinkBase summaryInfo "http://www.autodesk.com")
    (vla-put-Keywords summaryInfo "Building Complex")
    (vla-put-LastSavedBy summaryInfo "JD")
    (vla-put-RevisionNumber summaryInfo "4")
    (vla-put-Subject summaryInfo "Plan for Building Five")
    (vla-put-Title summaryInfo "Building Five")

    (setq author (vla-get-Author summaryInfo))
    (setq comments (vla-get-Comments summaryInfo))
    (setq HLB (vla-get-HyperlinkBase summaryInfo))
    (setq KW (vla-get-Keywords summaryInfo))
    (setq LSB (vla-get-LastSavedBy summaryInfo))
    (setq RN (vla-get-RevisionNumber summaryInfo))
    (setq subject (vla-get-Subject summaryInfo))
    (setq Title (vla-get-Title summaryInfo))
    (alert (strcat "The standard drawing properties are "
                   "\nAuthor = " author
                   "\nComments = " comments
                   "\nHyperlinkBase = " HLB
                   "\nKeywords = " KW
                   "\nLastSavedBy = " LSB
                   "\nRevisionNumber = " RN
                   "\nSubject = " Subject
                   "\nTitle = " Title
           )
    )

    ;; Add and display custom properties
    (setq CustomPropertyBranch "Branch")
    (setq PropertyBranchValue "Main")
    (setq CustomPropertyZone "Zone")
    (setq PropertyZoneValue "Industrial")

    ;; Add custom properties
    (if (>= (vla-NumCustomInfo summaryInfo) 1)
        (vla-SetCustomByIndex summaryInfo 0 CustomPropertyBranch PropertyBranchValue)
        (vla-AddCustomInfo summaryInfo CustomPropertyBranch PropertyBranchValue)
    )

    (if (>= (vla-NumCustomInfo summaryInfo) 2)
        (vla-SetCustomByKey summaryInfo CustomPropertyBranch "Satellite")
        (vla-AddCustomInfo summaryInfo CustomPropertyZone PropertyZoneValue)
    )

    ;; Get custom properties
    (vla-GetCustomByIndex summaryInfo 0 'Key0 'Value0)
    (setq Key1 CustomPropertyZone)
    (vla-GetCustomByKey summaryInfo Key1 'Value1)

    (alert (strcat "The custom drawing properties are "
                   "\nFirst property name = " Key0
                   "\nFirst property value = " Value0
                   "\nSecond property name = " Key1
                   "\nSecond property value = " Value1
           )
    )
)


TitleSuppressed Property (ActiveX)

Specifies whether the title of the table is suppressed.

Supported platforms: Windows only

Signature

VBA:

object.TitleSuppressed
object

Type: Table, TableStyle

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The title of the table is suppressed.
  • False: The title of the table is not suppressed.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_TitleSuppressed()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.FlowDirection = acTableBottomToTop
    customObj.HorzCellMargin = 0.22
    customObj.BitFlags = 1
    customObj.SetTextHeight AcRowType.acDataRow + AcRowType.acTitleRow, 1.3
    customObj.SetTextStyle AcRowType.acDataRow + AcRowType.acTitleRow, "Standard"

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 12, 23, 45
    customObj.SetBackgroundColor AcRowType.acDataRow + AcRowType.acTitleRow, col
    customObj.SetGridVisibility AcGridLineType.acHorzInside + AcGridLineType.acHorzTop _
                                , AcRowType.acDataRow + AcRowType.acTitleRow, True

    customObj.SetAlignment AcRowType.acDataRow + AcRowType.acTitleRow, acBottomRight
    col.SetRGB 244, 0, 0
    customObj.SetGridColor 3, 1, col

    MsgBox "Table Style Name = " & customObj.Name & vbCrLf & _
           "Style Description = " & customObj.Description & vbCrLf & _
           "Flow Direction = " & customObj.FlowDirection & vbCrLf & _
           "Horzontal Cell Margin = " & customObj.HorzCellMargin & vbCrLf & _
           "Bit Flags = " & customObj.BitFlags & vbCrLf & _
           "Title Row Text Height = " & customObj.GetTextHeight(acTitleRow) & vbCrLf & _
           "Title Row Text Style = " & customObj.GetTextStyle(acTitleRow) & vbCrLf & _
           "Grid Visibility for HorizontalBottom TitleRow  = " & customObj.GetGridVisibility(acHorzBottom, acTitleRow) & vbCrLf & _
           "Title Row Alignment = " & customObj.GetAlignment(acTitleRow) & vbCrLf & _
           "Header Suppression = " & customObj.HeaderSuppressed & vbCrLf & _
           "Title Suppression = " & customObj.TitleSuppressed

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TitleSuppressed()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-put-FlowDirection customObj acTableBottomToTop)
    (vla-put-HorzCellMargin customObj 0.22)
    (vla-put-BitFlags customObj 1)
    (vla-SetTextHeight customObj (+ acDataRow acTitleRow) 1.3)
    (vla-SetTextStyle customObj (+ acDataRow acTitleRow) "Standard")

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 12 23 45)

    (vla-SetBackgroundColor customObj (+ acDataRow acTitleRow) col)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) (+ acDataRow acTitleRow) :vlax-true)
    (vla-SetAlignment customObj (+ acDataRow acTitleRow) acBottomRight)
    (vla-SetRGB col 244 0 0)
    (vla-SetGridColor customObj (+ acHorzTop acHorzInside) acDataRow col)

    (alert (strcat "Table Style Name = " (vla-get-Name customObj)
                   "\nStyle Description = " (vla-get-Description customObj)
                   "\nFlow Direction = " (itoa (vla-get-FlowDirection customObj))
                   "\nHorzontal Cell Margin = " (rtos (vla-get-HorzCellMargin customObj) 2)
                   "\nBit Flags = " (itoa (vla-get-BitFlags customObj))
                   "\nTitle Row Text Height = " (rtos (vla-GetTextHeight customObj acTitleRow) 2)
                   "\nTitle Row Text Style = " (vla-GetTextStyle customObj acTitleRow)
                   "\nGrid Visibility for HorizontalBottom TitleRow  = " (if (= (vla-GetGridVisibility customObj acHorzBottom acTitleRow) :vlax-true) "True" "False")
                   "\nTitle Row Alignment = " (itoa (vla-GetAlignment customObj acTitleRow))
                      "\nHeader Suppression = " (if (= (vla-get-HeaderSuppressed customObj) :vlax-true) "True" "False")
                      "\nTitle Suppression = " (if (= (vla-get-TitleSuppressed customObj) :vlax-true) "True" "False")
              )
    )
    (vlax-release-object col)
)


ToleranceDisplay Property (ActiveX)

Specifies if tolerances are displayed with the dimension text.

Supported platforms: Windows only

Signature

VBA:

object.ToleranceDisplay
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The object this property applies to.

Property Value

Read-only: No

Type: acDimToleranceMethod enum

  • acTolNone
  • acTolSymmetrical
  • acTolDeviation
  • acTolLimits
  • acTolBasic

Remarks

The initial value for this property is acTolNone.

NoteThis property overrides the value of the DIMTOL system variable for the given dimension.

Examples

VBA:

Sub Example_ToleranceDisplay()
    ' This example creates an aligned dimension in model space and
    ' turns on the tolerance display for the new dimension

    Dim dimObj As AcadDimAligned
    Dim newText As AcadTextStyle
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim CurrentDisplay As String

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 5.5: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ThisDrawing.Application.ZoomAll

    ' Read and display the current tolerance display for this dimension
    CurrentDisplay = IIf(dimObj.ToleranceDisplay = acTolNone, "Hidden", "Visible")
    MsgBox "The tolerance display is currently: " & CurrentDisplay

    ' Toggle the tolerance display for this dimension
    If dimObj.ToleranceDisplay = acTolNone Then
        dimObj.ToleranceDisplay = acTolSymmetrical
        CurrentDisplay = "Symmetrical"
    Else
        dimObj.ToleranceDisplay = acTolNone
        CurrentDisplay = "None"
    End If

    ThisDrawing.Regen acAllViewports

    ' Display the current tolerance display for this dimension
    MsgBox "The tolerance display is now set to: " & CurrentDisplay

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ToleranceDisplay()
    ;; This example creates an aligned dimension in model space and
    ;; turns on the tolerance display for the new dimension
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 5.5 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    (vla-ZoomAll acadObj)

    ;; Read and display the current tolerance display for this dimension
    (setq currentDisplay (if (= (vla-get-ToleranceDisplay dimObj) acTolNone) "Hidden" "Visible"))
    (alert (strcat "The tolerance display is currently: " currentDisplay))

    ;; Toggle the tolerance display for this dimension
    (if (= (vla-get-ToleranceDisplay dimObj) acTolNone)
        (progn
            (vla-put-ToleranceDisplay dimObj acTolSymmetrical)
            (setq currentDisplay "Symmetrical")
        )
        (progn
            (vla-put-ToleranceDisplay dimObj acTolNone)
            (setq currentDisplay "None")
        )
    )

    (vla-Regen doc acAllViewports)

    ;; Display the current tolerance display for this dimension
    (alert (strcat "The tolerance display is now set to: " currentDisplay))
)


ToleranceHeightScale Property (ActiveX)

Specifies a scale factor for the text height of tolerance values relative to the dimension text height.

Supported platforms: Windows only

Signature

VBA:

object.ToleranceHeightScale
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The object this property applies to.

Property Value

Read-only: No

Type: Double

The scale factor for the tolerance values.

Remarks

The initial value for this property is 1.0000.

This property is only available when the ToleranceDisplay property is set to any value other than acTolNone.

Use this property for plus and minus tolerance strings when DIMTOL is on and DIMTM is not equal to DIMTP, or when DIMLIM is on.

NoteThis property overrides the value of the DIMTFAC system variable for the given dimension.

Examples

VBA:

Sub Example_ToleranceHeightScale()
    ' This example creates an aligned dimension in model space and
    ' turns on the tolerance display for the new dimension.  The height
    ' of the tolerance text can then be adjusted by the user

    Dim dimObj As AcadDimAligned
    Dim newText As AcadTextStyle
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim CurrentScale As Integer

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 5.5: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Turn on the tolerance display
    dimObj.ToleranceDisplay = acTolSymmetrical

    ThisDrawing.Application.ZoomAll

Increase:
    ' Read and display the current tolerance height scale for this dimension
    If MsgBox("The tolerance height scale is currently set to: " & dimObj.ToleranceHeightScale & vbCrLf & _
              "Press OK to increase, or cancel to finish", vbOKCancel) = vbCancel Then

        Exit Sub
    End If

    ' Increase the tolerance height scale for this dimension
    dimObj.ToleranceHeightScale = dimObj.ToleranceHeightScale + 1

    ThisDrawing.Regen acAllViewports

    GoTo Increase
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ToleranceHeightScale()
    ;; This example creates an aligned dimension in model space and
    ;; turns on the tolerance display for the new dimension.  The height
    ;; of the tolerance text can then be adjusted by the user
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 5.5 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Turn on the tolerance display
    (vla-put-ToleranceDisplay dimObj acTolSymmetrical)

    (vla-ZoomAll acadObj)
    (vla-Regen doc acAllViewports)

    ;; Read and display the current tolerance height scale for this dimension
    (alert (strcat "The tolerance height scale is currently set to: " (rtos (vla-get-ToleranceHeightScale dimObj) 2)))

    ;; Increase the tolerance height scale for this dimension
    (vla-put-ToleranceHeightScale dimObj (1+ (vla-get-ToleranceHeightScale dimObj)))

    (vla-Regen doc acAllViewports)

    ;; Read and display the current tolerance height scale for this dimension
    (alert (strcat "The tolerance height scale is now set to: " (rtos (vla-get-ToleranceHeightScale dimObj) 2)))
)


ToleranceJustification Property (ActiveX)

Specifies the vertical justification of tolerance values relative to the nominal dimension text.

Supported platforms: Windows only

Signature

VBA:

object.ToleranceJustification
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: acDimToleranceJustify enum

  • acTolTop
  • acTolMiddle
  • acTolBottom

Remarks

The initial value for this property is acTolMiddle.

This property is only available when the ToleranceDisplay property is set to any value other than acTolNone.

NoteThis property overrides the value of the DIMTOLJ system variable for the given dimension.

Examples

VBA:

Sub Example_ToleranceJustification()
    ' This example creates an aligned dimension in model space and
    ' sets the tolerance justification for the dimension to
    ' a couple of common values
    '
    ' * Note the vertical position of the tolerance text

    Dim dimObj As AcadDimAligned
    Dim newText As AcadTextStyle
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim CurrentDisplay As String

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 5.5: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Turn on tolerance display and increase the dimension text height,
    ' so the alignment of the tolerance is visible
    dimObj.ToleranceDisplay = acTolSymmetrical
    dimObj.textHeight = 1
    dimObj.ToleranceHeightScale = 0.25

    ThisDrawing.Application.ZoomAll

    ' Read and display the current tolerance justification for this dimension
    Select Case dimObj.ToleranceJustification
        Case acTolBottom: CurrentDisplay = "Bottom"
        Case acTolTop: CurrentDisplay = "Top"
        Case acTolMiddle: CurrentDisplay = "Middle"
    End Select

    MsgBox "The tolerance justification is currently: " & CurrentDisplay

    ' Set the tolerance justification for this dimension
    dimObj.ToleranceJustification = acTolBottom

    ThisDrawing.Regen acAllViewports

    ' Display the current tolerance justification for this dimension
    MsgBox "The tolerance display is now set to: Bottom"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ToleranceJustification()
    ;; This example creates an aligned dimension in model space and
    ;; sets the tolerance justification for the dimension to
    ;; a couple of common values
    ;;
    ;; * Note the vertical position of the tolerance text
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 5.5 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Turn on tolerance display and increase the dimension text height,
    ;; so the alignment of the tolerance is visible
    (vla-put-ToleranceDisplay dimObj acTolSymmetrical)
    (vla-put-TextHeight dimObj 1)
    (vla-put-ToleranceHeightScale dimObj 0.25)

    (vla-ZoomAll acadObj)
    (vla-Regen doc acAllViewports)

    ;; Read and display the current tolerance justification for this dimension
    (setq currentDisplay (cond
                             ((= (vla-get-ToleranceJustification dimObj) acTolBottom) "Bottom")
                             ((= (vla-get-ToleranceJustification dimObj) acTolTop) "Top")
                             ((= (vla-get-ToleranceJustification dimObj) acTolMiddle) "Middle")
                         ))

    (alert (strcat "The tolerance justification is currently: " currentDisplay))

    ;; Set the tolerance justification for this dimension
    (vla-put-ToleranceJustification dimObj acTolBottom)

    (vla-Regen doc acAllViewports)

    ;; Display the current tolerance justification for this dimension
    (alert "The tolerance display is now set to: Bottom")
)


ToleranceLowerLimit Property (ActiveX)

Specifies the minimum tolerance limit for dimension text.

Supported platforms: Windows only

Signature

VBA:

object.ToleranceLowerLimit
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The tolerance lower limit.

Remarks

The initial value for this property is 0.0000.

This property is only available when the ToleranceDisplay property is set to acTolDeviation or acTolLimits.

NoteThis property overrides the value of the DIMTM system variable for the given dimension.

Examples

VBA:

Sub Example_ToleranceLowerLimit()
    ' This example creates an aligned dimension in model space and
    ' sets the tolerance limits using the ToleranceLowerLimit and
    ' ToleranceUpperLimit properties

    Dim dimObj As AcadDimAligned
    Dim newText As AcadTextStyle
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 5.5: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Turn on tolerance display
    dimObj.ToleranceDisplay = acTolSymmetrical

    ThisDrawing.Application.ZoomAll

    ' Read and display the tolerance limits for the dimension
    MsgBox "The tolerance lower limit is set to: " & dimObj.ToleranceLowerLimit & vbCrLf & _
           "The tolerance upper limit is set to: " & dimObj.ToleranceUpperLimit

    ' Adjust the tolerance limits for this dimension
    dimObj.ToleranceLowerLimit = 0.0001
    dimObj.ToleranceUpperLimit = 0.005

    ThisDrawing.Regen acAllViewports

    ' Read and display the tolerance limits for the dimension
    MsgBox "The tolerance lower limit is now set to: " & dimObj.ToleranceLowerLimit & vbCrLf & _
           "The tolerance upper limit is now set to: " & dimObj.ToleranceUpperLimit

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ToleranceLowerLimit()
    ;; This example creates an aligned dimension in model space and
    ;; sets the tolerance limits using the ToleranceLowerLimit and
    ;; ToleranceUpperLimit properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 5.5 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Turn on tolerance display
    (vla-put-ToleranceDisplay dimObj acTolSymmetrical)

    (vla-ZoomAll acadObj)
    (vla-Regen doc acAllViewports)

    ;; Read and display the tolerance limits for the dimension
    (alert (strcat "The tolerance lower limit is set to: " (rtos (vla-get-ToleranceLowerLimit dimObj) 2)
                   "\nThe tolerance upper limit is set to: " (rtos (vla-get-ToleranceUpperLimit dimObj) 2)))

    ;; Adjust the tolerance limits for this dimension
    (vla-put-ToleranceLowerLimit dimObj 0.0001)
    (vla-put-ToleranceUpperLimit dimObj 0.005)

    (vla-Regen doc acAllViewports)

    ;; Read and display the tolerance limits for the dimension
    (alert (strcat "The tolerance lower limit is now set to: " (rtos (vla-get-ToleranceLowerLimit dimObj) 2)
                   "\nThe tolerance upper limit is now set to: " (rtos (vla-get-ToleranceUpperLimit dimObj) 2)))
)


TolerancePrecision Property (ActiveX)

Specifies the precision of tolerance values in primary dimensions.

Supported platforms: Windows only

Signature

VBA:

object.TolerancePrecision
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: acDimPrecision enum

  • acDimPrecisionZero: 0.
  • acDimPrecisionOne: 0.0
  • acDimPrecisionTwo: 0.00
  • acDimPrecisionThree: 0.000
  • acDimPrecisionFour: 0.0000
  • acDimPrecisionFive: 0.00000
  • acDimPrecisionSix: 0.000000
  • acDimPrecisionSeven: 0.0000000
  • acDimPrecisionEight: 0.00000000

Remarks

The initial value for this property is acDimPrecisionFour.

This property is only available when the ToleranceDisplay property is set to any value other than acTolNone.

NoteThis property overrides the value of the DIMTDEC system variable for the given dimension.

Examples

VBA:

Sub Example_TolerancePrecision()
    ' This example creates an aligned dimension in model space and
    ' uses TolerancePrecision to allow the user to change the
    ' precision of the dimension tolerance

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim oldTolerance As String, newTolerance As String

    ' Define the dimension
    point1(0) = 0: point1(1) = 5: point1(2) = 0
    point2(0) = 5.12345678: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Enable and setup tolerance display
    dimObj.ToleranceDisplay = acTolSymmetrical
    dimObj.ToleranceLowerLimit = -0.0001
    dimObj.ToleranceUpperLimit = 0.005

    ThisDrawing.Application.ZoomAll

    ' Store old tolerance value as default for input box
    oldTolerance = dimObj.TolerancePrecision

    ' Allow the user to change the precision for the dimension tolerance
    newTolerance = InputBox("Enter a new tolerance precision for the dimension.  The value must range from 0 to 8.", "Dimension Tolerance Precision", oldTolerance)

    Select Case newTolerance
        Case 0: newTolerance = acDimPrecisionZero
        Case 1: newTolerance = acDimPrecisionOne
        Case 2: newTolerance = acDimPrecisionTwo
        Case 3: newTolerance = acDimPrecisionThree
        Case 4: newTolerance = acDimPrecisionFour
        Case 5: newTolerance = acDimPrecisionFive
        Case 6: newTolerance = acDimPrecisionSix
        Case 7: newTolerance = acDimPrecisionSeven
        Case 8: newTolerance = acDimPrecisionEight
        Case Else
            MsgBox "The tolerance precision has not been changed."
            Exit Sub
    End Select

    dimObj.TolerancePrecision = newTolerance   ' Commit changes to tolerance precision

    ThisDrawing.Regen acAllViewports

    ' Read back and display the dimension tolerance precision
    newTolerance = dimObj.TolerancePrecision
    MsgBox "The tolerance precision has been set to " & newTolerance & " decimal places"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TolerancePrecision()
    ;; This example creates an aligned dimension in model space and
    ;; uses TolerancePrecision to allow the user to change the
    ;; precision of the dimension tolerance
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 0 5 0)
          point2 (vlax-3d-point 5.12345678 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Enable and setup tolerance display
    (vla-put-ToleranceDisplay dimObj acTolSymmetrical)
    (vla-put-ToleranceLowerLimit dimObj -0.0001)
    (vla-put-ToleranceUpperLimit dimObj 0.005)

    (vla-ZoomAll acadObj)

    ;; Store old tolerance value as default for input box
    (setq oldTolerance (vla-get-TolerancePrecision dimObj))

    ;; Allow the user to change the precision for the dimension tolerance
    (setq newTolerance (vla-GetInteger (vla-get-Utility doc) (strcat "\nEnter a new tolerance precision for the dimension (0 to 8) <" (itoa oldTolerance) ">: ")))

    (if (= newTolerance nil) (setq newTolerance oldTolerance))

    (setq newTolerance (cond
                           ((= newTolerance 0) acDimPrecisionZero)
                           ((= newTolerance 1) acDimPrecisionOne)
                           ((= newTolerance 2) acDimPrecisionTwo)
                           ((= newTolerance 3) acDimPrecisionThree)
                           ((= newTolerance 4) acDimPrecisionFour)
                           ((= newTolerance 5) acDimPrecisionFive)
                           ((= newTolerance 6) acDimPrecisionSix)
                           ((= newTolerance 7) acDimPrecisionSeven)
                           ((= newTolerance 8) acDimPrecisionEight)
                           (progn (setq newTolerance nil) (alert "The tolerance precision has not been changed."))
                       ))

    (if (/= newTolerance nil)
        (progn
            (vla-put-TolerancePrecision dimObj newTolerance)   ;; Commit changes to tolerance precision

            (vla-Regen doc acAllViewports)

            ;; Read back and display the dimension tolerance precision
            (alert (strcat "The tolerance precision has been set to " (itoa (vla-get-TolerancePrecision dimObj)) " decimal places"))
        )
    )
)


ToleranceSuppressLeadingZeros Property (ActiveX)

Specifies the suppression of leading zeros in tolerance values.

Supported platforms: Windows only

Signature

VBA:

object.ToleranceSuppressLeadingZeros
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress leading zeros in decimal values. For example, 0.5000 becomes .5000.
  • False: Do not suppress leading zeros in decimal values.

Remarks

The initial value for this property is False.

NoteThis value overrides the value for the DIMTZIN system variable.

Examples

VBA:

Sub Example_ToleranceSuppressLeadingZeros()
    ' This example creates an aligned dimension in model space and
    ' uses ToleranceSuppressLeadingZeros to toggle the display of leading zeros
    ' in the dimension tolerance display

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 5.01: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Enable and setup tolerance display
    dimObj.ToleranceDisplay = acTolSymmetrical
    dimObj.ToleranceLowerLimit = -0.0001: dimObj.ToleranceUpperLimit = 0.005

    ThisDrawing.Application.ZoomAll

Toggle:
    Select Case MsgBox("Press OK to toggle the display of leading zeros in the dimension tolerance", vbOKCancel)
        Case vbOK
            ' Toggle the display of leading zeros for the dimension tolerance value
            dimObj.ToleranceSuppressLeadingZeros = Not (dimObj.ToleranceSuppressLeadingZeros)
            ThisDrawing.Regen acAllViewports

        Case vbCancel
            Exit Sub
    End Select

    GoTo Toggle
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ToleranceSuppressLeadingZeros()
    ;; This example creates an aligned dimension in model space and
    ;; uses ToleranceSuppressLeadingZeros to toggle the display of leading zeros
    ;; in the dimension tolerance display
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 5.01 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Enable and setup tolerance display
    (vla-put-ToleranceDisplay dimObj acTolSymmetrical)
    (vla-put-ToleranceLowerLimit dimObj -0.0001)
    (vla-put-ToleranceUpperLimit dimObj 0.005)

    (vla-ZoomAll acadObj)

    ;; Toggle the display of leading zeros for the dimension tolerance value
    (vla-put-ToleranceSuppressLeadingZeros dimObj (if (= (vla-get-ToleranceSuppressLeadingZeros dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of leading zeros toggled.")

    ;; Toggle the display of leading zeros for the dimension tolerance value back to previous state
    (vla-put-ToleranceSuppressLeadingZeros dimObj (if (= (vla-get-ToleranceSuppressLeadingZeros dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of leading zeros toggled back.")
)


ToleranceSuppressTrailingZeros Property (ActiveX)

Specifies the suppression of trailing zeros in dimension values.

Supported platforms: Windows only

Signature

VBA:

object.ToleranceSuppressTrailingZeros
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress trailing zeros in decimal values. For example, 12.5000 becomes 12.5.
  • False: Do not suppress trailing zeros in decimal values.

Remarks

The initial value for this property is False.

NoteThis value overrides the value for the DIMTZIN system variable.

Examples

VBA:

Sub Example_ToleranceSuppressTrailingZeros()
    ' This example creates an aligned dimension in model space and
    ' uses ToleranceSuppressTrailingZeros to toggle the display of trailing zeros
    ' in the dimension tolerance display

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 5.01: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Enable and setup tolerance display
    dimObj.ToleranceDisplay = acTolSymmetrical
    dimObj.ToleranceLowerLimit = -0.0001: dimObj.ToleranceUpperLimit = 0.005

    ThisDrawing.Application.ZoomAll

Toggle:
    Select Case MsgBox("Press OK to toggle the display of trailing zeros in the dimension tolerance", vbOKCancel)
        Case vbOK
            ' Toggle the display of trailing zeros for the dimension tolerance value
            dimObj.ToleranceSuppressTrailingZeros = Not (dimObj.ToleranceSuppressTrailingZeros)
            ThisDrawing.Regen acAllViewports

        Case vbCancel
            Exit Sub
    End Select

    GoTo Toggle
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ToleranceSuppressTrailingZeros()
    ;; This example creates an aligned dimension in model space and
    ;; uses ToleranceSuppressTrailingZeros to toggle the display of trailing zeros
    ;; in the dimension tolerance display
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 5.01 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Enable and setup tolerance display
    (vla-put-ToleranceDisplay dimObj acTolSymmetrical)
    (vla-put-ToleranceLowerLimit dimObj -0.0001)
    (vla-put-ToleranceUpperLimit dimObj 0.005)

    (vla-ZoomAll acadObj)

    ;; Toggle the display of trailing zeros for the dimension tolerance value
    (vla-put-ToleranceSuppressTrailingZeros dimObj (if (= (vla-get-ToleranceSuppressTrailingZeros dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of trailing zeros toggled.")

    ;; Toggle the display of trailing zeros for the dimension tolerance value back to previous state
    (vla-put-ToleranceSuppressTrailingZeros dimObj (if (= (vla-get-ToleranceSuppressTrailingZeros dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of trailing zeros toggled back.")
)


ToleranceSuppressZeroFeet Property (ActiveX)

Specifies the suppression of a zero foot measurement in tolerance values.

Supported platforms: Windows only

Signature

VBA:

object.ToleranceSuppressZeroFeet
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress the display of a zero foot measurement.
  • False: Do not suppress the display of a zero foot measurement.

Remarks

The initial value for this property is False.

NoteThis property overrides the value for the DIMTZIN system variable for the given dimension.

Examples

VBA:

Sub Example_ToleranceSuppressZeroFeet()
    ' This example creates an aligned dimension in model space and
    ' uses ToleranceSuppressZeroFeet to toggle the display of zeros feet
    ' in the dimension tolerance display

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 6.01: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 8: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    dimObj.UnitsFormat = acDimLArchitectural

    ' Enable and setup tolerance display
    dimObj.ToleranceDisplay = acTolLimits
    dimObj.ToleranceLowerLimit = -0.0001: dimObj.ToleranceUpperLimit = 0.0001

    ZoomAll

Toggle:
    Select Case MsgBox("Press OK to toggle the display of zero feet in the dimension tolerance", vbOKCancel)
        Case vbOK
            ' Toggle the display of zero feet for the dimension tolerance value
            dimObj.ToleranceSuppressZeroFeet = Not (dimObj.ToleranceSuppressZeroFeet)
            ThisDrawing.Regen acAllViewports

        Case vbCancel
            Exit Sub
    End Select

    GoTo Toggle
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ToleranceSuppressZeroFeet()
    ;; This example creates an aligned dimension in model space and
    ;; uses ToleranceSuppressZeroFeet to toggle the display of zeros feet
    ;; in the dimension tolerance display
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 6.01 5 0)
          location (vlax-3d-point 5 8 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-put-UnitsFormat dimObj acDimLArchitectural)

    ;; Enable and setup tolerance display
    (vla-put-ToleranceDisplay dimObj acTolLimits)
    (vla-put-ToleranceLowerLimit dimObj -0.0001)
    (vla-put-ToleranceUpperLimit dimObj 0.0001)

    (vla-ZoomAll acadObj)

    ;; Toggle the display of zero feet for the dimension tolerance value
    (vla-put-ToleranceSuppressZeroFeet dimObj (if (= (vla-get-ToleranceSuppressZeroFeet dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of zero feet toggled.")

    ;; Toggle the display of zero feet for the dimension tolerance value back to previous state
    (vla-put-ToleranceSuppressZeroFeet dimObj (if (= (vla-get-ToleranceSuppressZeroFeet dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of zero feet toggled back.")
)


ToleranceSuppressZeroInches Property (ActiveX)

Specifies the suppression of a zero inch measurement in tolerance values.

Supported platforms: Windows only

Signature

VBA:

object.ToleranceSuppressZeroInches
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Suppress the display of a zero inch measurement.
  • False: Do not suppress the display of a zero inch measurement.

Remarks

The initial value for this property is False.

NoteThis property overrides the value for the DIMTZIN system variable for the given dimension.

Examples

VBA:

Sub Example_ToleranceSuppressZeroInches()
    ' This example creates an aligned dimension in model space and
    ' uses ToleranceSuppressZeroInches to toggle the display of zeros inches
    ' in the dimension tolerance display

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 6.01: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 8: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    dimObj.UnitsFormat = acDimLArchitectural

    ' Enable and setup tolerance display
    dimObj.ToleranceDisplay = acTolLimits
    dimObj.ToleranceLowerLimit = -95#: dimObj.ToleranceUpperLimit = 95#

    ZoomAll

Toggle:
    Select Case MsgBox("Press OK to toggle the display of zero inches in the dimension tolerance", vbOKCancel)
        Case vbOK
            ' Toggle the display of zero inches for the dimension tolerance value
            dimObj.ToleranceSuppressZeroInches = Not (dimObj.ToleranceSuppressZeroInches)
            ThisDrawing.Regen acAllViewports

        Case vbCancel
            Exit Sub
    End Select

    GoTo Toggle
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ToleranceSuppressZeroInches()
    ;; This example creates an aligned dimension in model space and
    ;; uses ToleranceSuppressZeroInches to toggle the display of zeros inches
    ;; in the dimension tolerance display
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 6.01 5 0)
          location (vlax-3d-point 5 8 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-put-UnitsFormat dimObj acDimLArchitectural)

    ;; Enable and setup tolerance display
    (vla-put-ToleranceDisplay dimObj acTolLimits)
    (vla-put-ToleranceLowerLimit dimObj -95)
    (vla-put-ToleranceUpperLimit dimObj 95)

    (vla-ZoomAll acadObj)

    ;; Toggle the display of zero inches for the dimension tolerance value
    (vla-put-ToleranceSuppressZeroInches dimObj (if (= (vla-get-ToleranceSuppressZeroInches dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of zero inches toggled.")

    ;; Toggle the display of zero inches for the dimension tolerance value back to previous state
    (vla-put-ToleranceSuppressZeroInches dimObj (if (= (vla-get-ToleranceSuppressZeroInches dimObj) :vlax-true) :vlax-false :vlax-true))
    (vla-Regen doc acAllViewports)
    (alert "Suppression of zero inches toggled back.")
)


ToleranceUpperLimit Property (ActiveX)

Specifies the maximum tolerance limit for dimension text.

Supported platforms: Windows only

Signature

VBA:

object.ToleranceUpperLimit
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The objects this property applies to.

Property Value

Read-only: No

Type: Double

The tolerance lower limit.

Remarks

The initial value for this property is 0.0000.

This property is only available when the ToleranceDisplay property is set to acTolSymmetrical, acTolDeviation, or acTolLimits.

NoteThis property overrides the value of the DIMTP system variable for the given dimension.

Examples

VBA:

Sub Example_ToleranceLowerLimit()
    ' This example creates an aligned dimension in model space and
    ' sets the tolerance limits using the ToleranceLowerLimit and
    ' ToleranceUpperLimit properties

    Dim dimObj As AcadDimAligned
    Dim newText As AcadTextStyle
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 5.5: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)

    ' Turn on tolerance display
    dimObj.ToleranceDisplay = acTolSymmetrical

    ThisDrawing.Application.ZoomAll

    ' Read and display the tolerance limits for the dimension
    MsgBox "The tolerance lower limit is set to: " & dimObj.ToleranceLowerLimit & vbCrLf & _
           "The tolerance upper limit is set to: " & dimObj.ToleranceUpperLimit

    ' Adjust the tolerance limits for this dimension
    dimObj.ToleranceLowerLimit = 0.0001
    dimObj.ToleranceUpperLimit = 0.005

    ThisDrawing.Regen acAllViewports

    ' Read and display the tolerance limits for the dimension
    MsgBox "The tolerance lower limit is now set to: " & dimObj.ToleranceLowerLimit & vbCrLf & _
           "The tolerance upper limit is now set to: " & dimObj.ToleranceUpperLimit

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ToleranceLowerLimit()
    ;; This example creates an aligned dimension in model space and
    ;; sets the tolerance limits using the ToleranceLowerLimit and
    ;; ToleranceUpperLimit properties
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 5.5 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))

    ;; Turn on tolerance display
    (vla-put-ToleranceDisplay dimObj acTolSymmetrical)

    (vla-ZoomAll acadObj)
    (vla-Regen doc acAllViewports)

    ;; Read and display the tolerance limits for the dimension
    (alert (strcat "The tolerance lower limit is set to: " (rtos (vla-get-ToleranceLowerLimit dimObj) 2)
                   "\nThe tolerance upper limit is set to: " (rtos (vla-get-ToleranceUpperLimit dimObj) 2)))

    ;; Adjust the tolerance limits for this dimension
    (vla-put-ToleranceLowerLimit dimObj 0.0001)
    (vla-put-ToleranceUpperLimit dimObj 0.005)

    (vla-Regen doc acAllViewports)

    ;; Read and display the tolerance limits for the dimension
    (alert (strcat "The tolerance lower limit is now set to: " (rtos (vla-get-ToleranceLowerLimit dimObj) 2)
                   "\nThe tolerance upper limit is now set to: " (rtos (vla-get-ToleranceUpperLimit dimObj) 2)))
)


Toolbars Property (ActiveX)

Gets the Toolbars collection.

Supported platforms: Windows only

Signature

VBA:

object.Toolbars
object

Type: MenuGroup

The object this property applies to.

Property Value

Read-only: Yes

Type: Toolbars

A user-specified variable declared as a Toolbars collection.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Toolbars()
    ' This example finds the names of the all toolbars in the first menu group.

    Dim toolbarNames As String
    Dim toolbarCollection As AcadToolbars
    Dim toolbar As AcadToolbar

    Set toolbarCollection = ThisDrawing.Application.MenuGroups.Item(0).Toolbars
    toolbarNames = ""
    For Each toolbar In toolbarCollection
        toolbarNames = toolbarNames & toolbar.name & vbCrLf
    Next toolbar
    MsgBox toolbarNames
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Toolbars()
    ;; This example finds the names of the all toolbars in the first menu group.
    (setq acadObj (vlax-get-acad-object))

    (setq toolbarCollection (vla-get-Toolbars (vla-Item (vla-get-MenuGroups acadObj) 0))
          toolbarNames "")

    (vlax-for toolbar toolbarCollection
        (setq toolbarNames (strcat toolbarNames (vla-get-Name toolbar) "\n"))
    )

    (alert toolbarNames)
)


ToolPalettePath Property (ActiveX)

Sets the tool palette path.

Supported platforms: Windows only

Signature

VBA:

object.ToolPalettePath
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The tool palette path.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ToolPalettePath()
    'This example changes the tool palette path
    'and then sets it to its original string

    Dim pref As AutoCAD.AcadPreferencesFiles
    Set pref = AcadApplication.Preferences.Files

    Dim defToolPalettePath As String
    Dim changedToolPalettePath As String

    defToolPalettePath = pref.ToolPalettePath
    MsgBox "The current tool palette path is " & defToolPalettePath

    pref.ToolPalettePath = "c:\winnt;c:\temp"
    changedToolPalettePath = pref.ToolPalettePath
    MsgBox "The changed tool palette path is " & changedToolPalettePath

    pref.ToolPalettePath = defToolPalettePath
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ToolPalettePath()
    ;; This example changes the tool palette path
    ;; and then sets it to its original string
    (setq acadObj (vlax-get-acad-object))
    (setq pref (vla-get-Files (vla-get-Preferences acadObj)))

    (setq defToolPalettePath (vla-get-ToolPalettePath pref))
    (alert (strcat "The current tool palette path is " defToolPalettePath))

    (vla-put-ToolPalettePath pref "c:\\winnt;c:\\temp")
    (alert (strcat "The changed tool palette path is " (vla-get-ToolPalettePath pref)))

    (vla-put-ToolPalettePath pref defToolPalettePath)
)


Top Property (ActiveX)

Specifies the top edge of a toolbar.

Supported platforms: Windows only

Signature

VBA:

object.Top
object

Type: Toolbar

The object this property applies to.

Property Value

Read-only: No

Type: Integer

The top edge of the toolbar.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Top()
    ' This example creates a new toolbar called and inserts a
    ' button into it. The toolbar is then displayed and the top
    ' position is returned.
    ' To remove the toolbar after execution of this macro, use the Customize Menu
    ' option from the Tools menu.

    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

    ' Create the new toolbar
    Dim newToolBar As AcadToolbar
    Set newToolBar = currMenuGroup.Toolbars.Add("TestToolbar")

    ' Add a button to the new toolbar.
    Dim newButton1 As AcadToolbarItem
    Dim openMacro As String

    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)

    Set newButton1 = newToolBar.AddToolbarButton("", "NewButton1", "Open a file.", openMacro)

    ' Display the toolbar
    newToolBar.Visible = True

    'Find the top position
    Dim currTop As Integer
    currTop = newToolBar.Top
    MsgBox "The current value of Top is " & newToolBar.Top, , "Top Example"

    ' Change the value of Top
    newToolBar.Top = currTop + 100
    MsgBox "The new value of Top is " & newToolBar.Top, , "Top Example"

    ' Reset the value of Top
    newToolBar.Top = currTop
    MsgBox "The value of Top has been reset to " & newToolBar.Top, , "Top Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Top()
    ;; This example creates a new toolbar called and inserts a
    ;; button into it. The toolbar is then displayed and the top
    ;; position is returned.
    ;; To remove the toolbar after execution of this macro, use the Customize Menu
    ;; option from the Tools menu.
    (setq acadObj (vlax-get-acad-object))
    (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))

    ;; Create the new toolbar
    (setq newToolBar (vla-Add (vla-get-Toolbars currMenuGroup) "TestToolbar"))

    ;; Add a button to the new toolbar.
    ;; Assign the macro string the VB equivalent of "ESC ESC _open "
    (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))

    (setq newButton1 (vla-AddToolbarButton newToolBar "" "NewButton1" "Open a file." openMacro))

    ;; Display the toolbar
    (vla-put-Visible newToolBar :vlax-true)

    ;; Find the top position
    (setq currTop (vla-get-Top newToolBar))
    (alert (strcat "The current value of Top is " (itoa currTop)))

    ;; Change the value of Top
    (vla-put-Top newToolBar (+ currTop 100))
    (alert (strcat "The new value of Top is " (itoa (vla-get-Top newToolBar))))

    ;; Reset the value of Top
    (vla-put-Top newToolBar currTop)
    (alert (strcat "The value of Top has been reset to " (itoa (vla-get-Top newToolBar))))
)


TopHeight Property (ActiveX)

Specifies elevation of section plane top extents relative to the object’s elevation.

Supported platforms: Windows only

Signature

VBA:

object.TopHeight
object

Type: Section

The object this property applies to.

Property Value

Read-only: No

Type: Double

Height of the section plane's top.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


TopRadius Property (ActiveX)

Specifies the top radius of the helix.

Supported platforms: Windows only

Signature

VBA:

object.TopRadius
object

Type: Helix

The object this property applies to.

Property Value

Read-only: No

Type: Double

Radius of the helix object's top.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


TotalAngle Property (ActiveX)

Gets the total angle for the arc.

Supported platforms: Windows only

Signature

VBA:

object.TotalAngle
object

Type: Arc

The object this property applies to.

Property Value

Read-only: Yes

Type: Double

The total length of the arc in radians.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_TotalAngle()
    ' This example creates an Arc in model space and
    ' returns the total angle of the new Arc

    Dim arcObj As AcadArc
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    Dim startAngleInDegree As Double, endAngleInDegree As Double
    Dim startAngleInRadian As Double, endAngleInRadian As Double

    ' Define the Arc
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    radius = 5#
    startAngleInDegree = 10#: endAngleInDegree = 230#

    ' Convert the angles in degrees to angles in radians
    startAngleInRadian = startAngleInDegree * 3.141592 / 180#
    endAngleInRadian = endAngleInDegree * 3.141592 / 180#

    ' Create the arc object in model space
    Set arcObj = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngleInRadian, endAngleInRadian)
    ThisDrawing.Application.ZoomAll

    ' Return length of new arc
    MsgBox "The total angle of the new Arc is: " & arcObj.TotalAngle
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TotalAngle()
    ;; This example creates an Arc in model space and
    ;; returns the total angle of the new Arc
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the arc
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius 5
          startAngleInDegree 10
          endAngleInDegree 230)

    ;; Convert the angles in degrees to angles in radians
    (setq startAngleInRadian (/ (* startAngleInDegree 3.141592) 180))
    (setq endAngleInRadian (/ (* endAngleInDegree 3.141592) 180))

    ;; Create the arc object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq arcObj (vla-AddArc modelSpace centerPoint radius startAngleInRadian endAngleInRadian))
    (vla-ZoomAll acadObj)

    ;; Return length of new arc
    (alert (strcat "The total angle of the new Arc is: " (rtos (vla-get-TotalAngle arcObj) 2)))
)


TotalLength Property (ActiveX)

Specifies the total length of the helix.

Supported platforms: Windows only

Signature

VBA:

object.TotalLength
object

Type: Helix

The object this property applies to.

Property Value

Read-only: No

Type: Double

The total length of the helix.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Helix_BaseRadius()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.BaseRadius = helix.BaseRadius * 2
            MsgBox "Baseradius of helix is doubled to " & helix.BaseRadius * 2
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_TopRadius()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.TopRadius = helix.TopRadius * 0.5
            MsgBox "Top radius of helix is halved to " & helix.TopRadius * 0.5
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Direction()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            If helix.Twist = acCCW Then
                helix.Twist = acCW
            Else
                helix.Twist = acCCW
            End If
            MsgBox "Direction is reversed"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Height()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acHeight
            helix.height = helix.height * 2
            MsgBox "Height doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Turns()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acTurns
            helix.Turns = helix.Turns * 2
            MsgBox "Turns doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_TurnHeight()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acTurnHeight
            helix.TurnHeight = helix.TurnHeight * 2
            MsgBox "Turns height doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Helix_BaseRadius()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-BaseRadius helix (* (vla-get-BaseRadius helix) 2))
                (alert (strcat "Baseradius of helix is doubled to " (rtos (vla-get-BaseRadius helix) 2)))
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_TopRadius()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-TopRadius helix (* (vla-get-TopRadius helix) 0.5))
                (alert (strcat "Top radius of helix is halved to " (rtos (vla-get-TopRadius helix) 2)))
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Direction()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
            (if (= (vla-get-Twist helix) acCCW)
                (vla-put-Twist helix acCW)
                (vla-put-Twist helix acCCW)
            )
                (alert "Direction is reversed")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Height()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acHeight)
                (vla-put-Height helix (* (vla-get-Height helix) 2))
                (alert "Height doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Turns()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acTurns)
                (vla-put-Turns helix (* (vla-get-Turns helix) 2))
                (alert "Turns doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_TurnHeight()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acTurnHeight)
                (vla-put-TurnHeight helix (* (vla-get-TurnHeight helix) 2))
                (alert "Turns height doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)


TranslateIDs Property (ActiveX)

Specifies the translation of any contained object IDs during deepClone or wblockClone operations.

Supported platforms: Windows only

Signature

VBA:

object.TranslateIDs
object

Type: XRecord

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Translate contained IDs during deepClone and wblockClone operations.
  • False: Do not translate contained IDs during deepClone and wblockClone operations.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_TranslateIDs()
    ' This example creates a new XRecord if one doesn't exist,
    ' and toggles the setting for TranslateIDs

    Dim TrackingDictionary As AcadDictionary, TrackingXRecord As AcadXRecord
    Dim XRecordDataType As Variant, XRecordData As Variant
    Dim ArraySize As Long, iCount As Long
    Dim DataType As Integer, Data As String, msg As String

    ' Unique identifiers to distinguish our XRecordData from other XRecordData
    Const TYPE_STRING = 1
    Const TAG_DICTIONARY_NAME = "ObjectTrackerDictionary"
    Const TAG_XRECORD_NAME = "ObjectTrackerXRecord"

    ' Connect to the dictionary we store the XRecord in
    On Error GoTo CREATE
    Set TrackingDictionary = ThisDrawing.Dictionaries(TAG_DICTIONARY_NAME)
    Set TrackingXRecord = TrackingDictionary.GetObject(TAG_XRECORD_NAME)
    On Error GoTo 0

    ' Get current XRecordData
    TrackingXRecord.GetXRecordData XRecordDataType, XRecordData

    ' If we don't have an array already then create one
    If VarType(XRecordDataType) And vbArray = vbArray Then
        ArraySize = UBound(XRecordDataType) + 1       ' Get the size of the data elements returned
        ArraySize = ArraySize + 1                        ' Increase to hold new data

        ReDim Preserve XRecordDataType(0 To ArraySize)
        ReDim Preserve XRecordData(0 To ArraySize)
    Else
        ArraySize = 0
        ReDim XRecordDataType(0 To ArraySize) As Integer
        ReDim XRecordData(0 To ArraySize) As Variant
    End If

    ' Find the current value of TranslateIDs
    Dim currXlate As Boolean
    currXlate = TrackingXRecord.TranslateIDs
    MsgBox "The current setting of the TranslateIDs is " & currXlate

    ' Toggle the setting
    TrackingXRecord.TranslateIDs = Not currXlate
    MsgBox "The new setting for the TranslateIDs is " & TrackingXRecord.TranslateIDs

    ' Reset the value
    TrackingXRecord.TranslateIDs = currXlate
    MsgBox "TranslateIDs has been reset to " & TrackingXRecord.TranslateIDs

    Exit Sub

CREATE:
    ' Create the entities that hold our XRecordData
    If TrackingDictionary Is Nothing Then  ' Make sure we have our tracking object
        Set TrackingDictionary = ThisDrawing.Dictionaries.Add(TAG_DICTIONARY_NAME)
        Set TrackingXRecord = TrackingDictionary.AddXRecord(TAG_XRECORD_NAME)
    End If

    Resume
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TranslateIDs()
    ;; This example creates a new XRecord if one doesn't exist,
    ;; and toggles the setting for TranslateIDs
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Unique identifiers to distinguish our XRecordData from other XRecordData
    (setq TYPE_STRING 1
          TAG_DICTIONARY_NAME "ObjectTrackerDictionary"
          TAG_XRECORD_NAME "ObjectTrackerXRecord")

    ;; Connect to the dictionary we store the XRecord in
    (setq dictionaries (vla-get-Dictionaries doc))
    (setq TrackingDictionary (vl-catch-all-apply 'vla-Item (list dictionaries TAG_DICTIONARY_NAME)))

    ;; (= (vl-catch-all-error-message TrackingDictionary) "Automation Error. Key not found")

    (if (= (type TrackingDictionary) 'VLA-OBJECT)
        (setq TrackingXRecord (vla-GetObject TrackingDictionary TAG_XRECORD_NAME))
        (progn
            ;; Create the objects that hold this XRecordData
            (setq TrackingDictionary (vla-Add dictionaries TAG_DICTIONARY_NAME))
            (setq TrackingXRecord  (vla-AddXRecord TrackingDictionary TAG_XRECORD_NAME))
           )
    )

    ;; Get current XRecordData
    (vla-GetXRecordData TrackingXRecord 'temp-XRecordDataType 'temp-XRecordData)

    ;; If we don't have an array already then create one
    (setq ArraySize 0)
    (if (/= temp-XRecordDataType nil)
        (progn
        (setq ArraySize (vlax-safearray-get-u-bound temp-XRecordDataType 1))
            (setq XRecordDataType (vlax-make-safearray vlax-vbInteger (cons 0 (1+ ArraySize))))
            (setq XRecordData (vlax-make-safearray vlax-vbVariant (cons 0 (1+ ArraySize))))

            (setq iCount 0)
            (while (>= ArraySize iCount)
                ;; Get information for this element
                (setq DataType (vlax-safearray-get-element temp-XRecordDataType iCount))
                (setq Data (vlax-variant-value (vlax-safearray-get-element temp-XRecordData iCount)))

                (vlax-safearray-put-element XRecordDataType iCount DataType)
                (vlax-safearray-put-element XRecordData iCount Data)

                (setq iCount (1+ iCount))
            )
           )
        (progn
            (setq XRecordDataType (vlax-make-safearray vlax-vbInteger '(0 . 0)))
            (setq XRecordData (vlax-make-safearray vlax-vbVariant '(0 . 0)))
           )
    )

    ;; Find the current value of TranslateIDs
    (setq currXlate (vla-get-TranslateIDs TrackingXRecord))
    (alert (strcat "The current setting of the TranslateIDs is " (if (= currXlate :vlax-true) "True" "False")))

    ;; Toggle the setting
    (vla-put-TranslateIDs TrackingXRecord (if (= currXlate :vlax-true) :vlax-false :vlax-true))
    (alert (strcat "The new setting for the TranslateIDs is " (if (= (vla-get-TranslateIDs TrackingXRecord) :vlax-true) "True" "False")))

    ;; Reset the value
    (vla-put-TranslateIDs TrackingXRecord currXlate)
    (alert (strcat "TranslateIDs has been reset to " (if (= (vla-get-TranslateIDs TrackingXRecord) :vlax-true) "True" "False")))
)


Transparency Property (ActiveX)

Specifies if the transparency for a particular bitonal image is on or off.

Supported platforms: Windows only

Signature

VBA:

object.Transparency
object

Type: GeomapImage, RasterImage, Wipeout

The objects this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Transparency is on.
  • False: Transparency is off.

Remarks

Bitonal raster images are images consisting only of a foreground and a background color. When you attach a bitonal image, the entire image inherits current layer settings for color. In addition to the modifications you can make to any attached image, you can modify bitonal images by turning the transparency of the background on and off.

NoteBitonal images and bitonal image boundaries are always the same color.

Examples

VBA:

Sub Example_Transparency()
    ' This example inserts a raster image and finds the current status
    ' of Transparency for the image. It then changes the Transparency
    ' status of the image.

    ' This example uses the "2d Projected Polylines.jpg" found in the sample
    ' directory. If you do not have the image, or it is located
    ' in a different directory, insert a valid path and name for the
    ' imageName variable below.
    Dim insertionPoint(0 To 2) As Double
    Dim scalefactor As Double
    Dim rotAngleInDegree As Double, rotAngle As Double
    Dim imageName As String
    Dim raster As AcadRasterImage
    imageName = "C:\AutoCAD\sample\2d Projected Polylines.jpg"
    insertionPoint(0) = 2#: insertionPoint(1) = 2#: insertionPoint(2) = 0#
    scalefactor = 1#
    rotAngleInDegree = 0#
    rotAngle = rotAngleInDegree * 3.141592 / 180#

    On Error Resume Next

    ' Creates a raster image in model space
    Set raster = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotAngle)
    If Err.Description = "Filer error" Then
        MsgBox imageName & " could not be found."
        Exit Sub
    End If

    ' Find the current Transparency
    ThisDrawing.Regen True
    MsgBox "The Transparency is currently set to: " & raster.transparency, vbInformation

    ' Change the Transparency
    If (raster.transparency) Then
        raster.transparency = False
    Else
        raster.transparency = True
    End If
    ThisDrawing.Regen True
    MsgBox "The Transparency is now set to: " & raster.transparency, vbInformation
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Transparency()
    ;; This example inserts a raster image and finds the current status
    ;; of Transparency for the image. It then changes the Transparency
    ;; status of the image.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; This example uses the "2d Projected Polylines.jpg" found in the sample
    ;; directory. If you do not have the image, or it is located
    ;; in a different directory, insert a valid path and name for the
    ;; imageName variable below.
    (setq insertionPoint (vlax-3d-point 2 2 0)
          imageName ".\\Sample\\VBA\\2d Projected Polylines.jpg"
          scalefactor 1
          rotAngle (/ (* 0 3.141592) 180))

    (if (/= (findfile imageName) nil)
        (progn
            ;; Creates a raster image in model space
            (setq modelSpace (vla-get-ModelSpace doc))
            (setq raster (vla-AddRaster modelSpace (findfile imageName) insertionPoint scalefactor rotAngle))
            (vla-ZoomExtents acadObj)

            ;; Find the current Transparency
            (vla-Regen doc :vlax-true)
            (alert (strcat "The Transparency is currently set to: " (if (= (vla-get-Transparency raster) :vlax-true) "True" "False")))

            ;; Change the Transparency
            (vla-put-Transparency raster (if (= (vla-get-Transparency raster) :vlax-true) :vlax-false :vlax-true))
            (vla-Regen doc :vlax-true)
            (alert (strcat "The Transparency is currently now set to: " (if (= (vla-get-Transparency raster) :vlax-true) "True" "False")))
           )
        (alert (strcat imageName " could not be found."))
    )
)


TrueColor Property (ActiveX)

Specifies the True Color of an object.

Supported platforms: Windows only

Signature

VBA:

object.TrueColor
object

Type: All drawing objects, AttributeReference, Dimension, Group, Layer

The objects this property applies to.

Property Value

Read-only: No

Type: AcCmColor

The True Color object of the object.

Remarks

This property is used to change an object's color. Colors are identified by an AcCmColor object. This object can hold an RGB value, an ACI number (an integer from 1 to 255), or a named color. Using an RGB value, you can choose from millions of colors.

Examples

VBA:

Sub Example_TrueColor()
    ' This example draws a line and returns the RGB values
    Dim color As AcadAcCmColor
    Set color = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    color.SetRGB 80, 100, 244

    Dim line As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double

    startPoint(0) = 1#: startPoint(1) = 1#: startPoint(2) = 0#
    endPoint(0) = 5#: endPoint(1) = 5#: endPoint(2) = 0#

    Set line = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    ZoomAll

    line.TrueColor = color
    Dim retcolor As AcadAcCmColor
    Set retcolor = line.TrueColor

    MsgBox "Red = " & retcolor.Red & vbLf & _
           "Green = " & retcolor.Green & vbLf & _
           "Blue = " & retcolor.Blue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TrueColor()
    ;; This example draws a line and returns the RGB values
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq color (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB color 80 100 244)

    (setq startPoint (vlax-3d-point 1 1 0)
          endPoint (vlax-3d-point 5 5 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-ZoomAll acadObj)

    (vla-put-TrueColor lineObj color)
    (setq retcolor (vla-get-TrueColor lineObj))

    (alert (strcat "Red = " (itoa (vla-get-Red retcolor))
                   "\nGreen = " (itoa (vla-get-Green retcolor))
                   "\nBlue = " (itoa (vla-get-Blue retcolor))))
)


TrueColorImages Property (ActiveX)

Determines if raster and render images are displayed at true color or palletized color.

Supported platforms: Windows only

Signature

VBA:

object.TrueColorImages
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Displays raster and render images at the highest color resolution the operating system is capable of.
  • False: Displays raster and render images in palette colors.

Remarks

The initial value for this property is False.

Examples

VBA:

Sub Example_TrueColorImages()
    ' This example reads and modifies the preference value which determines
    ' if raster and render images are displayed at True Color or palletized color.
    ' When finished, this example resets the preference value back to
    ' it's original value.
    '
    ' This example uses the "2d Projected Polylines.jpg" found in the sample
    ' directory. If you do not have this image, or it is located
    ' in a different directory, insert a valid path and file name
    ' for the imageName variable below.

    Dim ACADPref As AcadPreferencesDisplay
    Dim originalValue As Variant, newValue As Variant
    Dim insertionPoint(0 To 2) As Double
    Dim scalefactor As Double, rotationAngle As Double
    Dim imageName As String
    Dim rasterObj As AcadRasterImage

    imageName = "c:\AutoCAD\sample\2d Projected Polylines.jpg"

    ' Define Raster object
    insertionPoint(0) = 5: insertionPoint(1) = 5: insertionPoint(2) = 0
    scalefactor = 5#: rotationAngle = 0

    On Error GoTo ERRORTRAP

    ' Loads a raster image into model space
    Set rasterObj = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotationAngle)
    ThisDrawing.Application.ZoomAll

    ' Get the display preferences object
    Set ACADPref = ThisDrawing.Application.Preferences.Display

    ' Read and display the original value
    originalValue = ACADPref.TrueColorImages
    MsgBox "The TrueColorImages preference is set to: " & originalValue

    ' Modify the TrueColorImages preference by toggling the value
    ACADPref.TrueColorImages = Not (originalValue)
    newValue = ACADPref.TrueColorImages
    ThisDrawing.Regen acAllViewports

    MsgBox "The TrueColorImages preference has been set to: " & newValue

    ' Reset the preference back to it's original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.TrueColorImages = originalValue
    ThisDrawing.Regen acAllViewports

    MsgBox "The TrueColorImages preference was reset back to: " & originalValue

    Exit Sub

    ' If you got an error (most likely a problem with the file path),
    ' then display an error message
ERRORTRAP:
    If Err.Description <> "" Then
        MsgBox Err.Description
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TrueColorImages()
    ;; This example reads and modifies the preference value which determines
    ;; if raster and render images are displayed at True Color or palletized color.
    ;; When finished, this example resets the preference value back to
    ;; it's original value.
    ;;
    ;; This example uses the "2d Projected Polylines.jpg" found in the sample
    ;; directory. If you do not have this image, or it is located
    ;; in a different directory, insert a valid path and file name
    ;; for the imageName variable below.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define Raster object
    (setq insertionPoint (vlax-3d-point 5 5 0)
          imageName ".\\Sample\\VBA\\2d Projected Polylines.jpg"
          scalefactor 5
          rotationAngle 0)

    (if (/= (findfile imageName) nil)
        (progn
            ;; Creates a raster image in model space
            (setq modelSpace (vla-get-ModelSpace doc))
            (setq raster (vla-AddRaster modelSpace (findfile imageName) insertionPoint scalefactor rotationAngle))
            (vla-ZoomExtents acadObj)

            ;; Get the display preferences object
            (setq ACADPref (vla-get-Display (vla-get-Preferences acadObj)))

            ;; Read and display the original value
            (setq originalValue (vla-get-TrueColorImages ACADPref))
            (alert (strcat "The TrueColorImages preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

            ;; Modify the TrueColorImages preference by toggling the value
            (vla-put-TrueColorImages ACADPref (if (= originalValue :vlax-true) :vlax-false :vlax-true))
            (vla-Regen doc acAllViewports)

            (alert (strcat "The TrueColorImages preference has been set to: " (if (= (vla-get-TrueColorImages ACADPref) :vlax-true) "True" "False")))

            ;; Reset the preference back to it's original value
            ;;
            ;; * Note: Comment out this last section to leave the change to
            ;;         this preference in effect
            (vla-put-TrueColorImages ACADPref originalValue)
            (vla-Regen doc acAllViewports)

            (alert (strcat "The TrueColorImages preference was reset back to: " (if (= (vla-get-TrueColorImages ACADPref) :vlax-true) "True" "False")))
           )
        (alert (strcat imageName " could not be found."))
    )
)


TurnHeight Property (ActiveX)

Specifies the height of one full turn for the helix.

Supported platforms: Windows only

Signature

VBA:

object.TurnHeight
object

Type: Helix

The object this property applies to.

Property Value

Read-only: No

Type: Double

The height of one full turn.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Helix_BaseRadius()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.BaseRadius = helix.BaseRadius * 2
            MsgBox "Baseradius of helix is doubled to " & helix.BaseRadius * 2
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_TopRadius()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.TopRadius = helix.TopRadius * 0.5
            MsgBox "Top radius of helix is halved to " & helix.TopRadius * 0.5
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Direction()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            If helix.Twist = acCCW Then
                helix.Twist = acCW
            Else
                helix.Twist = acCCW
            End If
            MsgBox "Direction is reversed"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Height()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acHeight
            helix.height = helix.height * 2
            MsgBox "Height doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Turns()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acTurns
            helix.Turns = helix.Turns * 2
            MsgBox "Turns doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_TurnHeight()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acTurnHeight
            helix.TurnHeight = helix.TurnHeight * 2
            MsgBox "Turns height doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Helix_BaseRadius()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-BaseRadius helix (* (vla-get-BaseRadius helix) 2))
                (alert (strcat "Baseradius of helix is doubled to " (rtos (vla-get-BaseRadius helix) 2)))
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_TopRadius()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-TopRadius helix (* (vla-get-TopRadius helix) 0.5))
                (alert (strcat "Top radius of helix is halved to " (rtos (vla-get-TopRadius helix) 2)))
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Direction()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
            (if (= (vla-get-Twist helix) acCCW)
                (vla-put-Twist helix acCW)
                (vla-put-Twist helix acCCW)
            )
                (alert "Direction is reversed")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Height()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acHeight)
                (vla-put-Height helix (* (vla-get-Height helix) 2))
                (alert "Height doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Turns()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acTurns)
                (vla-put-Turns helix (* (vla-get-Turns helix) 2))
                (alert "Turns doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_TurnHeight()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acTurnHeight)
                (vla-put-TurnHeight helix (* (vla-get-TurnHeight helix) 2))
                (alert "Turns height doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)


Turns Property (ActiveX)

Specifies the number of turns for the helix.

Supported platforms: Windows only

Signature

VBA:

object.Turns
object

Type: Helix

The object this property applies to.

Property Value

Read-only: No

Type: ACAD_NOUNITS

The number of turns.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Helix_BaseRadius()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.BaseRadius = helix.BaseRadius * 2
            MsgBox "Baseradius of helix is doubled to " & helix.BaseRadius * 2
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_TopRadius()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.TopRadius = helix.TopRadius * 0.5
            MsgBox "Top radius of helix is halved to " & helix.TopRadius * 0.5
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Direction()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            If helix.Twist = acCCW Then
                helix.Twist = acCW
            Else
                helix.Twist = acCCW
            End If
            MsgBox "Direction is reversed"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Height()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acHeight
            helix.height = helix.height * 2
            MsgBox "Height doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Turns()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acTurns
            helix.Turns = helix.Turns * 2
            MsgBox "Turns doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_TurnHeight()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acTurnHeight
            helix.TurnHeight = helix.TurnHeight * 2
            MsgBox "Turns height doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Helix_BaseRadius()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-BaseRadius helix (* (vla-get-BaseRadius helix) 2))
                (alert (strcat "Baseradius of helix is doubled to " (rtos (vla-get-BaseRadius helix) 2)))
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_TopRadius()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-TopRadius helix (* (vla-get-TopRadius helix) 0.5))
                (alert (strcat "Top radius of helix is halved to " (rtos (vla-get-TopRadius helix) 2)))
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Direction()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
            (if (= (vla-get-Twist helix) acCCW)
                (vla-put-Twist helix acCW)
                (vla-put-Twist helix acCCW)
            )
                (alert "Direction is reversed")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Height()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acHeight)
                (vla-put-Height helix (* (vla-get-Height helix) 2))
                (alert "Height doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Turns()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acTurns)
                (vla-put-Turns helix (* (vla-get-Turns helix) 2))
                (alert "Turns doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_TurnHeight()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acTurnHeight)
                (vla-put-TurnHeight helix (* (vla-get-TurnHeight helix) 2))
                (alert "Turns height doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)


TurnSlope Property (ActiveX)

Displays the constant incline angle for the helix path.

Supported platforms: Windows only

Signature

VBA:

object.TurnSlope
object

Type: Helix

The object this property applies to.

Property Value

Read-only: No

Type: ACAD_ANGLE

The constant incline angle.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Helix_BaseRadius()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.BaseRadius = helix.BaseRadius * 2
            MsgBox "Baseradius of helix is doubled to " & helix.BaseRadius * 2
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_TopRadius()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.TopRadius = helix.TopRadius * 0.5
            MsgBox "Top radius of helix is halved to " & helix.TopRadius * 0.5
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Direction()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            If helix.Twist = acCCW Then
                helix.Twist = acCW
            Else
                helix.Twist = acCCW
            End If
            MsgBox "Direction is reversed"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Height()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acHeight
            helix.height = helix.height * 2
            MsgBox "Height doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Turns()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acTurns
            helix.Turns = helix.Turns * 2
            MsgBox "Turns doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_TurnHeight()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acTurnHeight
            helix.TurnHeight = helix.TurnHeight * 2
            MsgBox "Turns height doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Helix_BaseRadius()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-BaseRadius helix (* (vla-get-BaseRadius helix) 2))
                (alert (strcat "Baseradius of helix is doubled to " (rtos (vla-get-BaseRadius helix) 2)))
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_TopRadius()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-TopRadius helix (* (vla-get-TopRadius helix) 0.5))
                (alert (strcat "Top radius of helix is halved to " (rtos (vla-get-TopRadius helix) 2)))
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Direction()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
            (if (= (vla-get-Twist helix) acCCW)
                (vla-put-Twist helix acCW)
                (vla-put-Twist helix acCCW)
            )
                (alert "Direction is reversed")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Height()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acHeight)
                (vla-put-Height helix (* (vla-get-Height helix) 2))
                (alert "Height doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Turns()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acTurns)
                (vla-put-Turns helix (* (vla-get-Turns helix) 2))
                (alert "Turns doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_TurnHeight()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acTurnHeight)
                (vla-put-TurnHeight helix (* (vla-get-TurnHeight helix) 2))
                (alert "Turns height doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)


Twist Property (ActiveX)

Controls the twist direction of the helix or specifies the amount of rotation along the entire length of the sweep path.

Supported platforms: Windows only

Signature

VBA:

object.Twist
object

Type: Helix, SweptSurface

The objects this property applies to.

Property Value - Helix

Read-only: No

Type: AcHelixTwistType enum

The twist direction.

  • acCCW: Counterclockwise
  • acCW: Clockwise

Property Value - SweptSurface

Read-only: No

Type: ACAD_ANGLE

The amount of rotation along the swept path.

Remarks

No additional remarks.

Examples - Helix

VBA:

Sub Example_Helix_BaseRadius()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.BaseRadius = helix.BaseRadius * 2
            MsgBox "Baseradius of helix is doubled to " & helix.BaseRadius * 2
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_TopRadius()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.TopRadius = helix.TopRadius * 0.5
            MsgBox "Top radius of helix is halved to " & helix.TopRadius * 0.5
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Direction()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            If helix.Twist = acCCW Then
                helix.Twist = acCW
            Else
                helix.Twist = acCCW
            End If
            MsgBox "Direction is reversed"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Height()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acHeight
            helix.height = helix.height * 2
            MsgBox "Height doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_Turns()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acTurns
            helix.Turns = helix.Turns * 2
            MsgBox "Turns doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Sub Example_Helix_TurnHeight()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_HELIX")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim helix As AcadHelix
    Dim helixBaseRadius As Double
    Dim objName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
            If TypeOf obj Is AcadHelix Then
            Set helix = obj
            helix.Constrain = acTurnHeight
            helix.TurnHeight = helix.TurnHeight * 2
            MsgBox "Turns height doubled"
            End If
    Next
    ssetObj.Delete
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Helix_BaseRadius()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-BaseRadius helix (* (vla-get-BaseRadius helix) 2))
                (alert (strcat "Baseradius of helix is doubled to " (rtos (vla-get-BaseRadius helix) 2)))
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_TopRadius()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-TopRadius helix (* (vla-get-TopRadius helix) 0.5))
                (alert (strcat "Top radius of helix is halved to " (rtos (vla-get-TopRadius helix) 2)))
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Direction()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
            (if (= (vla-get-Twist helix) acCCW)
                (vla-put-Twist helix acCW)
                (vla-put-Twist helix acCCW)
            )
                (alert "Direction is reversed")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Height()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acHeight)
                (vla-put-Height helix (* (vla-get-Height helix) 2))
                (alert "Height doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_Turns()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acTurns)
                (vla-put-Turns helix (* (vla-get-Turns helix) 2))
                (alert "Turns doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)

(defun c:Example_Helix_TurnHeight()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_HELIX"))
    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))
        (if (= objName "AcDbHelix")
            (progn
                (setq helix obj)
                (vla-put-Constrain helix acTurnHeight)
                (vla-put-TurnHeight helix (* (vla-get-TurnHeight helix) 2))
                (alert "Turns height doubled")
            )
        )
    )
    (vla-Delete ssetObj)
)

Examples - SweptSurface

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


TwistAngle Property (ActiveX)

Specifies the twist angle for the viewport.

Supported platforms: Windows only

Signature

VBA:

object.TwistAngle
object

Type: PViewport

The object this property applies to.

Property Value

Read-only: No

Type: Double

The twist angle in radians.

Remarks

This method twists or tilts the view around the line of sight. AutoCAD measures the twist angle counterclockwise, with 0 degrees to the right.

Examples

VBA:

Sub Example_TwistAngle()
    ' This example creates a new paper space viewport.
    ' It then displays the twist angle of the viewport.

    Dim pviewportObj As AcadPViewport
    Dim center(0 To 2) As Double
    Dim width As Double
    Dim height As Double

    ' Define the pviewport
    center(0) = 3: center(1) = 3: center(2) = 0
    width = 40
    height = 40

    ' Change from model space to paper space
    ThisDrawing.ActiveSpace = acPaperSpace

    ' Create the pviewport
    Set pviewportObj = ThisDrawing.PaperSpace.AddPViewport(center, width, height)
    pviewportObj.Display True
    ThisDrawing.MSpace = True
    ThisDrawing.ActivePViewport = pviewportObj
    ThisDrawing.Regen acAllViewports

    ' Find the twist angle for the viewport
    Dim twistAngle As Double
    twistAngle = pviewportObj.TwistAngle
    MsgBox "The twist angle of the paper space viewport is " & pviewportObj.twistAngle, , "TwistAngle Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_TwistAngle()
    ;; This example creates a new paper space viewport.
    ;; It then displays the twist angle of the viewport.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the pviewport
    (setq center (vlax-3d-point 3 3 0)
          width 40
          height 40)

    ;; Change from model space to paper space
    (vla-put-ActiveSpace doc acPaperSpace)

    ;; Create the pviewport
    (setq paperSpace (vla-get-PaperSpace doc))
    (setq pviewportObj (vla-AddPViewport paperSpace center width height))

    (vla-Display pviewportObj :vlax-true)
    (vla-put-MSpace doc :vlax-true)
    (vla-put-ActivePViewport doc pviewportObj)
    (vla-Regen doc acAllViewports)

    ;; Find the twist angle for the viewport
    (setq twistAngle (vla-get-TwistAngle pviewportObj))
    (alert (strcat "The twist angle of the paper space viewport is " (rtos twistAngle 2)))
)


Type Property (ActiveX)

Specifies type of a Leader, MenuGroup, PopupMenuItem, ToolbarItem, Polyline, or PolygonMesh object.

Supported platforms: Windows only

Signature

VBA:

object.Type
object

Type: 3DPolyline, Leader, MenuGroup, PolygonMesh, Polyline, PopupMenuItem, ToolbarItem

The object this property applies to.

Property Value - 3DPolyline

Read-only: No

Type: ac3DPolylineType enum

  • acSimple3DPoly: A simple polyline.
  • acQuadSpline3DPoly: A quadratic B-spline polyline.
  • acCubicSpline3DPoly: A cubic B-spline polyline.

Property Value - Leader

Read-only: No

Type: acLeaderType enum

  • acLineNoArrow: A line with no arrow.
  • acLineWithArrow: A line with arrow.
  • acSplineNoArrow: A spline with no arrow.
  • acSplineWithArrow: A spline with arrow.

Property Value - MenuGroup

Read-only: Yes

Type: acMenuGroupType enum

  • acBaseMenuGroup: The base menu group.
  • acPartialMenuGroup: A partial menu group.

Property Value - PolygonMesh

Read-only: No

Type: acPolymeshType enum

  • acSimpleMesh: A simple mesh with no surface fitting or smoothing.
  • acQuadSurfaceMesh: A quadratic B-spline surface fit.
  • acCubicSurfaceMesh: A cubic B-spline surface fit.
  • acBezierSurfaceMesh: A Bezier surface fit.

Property Value - Polyline

Read-only: No

Type: acPolylineType enum

  • acSimplePoly: A simple polyline.
  • acFitCurvePoly: A fit curve polyline.
  • acQuadSplinePoly: A quadratic B-spline polyline.
  • acCubicSplinePoly: A cubic B-spline polyline.

Property Value - PopupMenuItem

Read-only: Yes

Type: acMenuItemType enum

  • acMenuItem: A menu item.
  • acMenuSeparator: A menu separator.
  • acMenuSubMenu: A sub menu.

Property Value - ToolbarItem

Read-only: Yes

Type: acToolbarItemType enum

  • acToolbarButton: A generic button.
  • acToolbarFlyout: A flyout button.
  • acToolbarControl: A control button.
  • acToolbarSeparator: A separator.

Remarks

PolygonMesh: If the PolygonMesh type is set to acSimpleMesh then the M and N vertex count values will be used for vertex row column sizes. For any other PolygonMesh type, the M and N density values will be used as the row and column sizes.

Examples

VBA:

Sub Example_Type()
    ' This example creates a leader in model space.
    ' It then changes the type of the leader.

    Dim leaderObj As AcadLeader
    Dim points(0 To 8) As Double
    Dim leaderType As Integer
    Dim annotationObject As AcadEntity

    points(0) = 0: points(1) = 2: points(2) = 0
    points(3) = 4: points(4) = 4: points(5) = 0
    points(6) = 4: points(7) = 2: points(8) = 0
    leaderType = acLineNoArrow
    Set annotationObject = Nothing

    ' Create the leader object in model space
    Set leaderObj = ThisDrawing.ModelSpace.AddLeader(points, annotationObject, leaderType)
    ZoomAll

    ' Find the current leader type
    leaderType = leaderObj.Type
    MsgBox "The leader type is " & Choose(leaderObj.Type + 1, "acLineNoArrow.", "acSplineNoArrow.", "acLineWithArrow.", "acSplineWithArrow."), , "Type Example"

    ' Change the leader type
    leaderObj.Type = acLineWithArrow
    leaderObj.Update
    MsgBox "The leader type is " & Choose(leaderObj.Type + 1, "acLineNoArrow.", "acSplineNoArrow.", "acLineWithArrow.", "acSplineWithArrow."), , "Type Example"

    ' Change the leader type
    leaderObj.Type = acSplineNoArrow
    leaderObj.Update
    MsgBox "The leader type is " & Choose(leaderObj.Type + 1, "acLineNoArrow.", "acSplineNoArrow.", "acLineWithArrow.", "acSplineWithArrow."), , "Type Example"

    ' Change the leader type
    leaderObj.Type = acSplineWithArrow
    leaderObj.Update
    MsgBox "The leader type is " & Choose(leaderObj.Type + 1, "acLineNoArrow.", "acSplineNoArrow.", "acLineWithArrow.", "acSplineWithArrow."), , "Type Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Type()
    ;; This example creates a leader in model space.
    ;; It then changes the type of the leader.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill points '(0 2 0
                                  4 4 0
                  4 2 0
                 )
    )

    (setq leaderType acLineNoArrow)

    (setq point (vlax-3d-point 4 2 0))
    (setq annotationObject (vla-AddMText modelSpace point 1 ""))

    ;; Create the leader object in model space
    (setq leaderObj (vla-AddLeader modelSpace points annotationObject leaderType))

    ;; Remove the temporary annotaion object and adjust the last coordinate of the leader
    (vla-Erase annotationObject)
    (vla-put-Coordinate leaderObj 2 (vlax-3D-point 4 2 0))
    (vla-ZoomAll acadObj)

    ;; Find the current leader type
    (setq leaderType (vla-get-Type leaderObj))
    (alert (strcat "The leader type is " (cond
                                             ((= leaderType acLineNoArrow) "acLineNoArrow.")
                                             ((= leaderType acSplineNoArrow) "acSplineNoArrow.")
                                             ((= leaderType acLineWithArrow) "acLineWithArrow.")
                                             ((= leaderType acSplineWithArrow) "acSplineWithArrow.")
                                         )))

    ;; Change the leader type
    (vla-put-Type leaderObj acLineWithArrow)
    (vla-Update leaderObj)
    (setq leaderType (vla-get-Type leaderObj))
    (alert (strcat "The leader type is " (cond
                                             ((= leaderType acLineNoArrow) "acLineNoArrow.")
                                             ((= leaderType acSplineNoArrow) "acSplineNoArrow.")
                                             ((= leaderType acLineWithArrow) "acLineWithArrow.")
                                             ((= leaderType acSplineWithArrow) "acSplineWithArrow.")
                                         )))

    ;; Change the leader type
    (vla-put-Type leaderObj acSplineNoArrow)
    (vla-Update leaderObj)
    (setq leaderType (vla-get-Type leaderObj))
    (alert (strcat "The leader type is " (cond
                                             ((= leaderType acLineNoArrow) "acLineNoArrow.")
                                             ((= leaderType acSplineNoArrow) "acSplineNoArrow.")
                                             ((= leaderType acLineWithArrow) "acLineWithArrow.")
                                             ((= leaderType acSplineWithArrow) "acSplineWithArrow.")
                                         )))

    ;; Change the leader type
    (vla-put-Type leaderObj acSplineWithArrow)
    (vla-Update leaderObj)
    (setq leaderType (vla-get-Type leaderObj))
    (alert (strcat "The leader type is " (cond
                                             ((= leaderType acLineNoArrow) "acLineNoArrow.")
                                             ((= leaderType acSplineNoArrow) "acSplineNoArrow.")
                                             ((= leaderType acLineWithArrow) "acLineWithArrow.")
                                             ((= leaderType acSplineWithArrow) "acSplineWithArrow.")
                                         )))
)


UCSIconAtOrigin Property (ActiveX)

Specifies if the UCS icon is displayed at the origin.

Supported platforms: Windows only

Signature

VBA:

object.UCSIconAtOrigin
object

Type: PViewport, Viewport

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The UCS icon is displayed at the origin.
  • False: The UCS icon is not displayed at the origin.

Remarks

If the UCS icon is on (see the UCSIconOn property) and is not displayed at the origin, it is displayed at the WCS coordinate defined by the UCSORG system variable.

Examples

VBA:

Sub Example_UCSIconAtOrigin()
    ' This example toggles the setting of UCSIconAtOrigin.

    Dim viewportObj As AcadViewport

    ' Set the viewportObj variable to the activeviewport
    Set viewportObj = ThisDrawing.ActiveViewport

    ' Make sure the UCS Icon is on, and a new UCS is defined.
    ' The new UCS defines the origin for the icon. When the icon
    ' is not displayed at the origin, it is displayed at the
    ' lower-left corner of the display.
    Dim ucsObj As AcadUCS
    Dim origin(0 To 2) As Double
    Dim xAxisPoint(0 To 2) As Double
    Dim yAxisPoint(0 To 2) As Double
    origin(0) = 2: origin(1) = 2: origin(2) = 0
    xAxisPoint(0) = 3: xAxisPoint(1) = 2: xAxisPoint(2) = 0
    yAxisPoint(0) = 2: yAxisPoint(1) = 3: yAxisPoint(2) = 0
    Set ucsObj = ThisDrawing.UserCoordinateSystems.Add(origin, xAxisPoint, yAxisPoint, "UCS1")
    ThisDrawing.ActiveUCS = ucsObj
    viewportObj.UCSIconOn = True

    ' Display the current setting of UCSIconAtOrigin
    MsgBox "UCSIconAtOrigin is: " & IIf(viewportObj.UCSIconAtOrigin, "On", "Off"), , "UCSIconAtOrigin Example"

    ' Toggle the setting of UCSIconAtOrigin
    viewportObj.UCSIconAtOrigin = Not (viewportObj.UCSIconAtOrigin)

    ' Reset the active viewport to see the change
    ThisDrawing.ActiveViewport = viewportObj

    MsgBox "UCSIconAtOrigin is now: " & IIf(viewportObj.UCSIconAtOrigin, "On", "Off"), , "UCSIconAtOrigin Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_UCSIconAtOrigin()
    ;; This example toggles the setting of UCSIconAtOrigin.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Set the viewportObj variable to the activeviewport
    (setq viewportObj (vla-get-ActiveViewport doc))

    ;; Make sure the UCS Icon is on, and a new UCS is defined.
    ;; The new UCS defines the origin for the icon. When the icon
    ;; is not displayed at the origin, it is displayed at the
    ;; lower-left corner of the display.
    (setq origin (vlax-3d-point 2 2 0)
          xAxisPoint (vlax-3d-point 3 2 0)
          yAxisPoint (vlax-3d-point 2 3 0))

    (setq ucsObj (vla-Add (vla-get-UserCoordinateSystems doc) origin xAxisPoint yAxisPoint "UCS1"))
    (vla-put-ActiveUCS doc ucsObj)
    (vla-put-UCSIconOn viewportObj :vlax-true)

    ;; Display the current setting of UCSIconAtOrigin
    (alert (strcat "UCSIconAtOrigin is: " (if (= (vla-get-UCSIconAtOrigin viewportObj) :vlax-true) "On" "Off")))

    ;; Toggle the setting of UCSIconAtOrigin
    (vla-put-UCSIconAtOrigin viewportObj (if (= (vla-get-UCSIconAtOrigin viewportObj) :vlax-true) :vlax-false :vlax-true))

    ;; Reset the active viewport to see the change
    (vla-put-ActiveViewport doc viewportObj)

    (alert (strcat "UCSIconAtOrigin is now: " (if (= (vla-get-UCSIconAtOrigin viewportObj) :vlax-true) "On" "Off")))
)


UCSIconOn Property (ActiveX)

Specifies if the UCS icon is on.

Supported platforms: Windows only

Signature

VBA:

object.UCSIconOn
object

Type: PViewport, Viewport

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The UCS icon is on.
  • False: The UCS icon is off.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_UCSIconOn()
    ' This example toggles the setting of UCSIconOn.

    Dim viewportObj As AcadViewport

    ' Set the viewportObj variable to the activeviewport
    Set viewportObj = ThisDrawing.ActiveViewport

    ' Display the current setting of UCSIconOn
    MsgBox "UCSIcon is: " & IIf(viewportObj.UCSIconOn, "On", "Off"), , "UCSIconOn Example"

    ' Toggle the setting of UCSIconOn
    viewportObj.UCSIconOn = Not (viewportObj.UCSIconOn)

    ' Reset the active viewport to see the change
    ThisDrawing.ActiveViewport = viewportObj

    MsgBox "UCSIcon is now: " & IIf(viewportObj.UCSIconOn, "On", "Off"), , "UCSIconOn Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_UCSIconOn()
    ;; This example toggles the setting of UCSIconOn.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Set the viewportObj variable to the activeviewport
    (setq viewportObj (vla-get-ActiveViewport doc))

    ;; Display the current setting of UCSIconOn
    (alert (strcat "UCSIcon is: " (if (= (vla-get-UCSIconOn viewportObj) :vlax-true) "On" "Off")))

    ;; Toggle the setting of UCSIconOn
    (vla-put-UCSIconOn viewportObj (if (= (vla-get-UCSIconOn viewportObj) :vlax-true) :vlax-false :vlax-true))

    ;; Reset the active viewport to see the change
    (vla-put-ActiveViewport doc viewportObj)

    (alert (strcat "UCSIcon is now: " (if (= (vla-get-UCSIconOn viewportObj) :vlax-true) "On" "Off")))
)


UCSPerViewport Property (ActiveX)

Specifies if the UCS is saved with the viewport.

Supported platforms: Windows only

Signature

VBA:

object.UCSPerViewport
object

Type: PViewport

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The UCS is saved with the viewport.
  • False: The UCS is not saved with the viewport.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ViewportOn()
    ' This example creates two new paper space viewports.
    ' It then checks the status of the viewports.

    Dim pviewportObj1 As AcadPViewport
    Dim pviewportObj2 As AcadPViewport
    Dim center(0 To 2) As Double
    Dim width As Double
    Dim height As Double

    ' Define the paper space viewport
    center(0) = 3: center(1) = 3: center(2) = 0
    width = 10
    height = 10

    ' Change from model space to paper space
    ThisDrawing.ActiveSpace = acPaperSpace

    ' Create the paper space viewports
    Set pviewportObj1 = ThisDrawing.PaperSpace.AddPViewport(center, width, height)
    center(0) = 8: center(1) = 8: center(2) = 0
    width = 10
    height = 10
    Set pviewportObj2 = ThisDrawing.PaperSpace.AddPViewport(center, width, height)

    ' Before making a paper space viewport active,
    ' the mspace property needs to be True
    pviewportObj1.DISPLAY (True)
    ThisDrawing.mspace = True
    ThisDrawing.ActivePViewport = pviewportObj1
    ThisDrawing.Regen acAllViewports

    MsgBox "pviewportObj1 is " & (IIf(pviewportObj1.ViewportOn, "on.", "not on.")) & vbCrLf & _
           "pviewportObj2 is " & (IIf(pviewportObj2.ViewportOn, "on.", "not on."))

    ' Now turn on pviewportObj2 as well
    pviewportObj2.DISPLAY (True)
    MsgBox "pviewportObj1 is " & (IIf(pviewportObj1.ViewportOn, "on.", "not on.")) & vbCrLf & _
           "pviewportObj2 is " & (IIf(pviewportObj2.ViewportOn, "on.", "not on."))

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ViewportOn()
    ;; This example creates two new paper space viewports.
    ;; It then checks the status of the viewports.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the paper space viewport
    (setq center (vlax-3d-point 3 3 0)
          width 10
          height 10)

    ;; Change from model space to paper space
    (vla-put-ActiveSpace doc acPaperSpace)

    ;; Create the paper space viewports
    (setq paperSpace (vla-get-PaperSpace doc))
    (setq pviewportObj1 (vla-AddPViewport paperSpace center width height))

    (setq center (vlax-3d-point 8 8 0)
          width 10
          height 10)

    (setq pviewportObj2 (vla-AddPViewport paperSpace center width height))

    ;; Before making a paper space viewport active,
    ;; the mspace property needs to be True
    (vla-Display pviewportObj1 :vlax-true)

    (vla-put-MSpace doc :vlax-true)
    (vla-put-ActivePViewport doc pviewportObj1)
    (vla-Regen doc acAllViewports)

    (alert (strcat "pviewportObj1 is " (if (= (vla-get-ViewportOn pviewportObj1) :vlax-true) "on." "not on.")
                   "\npviewportObj2 is " (if (= (vla-get-ViewportOn pviewportObj2) :vlax-true) "on." "not on.")))

    ;; Now turn on pviewportObj2 as well
    (vla-Display pviewportObj2 :vlax-true)

    (alert (strcat "pviewportObj1 is " (if (= (vla-get-ViewportOn pviewportObj1) :vlax-true) "on." "not on.")
                   "\npviewportObj2 is " (if (= (vla-get-ViewportOn pviewportObj2) :vlax-true) "on." "not on.")))
)


UIsolineDensity Property (ActiveX)

Specifies the number of U isolines that are displayed.

Supported platforms: Windows only

Signature

VBA:

object.UIsolineDensity
object

Type: ExtrudedSurface, LoftedSurface, NurbSurface, PlaneSurface, RevolvedSurface, Surface, SweptSurface

The object to which this property applies.

Property Value

Read-only: No

Type: Long

Number of isolines that the object displays in the U direction.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


UnderlayLayerOverrideApplied Property (ActiveX)

Determines whether underlay layer overrides are applied or not.

Supported platforms: Windows only

Signature

VBA:

object.UnderlayLayerOverrideApplied
object

Type: DgnUnderlay, DwfUnderlay, PdfUnderlay

The object to which this property applies.

Property Value

Read-only: No

Type: Boolean

  • True: Layer overrides are applied.
  • False: Layer overrides are not applied.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


UnderlayName Property (ActiveX)

Specifies the name of the underlay file.

Supported platforms: Windows only

Signature

VBA:

object.UnderlayName
object

Type: DgnUnderlay, DwfUnderlay, PdfUnderlay

The object to which this property applies.

Property Value

Read-only: No

Type: String

The file name of the underlay.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


UnderlayVisibility Property (ActiveX)

Specifies the visibility of the underlay file.

Supported platforms: Windows only

Signature

VBA:

object.UnderlayVisibility
object

Type: DgnUnderlay, DwfUnderlay, PdfUnderlay

The object to which this property applies.

Property Value

Read-only: No

Type: Boolean

  • True: Underlay is visible.
  • False: Underlay is not visible.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Unit Property (ActiveX)

Gets the unit of the point cloud file.

Supported platforms: Windows only

Signature

VBA:

object.Unit
object

Type: PointCloud, PointCloudEx

The object this property applies to.

Property Value

Read-only: Yes

Type: String

A string representing the unit of the point cloud file.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


UnitFactor Property (ActiveX)

Gets the insertion unit factor of the point cloud file.

Supported platforms: Windows only

Signature

VBA:

object.UnitFactor
object

Type: PointCloud, PointCloudEx

The object this property applies to.

Property Value

Read-only: Yes

Type: ACAD_NOUNITS

The insertion unit factor for the point cloud.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Units Property (ActiveX)

Specifies the native units of measure for the block.

Supported platforms: Windows only

Signature

VBA:

object.Units
object

Type: Block

The object this property applies to.

Property Value

Read-only: No

Type: acInsertUnits enum

  • acInsertUnitsAngstroms
  • acInsertUnitsAstronomicalUnits
  • acInsertUnitsCentimeters
  • acInsertUnitsDecameters
  • acInsertUnitsDecimeters
  • acInsertUnitsFeet
  • acInsertUnitsGigameters
  • acInsertUnitsHectometers
  • acInsertUnitsInches
  • acInsertUnitsKilometers
  • acInsertUnitsLightYears
  • acInsertUnitsMeters
  • acInsertUnitsMicroinches
  • acInsertUnitsMicrons
  • acInsertUnitsMiles
  • acInsertUnitsMillimeters
  • acInsertUnitsMils
  • acInsertUnitsNanometers
  • acInsertUnitsParsecs
  • acInsertUnitsUnitless
  • acInsertUnitsYards

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


UnitsFormat Property (ActiveX)

Specifies the unit format for all dimensions except angular.

Supported platforms: Windows only

Signature

VBA:

object.UnitsFormat
object

Type: DimAligned, DimArcLength, DimDiametric, DimOrdinate, DimRadial, DimRadialLarge, DimRotated

The object this property applies to.

Property Value

Read-only: No

Type: acDimLUnits enum

  • acDimLScientific
  • acDimLDecimal
  • acDimLEngineering
  • acDimLArchitectural
  • acDimLFractional
  • acDimLWindowsDesktop

Remarks

The initial value for this property is acDimLDecimal.

If this property is set to acDimLDecimal, the format specified by the DecimalSeparator and PrimaryUnitsPrecision properties will be used to format the decimal value.

To create a stacked architectural or fractional unit format, use the FractionFormat property.

NoteThis property overrides the value of the DIMLUNIT system variable for the given dimension.

Examples

VBA:

Sub Example_UnitsFormat()
   ' This example creates an aligned dimension in model space and
   ' uses UnitsFormat to cycle through some common unit formats
   ' for the dimension

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double

    ' Define the dimension
    point1(0) = 0: point1(1) = 5: point1(2) = 0
    point2(0) = 5.12345678: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ThisDrawing.Application.ZoomAll

    ' Cycle through common unit formats

    dimObj.UnitsFormat = acDimLScientific     ' Change format to Scientific
    ThisDrawing.Regen acAllViewports
    MsgBox "The dimension units are now set to Scientific"

    dimObj.UnitsFormat = acDimLDecimal        ' Change format to Decimal
    ThisDrawing.Regen acAllViewports
    MsgBox "The dimension units are now set to Decimal"

    dimObj.UnitsFormat = acDimLArchitectural  ' Change format to Architectural
    ThisDrawing.Regen acAllViewports
    MsgBox "The dimension units are now set to Architectural"

    dimObj.UnitsFormat = acDimLWindowsDesktop ' Change format to WindowsDesktop
    ThisDrawing.Regen acAllViewports
    MsgBox "The dimension units are now set to Windows Desktop"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_UnitsFormat()
    ;; This example creates an aligned dimension in model space and
    ;; uses UnitsFormat to cycle through some common unit formats
    ;; for the dimension
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 0 5 0)
          point2 (vlax-3d-point 5.12345678 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    ;; Cycle through common unit formats
    (vla-put-UnitsFormat dimObj acDimLScientific)     ;; Change format to Scientific
    (vla-Regen doc acAllViewports)
    (alert "The dimension units are now set to Scientific")

    (vla-put-UnitsFormat dimObj acDimLDecimal)        ;; Change format to Decimal
    (vla-Regen doc acAllViewports)
    (alert "The dimension units are now set to Decimal")

    (vla-put-UnitsFormat dimObj acDimLArchitectural)  ;; Change format to Architectural
    (vla-Regen doc acAllViewports)
    (alert "The dimension units are now set to Architectural")

    (vla-put-UnitsFormat dimObj acDimLWindowsDesktop) ;; Change format to WindowsDesktop
    (vla-Regen doc acAllViewports)
    (alert "The dimension units are now set to Windows Desktop")
)


UnitsType Property (ActiveX)

Specifies the current display units type for the property.

Supported platforms: Windows only

Signature

VBA:

object.UnitsType
object

Type: DynamicBlockReferenceProperty

The object this property applies to.

Property Value

Read-only: Yes

Type: acDynamicBlockReferencePropertyUnitsType enum

  • acNoUnits
  • acAngular
  • acDistance
  • acArea

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


UpperRightCorner Property (ActiveX)

Gets the upper-right corner of the current active viewport.

Supported platforms: Windows only

Signature

VBA:

object.UpperRightCorner
object

Type: Viewport

The object this property applies to.

Property Value

Read-only: Yes

Type: Variant (two element array of doubles)

A 2D coordinate representing the upper-right corner of the current active viewport.

Remarks

The LowerLeftCorner and UpperRightCorner properties represent the graphic placement of the viewport on the display. These properties are defined as follows:

Viewport 1—LowerLeftCorner = (0, .5), UpperRightCorner = (.5, 1)

Viewport 2—LowerLeftCorner = (.5, .5), UpperRightCorner = (1, 1)

Viewport 3—LowerLeftCorner = (0, 0), UpperRightCorner = (.5, .5)

Viewport 4—LowerLeftCorner = (.5, 0), UpperRightCorner = (1, .5)

Examples

VBA:

Sub Example_UpperRightCorner()
    ' This example creates a new viewport and makes it active.
    ' Then it splits the viewport into 4 windows.
    ' It then takes finds the upper right corner of each of the
    ' windows.
    Dim newViewport As AcadViewport

    ' Create a new viewport and make it active
    Set newViewport = ThisDrawing.Viewports.Add("TESTVIEWPORT")
    ThisDrawing.ActiveViewport = newViewport

    ' Split the viewport in 4 windows
    newViewport.Split acViewport4

    ' Make the newly split viewport active
    ThisDrawing.ActiveViewport = newViewport

    ' Iterate through the viewports. For each viewport,
    ' make that viewport active and display the coordinates
    ' of the upper right corner.
    Dim entry As AcadViewport
    Dim UpperRight As Variant
    For Each entry In ThisDrawing.Viewports
        entry.GridOn = True
        ThisDrawing.ActiveViewport = entry
        UpperRight = entry.UpperRightCorner
        MsgBox "The upper right corner of this viewport is " & UpperRight(0) & ", " & UpperRight(1), , "UpperRightCorner Example"
        entry.GridOn = False
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_UpperRightCorner()
    ;; This example creates a new viewport and makes it active.
    ;; Then it splits the viewport into four windows.
    ;; It then finds the lower-left corner of each of the
    ;; windows.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create a new viewport and make it active
    (setq newViewport (vla-Add (vla-get-Viewports doc) "TESTVIEWPORT"))
    (vla-put-ActiveViewport doc newViewport)

    ;; Split the viewport in four windows
    (vla-Split newViewport acViewport4)

    ;; Make the newly split viewport active
    (vla-put-ActiveViewport doc newViewport)

    ;; Iterate through the viewports. For each viewport,
    ;; make that viewport active and display the coordinates
    ;; of the upper right corner.
    (vlax-for entry (vla-get-Viewports doc)
        (vla-put-GridOn entry :vlax-true)
        (vla-put-ActiveViewport doc entry)
        (setq upperRight (vlax-safearray->list (vlax-variant-value (vla-get-UpperRightCorner entry))))
        (alert (strcat "The upper right corner of this viewport is " (rtos (nth 0 upperRight) 2) ", " (rtos (nth 1 upperRight) 2)))
        (vla-put-GridOn entry :vlax-false)
    )
)


UpsideDown Property (ActiveX)

Specifies the direction of text.

Supported platforms: Windows only

Signature

VBA:

object.UpsideDown
object

Type: Attribute, AttributeReference, Text

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The text is upside down.
  • False: The text is not upside down.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_UpsideDown()
    ' This example creates a text object in model space and
    ' uses the UpsideDown property to flip the text vertically

    Dim textObj As AcadText
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double

    ' Define the new Text object
    textString = "Hello, World."
    insertionPoint(0) = 3: insertionPoint(1) = 3: insertionPoint(2) = 0
    height = 0.5

    ' Create the Text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)

    ThisDrawing.Application.ZoomAll

    MsgBox "The Text oject is now right side up"

    textObj.UpsideDown = True
    ThisDrawing.Regen acActiveViewport

    MsgBox "The Text object is now upside down"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_UpsideDown()
    ;; This example creates a text object in model space and
    ;; uses the UpsideDown property to flip the text vertically
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the new Text object
    (setq insertionPoint (vlax-3d-point 3 3 0)
          textString "Hello, World."
          height 0.5)

    ;; Create the Text object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq textObj (vla-AddText modelSpace textString insertionPoint height))

    (vla-ZoomAll acadObj)

    (alert "The Text oject is now right side up")

    (vla-put-UpsideDown textObj :vlax-true)
    (vla-Regen doc acActiveViewport)

    (alert "The Text object is now upside down")
)


URL Property (ActiveX)

Specifies the URL for the Hyperlink object.

Supported platforms: Windows only

Signature

VBA:

object.URL
object

Type: Hyperlink

The object this property applies to.

Property Value

Read-only: No

Type: String

A string representing the URL for the Hyperlink object.

Remarks

The file can be stored locally, on a network drive, or on an Internet or intranet location.

Examples

VBA:

Sub Example_URL()
    ' This example creates a Circle object in model space and
    ' adds a new Hyperlink to its Hyperlink collection

    Dim Hyperlinks As AcadHyperlinks
    Dim Hyperlink As AcadHyperlink
    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    Dim HLList As String

    ' Define the Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    radius = 5#

    ' Create the Circle object in model space
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)

    ThisDrawing.Application.ZoomAll

    ' Get reference to the Circle's Hyperlinks collection
    Set Hyperlinks = circleObj.Hyperlinks

    ' Add a new Hyperlink complete with all properties
    Set Hyperlink = Hyperlinks.Add("AutoDesk")
    Hyperlink.URL = "www.autodesk.com"
    Hyperlink.URLDescription = "Autodesk Main Site"
    Hyperlink.URLNamedLocation = "MY_LOCATION"

    ' Read and display a list of existing Hyperlinks and
    ' their properties for this object
    For Each Hyperlink In Hyperlinks
        HLList = HLList & "____________________________________" & vbCrLf   ' Separator
        HLList = HLList & "URL: " & Hyperlink.URL & vbCrLf
        HLList = HLList & "URL Description: " & Hyperlink.URLDescription & vbCrLf
        HLList = HLList & "URL Named Location: " & Hyperlink.URLNamedLocation & vbCrLf
    Next

    MsgBox "The circle has " & Hyperlinks.count & " Hyperlink: " & vbCrLf & HLList
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_URL()
    ;; This example creates a Circle object in model space and
    ;; adds a new Hyperlink to its Hyperlink collection
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Circle object
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius 5)

    ;; Create the Circle object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))

    (vla-ZoomAll acadObj)

    ;; Get reference to the Circle's Hyperlinks collection
    (setq Hyperlinks (vla-get-Hyperlinks circleObj))

    ;; Add a new Hyperlink complete with all properties
    (setq Hyperlink (vla-Add Hyperlinks "Autodesk"))
    (vla-put-URL Hyperlink "www.autodesk.com")
    (vla-put-URLDescription Hyperlink "Autodesk Main Site")
    (vla-put-URLNamedLocation Hyperlink "MY_LOCATION")

    ;; Read and display a list of existing Hyperlinks and
    ;; their properties for this object
    (setq HLList "")
    (vlax-for Hyperlink Hyperlinks
        (setq HLList (strcat HLList "____________________________________"   ;; Separator
                             "\nURL: " (vla-get-URL Hyperlink)
                             "\nURL Description: " (vla-get-URLDescription Hyperlink)
                             "\nURL Named Location: " (vla-get-URLNamedLocation Hyperlink)))
    )

    (alert (strcat "The circle has " (itoa (vla-get-Count Hyperlinks)) " Hyperlink: \n"  HLList))
)


URLDescription Property (ActiveX)

Specifies the URL description for the Hyperlink object.

Supported platforms: Windows only

Signature

VBA:

object.URLDescription
object

Type: Hyperlink

The object this property applies to.

Property Value

Read-only: No

Type: String

A string representing the description of the URL for the Hyperlink object.

Remarks

This is useful in cases where the name or URL of the file is not very helpful in identifying the contents of the file.

Examples

VBA:

Sub Example_URLDescription()
    ' This example creates a Circle object in model space and
    ' adds a new Hyperlink to its Hyperlink collection

    Dim Hyperlinks As AcadHyperlinks
    Dim Hyperlink As AcadHyperlink
    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    Dim HLList As String

    ' Define the Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    radius = 5#

    ' Create the Circle object in model space
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)

    ThisDrawing.Application.ZoomAll

    ' Get reference to the Circle's Hyperlinks collection
    Set Hyperlinks = circleObj.Hyperlinks

    ' Add a new Hyperlink complete with all properties
    Set Hyperlink = Hyperlinks.Add("AutoDesk")
    Hyperlink.URL = "www.autodesk.com"
    Hyperlink.URLDescription = "Autodesk Main Site"
    Hyperlink.URLNamedLocation = "MY_LOCATION"

    ' Read and display a list of existing Hyperlinks and
    ' their properties for this object
    For Each Hyperlink In Hyperlinks
        HLList = HLList & "____________________________________" & vbCrLf   ' Separator
        HLList = HLList & "URL: " & Hyperlink.URL & vbCrLf
        HLList = HLList & "URL Description: " & Hyperlink.URLDescription & vbCrLf
        HLList = HLList & "URL Named Location: " & Hyperlink.URLNamedLocation & vbCrLf
    Next

    MsgBox "The circle has " & Hyperlinks.count & " Hyperlink: " & vbCrLf & HLList
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_URLDescription()
    ;; This example creates a Circle object in model space and
    ;; adds a new Hyperlink to its Hyperlink collection
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Circle object
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius 5)

    ;; Create the Circle object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))

    (vla-ZoomAll acadObj)

    ;; Get reference to the Circle's Hyperlinks collection
    (setq Hyperlinks (vla-get-Hyperlinks circleObj))

    ;; Add a new Hyperlink complete with all properties
    (setq Hyperlink (vla-Add Hyperlinks "Autodesk"))
    (vla-put-URL Hyperlink "www.autodesk.com")
    (vla-put-URLDescription Hyperlink "Autodesk Main Site")
    (vla-put-URLNamedLocation Hyperlink "MY_LOCATION")

    ;; Read and display a list of existing Hyperlinks and
    ;; their properties for this object
    (setq HLList "")
    (vlax-for Hyperlink Hyperlinks
        (setq HLList (strcat HLList "____________________________________"   ;; Separator
                             "\nURL: " (vla-get-URL Hyperlink)
                             "\nURL Description: " (vla-get-URLDescription Hyperlink)
                             "\nURL Named Location: " (vla-get-URLNamedLocation Hyperlink)))
    )

    (alert (strcat "The circle has " (itoa (vla-get-Count Hyperlinks)) " Hyperlink: \n"  HLList))
)


URLNamedLocation Property (ActiveX)

Specifies the named location for the Hyperlink object.

Supported platforms: Windows only

Signature

VBA:

object.URLNamedLocation
object

Type: Hyperlink

The object this property applies to.

Property Value

Read-only: No

Type: String

A string representing the named location for the Hyperlink object.

Remarks

This property specifies a given location, such as a named view in AutoCAD or a bookmark in a word processing program. If you specify a named view to jump to in an AutoCAD drawing, AutoCAD restores that view when the hyperlink is opened. Views that are created in model space are restored in the Model tab. Views that are created in paper space are restored in the last active layout tab.

Examples

VBA:

Sub Example_URLNamedLocation()
    ' This example creates a Circle object in model space and
    ' adds a new Hyperlink to its Hyperlink collection

    Dim Hyperlinks As AcadHyperlinks
    Dim Hyperlink As AcadHyperlink
    Dim circleObj As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius As Double
    Dim HLList As String

    ' Define the Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    radius = 5#

    ' Create the Circle object in model space
    Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)

    ThisDrawing.Application.ZoomAll

    ' Get reference to the Circle's Hyperlinks collection
    Set Hyperlinks = circleObj.Hyperlinks

    ' Add a new Hyperlink complete with all properties
    Set Hyperlink = Hyperlinks.Add("AutoDesk")
    Hyperlink.URL = "www.autodesk.com"
    Hyperlink.URLDescription = "Autodesk Main Site"
    Hyperlink.URLNamedLocation = "MY_LOCATION"

    ' Read and display a list of existing Hyperlinks and
    ' their properties for this object
    For Each Hyperlink In Hyperlinks
        HLList = HLList & "____________________________________" & vbCrLf   ' Separator
        HLList = HLList & "URL: " & Hyperlink.URL & vbCrLf
        HLList = HLList & "URL Description: " & Hyperlink.URLDescription & vbCrLf
        HLList = HLList & "URL Named Location: " & Hyperlink.URLNamedLocation & vbCrLf
    Next

    MsgBox "The circle has " & Hyperlinks.count & " Hyperlink: " & vbCrLf & HLList
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_URLNamedLocation()
    ;; This example creates a Circle object in model space and
    ;; adds a new Hyperlink to its Hyperlink collection
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Circle object
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius 5)

    ;; Create the Circle object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj (vla-AddCircle modelSpace centerPoint radius))

    (vla-ZoomAll acadObj)

    ;; Get reference to the Circle's Hyperlinks collection
    (setq Hyperlinks (vla-get-Hyperlinks circleObj))

    ;; Add a new Hyperlink complete with all properties
    (setq Hyperlink (vla-Add Hyperlinks "Autodesk"))
    (vla-put-URL Hyperlink "www.autodesk.com")
    (vla-put-URLDescription Hyperlink "Autodesk Main Site")
    (vla-put-URLNamedLocation Hyperlink "MY_LOCATION")

    ;; Read and display a list of existing Hyperlinks and
    ;; their properties for this object
    (setq HLList "")
    (vlax-for Hyperlink Hyperlinks
        (setq HLList (strcat HLList "____________________________________"   ;; Separator
                             "\nURL: " (vla-get-URL Hyperlink)
                             "\nURL Description: " (vla-get-URLDescription Hyperlink)
                             "\nURL Named Location: " (vla-get-URLNamedLocation Hyperlink)))
    )

    (alert (strcat "The circle has " (itoa (vla-get-Count Hyperlinks)) " Hyperlink: \n"  HLList))
)


Used Property (ActiveX)

Specifies whether a layer is in use.

Supported platforms: Windows only

Signature

VBA:

object.Used
object

Type: Layer

The object this property applies to.

Property Value

Read-only: Yes

Type: Boolean

  • True: The layer is in use.
  • False: The layer is not in use.

Remarks

This property specifies whether a layer is in use when the GenerateUsageData method is called.

Examples

VBA:

Sub Example_Used()
    ' This example provides usage information for the layers
    ' in a drawing
    Dim MyLayers As AcadLayers
    Set MyLayers = ThisDrawing.Layers
    MyLayers.GenerateUsageData

    Dim MyLayerObj As AcadLayer
    For Each MyLayerObj In ThisDrawing.Layers
        MyLayerObj.Description = "Test"
        MsgBox (MyLayerObj.Used)
    Next MyLayerObj
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Used()
    ;; This example provides usage information for the layers
    ;; in a drawing
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq MyLayers (vla-get-Layers doc))
    (vla-GenerateUsageData MyLayers)

    (vlax-for MyLayerObj (vla-get-Layers doc)
        (alert (strcat "Layer " (vla-get-Name MyLayerObj) (if (= (vla-get-Used MyLayerObj) :vlax-true) " is used." " is not used.")))
    )
)


UseEntityColor Property (ActiveX)

Specifies the color source for the point cloud.

Supported platforms: Windows only

Signature

VBA:

object.UseEntityColor
object

Type: PointCloud

The object this property applies to.

Property Value

Read-only: No

Type: AcPointCloudColorType enum

  • acTrueColor
  • acByColor

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


UseLastPlotSettings Property (ActiveX)

Applies the plotting settings of the last successful plot.

Supported platforms: Windows only

Signature

VBA:

object.UseLastPlotSettings
object

Type: PreferencesOutput

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Use the settings of the last successful plot as the current plot settings.
  • False: Do not use the settings of the last successful plot as the current plot settings.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_UseLastPlotSettings()
    ' This example reads and modifies the UseLastPlotSettings
    ' preference value.
    ' When finished, this example resets the preference value back to
    ' it's original value.

    Dim ACADPref As AcadPreferencesOutput
    Dim originalValue As Boolean

    ' Get the user preferences object

    Set ACADPref = ThisDrawing.Application.preferences.Output

    ' Read and display the original value
    originalValue = ACADPref.UseLastPlotSettings
    MsgBox "The UseLastPlotSettings preference is set to: " & originalValue

    ' Modify the UseLastPlotSettings preference by toggling the value
    ACADPref.UseLastPlotSettings = Not ACADPref.UseLastPlotSettings

    MsgBox "The UseLastPlotSettings preference has been set to: " & ACADPref.UseLastPlotSettings

    ' Reset the preference back to it's original value
    ACADPref.UseLastPlotSettings = originalValue
    MsgBox "The UseLastPlotSettings preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_UseLastPlotSettings()
    ;; This example reads and modifies the UseLastPlotSettings
    ;; preference value.
    ;; When finished, this example resets the preference value back to
    ;; it's original value.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-UseLastPlotSettings (vla-get-Output preferences)))
    (alert (strcat "The UseLastPlotSettings preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the UseLastPlotSettings preference by toggling the value
    (vla-put-UseLastPlotSettings (vla-get-Output preferences) (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (alert (strcat "The UseLastPlotSettings preference has been set to: " (if (= (vla-get-UseLastPlotSettings (vla-get-Output preferences)) :vlax-true) "True" "False")))

    ;; Reset the preference back to it's original value
    (vla-put-UseLastPlotSettings (vla-get-Output preferences) originalValue)
    (alert (strcat "The UseLastPlotSettings preference was reset back to: " (if (= (vla-get-UseLastPlotSettings (vla-get-Output preferences)) :vlax-true) "True" "False")))
)


User Property (ActiveX)

Gets the PreferencesUser object.

Supported platforms: Windows only

Signature

VBA:

object.User
object

Type: Preferences

The object this property applies to.

Property Value

Read-only: Yes

Type: PreferencesUser

Gets the PreferencesUser object.

Remarks

The PreferencesUser object holds all the options from the User tab on the Options dialog stored in the registry. All options that are stored with the drawing can be found on the DatabasePreferences object.

Examples

VBA:

Sub Example_User()
    ' This example obtains a reference to the User Preferences object
    ' from the Application Preferences object, and reads one of the User
    ' preferences

    Dim ACADPref As AcadPreferencesUser

    ' Obtain a reference to the User Preferences object
    Set ACADPref = ThisDrawing.Application.preferences.User

    MsgBox "You now have access to the properties and methods of the User Preferences object!"
    MsgBox "The User preference KeyboardAccelerator is set to: " & ACADPref.KeyboardAccelerator

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_User()
    ;; This example obtains a reference to the User Preferences object
    ;; from the Application Preferences object, and reads one of the User
    ;; preferences
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    (alert "You now have access to the properties and methods of the User Preferences object!")
    (alert (strcat "The User preference KeyboardAccelerator is set to: " (if (= (vla-get-KeyboardAccelerator (vla-get-User preferences)) :vlax-true) "True" "False")))
)


UserCoordinateSystems Property (ActiveX)

Gets the UCSs collection for the document.

Supported platforms: Windows only

Signature

VBA:

object.UserCoordinateSystems
object

Type: Document

The object this property applies to.

Property Value

Read-only: Yes

Type: UCSs

The UCSs collection for the document.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_UserCoordinateSystems()
    ' This example finds the current UserCoordinateSystems collection and
    ' adds a new UCS to that collection.

    Dim UCSColl As AcadUCSs
    Set UCSColl = ThisDrawing.UserCoordinateSystems

    ' Create a UCS named "TEST" in the current drawing
    Dim ucsObj As AcadUCS
    Dim origin(0 To 2) As Double
    Dim xAxisPnt(0 To 2) As Double
    Dim yAxisPnt(0 To 2) As Double

    ' Define the UCS
    origin(0) = 4#: origin(1) = 5#: origin(2) = 3#
    xAxisPnt(0) = 5#: xAxisPnt(1) = 5#: xAxisPnt(2) = 3#
    yAxisPnt(0) = 4#: yAxisPnt(1) = 6#: yAxisPnt(2) = 3#

    ' Add the UCS to the UserCoordinatesSystems collection
    Set ucsObj = UCSColl.Add(origin, xAxisPnt, yAxisPnt, "TEST")

    MsgBox "A new UCS called " & ucsObj.name & " has been added to the UserCoordinateSystems collection.", vbInformation, "UserCoordinateSystems Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_UserCoordinateSystems()
    ;; This example finds the current UserCoordinateSystems collection and
    ;; adds a new UCS to that collection.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq UCSColl (vla-get-UserCoordinateSystems doc))

    ;; Create a UCS named "TEST" in the current drawing
    ;; Define the UCS
    (setq origin (vlax-3d-point 4 5 3)
          xAxisPnt (vlax-3d-point 5 5 3)
          yAxisPnt (vlax-3d-point 4 6 3))

    ;; Add the UCS to the UserCoordinatesSystems collection
    (setq ucsObj (vla-Add UCSColl origin xAxisPnt yAxisPnt "TEST"))

    (alert (strcat "A new UCS called " (vla-get-Name ucsObj) " has been added to the UserCoordinateSystems collection."))
)


UseStandardScale Property (ActiveX)

Specifies if the plot is to use a standard or custom scale.

Supported platforms: Windows only

Signature

VBA:

object.UseStandardScale
object

Type: Layout, PlotConfiguration

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Plot with the standard scale.
  • False: Plot with a custom scale.

Remarks

To specify the standard scale to use in the plot, use the StandardScale property. To specify a custom scale, use the SetCustomScale method.

Examples

VBA:

Sub Example_UseStandardScale()
    ' This example will access the Layouts collection for the current drawing
    ' and list the status of UseStandardScale for each Layout.

    Dim Layouts As AcadLayouts, Layout As ACADLayout
    Dim msg As String

    ' Get layouts collection from document object
    Set Layouts = ThisDrawing.Layouts

    msg = ""

    ' Get the UseStandardScale information of every layout in this drawing
    For Each Layout In Layouts
        If Layout.UseStandardScale Then
            msg = msg & Layout.name & " uses the standard scale." & vbCrLf
        Else
            msg = msg & Layout.name & " uses a custom scale." & vbCrLf
        End If
    Next

    ' Display the information
    MsgBox msg
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_UseStandardScale()
    ;; This example will access the Layouts collection for the current drawing
    ;; and list the status of UseStandardScale for each Layout.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get layouts collection from document object
    (setq Layouts (vla-get-Layouts doc)
          msg "")

    ;; Get the UseStandardScale information of every layout in this drawing
    (vlax-for Layout Layouts
        (if (= (vla-get-UseStandardScale Layout) :vlax-true)
            (setq msg (strcat msg (vla-get-Name Layout) " uses the standard scale.\n"))
            (setq msg (strcat msg (vla-get-Name Layout) " uses a custom scale.\n"))
        )
    )

    ;; Display the information
    (alert msg)
)


Utility Property (ActiveX)

Gets the Utility object for the document.

Supported platforms: Windows only

Signature

VBA:

object.Utility
object

Type: Document

The object this property applies to.

Property Value

Read-only: Yes

Type: Utility

The Utility object for the document.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Utility()
    ' This example creates a spline in model space using the
    ' CreateTypedArray method off of the utility object.

    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan As Variant
    Dim endTan As Variant
    Dim fitPoints As Variant
    Dim utilObj As Object   ' CreateTypedArray needs to be a late bound object
    Set utilObj = ThisDrawing.Utility

    utilObj.CreateTypedArray startTan, vbDouble, 0.5, 0.5, 0
    utilObj.CreateTypedArray endTan, vbDouble, 0.5, 0.5, 0
    utilObj.CreateTypedArray fitPoints, vbDouble, 1, 1, 0, 5, 5, 0, 10, 0, 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)

    ZoomAll

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Utility()
    ;; This example creates a spline in model space using the
    ;; CreateTypedArray method off of the utility object.

    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the spline
    (setq utilObj (vla-get-Utility doc))

    (vla-CreateTypedArray utilObj 'startTan vlax-vbDouble 0.5 0.5 0)
    (vla-CreateTypedArray utilObj 'endTan vlax-vbDouble 0.5 0.5 0)
    (vla-CreateTypedArray utilObj 'fitPoints vlax-vbDouble 0 0 0 5 5 0 10 0 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))

    (vla-ZoomAll acadObj)
)


Value Property (ActiveX)

Specifies the current value for the property, or the object ID of the newly created cloned object.

Supported platforms: Windows only

Signature

VBA:

object.Value
object

Type: DynamicBlockReferenceProperty, IDPair

The object this property applies to.

Property Value

Read-only: No (DynamicBlockReferenceProperty), Yes (IDPair)

Type: Variant (DynamicBlockReferenceProperty), Long_PTR (IDPair)

DynamicBlockReferenceProperty: The current value for the property.

IDPair: The object ID of the newly created cloned object in the CopyObjects operation.

Remarks

DynamicBlockReferenceProperty: No error is returned if the specified property value could not be set. For example, if the property has a list of allowable values or a minimum-maximum range, and the value provided is not in the list or is out of range, no error is returned.

IDPair: Use the Key property to get the object ID of the source object.

Examples

VBA:

Sub Example_Value()
    ' This example creates two Circle objects and uses the CopyObjects
    ' method to copy them. It then returns the object IDs
    ' of the new objects using the Value property and uses the
    ' object IDs to remove the new (target) objects

    Dim circleObj1 As AcadCircle, circleObj2 As AcadCircle
    Dim circleObj1Copy As AcadCircle, circleObj2Copy As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius1 As Double, radius2 As Double
    Dim radius1Copy As Double, radius2Copy As Double
    Dim objCollection(0 To 1) As Object
    Dim retObjects As Variant
    Dim IDPairs As Variant
    Dim TargetObject As AcadObject

    ' Define the Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    radius1 = 5#: radius2 = 7#
    radius1Copy = 1#: radius2Copy = 2#

    ' Add two circles to the drawing
    Set circleObj1 = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius1)
    Set circleObj2 = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius2)
    ThisDrawing.Application.ZoomAll

    ' Copy objects
    '
    ' First put the objects to be copied into a form compatible with CopyObjects
    Set objCollection(0) = circleObj1
    Set objCollection(1) = circleObj2

    ' Copy object and get back a collection of the new objects (copies)
    retObjects = ThisDrawing.CopyObjects(objCollection, , IDPairs)

    ' Get newly created object and apply new properties to the copies
    Set circleObj1Copy = retObjects(0)
    Set circleObj2Copy = retObjects(1)

    circleObj1Copy.radius = radius1Copy
    circleObj2Copy.radius = radius2Copy

    ThisDrawing.Application.ZoomAll
    ThisDrawing.Regen acAllViewports

    ' Display the object IDs of the source objects used for the copy
    MsgBox "The first target object ID is: " & IDPairs(0).Value & vbCrLf & _
           "The second target object ID is: " & IDPairs(1).Value

    ' This key can be used with objectIDtoObject to reference the source objects,
    ' which is useful if the user manually selected the source objects.
    '
    ' Here we delete the source objects from the ID obtained
    Set TargetObject = ThisDrawing.ObjectIdToObject(IDPairs(0).Value)
    TargetObject.Delete
    Set TargetObject = ThisDrawing.ObjectIdToObject(IDPairs(1).Value)
    TargetObject.Delete

    ThisDrawing.Regen acAllViewports

    MsgBox "The target objects have been deleted!", vbInformation
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Value()
    ;; This example creates two Circle objects and uses the CopyObjects
    ;; method to copy them. It then returns the object IDs
    ;; of the new objects using the Value property and uses the
    ;; object IDs to remove the new (target) objects
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Circle object
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius1 5
          radius2 7
          radius1Copy 1
          radius2Copy 2)

    ;; Add two circles to the drawing
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj1 (vla-AddCircle modelSpace centerPoint radius1))
    (setq circleObj2 (vla-AddCircle modelSpace centerPoint radius2))
    (vla-ZoomAll acadObj)

    ;; Copy objects
    ;;
    ;; First put the objects to be copied into a form compatible with CopyObjects
    (setq objCollection (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element objCollection 0 circleObj1)
    (vlax-safearray-put-element objCollection 1 circleObj2)

    ;; Copy object and get back a collection of the new objects (copies)
    (setq retObjects (vlax-variant-value (vla-CopyObjects doc objCollection nil 'IDPairs)))

    ;; Get newly created object and apply new properties to the copies
    (setq circleObj1Copy (vlax-safearray-get-element retObjects 0))
    (setq circleObj2Copy (vlax-safearray-get-element retObjects 1))

    (vla-put-Radius circleObj1Copy radius1Copy)
    (vla-put-Radius circleObj2Copy radius2Copy)

    (vla-ZoomAll acadObj)
    (vla-Regen doc acAllViewports)

    ;; Display the object IDs of the source objects used for the copy
    (alert (strcat "The first target object ID is: " (itoa (vla-get-Value (vlax-safearray-get-element IDPairs 0)))
                   "\nThe second target object ID is: " (itoa (vla-get-Value (vlax-safearray-get-element IDPairs 1)))))

    ;; This key can be used with objectIDtoObject to reference the source objects,
    ;; which is useful if the user manually selected the source objects.
    ;;
    ;; Here we delete the source objects from the ID obtained
    (setq TargetObject (vla-ObjectIdToObject doc (vla-get-Value (vlax-safearray-get-element IDPairs 0))))
    (vla-Delete TargetObject)
    (setq TargetObject (vla-ObjectIdToObject doc (vla-get-Value (vlax-safearray-get-element IDPairs 1))))
    (vla-Delete TargetObject)

    (vla-Regen doc acAllViewports)

    (alert "The target objects have been deleted!")
)


VBE Property (ActiveX)

Gets the VBAIDE extensibility object.

Supported platforms: Windows only

Signature

VBA:

object.VBE
object

Type: Application

The object this property applies to.

Property Value

Read-only: Yes

Type: Microsoft VBE object

The VBAIDE extensibility object.

Remarks

This property allows you to access the VBA IDE object model from AutoCAD's object model. The property will throw an exception if the VBAIDE is not available. For example, the VBAIDE is not available if the acvba.arx app has not been loaded.

The following line of code returns the name of the active VBA project description string:

ThisDrawing.Application.VBE.ActiveVBProject.Description

Examples

VBA:

Sub Example_VBE()
    ' This example uses the VBA IDE extensibility model to dynamically
    ' create a VBA subroutine. After running this example, see the first line of code
    ' in the VBA IDE code window to see a new subroutine. Then
    ' remove the new subroutine before continuing.

    Dim VBEModel As Object
    Dim newRoutine As String

    Set VBEModel = VBE  ' Get the VBE object

    ' Define new subroutine to be added. This could be created dynamically from user feedback.
    newRoutine = "Sub Dynamic_Procedure()" & vbCrLf
    newRoutine = newRoutine & vbTab & "MsgBox ""New subroutine.""" & vbCrLf
    newRoutine = newRoutine & "End Sub" & vbCrLf

    ' Insert new subroutine
    VBEModel.CodePanes(1).CodeModule.InsertLines 1, newRoutine

    MsgBox "A new subroutine was added called Dynamic_Procedure."
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_VBE()
    ;; This example uses the VBA IDE extensibility model to dynamically
    ;; create a VBA subroutine. After running this example, see the first line of code
    ;; in the VBA IDE code window to see a new subroutine. Then
    ;; remove the new subroutine before continuing.

    ;; Note: You might need to add a code module to the default project first.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq VBEModel (vla-get-VBE acadObj))  ;; Get the VBE object

    ;; Define new subroutine to be added. This could be created dynamically from user feedback.
    (setq newRoutine (strcat "Sub Dynamic_Procedure()"
                             "\n    MsgBox \"New subroutine.\""
                             "\nEnd Sub"))

    ;; Insert new subroutine
    (vlax-invoke-method (vlax-get-property (vlax-invoke-method (vlax-get-property VBEModel 'CodePanes) 'Item 1) 'CodeModule) 'InsertLines 1 newRoutine)

    (alert "A new subroutine was added called Dynamic_Procedure.")
)


Verify Property (ActiveX)

Specifies if the attribute is set for verification.

Supported platforms: Windows only

Signature

VBA:

object.Verify
object

Type: Attribute

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The attribute is set to verify.
  • False: The attribute is not set to verify.

Remarks

An attribute set to verify prompts the user for verification that the attribute value is correct when inserting the block.

An attribute may exist as only one of four optional modes: constant, preset, invisible, or verify. The AFLAGS system variable stores the current mode settings. You can query the current mode using the Mode property.

Examples

VBA:

Sub Example_Verify()
    ' This example creates an attribute definition in model space.
    ' It then sets the definition to be verify, and queries the mode.

    Dim attributeObj As AcadAttribute
    Dim height As Double
    Dim mode As Long
    Dim prompt As String
    Dim insertionPoint(0 To 2) As Double
    Dim tag As String
    Dim value As String

    ' Define the attribute definition
    height = 1#
    mode = acAttributeModeVerify
    prompt = "New Prompt"
    insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0
    tag = "New_Tag"
    value = "New Value"

    ' Create the attribute definition object in model space
    Set attributeObj = ThisDrawing.ModelSpace.AddAttribute(height, mode, prompt, insertionPoint, tag, value)
    ZoomAll

    ' Change the mode to be verify
    attributeObj.mode = acAttributeModeVerify
    attributeObj.Update

    ' Check to see if the attribute is set to verify
    MsgBox (IIf(attributeObj.Verify, "The attribute is set to verify", "The attribute is not set to verify"))
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Verify()
    ;; This example creates an attribute definition in model space.
    ;; It then sets the definition to be verify, and queries the mode.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the attribute definition
    (setq insertionPoint (vlax-3d-point 5 5 0)
          attHeight 1
          attMode acAttributeModeVerify
          attPrompt "New Prompt"
          attTag "New_Tag"
          attValue "New Value")

    ;; Create the attribute definition object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq attributeObj (vla-AddAttribute modelSpace attHeight attMode attPrompt insertionPoint attTag attValue))
    (vla-ZoomAll acadObj)

    ;; Change the mode to be verify
    (vla-put-Mode attributeObj acAttributeModeVerify)
    (vla-Update attributeObj)

    ;; Check to see if the attribute is set to verify
    (alert (if (= (vla-get-Verify attributeObj) :vlax-true) "The attribute is set to verify" "The attribute is not set to verify"))
)


Version Property (ActiveX)

Gets the version of the AutoCAD application you are using.

Supported platforms: Windows only

Signature

VBA:

object.Version
object

Type: Application

The object this property applies to.

Property Value

Read-only: Yes

Type: String

The version of AutoCAD that you are using.

Remarks

NoteThe value of this property is stored in the ACADVER system variable.

Examples

VBA:

Sub Example_Version()
    ' This example returns AutoCAD version as a string

    Dim version As String
    version = ThisDrawing.Application.version
    MsgBox "This is AutoCAD Version " & version, , "Version Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Version()
    ;; This example returns AutoCAD version as a string
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq version (vla-get-Version acadObj))
    (alert (strcat "This is AutoCAD Version " version))
)


VersionGUID Property (ActiveX)

Specifies the name of the Version GUID of an entry in the File Dependency List.

Supported platforms: Windows only

Signature

VBA:

object.VersionGUID
object

Type: FileDependency

The object this property applies to.

Property Value

Read-only: Yes

Type: String

The version GUID of an entry.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_VersionGUID()
    ' This example reads information from a File Dependency List
    ' Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ' \Sample\Sheet Sets\Architectural\A-01.dwg

    Dim objFDLCol As AutoCAD.AcadFileDependencies
    Dim objFDL As AutoCAD.AcadFileDependency

    Set objFDLCol = ThisDrawing.FileDependencies
    MsgBox ("The number of entries in the File Dependency List is " & objFDLCol.count & ".")

    Dim strTemp As String
    For Each objFDL In objFDLCol
        strTemp = "Affects graphics?: " & vbTab & objFDL.AffectsGraphics
        strTemp = strTemp & vbCrLf & "Feature: " & vbTab & objFDL.Feature
        strTemp = strTemp & vbCrLf & "FileName: " & vbTab & objFDL.FileName
        strTemp = strTemp & vbCrLf & "FileSize: " & vbTab & objFDL.FileSize
        strTemp = strTemp & vbCrLf & "Fingerprint GUID: " & vbTab & objFDL.FingerprintGuid
        strTemp = strTemp & vbCrLf & "FoundPath: " & vbTab & objFDL.FoundPath
        strTemp = strTemp & vbCrLf & "FullFileName: " & vbTab & objFDL.FullFileName
        strTemp = strTemp & vbCrLf & "Index: " & vbTab & objFDL.Index
        strTemp = strTemp & vbCrLf & "Modified?: " & vbTab & objFDL.IsModified
        strTemp = strTemp & vbCrLf & "ReferenceCount: " & vbTab & objFDL.ReferenceCount
        strTemp = strTemp & vbCrLf & "Timestamp: " & vbTab & objFDL.TimeStamp
        strTemp = strTemp & vbCrLf & "Version GUID: " & vbTab & objFDL.VersionGuid
        MsgBox strTemp
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_VersionGUID()
    ;; This example reads information from a File Dependency List
    ;; Open a drawing from the sample Sheet Sets that contains xrefs, such as
    ;; .\\Sample\\Sheet Sets\\Architectural\\A-01.dwg
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq objFDLCol (vla-get-FileDependencies doc))
    (alert (strcat "The number of entries in the File Dependency List is " (itoa (vla-get-Count objFDLCol)) "."))

    (setq strTemp "")
    (vlax-for each-objFDL objFDLCol
        (setq strTemp (strcat "Affects graphics?: " (if (= (vla-get-AffectsGraphics each-objFDL) :vlax-true) "True" "False")))
        (setq strTemp (strcat strTemp
                  "\nFeature: " (vla-get-Feature each-objFDL)
                  "\nFileName: " (vla-get-FileName each-objFDL)
                  "\nFileSize: " (itoa (vla-get-FileSize each-objFDL))
                  "\nFingerprint GUID: " (vla-get-FingerprintGuid each-objFDL)
                  "\nFoundPath: " (vla-get-FoundPath each-objFDL)
                  "\nFullFileName: " (vla-get-FullFileName each-objFDL)
                  "\nIndex: " (itoa (vla-get-Index each-objFDL))
                  "\nModified?: " (if (= (vla-get-IsModified each-objFDL) :vlax-true) "True" "False")
                  "\nReferenceCount: " (itoa (vla-get-ReferenceCount each-objFDL))
                  "\nTimeStamp: " (itoa (vla-get-TimeStamp each-objFDL))
                  "\nVersion GUID: " (vla-get-VersionGuid each-objFDL)
                  )
    )
        (alert strTemp)
    )
)


VertCellMargin Property (ActiveX)

Specifies the value of the vertical margin of cells.

Supported platforms: Windows only

Signature

VBA:

object.VertCellMargin
object

Type: Table, TableStyle

The object this property applies to.

Property Value

Read-only: No

Type: Double

The vertical margin applied to each table cell.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_VertCellMargin()
    ' This example creates a TableStyle object and sets values for
    ' the style name and other attributes.

    Dim dictionaries As AcadDictionaries
    Set dictionaries = ThisDrawing.Database.dictionaries

    Dim dictObj As AcadDictionary
    Set dictObj = dictionaries.Item("acad_tablestyle")

    ' Create the custom TableStyle object in the dictionary
    Dim keyName As String
    Dim className As String
    Dim customObj As AcadTableStyle
    keyName = "NewStyle"
    className = "AcDbTableStyle"
    Set customObj = dictObj.AddObject(keyName, className)

    customObj.Name = "NewStyle"
    customObj.Description = "New Style for My Tables"

    customObj.FlowDirection = acTableBottomToTop
    customObj.HorzCellMargin = 0.22
    customObj.VertCellMargin = 0.22
    customObj.BitFlags = 1
    customObj.SetTextHeight AcRowType.acDataRow + AcRowType.acTitleRow, 1.3
    customObj.SetTextStyle AcRowType.acDataRow + AcRowType.acTitleRow, "Standard"

    Dim col As AcadAcCmColor
    Set col = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    col.SetRGB 12, 23, 45
    customObj.SetBackgroundColor AcRowType.acDataRow + AcRowType.acTitleRow, col
    customObj.SetGridVisibility AcGridLineType.acHorzInside + AcGridLineType.acHorzTop _
                                , AcRowType.acDataRow + AcRowType.acTitleRow, True

    customObj.SetAlignment AcRowType.acDataRow + AcRowType.acTitleRow, acBottomRight
    col.SetRGB 244, 0, 0
    customObj.SetGridColor 3, 1, col

    MsgBox "Table Style Name = " & customObj.Name & vbCrLf & _
           "Style Description = " & customObj.Description & vbCrLf & _
           "Flow Direction = " & customObj.FlowDirection & vbCrLf & _
           "Horzontal Cell Margin = " & customObj.HorzCellMargin & vbCrLf & _
           "Vertical Cell Margin = " & customObj.VertCellMargin & vbCrLf & _
           "Bit Flags = " & customObj.BitFlags & vbCrLf & _
           "Title Row Text Height = " & customObj.GetTextHeight(acTitleRow) & vbCrLf & _
           "Title Row Text Style = " & customObj.GetTextStyle(acTitleRow) & vbCrLf & _
           "Grid Visibility for HorizontalBottom TitleRow  = " & customObj.GetGridVisibility(acHorzBottom, acTitleRow) & vbCrLf & _
           "Title Row Alignment = " & customObj.GetAlignment(acTitleRow) & vbCrLf & _
           "Header Suppression = " & customObj.HeaderSuppressed

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_HorzCellMargin()
    ;; This example creates a TableStyle object and sets values for
    ;; the style name and other attributes.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq dictionaries (vla-get-Dictionaries doc))
    (setq dictObj (vla-Item dictionaries "acad_tablestyle"))

    ;; Create the custom TableStyle object in the dictionary
    (setq keyName "NewStyle"
          className "AcDbTableStyle")

    (setq customObj (vla-AddObject dictObj keyName className))

    (vla-put-Name customObj "NewStyle")
    (vla-put-Description customObj "New Style for My Tables")

    (vla-put-FlowDirection customObj acTableBottomToTop)
    (vla-put-HorzCellMargin customObj 0.22)
    (vla-put-VertCellMargin customObj 0.22)
    (vla-put-BitFlags customObj 1)
    (vla-SetTextHeight customObj (+ acDataRow acTitleRow) 1.3)
    (vla-SetTextStyle customObj (+ acDataRow acTitleRow) "Standard")

    (setq col (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB col 12 23 45)

    (vla-SetBackgroundColor customObj (+ acDataRow acTitleRow) col)
    (vla-SetGridVisibility customObj (+ acHorzInside acHorzTop) (+ acDataRow acTitleRow) :vlax-true)
    (vla-SetAlignment customObj (+ acDataRow acTitleRow) acBottomRight)
    (vla-SetRGB col 244 0 0)
    (vla-SetGridColor customObj (+ acHorzTop acHorzInside) acDataRow col)

    (alert (strcat "Table Style Name = " (vla-get-Name customObj)
                   "\nStyle Description = " (vla-get-Description customObj)
                   "\nFlow Direction = " (itoa (vla-get-FlowDirection customObj))
                   "\nHorzontal Cell Margin = " (rtos (vla-get-HorzCellMargin customObj) 2)
                   "\nVertical Cell Margin = " (rtos (vla-get-VertCellMargin customObj) 2)
                   "\nBit Flags = " (itoa (vla-get-BitFlags customObj))
                   "\nTitle Row Text Height = " (rtos (vla-GetTextHeight customObj acTitleRow) 2)
                   "\nTitle Row Text Style = " (vla-GetTextStyle customObj acTitleRow)
                   "\nGrid Visibility for HorizontalBottom TitleRow  = " (if (= (vla-GetGridVisibility customObj acHorzBottom acTitleRow) :vlax-true) "True" "False")
                   "\nTitle Row Alignment = " (itoa (vla-GetAlignment customObj acTitleRow))
               "\nHeader Suppression = " (if (= (vla-get-HeaderSuppressed customObj) :vlax-true) "True" "False")
       )
    )
    (vlax-release-object col)
)


VertexCount Property (ActiveX)

Returns the number of vertices in the SubD mesh.

Supported platforms: Windows only

Signature

VBA:

object.VertexCount
object

Type: SubDMesh

The objects this property applies to.

Property Value

Read-only: Yes

Type: Long

Number of vertices in the SubD mesh.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


VerticalDirection Property (ActiveX)

Specifies the vertical direction for the section plane.

Supported platforms: Windows only

Signature

VBA:

object.VerticalDirection
object

Type: Section

The object to which this property applies.

Property Value

Read-only: No

Type: Variant

Vertical direction of the section plane.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


VerticalTextPosition Property (ActiveX)

Specifies the vertical position of text in relation to the dimension line.

Supported platforms: Windows only

Signature

VBA:

object.VerticalTextPosition
object

Type: Dim3PointAngular, DimAligned, DimAngular, DimArcLength, DimDiametric, Dimension, DimOrdinate, DimRadial, DimRadialLarge, DimRotated, Leader

The object this property applies to.

Property Value

Read-only: No

Type: acDimVerticalJustification enum

  • acVertCentered: Centers the dimension text between the extension lines.
  • acAbove: Places the dimension text above the dimension line except when the dimension line is not horizontal and text inside the extension lines is forced horizontal (DIMTIH = 1). The distance from the dimension line to the baseline of the lowest line of text is the current DIMGAP value.
  • acUnder: Places the dimension text below the dimension line except when the dimension line is not horizontal and text inside the extension lines is forced horizontal (DIMTIH = 1). The distance from the dimension line to the baseline of the lowest line of text is the current DIMGAP value.
  • acOutside: Places the dimension text on the side of the dimension line farthest from the defining points.
  • acJIS: Places the dimension text to conform to Japanese Industrial Standards (JIS).

Remarks

The initial value for this property is acVertCentered.

NoteThis property overrides the value of the DIMTAD system variable for the given dimension, leader, or tolerance object.

Examples

VBA:

Sub Example_VerticalTextPosition()
    ' This example creates an aligned dimension in model space
    ' and cycles the dimension text through a couple of different
    ' vertical alignments

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim CurrentValue As String

    ' Define the dimension
    point1(0) = 5: point1(1) = 5: point1(2) = 0
    point2(0) = 9: point2(1) = 5: point2(2) = 0
    location(0) = 5: location(1) = 7: location(2) = 0

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ThisDrawing.Application.ZoomAll

    ' Read and display current text position
    Select Case dimObj.VerticalTextPosition
        Case acVertCentered:    CurrentValue = "centered"
        Case acAbove:           CurrentValue = "above"
        Case acOutside:         CurrentValue = "outside"
        Case acJIS:             CurrentValue = "to Japanesee industrial standards"
    End Select

    MsgBox "The vertical position of the dimension is: " & CurrentValue

    ' Change the position of the dimension text to be above the extesnion lines
    dimObj.VerticalTextPosition = acAbove
    ThisDrawing.Regen acAllViewports
    MsgBox "Dimension text is now aligned above extension lines"

    ' Change the position of the dimension text to be centered with the extension lines
    dimObj.VerticalTextPosition = acVertCentered
    ThisDrawing.Regen acAllViewports
    MsgBox "Dimension text is now centered with the extension lines"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_VerticalTextPosition()
    ;; This example creates an aligned dimension in model space
    ;; and cycles the dimension text through a couple of different
    ;; vertical alignments
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the dimension
    (setq point1 (vlax-3d-point 5 5 0)
          point2 (vlax-3d-point 9 5 0)
          location (vlax-3d-point 5 7 0))

    ;; Create an aligned dimension object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq dimObj (vla-AddDimAligned modelSpace point1 point2 location))
    (vla-ZoomAll acadObj)

    ;; Read and display current text position
    (setq CurrentValue (cond
                           ((= (vla-get-VerticalTextPosition dimObj) acVertCentered) "centered")
                           ((= (vla-get-VerticalTextPosition dimObj) acAbove) "above")
                           ((= (vla-get-VerticalTextPosition dimObj) acOutside) "outside")
                           ((= (vla-get-VerticalTextPosition dimObj) acJIS) "to Japanesee industrial standards")
                       ))

    (alert (strcat "The vertical position of the dimension is: " CurrentValue))

    ;; Change the position of the dimension text to be above the extesnion lines
    (vla-put-VerticalTextPosition dimObj acAbove)
    (vla-Regen doc acAllViewports)
    (alert "Dimension text is now aligned above extension lines")

    ;; Change the position of the dimension text to be centered with the extension lines
    (vla-put-VerticalTextPosition dimObj acVertCentered)
    (vla-Regen doc acAllViewports)
    (alert "Dimension text is now centered with the extension lines")
)


Vertices Property (ActiveX)

Gets the vertices in the section line.

Supported platforms: Windows only

Signature

VBA:

object.Vertices
object

Type: Section

The object to which this property applies.

Property Value

Read-only: No

Type: Variant

Array of vertices that define the section line.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ViewingDirection Property (ActiveX)

Specifies the viewing direction for the section plane.

Supported platforms: Windows only

Signature

VBA:

object.ViewingDirection
object

Type: Section

The object to which this property applies.

Property Value

Read-only: No

Type: Variant

Viewing direction of the section plane.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ViewportDefault Property (ActiveX)

Specifies if the layer is to be frozen in new viewports.

Supported platforms: Windows only

Signature

VBA:

object.ViewportDefault
object

Type: Layer

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The layer is frozen in new viewports.
  • False: The layer is not frozen in new viewports.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_ViewportDefault()
    ' This example creates a new layer called "New_Layer".  It then uses
    ' the ViewportDefault property of each Layer to display whether or not that layer
    ' is frozen in new viewports.  The user has the ability to toggle whether or not
    ' each layer will be frozen in new viewports, and the final ViewportDefault status
    ' for all layers is displayed.

    Dim layerObj As AcadLayer, tempLayer As AcadLayer
    Dim msg As String

    ' Add the layer to the layers collection
    Set layerObj = ThisDrawing.Layers.Add("New_Layer")

    ' Make the new layer the active layer for the drawing
    ThisDrawing.ActiveLayer = layerObj

    ' Cycle through the layers and allow user to make them frozen in new viewports or not

    For Each tempLayer In ThisDrawing.Layers
        If tempLayer.ViewportDefault Then     ' Determine if this layer is fozen in new viewports
            If MsgBox("The layer '" & tempLayer.name & "' will be frozen in new viewports.  Would you like to make this layer unfrozen in new viewports?", vbYesNo & vbQuestion) = vbYes Then
                tempLayer.ViewportDefault = False     ' Change frozen state
            End If
        Else
            If MsgBox("The layer '" & tempLayer.name & "' will not be frozen in new viewports.  Would you like to make this layer frozen in new viewports?", vbYesNo & vbQuestion) = vbYes Then
                tempLayer.ViewportDefault = True      ' Change frozen state
            End If
        End If
    Next

    ' Display the new viewport freeze status of the layers in this drawing

    For Each tempLayer In ThisDrawing.Layers
        ' Determine if this layer is frozen in new viewports
        If tempLayer.ViewportDefault Then
            msg = msg & "The layer '" & tempLayer.name & "' will be frozen in new viewports." & vbCrLf
        Else
            msg = msg & "The layer '" & tempLayer.name & "' will not be frozen in new viewports." & vbCrLf
        End If
    Next

    MsgBox msg
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ViewportDefault()
    ;; This example creates a new layer called "New_Layer".  It then uses
    ;; the ViewportDefault property of each Layer to display whether or not that layer
    ;; is frozen in new viewports.  The user has the ability to toggle whether or not
    ;; each layer will be frozen in new viewports, and the final ViewportDefault status
    ;; for all layers is displayed.

    ;; Add the layer to the layers collection
    (setq layerObj (vla-Add (vla-get-Layers doc) "New_Layer"))

    ;; Make the new layer the active layer for the drawing
    (vla-put-ActiveLayer doc layerObj)

    ;; Cycle through the layers and allow user to make them frozen in new viewports or not
    (vlax-for tempLayer (vla-get-Layers doc)
        ;; Display the current new viewports layer state
        (if (= (vla-get-ViewportDefault tempLayer) :vlax-true)
            (alert (strcat "The layer '" (vla-get-Name tempLayer) "' is frozen for new viewports. Toggling state now."))
            (alert (strcat "The layer '" (vla-get-Name tempLayer) "' is not frozen for new viewports. Toggling state now."))
        )
        (vla-put-ViewportDefault tempLayer (if (= (vla-get-ViewportDefault tempLayer) :vlax-true) :vlax-false :vlax-true))
    )

    ;; Display the new viewport freeze status of the layers in this drawing
    (setq msg "")
    (vlax-for tempLayer (vla-get-Layers doc)
        ;; Determine if this layer is frozen in new viewports
        (if (= (vla-get-ViewportDefault tempLayer) :vlax-true)
            (setq msg (strcat msg "The layer '" (vla-get-Name tempLayer) "' will be frozen in new viewports.\n"))
            (setq msg (strcat msg "The layer '" (vla-get-Name tempLayer) "' will not be frozen in new viewports.\n"))
        )
    )

    (alert msg)
)


ViewportOn Property (ActiveX)

Specifies the display status of the viewport.

Supported platforms: Windows only

Signature

VBA:

object.ViewportOn
object

Type: PViewport

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The viewport is on.
  • False: The viewport is off.

Remarks

To turn the display control of a viewport on or off use the Display method.

Examples

VBA:

Sub Example_ViewportOn()
    ' This example creates two new paper space viewports.
    ' It then checks the status of the viewports.

    Dim pviewportObj1 As AcadPViewport
    Dim pviewportObj2 As AcadPViewport
    Dim center(0 To 2) As Double
    Dim width As Double
    Dim height As Double

    ' Define the paper space viewport
    center(0) = 3: center(1) = 3: center(2) = 0
    width = 10
    height = 10

    ' Change from model space to paper space
    ThisDrawing.ActiveSpace = acPaperSpace

    ' Create the paper space viewports
    Set pviewportObj1 = ThisDrawing.PaperSpace.AddPViewport(center, width, height)
    center(0) = 8: center(1) = 8: center(2) = 0
    width = 10
    height = 10
    Set pviewportObj2 = ThisDrawing.PaperSpace.AddPViewport(center, width, height)

    ' Before making a paper space viewport active,
    ' the mspace property needs to be True
    pviewportObj1.DISPLAY (True)
    ThisDrawing.mspace = True
    ThisDrawing.ActivePViewport = pviewportObj1
    ThisDrawing.Regen acAllViewports

    MsgBox "pviewportObj1 is " & (IIf(pviewportObj1.ViewportOn, "on.", "not on.")) & vbCrLf & _
           "pviewportObj2 is " & (IIf(pviewportObj2.ViewportOn, "on.", "not on."))

    ' Now turn on pviewportObj2 as well
    pviewportObj2.DISPLAY (True)
    MsgBox "pviewportObj1 is " & (IIf(pviewportObj1.ViewportOn, "on.", "not on.")) & vbCrLf & _
           "pviewportObj2 is " & (IIf(pviewportObj2.ViewportOn, "on.", "not on."))

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ViewportOn()
    ;; This example creates two new paper space viewports.
    ;; It then checks the status of the viewports.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the paper space viewport
    (setq center (vlax-3d-point 3 3 0)
          width 10
          height 10)

    ;; Change from model space to paper space
    (vla-put-ActiveSpace doc acPaperSpace)

    ;; Create the paper space viewports
    (setq paperSpace (vla-get-PaperSpace doc))
    (setq pviewportObj1 (vla-AddPViewport paperSpace center width height))

    (setq center (vlax-3d-point 8 8 0)
          width 10
          height 10)

    (setq pviewportObj2 (vla-AddPViewport paperSpace center width height))

    ;; Before making a paper space viewport active,
    ;; the mspace property needs to be True
    (vla-Display pviewportObj1 :vlax-true)

    (vla-put-MSpace doc :vlax-true)
    (vla-put-ActivePViewport doc pviewportObj1)
    (vla-Regen doc acAllViewports)

    (alert (strcat "pviewportObj1 is " (if (= (vla-get-ViewportOn pviewportObj1) :vlax-true) "on." "not on.")
                   "\npviewportObj2 is " (if (= (vla-get-ViewportOn pviewportObj2) :vlax-true) "on." "not on.")))

    ;; Now turn on pviewportObj2 as well
    (vla-Display pviewportObj2 :vlax-true)

    (alert (strcat "pviewportObj1 is " (if (= (vla-get-ViewportOn pviewportObj1) :vlax-true) "on." "not on.")
                   "\npviewportObj2 is " (if (= (vla-get-ViewportOn pviewportObj2) :vlax-true) "on." "not on.")))
)


Viewports Property (ActiveX)

Gets the Viewports collection for the document.

Supported platforms: Windows only

Signature

VBA:

object.Viewports
object

Type: Database, Document

The object this property applies to.

Property Value

Read-only: Yes

Type: Viewports

The Viewports collection for the document.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Viewports()
    ' This example finds the current Viewports collection and
    ' adds a new viewport to that collection.

    Dim viewportColl As AcadViewports
    Set viewportColl = ThisDrawing.Viewports

    ' Create a viewport named "TEST" in the current drawing
    Dim viewportObj As AcadViewport
    Set viewportObj = viewportColl.Add("TEST")
    MsgBox "A new viewport called " & viewportObj.name & " has been added to the Viewports collection.", vbInformation, "Viewports Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Viewports()
    ;; This example finds the current Viewports collection and
    ;; adds a new viewport to that collection.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq viewportColl (vla-get-Viewports doc))

    ;; Create a viewport named "TEST" in the current drawing
    (setq viewportObj (vla-Add viewportColl "TEST"))
    (alert (strcat "A new viewport called " (vla-get-Name viewportObj) " has been added to the Viewports collection."))
)


Views Property (ActiveX)

Gets the Views collection for the document.

Supported platforms: Windows only

Signature

VBA:

object.Views
object

Type: Database, Document

The object this property applies to.

Property Value

Read-only: Yes

Type: Views

The Views collection for the document.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Views()
    ' This example finds the current views collection and
    ' adds a new view to that collection.

    Dim viewColl As AcadViews
    Set viewColl = ThisDrawing.Views

    ' Create a view named "TEST" in the current drawing
    Dim viewObj As AcadView
    Set viewObj = viewColl.Add("TEST")
    MsgBox "A new view called " & viewObj.name & " has been added to the views collection.", vbInformation, "Views Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Views()
    ;; This example finds the current views collection and
    ;; adds a new view to that collection.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq viewColl (vla-get-Views doc))

    ;; Create a view named "TEST" in the current drawing
    (setq viewObj (vla-Add viewColl "TEST"))
    (alert (strcat "A new view called " (vla-get-Name viewObj) " has been added to the views collection."))
)


ViewToPlot Property (ActiveX)

Specifies the name of the view to plot.

Supported platforms: Windows only

Signature

VBA:

object.ViewToPlot
object

Type: Layout, PlotConfiguration

The object this property applies to.

Property Value

Read-only: No

Type: String

The name of the view to plot.

Remarks

To specify a plot to a view, set the PlotType property for the layout or plot configuration to acView.

Examples

VBA:

Sub Example_ViewToPlot()
    ' This example reads a list of available Named Views and displays a plot preview
    ' of the view selected by the user.  The current view to plot,
    ' if set, if preceded by an '*'
    '
    ' * Note: After previewing the plot, you will have to exit the
    ' plot preview before the VBA example will stop and control will be returned

    Dim ViewList As New Collection
    Dim View As AcadView
    Dim iCount As Long
    Dim msg As String
    Dim ViewName As String, ViewNum As String

    ' Get list of views available to plot
    For Each View In ThisDrawing.Views
        ViewList.Add View
    Next

    ' Are there any named views to plot
    If ViewList.count = 0 Then
        MsgBox "There are no named views to plot.", vbInformation
        Exit Sub
    End If

    ' Read and display the current plot style table path
    For iCount = 1 To ViewList.count
        ViewName = ViewList(iCount).Name

        If ViewName = ThisDrawing.ActiveLayout.ViewToPlot Then  ' Is this the current view to plot
            ViewNum = iCount
            ViewName = "*" & ViewName
        End If

        msg = msg & "(" & iCount & ") " & vbTab & ViewName & vbCrLf
    Next

    ' Prompt user for the view to plot
RETRY:
    ViewNum = InputBox("Which view would you like to plot?" & vbCrLf & vbCrLf & msg, "View To Plot", ViewNum)

    If Trim(ViewNum) = "" Then
        Exit Sub
    End If

    If Not (IsNumeric(ViewNum)) Then
        MsgBox "You must supply a numeric value corresponding to one of the views listed above.", vbExclamation
        GoTo RETRY
    End If

    ' Tell the drawing which view to plot
    ThisDrawing.ActiveLayout.ViewToPlot = ViewList(CLng(ViewNum)).Name

    ' Make sure you tell the drawing to plot a view, not some other plot style
    ThisDrawing.ActiveLayout.PlotType = acView

    ' Send Plot To Window
    ThisDrawing.ActiveLayout.ConfigName = "DWG to PDF.pc3"
    ThisDrawing.Plot.DisplayPlotPreview acFullPreview
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ViewToPlot()
    ;; This example reads a list of available Named Views and displays a plot preview
    ;; of the view selected by the user.  The current view to plot,
    ;; if set, if preceded by an '*'
    ;;
    ;; * Note: After previewing the plot, you will have to exit the
    ;; plot preview before the VBA example will stop and control will be returned
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get list of views available to plot
    (setq viewList (vlax-make-safearray vlax-vbObject (cons 0 (vla-get-Count (vla-get-Views doc))))
          cnt 0)

    (vlax-for view (vla-get-Views doc)
        (vlax-safearray-put-element viewList cnt view)
        (setq cnt (1+ cnt))
    )

    ;; Are there any named views to plot
    (if (> (vla-get-Count (vla-get-Views doc)) 0)
        (progn
            ;; Read and display the current plot style table path
            (setq iCount 0
                  msg "")
            (while (> (vla-get-Count (vla-get-Views doc)) iCount)
                (setq viewName (vla-get-Name (vlax-safearray-get-element ViewList iCount)))

                (if (= viewName (vla-get-ViewToPlot (vla-get-ActiveLayout doc)))  ;; Is this the current view to plot
                    (setq ViewNum (1+ iCount)
                          ViewName (strcat "*" ViewName))
                )

                (setq iCount (1+ iCount)
                      msg (strcat msg "(" (itoa iCount) ")   " viewName "\n"))
            )

            ;; Prompt user for the view to plot
            (setq viewNum (vla-GetInteger (vla-get-Utility doc) (strcat "\nWhich view would you like to plot?\n" msg)))

            (if (and (<= viewNum (vla-get-Count (vla-get-Views doc)))
                     (> viewNum 0))
                (progn
                    ;; Tell the drawing which view to plot
                    (vla-put-ViewToPlot (vla-get-ActiveLayout doc) (vla-get-Name (vlax-safearray-get-element ViewList (1- viewNum))))

                    ;; Make sure you tell the drawing to plot a view, not some other plot style
                    (vla-put-PlotType (vla-get-ActiveLayout doc) acView)
                    (vla-put-ConfigName (vla-get-ActiveLayout doc) "DWF6 ePlot.pc3")

                    ;; Send Plot To Window
                    (vla-DisplayPlotPreview (vla-get-Plot doc) acFullPreview)
                )
                (alert "The view number entered is not valid.")
            )
        )
        (alert "There are no named views to plot.")
    )
)


VisibilityEdge1 Property (ActiveX)

Specifies the visibility of a 3DFace edge 1.

Supported platforms: Windows only

Signature

VBA:

object.VisibilityEdge1
object

Type: 3DFace

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The edge is visible.
  • False: The edge is invisible.

Remarks

You can also use the GetInvisibleEdge and SetInvisibleEdge methods to query or set the visibility of an edge. Because these methods use an index to specify the edge, they are useful when iterating through all the edges of a face.

Examples

VBA:

Sub Example_VisibilityEdge1()
    ' This example creates a 3D Face in model space and allows the user to
    ' control the visibility of the edges

    Dim faceObj As Acad3DFace
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double, _
        point3(0 To 2) As Double, point4(0 To 2) As Double
    Dim Edge1Msg As String, Edge2Msg As String, _
        Edge3Msg As String, Edge4Msg As String

    ' Define the four coordinates of the face
    point1(0) = 0: point1(1) = 0: point1(2) = 0
    point2(0) = 5: point2(1) = 0: point2(2) = 1
    point3(0) = 1: point3(1) = 10: point3(2) = 0
    point4(0) = 5: point4(1) = 5: point4(2) = 1

    ' Create the 3DFace object in model space
    Set faceObj = ThisDrawing.ModelSpace.Add3DFace(point1, point2, point3, point4)
    ThisDrawing.Application.ZoomAll

    ' Display information about the visibility of the edges for this object
DisplayEdgeInformation:
    Edge1Msg = IIf(faceObj.VisibilityEdge1, "Edge1 of the new 3DFace is visible", "Edge1 of the new 3DFace is not visible")
    Edge2Msg = IIf(faceObj.VisibilityEdge2, "Edge2 of the new 3DFace is visible", "Edge2 of the new 3DFace is not visible")
    Edge3Msg = IIf(faceObj.VisibilityEdge3, "Edge3 of the new 3DFace is visible", "Edge3 of the new 3DFace is not visible")
    Edge4Msg = IIf(faceObj.VisibilityEdge4, "Edge4 of the new 3DFace is visible", "Edge4 of the new 3DFace is not visible")

    MsgBox Edge1Msg & vbCrLf & _
           Edge2Msg & vbCrLf & _
           Edge3Msg & vbCrLf & _
           Edge4Msg

    ' Allow user to toggle the visibility of one of the edges
    Select Case InputBox("Which edge of the 3DFace would you like to toggle the visibility of?", "Toggle Edge Visibility", 1)
        Case "1": faceObj.VisibilityEdge1 = Not (faceObj.VisibilityEdge1)
        Case "2": faceObj.VisibilityEdge2 = Not (faceObj.VisibilityEdge2)
        Case "3": faceObj.VisibilityEdge3 = Not (faceObj.VisibilityEdge3)
        Case "4": faceObj.VisibilityEdge4 = Not (faceObj.VisibilityEdge4)
        Case "":  Exit Sub
        Case Else: MsgBox "You must enter the number of an edge (1-4)", vbInformation
    End Select

    ' Refresh view
    ThisDrawing.Regen acAllViewports

    ' Return to display information about the edges
    GoTo DisplayEdgeInformation
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_VisibilityEdge1()
    ;; This example creates a 3D Face in model space and allows the user to
    ;; control the visibility of the edges
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the four coordinates of the face
    (setq point1 (vlax-3d-point 0 0 0)
          point2 (vlax-3d-point 5 0 1)
          point3 (vlax-3d-point 5 5 1)
          point4 (vlax-3d-point 1 10 0))

    ;; Create the 3DFace object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq faceObj (vla-Add3DFace modelSpace point1 point2 point3 point4))
    (vla-ZoomAll acadObj)

    ;; Display information about the visibility of the edges for this object
    (setq edge1Msg (if (= (vla-get-VisibilityEdge1 faceObj) :vlax-true) "Edge1 of the new 3DFace is visible" "Edge1 of the new 3DFace is not visible"))
    (setq edge2Msg (if (= (vla-get-VisibilityEdge2 faceObj) :vlax-true) "Edge2 of the new 3DFace is visible" "Edge2 of the new 3DFace is not visible"))
    (setq edge3Msg (if (= (vla-get-VisibilityEdge3 faceObj) :vlax-true) "Edge3 of the new 3DFace is visible" "Edge3 of the new 3DFace is not visible"))
    (setq edge4Msg (if (= (vla-get-VisibilityEdge4 faceObj) :vlax-true) "Edge4 of the new 3DFace is visible" "Edge4 of the new 3DFace is not visible"))

    (alert (strcat Edge1Msg
                   "\n" Edge2Msg
                   "\n" Edge3Msg
                   "\n" Edge4Msg))

    ;; Allow user to toggle the visibility of one of the edges
    (setq faceNum (vla-GetInteger (vla-get-Utility doc) "\nWhich edge of the 3DFace would you like to toggle the visibility of? (1 to 4)\n"))

    (cond
        ((= faceNum 1)(vla-put-VisibilityEdge1 faceObj (if (= (vla-get-VisibilityEdge1 faceObj) :vlax-true) :vlax-false :vlax-true)))
        ((= faceNum 2)(vla-put-VisibilityEdge2 faceObj (if (= (vla-get-VisibilityEdge2 faceObj) :vlax-true) :vlax-false :vlax-true)))
        ((= faceNum 3)(vla-put-VisibilityEdge3 faceObj (if (= (vla-get-VisibilityEdge3 faceObj) :vlax-true) :vlax-false :vlax-true)))
        ((= faceNum 4)(vla-put-VisibilityEdge4 faceObj (if (= (vla-get-VisibilityEdge4 faceObj) :vlax-true) :vlax-false :vlax-true)))
        (alert "You must enter the number of an edge (1-4)")
    )

    ;; Refresh view
    (vla-Regen doc acAllViewports)

    ;; Return to display information about the edges
    (setq edge1Msg (if (= (vla-get-VisibilityEdge1 faceObj) :vlax-true) "Edge1 of the new 3DFace is now visible" "Edge1 of the new 3DFace is now not visible"))
    (setq edge2Msg (if (= (vla-get-VisibilityEdge2 faceObj) :vlax-true) "Edge2 of the new 3DFace is now visible" "Edge2 of the new 3DFace is now not visible"))
    (setq edge3Msg (if (= (vla-get-VisibilityEdge3 faceObj) :vlax-true) "Edge3 of the new 3DFace is now visible" "Edge3 of the new 3DFace is now not visible"))
    (setq edge4Msg (if (= (vla-get-VisibilityEdge4 faceObj) :vlax-true) "Edge4 of the new 3DFace is now visible" "Edge4 of the new 3DFace is now not visible"))

    (alert (strcat Edge1Msg
                   "\n" Edge2Msg
                   "\n" Edge3Msg
                   "\n" Edge4Msg))
)


VisibilityEdge2 Property (ActiveX)

Specifies the visibility of a 3DFace edge 2.

Supported platforms: Windows only

Signature

VBA:

object.VisibilityEdge2
object

Type: 3DFace

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The edge is visible.
  • False: The edge is invisible.

Remarks

You can also use the GetInvisibleEdge and SetInvisibleEdge methods to query or set the visibility of an edge. Because these methods use an index to specify the edge, they are useful when iterating through all the edges of a face.

Examples

VBA:

Sub Example_VisibilityEdge2()
    ' This example creates a 3D Face in model space and allows the user to
    ' control the visibility of the edges

    Dim faceObj As Acad3DFace
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double, _
        point3(0 To 2) As Double, point4(0 To 2) As Double
    Dim Edge1Msg As String, Edge2Msg As String, _
        Edge3Msg As String, Edge4Msg As String

    ' Define the four coordinates of the face
    point1(0) = 0: point1(1) = 0: point1(2) = 0
    point2(0) = 5: point2(1) = 0: point2(2) = 1
    point3(0) = 1: point3(1) = 10: point3(2) = 0
    point4(0) = 5: point4(1) = 5: point4(2) = 1

    ' Create the 3DFace object in model space
    Set faceObj = ThisDrawing.ModelSpace.Add3DFace(point1, point2, point3, point4)
    ThisDrawing.Application.ZoomAll

    ' Display information about the visibility of the edges for this object
DisplayEdgeInformation:
    Edge1Msg = IIf(faceObj.VisibilityEdge1, "Edge1 of the new 3DFace is visible", "Edge1 of the new 3DFace is not visible")
    Edge2Msg = IIf(faceObj.VisibilityEdge2, "Edge2 of the new 3DFace is visible", "Edge2 of the new 3DFace is not visible")
    Edge3Msg = IIf(faceObj.VisibilityEdge3, "Edge3 of the new 3DFace is visible", "Edge3 of the new 3DFace is not visible")
    Edge4Msg = IIf(faceObj.VisibilityEdge4, "Edge4 of the new 3DFace is visible", "Edge4 of the new 3DFace is not visible")

    MsgBox Edge1Msg & vbCrLf & _
           Edge2Msg & vbCrLf & _
           Edge3Msg & vbCrLf & _
           Edge4Msg

    ' Allow user to toggle the visibility of one of the edges
    Select Case InputBox("Which edge of the 3DFace would you like to toggle the visibility of?", "Toggle Edge Visibility", 1)
        Case "1": faceObj.VisibilityEdge1 = Not (faceObj.VisibilityEdge1)
        Case "2": faceObj.VisibilityEdge2 = Not (faceObj.VisibilityEdge2)
        Case "3": faceObj.VisibilityEdge3 = Not (faceObj.VisibilityEdge3)
        Case "4": faceObj.VisibilityEdge4 = Not (faceObj.VisibilityEdge4)
        Case "":  Exit Sub
        Case Else: MsgBox "You must enter the number of an edge (1-4)", vbInformation
    End Select

    ' Refresh view
    ThisDrawing.Regen acAllViewports

    ' Return to display information about the edges
    GoTo DisplayEdgeInformation

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_VisibilityEdge2()
    ;; This example creates a 3D Face in model space and allows the user to
    ;; control the visibility of the edges
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the four coordinates of the face
    (setq point1 (vlax-3d-point 0 0 0)
          point2 (vlax-3d-point 5 0 1)
          point3 (vlax-3d-point 5 5 1)
          point4 (vlax-3d-point 1 10 0))

    ;; Create the 3DFace object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq faceObj (vla-Add3DFace modelSpace point1 point2 point3 point4))
    (vla-ZoomAll acadObj)

    ;; Display information about the visibility of the edges for this object
    (setq edge1Msg (if (= (vla-get-VisibilityEdge1 faceObj) :vlax-true) "Edge1 of the new 3DFace is visible" "Edge1 of the new 3DFace is not visible"))
    (setq edge2Msg (if (= (vla-get-VisibilityEdge2 faceObj) :vlax-true) "Edge2 of the new 3DFace is visible" "Edge2 of the new 3DFace is not visible"))
    (setq edge3Msg (if (= (vla-get-VisibilityEdge3 faceObj) :vlax-true) "Edge3 of the new 3DFace is visible" "Edge3 of the new 3DFace is not visible"))
    (setq edge4Msg (if (= (vla-get-VisibilityEdge4 faceObj) :vlax-true) "Edge4 of the new 3DFace is visible" "Edge4 of the new 3DFace is not visible"))

    (alert (strcat Edge1Msg
                   "\n" Edge2Msg
                   "\n" Edge3Msg
                   "\n" Edge4Msg))

    ;; Allow user to toggle the visibility of one of the edges
    (setq faceNum (vla-GetInteger (vla-get-Utility doc) "\nWhich edge of the 3DFace would you like to toggle the visibility of? (1 to 4)\n"))

    (cond
        ((= faceNum 1)(vla-put-VisibilityEdge1 faceObj (if (= (vla-get-VisibilityEdge1 faceObj) :vlax-true) :vlax-false :vlax-true)))
        ((= faceNum 2)(vla-put-VisibilityEdge2 faceObj (if (= (vla-get-VisibilityEdge2 faceObj) :vlax-true) :vlax-false :vlax-true)))
        ((= faceNum 3)(vla-put-VisibilityEdge3 faceObj (if (= (vla-get-VisibilityEdge3 faceObj) :vlax-true) :vlax-false :vlax-true)))
        ((= faceNum 4)(vla-put-VisibilityEdge4 faceObj (if (= (vla-get-VisibilityEdge4 faceObj) :vlax-true) :vlax-false :vlax-true)))
        (alert "You must enter the number of an edge (1-4)")
    )

    ;; Refresh view
    (vla-Regen doc acAllViewports)

    ;; Return to display information about the edges
    (setq edge1Msg (if (= (vla-get-VisibilityEdge1 faceObj) :vlax-true) "Edge1 of the new 3DFace is now visible" "Edge1 of the new 3DFace is now not visible"))
    (setq edge2Msg (if (= (vla-get-VisibilityEdge2 faceObj) :vlax-true) "Edge2 of the new 3DFace is now visible" "Edge2 of the new 3DFace is now not visible"))
    (setq edge3Msg (if (= (vla-get-VisibilityEdge3 faceObj) :vlax-true) "Edge3 of the new 3DFace is now visible" "Edge3 of the new 3DFace is now not visible"))
    (setq edge4Msg (if (= (vla-get-VisibilityEdge4 faceObj) :vlax-true) "Edge4 of the new 3DFace is now visible" "Edge4 of the new 3DFace is now not visible"))

    (alert (strcat Edge1Msg
                   "\n" Edge2Msg
                   "\n" Edge3Msg
                   "\n" Edge4Msg))
)


VisibilityEdge3 Property (ActiveX)

Specifies the visibility of a 3DFace edge 3.

Supported platforms: Windows only

Signature

VBA:

object.VisibilityEdge3
object

Type: 3DFace

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The edge is visible.
  • False: The edge is invisible.

Remarks

You can also use the GetInvisibleEdge and SetInvisibleEdge methods to query or set the visibility of an edge. Because these methods use an index to specify the edge, they are useful when iterating through all the edges of a face.

Examples

VBA:

Sub Example_VisibilityEdge3()
    ' This example creates a 3D Face in model space and allows the user to
    ' control the visibility of the edges

    Dim faceObj As Acad3DFace
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double, _
        point3(0 To 2) As Double, point4(0 To 2) As Double
    Dim Edge1Msg As String, Edge2Msg As String, _
        Edge3Msg As String, Edge4Msg As String

    ' Define the four coordinates of the face
    point1(0) = 0: point1(1) = 0: point1(2) = 0
    point2(0) = 5: point2(1) = 0: point2(2) = 1
    point3(0) = 1: point3(1) = 10: point3(2) = 0
    point4(0) = 5: point4(1) = 5: point4(2) = 1

    ' Create the 3DFace object in model space
    Set faceObj = ThisDrawing.ModelSpace.Add3DFace(point1, point2, point3, point4)
    ThisDrawing.Application.ZoomAll

    ' Display information about the visibility of the edges for this object
DisplayEdgeInformation:
    Edge1Msg = IIf(faceObj.VisibilityEdge1, "Edge1 of the new 3DFace is visible", "Edge1 of the new 3DFace is not visible")
    Edge2Msg = IIf(faceObj.VisibilityEdge2, "Edge2 of the new 3DFace is visible", "Edge2 of the new 3DFace is not visible")
    Edge3Msg = IIf(faceObj.VisibilityEdge3, "Edge3 of the new 3DFace is visible", "Edge3 of the new 3DFace is not visible")
    Edge4Msg = IIf(faceObj.VisibilityEdge4, "Edge4 of the new 3DFace is visible", "Edge4 of the new 3DFace is not visible")

    MsgBox Edge1Msg & vbCrLf & _
           Edge2Msg & vbCrLf & _
           Edge3Msg & vbCrLf & _
           Edge4Msg

    ' Allow user to toggle the visibility of one of the edges
    Select Case InputBox("Which edge of the 3DFace would you like to toggle the visibility of?", "Toggle Edge Visibility", 1)
        Case "1": faceObj.VisibilityEdge1 = Not (faceObj.VisibilityEdge1)
        Case "2": faceObj.VisibilityEdge2 = Not (faceObj.VisibilityEdge2)
        Case "3": faceObj.VisibilityEdge3 = Not (faceObj.VisibilityEdge3)
        Case "4": faceObj.VisibilityEdge4 = Not (faceObj.VisibilityEdge4)
        Case "":  Exit Sub
        Case Else: MsgBox "You must enter the number of an edge (1-4)", vbInformation
    End Select

    ' Refresh view
    ThisDrawing.Regen acAllViewports

    ' Return to display information about the edges
    GoTo DisplayEdgeInformation

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_VisibilityEdge3()
    ;; This example creates a 3D Face in model space and allows the user to
    ;; control the visibility of the edges
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the four coordinates of the face
    (setq point1 (vlax-3d-point 0 0 0)
          point2 (vlax-3d-point 5 0 1)
          point3 (vlax-3d-point 5 5 1)
          point4 (vlax-3d-point 1 10 0))

    ;; Create the 3DFace object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq faceObj (vla-Add3DFace modelSpace point1 point2 point3 point4))
    (vla-ZoomAll acadObj)

    ;; Display information about the visibility of the edges for this object
    (setq edge1Msg (if (= (vla-get-VisibilityEdge1 faceObj) :vlax-true) "Edge1 of the new 3DFace is visible" "Edge1 of the new 3DFace is not visible"))
    (setq edge2Msg (if (= (vla-get-VisibilityEdge2 faceObj) :vlax-true) "Edge2 of the new 3DFace is visible" "Edge2 of the new 3DFace is not visible"))
    (setq edge3Msg (if (= (vla-get-VisibilityEdge3 faceObj) :vlax-true) "Edge3 of the new 3DFace is visible" "Edge3 of the new 3DFace is not visible"))
    (setq edge4Msg (if (= (vla-get-VisibilityEdge4 faceObj) :vlax-true) "Edge4 of the new 3DFace is visible" "Edge4 of the new 3DFace is not visible"))

    (alert (strcat Edge1Msg
                   "\n" Edge2Msg
                   "\n" Edge3Msg
                   "\n" Edge4Msg))

    ;; Allow user to toggle the visibility of one of the edges
    (setq faceNum (vla-GetInteger (vla-get-Utility doc) "\nWhich edge of the 3DFace would you like to toggle the visibility of? (1 to 4)\n"))

    (cond
        ((= faceNum 1)(vla-put-VisibilityEdge1 faceObj (if (= (vla-get-VisibilityEdge1 faceObj) :vlax-true) :vlax-false :vlax-true)))
        ((= faceNum 2)(vla-put-VisibilityEdge2 faceObj (if (= (vla-get-VisibilityEdge2 faceObj) :vlax-true) :vlax-false :vlax-true)))
        ((= faceNum 3)(vla-put-VisibilityEdge3 faceObj (if (= (vla-get-VisibilityEdge3 faceObj) :vlax-true) :vlax-false :vlax-true)))
        ((= faceNum 4)(vla-put-VisibilityEdge4 faceObj (if (= (vla-get-VisibilityEdge4 faceObj) :vlax-true) :vlax-false :vlax-true)))
        (alert "You must enter the number of an edge (1-4)")
    )

    ;; Refresh view
    (vla-Regen doc acAllViewports)

    ;; Return to display information about the edges
    (setq edge1Msg (if (= (vla-get-VisibilityEdge1 faceObj) :vlax-true) "Edge1 of the new 3DFace is now visible" "Edge1 of the new 3DFace is now not visible"))
    (setq edge2Msg (if (= (vla-get-VisibilityEdge2 faceObj) :vlax-true) "Edge2 of the new 3DFace is now visible" "Edge2 of the new 3DFace is now not visible"))
    (setq edge3Msg (if (= (vla-get-VisibilityEdge3 faceObj) :vlax-true) "Edge3 of the new 3DFace is now visible" "Edge3 of the new 3DFace is now not visible"))
    (setq edge4Msg (if (= (vla-get-VisibilityEdge4 faceObj) :vlax-true) "Edge4 of the new 3DFace is now visible" "Edge4 of the new 3DFace is now not visible"))

    (alert (strcat Edge1Msg
                   "\n" Edge2Msg
                   "\n" Edge3Msg
                   "\n" Edge4Msg))
)


VisibilityEdge4 Property (ActiveX)

Specifies the visibility of a 3DFace edge 4.

Supported platforms: Windows only

Signature

VBA:

object.VisibilityEdge4
object

Type: 3DFace

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: The edge is visible.
  • False: The edge is invisible.

Remarks

You can also use the GetInvisibleEdge and SetInvisibleEdge methods to query or set the visibility of an edge. Because these methods use an index to specify the edge, they are useful when iterating through all the edges of a face.

Examples

VBA:

Sub Example_VisibilityEdge4()
    ' This example creates a 3D Face in model space and allows the user to
    ' control the visibility of the edges

    Dim faceObj As Acad3DFace
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double, _
        point3(0 To 2) As Double, point4(0 To 2) As Double
    Dim Edge1Msg As String, Edge2Msg As String, _
        Edge3Msg As String, Edge4Msg As String

    ' Define the four coordinates of the face
    point1(0) = 0: point1(1) = 0: point1(2) = 0
    point2(0) = 5: point2(1) = 0: point2(2) = 1
    point3(0) = 1: point3(1) = 10: point3(2) = 0
    point4(0) = 5: point4(1) = 5: point4(2) = 1

    ' Create the 3DFace object in model space
    Set faceObj = ThisDrawing.ModelSpace.Add3DFace(point1, point2, point3, point4)
    ThisDrawing.Application.ZoomAll

    ' Display information about the visibility of the edges for this object
DisplayEdgeInformation:
    Edge1Msg = IIf(faceObj.VisibilityEdge1, "Edge1 of the new 3DFace is visible", "Edge1 of the new 3DFace is not visible")
    Edge2Msg = IIf(faceObj.VisibilityEdge2, "Edge2 of the new 3DFace is visible", "Edge2 of the new 3DFace is not visible")
    Edge3Msg = IIf(faceObj.VisibilityEdge3, "Edge3 of the new 3DFace is visible", "Edge3 of the new 3DFace is not visible")
    Edge4Msg = IIf(faceObj.VisibilityEdge4, "Edge4 of the new 3DFace is visible", "Edge4 of the new 3DFace is not visible")

    MsgBox Edge1Msg & vbCrLf & _
           Edge2Msg & vbCrLf & _
           Edge3Msg & vbCrLf & _
           Edge4Msg

    ' Allow user to toggle the visibility of one of the edges
    Select Case InputBox("Which edge of the 3DFace would you like to toggle the visibility of?", "Toggle Edge Visibility", 1)
        Case "1": faceObj.VisibilityEdge1 = Not (faceObj.VisibilityEdge1)
        Case "2": faceObj.VisibilityEdge2 = Not (faceObj.VisibilityEdge2)
        Case "3": faceObj.VisibilityEdge3 = Not (faceObj.VisibilityEdge3)
        Case "4": faceObj.VisibilityEdge4 = Not (faceObj.VisibilityEdge4)
        Case "":  Exit Sub
        Case Else: MsgBox "You must enter the number of an edge (1-4)", vbInformation
    End Select

    ' Refresh view
    ThisDrawing.Regen acAllViewports

    ' Return to display information about the edges
    GoTo DisplayEdgeInformation

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_VisibilityEdge4()
    ;; This example creates a 3D Face in model space and allows the user to
    ;; control the visibility of the edges
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the four coordinates of the face
    (setq point1 (vlax-3d-point 0 0 0)
          point2 (vlax-3d-point 5 0 1)
          point3 (vlax-3d-point 5 5 1)
          point4 (vlax-3d-point 1 10 0))

    ;; Create the 3DFace object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq faceObj (vla-Add3DFace modelSpace point1 point2 point3 point4))
    (vla-ZoomAll acadObj)

    ;; Display information about the visibility of the edges for this object
    (setq edge1Msg (if (= (vla-get-VisibilityEdge1 faceObj) :vlax-true) "Edge1 of the new 3DFace is visible" "Edge1 of the new 3DFace is not visible"))
    (setq edge2Msg (if (= (vla-get-VisibilityEdge2 faceObj) :vlax-true) "Edge2 of the new 3DFace is visible" "Edge2 of the new 3DFace is not visible"))
    (setq edge3Msg (if (= (vla-get-VisibilityEdge3 faceObj) :vlax-true) "Edge3 of the new 3DFace is visible" "Edge3 of the new 3DFace is not visible"))
    (setq edge4Msg (if (= (vla-get-VisibilityEdge4 faceObj) :vlax-true) "Edge4 of the new 3DFace is visible" "Edge4 of the new 3DFace is not visible"))

    (alert (strcat Edge1Msg
                   "\n" Edge2Msg
                   "\n" Edge3Msg
                   "\n" Edge4Msg))

    ;; Allow user to toggle the visibility of one of the edges
    (setq faceNum (vla-GetInteger (vla-get-Utility doc) "\nWhich edge of the 3DFace would you like to toggle the visibility of? (1 to 4)\n"))

    (cond
        ((= faceNum 1)(vla-put-VisibilityEdge1 faceObj (if (= (vla-get-VisibilityEdge1 faceObj) :vlax-true) :vlax-false :vlax-true)))
        ((= faceNum 2)(vla-put-VisibilityEdge2 faceObj (if (= (vla-get-VisibilityEdge2 faceObj) :vlax-true) :vlax-false :vlax-true)))
        ((= faceNum 3)(vla-put-VisibilityEdge3 faceObj (if (= (vla-get-VisibilityEdge3 faceObj) :vlax-true) :vlax-false :vlax-true)))
        ((= faceNum 4)(vla-put-VisibilityEdge4 faceObj (if (= (vla-get-VisibilityEdge4 faceObj) :vlax-true) :vlax-false :vlax-true)))
        (alert "You must enter the number of an edge (1-4)")
    )

    ;; Refresh view
    (vla-Regen doc acAllViewports)

    ;; Return to display information about the edges
    (setq edge1Msg (if (= (vla-get-VisibilityEdge1 faceObj) :vlax-true) "Edge1 of the new 3DFace is now visible" "Edge1 of the new 3DFace is now not visible"))
    (setq edge2Msg (if (= (vla-get-VisibilityEdge2 faceObj) :vlax-true) "Edge2 of the new 3DFace is now visible" "Edge2 of the new 3DFace is now not visible"))
    (setq edge3Msg (if (= (vla-get-VisibilityEdge3 faceObj) :vlax-true) "Edge3 of the new 3DFace is now visible" "Edge3 of the new 3DFace is now not visible"))
    (setq edge4Msg (if (= (vla-get-VisibilityEdge4 faceObj) :vlax-true) "Edge4 of the new 3DFace is now visible" "Edge4 of the new 3DFace is now not visible"))

    (alert (strcat Edge1Msg
                   "\n" Edge2Msg
                   "\n" Edge3Msg
                   "\n" Edge4Msg))
)


Visible Property (ActiveX)

Specifies the visibility of an object or the application.

Supported platforms: Windows only

Signature

VBA:

object.Visible
object

Type: All drawing objects, Application, AttributeReference, Group, Toolbar

The objects this property applies to

Property Value

Read-only: No (except for a Group object which is write-only)

Type: Boolean

  • True: The object or application is visible.
  • False: The object or application is not visible.

Remarks

If you specify an object to be invisible, it will be invisible regardless of the application visible setting. Other factors can also cause an object to be invisible; for example, an object will not be displayed if its layer is off or frozen.

Specifying the application to be invisible allows you to run tasks in the background without having to see the component.

Examples

VBA:

Sub Example_Visible()
    ' This example creates a line in model space.
    ' It then turns visibility of the line on or off, depending
    ' on the user's choice.

    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    ' Create the line
    startPoint(0) = 2#: startPoint(1) = 2#: startPoint(2) = 0#
    endPoint(0) = 4#: endPoint(1) = 4#: endPoint(2) = 0#
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)
    ZoomAll

    Dim response As Integer
    response = MsgBox("Do you want the new line to be visible?", vbYesNoCancel + vbQuestion)
    Select Case response
    Case vbYes
        lineObj.Visible = True
    Case vbNo
        lineObj.Visible = False
    Case vbCancel
        Exit Sub
    End Select

    ThisDrawing.Regen True
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Visible()
    ;; This example creates a line in model space.
    ;; It then turns visibility of the line on or off, depending
    ;; on the user's choice.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the line
    (setq startPoint (vlax-3d-point 2 2 0)
          endPoint (vlax-3d-point 4 4 0))

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))
    (vla-ZoomAll acadObj)

    (setq kwordList "Yes No")
    (vla-InitializeUserInput (vla-get-Utility doc) 1 kwordList)
    (setq response (vla-GetKeyword (vla-get-Utility doc) "Do you want the new line to be visible? [Yes/No]: "))

    (cond
        ((= response "Yes") (vla-put-Visible lineObj :vlax-true))
        ((= response "No") (vla-put-Visible lineObj :vlax-false))
    )

    (vla-Regen doc :vlax-true)
)


VIsolineDensity Property (ActiveX)

Specifies the number of V isolines that are displayed.

Supported platforms: Windows only

Signature

VBA:

object.VIsolineDensity
object

Type: ExtrudedSurface, LoftedSurface, NurbSurface, PlaneSurface, RevolvedSurface, Surface, SweptSurface

The object to which this property applies.

Property Value

Read-only: No

Type: Long

Number of isolines that the object displays in the V direction.

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


VisualStyle Property (ActiveX)

Specifies the visual style for a viewport.

Supported platforms: Windows only

Signature

VBA:

object.VisualStyle
object

Type: PViewport

The object this property applies to.

Property Value

Read-only: No

Type: Long

ID of the visual style that should be assigned to the paper space viewport.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Volume Property (ActiveX)

Gets the volume of the solid.

Supported platforms: Windows only

Signature

VBA:

object.Volume
object

Type: 3DSolid

The object this property applies to.

Property Value

Read-only: Yes

Type: Double

The volume of the solid.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Volume()
    ' This example creates a box in model space.
    ' It then returns the Volume for that box.

    Dim boxObj As Acad3DSolid
    Dim length As Double, width As Double, height As Double
    Dim center(0 To 2) As Double

    ' Define the box
    center(0) = 5#: center(1) = 5#: center(2) = 0
    length = 5#: width = 7: height = 10#

    ' Create the box (3DSolid) object in model space
    Set boxObj = ThisDrawing.ModelSpace.AddBox(center, length, width, height)

    ' Change the viewing direction of the viewport to better see the box
    Dim NewDirection(0 To 2) As Double
    NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
    ThisDrawing.ActiveViewport.direction = NewDirection
    ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
    ZoomAll

    ' Return the Volume for the box
    Dim Volume As Double
    Volume = boxObj.Volume
    MsgBox "The Volume for the box is " & Volume, , "Volume Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Volume()
    ;; This example creates a box in model space.
    ;; It then returns the Volume for that box.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the box
    (setq center (vlax-3d-point 5 5 0)
          boxLength 5
      boxWidth 7
      boxHeight 10)

    ;; Create the box (3DSolid) object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq boxObj (vla-AddBox modelSpace center boxLength boxWidth boxHeight))

    ;; Change the viewing direction of the viewport to better see the box
    (setq NewDirection (vlax-3d-point -1 -1 1))
    (setq activeViewport (vla-get-ActiveViewport doc))
    (vla-put-Direction activeViewport NewDirection)
    (vla-put-ActiveViewport doc activeViewport)
    (vla-ZoomAll acadObj)

    ;; Return the Volume for the box
    (setq volume (vla-get-Volume boxObj))
    (alert (strcat "The Volume for the box is " (rtos volume 2)))
)


Weights Property (ActiveX)

Gets the weight vector for spline.

Supported platforms: Windows only

Signature

VBA:

object.Weights
object

Type: Spline

The object this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

The weight vector of the spline.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Weights()
    ' This example creates a Spline object in model space and
    ' returns the weight vector for the new Spline

    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double, endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double
    Dim weightVector As Variant

    ' Define the Spline object
    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 0: fitPoints(1) = 0: fitPoints(2) = 0
    fitPoints(3) = 5:    fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0

    ' Create new Spline object
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)

    ' Add weights to the Spline
    splineObj.SetWeight 0, 1.5
    splineObj.SetWeight 1, 2
    splineObj.SetWeight 2, 4.5

    ThisDrawing.Application.ZoomAll

    ' Display the weight vector of the new Spline
    weightVector = splineObj.Weights
    MsgBox "The weight vector of the new Spline is: " & vbCrLf & _
           weightVector(0) & vbCrLf & _
           weightVector(1) & vbCrLf & _
           weightVector(2)
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Weights()
    ;; This example creates a Spline object in model space and
    ;; returns the weight vector for the new Spline
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Spline object
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
         fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(0 0 0
                     5 5 0
                     10 0 0
                    )
    )

    ;; Create new Spline object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)

    ;; Add weights to the Spline
    (vla-SetWeight splineObj 0 1.5)
    (vla-SetWeight splineObj 1 2)
    (vla-SetWeight splineObj 2 4.5)

    (vla-ZoomAll acadObj)

    ;; Display the weight vector of the new Spline
    (setq weightVector (vlax-variant-value (vla-get-Weights splineObj)))
    (alert (strcat "The weight vector of the new Spline is: "
                   "\n" (rtos (vlax-safearray-get-element weightVector 0) 2)
                   "\n" (rtos (vlax-safearray-get-element weightVector 1) 2)
                   "\n" (rtos (vlax-safearray-get-element weightVector 2) 2)))
)


Width Property (ActiveX)

Specifies the width of the object.

Supported platforms: Windows only

Signature

VBA:

object.Width
object

Type: Application, DgnUnderlay, Document, DwfUnderlay, GeomapImage, MText, OLE, PdfUnderlay, PointCloud, PViewport, RasterImage, Table, TextStyle, Toolbar, View, Viewport, Wipeout

The objects this property applies to.

Property Value

Read-only: No (except for the GeomapImage, RasterImage and Toolbar objects which are read-only)

Type: Double

The width of the given object. This value must be a positive, non-negative number.

Remarks

MText: Specifies the width of the text boundary in the current units. AutoCAD wraps the text within the text boundary, therefore the width must be a positive number large enough to accommodate the text. If the width is not large enough, the text may be difficult to read or may not be visible at all.

OLE: The width of an OLE object is the X axis measurement of the frame.

Table: The width of a table is the X axis measurement of the table.

TextStyle: Sets the character spacing. Entering a value of less than 1.0 condenses the text. Entering a value of greater than 1.0 expands it. The maximum value is 100.

Viewport: The width of a viewport is the X axis measurement of the viewport frame.

View: The width of a view is the X axis measurement of the area within a viewport that is used to display the model.

Raster: The width of the raster image in pixels.

Examples

VBA:

Sub Example_Width()
    ' This example creates an MText object in model space.
    ' It then changes the width of the MText object.

    Dim MTextObj As AcadMText
    Dim corner(0 To 2) As Double
    Dim width As Double
    Dim text As String
    corner(0) = 0: corner(1) = 5: corner(2) = 0
    width = 10
    text = "This is the text String for the mtext Object"

    ' Creates the mtext Object
    Set MTextObj = ThisDrawing.ModelSpace.AddMText(corner, width, text)
    ZoomAll

    ' Find the current width of the mtext object
    width = MTextObj.width
    MsgBox "The current width of the mtext object is " & MTextObj.width, , "Width Example"

    ' Change the width of the mtext object
    MTextObj.width = width / 2
    MTextObj.Update
    MsgBox "The new width of the mtext object is " & MTextObj.width, , "Width Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Width()
    ;; This example creates an MText object in model space.
    ;; It then changes the width of the MText object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq corner (vlax-3d-point 0 5 0)
          width 10
          text "This is the text String for the mtext Object")

    ;; Creates the mtext Object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MTextObj (vla-AddMText modelSpace corner width text))
    (vla-ZoomAll acadObj)

    ;; Find the current width of the mtext object
    (setq width (vla-get-width MTextObj))
    (alert (strcat "The current width of the mtext object is " (rtos width 2)))

    ;; Change the width of the mtext object
    (vla-put-width MTextObj (/ width 2))
    (vla-Update MTextObj)
    (alert (strcat "The new width of the mtext object is " (rtos (vla-get-width MTextObj) 2)))
)


WindowLeft Property (ActiveX)

Specifies the left edge of the application window.

Supported platforms: Windows only

Signature

VBA:

object.WindowLeft
object

Type: Application

The object this property applies to.

Property Value

Read-only: No

Type: Integer

The left edge of the application window.

Remarks

The left edge of the application is represented by the distance between the left edge of the main application window and the left edge of the screen.

This distance will establish the X coordinate of the upper-left corner of the application. Note that the origin (0, 0) is the top, left corner.

Examples

VBA:

Sub Example_WindowLeft()
    ' This example finds the WindowLeft (X coordinate) of the top of the
    ' AutoCAD window. It then changes that position to be 100 more
    ' than it currently is. Finally, it resets the window to the
    ' original value.

    ' Find the current value of the WindowLeft property
    Dim currWindowLeft As Integer
    currWindowLeft = ThisDrawing.Application.WindowLeft
    MsgBox "The current value of WindowLeft is " & ThisDrawing.Application.WindowLeft, , "WindowLeft Example"

    ' Change the value of WindowLeft
    ThisDrawing.Application.WindowLeft = currWindowLeft + 100
    MsgBox "The new value of WindowLeft is " & ThisDrawing.Application.WindowLeft, , "WindowLeft Example"

    ' Reset the value of WindowLeft
    ThisDrawing.Application.WindowLeft = currWindowLeft
    MsgBox "The value of WindowLeft has been reset to " & ThisDrawing.Application.WindowLeft, , "WindowLeft Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_WindowLeft()
    ;; This example finds the WindowLeft (X coordinate) of the top of the
    ;; AutoCAD window. It then changes that position to be 100 more
    ;; than it currently is. Finally, it resets the window to the
    ;; original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Find the current value of the WindowLeft property
    (setq currWindowLeft (vla-get-WindowLeft acadObj))
    (alert (strcat "The current value of WindowLeft is " (itoa currWindowLeft)))

    ;; Change the value of WindowLeft
    (vla-put-WindowLeft acadObj (+ currWindowLeft 100))
    (alert (strcat "The new value of WindowLeft is " (itoa (vla-get-WindowLeft acadObj))))

    ;; Reset the value of WindowLeft
    (vla-put-WindowLeft acadObj currWindowLeft)
    (alert (strcat "The value of WindowLeft has been reset to " (itoa (vla-get-WindowLeft acadObj))))
)


WindowState Property (ActiveX)

Specifies the state of the application or document window.

Supported platforms: Windows only

Signature

VBA:

object.WindowState
object

Type: Application, Document

The object this property applies to.

Property Value

Read-only: No

Type: acWindowState enum

  • acMin: The window is minimized.
  • acMax: The window is maximized.
  • acNorm: The window is normal (neither minimized nor maximized).

Remarks

No additional remarks.

Examples

VBA:

Sub Example_WindowState()
    ' This example reads and displays the current window state of the AutoCAD application.

    Dim CurrentState As String

    ' Use the "WindowState" variable to determine the window state of AutoCAD
    Select Case WindowState
        Case acMin: CurrentState = "Minimized"
        Case acMax: CurrentState = "Maximized"
        Case acNorm: CurrentState = "Normal Size"
    End Select

    ' Display window state
    MsgBox "AutoCAD is now: " & CurrentState
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_WindowState()
    ;; This example reads and displays the current window state of the AutoCAD application.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Use the "WindowState" variable to determine the window state of AutoCAD
    (setq CurrentState (cond
                           ((= (vla-get-WindowState acadObj) acMin) "Minimized")
                           ((= (vla-get-WindowState acadObj) acMax) "Maximized")
                           ((= (vla-get-WindowState acadObj) acNorm) "Normal Size")
                       ))

    ;; Display window state
    (alert (strcat "AutoCAD is now: " CurrentState))
)


WindowTitle Property (ActiveX)

Gets the title of the document window.

Supported platforms: Windows only

Signature

VBA:

object.WindowTitle
object

Type: Document

The object this property applies to.

Property Value

Read-only: Yes

Type: String

The window title of the document.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_WindowTitle()
    ' This example cycles through the documents collection
    ' and uses the WindowTitle property to create a list of all open documents.

    Dim DOC As AcadDocument
    Dim msg As String

    ' If there are no open documents, then exit
    If Documents.count = 0 Then
        MsgBox "There are no open documents!"
        Exit Sub
    End If

    msg = vbCrLf    ' Start with a space

    ' Cycle through all open drawings and get the window title of each drawing
    For Each DOC In Documents
        msg = msg & DOC.WindowTitle
    Next

    ' Display a list of open drawings
    MsgBox "The open drawing titles are: " & msg
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_WindowTitle()
    ;; This example cycles through the documents collection
    ;; and uses the WindowTitle property to create a list of all open documents.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; If there are no open documents, then exit
    (if (> (vla-get-Count (vla-get-Documents acadObj)) 0)
        (progn
            (setq msg "")

            ;; Cycle through all open drawings and get the window title of each drawing
            (vlax-for DOC (vla-get-Documents acadObj)
                (setq msg (strcat msg "\n" (vla-get-WindowTitle DOC)))
            )

            ;; Display a list of open drawings
            (alert (strcat "The open drawing titles are: " msg))
        )
        (alert "There are no open documents!")
    )
)


WindowTop Property (ActiveX)

Specifies the top edge of the application window.

Supported platforms: Windows only

Signature

VBA:

object.WindowTop
object

Type: Application

The object this property applies to.

Property Value

Read-only: No

Type: Integer

The top edge of the application window.

Remarks

The top edge of the application is determined by the distance from the top edge of the main application window to the top edge of the screen.

This distance will establish the Y coordinate of the upper-left corner of the application. Note that the origin (0, 0) is the top, left corner.

Examples

VBA:

Sub Example_WindowTop()
    ' This example finds the WindowTop (X coordinate) of the WindowTop of the
    ' AutoCAD window. It then changes that position to be 100 more
    ' than it currently is. Finally, it resets the window to the
    ' original value.

    ' Find the current value of the WindowTop property
    Dim currWindowTop As Integer
    currWindowTop = ThisDrawing.Application.WindowTop
    MsgBox "The current value of WindowTop is " & ThisDrawing.Application.WindowTop, , "WindowTop Example"

    ' Change the value of WindowTop
    ThisDrawing.Application.WindowTop = currWindowTop + 100
    MsgBox "The new value of WindowTop is " & ThisDrawing.Application.WindowTop, , "WindowTop Example"

    ' Reset the value of WindowTop
    ThisDrawing.Application.WindowTop = currWindowTop
    MsgBox "The value of WindowTop has been reset to " & ThisDrawing.Application.WindowTop, , "WindowTop Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_WindowTop()
    ;; This example finds the WindowTop (X coordinate) of the WindowTop of the
    ;; AutoCAD window. It then changes that position to be 100 more
    ;; than it currently is. Finally, it resets the window to the
    ;; original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Find the current value of the WindowTop property
    (setq currWindowTop (vla-get-WindowTop acadObj))
    (alert (strcat "The current value of WindowTop is " (itoa currWindowTop)))

    ;; Change the value of WindowTop
    (vla-put-WindowTop acadObj (+ currWindowTop 100))
    (alert (strcat "The new value of WindowTop is " (itoa (vla-get-WindowTop acadObj))))

    ;; Reset the value of WindowTop
    (vla-put-WindowTop acadObj currWindowTop)
    (alert (strcat "The value of WindowTop has been reset to " (itoa (vla-get-WindowTop acadObj))))
)


WireframeType Property (ActiveX)

Specifies the wireframe display type of the surface.

Supported platforms: Windows only

Signature

VBA:

object.WireframeType
object

Type: ExtrudedSurface, LoftedSurface, NurbSurface, PlaneSurface, RevolvedSurface, Surface, SweptSurface

The object this property applies to.

Property Value

Read-only: No

Type: acWireframeType enum

  • acIsolines: Contour lines displayed on the curved surfaces of 3D solids and surfaces
  • acIsoparms: Lines drawn along the U and V directions of the surface, reflecting the shape of the surface defined by its control vertices (CVs)

Remarks

No additional remarks.

Examples

VBA:

Sub SurfaceProperties()
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SURFACES2")
    Dim mode As Integer

    AppActivate ThisDrawing.Application.Caption

    ssetObj.SelectOnScreen

    Dim obj As AcadEntity
    Dim extrude As AcadExtrudedSurface
    Dim objName As String
    Dim LayerName As String
    For Each obj In ssetObj
        objName = obj.ObjectName
        If TypeOf obj Is AcadExtrudedSurface Then
            ExtrudedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadRevolvedSurface Then
            RevolvedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadLoftedSurface Then
            LoftedSurfaceProperties obj
        ElseIf TypeOf obj Is AcadSweptSurface Then
            SweptSurfaceProperties obj
        ElseIf TypeOf obj Is AcadPlaneSurface Then
            PlaneSurfaceProperties obj
        End If
    Next

    ssetObj.Delete
End Sub

Private Sub ExtrudedSurfaceProperties(extrude As AcadExtrudedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox extrude
    MsgBox "SurfaceType: " & extrude.SurfaceType & vbCr & _
           "Height: " & extrude.height & vbCr & _
           "TaperAngle: " & extrude.TaperAngle & vbCr & _
           "Direction: " & extrude.Direction & vbCr & _
           "Material: " & extrude.Material & vbCr & _
           "UIsolineDensity: " & extrude.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & extrude.VIsolineDensity

    'Now change the configurable properties
    extrude.height = extrude.height * 1.5
    extrude.TaperAngle = extrude.TaperAngle * (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity * 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity * 0.5
    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    extrude.height = extrude.height / 1.5
    extrude.TaperAngle = extrude.TaperAngle / (3.14 / 2)
    extrude.UIsolineDensity = extrude.UIsolineDensity / 2#
    extrude.VIsolineDensity = extrude.VIsolineDensity / 0.5
End Sub

Private Sub RevolvedSurfaceProperties(revolve As AcadRevolvedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox revolve
    MsgBox "SurfaceType: " & revolve.SurfaceType & vbCr & _
           "RevolutionAngle: " & revolve.RevolutionAngle & vbCr & _
           "AxisPosition: " & revolve.AxisPosition & vbCr & _
           "AxisDirection: " & revolve.AxisDirection & vbCr & _
           "Material: " & revolve.Material & vbCr & _
           "UIsolineDensity: " & revolve.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & revolve.VIsolineDensity

    'Now change the configurable properties
    revolve.RevolutionAngle = revolve.RevolutionAngle * (3.14 / 2)

    revolve.UIsolineDensity = revolve.UIsolineDensity * 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    revolve.RevolutionAngle = revolve.RevolutionAngle / (3.14 / 2)
    revolve.UIsolineDensity = revolve.UIsolineDensity / 2#
    revolve.VIsolineDensity = revolve.VIsolineDensity / 0.5
End Sub

Private Sub LoftedSurfaceProperties(lofted As AcadLoftedSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox lofted
    MsgBox "SurfaceType: " & lofted.SurfaceType & vbCr & _
           "NumCrossSections: " & lofted.NumCrossSections & vbCr & _
           "NumGuidePaths: " & lofted.NumGuidePaths & vbCr & _
           "SurfaceNormals: " & lofted.SurfaceNormals & vbCr & _
           "StartDraftAngle: " & lofted.StartDraftAngle & vbCr & _
           "StartDraftMagnitude: " & lofted.StartDraftMagnitude & vbCr & _
           "EndDraftAngle: " & lofted.EndDraftAngle & vbCr & _
           "EndDraftMagnitude: " & lofted.EndDraftMagnitude & vbCr & _
           "Closed: " & lofted.Closed & vbCr & _
           "Material: " & lofted.Material & vbCr & _
           "UIsolineDensity: " & lofted.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & lofted.VIsolineDensity

    'Now change the configurable properties
    lofted.StartDraftAngle = lofted.StartDraftAngle * (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle * (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity * 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    lofted.StartDraftAngle = lofted.StartDraftAngle / (3.14 / 2)
    lofted.EndDraftAngle = lofted.EndDraftAngle / (3.14 / 4)
    lofted.UIsolineDensity = lofted.UIsolineDensity / 2#
    lofted.VIsolineDensity = lofted.VIsolineDensity / 0.5
End Sub

Private Sub SweptSurfaceProperties(swept As AcadSweptSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox swept
    MsgBox "SurfaceType: " & swept.SurfaceType & vbCr & _
           "ProfileRotation: " & swept.ProfileRotation & vbCr & _
           "Bank: " & swept.Bank & vbCr & _
           "Twist: " & swept.Twist & vbCr & _
           "scale: " & swept.scale & vbCr & _
           "Length: " & swept.length & vbCr & _
           "Material: " & swept.Material & vbCr & _
           "UIsolineDensity: " & swept.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & swept.VIsolineDensity

    swept.ProfileRotation = swept.ProfileRotation * 3.14 * 0.25
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist * 3.14 * -0.5
    swept.UIsolineDensity = swept.UIsolineDensity * 2#
    swept.VIsolineDensity = swept.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    swept.ProfileRotation = swept.ProfileRotation / (3.14 * 0.25)
    swept.Bank = Not swept.Bank
    swept.Twist = swept.Twist / (3.14 * -0.5)
    swept.UIsolineDensity = swept.UIsolineDensity / 2#
    swept.VIsolineDensity = swept.VIsolineDensity / 0.5
End Sub

Private Sub PlaneSurfaceProperties(planar As AcadPlaneSurface)
    AppActivate ThisDrawing.Application.Caption

    GetSurfaceBoundingBox planar
    MsgBox "SurfaceType: " & planar.SurfaceType & vbCr & _
           "UIsolineDensity: " & planar.UIsolineDensity & vbCr & _
           "VIsolineDensity: " & planar.VIsolineDensity

    planar.UIsolineDensity = planar.UIsolineDensity * 2#
    planar.VIsolineDensity = planar.VIsolineDensity * 0.5

    ThisDrawing.Regen acActiveViewport
    Utility.GetString 0, "Press return to continue..."

    'Now change the properties back to their original values
    planar.UIsolineDensity = planar.UIsolineDensity / 2#
    planar.VIsolineDensity = planar.VIsolineDensity / 0.5
End Sub

Private Sub GetSurfaceBoundingBox(surf As AcadSurface)
    Dim MinPoint As Variant
    Dim MaxPoint As Variant

    surf.GetBoundingBox MinPoint, MaxPoint

    ' Print the min and max extents
    MsgBox "The extents of the bounding box for the surface are:" & vbCrLf _
           & "Min Point: " & MinPoint(0) & "," & MinPoint(1) & "," & MinPoint(2) _
           & vbCrLf & "Max Point: " & MaxPoint(0) & "," & MaxPoint(1) & "," & MaxPoint(2), vbInformation, "GetBoundingBox of Surface"
End Sub

Visual LISP:

(vl-load-com)
(defun c:SurfaceProperties()
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SURFACES2"))

    (vla-SelectOnScreen ssetObj)

    (vlax-for obj ssetObj
        (setq objName (vla-get-ObjectName obj))

        (cond
          ((= "AcDb3dSolid" objName)
            (cond
                ((= (vla-get-SolidType obj) "Extrusion") (alert "Extruded solid selected."))
                ((= (vla-get-SolidType obj) "Revolve") (alert "Revolved solid selected."))
                ((= (substr (vla-get-SolidType obj) 1 4) "Loft") (alert "Lofted solid selected."))
                ((= (vla-get-SolidType obj) "Sweep") (alert "Swept solid selected."))
            )
          )
          ((= "AcDbExtrudedSurface" objName) (ExtrudedSurfaceProperties obj))
          ((= "AcDbRevolvedSurface" objName) (RevolvedSurfaceProperties obj))
          ((= "AcDbLoftedSurface" objName) (LoftedSurfaceProperties obj))
          ((= "AcDbSweptSurface" objName) (SweptSurfaceProperties obj))
          ((= "AcDbPlaneSurface" objName) (PlaneSurfaceProperties obj))
        )
    )

    (vla-Delete ssetObj)
)

(defun ExtrudedSurfaceProperties (extrude / )
    (GetSurfaceBoundingBox extrude)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType extrude)
                   "\nHeight: " (rtos (vla-get-Height extrude) 2)
                   "\nTaperAngle: " (rtos (vla-get-TaperAngle extrude) 2)
                   "\nMaterial: " (vla-get-Material extrude)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity extrude))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity extrude))))
    ;; Now change the configurable properties
    (vla-put-Height extrude (* (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (* (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (* (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (* (vla-get-VIsolineDensity extrude) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-Height extrude (/ (vla-get-Height extrude) 1.5))
    (vla-put-TaperAngle extrude (/ (vla-get-TaperAngle extrude) (/ 3.14 2)))
    (vla-put-UIsolineDensity extrude (/ (vla-get-UIsolineDensity extrude) 2))
    (vla-put-VIsolineDensity extrude (/ (vla-get-VIsolineDensity extrude) 0.5))
)

(defun RevolvedSurfaceProperties (revolve / )
    (GetSurfaceBoundingBox revolve)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType revolve)
                   "\nRevolutionAngle: " (rtos (vla-get-RevolutionAngle revolve) 2)
                   "\nMaterial: " (vla-get-Material revolve)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity revolve))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity revolve))))

    ;; Now change the configurable properties
    (vla-put-RevolutionAngle revolve (* (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (* (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (* (vla-get-VIsolineDensity revolve) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-RevolutionAngle revolve (/ (vla-get-RevolutionAngle revolve) (/ 3.14 2)))
    (vla-put-UIsolineDensity revolve (/ (vla-get-UIsolineDensity revolve) 2))
    (vla-put-VIsolineDensity revolve (/ (vla-get-VIsolineDensity revolve) 0.5))
)

(defun LoftedSurfaceProperties (lofted / )
    (GetSurfaceBoundingBox lofted)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType lofted)
                   "\nNumCrossSections: " (itoa (vla-get-NumCrossSections lofted))
                   "\nNumGuidePaths: " (itoa (vla-get-NumGuidePaths lofted))
                   "\nSurfaceNormals: " (itoa (vla-get-SurfaceNormals lofted))
                   "\nStartDraftAngle: " (rtos (vla-get-StartDraftAngle lofted) 2)
                   "\nStartDraftMagnitude: " (rtos (vla-get-StartDraftMagnitude lofted) 2)
                   "\nEndDraftAngle: " (rtos (vla-get-EndDraftAngle lofted) 2)
                   "\nEndDraftMagnitude: " (rtos (vla-get-EndDraftMagnitude lofted) 2)
                   "\nClosed: " (if (= (vla-get-Closed lofted) :vlax-true) "True" "False")
                   "\nMaterial: " (vla-get-Material lofted)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity lofted))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity lofted))))

    ;; Now change the configurable properties
    (vla-put-StartDraftAngle lofted (* (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (* (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (* (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (* (vla-get-VIsolineDensity lofted) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-StartDraftAngle lofted (/ (vla-get-StartDraftAngle lofted) (/ 3.14 2)))
    (vla-put-EndDraftAngle lofted (/ (vla-get-EndDraftAngle lofted) (/ 3.14 4)))
    (vla-put-UIsolineDensity lofted (/ (vla-get-UIsolineDensity lofted) 2))
    (vla-put-VIsolineDensity lofted (/ (vla-get-VIsolineDensity lofted) 0.5))
)

(defun SweptSurfaceProperties (swept / )
    (GetSurfaceBoundingBox swept)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType swept)
                   "\nProfileRotation: " (rtos (vla-get-ProfileRotation swept) 2)
                   "\nBank: " (if (= (vla-get-Bank swept) :vlax-true) "True" "False")
                   "\nTwist: " (rtos (vla-get-Twist swept) 2)
                   "\nscale: " (rtos (vla-get-Scale swept) 2)
                   "\nLength: " (rtos (vla-get-Length swept) 2)
                   "\nMaterial: " (vla-get-Material swept)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity swept))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity swept))))

    (vla-put-ProfileRotation swept (* (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (* (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (* (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (* (vla-get-VIsolineDensity swept) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-ProfileRotation swept (/ (vla-get-ProfileRotation swept) (* 3.14 0.25)))
    (vla-put-Bank swept (if (= (vla-get-Bank swept) :vlax-true) :vlax-false :vlax-true))
    (vla-put-Twist swept (/ (vla-get-Twist swept) (* 3.14 -0.5)))
    (vla-put-UIsolineDensity swept (/ (vla-get-UIsolineDensity swept) 2))
    (vla-put-VIsolineDensity swept (/ (vla-get-VIsolineDensity swept) 0.5))
)

(defun PlaneSurfaceProperties (planar / )
    (GetSurfaceBoundingBox planar)

    (alert (strcat "SurfaceType: " (vla-get-SurfaceType planar)
                   "\nUIsolineDensity: " (itoa (vla-get-UIsolineDensity planar))
                   "\nVIsolineDensity: " (itoa (vla-get-VIsolineDensity planar))))

    (vla-put-UIsolineDensity planar (* (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (* (vla-get-VIsolineDensity planar) 0.5))

    (vla-Regen doc acActiveViewport)
    (vla-GetString (vla-get-Utility doc) 0 "Press return to continue...")

    ;; Now change the properties back to their original values
    (vla-put-UIsolineDensity planar (/ (vla-get-UIsolineDensity planar) 2))
    (vla-put-VIsolineDensity planar (/ (vla-get-VIsolineDensity planar) 0.5))
)

(defun GetSurfaceBoundingBox (surf / )
    (vla-GetBoundingBox surf 'MinPoint 'MaxPoint)

    ;; Print the min and max extents
    (alert (strcat "The extents of the bounding box for the surface are:"
                   "\nMin Point: " (rtos (vlax-safearray-get-element MinPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MinPoint 2) 2)
                   "\nMax Point: " (rtos (vlax-safearray-get-element MaxPoint 0) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 1) 2) ","
                                   (rtos (vlax-safearray-get-element MaxPoint 2) 2)))
)


WorkspacePath Property (ActiveX)

Specifies the path for the database workspace file.

Supported platforms: Windows only

Signature

VBA:

object.WorkspacePath
object

Type: PreferencesFiles

The object this property applies to.

Property Value

Read-only: No

Type: String

The drive, path, and file name of the database workspace file.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_WorkspacePath()
    ' This example reads and modifies the preference value that controls
    ' the path for the database workspace file.
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadPreferencesFiles
    Dim originalValue As Variant, newValue As Variant

    ' Get the files preferences object
    Set ACADPref = ThisDrawing.Application.preferences.Files

    ' Read and display the original value
    originalValue = ACADPref.WorkspacePath
    MsgBox "The WorkspacePath preference is set to: " & originalValue

    ' Modify the WorkspacePath preference by changing the path to "C:\"
    ACADPref.WorkspacePath = "C:\"
    newValue = ACADPref.WorkspacePath
    MsgBox "The WorkspacePath preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.WorkspacePath = originalValue
    MsgBox "The WorkspacePath preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_WorkspacePath()
    ;; This example reads and modifies the preference value that controls
    ;; the path for the database workspace file.
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))

    ;; Get the files preferences object
    (setq ACADPref (vla-get-Files (vla-get-Preferences acadObj)))

    ;; Read and display the original value
    (setq originalValue (vla-get-WorkspacePath ACADPref))
    (alert (strcat "The WorkspacePath preference is set to: " originalValue))

    ;; Modify the WorkspacePath preference by changing the path to "C:\\"
    (vla-put-WorkspacePath ACADPref "C:\\")
    (alert (strcat "The WorkspacePath preference has been set to: " (vla-get-WorkspacePath ACADPref)))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-WorkspacePath ACADPref originalValue)
    (alert (strcat "The WorkspacePath preference was reset back to: " (vla-get-WorkspacePath ACADPref)))
)


XEffectiveScaleFactor Property (ActiveX)

Specifies the effective XScale factor of the block.

Supported platforms: Windows only

Signature

VBA:

object.XEffectiveScaleFactor
object

Type: BlockReference, ExternalReference, MInsertBlock

The object this property applies to.

Property Value

Read-only: No

Type: ACAD_NOUNITS

A non-zero real number.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


XRefDatabase Property (ActiveX)

Gets the Database object that defines the contents of the block.

Supported platforms: Windows only

Signature

VBA:

object.XRefDatabase
object

Type: Block

The object this property applies to.

Property Value

Read-only: Yes

Type: Database

The Database object that defines the contents of the block.

Remarks

This property is only available if the IsXRef property for the block equals True.

Examples

VBA:

Sub Example_XRefDatabase()
    ' This example adds an external reference to the current drawing.
    ' It then cycles through each Block object in the drawing
    ' and determines the style of each Block by accessing the
    ' IsLayout and IsXRef properties of the Block. If the Block is an
    ' XRef Block, you obtain a reference to the external Database object
    ' for that Block and display the number of Blocks the Database contains.

    Dim InsertPoint(0 To 2) As Double
    Dim insertedBlock As AcadExternalReference
    Dim tempBlock As AcadBlock
    Dim msg As String, PathName As String

    ' Define external reference to be inserted
    InsertPoint(0) = 1: InsertPoint(1) = 1: InsertPoint(2) = 0
    PathName = "c:\program files\autocad\sample\city map.dwg"

    ' Add the external block to model space
    Set insertedBlock = ThisDrawing.ModelSpace.AttachExternalReference(PathName, "XREF_IMAGE", InsertPoint, 1, 1, 1, 0, False)

    ThisDrawing.Application.ZoomAll

    msg = vbCrLf & vbCrLf

    For Each tempBlock In ThisDrawing.Blocks
        If tempBlock.IsXRef Then
            ' Block is an external reference, so add it to list
            msg = msg & tempBlock.name & " contains " & _
            tempBlock.XRefDatabase.Blocks.count & " blocks"

            msg = msg & vbCrLf      ' Insert line
        End If
    Next

    ' Display Block information for the XRefDatabase
    MsgBox "Externally referenced blocks attached to this drawing have the following block counts: " & msg

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_XRefDatabase()
    ;; This example adds an external reference to the current drawing.
    ;; It then cycles through each Block object in the drawing
    ;; and determines the style of each Block by accessing the
    ;; IsLayout and IsXRef properties of the Block. If the Block is an
    ;; XRef Block, you obtain a reference to the external Database object
    ;; for that Block and display the number of Blocks the Database contains.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define external reference to be inserted
    (setq InsertPoint (vlax-3d-point 1 1 0)
          pathName (findfile ".\\Sample\\Sheet Sets\\Architectural\\Res\\STAIR1.dwg"))

    ;; Add the external block to model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq insertedBlock (vla-AttachExternalReference modelSpace pathName "XREF_IMAGE" InsertPoint 1 1 1 0 :vlax-false))

    (vla-ZoomAll acadObj)

    (setq msg "")
    (vlax-for tempBlock (vla-get-Blocks doc)
        (if (= (vla-get-IsXRef tempBlock) :vlax-true)
            (progn
                ;; Block is an external reference, so add it to list
                (setq msg (strcat msg (vla-get-Name tempBlock) " contains "
                                  (itoa (vla-get-Count (vla-get-Blocks (vla-get-XRefDatabase tempBlock)))) " blocks\n"))
            )
        )
    )

    ;; Display Block information for the XRefDatabase
    (alert (strcat "Externally referenced blocks attached to this drawing have the following block counts: " msg))
)


XRefDemandLoad Property (ActiveX)

Specifies demand loading of external references.

Supported platforms: Windows only

Signature

VBA:

object.XRefDemandLoad
object

Type: PreferencesOpenSave

The object this property applies to.

Property Value

Read-only: No

Type: acXRefDemandLoad enum

  • acDemandLoadDisabled: Turns off demand loading; the entire drawing is loaded.
  • acDemandLoadEnabled: Turns on demand loading and improves AutoCAD performance. Other users cannot edit the file while it is being referenced.
  • acDemandLoadEnabledWithCopy: Turns on demand loading but uses a copy of the referenced drawing. Other users can edit the original drawing.

Remarks

Demand loading improves performance by loading only the parts of the referenced drawing needed to regenerate the current drawing.

The initial value for this property is acDemandLoadEnabled.

NoteThe value for this property is stored in the XLOADCTL system variable.

Examples

VBA:

Sub Example_XRefDemandLoad()
    ' This example returns the current setting of
    ' XRefDemandLoad. It then changes the value, and finally
    ' it resets the value back to the original setting.

    Dim preferences As AcadPreferences
    Dim currXRefDemandLoad As Integer
    Dim constant As String
    Dim newConstant As String

    Set preferences = ThisDrawing.Application.preferences

    ' Retrieve the current XRefDemandLoad value
    currXRefDemandLoad = preferences.OpenSave.XrefDemandLoad
    constant = Choose(currXRefDemandLoad + 1, "acDemandLoadDisabled", "acDemandLoadEnabled", "acDemandLoadEnabledWithCopy")
    MsgBox "The current value for XRefDemandLoad is " & constant, vbInformation, "XRefDemandLoad Example"

    ' Change the value for XRefDemandLoad
    newConstant = "acDemandLoadEnabledWithCopy"
    preferences.OpenSave.XrefDemandLoad = acDemandLoadEnabledWithCopy
    MsgBox "The new value for XRefDemandLoad is " & newConstant, vbInformation, "XRefDemandLoad Example"

    ' Reset XRefDemandLoad to its original value
    preferences.OpenSave.XrefDemandLoad = currXRefDemandLoad
    MsgBox "The XRefDemandLoad value is reset to " & constant, vbInformation, "XRefDemandLoad Example"
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_XRefDemandLoad()
    ;; This example returns the current setting of
    ;; XRefDemandLoad. It then changes the value, and finally
    ;; it resets the value back to the original setting.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Retrieve the current XRefDemandLoad value
    (setq currXRefDemandLoad (vla-get-XrefDemandLoad (vla-get-OpenSave preferences)))
    (setq constant (cond
                       ((= currXRefDemandLoad acDemandLoadDisabled) "acDemandLoadDisabled")
                       ((= currXRefDemandLoad acDemandLoadEnabled) "acDemandLoadEnabled")
                       ((= currXRefDemandLoad acDemandLoadEnabledWithCopy) "acDemandLoadEnabledWithCopy")
                   ))
    (alert (strcat "The current value for XRefDemandLoad is " constant))

    ;; Change the value for XRefDemandLoad
    (setq newConstant "acDemandLoadDisabled")
    (vla-put-XrefDemandLoad (vla-get-OpenSave preferences) acDemandLoadDisabled)
    (alert (strcat "The new value for XRefDemandLoad is " newConstant))

    ;; Reset XRefDemandLoad to its original value
    (vla-put-XrefDemandLoad (vla-get-OpenSave preferences) currXRefDemandLoad)
    (alert (strcat "The XRefDemandLoad value is reset to " constant))
)


XRefEdit Property (ActiveX)

Determines if the current drawing can be edited in place when being referenced by another user.

Supported platforms: Windows only

Signature

VBA:

object.XRefEdit
object

Type: DatabasePreferences

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Allows in-place reference editing.
  • False: Does not allow in-place reference editing.

Remarks

The initial value of this property is True.

NoteThe value of this property is stored in the XEDIT system variable.

Examples

VBA:

Sub Example_XRefEdit()
    ' This example reads and modifies the preference value that controls
    ' whether the current drawing can be edited in place when being
    ' referenced by another user.
    '
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadDatabasePreferences
    Dim originalValue As Variant, newValue As Variant

    ' Get the user preferences object
    Set ACADPref = ThisDrawing.preferences

    ' Read and display the original value
    originalValue = ACADPref.XRefEdit
    MsgBox "The XRefEdit preference is set to: " & originalValue

    ' Modify the XRefEdit preference by toggling the value
    ACADPref.XRefEdit = Not (ACADPref.XRefEdit)
    newValue = ACADPref.XRefEdit
    MsgBox "The XRefEdit preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.XRefEdit = originalValue
    MsgBox "The XRefEdit preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_XRefEdit()
    ;; This example reads and modifies the preference value that controls
    ;; whether the current drawing can be edited in place when being
    ;; referenced by another user.
    ;;
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences doc))

    ;; Read and display the original value
    (setq originalValue (vla-get-XRefEdit preferences))
    (alert (strcat "The XRefEdit preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the XRefEdit preference by toggling the value
    (vla-put-XRefEdit preferences (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (alert (strcat "The XRefEdit preference has been set to: " (if (= (vla-get-XRefEdit preferences) :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-XRefEdit preferences originalValue)
    (alert (strcat "The XRefEdit preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


XRefFadeIntensity Property (ActiveX)

Controls the dimming intensity for XRefs.

Supported platforms: Windows only

Signature

VBA:

object.XRefFadeIntensity
object

Type: PreferencesDisplay

The object this property applies to.

Property Value

Read-only: No

Type: Long

A positive long integer from 1 to 90 representing the percentage of fade for XRefs.

Remarks

The initial value for this property is 50.

NoteThe value of this property is stored in the XFADECTL system variable.

Examples

VBA:

Sub Example_XRefFadeIntensity()
    ' This example reads and modifies the preference value that controls
    ' the dimming intensity for xrefs. When finished, this example resets
    ' the preference value back to its original value.
    '
    ' * Note: Changes can only be observed when in-place editing of an Xref
    ' object is in progress and other entities are visible.

    Dim ACADPref As AcadPreferencesDisplay
    Dim originalValue As Variant, newValue As Variant

    ' Get the display preferences object
    Set ACADPref = ThisDrawing.Application.preferences.DISPLAY

    ' Read and display the original value
    originalValue = ACADPref.XRefFadeIntensity
    MsgBox "The XRefFadeIntensity preference is: " & originalValue

    ' Modify the XRefFadeIntensity preference by setting it to 75
    ACADPref.XRefFadeIntensity = 75
    newValue = ACADPref.XRefFadeIntensity
    ThisDrawing.Regen acAllViewports

    MsgBox "The XRefFadeIntensity preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.XRefFadeIntensity = originalValue
    ThisDrawing.Regen acAllViewports

    MsgBox "The XRefFadeIntensity preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_XRefFadeIntensity()
    ;; This example reads and modifies the preference value that controls
    ;; the dimming intensity for xrefs. When finished, this example resets
    ;; the preference value back to its original value.
    ;;
    ;; * Note: Changes can only be observed when in-place editing of an Xref
    ;; object is in progress and other entities are visible.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Read and display the original value
    (setq originalValue (vla-get-XRefFadeIntensity (vla-get-Display preferences)))
    (alert (strcat "The XRefFadeIntensity preference is: " (itoa originalValue)))

    ;; Modify the XRefFadeIntensity preference by setting it to 75
    (vla-put-XRefFadeIntensity (vla-get-Display preferences) 75)
    (vla-Regen doc acAllViewports)
    (alert (strcat "The XRefFadeIntensity preference has been set to: " (itoa (vla-get-XRefFadeIntensity (vla-get-Display preferences)))))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-XRefFadeIntensity (vla-get-Display preferences) originalValue)
    (vla-Regen doc acAllViewports)
    (alert (strcat "The XRefFadeIntensity preference was reset back to: " (itoa (vla-get-XRefFadeIntensity (vla-get-Display preferences)))))
)


XRefLayerVisibility Property (ActiveX)

Determines the visibility of xref-dependent layers and specifies if nested xref path changes are saved.

Supported platforms: Windows only

Signature

VBA:

object.XRefLayerVisibility
object

Type: DatabasePreferences

The object this property applies to.

Property Value

Read-only: No

Type: Boolean

  • True: Xref-dependent layer changes made in the current drawing take precedence.
  • False: The layer table, as stored in the reference drawing (xref) takes precedence.

Remarks

The initial value of this property is True.

When this property is set to True, layer settings are saved with the current drawing's layer table and persist from session to session. Nested xref path changes are saved with the current drawing and persist from session to session.

When this property is set to False, changes made to xref-dependent layers in the current drawing are valid in the current session only, but are not saved with the drawing. When the current drawing is reopened, the layer table is reloaded from the reference drawing and the current drawing reflects those settings. The layer settings affected are: On/Off, Freeze/Thaw, Color, and Linetype. This setting also specifies that changes made to the paths of nested xrefs are for the current session only and are not saved with the drawing.

NoteThe value of this property is stored in the VISRETAIN system variable.

Examples

VBA:

Sub Example_XRefLayerVisibility()
    ' This example reads and modifies the preference value that controls
    ' the visibility of xref-dependent layers and specifies if nested xref
    ' path changes are saved.
    '
    ' When finished, this example resets the preference value back to
    ' its original value.

    Dim ACADPref As AcadDatabasePreferences
    Dim originalValue As Variant, newValue As Variant

    ' Get the user preferences object
    Set ACADPref = ThisDrawing.preferences

    ' Read and display the original value
    originalValue = ACADPref.XRefLayerVisibility
    MsgBox "The XRefLayerVisibility preference is set to: " & originalValue

    ' Modify the XRefLayerVisibility preference by toggling the value
    ACADPref.XRefLayerVisibility = Not (ACADPref.XRefLayerVisibility)
    newValue = ACADPref.XRefLayerVisibility
    MsgBox "The XRefLayerVisibility preference has been set to: " & newValue

    ' Reset the preference back to its original value
    '
    ' * Note: Comment out this last section to leave the change to
    '         this preference in effect
    ACADPref.XRefLayerVisibility = originalValue
    MsgBox "The XRefLayerVisibility preference was reset back to: " & originalValue
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_XRefLayerVisibility()
    ;; This example reads and modifies the preference value that controls
    ;; the visibility of xref-dependent layers and specifies if nested xref
    ;; path changes are saved.
    ;;
    ;; When finished, this example resets the preference value back to
    ;; its original value.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences doc))

    ;; Read and display the original value
    (setq originalValue (vla-get-XRefLayerVisibility preferences))
    (alert (strcat "The XRefLayerVisibility preference is set to: " (if (= originalValue :vlax-true) "True" "False")))

    ;; Modify the XRefLayerVisibility preference by toggling the value
    (vla-put-XRefLayerVisibility preferences (if (= originalValue :vlax-true) :vlax-false :vlax-true))
    (alert (strcat "The XRefLayerVisibility preference has been set to: " (if (= (vla-get-XRefLayerVisibility preferences) :vlax-true) "True" "False")))

    ;; Reset the preference back to its original value
    ;;
    ;; * Note: Comment out this last section to leave the change to
    ;;         this preference in effect
    (vla-put-XRefLayerVisibility preferences originalValue)
    (alert (strcat "The XRefLayerVisibility preference was reset back to: " (if (= originalValue :vlax-true) "True" "False")))
)


XScaleFactor Property (ActiveX)

Specifies the X scale factor for the block or external reference (xref).

Supported platforms: Windows only

Signature

VBA:

object.XScaleFactor
object

Type: BlockReference, ExternalReference, MInsertBlock

The object this property applies to.

Property Value

Read-only: No

Type: Double

A non-zero real number.

Remarks

The initial scale factor is 1.0.

Examples

VBA:

Sub Example_XScaleFactor()
    ' This example creates a block containing a circle.
    ' It then inserts the block and changes the XScaleFactor.

    ' Create the block
    Dim blockObj As AcadBlock
    Dim insertionPnt(0 To 2) As Double
    insertionPnt(0) = 0#: insertionPnt(1) = 0#: insertionPnt(2) = 0#
    Set blockObj = ThisDrawing.Blocks.Add(insertionPnt, "CircleBlock")

    ' Add a circle to the block
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 0: center(1) = 0: center(2) = 0
    radius = 1
    Set circleObj = blockObj.AddCircle(center, radius)

    ' Insert the block
    Dim blockRefObj As AcadBlockReference
    insertionPnt(0) = 2#: insertionPnt(1) = 2#: insertionPnt(2) = 0
    Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, "CircleBlock", 1#, 1#, 1#, 0)

    ' Find the current XScaleFactor for the block reference
    Dim currXScaleFactor As Double
    currXScaleFactor = blockRefObj.XScaleFactor
    ZoomAll
    MsgBox "The current XScaleFactor for the block reference is " & blockRefObj.XScaleFactor, , "XScaleFactor Example"

    ' Change the XScaleFactor for the block reference
    blockRefObj.XScaleFactor = currXScaleFactor + 2
    ZoomAll
    MsgBox "The new XScaleFactor for the block reference is " & blockRefObj.XScaleFactor, , "XScaleFactor Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_XScaleFactor()
    ;; This example creates a block containing a circle.
    ;; It then inserts the block and changes the XScaleFactor.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the block
    (setq insertionPnt (vlax-3d-point 0 0 0))
    (setq blockObj (vla-Add (vla-get-Blocks doc) insertionPnt "CircleBlock"))

    ;; Add a circle to the block
    (setq center (vlax-3d-point 0 0 0)
          radius 1)
    (setq circleObj (vla-AddCircle blockObj center radius))

    ;; Insert the block
    (setq insertionPnt (vlax-3d-point 2 2 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq blockRefObj (vla-InsertBlock modelSpace insertionPnt "CircleBlock" 1 1 1 0))

    ;; Find the current XScaleFactor for the block reference
    (setq currXScaleFactor (vla-get-XScaleFactor blockRefObj))
    (vla-ZoomAll acadObj)
    (alert (strcat "The current XScaleFactor for the block reference is " (rtos (vla-get-XScaleFactor blockRefObj) 2)))

    ;; Change the XScaleFactor for the block reference
    (vla-put-XScaleFactor blockRefObj (+ currXScaleFactor 2))
    (vla-ZoomAll acadObj)
    (alert (strcat "The new XScaleFactor for the block reference is " (rtos (vla-get-XScaleFactor blockRefObj) 2)))
)


XVector Property (ActiveX)

Specifies the X direction of the given UCS.

Supported platforms: Windows only

Signature

VBA:

object.XVector
object

Type: UCS

The object this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

A vector specifying the X direction of the given UCS.

Remarks

If you change the X vector value on the active UCS, you must reset the active UCS to see the changes. To reset the active UCS, use the ActiveUCS property.

Examples

VBA:

Sub Example_XVector()
    ' This finds the current setting of XVector for a given UCS.
    ' It then changes the XVector and resets the UCS.

    Dim viewportObj As AcadViewport

    ' Set the viewportObj variable to the activeviewport
    Set viewportObj = ThisDrawing.ActiveViewport

    ' Define a new UCS and turn on the UCS icon at the origin.
    Dim ucsObj As AcadUCS
    Dim origin(0 To 2) As Double
    Dim xAxisPoint(0 To 2) As Double
    Dim yAxisPoint(0 To 2) As Double

    origin(0) = 2: origin(1) = 2: origin(2) = 0
    xAxisPoint(0) = 3: xAxisPoint(1) = 2: xAxisPoint(2) = 0
    yAxisPoint(0) = 2: yAxisPoint(1) = 3: yAxisPoint(2) = 0

    Set ucsObj = ThisDrawing.UserCoordinateSystems.Add(origin, xAxisPoint, yAxisPoint, "UCS1")
    ThisDrawing.ActiveUCS = ucsObj
    viewportObj.UCSIconOn = True
    viewportObj.UCSIconAtOrigin = True
    ThisDrawing.ActiveViewport = viewportObj

    ' Display the current setting of the XVector
    MsgBox "The current XVector is: " _
           & ucsObj.XVector(0) & ", " & ucsObj.XVector(1) & ", " & ucsObj.XVector(2) & vbCrLf _
           & "The current YVector is: " _
           & ucsObj.YVector(0) & ", " & ucsObj.YVector(1) & ", " & ucsObj.YVector(2), , "XVector Example"

    ' Change the setting of XVector
    Dim newVector(0 To 2) As Double
    newVector(0) = 1: newVector(1) = 1: newVector(2) = 0
    ucsObj.XVector = newVector

    ' Reset the active UCS to see the change
    ThisDrawing.ActiveUCS = ucsObj

    MsgBox "The new XVector is: " _
           & ucsObj.XVector(0) & ", " & ucsObj.XVector(1) & ", " & ucsObj.XVector(2) & vbCrLf _
           & "The YVector is: " _
           & ucsObj.YVector(0) & ", " & ucsObj.YVector(1) & ", " & ucsObj.YVector(2), , "XVector Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_XVector()
    ;; This finds the current setting of XVector for a given UCS.
    ;; It then changes the XVector and resets the UCS.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Set the viewportObj variable to the activeviewport
    (setq viewportObj (vla-get-ActiveViewport doc))

    ;; Define a new UCS and turn on the UCS icon at the origin.
    (setq origin (vlax-3d-point 2 2 0)
          xAxisPoint (vlax-3d-point 3 2 0)
          yAxisPoint (vlax-3d-point 2 3 0))

    (setq ucsObj (vla-Add (vla-get-UserCoordinateSystems doc) origin xAxisPoint yAxisPoint "TEST"))
    (vla-put-ActiveUCS doc ucsObj)
    (vla-put-UCSIconOn viewportObj :vlax-true)
    (vla-put-UCSIconAtOrigin viewportObj :vlax-true)
    (vla-put-ActiveViewport doc viewportObj)

    ;; Display the current setting of the XVector
    (alert (strcat "The current XVector is: "
                   "\n" (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-XVector ucsObj)) 0) 2) ", "
                        (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-XVector ucsObj)) 1) 2) ", "
                        (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-XVector ucsObj)) 2) 2)
                   "\nThe current YVector is: "
                   "\n" (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-YVector ucsObj)) 0) 2) ", "
                        (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-YVector ucsObj)) 1) 2) ", "
                        (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-YVector ucsObj)) 2) 2)))

    ;; Change the setting of XVector
    (setq newVector (vlax-3d-point 0.7071 0.7071 0))
    (vla-put-XVector ucsObj newVector)

    (setq newVector (vlax-3d-point -0.7071 0.7071 0))
    (vla-put-YVector ucsObj newVector)

    ;; Reset the active UCS to see the change
    (vla-put-ActiveUCS doc ucsObj)

    (alert (strcat "The new XVector is: "
                   "\n" (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-XVector ucsObj)) 0) 2) ", "
                        (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-XVector ucsObj)) 1) 2) ", "
                        (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-XVector ucsObj)) 2) 2)
                   "\nThe new YVector is: "
                   "\n" (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-YVector ucsObj)) 0) 2) ", "
                        (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-YVector ucsObj)) 1) 2) ", "
                        (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-YVector ucsObj)) 2) 2)))
)


YEffectiveScaleFactor Property (ActiveX)

Specifies the effective YScale factor of the block.

Supported platforms: Windows only

Signature

VBA:

object.YEffectiveScaleFactor
object

Type: BlockReference, ExternalReference, MInsertBlock

The object this property applies to.

Property Value

Read-only: No

Type: ACAD_NOUNITS

A non-zero real number.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


YScaleFactor Property (ActiveX)

Specifies the Y scale factor for the block or external reference (xref).

Supported platforms: Windows only

Signature

VBA:

object.YScaleFactor
object

Type: BlockReference, ExternalReference, MInsertBlock

The object this property applies to.

Property Value

Read-only: No

Type: Double

A non-zero real number.

Remarks

The initial scale factor is 1.0.

Examples

VBA:

Sub Example_YScaleFactor()
    ' This example creates a block containing a circle.
    ' It then inserts the block and changes the YScaleFactor.

    ' Create the block
    Dim blockObj As AcadBlock
    Dim insertionPnt(0 To 2) As Double
    insertionPnt(0) = 0#: insertionPnt(1) = 0#: insertionPnt(2) = 0#
    Set blockObj = ThisDrawing.Blocks.Add(insertionPnt, "CircleBlock")

    ' Add a circle to the block
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 0: center(1) = 0: center(2) = 0
    radius = 1
    Set circleObj = blockObj.AddCircle(center, radius)

    ' Insert the block
    Dim blockRefObj As AcadBlockReference
    insertionPnt(0) = 2#: insertionPnt(1) = 2#: insertionPnt(2) = 0
    Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, "CircleBlock", 1#, 1#, 1#, 0)
    ZoomAll

    ' Find the current YScaleFactor for the block reference
    Dim currYScaleFactor As Double
    currYScaleFactor = blockRefObj.YScaleFactor
    MsgBox "The current YScaleFactor for the block reference is " & blockRefObj.YScaleFactor, , "YScaleFactor Example"

    ' Change the YScaleFactor for the block reference
    blockRefObj.YScaleFactor = currYScaleFactor + 2
    ZoomAll
    MsgBox "The new YScaleFactor for the block reference is " & blockRefObj.YScaleFactor, , "YScaleFactor Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_YScaleFactor()
    ;; This example creates a block containing a circle.
    ;; It then inserts the block and changes the YScaleFactor.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the block
    (setq insertionPnt (vlax-3d-point 0 0 0))
    (setq blockObj (vla-Add (vla-get-Blocks doc) insertionPnt "CircleBlock"))

    ;; Add a circle to the block
    (setq center (vlax-3d-point 0 0 0)
          radius 1)
    (setq circleObj (vla-AddCircle blockObj center radius))

    ;; Insert the block
    (setq insertionPnt (vlax-3d-point 2 2 0))
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq blockRefObj (vla-InsertBlock modelSpace insertionPnt "CircleBlock" 1 1 1 0))

    ;; Find the current YScaleFactor for the block reference
    (setq currYScaleFactor (vla-get-YScaleFactor blockRefObj))
    (vla-ZoomAll acadObj)
    (alert (strcat "The current YScaleFactor for the block reference is " (rtos (vla-get-YScaleFactor blockRefObj) 2)))

    ;; Change the YScaleFactor for the block reference
    (vla-put-YScaleFactor blockRefObj (+ currYScaleFactor 2))
    (vla-ZoomAll acadObj)
    (alert (strcat "The new YScaleFactor for the block reference is " (rtos (vla-get-YScaleFactor blockRefObj) 2)))
)


YVector Property (ActiveX)

Specifies the Y direction of the given UCS.

Supported platforms: Windows only

Signature

VBA:

object.YVector
object

Type: UCS

The object this property applies to.

Property Value

Read-only: No

Type: Variant (three-element array of doubles)

A vector specifying the Y direction of the given UCS

Remarks

If you change the Y vector value on the active UCS, you must reset the active UCS to see the changes. To reset the active UCS, use the ActiveUCS property.

NoteThe value of this property is stored in the UCSYDIR system variable.

Examples

VBA:

Sub Example_YVector()
    ' This finds the current setting of YVector for a given UCS.
    ' It then changes the YVector and resets the UCS.

    Dim viewportObj As AcadViewport

    ' Set the viewportObj variable to the active viewport
    Set viewportObj = ThisDrawing.ActiveViewport

    ' Define a new UCS and turn on the UCS icon at the origin.
    Dim ucsObj As AcadUCS
    Dim origin(0 To 2) As Double
    Dim xAxisPoint(0 To 2) As Double
    Dim yAxisPoint(0 To 2) As Double

    origin(0) = 2: origin(1) = 2: origin(2) = 0
    xAxisPoint(0) = 3: xAxisPoint(1) = 2: xAxisPoint(2) = 0
    yAxisPoint(0) = 2: yAxisPoint(1) = 3: yAxisPoint(2) = 0

    Set ucsObj = ThisDrawing.UserCoordinateSystems.Add(origin, xAxisPoint, yAxisPoint, "UCS1")
    ThisDrawing.ActiveUCS = ucsObj
    viewportObj.UCSIconOn = True
    viewportObj.UCSIconAtOrigin = True
    ThisDrawing.ActiveViewport = viewportObj

    ' Display the current setting of the vectors
    MsgBox "The current XVector is: " _
           & ucsObj.XVector(0) & ", " & ucsObj.XVector(1) & ", " & ucsObj.XVector(2) & vbCrLf _
           & "The current YVector is: " _
           & ucsObj.YVector(0) & ", " & ucsObj.YVector(1) & ", " & ucsObj.YVector(2), , "YVector Example"

    ' Change the setting of YVector
    Dim newVector(0 To 2) As Double
    newVector(0) = -1: newVector(1) = -1: newVector(2) = 0
    ucsObj.YVector = newVector

    ' Reset the active UCS to see the change
    ThisDrawing.ActiveUCS = ucsObj

    MsgBox "The new XVector is: " _
           & ucsObj.XVector(0) & ", " & ucsObj.XVector(1) & ", " & ucsObj.XVector(2) & vbCrLf _
           & "The YVector is: " _
           & ucsObj.YVector(0) & ", " & ucsObj.YVector(1) & ", " & ucsObj.YVector(2), , "YVector Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_YVector()
    ;; This finds the current setting of XVector for a given UCS.
    ;; It then changes the XVector and resets the UCS.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Set the viewportObj variable to the activeviewport
    (setq viewportObj (vla-get-ActiveViewport doc))

    ;; Define a new UCS and turn on the UCS icon at the origin.
    (setq origin (vlax-3d-point 2 2 0)
          xAxisPoint (vlax-3d-point 3 2 0)
          yAxisPoint (vlax-3d-point 2 3 0))

    (setq ucsObj (vla-Add (vla-get-UserCoordinateSystems doc) origin xAxisPoint yAxisPoint "TEST"))
    (vla-put-ActiveUCS doc ucsObj)
    (vla-put-UCSIconOn viewportObj :vlax-true)
    (vla-put-UCSIconAtOrigin viewportObj :vlax-true)
    (vla-put-ActiveViewport doc viewportObj)

    ;; Display the current setting of the XVector
    (alert (strcat "The current XVector is: "
                   "\n" (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-XVector ucsObj)) 0) 2) ", "
                        (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-XVector ucsObj)) 1) 2) ", "
                        (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-XVector ucsObj)) 2) 2)
                   "\nThe current YVector is: "
                   "\n" (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-YVector ucsObj)) 0) 2) ", "
                        (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-YVector ucsObj)) 1) 2) ", "
                        (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-YVector ucsObj)) 2) 2)))

    ;; Change the setting of XVector
    (setq newVector (vlax-3d-point 0.7071 0.7071 0))
    (vla-put-XVector ucsObj newVector)

    (setq newVector (vlax-3d-point -0.7071 0.7071 0))
    (vla-put-YVector ucsObj newVector)

    ;; Reset the active UCS to see the change
    (vla-put-ActiveUCS doc ucsObj)

    (alert (strcat "The new XVector is: "
                   "\n" (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-XVector ucsObj)) 0) 2) ", "
                        (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-XVector ucsObj)) 1) 2) ", "
                        (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-XVector ucsObj)) 2) 2)
                   "\nThe new YVector is: "
                   "\n" (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-YVector ucsObj)) 0) 2) ", "
                        (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-YVector ucsObj)) 1) 2) ", "
                        (rtos (vlax-safearray-get-element (vlax-variant-value (vla-get-YVector ucsObj)) 2) 2)))
)


ZEffectiveScaleFactor Property (ActiveX)

Specifies the effective ZScale factor of the block.

Supported platforms: Windows only

Signature

VBA:

object.ZEffectiveScaleFactor
object

Type: BlockReference, ExternalReference, MInsertBlock

The object this property applies to.

Property Value

Read-only: No

Type: ACAD_NOUNITS

A non-zero real number.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ZScaleFactor Property (ActiveX)

Specifies the Z scale factor for the block or external reference (xref).

Supported platforms: Windows only

Signature

VBA:

object.ZScaleFactor
object

Type: BlockReference, ExternalReference, MInsertBlock

The object this property applies to.

Property Value

Read-only: No

Type: Double

A non-zero real number.

Remarks

The initial scale factor is 1.0.

Examples

VBA:

Not available

Visual LISP:

Not available


Events

Topics in this section

  • AppActivate

    Triggered just before the main application window is activated.

  • AppDeactivate

    Triggered just before the main application window is deactivated.

  • ARXLoaded

    Triggered when an ObjectARX application has been loaded.

  • ARXUnloaded

    Triggered when an ObjectARX application has been unloaded.

  • BeginClose

    Triggered immediately after AutoCAD receives a request to close a drawing.

  • BeginCommand

    Triggered immediately after a command is issued, but before it completes.

  • BeginDocClose

    Triggered immediately after AutoCAD receives a request to close a drawing.

  • BeginDoubleClick

    Triggered after the user double-clicks an object in the drawing.

  • BeginFileDrop

    Triggered when a file is dropped on the main application window.

  • BeginLISP

    Triggered immediately after AutoCAD receives a request to evaluate an AutoLISP expression.

  • BeginModal

    Triggered just before a modal dialog is displayed.

  • BeginOpen

    Triggered immediately after AutoCAD receives a request to open an existing drawing.

  • BeginPlot

    Triggered immediately after AutoCAD receives a request to print a drawing.

  • BeginQuit

    Triggered just before an AutoCAD session ends or a document closes.

  • BeginRightClick

    Triggered after the user right-clicks on the drawing window.

  • BeginSave

    Triggered immediately after AutoCAD receives a request to save the drawing.

  • BeginShortcutMenuCommand

    Triggered after the user right-clicks on the drawing window, and before the shortcut menu appears in command mode.

  • BeginShortcutMenuDefault

    Triggered after the user right-clicks on the drawing window, and before the shortcut menu appears in default mode.

  • BeginShortcutMenuEdit

    Triggered after the user right-clicks on the drawing window, and before the shortcut menu appears in edit mode.

  • BeginShortcutMenuGrip

    Triggered after the user right-clicks on the drawing window, and before the shortcut menu appears in grip mode.

  • BeginShortcutMenuOSnap

    Triggered after the user right-clicks on the drawing window, and before the shortcut menu appears in object snap mode.

  • Deactivate

    Triggered when the drawing window is deactivated.

  • EndCommand

    Triggered immediately after a command completes.

  • EndLISP

    Triggered upon completion of evaluating an AutoLISP expression.

  • EndModal

    Triggered just after a modal dialog is dismissed.

  • EndOpen

    Triggered immediately after AutoCAD finishes opening an existing drawing.

  • EndPlot

    Triggered after a document has been sent to the printer.

  • EndSave

    Triggered when AutoCAD has finished saving the drawing.

  • EndShortcutMenu

    Triggered after the shortcut menu appears.

  • LayoutSwitched

    Triggered after the user switches to a different layout.

  • LISPCancelled

    Triggered when the evaluation of a AutoLISP expression is cancelled.

  • Modified

    Triggered when an object or collection in the drawing has been modified.

  • NewDrawing

    Triggered just before a new drawing is created.

  • ObjectAdded

    Triggered when an object has been added to the drawing.

  • ObjectErased

    Triggered when an object has been erased from the drawing.

  • ObjectModified

    Triggered when an object in the drawing has been modified.

  • SelectionChanged

    Triggered when the current pickfirst selection set changes.

  • SysVarChanged

    Triggered when the value of a system variable is changed.

  • WindowChanged

    Triggered when there is a change to the application or document windows.

  • WindowMovedOrResized

    Triggered just after the application or drawing window has been moved or resized.


AppActivate Event (ActiveX)

Triggered just before the main application window is activated.

Supported platforms: Windows only

Signature

VBA:

object.AppActivate()
object

Type: Application

An object expression that evaluates to a valid container object. In this case, the only valid container is the application.

Remarks

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Public WithEvents ACADApp As AcadApplication    ' Use with Application Event Examples
Sub Example_AcadApplication_Events()
    ' This example initializes the public variable (ACADApp), which will be used
    ' to intercept AcadApplication Events
    '
    ' The VBA WithEvents statement makes it possible to intercept a generic object
    ' with the events associated with that object.
    '
    ' Before you will be able to trigger any of the AcadApplication events,
    ' you will need to run this procedure.

    ' We could get the application from the ThisDocument object, but that would
    ' require having a drawing open, so we get it from the system.
    Set ACADApp = GetObject(, "AutoCAD.Application.20")
End Sub

Private Sub ACADApp_AppActivate()
    ' This example intercepts an Application AppActivate event.
    '
    ' This event is triggered when the AutoCAD application receives focus
    '
    ' To trigger this example event:
    '     1) Make sure to run the example that initializes
    '     the public variable (named ACADApp) linked to this event.
    '
    '     2) Switch focus from AutoCAD to another Windows application
    '     and then back again.

      MsgBox "AutoCAD was just activated!"
End Sub

Visual LISP:

Not available


AppDeactivate Event (ActiveX)

Triggered just before the main application window is deactivated.

Supported platforms: Windows only

Signature

VBA:

object.AppDeactivate()
object

Type: Application

An object expression that evaluates to a valid container object. In this case, the only valid container is the application.

Remarks

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Public WithEvents ACADApp As AcadApplication    ' Use with Application Event Examples
Sub Example_AcadApplication_Events()
    ' This example initializes the public variable (ACADApp), which will be used
    ' to intercept AcadApplication Events.
    '
    ' The VBA WithEvents statement makes it possible to intercept a generic object
    ' with the events associated with that object.
    '
    ' Before you will be able to trigger any of the AcadApplication events,
    ' you will first need to run this procedure.

    ' We could get the application from the ThisDocument object, but that would
    ' require having a drawing open, so we get it from the system.
    Set ACADApp = GetObject(, "AutoCAD.Application.20")
End Sub

Private Sub ACADApp_AppDeactivate()
    ' This example intercepts an Application AppDeactivate event.
    '
    ' This event is triggered when the AutoCAD application loses focus
    '
    ' To trigger this example event:
    '     1) Make sure to run the example that initializes
    '     the public variable (named ACADApp) linked to this event.
    '
    '     2) Switch focus from AutoCAD to another Windows application.

      MsgBox "AutoCAD just lost focus!"
End Sub

Visual LISP:

Not available


ARXLoaded Event (ActiveX)

Triggered when an ObjectARX application has been loaded.

Supported platforms: Windows only

Signature

VBA:

object.ARXLoaded(FullPathName)
object

Type: Application

An object expression that evaluates to a valid container object. In this case, the only valid container is the application.

FullPathName

Type: String

The full path and file name of the ObjectARX application that has been loaded.

Remarks

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Public WithEvents ACADApp As AcadApplication    ' Use with Application Event Examples
Sub Example_AcadApplication_Events()
    ' This example initializes the public variable (ACADApp), which will be used
    ' to intercept AcadApplication Events.
    '
    ' The VBA WithEvents statement makes it possible to intercept a generic object
    ' with the events associated with that object.
    '
    ' Before you will be able to trigger any of the AcadApplication events,
    ' you will first need to run this procedure.

    ' We could get the application from the ThisDocument object, but that would
    ' require having a drawing open, so we get it from the system.
    Set ACADApp = GetObject(, "AutoCAD.Application.20")
End Sub

Private Sub ACADApp_ARXLoaded(ByVal AppName As String)
    ' This example intercepts an Application ARXLoaded event.
    ' This event is triggered when AutoCAD loads an ObjectARX application.
    '
    ' To trigger this example event:
    '     1) Make sure to run the example that initializes
    '     the public variable (named ACADApp) linked to this event.
    '
    '     2) Load an ARX application into AutoCAD.

    ' Use the "AppName" variable to notify the user which ARX application was loaded
      MsgBox "AutoCAD just loaded the ARX application: " & AppName

End Sub

Visual LISP:

Not available


ARXUnloaded Event (ActiveX)

Triggered when an ObjectARX application has been unloaded.

Supported platforms: Windows only

Signature

VBA:

object.ARXUnloaded(FullPathName)
object

Type: Application

An object expression that evaluates to a valid container object. In this case, the only valid container is the application.

FullPathName

Type: String

The full path and file name of the ObjectARX application that has been unloaded.

Remarks

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Public WithEvents ACADApp As AcadApplication    ' Use with Application Event Examples
Sub Example_AcadApplication_Events()
    ' This example intializes the public variable (ACADApp) which will be used
    ' to intercept AcadApplication Events
    '
    ' The VBA WithEvents statement makes it possible to intercept an generic object
    ' with the events associated with that object.
    '
    ' Before you will be able to trigger any of the AcadApplication events,
    ' you will first need to run this procedure.

    ' We could get the application from the ThisDocument object, but that would
    ' require having a drawing open, so we grab it from the system.
    Set ACADApp = GetObject(, "AutoCAD.Application.20")
End Sub

Private Sub ACADApp_ARXUnloaded(ByVal AppName As String)
    ' This example intercepts an Application ARXUnloaded event.
    '
    ' This event is triggered when the AutoCAD unloads an ARX application
    '
    ' To trigger this example event:
    '     1) Make sure to run the example that initializes
    '     the public variable (named ACADApp) linked to this event.
    '
    '     2) Unload an ARX application that is already loaded into AutoCAD

    ' Use the "AppName" variable to notify the user which ARX application was unloaded
      MsgBox "AutoCAD just unloaded the ARX application: " & AppName

End Sub

Visual LISP:

Not available


BeginClose Event (ActiveX)

Triggered immediately after AutoCAD receives a request to close a drawing.

Supported platforms: Windows only

Signature

VBA:

object.BeginClose()
object

Type: Document

An object expression that evaluates to a valid container object. In this case, the only valid containers are the application and a document.

Remarks

You should use the BeginDocClose event rather than the BeginClose event because the BeginDocClose event enables you to keep a drawing from being closed.

No events occur while a modal dialog is displayed.

Examples

VBA:

Private Sub AcadDocument_BeginClose()
    ' This example intercepts a drawing BeginClose event.
    '
    ' This event is triggered when a drawing receives a request to close.
    '
    ' To trigger this example event: Close an open drawing

    MsgBox "A drawing has just been closed!"
End Sub

Visual LISP:

Not available


BeginCommand Event (ActiveX)

Triggered immediately after a command is issued, but before it completes.

Supported platforms: Windows only

Signature

VBA:

object.BeginCommand(CommandName)
object

Type: Application

An object expression that evaluates to a valid container object. In this case, the only valid container is the application.

CommandName

Type: String

The name of the command being issued.

Remarks

The BeginCommand event is triggered as soon as AutoCAD receives a request to issue a command. This request can come either interactively by a user through the AutoCAD user interface or programmatically. The BeginCommand event is followed by the EndCommand event after AutoCAD completes processing the command. If the user cancels out of the command, the EndCommand event will not be triggered.

The BeginCommand event will be fired for any basic AutoCAD command, or any command registered on the AutoCAD command stack via an ObjectARX application, or the Visual LISP vlax-add-cmd function.

This event will not be fired for Visual LISP functions defined as external subroutines via the Visual LISP vl-acad-defun function. These functions are not exposed to the command stack, even though you execute them from the AutoCAD command line. Instead, these functions will trigger the BeginLISP and EndLISP events. If you need LISP commands to be recognized when they execute you will need to use the Visual LISP vlax-add-cmd function to register the command correctly to the AutoCAD command stack.

If you undefine an AutoCAD command and then redefine it via the Visual LISP vl-acad-defun function, the BeginCommand event may not be triggered until an actual AutoCAD command is called (command "._LINE" ...) for instance.

AutoCAD commands are stored in groups in the command stack. One instance of the command stack is created per AutoCAD session. This stack consists of the native AutoCAD commands, as well as any custom commands you add to it.

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)
    ' This example intercepts a drawing BeginCommand event.
    '
    ' This event is triggered when a drawing receives
    ' any command compatible with this event.
    '
    ' To trigger this example event: Issue any command to an open drawing from
    ' either the command line, VBA, the AutoCAD menus, the AutoCAD toolbars, or LISP.

    ' Use the "CommandName" variable to determine which command was started
    MsgBox "A drawing has just been issued a " & CommandName & " command."
End Sub

Visual LISP:

Not available


BeginDocClose Event (ActiveX)

Triggered immediately after AutoCAD receives a request to close a drawing.

Supported platforms: Windows only

Signature

VBA:

object.BeginDocClose(Cancel)
object

Type: Document

An object expression that evaluates to a valid container object. In this case, the only valid containers are the application and a document.

Cancel

Type: Boolean

Determines whether to prevent the drawing from being closed.

  • True: The drawing is prevented from closing.
  • False: The drawing is not prevented from closing.

Remarks

You can use this event to keep a drawing from being closed. This event should be used instead of the BeginClose event.

No events occur while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_BeginDocClose(Cancel As Boolean)
    ' This example prevents a drawing from closing.
    Cancel = True
    MsgBox "Please do not close this drawing."

End Sub

Visual LISP:

Not available


BeginDoubleClick Event (ActiveX)

Triggered after the user double-clicks an object in the drawing.

Supported platforms: Windows only

Signature

VBA:

object.BeginDoubleClick(PickPoint)
object

Type: Document

An object expression that evaluates to a valid container object. In this case, the only valid container is a document.

PickPoint

Type: Variant (three-element array of doubles); input to the handler

The 3D WCS coordinate that was double-clicked.

Remarks

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_BeginDoubleClick(ByVal PickPoint As Variant)
    ' This example intercepts a drawing BeginDoubleClick event.
    '
    ' This event is triggered when a drawing receives
    ' a double mouse click in its working area.
    '
    ' To trigger this example event: Position the mouse over the working area of
    ' a drawing window and double-click the left mouse button

    ' Use the "PickPoint" variable to determine where on the drawing the user clicked
    MsgBox "A drawing has just been double-clicked at:" & vbCrLf & _
            PickPoint(0) & vbCrLf & _
            PickPoint(1) & vbCrLf & _
            PickPoint(2)
End Sub

Visual LISP:

Not available


BeginFileDrop Event (ActiveX)

Triggered when a file is dropped on the main application window.

Supported platforms: Windows only

Signature

VBA:

object.BeginFileDrop(FileName, Cancel)
object

Type: Application

An object expression that evaluates to a valid container object. In this case, the only valid container is the application.

FileName

Type: String; input to the handler

The name of the file that has been dropped on the main application window.

Cancel

Type: Boolean; output from the handler

  • True: Aborts the loading of the drawing.
  • False: Allows the loading of the drawing to continue.

Remarks

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Public WithEvents ACADApp As AcadApplication    ' Use with Application Event Examples
Sub Example_AcadApplication_Events()
    ' This example intializes the public variable (ACADApp) which will be used
    ' to intercept AcadApplication Events
    '
    ' The VBA WithEvents statement makes it possible to intercept an generic object
    ' with the events associated with that object.
    '
    ' Before you will be able to trigger any of the AcadApplication events,
    ' you will first need to run this procedure.

    ' We could get the application from the ThisDocument object, but that would
    ' require having a drawing open, so we grab it from the system.
    Set ACADApp = GetObject(, "AutoCAD.Application.20")
End Sub

Private Sub ACADApp_BeginFileDrop(ByVal FileName As String, Cancel As Boolean)
    ' This example intercepts an Application BeginFileDrop event.
    '
    ' This event is triggered when a drawing file is dragged into AutoCAD.
    '
    ' To trigger this example event:
    '     1) Make sure to run the example that initializes
    '     the public variable (named ACADApp) linked to this event.
    '
    '     2) Drag an AutoCAD drawing file into the AutoCAD application from either
    '     the Windows Desktop or Windows Explorer

    ' Use the "Cancel" variable to stop the loading of the dragged file, and the "FileName"
    ' variable to notifiy the user which file is about to be dragged in.
    If MsgBox("AutoCAD is about to load " & FileName & vbCrLf & _
              "Do you want to continue loading this file?", vbYesNoCancel + vbQuestion) <> vbYes Then
        Cancel = True
    End If
End Sub

Visual LISP:

Not available


BeginLISP Event (ActiveX)

Triggered immediately after AutoCAD receives a request to evaluate an AutoLISP expression.

Supported platforms: Windows only

Signature

VBA:

object.BeginLISP(FirstLine)
object

Type: Application, Document

An object expression that evaluates to a valid container object. In this case, the only valid containers are the application and the document.

FirstLine

Type: String; input-only

The name of the AutoLISP expression about to be executed by the AutoLISP interpreter. FirstLine will not have any case conversion of the alpha characters.

If the AutoLISP function being executed is defined (with defun) as a C:xxx function and is being executed as an AutoCAD command (such as just using the xxx part of the function name and no parentheses), then FirstLine will be the complete function name including the C: prefix and will be enclosed inside a pair of parentheses—just the way it would appear when executed as a true AutoLISP function call. Otherwise, FirstLine will be the actual AutoLISP expression that has been typed in at the AutoCAD command line or is part of a menu macro.

For example:

  • If there is a user-defined AutoLISP function loaded called C:TEST, and it is executed by typing "TEST" at the command line, then FirstLine will be (C:TEST).
  • If there is a user defined AutoLISP function loaded called calc and it is executed as (cAlc), then FirstLine will be (cAlc).
  • If a menu macro contains (getvar "cmdecho"), then FirstLine will be (getvar "cmdecho").

Remarks

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_BeginLisp(ByVal FirstLine As String)
    ' This example intercepts a drawing BeginLisp event.
    '
    ' This event is triggered when a drawing receives
    ' a request to evaluate a LISP expression.
    '
    ' To trigger this example event: Start the evaluation of a LISP expression

    ' Use the "FirstLine" variable to help the user determine which LISP expression is running
    MsgBox "A LISP expression has just started to be evaluated.  The first line of the expression is: " & FirstLine

End Sub

Visual LISP:

Not available


BeginModal Event (ActiveX)

Triggered just before a modal dialog is displayed.

Supported platforms: Windows only

Signature

VBA:

object.BeginModal()
object

Type: Application

An object expression that evaluates to a valid container object. In this case, the only valid container is the application.

Remarks

No events will be fired while a modal dialog is being displayed.

You should never issue a message box from within an event handler for the BeginModal event.

Examples

VBA:

Public WithEvents ACADApp As AcadApplication    ' Use with Application Event Examples
Sub Example_AcadApplication_Events()
    ' This example intializes the public variable (ACADApp) which will be used
    ' to intercept AcadApplication Events
    '
    ' The VBA WithEvents statement makes it possible to intercept an generic object
    ' with the events associated with that object.
    '
    ' Before you will be able to trigger any of the AcadApplication events,
    ' you will first need to run this procedure.

    ' We could get the application from the ThisDocument object, but that would
    ' require having a drawing open, so we grab it from the system.
    Set ACADApp = GetObject(, "AutoCAD.Application.20")
End Sub

Private Sub ACADApp_BeginModal()
    ' This example intercepts an Application BeginModal event.  We use a Beep instead of
    ' a message box to notify the user when the event is triggered, since a message box
    ' is a modal entity and would cause continuous BeginModal/EndModal events to be triggered.
    '
    ' This event is triggered when AutoCAD displays a modal dialog.
    '
    ' To trigger this example event:
    '     1) Make sure to run the example that initializes
    '     the public variable (named ACADApp) linked to this event.
    '
    '     2) Use AutoCAD to begin a modal dialog operation.
    '     For example, use AutoCAD to display a modal file dialog by using File/New

    Beep  ' A modal dialog is about to be displayed!
End Sub

Visual LISP:

Not available


BeginOpen Event (ActiveX)

Triggered immediately after AutoCAD receives a request to open an existing drawing.

Supported platforms: Windows only

Signature

VBA:

object.BeginOpen(Filename)
object

Type: Application

An object expression that evaluates to a valid container object. In this case, the only valid container is the application.

Filename

Type: String

The name of the file being opened.

Remarks

The BeginOpen event is triggered as soon as AutoCAD receives a request to open an existing file. This request can come either interactively by a user through the File Open dialog box or programmatically.

The BeginOpen event does not trigger when opening a DXF format file.

When opening an existing file, the BeginOpen event will be followed by the EndOpen event when AutoCAD completes the opening of the drawing. For example, when a user selects Application menu [image] Open, then chooses the file to open from the dialog box and selects the Open button, the BeginOpen event is triggered (as soon as the Open button is processed). Once the drawing is visible in the AutoCAD window and is ready for work, the EndOpen event is triggered.

When creating a new file, the NewDrawing event is triggered.

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Public WithEvents ACADApp As AcadApplication    ' Use with Application Event Examples
Sub Example_AcadApplication_Events()
    ' This example intializes the public variable (ACADApp) which will be used
    ' to intercept AcadApplication Events
    '
    ' The VBA WithEvents statement makes it possible to intercept an generic object
    ' with the events associated with that object.
    '
    ' Before you will be able to trigger any of the AcadApplication events,
    ' you will first need to run this procedure.

    ' We could get the application from the ThisDocument object, but that would
    ' require having a drawing open, so we grab it from the system.
    Set ACADApp = GetObject(, "AutoCAD.Application.20")
End Sub

Private Sub ACADApp_BeginOpen(FileName As String)
    ' This example intercepts an Application BeginOpen event.
    '
    ' This event is triggered when a drawing is opened by AutoCAD.
    '
    ' To trigger this example event:
    '     1) Make sure to run the example that initializes
    '     the public variable (named ACADApp) linked to this event.
    '
    '     2) Use AutoCAD to open an existing drawing

    ' Use the "FileName" variable to determine which drawing file is being opened
    MsgBox "A drawing is about to be loaded from: " & FileName
End Sub

Visual LISP:

Not available


BeginPlot Event (ActiveX)

Triggered immediately after AutoCAD receives a request to print a drawing.

Supported platforms: Windows only

Signature

VBA:

object.BeginPlot(DrawingName)
object

Type: Application, Document

An object expression that evaluates to a valid container object. In this case, the only valid containers are the application and a document.

DrawingName

Type: String; input to the handler

The name of the drawing that is being sent to the printer.

Remarks

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_BeginPlot(ByVal DrawingName As String)
    ' This example intercepts a drawing BeginPlot event.
    '
    ' This event is triggered when a drawing receives a plot request.
    '
    ' To trigger this example event: Plot an open drawing

    ' Use the "DrawingName" variable to determine which drawing is about to plot
    MsgBox "A drawing has just received a request to plot for: " & DrawingName

End Sub

Visual LISP:

Not available


BeginQuit Event (ActiveX)

Triggered just before an AutoCAD session ends or a document closes.

Supported platforms: Windows only

Signature

VBA:

object.BeginQuit(Cancel)
object

Type: Application

An object expression that evaluates to a valid container object. In this case, the only valid container is the application.

Cancel

Type: Boolean; output from the handler

  • True: Aborts the shutdown of AutoCAD.
  • False: Allows the shutdown of AutoCAD to continue.

Remarks

The BeginQuit event marks the end of the AutoCAD session.

Examples

VBA:

Public WithEvents ACADApp As AcadApplication    ' Use with Application Event Examples
Sub Example_AcadApplication_Events()
    ' This example intializes the public variable (ACADApp) which will be used
    ' to intercept AcadApplication Events
    '
    ' The VBA WithEvents statement makes it possible to intercept an generic object
    ' with the events associated with that object.
    '
    ' Before you will be able to trigger any of the AcadApplication events,
    ' you will first need to run this procedure.

    ' We could get the application from the ThisDocument object, but that would
    ' require having a drawing open, so we grab it from the system.
    Set ACADApp = GetObject(, "AutoCAD.Application.20")
End Sub

Private Sub ACADApp_BeginQuit(Cancel As Boolean)
    ' This example intercepts an Application BeginQuit event.
    '
    ' This event is triggered when AutoCAD receives a request to shut down.
    '
    ' To trigger this example event:
    '     1) Make sure to run the example that initializes
    '     the public variable (named ACADApp) linked to this event.
    '
    '     2) Close the AutoCAD application

    ' Use the "Cancel" variable to stop the shut down of the application
    If MsgBox("AutoCAD is about to shut down.  Do you want to continue with the shutdown?", _
              vbYesNoCancel + vbQuestion) <> vbYes Then
        Cancel = True
    End If
End Sub

Visual LISP:

Not available


BeginRightClick Event (ActiveX)

Triggered after the user right-clicks on the drawing window.

Supported platforms: Windows only

Signature

VBA:

object.BeginRightClick(PickPoint)
object

Type: Document

An object expression that evaluates to a valid container object. In this case, the only valid container is a document.

PickPoint

Type: Variant (three-element array of doubles); input to the handler

The 3D WCS coordinate that was right-clicked.

Remarks

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_BeginRightClick(ByVal PickPoint As Variant)
    ' This example intercepts a drawing BeginRightClick event.
    '
    ' This event is triggered when a drawing receives
    ' a right mouse click in its working area.
    '
    ' To trigger this example event: Position the cursor over the working area of
    ' a drawing window and click the right mouse button.

    ' Use the "PickPoint" variable to determine where on the drawing the user clicked
    MsgBox "A drawing has just been right-clicked at:" & vbCrLf & _
            PickPoint(0) & vbCrLf & _
            PickPoint(1) & vbCrLf & _
            PickPoint(2)

End Sub

Visual LISP:

Not available


BeginSave Event (ActiveX)

Triggered immediately after AutoCAD receives a request to save the drawing.

Supported platforms: Windows only

Signature

VBA:

object.BeginSave(Filename)
object

Type: Application

An object expression that evaluates to a valid container object. In this case, the only valid container is the application.

Filename

Type: String

The name of the file being saved.

Remarks

The BeginSave event is triggered as soon as AutoCAD receives a request to save along with the name of the file to save. This request can come either interactively by a user through the interface or programmatically.

The BeginSave event is followed by the EndSave event after AutoCAD completes the saving of the drawing.

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_BeginSave(ByVal FileName As String)
    ' This example intercepts a drawing BeginSave event.
    '
    ' This event is triggered when a drawing receives a request to be saved.
    '
    ' To trigger this example event: Save an open drawing

    ' Use the "FileName" variable to determine where the drawing file is being saved
    MsgBox "A drawing is about to be saved to: " & FileName
End Sub

Visual LISP:

Not available


BeginShortcutMenuCommand Event (ActiveX)

Triggered after the user right-clicks on the drawing window, and before the shortcut menu appears in command mode.

Supported platforms: Windows only

Signature

VBA:

object.BeginShortcutMenuCommand(ShortcutMenu, Command)
object

Type: Document

An object expression that evaluates to a valid container object. In this case, the only valid container is a document.

ShortcutMenu

Type: PopupMenu object; input/output from the handler

The shortcut menu about to be displayed.

Command

Type: String; input to the handler only

The name of the command in process.

Remarks

This event allows you to make changes to the shortcut menu before it is displayed. To make changes to the shortcut menu, edit the PopupMenu object that is passed in to your handler from the event. This same PopupMenu object is passed out of the handler as the current shortcut menu. Use the EndShortcutMenu event to perform any cleanup work on the shortcut menu.

There is a command in progress when this event is triggered.

This event is triggered after all shortcut menu elements, including any ObjectARX command additions, have occurred.

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_BeginShortcutMenuCommand(ShortcutMenu As AutoCAD.IAcadPopupMenu, ByVal Command As String)
    ' This example intercepts a shortcut menu start while you are in the command mode.
    '
    MsgBox "You have just initiated a shortcut menu in command mode!"
End Sub

Visual LISP:

Not available


BeginShortcutMenuDefault Event (ActiveX)

Triggered after the user right-clicks on the drawing window, and before the shortcut menu appears in default mode.

Supported platforms: Windows only

Signature

VBA:

object.BeginShortcutMenuDefault(ShortcutMenu)
object

Type: Document

An object expression that evaluates to a valid container object. In this case, the only valid container is a document.

ShortcutMenu

Type: PopupMenu object; input/output from the handler

The shortcut menu about to be displayed.

Remarks

This event allows you to make changes to the shortcut menu before it is displayed. To make changes to the shortcut menu, edit the PopupMenu object that is passed in to your handler from the event. This same PopupMenu object is passed out as the current shortcut menu. Use the EndShortcutMenu event to perform any cleanup work on the shortcut menu.

There is no selection set active and no command in process when this event is triggered.

This event is triggered after all shortcut menu elements, including any ObjectARX command additions, have occurred.

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_BeginShortcutMenuDefault(ShortcutMenu As AutoCAD.IAcadPopupMenu)
    ' This example intercepts a shortcut menu start while you are in the default mode.
    '
    MsgBox "You have just initiated a shortcut menu in default mode!"
End Sub

Visual LISP:

Not available


BeginShortcutMenuEdit Event (ActiveX)

Triggered after the user right-clicks on the drawing window, and before the shortcut menu appears in edit mode.

Supported platforms: Windows only

Signature

VBA:

object.BeginShortcutMenuEdit(ShortcutMenu, SelectionSet)
object

Type: Document

An object expression that evaluates to a valid container object. In this case, the only valid container is a document.

ShortcutMenu

Type: PopupMenu object; input/output from the handler

The shortcut menu about to be displayed.

SelectionSet

Type: SelectionSet object; input/output from the handler

The pickfirst selection set.

Remarks

This event allows you to make changes to the shortcut menu before it is displayed. To make changes to the shortcut menu, edit the PopupMenu object that is passed in to your handler from the event. This same PopupMenu object is passed out of the handler as the current shortcut menu. Use the EndShortcutMenu event to perform any cleanup work on the shortcut menu.

There is a selection set active but no command in progress when this event is triggered.

This event is triggered after all shortcut menu elements, including any ObjectARX command additions, have occurred.

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_BeginShortcutMenuEdit(ShortcutMenu As AutoCAD.IAcadPopupMenu, SelectionSet As AutoCAD.IAcadSelectionSet)
    ' This example intercepts a shortcut menu start while you are in the edit mode.
    '
    MsgBox "You have just initiated a shortcut menu in edit mode!"
End Sub

Visual LISP:

Not available


BeginShortcutMenuGrip Event (ActiveX)

Triggered after the user right-clicks on the drawing window, and before the shortcut menu appears in grip mode.

Supported platforms: Windows only

Signature

VBA:

object.BeginShortcutMenuGrip(ShortcutMenu)
object

Type: Document

An object expression that evaluates to a valid container object. In this case, the only valid container is a document.

ShortcutMenu

Type: PopupMenu object; input/output from the handler

The shortcut menu about to be displayed.

Remarks

This event allows you to make changes to the shortcut menu before it is displayed. To make changes to the shortcut menu, edit the PopupMenu object that is passed in to your handler from the event. This same PopupMenu object is passed out as the current shortcut menu. Use the EndShortcutMenu event to perform any cleanup work on the shortcut menu.

There is a hot grip active when this event is triggered.

This event is triggered after all shortcut menu elements, including any ObjectARX command additions, have occurred.

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_BeginShortcutMenuGrip(ShortcutMenu As AutoCAD.IAcadPopupMenu)
    ' This example intercepts a shortcut menu start while you are in the grip mode.
    '
    MsgBox "You have just initiated a shortcut menu in grip mode!"
End Sub

Visual LISP:

Not available


BeginShortcutMenuOSnap Event (ActiveX)

Triggered after the user right-clicks on the drawing window, and before the shortcut menu appears in object snap mode.

Supported platforms: Windows only

Signature

VBA:

object.BeginShortcutMenuGrip(ShortcutMenu)
object

Type: Document

An object expression that evaluates to a valid container object. In this case, the only valid container is a document.

ShortcutMenu

Type: PopupMenu object; input/output from the handler

The shortcut menu about to be displayed.

Remarks

This event allows you to make changes to the shortcut menu before it is displayed. To make changes to the shortcut menu, edit the PopupMenu object that is passed in to your handler from the event. This same PopupMenu object is passed out as the current shortcut menu. Use the EndShortcutMenu event to perform any cleanup work on the shortcut menu.

This event is triggered after all shortcut menu elements, including any ObjectARX command additions, have occurred.

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_BeginShortcutMenuOSnap(ShortcutMenu As AutoCAD.IAcadPopupMenu)
    ' This example intercepts a shortcut menu start while you are in the osnap mode.
    '
    MsgBox "You have just initiated a shortcut menu in osnap mode!"
End Sub

Visual LISP:

Not available


Deactivate Event (ActiveX)

Triggered when the drawing window is deactivated.

Supported platforms: Windows only

Signature

VBA:

object.Deactivate()
object

Type: Document

An object expression that evaluates to a valid container object. In this case, the only valid container is a document.

Remarks

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_Deactivate()
    ' This example intercepts a drawing DeActivate event.
    '
    ' This event is triggered when a drawing window loses focus.
    '
    ' To trigger this example event: Open two drawings and switch from
    ' one drawing window to another

    MsgBox "You have just deactivated a drawing!"
End Sub

Visual LISP:

Not available


EndCommand Event (ActiveX)

Triggered immediately after a command completes.

Supported platforms: Windows only

Signature

VBA:

object.EndCommand(CommandName)
object

Type: Application

An object expression that evaluates to a valid container object. In this case, the only valid container is the application.

CommandName

Type: String

The name of the command that was issued.

Remarks

The EndCommand event follows the BeginCommand event after AutoCAD completes processing the command. If the user cancels out of the command, the EndCommand event will not be triggered.

The BeginCommand event will be fired for any basic AutoCAD command, or any command registered on the AutoCAD command stack via an ObjectARX application, or the Visual LISP vlax-add-cmd function. It will not be fired for any normally defun'd C: AutoLISP function because it is not exposed to the command stack, even though you execute it from the AutoCAD command Line. If you need AutoLISP commands to be recognized when they execute, you will need to use the Visual LISP vlax-add-cmd function to register the command correctly to the AutoCAD command stack.

If you undefine an AutoCAD command and then redefine it via the AutoLISP defun function, the BeginCommand event may not be triggered until an actual AutoCAD command is called; for example, (command "._LINE" ...).

AutoCAD commands are stored in groups in the command stack. One instance of the command stack is created per AutoCAD session. This stack consists of the native AutoCAD commands, as well as any custom commands you add to it.

No events will be fired while a modal dialog is being displayed

Examples

VBA:

Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
    ' This example intercepts a drawing EndCommand event.
    '
    ' This event is triggered when a drawing receives
    ' any command compatible with this event.
    '
    ' To trigger this example event: Issue any command to an open drawing from
    ' either the command line, VBA, the ACAD menus, the ACAD toolbars, or LISP.
    ' When the command is finished, this event will be triggered.

    ' Use the "CommandName" variable to determine which command just finished
    MsgBox "A drawing has just finished a " & CommandName & " command."

End Sub

Visual LISP:

Not available


EndLISP Event (ActiveX)

Triggered upon completion of evaluating an AutoLISP expression.

Supported platforms: Windows only

Signature

VBA:

object.EndLISP()
object

Type: Application, Document

An object expression that evaluates to a valid container object. In this case, the only valid containers are the application and a document.

Remarks

This event will occur after either a normal termination of the AutoLISP evaluation, or after a cancellation of the AutoLISP evaluation.

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_EndLisp()
    ' This example intercepts a drawing BeginLisp event.
    '
    ' This event is triggered when a drawing finishes
    ' a the evaluation of a LISP expression.
    '
    ' To trigger this example event: Start the evaluation of a LISP expression and
    ' wait for it to finish being evaluated

    MsgBox "A LISP expression has just finished being evaluated!"

End Sub

Visual LISP:

Not available


EndModal Event (ActiveX)

Triggered just after a modal dialog is dismissed.

Supported platforms: Windows only

Signature

VBA:

object.EndModal()
object

Type: Application

An object expression that evaluates to a valid container object. In this case, the only valid container is the application.

Remarks

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Public WithEvents ACADApp As AcadApplication    ' Use with Application Event Examples
Sub Example_AcadApplication_Events()
    ' This example intializes the public variable (ACADApp) which will be used
    ' to intercept AcadApplication Events
    '
    ' The VBA WithEvents statement makes it possible to intercept an generic object
    ' with the events associated with that object.
    '
    ' Before you will be able to trigger any of the AcadApplication events,
    ' you will first need to run this procedure.

    ' We could get the application from the ThisDocument object, but that would
    ' require having a drawing open, so we grab it from the system.
    Set ACADApp = GetObject(, "AutoCAD.Application.20")
End Sub

Private Sub ACADApp_EndModal()
    ' This example intercepts an Application EndModal event.  We use a Beep instead of
    ' a message box to notify the user when the event is triggered, since a message box
    ' is a modal entity and would cause continuous BeginModal/EndModal events to be triggered.
    '
    ' This event is triggered when AutoCAD finishes displaying a modal dialog.
    '
    ' To trigger this example event:
    '     1) Make sure to run the example that initializes
    '     the public variable (named ACADApp) linked to this event.
    '
    '     2) Use AutoCAD to begin a modal dialog operation and then dismiss the dialog.
    '     For example, use AutoCAD to display a modal file dialog by using File/New and then
    '     close the dialog by selecting Cancel

    Beep  ' The modal dialog was just closed!

End Sub

Visual LISP:

Not available


EndOpen Event (ActiveX)

Triggered immediately after AutoCAD finishes opening an existing drawing.

Supported platforms: Windows only

Signature

VBA:

object.EndOpen(Filename)
object

Type: Application

An object expression that evaluates to a valid container object. In this case, the only valid container is the application.

Filename

Type: String

The name of the file being opened.

Remarks

The EndOpen event follows the BeginOpen event after AutoCAD completes the opening of an existing drawing.

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Public WithEvents ACADApp As AcadApplication    ' Use with Application Event Examples
Sub Example_AcadApplication_Events()
    ' This example intializes the public variable (ACADApp) which will be used
    ' to intercept AcadApplication Events
    '
    ' The VBA WithEvents statement makes it possible to intercept an generic object
    ' with the events associated with that object.
    '
    ' Before you will be able to trigger any of the AcadApplication events,
    ' you will first need to run this procedure.

    ' We could get the application from the ThisDocument object, but that would
    ' require having a drawing open, so we grab it from the system.
    Set ACADApp = GetObject(, "AutoCAD.Application.20")
End Sub

Private Sub ACADApp_EndOpen(ByVal FileName As String)
    ' This example intercepts an Application EndOpen event.
    '
    ' This event is triggered when AutoCAD finishes opening a drawing.
    '
    ' To trigger this example event:
    '     1) Make sure to run the example that initializes
    '     the public variable (named ACADApp) linked to this event.
    '
    '     2) Use AutoCAD to open an existing drawing and wait until the
    '     operation finishes

    ' Use the "FileName" variable to determine which drawing file is being opened
    MsgBox "A drawing was just loaded from: " & FileName
End Sub

Visual LISP:

Not available


EndPlot Event (ActiveX)

Triggered after a document has been sent to the printer.

Supported platforms: Windows only

Signature

VBA:

object.EndPlot(DrawingName)
object

Type: Application, Document

An object expression that evaluates to a valid container object. In this case, the only valid containers are the application or a document.

DrawingName

Type: String; input to the handler

The name of the drawing that has been printed.

Remarks

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_EndPlot(ByVal DrawingName As String)
    ' This example intercepts a drawing EndPlot event.
    '
    ' This event is triggered when a drawing finishes a plot request.
    '
    ' To trigger this example event: Plot an open drawing and wait for the plot to finish

    ' Use the "DrawingName" variable to determine which drawing just finished plotting
    MsgBox "A drawing has just finished a plot request!"
End Sub

Visual LISP:

Not available


EndSave Event (ActiveX)

Triggered when AutoCAD has finished saving the drawing.

Supported platforms: Windows only

Signature

VBA:

object.EndSave(Filename)
object

Type: Application

An object expression that evaluates to a valid container object. In this case, the only valid container is the application.

Filename

Type: String

The name of the file that was saved.

Remarks

The EndSave event follows the BeginSave event after AutoCAD completes the saving of the drawing.

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_EndSave(ByVal FileName As String)
    ' This example intercepts a drawing EndSave event.
    '
    ' This event is triggered when a drawing finishes a save request.
    '
    ' To trigger this example event: Save an open drawing and wait for the save to complete

    ' Use the "FileName" variable to determine where the drawing file was saved
    MsgBox "A drawing has just been saved to: " & FileName
End Sub

Visual LISP:

Not available


EndShortcutMenu Event (ActiveX)

Triggered after the shortcut menu appears.

Supported platforms: Windows only

Signature

VBA:

object.EndShortcutMenu(ShortcutMenu)
object

Type: Document

An object expression that evaluates to a valid container object. In this case, the only valid container is a document.

ShortcutMenu

Type: PopupMenu object; input/output from the handler

The shortcut menu that has been displayed.

Remarks

Use this event to perform any cleanup work on the shortcut menu.

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_EndShortcutMenu(ShortcutMenu As AutoCAD.IAcadPopupMenu)
    ' This example intercepts a drawing EndShortcutMenu event.
    '
    ' This event is triggered when the user closes a drawing shortcut menu.
    '
    ' To trigger this example event: Right click the mouse in the working area of a drawing,
    ' wait for the shortcut menu to be displayed and then dismiss the shortcut menu

    MsgBox "A shortcut menu was just closed!"
End Sub

Visual LISP:

Not available


LayoutSwitched Event (ActiveX)

Triggered after the user switches to a different layout.

Supported platforms: Windows only

Signature

VBA:

object.LayoutSwitched(LayoutName)
object

Type: Document

An object expression that evaluates to a valid container object. In this case, the only valid container is a document.

LayoutName

Type: String; input to the handler

The name of the layout the user has switched to.

Remarks

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_LayoutSwitched(ByVal LayoutName As String)
    ' This example intercepts a drawing LayoutSwitched event.
    '
    ' This event is triggered when the user switches to a different
    ' drawing layout view.
    '
    ' To trigger this example event: Open a drawing and change its layout view
    '
    ' For example: Switch the drawing from Model view to Layout1 view

    ' Use the "LayoutName" variable to determine the which layout view we changed to
    MsgBox "The drawing layout was just changed to: " & LayoutName
End Sub

Visual LISP:

Not available


LISPCancelled Event (ActiveX)

Triggered when the evaluation of a AutoLISP expression is cancelled.

Supported platforms: Windows only

Signature

VBA:

object.LISPCancelled()
object

Type: Application, Document

An object expression that evaluates to a valid container object. In this case, the only valid containers are the application and a document.

Remarks

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_LispCancelled()
    ' This example intercepts a drawing LispCancelled event.
    '
    ' This event is triggered when the evaluation of a LISP expression is cancelled.
    '
    ' To trigger this example event: Run a LISP expression and
    ' cancel the LISP evaluation before it finishes

    MsgBox "A LISP evaluation was just cancelled."
End Sub

Visual LISP:

Not available


Modified Event (ActiveX)

Triggered when an object or collection in the drawing has been modified.

Supported platforms: Windows only

Signature

VBA:

object.Modified(Entity)
object

Type: All drawing objects, Block, Blocks, Dictionaries, Dictionary, DimStyle, DimStyles, Group, Groups, Layer, Layers, Layout, Layouts, Linetype, Linetypes, Material, Materials, MLeaderStyle, ModelSpace, PaperSpace, PlotConfiguration, PlotConfigurations, RegisteredApplication, RegisteredApplications, SectionManager, SectionSettings, SectionTypeSettings, SortentsTable, TableStyle, TextStyle, TextStyles, UCS, UCSs, View, Viewport, Viewports, Views, XRecord

An object expression that evaluates to a valid container object.

Entity

Type: A Drawing Object

The object in the drawing that is modified can be any one of the drawing objects.

Remarks

This event will be triggered whenever the object is modified. Modification includes whenever the value of a property is set, even if the new value is equal to the current value.

When coding in VBA, you must provide an event handler for all objects enabled for the Modified event. If you do not provide a handler, VBA may terminate unexpectedly.

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Public WithEvents PLine As AcadLWPolyline    ' Use with Modified Event Example
Sub Example_Modified()
     ' This example creates a lightweight polyline in model space and
     ' references the PolyLine using the public variable (PLine) which
     ' is set up to intercept Modified events.
     '
     ' This example then modifies the new object, triggering the code
     ' in the Modified event.

    Dim points(0 To 9) As Double

    ' Define the 2D polyline points
    points(0) = 1: points(1) = 1
    points(2) = 1: points(3) = 2
    points(4) = 2: points(5) = 2
    points(6) = 3: points(7) = 2
    points(8) = 4: points(9) = 4

    ' Create a lightweight Polyline object in model space
    '
    ' * Note: We are returning the new PolyLine object into a Module
    ' level variable.  This allows us to intercept events associated
    ' with that particular object.
    Set PLine = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)

    ThisDrawing.Application.ZoomAll

    ' Modify object to trigger event.
    '
    ' * Note: The event code for the PolyLine modification will be triggered
    ' before we move forward and refresh the view, so the line will not
    ' appear blue when the event message box is displayed.
    Dim color As AcadAcCmColor
    Set color = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    Call color.SetRGB(80, 100, 244)
    PLine.TrueColor = color

    ThisDrawing.Regen acAllViewports

End Sub

Private Sub PLine_Modified(ByVal pObject As AutoCAD.IAcadObject)
    ' This example intercepts an object's Modified event.
    '
    ' This event is triggered when an object supporting this event is modified.
    '
    ' To trigger this code: Modify an object connected to this event
    ' * Note: By connected, we mean the object set up to intercept events using
    ' the VBA WithEvents statement

    ' Use the "pObject" variable to determine which object was modified
    MsgBox "You just modified an object with an ID of: " & pObject.ObjectID

End Sub

Visual LISP:

Not available


NewDrawing Event (ActiveX)

Triggered just before a new drawing is created.

Supported platforms: Windows only

Signature

VBA:

object.NewDrawing()
object

Type: Application

An object expression that evaluates to a valid container object. In this case, the only valid container is the application.

Remarks

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Public WithEvents ACADApp As AcadApplication    ' Use with Application Event Examples
Sub Example_AcadApplication_Events()
    ' This example intializes the public variable (ACADApp) which will be used
    ' to intercept AcadApplication Events
    '
    ' The VBA WithEvents statement makes it possible to intercept an generic object
    ' with the events associated with that object.
    '
    ' Before you will be able to trigger any of the AcadApplication events,
    ' you will first need to run this procedure.

    ' We could get the application from the ThisDocument object, but that would
    ' require having a drawing open, so we grab it from the system.
    Set ACADApp = GetObject(, "AutoCAD.Application.20")
End Sub

Private Sub ACADApp_NewDrawing()
    ' This example intercepts an Application NewDrawing event.
    '
    ' This event is triggered when a new drawing request is sent to AutoCAD.
    '
    ' To trigger this example event:
    '     1) Make sure to run the example that initializes
    '     the public variable (named ACADApp) linked to this event.
    '
    '     2) Use AutoCAD to create a new drawing using File/New

    MsgBox "A request to start a new drawing was just intercepted!"
End Sub

Visual LISP:

Not available


ObjectAdded Event (ActiveX)

Triggered when an object has been added to the drawing.

Supported platforms: Windows only

Signature

VBA:

object.ObjectAdded(Entity)
object

Type: Document

An object expression that evaluates to a valid container object. In this case, the only valid container is a document.

Entity

Type: A Drawing Object; input to the handler

The object that was added to the drawing. It can be any one of the drawing objects.

Remarks

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_ObjectAdded(ByVal Object As Object)
    ' This example intercepts a drawing ObjectAdded event.
    '
    ' This event is triggered when an object is added to a drawing.
    '
    ' To trigger this example event: Add an object to an open drawing

    ' Use the "Object" variable to determine the type of object added
    MsgBox "A " & TypeName(Object) & " was just added to the drawing!"
End Sub

Visual LISP:

Not available


ObjectErased Event (ActiveX)

Triggered when an object has been erased from the drawing.

Supported platforms: Windows only

Signature

VBA:

object.ObjectErased(ObjectID)
object

Type: Document

An object expression that evaluates to a valid container object. In this case, the only valid container is a document.

ObjectID

Type: LONG_PTR; input to the handler

The object ID of the object that was erased.

Remarks

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_ObjectErased(ByVal ObjectID As Long_PTR)
    ' This example intercepts a drawing ObjectErased event.
    '
    ' This event is triggered when an object is removed from a drawing.
    '
    ' To trigger this example event: Delete (Cut) an existing object from an open drawing

    ' Use the "Object" variable to determine the type of object removed
    MsgBox "The ID of the object deleted is: " & ObjectID

End Sub

Visual LISP:

Not available


ObjectModified Event (ActiveX)

Triggered when an object in the drawing has been modified.

Supported platforms: Windows only

Signature

VBA:

object.ObjectModified(Entity)
object

Type: Document

An object expression that evaluates to a valid container object. In this case, the only valid container is a document.

Entity

Type: Document; input to the handler

The object in the drawing that is modified. It can be any one of the drawing objects.

Remarks

This event takes place after the modification operation is complete.

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_ObjectModified(ByVal Object As Object)
    ' This example intercepts a drawing ObjectModified event.
    '
    ' This event is triggered when an object in a drawing is modified.
    '
    ' To trigger this example event: Modify an object in any open drawing

    ' Use the "Object" variable to determine the type of object modified
    MsgBox "A " & TypeName(Object) & " was just modified!"
End Sub

Visual LISP:

Not available


SelectionChanged Event (ActiveX)

Triggered when the current pickfirst selection set changes.

Supported platforms: Windows only

Signature

VBA:

object.SelectionChanged()
object

Type: Document

An object expression that evaluates to a valid container object. In this case, the only valid container is a document.

Remarks

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_SelectionChanged()
    ' This example intercepts a drawing SelectionChanged event.
    '
    ' This event is triggered when the current selection set in a drawing is modified.
    '
    ' To trigger this example event: Select or deselect objects in any open drawing

    MsgBox "The selection set in a drawing was just changed!"
End Sub

Visual LISP:

Not available


SysVarChanged Event (ActiveX)

Triggered when the value of a system variable is changed.

Supported platforms: Windows only

Signature

VBA:

object.SysVarChanged(SysVarName, NewVal)
object

Type: Application

An object expression that evaluates to a valid container object. In this case, the only valid container is the application.

SysVarName

Type: String; input to the handler

The name of the system variable whose value has changed.

NewVal

Type: Variant; input to the handler

The new value of the system variable.

Remarks

This event indicates an attempt was made to change a system variable. It does not indicate the actual value was changed. In some cases, it is possible to set a system variable without causing its value to change. For example, if FILLMODE was 0 and someone tried to set it to 0, then you would get an event for that system variable even though the call had no actual effect on the value of FILLMODE.

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Public WithEvents ACADApp As AcadApplication    ' Use with Application Event Examples
Sub Example_AcadApplication_Events()
    ' This example intializes the public variable (ACADApp) which will be used
    ' to intercept AcadApplication Events
    '
    ' The VBA WithEvents statement makes it possible to intercept an generic object
    ' with the events associated with that object.
    '
    ' Before you will be able to trigger any of the AcadApplication events,
    ' you will first need to run this procedure.

    ' We could get the application from the ThisDocument object, but that would
    ' require having a drawing open, so we grab it from the system.
    Set ACADApp = GetObject(, "AutoCAD.Application.20")
End Sub

Private Sub ACADApp_SysVarChanged(ByVal SysvarName As String, ByVal newVal As Variant)
    ' This example intercepts an Application SysVarChanged event.
    '
    ' This event is triggered when the value of a system variable is changed.
    '
    ' To trigger this example event:
    '     1) Make sure to run the example that initializes
    '     the public variable (named ACADApp) linked to this event.
    '
    '     2) Change the value of a system variable in AutoCAD.
    '     For example: Type GRIDMODE on the command line and toggle the grid display on/off

    ' Use the "SysvarName" and "newVal" variables to determine which
    ' system variable has changed and its new value.
    MsgBox "The system variable " & SysvarName & " was just changed to: " & newVal
End Sub

Visual LISP:

Not available


WindowChanged Event (ActiveX)

Triggered when there is a change to the application or document windows.

Supported platforms: Windows only

Signature

VBA:

object.WindowChanged(WindowState)
object

Type: Application, Document

An object expression that evaluates to a valid container object. In this case, the only valid containers are the application and a document.

WindowState

Type: Integer; input to the handler.

  • acMin - The window is minimized.
  • acMax - The window is maximized.
  • acNorm - The window is normal (neither minimized nor maximized).

Remarks

This event is helpful when implementing toolbars or modeless dialog boxes that track with the application or document window. The VB or ObjectARX application can use the HWNDFrame parameter to get the coordinates of the window, convert those coordinates to either screen or parent coordinates, and use this information to position other windows.

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_WindowChanged(ByVal WindowState As Long)
    ' This example intercepts a drawing WindowChanged event.
    '
    ' This event is triggered when the window state of the
    ' current drawing window is changed.
    '
    ' To trigger this example event: Change the window state of the drawing window
    '
    ' For example: Minimize or maximize the drawing window

    Dim CurrentState As String

    ' Use the "WindowState" variable to determine the new drawing window state
    Select Case WindowState
        Case acMin: CurrentState = "Minimized"
        Case acMax: CurrentState = "Maximized"
        Case acNorm: CurrentState = "Normal Size"
    End Select

    MsgBox "The drawing window is now: " & CurrentState
End Sub

Visual LISP:

Not available


WindowMovedOrResized Event (ActiveX)

Triggered just after the application or drawing window has been moved or resized.

Supported platforms: Windows only

Signature

VBA:

object.WindowMovedOrResized(HWNDFrame, bMoved)
object

Type: Application, Document

An object expression that evaluates to a valid container object. In this case, the only valid containers are the application and a document.

HWNDFrame

Type: Long_PTR; input to the handler

The application or document window frame.

bMoved

Type: Boolean; input to the handler

  • True: The window was moved.
  • False: The window was resized

Remarks

This event is helpful when implementing toolbars or modeless dialog boxes that track with the application or document window. The VB or ObjectARX application can use the HWNDFrame parameter to get the coordinates of the window, convert those coordinates to either screen or parent coordinates, and use this information to position other windows.

No events will be fired while a modal dialog is being displayed.

Examples

VBA:

Private Sub AcadDocument_WindowMovedOrResized(ByVal HWNDFrame As LONG_PTR, ByVal bMoved As Boolean)
    ' This example intercepts a drawing WindowMovedOrResized event.
    '
    ' This event is triggered when the drawing window is moved or resized
    '
    ' To trigger this example event: Move or resize the drawing window

    Dim CurrentState As String

    ' Use the "bmoved" variable to determine if we moved or sized the drawing window
    CurrentState = IIf(bMoved, "Moving", "Sizing")

    MsgBox "The drawing window appearance was changed by: " & CurrentState
End Sub

Visual LISP:

Not available


Obsolete

Topics in this section

  • GetBlockAttributeValue232

    For a 64-Bit system, gets the attribute value associated to a specified block cell. (Obsolete)

  • GetBlockAttributeValue32

    For a 64-Bit system, gets the attribute value in block content with attribute definition id. (Obsolete)

  • GetBlockTableRecordId232

    For a 64-Bit system, gets the block table record object id associated to a specified cell. (Obsolete)

  • GetBlockTableRecordId32

    For a 64-Bit system, gets a cell's block table record id. (Obsolete)

  • GetFieldId232

    For a 64-Bit system, gets a cell's field object id. (Obsolete)

  • GetFieldId32

    For a 64-Bit system, gets the field object ID of the specified cell. (Obsolete)

  • GetGridLinetype32

    For a 64-Bit system, gets the idLinetype with the gridLinetype value for the specified cell. (Obsolete)

  • GetSubEntity32

    For a 64-Bit system, gets an object or subentity interactively. (Obsolete)

  • GetTextStyleId32

    For a 64-Bit system, gets the object id for a named cell style. (Obsolete)

  • ObjectId32ToObjectIdString

    For a 64-Bit system, returns an object's ID as a string. (Obsolete)

  • ObjectIDToObject32

    Gets the object that corresponds to the given object ID for a 64-bit system. (Obsolete)

  • SetBlockAttributeValue232

    For a 64-Bit system, sets a block cell's attribute value. (Obsolete)

  • SetBlockAttributeValue32

    For a 64-Bit system, sets the attribute value for an attribute in a block contained within a MLeader or Table object. (Obsolete)

  • SetBlockTableRecordId232

    For a 64-Bit system, sets the block table record object id associated to a specified cell. (Obsolete)

  • SetBlockTableRecordId32

    For a 64-Bit system, sets a cell's block table record id. (Obsolete)

  • SetFieldId232

    For a 64-Bit system, Sets a cell's field object id. (Obsolete)

  • SetFieldId32

    Sets the field object ID of the specified cell for a 64-bit system. (Obsolete)

  • SetGridLinetype32

    For a 64-Bit system, sets an object from a cell with a specific gridLineType. (Obsolete)

  • SetTemplateId32

    For a 64-Bit system, sets a template using an object ID to the table style. (Obsolete)

  • SetTextStyleId32

    For a 64-Bit system, sets a text style using an object ID to a named cell style. (Obsolete)

  • HWND32

    Gets the window handle of the window frame for a 64-bit system. (Obsolete)

  • Key32

    The object ID of the source object in the CopyObjects operation for a 64-bit system. (Obsolete)

  • LabelBlockId32

    Returns and sets the label block ID associated with the viewport for a 64-bit system. (Obsolete)

  • LayoutID32

    Specifies the layout of the view for a 64-bit system. (Obsolete)

  • ObjectID32

    Gets the object ID for a 64-bit system. (Obsolete)

  • OwnerID32

    Gets the object ID of the owner (parent) object for 64-bit systems. (Obsolete)

  • TemplateId32

    For a 64-Bit system, specifies the template ID for the table style. (Obsolete)

  • Value32

    Specifies the current value for the property, or the object ID of the newly created cloned object, for a 64-bit system. (Obsolete)


GetBlockAttributeValue232 Method (ActiveX)

For a 64-Bit system, gets the attribute value associated to a specified block cell. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetBlockAttributeValue232(nRow, nCol, nContent, blkId)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The index of the row.

nCol

Access: Input-only

Type: Long

The index of the column.

nContent

Access: Input-only

Type: Long

The index of the content.

blkId

Access: Input-only

Type: Long

The value of the block table record.

Return Value (RetVal)

Type: String

The returned block attribute value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetBlockAttributeValue32 Method (ActiveX)

For a 64-Bit system, gets the attribute value in block content with attribute definition id. (Obsolete)

Supported platforms: Windows only

Signature - MLeader

VBA:

RetVal = object.GetBlockAttributeValue32(attdefId)
object

Type: MLeader

The object this method applies to.

attdefID

Access: Input-only

Type: Long

The attribute definition ID.

Signature - Table

VBA:

RetVal = object.GetBlockAttributeValue32(row, col, attdefId)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row in the table.

col

Access: Input-only

Type: Long

The column in the table.

attdefId

Access: Input-only

Type: Long

The attribute definition ID.

Return Value (RetVal)

Type: String

The attribute value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Blockttribute()
    ' This example creates an MLeader object and gets and sets values for
    ' the block attribute type.

    Dim points(0 To 5) As Double

    points(0) = 0: points(1) = 4: points(2) = 0
    points(3) = 1.5: points(4) = 5: points(5) = 0

    Dim i As Long

    Dim oML As AcadMLeader
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    oML.ContentType = acBlockContent
    oML.ContentBlockType = acBlockBox

    Dim sBlock As String

    sBlock = oML.ContentBlockName

    Dim o As AcadEntity
    For Each o In ThisDrawing.Blocks(sBlock)
        If o.ObjectName = "AcDbAttributeDefinition" Then
            oML.SetBlockAttributeValue o.ObjectID, "123"
            MsgBox oML.GetBlockAttributeValue(o.ObjectID)
        End If
    Next o

    Update
    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_BlockAttribute()
    ;; This example creates an MLeader object and gets and sets values for
    ;; the block attribute type.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(0 4 0
                                              1.5 5 0
                                             )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (vla-put-ContentType oML acBlockContent)
    (vla-put-ContentBlockType oML acBlockBox)

    (setq sBlock (vla-get-ContentBlockName oML))

    (vlax-for o (vla-Item (vla-get-Blocks doc) sBlock)
        (if (= (vla-get-ObjectName o) "AcDbAttributeDefinition")
               (progn
                (vla-SetBlockAttributeValue oML (vla-get-ObjectID o) "123")
                (alert (vla-GetBlockAttributeValue oML (vla-get-ObjectID o)))
               )
        )
    )

    (vla-Update acadObj)
    (vla-ZoomExtents acadObj)
)


GetBlockTableRecordId232 Method (ActiveX)

For a 64-Bit system, gets the block table record object id associated to a specified cell. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetBlockTableRecordId232(nRow, nCol, nContent)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value of the cell.

Return Value (RetVal)

Type: Long

The pointer to hold the block table record object id.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetBlockTableRecordId32 Method (ActiveX)

For a 64-Bit system, gets a cell's block table record id. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetBlockTableRecordId32(row, col)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Integer

The row in the table.

col

Access: Input-only

Type: Integer

The column in the table.

Return Value (RetVal)

Type: Long

The pointer to hold the block table record object id.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetFieldId232 Method (ActiveX)

For a 64-Bit system, gets a cell's field object id. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetFieldId232(nRow, nCol, nContent)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value of the cell.

Return Value (RetVal)

Type: Long

The field object id.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetFieldId32 Method (ActiveX)

For a 64-Bit system, gets the field object ID of the specified cell. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetFieldId32(row, col)
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

Return Value (RetVal)

Type: Long

The field object id.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetGridLinetype32 Method (ActiveX)

For a 64-Bit system, gets the idLinetype with the gridLinetype value for the specified cell. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetGridLinetype32(nRow, nCol, nGridLineType)
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Integer

The row number of the cell to set.

nCol

Access: Input-only

Type: Integer

The column number of the cell to set.

nGridLineType

Access: Input-only

Type: AcGridLineType enum

The grid line type to check.

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight

Return Value (RetVal)

Type: Long

The object id of the Linetype from the cell.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


GetSubEntity32 Method (ActiveX)

For a 64-Bit system, gets an object or subentity interactively. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.GetSubEntity32 Object, PickedPoint, TransMatrix, ContextData [, Prompt]
object

Type: Utility

The object this method applies to.

Object

Access: Output-only

Type: Object

The picked object or subentity. Can be one of any of the drawing objects.

PickedPoint

Access: Output-only

Type: Variant (three-element array of doubles)

A 3D WCS coordinate specifying the point that was selected.

TransMatrix

Access: Output-only

Type: Variant (4x4 array of doubles)

The translation matrix applied to this entity.

ContextData

Access: Output-only

Type: Variant (array of longs)

An array of object IDs for any nested objects in the selected object.

Prompt

Access: Input-only; optional

Type: Variant (string)

The text to display to prompt the user for input.

Return Value (RetVal)

No return value.

Remarks

This method requires the AutoCAD user to select an object by picking a point on the graphics screen. If an object or subentity is picked, it is returned in the first parameter, and the second parameter will contain the point picked in WCS coordinates. If the pick point is not on an object the method will fail.

This method can retrieve an object even if it is not visible on the screen or if it is on a frozen layer.

Examples

VBA:

Sub Example_GetSubEntity()
    ' This example prompts the user to select on object on the screen with a mouse click,
    ' and returns some information about the selected object.

    AppActivate ThisDrawing.Application.Caption

    Dim Object As Object
    Dim PickedPoint As Variant, TransMatrix As Variant, ContextData As Variant
    Dim HasContextData As String

    On Error GoTo NOT_ENTITY

TRYAGAIN:

    MsgBox "Use the mouse to click on an object in the current drawing after dismissing this dialog box."

    ' Get information about selected object
    ThisDrawing.Utility.GetSubEntity Object, PickedPoint, TransMatrix, ContextData

    ' Process and display selected object properties
    HasContextData = IIf(VarType(ContextData) = vbEmpty, " does not ", " does ")

    MsgBox "The object you chose was an: " & TypeName(Object) & vbCrLf & _
            "Your point of selection was: " & PickedPoint(0) & ", " & _
                                              PickedPoint(1) & ", " & _
                                              PickedPoint(2) & vbCrLf & _
            "This object" & HasContextData & "have nested objects."

    Exit Sub

NOT_ENTITY:
    ' If you click on empty space or do not select an entity,
    ' this error will be generated
    If MsgBox("You have not selected an object.  Click OK to try again.", _
               vbOKCancel & vbInformation) = vbOK Then
        Resume TRYAGAIN
    End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetSubEntity()
    ;; This example prompts the user to select on object on the screen with a mouse click,
    ;; and returns some information about the selected object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Get information about selected object
    (vla-GetSubEntity (vla-get-Utility doc) 'Object 'PickedPoint 'TransMatrix 'ContextData "Select a subentity: ")

    ;; Process and display selected object properties
    (if (/= ContextData nil)
        (setq HasContextData " does ")
        (setq HasContextData " does not ")
    )

    (alert (strcat "The object you chose was an: " (vla-get-ObjectName Object)
                   "\nYour point of selection was: " (rtos (vlax-safearray-get-element PickedPoint 0) 2) ", "
                                                           (rtos (vlax-safearray-get-element PickedPoint 1) 2) ", "
                                                           (rtos (vlax-safearray-get-element PickedPoint 2) 2)
                   "\nThis object" HasContextData "have nested objects."))
)


GetTextStyleId32 Method (ActiveX)

For a 64-Bit system, gets the object id for a named cell style. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetTextStyleId32(bstrCellStyle)
object

Type: TableStyle

The object this method applies to.

bstrCellStyle

Access: Input-only

Type: String

The named cell style.

Return Value (RetVal)

Type: Long

The object id of the named text style.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ObjectId32ToObjectIdString Method (ActiveX)

For a 64-Bit system, returns an object's ID as a string. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

RetVal = Object.ObjectId32ToObjectIdString(ObjectID32)
object

Type: Utility

The object this method applies to.

ObjectID32

Access: Input-only

Type: Long

The object ID to return as a string.

Return Value (RetVal)

Type: String

The object ID as a string.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


ObjectIDToObject32 Method (ActiveX)

Gets the object that corresponds to the given object ID for a 64-bit system. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

RetVal = object.ObjectIDToObject32(ID)
object

Type: Database, Document

The objects this method applies to.

ID

Access: Input-only

Type: Long

The object ID of the object to return.

Return Value (RetVal)

Type: Object

The object that corresponds to the given object ID.

Remarks

This method can return only objects that are in the current document.

Examples

VBA:

Sub Example_ObjectIDToObject()
    ' This example creates a spline in model space, and returns the
    ' handle for the spline. Then the spline is returned from the handle and colored.

    ' Create the spline
    Dim splineObj As AcadSpline
    Dim startTan(0 To 2) As Double
    Dim endTan(0 To 2) As Double
    Dim fitPoints(0 To 8) As Double

    startTan(0) = 0.5: startTan(1) = 0.5: startTan(2) = 0
    endTan(0) = 0.5: endTan(1) = 0.5: endTan(2) = 0
    fitPoints(0) = 1: fitPoints(1) = 1: fitPoints(2) = 0
    fitPoints(3) = 5: fitPoints(4) = 5: fitPoints(5) = 0
    fitPoints(6) = 10: fitPoints(7) = 0: fitPoints(8) = 0
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)

    ZoomAll

    Dim objectID As Long
    objectID = splineObj.ObjectID
    MsgBox "The objectID of the Spline is: " & objectID, , "ObjectIDToObject Example"

    ' Find an object from a given objectID
    Dim tempObj As AcadObject
    Set tempObj = ThisDrawing.ObjectIdToObject(objectID)

    ' Now use the newly initialized object variable to color the object
    Dim color As AcadAcCmColor
    Set color = AcadApplication.GetInterfaceObject("AutoCAD.AcCmColor.20")
    color.SetRGB 80, 100, 244

    tempObj.TrueColor = color

    ThisDrawing.Regen True
    MsgBox "The Spline is now blue.", , "ObjectIDToObject Example"

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ObjectIDToObject()
    ;; This example creates a spline in model space, and returns the
    ;; handle for the spline. Then the spline is returned from the handle and colored.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the spline
    (setq startTan (vlax-3d-point 0.5 0.5 0)
          endTan (vlax-3d-point 0.5 0.5 0)
          fitPoints (vlax-make-safearray vlax-vbDouble '(0 . 8)))
    (vlax-safearray-fill fitPoints '(1 1 0
                                     5 5 0
                     10 0 0
                    )
    )

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)

    ;; Find the objectID of the spline
    (setq objectID (vla-get-objectID splineObj))
    (alert (strcat "The objectID of the Spline is: " (itoa objectID)))

    ;; Find an object from a given objectID
    (setq tempObj (vla-ObjectIDToObject doc objectID))

    ;; Now use the newly initialized object variable to color the object
    (setq color (vlax-create-object "AutoCAD.AcCmColor.20"))
    (vla-SetRGB color 80 100 244)

    (vla-put-TrueColor tempObj color)

    (vla-Regen doc :vlax-true)
    (alert "The Spline is now blue.")
    (vlax-release-object color)
)


SetBlockAttributeValue232 Method (ActiveX)

For a 64-Bit system, sets a block cell's attribute value. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.SetBlockAttributeValue232 nRow, nCol, nContent, blkId, value
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value of the cell.

blkId

Access: Input-only

Type: Long

The block table record object id to check.

value

Access: Input-only

Type: String

The attribute value to set.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetBlockAttributeValue32 Method (ActiveX)

For a 64-Bit system, sets the attribute value for an attribute in a block contained within a MLeader or Table object. (Obsolete)

Supported platforms: Windows only

Signature - MLeader

VBA:

object.SetBlockAttributeValue32 attdefId, value
object

Type: MLeader

The object this method applies to.

attdefID

Access: Input-only

Type: Long

The attribute definition ID.

value

Access: Input-only

Type: String

The new attribute value.

Signature - Table

VBA:

object.SetBlockAttributeValue32 row, col, attdefId, StringValue
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The row in the table.

col

Access: Input-only

Type: Long

The column in the table.

attdefId

Access: Input-only

Type: Long

The object ID of the attribute definition.

StringValue

Access: Input-only

Type: String

The attribute value.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_Blockttribute()
    ' This example creates an MLeader object and gets and sets values for
    ' the block attribute type.

    Dim points(0 To 5) As Double

    points(0) = 0: points(1) = 4: points(2) = 0
    points(3) = 1.5: points(4) = 5: points(5) = 0

    Dim i As Long

    Dim oML As AcadMLeader
    Set oML = ThisDrawing.ModelSpace.AddMLeader(points, i)

    oML.ContentType = acBlockContent
    oML.ContentBlockType = acBlockBox

    Dim sBlock As String

    sBlock = oML.ContentBlockName

    Dim o As AcadEntity
    For Each o In ThisDrawing.Blocks(sBlock)
        If o.ObjectName = "AcDbAttributeDefinition" Then
            oML.SetBlockAttributeValue o.ObjectID, "123"
            MsgBox oML.GetBlockAttributeValue(o.ObjectID)
        End If
    Next o

    Update
    ZoomExtents

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_BlockAttribute()
    ;; This example creates an MLeader object and gets and sets values for
    ;; the block attribute type.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(0 4 0
                                  1.5 5 0
                                 )
    )
    (setq i 0)

    (setq modelSpace (vla-get-ModelSpace doc))
    (setq oML (vla-AddMLeader modelSpace points i))

    (vla-put-ContentType oML acBlockContent)
    (vla-put-ContentBlockType oML acBlockBox)

    (setq sBlock (vla-get-ContentBlockName oML))

    (vlax-for o (vla-Item (vla-get-Blocks doc) sBlock)
        (if (= (vla-get-ObjectName o) "AcDbAttributeDefinition")
               (progn
                (vla-SetBlockAttributeValue oML (vla-get-ObjectID o) "123")
                (alert (vla-GetBlockAttributeValue oML (vla-get-ObjectID o)))
               )
        )
    )

    (vla-Update acadObj)
    (vla-ZoomExtents acadObj)
)


SetBlockTableRecordId232 Method (ActiveX)

For a 64-Bit system, sets the block table record object id associated to a specified cell. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.SetBlockTableRecordId232 nRow, nCol, nContent, blkId, autoFit
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value of the cell.

blkId

Access: Input-only

Type: Long

The block table record object id to set.

autoFit

Access: Input-only

Type: Boolean

  • True: The block is set to auto fit the cell.
  • False: The block is not set to auto fit the cell.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetBlockTableRecordId32 Method (ActiveX)

For a 64-Bit system, sets a cell's block table record id. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.SetBlockTableRecordId32 row, col, blkId, bAutoFit
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

blkId

Access: Input-only

Type: Long

The block table record object id to set in the cell.

bAutoFit

Access: Input-only

Type: Boolean

  • True: The block is set to auto fit the cell.
  • False: The block is not set to auto fit the cell.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetFieldId232 Method (ActiveX)

For a 64-Bit system, Sets a cell's field object id. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.SetFieldId232 nRow, nCol, nContent, acDbObjectId, nflag
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nContent

Access: Input-only

Type: Long

The content value of the cell.

acDbObjectId

Access: Input-only

Type: Long

The field object id to set.

nflag

Access: Input-only

Type: AcCellOption enum

The cell inheritance flag.

  • kCellOptionNone
  • kInheritCellFormat

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetFieldId32 Method (ActiveX)

Sets the field object ID of the specified cell for a 64-bit system. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.SetFieldId32 row, col, fieldId
object

Type: Table

The object this method applies to.

row

Access: Input-only

Type: Long

The zero-based row index for the cell.

col

Access: Input-only

Type: Long

The zero-based column index for the cell.

fieldId

Access: Input-only

Type: Long

The field object ID.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetGridLinetype32 Method (ActiveX)

For a 64-Bit system, sets an object from a cell with a specific gridLineType. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.SetGridLinetype32 nRow, nCol, nGridLineType, idLinetype
object

Type: Table

The object this method applies to.

nRow

Access: Input-only

Type: Long

The row number of the cell to set.

nCol

Access: Input-only

Type: Long

The column number of the cell to set.

nGridLineType

Access: Input-only

Type: AcGridLineType enum

The grid linetypes to change.

  • acHorzBottom
  • acHorzInside
  • acHorzTop
  • acInvalidGridLine
  • acVertInside
  • acVertLeft
  • acVertRight
idLinetype

Access: Input-only

Type: Long

The point which references the new linetype.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetTemplateId32 Method (ActiveX)

For a 64-Bit system, sets a template using an object ID to the table style. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.SetTemplateId32 val, option
object

Type: TableStyle

The object this method applies to.

val

Access: Input-only

Type: Long

The object ID to a template.

option

Access: Input-only

Type: AcMergeCellStyleOption enum

The merge cell style to use when applying the template.

  • acMergeCellStyleCopyDuplicates
  • acMergeCellStyleConvertDuplicatesToOverrides
  • acMergeCellStyleIgnoreNewStyles
  • acMergeCellStyleNone
  • acMergeCellStyleOverwriteDuplicates

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


SetTextStyleId32 Method (ActiveX)

For a 64-Bit system, sets a text style using an object ID to a named cell style. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.SetTextStyleId32 bstrCellStyle, val
object

Type: TableStyle

The object this method applies to.

bstrCellStyle

Access: Input-only

Type: String

The named cell style to modify.

val

Access: Input-only

Type: Long

The object ID of the text style being to assign to the named cell style.

Return Value (RetVal)

No return value.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


HWND32 Property (ActiveX)

Gets the window handle of the window frame for a 64-bit system. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.HWND32
object

Type: Application, Document

The objects this property applies to.

Property Value

Read-only: Yes

Type: Long

The handle of the window frame.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_HWND32()
    ' This example returns the handle (Hwnd32) of a document window. The handle can be
    ' used with WindowsAPI calls, or with ActiveX components that require a handle
    ' to a window.

    ' If there are no open documents, then exit
    If Documents.Count = 0 Then
        MsgBox "There are no open documents!"
        Exit Sub
    End If

    MsgBox "The HWND32 of the active document is: " & ActiveDocument.HWND32
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_HWND32()
    ;; This example returns the handle (Hwnd32) of a document window. The handle can be
    ;; used with WindowsAPI calls, or with ActiveX components that require a handle
    ;; to a window.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (alert (strcat "The HWND32 of the active document is: " (itoa (vla-get-HWND32 doc))))
)


Key32 Property (ActiveX)

The object ID of the source object in the CopyObjects operation for a 64-bit system. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.Key32
object

Type: IDPair

The object this property applies to.

Property Value

Read-only: Yes

Type: Long

The object ID of the source object.

Remarks

Use the Value32 property to get the object ID of the newly created cloned object.

Examples

VBA:

Sub Example_Key()
    ' This example creates two Circle objects and uses the CopyObjects
    ' method to copy them. It then returns the
    ' object IDs of the source objects using the Key property and uses these
    ' values to remove the original (source) objects

    Dim circleObj1 As AcadCircle, circleObj2 As AcadCircle
    Dim circleObj1Copy As AcadCircle, circleObj2Copy As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius1 As Double, radius2 As Double
    Dim radius1Copy As Double, radius2Copy As Double
    Dim objCollection(0 To 1) As Object
    Dim retObjects As Variant
    Dim IDPairs As Variant
    Dim SourceObject As AcadObject

    ' Define the Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    radius1 = 5#: radius2 = 7#
    radius1Copy = 1#: radius2Copy = 2#

    ' Add two circles to the drawing
    Set circleObj1 = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius1)
    Set circleObj2 = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius2)
    ThisDrawing.Application.ZoomAll

    ' Copy objects
    '
    ' First put the objects to be copied into a form compatible with CopyObjects
    Set objCollection(0) = circleObj1
    Set objCollection(1) = circleObj2

    ' Copy object and get back a collection of the new objects (copies)
    retObjects = ThisDrawing.CopyObjects(objCollection, , IDPairs)

    ' Get newly created object and apply new properties to the copies
    Set circleObj1Copy = retObjects(0)
    Set circleObj2Copy = retObjects(1)

    circleObj1Copy.radius = radius1Copy
    circleObj2Copy.radius = radius2Copy

    ThisDrawing.Application.ZoomAll
    ThisDrawing.Regen acAllViewports

    ' Display the object IDs of the source objects used for the copy
    MsgBox "The first source object ID is: " & IDPairs(0).key & vbCrLf & _
           "The second source object ID is: " & IDPairs(1).key

    ' This key can be used with objectIDtoObject to reference the source objects,
    ' which is handy if the user manually selected the source objects.
    '
    ' Delete the source objects from the ID obtained
    Set SourceObject = ThisDrawing.ObjectIdToObject(IDPairs(0).key)
    SourceObject.Delete
    Set SourceObject = ThisDrawing.ObjectIdToObject(IDPairs(1).key)
    SourceObject.Delete

    ThisDrawing.Regen acAllViewports

    MsgBox "The source objects have just been deleted!", vbInformation
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Key()
    ;; This example creates two Circle objects and uses the CopyObjects
    ;; method to copy them. It then returns the
    ;; object IDs of the source objects using the Key property and uses these
    ;; values to remove the original (source) objects
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Circle object
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius1 5
          radius2 7
          radius1Copy 1
          radius2Copy 2)

    ;; Add two circles to the drawing
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj1 (vla-AddCircle modelSpace centerPoint radius1))
    (setq circleObj2 (vla-AddCircle modelSpace centerPoint radius2))
    (vla-ZoomAll acadObj)

    ;; Copy objects
    ;;
    ;; First put the objects to be copied into a form compatible with CopyObjects
    (setq objCollection (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element objCollection 0 circleObj1)
    (vlax-safearray-put-element objCollection 1 circleObj2)

    ;; Copy object and get back a collection of the new objects (copies)
    (setq retObjects (vlax-variant-value (vla-CopyObjects doc objCollection nil 'IDPairs)))

    ;; Get newly created object and apply new properties to the copies
    (setq circleObj1Copy (vlax-safearray-get-element retObjects 0))
    (setq circleObj2Copy (vlax-safearray-get-element retObjects 1))

    (vla-put-Radius circleObj1Copy radius1Copy)
    (vla-put-Radius circleObj2Copy radius2Copy)

    (vla-ZoomAll acadObj)
    (vla-Regen doc acAllViewports)

    ;; Display the object IDs of the source objects used for the copy
    (alert (strcat "The first source object ID is: " (itoa (vla-get-Key (vlax-safearray-get-element IDPairs 0)))
                   "\nThe second source object ID is: " (itoa (vla-get-Key (vlax-safearray-get-element IDPairs 1)))))

    ;; This key can be used with objectIDtoObject to reference the source objects,
    ;; which is handy if the user manually selected the source objects.
    ;;
    ;; Delete the source objects from the ID obtained
    (setq SourceObject (vla-ObjectIdToObject doc (vla-get-Key (vlax-safearray-get-element IDPairs 0))))
    (vla-Delete SourceObject)
    (setq SourceObject (vla-ObjectIdToObject doc (vla-get-Key (vlax-safearray-get-element IDPairs 1))))
    (vla-Delete SourceObject)

    (vla-Regen doc acAllViewports)

    (alert "The source objects have just been deleted!")
)


LabelBlockId32 Property (ActiveX)

Returns and sets the label block ID associated with the viewport for a 64-bit system. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.LabelBlockId32
object

Type: PViewport

The object this property applies to.

Property Value

Read-only: No

Type: Long

The label block ID associated with the viewport.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


LayoutID32 Property (ActiveX)

Specifies the layout of the view for a 64-bit system. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.LayoutID32
object

Type: View

The object this property applies to.

Property Value

Read-only: Yes

Type: Long

The ObjectID of the layout.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_LayoutID32()
    ' This example demonstrates the
    ' CategoryName, LayoutID32, LayerState,
    ' and HasVpAssociation properties of the View object

    Dim oLSM As AcadLayerStateManager

    ' Access the LayerStateManager object
    Set oLSM = ThisDrawing.Application. _
       GetInterfaceObject("AutoCAD.AcadLayerStateManager.20")

    ' Associate the current drawing database with LayerStateManager
    oLSM.SetDatabase ThisDrawing.Database

    oLSM.Save "ColorLinetype", acLsColor + acLsLineType

    ' Create a view named "New_View" in current drawing
    Dim viewObj As AcadView

    ' Add the view to the views collection
    Set viewObj = ThisDrawing.Views.Add("New_View")
    MsgBox viewObj.Name & " has been added." & vbCrLf & _
           "Height: " & viewObj.Height & vbCrLf & _
           "Width: " & viewObj.Width, , "Example"

    viewObj.CategoryName = "My View Category"
    viewObj.LayerState = "My Layer State"

    viewObj.LayoutId32 = ThisDrawing.Layouts(1).ObjectID32

    MsgBox viewObj.CategoryName & " is the Category name." & vbCrLf & _
            viewObj.LayoutId32 & " is the Layout ID." & vbCrLf & _
            viewObj.LayerState & " is the Layer state."

    If viewObj.HasVpAssociation = True Then
        MsgBox "The view is associated with a paper space viewport."
    Else
        MsgBox "The view is not associated with a paper space viewport."

   End If
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_LayoutID32()
    ;; This example demonstrates the
    ;; CategoryName, LayoutId32, LayerState,
    ;; and HasVpAssociation properties of the View object
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Access the LayerStateManager object
    (setq oLSM (vla-GetInterfaceObject acadObj "AutoCAD.AcadLayerStateManager.20"))

    ;; Associate the current drawing database with LayerStateManager
    (vla-SetDatabase oLSM (vla-get-Database doc))

    (vla-Save oLSM "ColorLinetype" (+ acLsColor acLsLineType))

    ;; Create a view named "New_View" in current drawing
    ;; Add the view to the views collection
    (setq viewObj (vla-Add (vla-get-Views doc) "New_View"))
    (alert (strcat (vla-get-Name viewObj) " has been added."
                   "\nHeight: " (rtos (vla-get-Height viewObj) 2)
                   "\nWidth: " (rtos (vla-get-Width viewObj) 2)))

    (vla-put-CategoryName viewObj "My View Category")
    (vla-put-LayerState viewObj "ColorLinetype")

    (vla-put-LayoutId32 viewObj (vla-get-ObjectID32 (vla-Item (vla-get-Layouts doc) 1)))

    (alert (strcat (vla-get-CategoryName viewObj) " is the Category name."
                   "\n" (itoa (vla-get-LayoutId viewObj)) " is the Layout ID."
                   "\n" (vla-get-LayerState viewObj) " is the Layer state."))

    (if (= (vla-get-HasVpAssociation viewObj) :vlax-true)
        (alert "The view is associated with a paper space viewport.")
        (alert "The view is not associated with a paper space viewport.")
    )

    (vlax-release-object oLSM)
)


ObjectID32 Property (ActiveX)

Gets the object ID for a 64-bit system. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.ObjectID32
object

Type: All Drawing objects, AttributeReference, Block, Blocks, Dictionary, Dictionaries, Dimension, DimStyle, DimStyles, Group, Groups, Layer, Layers, Layout, Layouts, Linetype, Linetypes, Material, Materials, MLeaderStyle, ModelSpace, PaperSpace, PlotConfiguration, PlotConfigurations, RegisteredApplication, RegisteredApplications, SectionManager, SectionSettings, SortentsTable, TableStyle, TextStyle, TextStyles, UCS, UCSs, View, Views, Viewport, Viewports, XRecord

The objects this property applies to.

Property Value

Read-only: Yes

Type: Long

The object ID of an object.

Remarks

An object ID and a unique handle are both ways of referencing an object.

In general, use a handle unless you plan to work with certain ObjectARX functions that require an object ID.

Examples

VBA:

Sub Example_ObjectID32()
    ' This example creates several objects in model space.
    ' It then iterates through model space and displays the
    ' ObjectID for each object found.

    ' Create a Ray object in model space
    Dim rayObj As AcadRay
    Dim basePoint(0 To 2) As Double
    Dim SecondPoint(0 To 2) As Double
    basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0#
    SecondPoint(0) = 1#: SecondPoint(1) = 3#: SecondPoint(2) = 0#
    Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, SecondPoint)

    ' Create a Polyline object in model space
    Dim plineObj As AcadLWPolyline
    Dim points(0 To 5) As Double
    points(0) = 3: points(1) = 7
    points(2) = 9: points(3) = 2
    points(4) = 3: points(5) = 5
    Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
    plineObj.Closed = True

    ' Create a Line object in model space
    Dim lineObj As AcadLine
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    startPoint(0) = 0: startPoint(1) = 0: startPoint(2) = 0
    endPoint(0) = 2: endPoint(1) = 2: endPoint(2) = 0
    Set lineObj = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint)

    ' Create a Circle object in model space
    Dim circObj As AcadCircle
    Dim centerPt(0 To 2) As Double
    Dim radius As Double
    centerPt(0) = 5: centerPt(1) = 3: centerPt(2) = 0
    radius = 3
    Set circObj = ThisDrawing.ModelSpace.AddCircle(centerPt, radius)

    ' Create an Ellipse object in model space
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)

    ZoomAll

    ' Iterate through the model space collection and display
    ' the ObjectID32 of each object found.
    Dim entObjectID32 As Long
    Dim entry As AcadEntity

    For Each entry In ThisDrawing.ModelSpace
        entObjectID32 = entry.ObjectID32
        entry.Highlight (True)
        MsgBox "The ObjectID of this object is " & entObjectID32, vbInformation, "ObjectID32 Example"
        entry.Highlight (False)
    Next
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_ObjectID32()
    ;; This example creates several objects in model space.
    ;; It then iterates through model space and displays the
    ;; ObjectID for each object found.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq modelSpace (vla-get-ModelSpace doc))

    ;; Create a Ray object in model space
    (setq basePoint (vlax-3d-point 3 3 0)
          secondPoint (vlax-3d-point 1 3 0))
    (setq rayObj (vla-AddRay modelSpace basePoint SecondPoint))

    ;; Create a Polyline object in model space
    (setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
    (vlax-safearray-fill points '(3 7
                                  9 2
                  3 5
                 )
    )
    (setq plineObj (vla-AddLightWeightPolyline modelSpace points))
    (vla-put-Closed plineObj :vlax-true)

    ;; Create a Line object in model space
    (setq startPoint (vlax-3d-point 0 0 0)
          endPoint (vlax-3d-point 2 2 0))
    (setq lineObj (vla-AddLine modelSpace startPoint endPoint))

    ;; Create a Circle object in model space
    (setq centerPt (vlax-3d-point 5 3 0)
          radius 3)
    (setq circObj (vla-AddCircle modelSpace centerPt radius))

    ;; Create an Ellipse object in model space
    (setq center (vlax-3d-point 5 5 0)
          majAxis (vlax-3d-point 10 20 0)
          radRatio 0.3)
    (setq ellObj (vla-AddEllipse modelSpace center majAxis radRatio))

    (vla-ZoomAll acadObj)

    ;; Iterate through the model space collection and display
    ;; the ObjectID32 of each object found.
    (vlax-for entry (vla-get-ModelSpace doc)
        (setq entObjectID32 (vla-get-objectID32 entry))
        (vla-Highlight entry :vlax-true)
        (alert (strcat "The ObjectID of this object is " (itoa entObjectID32)))
        (vla-Highlight entry :vlax-false)
    )
)


OwnerID32 Property (ActiveX)

Gets the object ID of the owner (parent) object for 64-bit systems. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.OwnerID32
object

Type: All Drawing objects, AttributeReference, Block, Blocks, Dictionary, Dictionaries, Dimension, DimStyle, DimStyles, Group, Groups, Layer, Layers, Layout, Layouts, Linetype, Linetypes, Material, Materials, MLeaderStyle, ModelSpace, PaperSpace, PlotConfiguration, PlotConfigurations, RegisteredApplication, RegisteredApplications, SectionManager, SectionSettings, SortentsTable, TableStyle, TextStyle, TextStyles, UCS, UCSs, View, Views, Viewport, Viewports, XRecord

The objects this property applies to.

Property Value

Read-only: Yes

Type: Long

The object ID of an object's owner.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_OwnerID32()
    ' This example creates an MText object in model space
    ' and then finds the OwnerID for the object.

    Dim MTextObj As AcadMText
    Dim corner(0 To 2) As Double
    Dim width As Double
    Dim text As String
    corner(0) = 0#: corner(1) = 10#: corner(2) = 0#
    width = 10
    text = "This is the text string for the MText object"

    ' Creates the MText object
    Set MTextObj = ThisDrawing.ModelSpace.AddMText(corner, width, text)
    ZoomAll

    MsgBox "The OwnerID for the MText object is: " & MTextObj.OwnerID32

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_OwnerID32()
    ;; This example creates an MText object in model space
    ;; and then finds the OwnerID for the object.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (setq corner (vlax-3d-point 0 10 0)
          width 10
          text "This is the text string for the MText object")

    ;; Creates the MText object
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq MTextObj (vla-AddMText modelSpace corner width text))
    (vla-ZoomAll acadObj)

    (alert (strcat "The OwnerID for the MText object is: " (itoa (vla-get-OwnerID32 MTextObj))))
)


TemplateId32 Property (ActiveX)

For a 64-Bit system, specifies the template ID for the table style. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.TemplateId32
object

Type: TableStyle

The object this property applies to.

Property Value

Read-only: No

Type: Long

The template ID for the table style.

Remarks

No additional remarks.

Examples

VBA:

Not available

Visual LISP:

Not available


Value32 Property (ActiveX)

Specifies the current value for the property, or the object ID of the newly created cloned object, for a 64-bit system. (Obsolete)

Supported platforms: Windows only

Signature

VBA:

object.Value32
object

Type: IDPair

The object this property applies to.

Property Value

Read-only: Yes

Type: Long

The object ID of the newly created cloned object in the CopyObjects operation.

Remarks

Use the Key32 property to get the object ID of the source object.

Examples

VBA:

Sub Example_Value()
    ' This example creates two Circle objects and uses the CopyObjects
    ' method to copy them. It then returns the object IDs
    ' of the new objects using the Value property and uses the
    ' object IDs to remove the new (target) objects

    Dim circleObj1 As AcadCircle, circleObj2 As AcadCircle
    Dim circleObj1Copy As AcadCircle, circleObj2Copy As AcadCircle
    Dim centerPoint(0 To 2) As Double
    Dim radius1 As Double, radius2 As Double
    Dim radius1Copy As Double, radius2Copy As Double
    Dim objCollection(0 To 1) As Object
    Dim retObjects As Variant
    Dim IDPairs As Variant
    Dim TargetObject As AcadObject

    ' Define the Circle object
    centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0
    radius1 = 5#: radius2 = 7#
    radius1Copy = 1#: radius2Copy = 2#

    ' Add two circles to the drawing
    Set circleObj1 = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius1)
    Set circleObj2 = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius2)
    ThisDrawing.Application.ZoomAll

    ' Copy objects
    '
    ' First put the objects to be copied into a form compatible with CopyObjects
    Set objCollection(0) = circleObj1
    Set objCollection(1) = circleObj2

    ' Copy object and get back a collection of the new objects (copies)
    retObjects = ThisDrawing.CopyObjects(objCollection, , IDPairs)

    ' Get newly created object and apply new properties to the copies
    Set circleObj1Copy = retObjects(0)
    Set circleObj2Copy = retObjects(1)

    circleObj1Copy.radius = radius1Copy
    circleObj2Copy.radius = radius2Copy

    ThisDrawing.Application.ZoomAll
    ThisDrawing.Regen acAllViewports

    ' Display the object IDs of the source objects used for the copy
    MsgBox "The first target object ID is: " & IDPairs(0).Value & vbCrLf & _
           "The second target object ID is: " & IDPairs(1).Value

    ' This key can be used with objectIDtoObject to reference the source objects,
    ' which is useful if the user manually selected the source objects.
    '
    ' Here we delete the source objects from the ID obtained
    Set TargetObject = ThisDrawing.ObjectIdToObject(IDPairs(0).Value)
    TargetObject.Delete
    Set TargetObject = ThisDrawing.ObjectIdToObject(IDPairs(1).Value)
    TargetObject.Delete

    ThisDrawing.Regen acAllViewports

    MsgBox "The target objects have been deleted!", vbInformation
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Value()
    ;; This example creates two Circle objects and uses the CopyObjects
    ;; method to copy them. It then returns the object IDs
    ;; of the new objects using the Value property and uses the
    ;; object IDs to remove the new (target) objects
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Define the Circle object
    (setq centerPoint (vlax-3d-point 0 0 0)
          radius1 5
          radius2 7
          radius1Copy 1
          radius2Copy 2)

    ;; Add two circles to the drawing
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq circleObj1 (vla-AddCircle modelSpace centerPoint radius1))
    (setq circleObj2 (vla-AddCircle modelSpace centerPoint radius2))
    (vla-ZoomAll acadObj)

    ;; Copy objects
    ;;
    ;; First put the objects to be copied into a form compatible with CopyObjects
    (setq objCollection (vlax-make-safearray vlax-vbObject '(0 . 1)))
    (vlax-safearray-put-element objCollection 0 circleObj1)
    (vlax-safearray-put-element objCollection 1 circleObj2)

    ;; Copy object and get back a collection of the new objects (copies)
    (setq retObjects (vlax-variant-value (vla-CopyObjects doc objCollection nil 'IDPairs)))

    ;; Get newly created object and apply new properties to the copies
    (setq circleObj1Copy (vlax-safearray-get-element retObjects 0))
    (setq circleObj2Copy (vlax-safearray-get-element retObjects 1))

    (vla-put-Radius circleObj1Copy radius1Copy)
    (vla-put-Radius circleObj2Copy radius2Copy)

    (vla-ZoomAll acadObj)
    (vla-Regen doc acAllViewports)

    ;; Display the object IDs of the source objects used for the copy
    (alert (strcat "The first target object ID is: " (itoa (vla-get-Value (vlax-safearray-get-element IDPairs 0)))
                   "\nThe second target object ID is: " (itoa (vla-get-Value (vlax-safearray-get-element IDPairs 1)))))

    ;; This key can be used with objectIDtoObject to reference the source objects,
    ;; which is useful if the user manually selected the source objects.
    ;;
    ;; Here we delete the source objects from the ID obtained
    (setq TargetObject (vla-ObjectIdToObject doc (vla-get-Value (vlax-safearray-get-element IDPairs 0))))
    (vla-Delete TargetObject)
    (setq TargetObject (vla-ObjectIdToObject doc (vla-get-Value (vlax-safearray-get-element IDPairs 1))))
    (vla-Delete TargetObject)

    (vla-Regen doc acAllViewports)

    (alert "The target objects have been deleted!")
)


Comments?

Using this form sends your comments to the Autodesk Technical Publications group responsible for this documentation.

Topic title and location (do not edit):
Name (optional):
         Email (optional):
Comments:

Note: This form is not intended as a way for you to receive feedback or technical support. The information you provide will be used to enhance future updates to the documentation. Thanks!


IDH__DACADAPPLICATIONEVENTS_INTERFACE=GUID-208C641B-DDA2-40F6-89D7-DAA70AF64325.htm
IDH__DACADDOCUMENTEVENTS_INTERFACE=GUID-7888B99C-BE13-4ECD-A4F1-E2F349B78D55.htm
IDH_3DFACE_OBJECT=GUID-1DAB32FC-8C8A-4116-BD3A-CF733740DF8F.htm
IDH_3DPOLY_OBJECT=GUID-896C0FBC-6558-40BE-AD84-8F8BCC6BA62A.htm
IDH_3DSOLID_OBJECT=GUID-4EC0355F-A91B-4ADA-A346-05CCCD22259B.htm
IDH_ACADSTATE_OBJECT=GUID-0516563E-51BA-4040-A51A-06D4AB7C6188.htm
IDH_ACCMCOLOR_OBJECT=GUID-D24C6BB5-5F87-42E7-907F-F27226B330E3.htm
IDH_APPLICATION_OBJECT=GUID-0225808C-8C91-407B-990C-15AB966FFFA8.htm
IDH_ARC_OBJECT=GUID-3D31C05F-BFF7-41E3-8ACE-0F807731C913.htm
IDH_ATTRIBUTE_OBJECT=GUID-E24E7CA0-0120-4C55-BADB-46D701B8D4CB.htm
IDH_ATTRIBUTEREF_OBJECT=GUID-0630EFF2-51A2-46E4-A5A1-0377FB7E38E8.htm
IDH_BLOCK_OBJECT=GUID-E6F7B03B-F5CC-4A18-9C48-BBF1D32A31FD.htm
IDH_BLOCKREF_OBJECT=GUID-88EEBCA3-8AF5-4776-9D54-520B05AB9129.htm
IDH_BLOCKS_COLLECTION=GUID-E77CC5AD-74B8-472C-8270-32FD162D5653.htm
IDH_CIRCLE_OBJECT=GUID-18ADF171-166F-4FF0-8ED6-5F83153A5649.htm
IDH_DATABASE_OBJECT=GUID-31D8D654-572D-4D2B-A138-4D8793ECE135.htm
IDH_DATABASEPREFERENCES_OBJECT=GUID-B03F622D-9D1D-4149-A170-1DF2AC62DA37.htm
IDH_DGNUNDERLAY_OBJECT=GUID-70DBB31B-E1D1-4D8C-928C-B274E0D63E66.htm
IDH_DICTIONARIES_COLLECTION=GUID-C04BFB8A-8FDF-4D9E-8C0F-E1D2226FEC8A.htm
IDH_DICTIONARY_OBJECT=GUID-9FF18AA0-4E48-4F92-AC0D-FBBD4225D347.htm
IDH_DIM3POINTANGULAR_OBJECT=GUID-1EF38BC6-8057-4F4A-95BC-0624544A248F.htm
IDH_DIMALIGNED_OBJECT=GUID-38EB1E39-B67A-4B90-A394-5C3FA260F9F3.htm
IDH_DIMANGULAR_OBJECT=GUID-C832CDC5-59AA-466F-B4BA-EFC133834A1E.htm
IDH_DIMARCLENGTH_OBJECT=GUID-BAB6D518-BE01-494A-A8AC-8645A99369CE.htm
IDH_DIMDIAMETRIC_OBJECT=GUID-181A4644-B053-49D6-BB3C-35158B8794C3.htm
IDH_DIMORDINATE_OBJECT=GUID-35CE0F15-A136-4878-AEDC-FADC193E7ED2.htm
IDH_DIMRADIAL_OBJECT=GUID-037CC1EC-8183-49B3-9F51-69AE8B282CC4.htm
IDH_DIMRADIALLARGE_OBJECT=GUID-E44150ED-D643-4BC5-AD6B-E4724A109DA5.htm
IDH_DIMROTATED_OBJECT=GUID-93D19CB2-9A1F-4324-BD49-D241FD009C3C.htm
IDH_DIMSTYLE_OBJECT=GUID-3227408C-75A9-434C-BD3F-B189A2BE098A.htm
IDH_DIMSTYLES_COLLECTION=GUID-46478963-D723-44E1-92F2-3E28384E64EA.htm
IDH_DOCUMENT_OBJECT=GUID-9216BFCD-D358-4FC6-B631-B52E6693D242.htm
IDH_DOCUMENTS_COLLECTION=GUID-2C8C8291-16C9-4A9F-8399-58D5DE4B9589.htm
IDH_DWFUNDERLAY_OBJECT=GUID-1205069A-A64A-4E21-9B9A-3EAF58F2EF26.htm
IDH_DYNAMICBLOCKREFERENCEPROPERTY_OBJECT=GUID-ED753239-0C53-4741-BE13-99B21751C22F.htm
IDH_ELLIPSE_OBJECT=GUID-85D3077C-DAE6-4BB7-BB69-E8A8BD10FEA5.htm
IDH_EXTERNALREFERENCE_OBJECT=GUID-63129986-F84E-4674-8C90-EC1E0E627845.htm
IDH_EXTRUDEDSURFACE_OBJECT=GUID-03E55664-0EBE-4EF5-A51C-B0806FA5DC3C.htm
IDH_FILEDEPENDENCY=GUID-C18BBD6D-44DD-4AC6-B712-B613A8788251.htm
IDH_GROUP_OBJECT=GUID-1CA2C9D1-F8F7-4C11-B361-2998C4869119.htm
IDH_GROUPS_COLLECTION=GUID-B6B9B72E-31BC-41E0-B06B-17B1EE33FFB0.htm
IDH_HATCH_OBJECT=GUID-92A2B30F-1B74-4894-850A-5505F3B5944B.htm
IDH_HELIX_OBJECT=GUID-A8B144D8-EFC1-4D2D-B6F8-73C541906646.htm
IDH_HYPERLINK_OBJECT=GUID-6F5F717A-F3ED-453B-B59A-E10D89153591.htm
IDH_HYPERLINKS_COLLECTION=GUID-D92E9BFF-F5A0-49EC-9262-93EAD73F4780.htm
IDH_IACADDATABASE_INTERFACE=GUID-DEB4B47D-4ED8-49EB-8739-8902B6219622.htm
IDH_IACADDIMENSION_INTERFACE=GUID-A9836239-6EF2-4BB8-8F49-2CBD32675DD2.htm
IDH_IACADENTITY_INTERFACE=GUID-FCA7867D-E354-4F48-9C47-DB22C53A3460.htm
IDH_IACADOBJECT_INTERFACE=GUID-1C457D0A-9933-4A74-B3E9-A7F3483B3F34.htm
IDH_IACADOBJECTEVENTS_INTERFACE=GUID-62DB50E4-EE2E-479E-8489-3E8B59FD3131.htm
IDH_IDPAIR_OBJECT=GUID-0A0BD12B-1A83-47D9-9E4E-2F83213D5026.htm
IDH_LAYER_OBJECT=GUID-14F28A52-81E5-4CD0-AA79-ADC09E91BB8C.htm
IDH_LAYERS_COLLECTION=GUID-D9F62B4B-401E-4AE6-969F-3F7756819EB6.htm
IDH_LAYERSTATEMANAGER=GUID-930152BE-F356-44CF-8BD1-7121E9886157.htm
IDH_LAYOUT_OBJECT=GUID-EFC848F1-26BE-4EFA-BC0E-11F874D73842.htm
IDH_LAYOUTS_COLLECTION=GUID-0C5AF331-03C4-472B-BD30-78C8310822A2.htm
IDH_LEADER_OBJECT=GUID-E1EC4A71-6FC0-4B76-AD53-4DE561D6EE46.htm
IDH_LIGHTWEIGHTPOLYLINE_OBJECT=GUID-5A604B98-B6DE-42C3-97D9-98B8CAEBB507.htm
IDH_LINE_OBJECT=GUID-2A2C2B78-3B64-4083-A8EC-984DB223053F.htm
IDH_LINETYPE_OBJECT=GUID-16016CA5-0126-403B-844B-F6CABE117B50.htm
IDH_LINETYPES_COLLECTION=GUID-968A3D1F-8DEF-4B8B-8067-0B756A622D97.htm
IDH_LOFTEDSURFACE_OBJECT=GUID-D56F5C92-731E-4FA3-9FAE-82E97E388901.htm
IDH_MATERIAL_OBJECT=GUID-A7E5AA1A-D3C3-4AA3-A751-97768628D96C.htm
IDH_MATERIALS_OBJECT=GUID-4BC04C70-B2B0-4325-8042-CAD81F9058F1.htm
IDH_MENUBAR_OBJECT=GUID-AC709260-4F3A-4EC0-A542-78D0B43342F7.htm
IDH_MENUGROUP_OBJECT=GUID-3DA607BC-1868-4C64-AF79-7E24F30B58EA.htm
IDH_MENUGROUPS_COLLECTION=GUID-AAD2CED1-F82B-44E5-98C9-937A4F3BD2D9.htm
IDH_MINSERTBLOCK_OBJECT=GUID-0F4669CB-6769-4F40-A24F-7658FBD41518.htm
IDH_MLEADER_OBJECT=GUID-95FD33C2-DF78-4014-933C-9AC124E6A35D.htm
IDH_MLEADERSTYLE_OBJECT=GUID-14AC2D0B-EBFC-44B9-982D-9112539F8DE8.htm
IDH_MLINE_OBJECT=GUID-D91098F2-83AB-41A7-B9F8-929871B438FC.htm
IDH_MODELSPACE_COLLECTION=GUID-C541B6F2-1279-4D1C-8DC0-788F27F644EF.htm
IDH_MTEXT_OBJECT=GUID-2532B20E-413D-4F59-9E88-B40E8AABB9FF.htm
IDH_NURBSURFACE_OBJECT=GUID-5F16F644-F61B-45AC-BB3D-AF8221336072.htm
IDH_OLE_OBJECT=GUID-F22B8915-FE51-4650-A738-95C81019064E.htm
IDH_PAPERSPACE_COLLECTION=GUID-C5E998B5-6EB1-459A-98B1-444C74DB4516.htm
IDH_PDFUNDERLAY_OBJECT=GUID-54DEC47A-5FBB-4E9F-B206-502785568E91.htm
IDH_PLANESURFACE_OBJECT=GUID-8979D4B7-F581-4623-B66F-1FC24BA2CDC3.htm
IDH_PLOT_OBJECT=GUID-0A01876A-13D5-4938-8BEE-7712FD7C12CF.htm
IDH_PLOTCONFIGURATION_OBJECT=GUID-AF404266-C40A-4FB4-B4E0-1D1C83052B6D.htm
IDH_PLOTCONFIGURATIONS_COLLECTION=GUID-7337ECFB-B538-4C5D-AB7F-BD3C2F255B81.htm
IDH_POINT_OBJECT=GUID-B7F38E33-911A-4285-BCFC-EFB5F8EE260D.htm
IDH_POINTCLOUD_OBJECT=GUID-5142F98A-F959-4107-AF76-28813152F04C.htm
IDH_POLYFACEMESH_OBJECT=GUID-679AA72F-7A2F-468D-A2D5-E3F28425C35A.htm
IDH_POLYGONMESH_OBJECT=GUID-AEE2A5BA-D35B-4C92-881B-2B327F656B93.htm
IDH_POLYLINE_OBJECT=GUID-35D9E28C-38A8-477A-AFCE-F21952092190.htm
IDH_POPUPMENU_OBJECT=GUID-9075A49A-5E89-4489-B5D4-0749A833CB19.htm
IDH_POPUPMENUITEM_OBJECT=GUID-8ACA3C83-3640-44A8-9A5F-122DADBD180C.htm
IDH_POPUPMENUS_COLLECTION=GUID-041CC42A-EEAB-4686-B186-69C801CE8460.htm
IDH_PREFERENCES_OBJECT=GUID-D4DC625F-555F-4DD4-A60B-FC86A8CD55C0.htm
IDH_PREFERENCESDISPLAY_OBJECT=GUID-140B9E57-C5F3-4EFF-884B-6C11CD8DDDB0.htm
IDH_PREFERENCESDRAFTING_OBJECT=GUID-4429EDB1-FB82-4339-88D3-F2B6807255D3.htm
IDH_PREFERENCESFILES_OBJECT=GUID-539ADB58-295E-4BF1-A0CB-D104163409F9.htm
IDH_PREFERENCESOPENSAVE_OBJECT=GUID-00DB1AF2-D4B0-45ED-B89A-A30A8702DB09.htm
IDH_PREFERENCESOUTPUT_OBJECT=GUID-55D3071F-86C0-4974-B972-397C7D3DF78D.htm
IDH_PREFERENCESPROFILES_OBJECT=GUID-EE065355-4343-4954-8C5F-04E2BA87891F.htm
IDH_PREFERENCESSELECTION_OBJECT=GUID-413CD115-ED98-469E-AE74-7BB106D03C77.htm
IDH_PREFERENCESSYSTEM_OBJECT=GUID-F3EEF084-D027-4E12-B3F7-83B34E81D6EA.htm
IDH_PREFERENCESUSER_OBJECT=GUID-B5C4EB12-9316-4D21-A808-FA5337404E3B.htm
IDH_PVIEWPORT_OBJECT=GUID-63DF4686-8A79-4A39-8247-4A3565F31FAA.htm
IDH_RASTER_OBJECT=GUID-3613CF3F-EFC6-4E20-B875-D66B0494B94F.htm
IDH_RAY_OBJECT=GUID-365768B5-3A4E-4340-AA17-8FCA291BA87C.htm
IDH_REGION_OBJECT=GUID-DFE47717-F7AF-443B-AD78-4E0BB60121C7.htm
IDH_REGISTEREDAPP_OBJECT=GUID-62AD8980-F707-4906-8640-B3C54E9FC3F4.htm
IDH_REGISTEREDAPPS_COLLECTION=GUID-606BE79B-6E2C-4BAB-BFF7-F54B7167F96C.htm
IDH_REVOLVEDSURFACE_OBJECT=GUID-DD54DF69-8424-488B-BD7B-7642AD1D379F.htm
IDH_SECTION_OBJECT=GUID-5242921B-1A1B-47DF-B9B7-2932DB5227AA.htm
IDH_SECTIONMANAGER_OBJECT=GUID-A64E22B8-26B4-4D5F-89C7-C8E077F86BEC.htm
IDH_SECTIONSETTINGS_OBJECT=GUID-72C22774-0C07-4B54-8760-65ADCFC228DD.htm
IDH_SECTIONTYPESETTINGS_OBJECT=GUID-034FBB08-5E8B-48BD-AAAF-E18A9BCAE1D8.htm
IDH_SECURITYPARAMS=GUID-5DB358E5-F631-4172-8E70-04FD26AC4460.htm
IDH_SELECTIONSET_OBJECT=GUID-BF264239-CF7D-4BC8-8D37-69477862DB5A.htm
IDH_SELECTIONSETS_COLLECTION=GUID-5B8DDC53-D4CD-4121-B58D-66B48D343A24.htm
IDH_SHADOWDISPLAY_INTERFACE=GUID-38FA2CF6-BFAF-4A5C-8B16-EC6B22C43E62.htm
IDH_SHAPE_OBJECT=GUID-14883954-9C4B-4B8F-AC0C-4B44940B5932.htm
IDH_SOLID_OBJECT=GUID-1B207FF4-E441-4B3B-A677-BD5FE8CC479D.htm
IDH_SORTENTSTABLE_OBJECT=GUID-258B72FF-B29A-45D2-B972-B1776D9112A7.htm
IDH_SPLINE_OBJECT=GUID-B8FC11E4-3F6B-40CE-8AEC-D4CF669086A3.htm
IDH_SUBDMESH_OBJECT=GUID-B1E2F826-917B-4844-B1C1-E87E487F2AE4.htm
IDH_SUBDMESHEDGE_OBJECT=GUID-4F2C59C1-7FAB-4909-B03F-D522C23DD204.htm
IDH_SUBDMESHFACE_OBJECT=GUID-BEC1E125-5969-40AC-A1EF-8E3F035D4A74.htm
IDH_SUBDMESHVERTEX_OBJECT=GUID-5396D2DC-D68B-4EEC-AB57-602361BD7EEE.htm
IDH_SUBENTITY_OBJECT=GUID-66654E1B-7AAF-4FB0-ADFE-04A5CD6B81DB.htm
IDH_SUBENTSOLIDEDGE_OBJECT=GUID-3ED9DEF8-07A0-4BCD-B2BE-FD1537333044.htm
IDH_SUBENTSOLIDFACE_OBJECT=GUID-34B05634-08F5-4227-8FC1-298A8C0271DD.htm
IDH_SUBENTSOLIDNODE_OBJECT=GUID-71C9E9A5-3E76-4242-9177-3F8A6464822D.htm
IDH_SUBENTSOLIDVERTEX_OBJECT=GUID-0F2250AA-F112-43F1-8553-26DA71CBB44B.htm
IDH_SUMMARYINFO_OBJECT=GUID-A029FB49-B0DB-43E4-8888-698E1BF49878.htm
IDH_SURFACE_OBJECT=GUID-98BC3DD3-F913-494C-8559-EAFA0DDEFE3E.htm
IDH_SWEPTSURFACE_OBJECT=GUID-2E70AE24-0C8F-4124-84F2-F20A94EA6AF2.htm
IDH_TABLE_OBJECT=GUID-7B82400C-53D0-4D1A-94FA-66BB3040F0AA.htm
IDH_TABLESTYLE_OBJECT=GUID-409A6709-D3D9-4D7D-AC60-163444D58FBA.htm
IDH_TEXT_OBJECT=GUID-ED298AC7-19E0-4E54-8983-48439EF70116.htm
IDH_TEXTSTYLE_OBJECT=GUID-0531335D-26F3-404B-A4E1-1DE70BF0A307.htm
IDH_TEXTSTYLES_COLLECTION=GUID-22FC4F30-F03C-4D9C-83DE-FEAEB7135D7F.htm
IDH_TOLERANCE_OBJECT=GUID-89AF1685-5ACA-44F2-B741-D4C957C887F0.htm
IDH_TOOLBAR_OBJECT=GUID-5D9BE04E-A84F-48E9-AFB6-7C0BCAD3D0C1.htm
IDH_TOOLBARITEM_OBJECT=GUID-3148AF99-A0CD-4C4E-8680-0A7731959BC9.htm
IDH_TOOLBARS_COLLECTION=GUID-E3B81587-A244-4437-869D-A7C242B9A732.htm
IDH_TRACE_OBJECT=GUID-7113C9E5-6875-4ABB-A4DC-68F6C09C4D7D.htm
IDH_UCS_OBJECT=GUID-42778889-C568-4ABF-9CFA-63CC0D781794.htm
IDH_UCSS_COLLECTION=GUID-C7B1383E-9E7B-46AD-B821-0906421194E5.htm
IDH_UTILITY_OBJECT=GUID-DE118C17-4567-48CF-8EFA-CABB52A27275.htm
IDH_VIEW_OBJECT=GUID-1B9C7D36-0905-4C20-84C5-53714379B811.htm
IDH_VIEWPORT_OBJECT=GUID-2B609059-6B70-4C66-A442-F5917363462A.htm
IDH_VIEWPORTS_COLLECTION=GUID-5C011DBD-1D92-4DF6-B0D5-9C12CD913273.htm
IDH_VIEWS_COLLECTION=GUID-786FCD2B-E5F8-4BFA-B69F-F871AF4503CA.htm
IDH_IACADWIPEOUT_INTERFACE=GUID-C978B807-6636-4DE4-AC63-7ACFF232B9EB.htm
IDH_XLINE_OBJECT=GUID-A223EA11-306F-4685-AE56-72DC8D21CB46.htm
IDH_XRECORD_OBJECT=GUID-AF9C01F7-5BD9-4AF8-AB63-F58A997A5258.htm
IDH_APPACTIVATE=GUID-FA52F3C0-FE4E-4F35-A6AE-C2BAA1912031.htm
IDH_APPDEACTIVATE=GUID-EC60EA71-090D-4D96-B951-9465D877F97F.htm
IDH_ARXLOADED=GUID-726449E4-E027-4260-BD6F-1C0D4E27D065.htm
IDH_ARXUNLOADED=GUID-B30E5068-B18A-4179-B253-23FD4CC01894.htm
IDH_BEGINCLOSE=GUID-0B1114C2-35FD-4689-B031-62D489FF8A7E.htm
IDH_BEGINDOCCLOSE=GUID-EE0D8F0D-1132-4BCE-A68F-7125B97E737F.htm
IDH_BEGINDOUBLECLICK=GUID-0BBE54CD-0C3C-49E3-8F43-02C8D3219ED4.htm
IDH_BEGINFILEDROP=GUID-D14A002C-60EF-493A-A8FA-696B12F05D3D.htm
IDH_BEGINLISP=GUID-CF0D87BB-1E41-4F82-B007-409F794EC8EB.htm
IDH_BEGINMODAL=GUID-1A32712E-B2AB-4159-95F3-8C95BC22AB7F.htm
IDH_BEGINOPEN=GUID-BD420830-798B-4023-BD33-E1442D71D800.htm
IDH_BEGINPLOT=GUID-286CEEB9-3F3B-40AC-B148-E02335B74270.htm
IDH_BEGINQUIT=GUID-5315845E-EC1F-4D03-AAAB-D9E08EB0873D.htm
IDH_BEGINRIGHTCLICK=GUID-6AF4DAD7-96EF-4CFB-9FC5-43F0F017F5CA.htm
IDH_BEGINSAVE=GUID-E34B6863-298A-40A3-AA8F-327F5C5DACF0.htm
IDH_BEGINSHORTCUTMENUCOMMAND=GUID-B125BE98-E80D-41EE-A281-E2E8DFC4968E.htm
IDH_BEGINSHORTCUTMENUDEFAULT=GUID-5DF17EEA-9276-4E14-8FF3-96F738F7ED8D.htm
IDH_BEGINSHORTCUTMENUEDIT=GUID-D993E595-B28A-4486-956C-3B1B7583F6DB.htm
IDH_BEGINSHORTCUTMENUGRIP=GUID-6E178381-061D-48FB-95C9-3D077AB1A1EF.htm
IDH_BEGINSHORTCUTMENUOSNAP=GUID-A244B425-3107-4F3B-97C6-229FCA1286EA.htm
IDH_DEACTIVATE=GUID-22750180-C69B-42BB-9895-F865797D753C.htm
IDH_ENDCOMMAND=GUID-54741B8A-2A8F-46CC-B62C-1DAA182E7174.htm
IDH_ENDLISP=GUID-A6EA78E5-C0FC-4E71-9223-24E30C32E217.htm
IDH_ENDMODAL=GUID-B834BF42-B242-40EC-9093-2D830C62F71F.htm
IDH_ENDOPEN=GUID-1AEC7F00-981A-4517-A830-37CA653D336A.htm
IDH_ENDPLOT=GUID-BC920EE5-A616-449B-A8E4-9CAF0E588306.htm
IDH_ENDSAVE=GUID-D72C232D-82D9-4C63-9808-9E8CFE514B36.htm
IDH_ENDSHORTCUTMENU=GUID-8F40A4D3-75DF-4DC6-BC63-8E927A049641.htm
IDH_LAYOUTSWITCHED=GUID-32909BB0-81E6-4E41-816D-8B0C1EAB608F.htm
IDH_MODIFIED=GUID-5EF65D7D-F5B4-48FE-A9F6-CD5F7CF3C54B.htm
IDH_NEWDRAWING=GUID-2204099A-0E75-4FA9-93B9-2FC997916682.htm
IDH_OBJECTERASED=GUID-7A8EB01B-B793-46CC-A369-FD9B4DD98022.htm
IDH_OBJECTMODIFIED=GUID-554BCA2C-19B5-4445-95E4-5624FE7F290A.htm
IDH_SELECTIONCHANGED=GUID-2C0AED20-1D9A-41F9-B62A-467C6E16E6C7.htm
IDH_SYSVARCHANGED=GUID-275C46E6-15AA-4086-84F9-D4836E96C049.htm
IDH_WINDOWCHANGED=GUID-EADD41ED-CEB1-4D2D-A7F2-710863289795.htm