Query.Define method

AutoCAD Map 3D ActiveX

Query.Define method

Sets or replaces the query's main branch.

Define(QueryBranch As QueryBranch) As Boolean

Returns True on success.

QueryBranch

The main branch of a query.

Note To prevent an error, call Query.Define before attempting to use Query.StringContext.

The following example shows the minimal code for setting up and defining a query. Before running this code, attach a drawing.

Dim amap As AcadMap

Dim prj As Project

Dim qry As Query

Dim qrybr 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

Set qrybr = qry.QueryBranch

Set qrylf = qrybr.Add(kLocationCondition, kOperatorAnd)

boolVal = qrylf.SetLocationCond(kLocationInside, _

prj.MapUtil.NewLocationAll) 

qry.Mode = kQueryDraw

boolVal = qry.Define(qrybr)