entsel
1 | (setq en1 (entsel)) |
If you want to prompt user with a sentence
1 | (setq e (entsel "Please choose an object: ")) |
More about entsel
Return value:
A list whose first element is the entity name of the chosen object and whose second element is the coordinates (in terms of the current UCS) of the point used to pick the object.
The pick point returned by entsel does not represent a point that lies on the selected object.
car
1 | (car en1) |
In the previos example, (car en1)
here will return the first element in the list, which is the EntityName
cadr
1 | (cadr en1) |
In the previos example, (car en1)
here will return the second element in the list, which is the point location
entget
Retrieves an object’s (entity’s) definition data
1 | (setq en1_data (entget (car en1))) |
If the entity you selected is in the different types, entget
may return different geometry infomation.
If the graph info pair separated by
.
, (1 . “ABC”) for example, we need to usecdr
to retrieve the secend element, instead ofcadr
1 | (cons 1 "ABC") |
can create an dot pair
, (1 . “ABC”)
How to revise the data?
entget
to get the entity informationassoc
to find the correct group_code string pair. The new string pair can be created bycons
subst
to swap/change the new/old string pairsentmod
to renew the autocad canvas and show the new string pair!ent_data
(setq oldr (assoc 40 en1_data))
(setq newr (cons 40 23.8))
(setq en1_data (subst newr oldr en1_data))
(entmod en1_data)