AutoCAD 2002 Bible

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

♦    Line 1 defines the function with three arguments, the entity name, a group code, and a new value for the group code. It also declares a local variable, PropertyList, which is the property list of the object.

♦    Line 2 sets the property list equal to the ENTGET of the entity name.

♦    Line 3 starts the process of setting the same property list to the new value.

♦    Lines 4 through 7 execute the substitution. They substitute the new group, created by (cons GroupCode Value) for the current group value, created with the ASSOC function, in the property list named PropertyList.

♦    Line 8 closes the subst function.

♦    Line 9 closes the second setq function.

♦    Line 10 modifies the drawing database using ENTMOD.

♦    Line 11 closes the defun function.

using the preceding function, you now have a much simpler interface for modifying any group code. Next, you use the function Put-a-Group-Code-Value to modify the 10 group code of the line object.

After entering and loading the preceding function, you can test the function by typing the following in Visual LIsP:

(Put-Group-Code-Value LineEntity 10 ‘(5 5 0)) J

This function changes the start point of the line to 5,5,0.

using the same logic to write the get functions, you can now define a separate 10 group code modifier function. You can do the same for any group code.

(defun Put-Group-10-Code (EntityName Value)

(Put-Group-Code-Value EntityName 10 Value)

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