Jump to content

DrawOrder Send Xref to back (select by name)


cadjunkee

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 :oops:

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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* :D

 

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

Link to comment
Share on other sites

Give this one a whirl

*ron slaps own hand for using command call* :D

 

(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.

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