QueryReport.Add method

AutoCAD Map 3D ActiveX

QueryReport.Add method

Adds an expression to the report template.

Add(Expression As String) As Expression

Returns an expression.

Expression

A string expression, evaluated when a query executes.

The following example adds two expressions to a template that produce a report listing the length and layer of each queried object.

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

 

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

qry.Define qrybr

qry.Execute