Hello everyone,
First post, thanks for your time in advance.
I have a command that will, like many others I've seen, allow selection of blocks, ask for an additional point and print them. My goal was to utilize the list data to draw polylines, but I want to add additional fields to the list for later use. I've simplified some of this just to show what code I have that functions properly, I'm having issues understanding how to add the other items to the list or sublist. This is totally out of ignorance but I'm trying to learn more, if I wanted to introduce this option what functions would be the best to use?
Concept:
Check blockname list for AA, if AA exist then AA is arc.
Modified example of current output of the code below (it would normally only have one userpt as intended):
Block Coordinates and Names:
((BLOCK1_XXAAXX (921.866 1042.21 246.0)) (UserPt (860.866 992.962 246.0)))
((BLOCK1_XXBBXX (860.866 992.962 246.0)) (UserPt (440.866 992.962 246.0)))
Desired output:
Block Coordinates and Names:
((BLOCK1_XXAAXX (921.866 1042.21 246.0)) (UserPt (860.866 992.962 246.0)) arc)
((BLOCK1_XXBBXX (860.866 992.962 246.0)) (UserPt (440.866 992.962 246.0)) straight)
(defun c:mycmd ( / ss ent inscoords blockname coordlist userpt)
(setq ss (ssget '((0 . "INSERT"))))
(setq coordlist (list))
(if ss
(progn
(setq ent (ssname ss 0))
(while ent
(setq inscoords (cdr (assoc 10 (entget ent))))
(setq blockname (cdr (assoc 2 (entget ent))))
(setq coordlist (append coordlist (list (list blockname inscoords))))
(setq ss (ssdel ent ss))
(setq ent (ssname ss 0))
)
(setq userpt (getpoint "\nSelect end point of last block selected: "))
(setq coordlist (append coordlist (list (list "UserPt" userpt))))
(princ "\nBlock Coordinates and Names: ")
(princ coordlist)
)
(princ "\nNo blocks selected.")
)
(princ) ; Ensure function returns nil
)
Thanks and regards,
jerryman