ade_qryexecute

AutoCAD Map 3D AutoLISP

Up a level
ade_qryexecute
 
 

Executes the current query.

(ade_qryexecute)

Returns the number of queried objects (real). If none, it returns 0.0.

Executing a query makes a new selection set of the queried objects if the "MkSelSetWithQryObj" option is turned on, as follows:

(ade_prefsetval "MkSelSetWithQryObj" T)

The query runs slower in this case because of the extra work involved.

The following code captures the ID of a selection set created by executing the current query.

(ade_prefsetval "MkSelSetWithQryObj" T)
(if (> (ade_qryexecute) 0.0)
    (setq queried_objects (ssget "P"))
    (princ "\nNo objects found.")
)
(ade_prefsetval "MkSelSetWithQryObj" nil)

The "P" argument in the ssget call identifies the "previous" selection set (the objects currently or most recently selected).

Note  Whenever you create a selection set, you replace the previous selection set. Make sure you know which objects you are getting.