cadjunkee Posted September 30, 2009 Share Posted September 30, 2009 I have 49 drawings which have the xref named x-392000-c103 and ai wanted to send the xref to the back with a script but cant seem to figure it out, or find anywhere that shows you how to select by xref name. This drawing has multiple xrefs all on the same layer so i need to find a way to select by xref name rather then by layer..... help please Quote Link to comment Share on other sites More sharing options...
ronjonp Posted September 30, 2009 Share Posted September 30, 2009 Assuming you only have one instance of the xref, this should work: (defun xrb (name / ss) (if (setq ss (ssget "_X" (list (cons 2 name)))) (command "._draworder" (ssname ss 0) "" "back") ) (princ) ) (xrb "x-392000-c103") Quote Link to comment Share on other sites More sharing options...
alanjt Posted September 30, 2009 Share Posted September 30, 2009 Assuming you only have one instance of the xref, this should work: (defun xrb (name / ss) (if (setq ss (ssget "_X" (list (cons 2 name)))) (command "._draworder" (ssname ss 0) "" "back") ) (princ) ) (xrb "x-392000-c103") Ron, you could just send the selection set to draworder, or am I wrong? (command "._draworder" ss "" "back") Quote Link to comment Share on other sites More sharing options...
cadjunkee Posted September 30, 2009 Author Share Posted September 30, 2009 Sorry for the Newbie questions, but is this a lisp? Cause i saved it in note pad as a lisp file, then appload, then typed in my command prompt 'xrb' how do i run this? thanks Quote Link to comment Share on other sites More sharing options...
ronjonp Posted October 1, 2009 Share Posted October 1, 2009 Ron, you could just send the selection set to draworder, or am I wrong? (command "._draworder" ss "" "back") You're probably right...but I did not test it Quote Link to comment Share on other sites More sharing options...
ronjonp Posted October 1, 2009 Share Posted October 1, 2009 Sorry for the Newbie questions, but is this a lisp? Cause i saved it in note pad as a lisp file, then appload, then typed in my command prompt 'xrb' how do i run this? thanks One the lisp is loaded use this to run it: (xrb "x-392000-c103") Quote Link to comment Share on other sites More sharing options...
cadjunkee Posted October 2, 2009 Author Share Posted October 2, 2009 this is the error I get Command: (xrb "x-392000-c103") Unknown command "BACK". Press F1 for help. Quote Link to comment Share on other sites More sharing options...
ronjonp Posted October 2, 2009 Share Posted October 2, 2009 this is the error I get Command: (xrb "x-392000-c103") Unknown command "BACK". Press F1 for help. Give this one a whirl *ron slaps own hand for using command call* (defun xrb (name / doc e ms n o sorttbl ss xdic) (vl-load-com) (setq xdic (vla-getextensiondictionary (setq ms (vla-get-modelspace (setq doc (vla-get-activedocument (vlax-get-acad-object))) ) ) ) ) (if (vl-catch-all-error-p (setq sorttbl (vl-catch-all-apply 'vla-getobject (list xdic "ACAD_SORTENTS"))) ) (setq sorttbl (vla-addobject xdic "ACAD_SORTENTS" "AcDbSortentsTable")) ) (setq n -1) (if (setq ss (ssget "_X" (list (cons 2 name)))) (progn (while (setq e (ssname ss (setq n (1+ n)))) (vlax-invoke sorttbl 'movetobottom (list (vlax-ename->vla-object e))) ) (vla-regen doc acallviewports) ) ) (princ) ) (xrb "x-392000-c103") Quote Link to comment Share on other sites More sharing options...
alanjt Posted October 3, 2009 Share Posted October 3, 2009 Give this one a whirl *ron slaps own hand for using command call* (defun xrb (name / doc e ms n o sorttbl ss xdic) (vl-load-com) (setq xdic (vla-getextensiondictionary (setq ms (vla-get-modelspace (setq doc (vla-get-activedocument (vlax-get-acad-object))) ) ) ) ) (if (vl-catch-all-error-p (setq sorttbl (vl-catch-all-apply 'vla-getobject (list xdic "ACAD_SORTENTS"))) ) (setq sorttbl (vla-addobject xdic "ACAD_SORTENTS" "AcDbSortentsTable")) ) (setq n -1) (if (setq ss (ssget "_X" (list (cons 2 name)))) (progn (while (setq e (ssname ss (setq n (1+ n)))) (vlax-invoke sorttbl 'movetobottom (list (vlax-ename->vla-object e))) ) (vla-regen doc acallviewports) ) ) (princ) ) (xrb "x-392000-c103") Still odd that it gave an error. I have 2 draw order macros I use daily (draw front and draw back) and I never have problems. with them. Quote Link to comment Share on other sites More sharing options...
cadjunkee Posted October 5, 2009 Author Share Posted October 5, 2009 Works great!! Thanks Again Ron! Quote Link to comment Share on other sites More sharing options...
ronjonp Posted October 5, 2009 Share Posted October 5, 2009 Works great!! Thanks Again Ron! Glad you got it to work 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.