The AutoCADET's Guide to Visual LISP: Optimize and Customize Your AutoCAD Design Environment

Chapter 13: Using Selection Sets and Tables

In this chapter, you explore groups of entities or related information. There are basically two kinds of data in this regard: data that you want to use temporarily and discard when finished, and data that must stay so that it can be referenced from other locations in the drawing database. A selection set is a temporary grouping of entity objects. A block, which is defined in the block table, is a more permanent grouping of entity objects.

Using Selection Sets

A selection set is a specific data type in Visual LISP known as a PICKSET. AutoCAD operators use selection sets all the time in commands such as MOVE, COPY, and ROTATE. Whenever AutoCAD prompts to Select objects, you are building a selection set.

You can create a selection-set object in Visual LISP in several ways. You can use the SSADD subr by itself and create an empty selection set. For example, the (SETQ SS1 (SSADD)) expression creates a new, empty selection set referenced by the SS1 symbol. You can use SSADD also to add entities one at a time to a selection set by providing the entity name values as parameters along with the existing selection-set reference.

Listing 13.1 is a simple function that builds a selection set by reading through a drawing looking for specific entities. (Note that this task can be performed using a better approach; this listing is provided only as a simple example.)

Listing 13.1: Searching for...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Mesh Generators
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.