Message 1 of 9

Not applicable
11-18-2019
07:54 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
So my code is to send xref layers to back (in an order).
(defun C:GEN-BU-DO-MEP (/ laylist sr) (setq laylist '("XREF-IMG-FRT" "XREF-VP" "XREF-MEP" "XREF-GRD") ) (foreach lay laylist (if (and (tblsearch "LAYER" lay)(setq sr (ssget "X" (list (cons 8 lay))))) ;if sr returns true / if there is something on it (command "_draworder" sr "" "_B") ;problem here is it goes to select objects that are not in current space ) ) )
My issue is (i think) that the 'if' function finds something on one of the layers, but then when it goes on to draworder the selection, an error occurs because whatever it has found is not in the current space.
How do I get around this?? Error handler??
Solved! Go to Solution.