QueryReport.Remove method

AutoCAD Map 3D ActiveX

QueryReport.Remove method

Removes an expression from a report template.

Remove(ExpNumber As Long) As Boolean

Returns True on success.

ExpNumber

The index number, or position, of the expression to remove, starting at 0.

The following example removes the .LAYER expression from the report template.

Dim amap As AcadMap

Dim prj As Project

Dim atdr As AttachedDrawing

Dim qry As Query

Dim qrybr As QueryBranch

Dim qrylf As QueryLeaf

Dim qryrp As QueryReport

Dim exp As Expression

Dim exp2 As Expression

Dim i As Integer

 

Set amap = ThisDrawing.Application. _

GetInterfaceObject("AutoCADMap.Application") 

Set prj = amap.Projects(ThisDrawing)

Set atdr = prj.DrawingSet.Add("MAPTUT:\\citymap7.dwg")

Set qry = prj.CurrQuery

qry.Clear

Set qrybr = qry.QueryBranch

Set qrylf = qrybr.Add(kLocationCondition, kOperatorAnd)

qrylf.SetLocationCond kLocationInside, prj.MapUtil.NewLocationAll

Set qryrp = prj.CurrQuery.Report

Set exp = qryrp.Add(".LENGTH")

Set exp2 = qryrp.Add(".LAYER")

prj.CurrQuery.Report.ReportFileName = "MyReport.txt"

qry.Mode = kQueryReport

For i = 0 To qryrp.Count - 1

If qryrp.Item(i).Value = ".LAYER" Then 

qryrp.Remove (i) 

Exit For 

End If 

Next i

qry.Define qrybr

qry.Execute