AutoCAD 2002 Bible

Скачать в pdf «AutoCAD 2002 Bible»

For example, you could enter the following in a new drawing:

(command «_circle» «3,3» «2») nil

(command «_circle» «4,4» «3») nil

(command «_line» «7,2» «6,6» «3,4» «5,5……)


(setq mysset (ssget))

Select objects: all J 5 found

Select objects: J <Selection set 1>

Now mysset is set to the selection set specified by all, which includes the three lines segments and the two circles. To see what you have in your selection set, type the following either on the command line or in the Visual LISP Console:

(sslength mysset)


You now know that you have five objects in your selection set. The first object is number 0, and the fifth object is number 4. To see what the first object is, enter the following:

(ssname mysset 0)

<Entity name: 3fe0550>

To get the database data on the object, enter:

(entget (ssname mysset 0))

Visual LISP responds:

((-1 . <Entity name: 1601580>) (0 . «LINE») (330 . <Entity name: 16014f8>)(5 . «30») (100 . «AcDbEntity») (67 . 0) (410 . «Model») (8 . «0»)(100 . «AcDbLine») (10 3.0 4.0 0.0)

(11 5.0 5.0 0.0) (210 0.0 0.0 1.0))

By stepping through each of the entity names returned by ssname from 0 to 4, you can manipulate each of the objects in the selection set.

Quicklsp is a reference chart of AutoLISP functions that you might find helpful. Look in SoftwareChap35Quicklsp.

Step-by-Step: Creating Selection Sets

1.    Start a new drawing using the Start from Scratch option and type the following in a new file in the Visual LISP edit window. Save it as ab35-4.lsp in your AutoCAD 2002Support folder or any folder in the support file search path.

Скачать в pdf «AutoCAD 2002 Bible»