Sets or replaces the query's main branch.
Define(QueryBranch As QueryBranch) As Boolean
Returns True on success.
QueryBranch
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)