Hello!
I am trying to select objects with a window selection. After this, bring to front all Mtexts, and send to back all Dimensions.
Any help?
(defun c:test (/ sel1)
(princ "\nSelect a Mtext or Dimension")
(setq sel1 (ssget))
(cond
((= sel1 "DIMENSION"); If Dimension
(command "draworder" sel1 "" "b"); send it to back
);eq
((= sel1 "MTEXT"); If Mtext
(command "draworder" sel1 "" "f"); bring to front
);eq
); cond
); defun
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
Try this ...
(defun c:Test (/ ss) (princ "\nSelect Mtexts and Dimensions") (if (setq ss (ssget "_:L" '((0 . "MTEXT,*DIMENSION")))) ((lambda (i / sn ) (while (setq sn (ssname ss (setq i (1+ i)))) (if (= (cdr (assoc 0 (entget sn))) "MTEXT") (command "draworder" sn "" "f") (command "draworder" sn "" "b") ) ) ) -1 ) ) (princ) )
Another
(defun c:Demo (/ ss ssD ssM) (prompt "\nSelect Mtexts and Dimensions") (if (setq ss (ssget "_:L" '((0 . "MTEXT,*DIMENSION")))) (progn (setq ssM (ssget "_P" '((0 . "MTEXT")))) (command "_.select" ss "") (setq ssD (ssget "_P" '((0 . "*DIMENSION")))) (if ssM (command "_.draworder" ssM "" "_F") ) (if ssD (command "_.draworder" ssD "" "_B") ) ) ) (princ) )
HTH
Henrique
Many thanks to both of you.
The two answers are realy good. I will accept Henrique's answer as a solution because the two separate "If". It suits better for my purposes. Kudos to Tharwat