QueryCategories.Item method

AutoCAD Map 3D ActiveX

QueryCategories.Item method

Gets a query category from the library.

Item(Index As Variant) As QueryCategory

Returns the query category.

Index

Name or index, starting at 0, of the category to get

The following example shows how to set a saved query to the member of the QueryCategories collection you want to load, call Load, and execute the loaded query. Before running this code, attach a drawing, and save a query in the query library by running the Query.Save example. To go to Query.Save, click .

Dim amap As AcadMap

Dim prj As Project

Dim qry As Query

Dim mainqrybr As QueryBranch

Dim qrylf As QueryLeaf

Dim boolVal As Boolean

Dim i As Integer, cqryct As Integer

Dim j As Integer, cqry As Integer

Dim sqry As SavedQuery

 

Set amap = ThisDrawing.Application. _

GetInterfaceObject("AutoCADMap.Application") 

Set prj = amap.Projects(ThisDrawing)

prj.CurrQuery.Clear

For i = 0 To prj.QueryCategories.Count - 1

If prj.QueryCategories(i).Name = "DrawingCategory" Then 

cqryct = i 

End If 

Next i

For j = 0 To prj.QueryCategories.Item(cqryct).Count - 1

If prj.QueryCategories.Item(cqryct).Item(j).Name = "myInternalquery" Then 

cqry = j 

End If 

Next j

Set sqry = prj.QueryCategories.Item(cqryct).Item(cqry)

boolVal = prj.CurrQuery.Load(sqry)

boolVal = prj.CurrQuery.Execute

ThisDrawing.Application.ZoomExtents