Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

AutoLisp Question re: Leaders 2

Status
Not open for further replies.

chrisj5

Civil/Environmental
Joined
Jul 12, 2001
Messages
4
Location
US
Hi all,

I've been trying to access the vertex coordinates of a leader in Autolisp. It is easy to 'pull' the list value via its 'assoc' code but since there are multiple assoc 10 list values, I'm running into a wall. Anybody have some insight to access multiple 'assoc' values?

Thanks in advance.

Chris
 
Hi Chris
I posted a sample lisp as FAQ right now, inspired by your question.
The trick is after each application of
(member (assoc 10 ....)
to truncate the entity list with
(cdr ....)
See the full function with tutorial comments in the FAQ area above.

Hope this helps.
;
(defun NextVertex1(ShortEDDY)
(princ "\nSuccessive access to (Assoc 10 EDDY) ... ")
(while (setq ShortEDDY (member (assoc 10 ShortEDDY) ShortEDDY))
;for debugging
(princ "\n(assoc 10 ShortEddy)..")
(princ (assoc 10 ShortEDDY))
;after debugging, put other function calls here
;to do things with vertex coordinates
;or assign the coordinates to a parameter, to use elsewhere
(setq nextVertexCoords (cdr (assoc 10 ShortEDDY)))
(setq ShortEddy (cdr ShortEddy))
)
(princ)
);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top