Jump to content

Copy an object above a series of selected objects


itacad

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)
  )

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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)
  )

 

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...