ade_qrysave

AutoCAD Map 3D AutoLISP

Up a level
ade_qrysave
 
 

Saves the current query.

(ade_qrysave catname qryparams)

Returns a query ID or nil.

catname Category name (string). The category is created if it does not exist.
qryparams List of a-lists, each composed of an information type and a value. See the Information Types table below.
Information Types
name Query name (string)
description Query description (string)
qtype How the query is saved (integer): 1 = internal (default), 2 = external.
filename For an external query, full path name (string).
saveoption Bit code for the save options you are choosing (integer). See the Save Options table below.

The function saves the current query to the project's query library or to a file.

  • A query saved to the query library is called an internal query.
  • A query saved to a file is called an external query.

You must specify a category name and a query name. In a project, no two queries can have the same name, even if they are saved in different categories. The default value for a description is the same as the query name. The default value for the storage type is internal. If you want to save the query externally, you must specify a file name for it.

Save Options
 1 Keep reference in query library.
 2 Save list of active drawings.
 4 Save location coordinates.
 8 Save current property alteration definition.
16 Execute automatically.

A query gets a name and an ID only if it is referenced the query library. A new query that you have not yet saved does not have a name or an ID, and neither does an external query unless you keep a reference to it in the query library.

The following example saves the current query to the query library without saving it to a file.

(ade_qrysave "CATEGORY1"
  '( ("name" . "QUERY1")
     ("saveoption" . 2)
   )
)

The expression saves the query in CATEGORY1 and names it QUERY1. Because there is no "qtype" list element, it saves the query internally by default, which eliminates the need for a "filename" element.

The following example saves the current query to the query library and also to a file.

(ade_qrysave "CATEGORY1"  
  '(  ("name" .  "QUERY1")  
      ("description" . "Query1 description")  
      ("qtype" . 2)  
      ("filename" . "c:\\qryfiles\\Query1.qry")  
      ("saveoption" . 3) 
   ) 
)