itacad Posted October 9, 2024 Posted October 9, 2024 Hi, very often I have to do some searches with Find, at the end and exit from the command I get a selection of objects Found. I ask if there is a method (or a lisp) to copy above each selected object, an object already present in the drawing. For example, I would like to: - copy a speech bubble (revision speech bubble) over the objects, or - copy a block specially prepared for tagging over the objects, or - copy a text to communicate information over the objects, or - copy a polyline with counting symbols, or - etc.... Of course, there is no need for perfect overlapping, it is fine to obtain the "insertion point above insertion point" copy and then manually refine the position. The object to be copied obviously would be previously prepared and ready to be selected in the file itself. Greetings Quote
fuccaro Posted October 9, 2024 Posted October 9, 2024 That should not cause much headache. (defun c:pp() (setq el (entget (car (entsel "What to copy? "))) el (subst (assoc 10 (entget (car (entsel " And where to copy that?")))) (assoc 10 el) el)) (entmake el) (princ) ) it will copy blocks, texts and lot more kind of objects over the geometry you select. It will superpose their insertion points. Quote
fuccaro Posted October 10, 2024 Posted October 10, 2024 In the Lisp above you pick one by one the objects to get something copied on top. Reading again I just realize that you wish to insert something over the objects already selected. Sorry, here is an other Lisp I think better suits your needs. (defun c:pp() (setq what (entget (car (entsel "\t what to copy? "))) a10 (assoc 10 what)) (setq p (cadr (ssgetfirst))) (repeat (setq i (sslength p)) (entmake (subst (assoc 10 (entget (ssname p (setq i (1- i))))) a10 what)) ) (setq p nil) ) Quote
itacad Posted October 10, 2024 Author Posted October 10, 2024 Good morning fuccaro and in the meantime thanks for the help. It doesn't seem to me that lisp works, to the question what to copy? whatever type of object I select I get an error error: wrong argument type: lselsetp nil Secondly, as explained to me, I need to solve it in another way. 1) I conclude a search or a multiple selection of objects that are therefore already selected 2) At this point I would like to call your command that should only ask me what to copy, letting me select the type of object (cloud, text, line, block...) 3) ...at that point the copy of the selected object should occur over the preselected objects... "pickfirst" type of operation therefore... thanks again Quote
fuccaro Posted October 10, 2024 Posted October 10, 2024 Please try this one: (defun c:pp( / a10 what p i ss) (setq what (entget (car (entsel "\t what to copy? "))) a10 (assoc 10 what)) (setq p (cadr (setq ss(ssgetfirst)))) (repeat (setq i (sslength p)) (entmake (subst (assoc 10 (entget (ssname p (setq i (1- i))))) a10 what)) ) (princ) ) Quote
itacad Posted October 10, 2024 Author Posted October 10, 2024 Sorry so much! I was still pointing to the previous lisp! With texts and blocks I tried it and it works and I'll start using it right away! thanks! Quote
fuccaro Posted October 10, 2024 Posted October 10, 2024 @itacad please use the last Lisp i posted here. That's the only one destroying the selection set. Using alot the previous routine wil lead to bad memory management. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.