Originally Posted by
matt.bachardy903119
Hello,
I've been searching for a Lisp routine that behaves like the one in the old Softdesk 8 Auto Architect / Productivity Tools for R14, for use with ACAD 2000 (or above).
When invoked, it allows you to pick any entity, text, block, line - whatever - changes to the layer the entity is on and invokes the command. Example: You invoke the "Draw By Example" Command, pick a line on Layer "Door", then allows you to draw a line on the "door" layer. It worked the same with text, blocks, circles, etc.
Any help would be appreciated! Thanks....
Question: what if you pick block? what is the command associated with that? Insert?
Here's the gist of it
Code:
(defun c:demo (/ objtype layer invoke)
(if (setq objtype (car (entsel "\Select Object:")))
(progn
(setq layer (cdr (assoc 8 (setq e (entget objtype)))))
(setq invoke (cdr (assoc 0 e)))
(setvar 'clayer layer)
(if (wcmatch invoke "*LINE")
(setq invoke (cadr
(assoc
invoke
'(("POLYLINE" "3DPOLY")
("SPLINE" "SPLINE")
("LINE" "LINE")
("LWPOLYLINE" "PLINE")
)
)
)
)
)
(apply 'command (list invoke))
)
)(princ)
)