AutoCAD 2002 Bible

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


(Setq LinePropertyList


(subst NewStartPoint (assoc 10 LinePropertyList) AcadLinePropertyList)


)


To test this out, type the preceding code in the Console window. To see the new start point, you need to scroll all the way to the right. The list (nicely formatted) now has a new group 10 value (the start point), shown on the third-to-last line that follows:


((-1 . <Entity name: 1456d60>)


(0 . «LINE»)


(330 . <Entity name: 1456cf8>)


(5 . «2C»)


(100 . «AcDbEntity»)


(67 . 0)


(410 . «Model»)


(8 . «0«)


(100 . «AcDbLine»)


(10 0 0 0)


(11 15.0 5.0 0.0)


(210 0.0 0.0 1.0))


To reflect the modification of this line in AutoCAD, as explained in Chapter 35, you can now use the function ENTMOD, as follows, by typing it in the Console. This code actually changes the start point of the line. (You can return to AutoCAD to check it out.)


(entmod LinePropertyList) J


As you can see from this example, getting object properties and modifying them can be a tedious and time-consuming process. For the next example, you write an interface function that modifies any group code contained in any object.


(defun put-group-code-value (Entityname Groupcode Value / PropertyList)


(setq PropertyList (entget EntityName))


(setq PropertyList (subst


(cons GroupCode Value)


(assoc GroupCode PropertyList)


PropertyList


)


)


(entmod PropertyList)


)


This function combines all the preceding steps into one function. Here’s how it works:

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