Hello Friends
i am looking for NCOPY with window selection, but can't find any solution. can some one help me by customizing through lisp rutine so i can copy objects by window selection.
Regards
Solved! Go to Solution.
Solved by ВeekeeCZ. Go to Solution.
Playing with this approach, but it fails on (entnext)...
(defun c:CopyNestedObjects (/ enl ss sn) (command "_.-REFEDIT" pause "_Ok" "_All" "_No") (setq enl (entlast)) (if (setq ss (ssget "_:L")) (command "_.COPY" ss "" "0,0" "0,0")) (setq sn (somehow-select-all-new)) (if (> (sslength sn) 0) (command "_.REFSET" "_R" ss "")) (command "_.REFCLOSE" "_Disc") (command-s "_.MOVE" ss "") (princ) )
@ВeekeeCZ wrote:
Playing with this approach, but it fails on (entnext)...
I assume it's not really necessary to remove the newly-copied objects from the Block. You can remove the original selection, and leave the newly-copied ones as part of the Block. Does this work [untested]?
(defun C:NCopyM (/ ss) ; = NCOPY Multiple objects (command "_.-REFEDIT" pause "_Ok" "_All" "_No") (if (setq ss (ssget "_:L")) (command "_.COPY" ss "" "0,0" "0,0" "_.REFSET" "_R" ss "" ); command ); if (command "_.REFCLOSE" "_Disc") (command-s "_.MOVE" ss "") (princ) )
@Kent1Cooper wrote:
@ВeekeeCZ wrote:
Playing with this approach, but it fails on (entnext)...
I assume it's not really necessary to remove the newly-copied objects from the Block. You can remove the original selection, and leave the newly-copied ones as part of the Block. Does this work [untested]?
(defun C:NCopyM (/ ss) ; = NCOPY Multiple objects (command "_.-REFEDIT" pause "_Ok" "_All" "_No") (if (setq ss (ssget "_:L")) (command "_.COPY" ss "" "0,0" "0,0" "_.REFSET" "_R" ss "" ); command ); if (command "_.REFCLOSE" "_SAVE") (command-s "_.MOVE" ss "") (princ) )
It isn't unless you actually save the changes to the original. That I didn't want to do...
But maybe @SAFizzy wouldn't mind...
Seems that a vla-copy method does a better job.
(vl-load-com) (defun c:CopyNestedObjects (/ ss sn doc obj objnew) (command "_.-REFEDIT" pause "_Ok" "_All" "_No") (if (and (setq ss (ssget "_:L")) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (setq sn (ssadd)) ) (repeat (setq i (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq i (1- i))))) (if (setq objnew (vla-Copy obj)) (ssadd (vlax-vla-object->ename objnew) sn)))) (if (> (sslength sn) 0) (command "_.REFSET" "_R" sn "")) (command "_.REFCLOSE" "_Disc") (command-s "_.MOVE" sn "") (princ) )
Hello @ВeekeeCZ
1) Thanks for your routine ! So Kudos for you ...
2) But I have a small defect : the routine seems to run ONLY ONCE !
I can't re-run the routine on the XREF to extract again entities from an other area !?
Thanks, Regards, Patrice (The Old French EE Froggy)
Patrice BRAUD
Hm... well, I would not expect much from it. It was just kinda 'proof of concept', I did not test it much. And the 'refedit' is not really 'custom-friendly' command.
Anyway, it seems to me to be working quite fain (2020). I am able to repeat the command, no confirmation receiving... a yes, there would be still the need to select an insert which from you copy objects. At least for the first time.
If you give me more information - possibly a test file, command-line listing, or screen capture... I could look into that.
Can't find what you're looking for? Ask the community or share your knowledge.