Jump to content

COPY NESTED WITH MULTI SELECTION


jim78b
 Share

Recommended Posts

HELLO in this LISP i  want the multiple selection WITH RECTANGLE WINDOW and not the single selection is possible?

#NESTEND BLOCK COPY WITHOUT OPEN THEM
(defun c:cx (/ *error* space ss nent br copy)
  (vl-load-com)
  (or *acad* (setq *acad* (vlax-get-acad-object)))
  (or *acdoc* (setq *acdoc* (vla-get-ActiveDocument *acad*)))

  (defun *error* (msg)
    (and msg
         (/=(strcase msg) "FUNCTION CANCELLED")
         (princ (strcat "\nError: " msg))
    )
    (vla-EndUndoMark *acdoc*)
    (princ)
  )

  (vla-StartUndoMark *acdoc*)
  (setq space (if (= 1 (getvar 'cvport))
                (vla-get-PaperSpace *acdoc*)
                (vla-get-ModelSpace *acdoc*)
              )
  )
  (setq ss (ssadd))
  (while (and (setq nent (nentselp "\nSelect a nested block: "))
              (= 4 (length nent))
              (= "AcDbBlockReference" (vla-get-ObjectName (setq br (vlax-ename->vla-object (car (last nent))))))
              (apply '= (mapcar 'abs (list (vla-get-XScaleFactor br) (vla-get-YScaleFactor br) (vla-get-ZScaleFactor br))))
         )
    (setq copy (vla-insertblock space (vlax-3d-point '(0 0 0)) (vla-get-Name br) 1.0 1.0 1.0 0.0))
    (vla-TransformBy copy (vlax-tmatrix (caddr nent)))
    (vla-Highlight copy :vlax-true)
    (ssadd (vlax-vla-object->ename copy) ss)
  )
  (command "_.move" ss "")
  (*error* nil)
)

 

Edited by jim78b
Link to comment
Share on other sites

I don't think that is possible. lets say you select multiple blocks with a window how then do you tell AutoCAD what nested blocks you want to copy? I guess you could retool the lisp to allow multiple selections at once. Looks like it already does this.

  • Thanks 1
Link to comment
Share on other sites

If the blocks are not too heavy or not xrefs, I would simply explode them, then make a rectangular selection, put it to the clipboard, then undo the explode command, then pasteclip.

Sound very noisy routine but I think it will work, If the blocks are not too heavy or not xrefs, anyway.

The given lisp doesn't run copy command. It gets the block name, insertion point, scale, then insert a new one to the current space, with transformed parameters. That is good, the clipboard can be dropped off.

If there is Xref, then a block name from xref database insert to current drawing database will be very tricky thing to do.

  • Thanks 1
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
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.

 Share

×
×
  • Create New...