Query.Execute method

AutoCAD Map 3D ActiveX

Query.Execute method

Executes the current query.

Execute As Boolean

Returns True on success.

The following example executes a query and calls the Application.ZoomExtents to display the query results. Before running this code, attach a drawing.

Dim amap As AcadMap

Dim prj As Project

Dim qry As Query

Dim mainqrybr As QueryBranch

Dim qrylf As QueryLeaf

Dim boolVal As Boolean

 

Set amap = ThisDrawing.Application. _

GetInterfaceObject("AutoCADMap.Application") 

Set prj = amap.Projects(ThisDrawing)

Set qry = prj.CurrQuery

qry.Clear

Set mainqrybr = qry.QueryBranch

Set qrylf = mainqrybr.Add(kLocationCondition, kOperatorAnd)

boolVal = qrylf.SetLocationCond(kLocationInside, _

prj.MapUtil.NewLocationAll) 

qry.Mode = kQueryDraw

boolVal = qry.Define(mainqrybr)

boolVal = qry.Execute

ThisDrawing.Application.ZoomExtents