AttachedDrawing.Extents property

AutoCAD Map 3D ActiveX

AttachedDrawing.Extents property

Read Only

Extents As Variant

Returns the attached drawing's extents as an array of four Doubles.

Coordinates are returned in the following order: MinX, MinY, MaxX, MaxY. The extents of the attached drawing is the smallest rectangle that encompasses all the objects in it. (MinX, MinY) is the lower-left corner, and (MaxX, MaxY) is the upper right.

The attached drawing must be active when you use this property.

The following code is an excerpt from a larger example. The code shows how to create the main branch of a query of all objects within the extents of the attached drawing. For the entire example, click .

Dim amap As AcadMap

Dim prj As Project

Dim qry As Query

Dim mainqrybr As QueryBranch

Dim qrylf As QueryLeaf

Dim mapu As MapUtil

Dim wind As WindowBound

Dim boolVal As Boolean

Dim dblary As Variant

 

Set amap = ThisDrawing.Application. _

GetInterfaceObject("AutoCADMap.Application") 

Set prj = amap.Projects(ThisDrawing)

Set qry = prj.CurrQuery

 

Set mainqrybr = qry.QueryBranch

Set qrylf = mainqrybr.Add(kLocationCondition, kOperatorAnd)

dblary = prj.DrawingSet.Item("MAPTUT:\\citymap7.dwg").Extents

Set mapu = prj.MapUtil

Set wind = mapu.NewWindow( _

mapu.NewPoint3d(dblary(0), dblary(1), 0), _ 

mapu.NewPoint3d(dblary(2), dblary(3), 0)) 

boolVal = qrylf.SetLocationCond(kLocationInside, wind)