0 Members and 2 Guests are viewing this topic.
(defun c:test ( / ss st n ) (if (setq ss (ssget "_X" '((0 . "INSERT") (66 . 1)))) (if (setq st (getstring T "\nSpecify New Value: ")) (repeat (setq n (sslength ss)) (LM:SetAttributeValue (ssname ss (setq n (1- n))) "RAUM/GRUPPE" st) ) ) ) (princ))
(defun c:Raumbuch (/ SS st n) (if (setq SS (ssget "_x" '((0 . "INSERT") (66 . 1)))) ;"_:L" (if (setq ST (getstring T "\nSpecify New Value: ")) (repeat (setq n (sslength ss)) (LM:SetAttributeValue (ssname ss (setq n (1- n))) "RAUM/GRUPPE" ST) ) ) ) (princ) )
So I get an error message but
(defun c:Raumbuch (/ SS st n) (if (setq SS (ssget '((0 . "INSERT") (66 . 1)))) (if (setq ST (getstring T "\nSpecify New Value: ")) (repeat (setq n (sslength ss)) (LM:SetAttributeValue (ssname ss (setq n (1- n))) "RAUM/GRUPPE" ST) ) ) ) (princ) )
Hi Kruuger,There is nothing wrong with your code, but I just wanted to point out that it is more efficient to step through the SelectionSet only once, instead of twice, hence:Code: [Select](defun c:test ( / ss st n ) (if (setq ss (ssget "_X" '((0 . "INSERT") (66 . 1)))) (if (setq st (getstring T "\nSpecify New Value: ")) (repeat (setq n (sslength ss)) (LM:SetAttributeValue (ssname ss (setq n (1- n))) "RAUM/GRUPPE" st) ) ) ) (princ))@Hugo,Regarding Code posting have a read of this:http://www.theswamp.org/index.php?topic=4429.0