Ahmed Khaled Posted February 4, 2022 Share Posted February 4, 2022 Hi, I'm asking if there Is a Lisp to make Ncopy Command use the current layer to bring the Copied objects in to it automatically Thanks in advance 1 Quote Link to comment Share on other sites More sharing options...
mhupp Posted February 4, 2022 Share Posted February 4, 2022 (edited) COPYTOLAYER Didn't realize n was for nested. ;Nested Copy to current Layer (defun C:NCL (/ LastEnt SS en) (setq LastEnt (entlast)) (C:ncopy) (setq SS (ssadd)) (if (setq en (entnext LastEnt)) (while en (ssadd en SS) (setq en (entnext en)) ) ) (setvar 'cmdecho 0) (command "_.Chprop" SS "" "LA" (getvar 'clayer) "") (setvar 'cmdecho 1) ) Edited February 4, 2022 by mhupp 1 Quote Link to comment Share on other sites More sharing options...
Ahmed Khaled Posted February 4, 2022 Author Share Posted February 4, 2022 1 hour ago, mhupp said: COPYTOLAYER Didn't realize n was for nested. ;Nested Copy to current Layer (defun C:NCL (/ LastEnt SS en) (setq LastEnt (entlast)) (C:ncopy) (setq SS (ssadd)) (if (setq en (entnext LastEnt)) (while en (ssadd en SS) (setq en (entnext en)) ) ) (setvar 'cmdecho 0) (command "_.Chprop" SS "" "LA" (getvar 'clayer) "") (setvar 'cmdecho 1) ) Thanks, but it return this error (; error: no function definition: C:NCOPY) Quote Link to comment Share on other sites More sharing options...
mhupp Posted February 4, 2022 Share Posted February 4, 2022 Do you have the command loaded? its an express tool command on my end in BricsCAD. Quote Link to comment Share on other sites More sharing options...
Ahmed Khaled Posted February 4, 2022 Author Share Posted February 4, 2022 28 minutes ago, mhupp said: Do you have the command loaded? its an express tool command on my end in BricsCAD. Yes, Ncopy Command is Loaded and working Quote Link to comment Share on other sites More sharing options...
Steven P Posted February 4, 2022 Share Posted February 4, 2022 Would it need to be (command "ncopy") rather than (c:ncopy) if it is a normal command rather than LISP command? For me after that it is saying "expects a point or settings" 1 Quote Link to comment Share on other sites More sharing options...
tombu Posted February 4, 2022 Share Posted February 4, 2022 NCOPY (Command) https://help.autodesk.com/view/ACD/2022/ENU/?guid=GUID-12FCCFDF-9B3B-48D0-AC46-DF1D3519B0E5 Many of the original Bonus or Express Tools are simply AutoCAD commands now. Those that are still lisp are only autoloaded with the command names. To use (c:xxxxx) you would have to preload the lisp before calling it. This may help: 1 Quote Link to comment Share on other sites More sharing options...
mhupp Posted February 4, 2022 Share Posted February 4, 2022 (C:Ncopy) works for me in bricscad so you don't have to use pauses. Quote Link to comment Share on other sites More sharing options...
Ahmed Khaled Posted February 4, 2022 Author Share Posted February 4, 2022 15 minutes ago, tombu said: NCOPY (Command) https://help.autodesk.com/view/ACD/2022/ENU/?guid=GUID-12FCCFDF-9B3B-48D0-AC46-DF1D3519B0E5 Many of the original Bonus or Express Tools are simply AutoCAD commands now. Those that are still lisp are only autoloaded with the command names. To use (c:xxxxx) you would have to preload the lisp before calling it. This may help: I Appreciated it but that is not what I'm looking for, this command (NCopy) get the line on the same layer as xref not my drawing current layer Quote Link to comment Share on other sites More sharing options...
tombu Posted February 4, 2022 Share Posted February 4, 2022 (edited) 5 hours ago, Ahmed Khaled said: I Appreciated it but that is not what I'm looking for, this command (NCopy) get the line on the same layer as xref not my drawing current layer Try (defun c:ncl ( / ent elist clayer) (setq ent (entlast)) (command "_.ncopy" "\\" "" "_non" '(0 0) "_non" '(0 0)) (while (/= (entlast) ent) (setq ent (entlast) elist (entget ent) elist (entget (entlast)) elist (subst (cons 8 (getvar 'clayer))(assoc 8 elist) elist)) (entmod elist) (command "_.ncopy" "\\" "" "_non" '(0 0) "_non" '(0 0)) ) (princ) ) Edited February 4, 2022 by tombu Updated to repeat until you press Esc key. 1 Quote Link to comment Share on other sites More sharing options...
Ahmed Khaled Posted February 4, 2022 Author Share Posted February 4, 2022 39 minutes ago, tombu said: Try (defun c:ncl ( / elist) (command "_.ncopy" "\\" "" "_non" '(0 0) "_non" '(0 0)) (setq elist (entget (entlast)) elist (subst (cons 8 (getvar 'clayer))(assoc 8 elist) elist)) (entmod elist) (princ) ) It Works Perfectly Thank You Very Much Quote Link to comment Share on other sites More sharing options...
Ahmed Khaled Posted February 4, 2022 Author Share Posted February 4, 2022 1 hour ago, tombu said: Try (defun c:ncl ( / elist) (command "_.ncopy" "\\" "" "_non" '(0 0) "_non" '(0 0)) (setq elist (entget (entlast)) elist (subst (cons 8 (getvar 'clayer))(assoc 8 elist) elist)) (entmod elist) (princ) ) Could you please make the command repeat itself until i press any key (like ESC) to exit it Quote Link to comment Share on other sites More sharing options...
tombu Posted February 4, 2022 Share Posted February 4, 2022 2 hours ago, Ahmed Khaled said: Could you please make the command repeat itself until i press any key (like ESC) to exit it I updated the code in my post above to repeat until you press the Esc key. 1 1 1 Quote Link to comment Share on other sites More sharing options...
Ahmed Khaled Posted February 4, 2022 Author Share Posted February 4, 2022 2 hours ago, tombu said: I updated the code in my post above to repeat until you press the Esc key. Thanks. I couldn't have done it without you. Quote Link to comment Share on other sites More sharing options...
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.