jan_ek Posted April 1, 2012 Posted April 1, 2012 Please find the error, any suggestions how to write it simply (if (= (setq zm1 (ssget "x" (list (cons 0 "text,mtext") (cons 8 desired_layer)))) nil) (progn (princ) ) (progn (setq dl_zm1 (sslength zm1) z_zm1 0) (while (< z_zm1 dl_zm1) (setq nazwa_zm1 (ssname zm1 z_zm1)) (setq lista_zm1 (entget nazwa_zm1)) (setq ilosc1_zm1 (dxf 1 lista_zm1)) (setq old_zm1 (cons 1 ilosc1_zm1)) (setq new_zm1 (cons 1 text_to_be_entered)) (setq lista_zm1 (subst new_zm1 old_zm1 lista_zm1)) (entmod lista_zm1) (setq z_zm1 (+ z_zm1 1)) ) ) ) Quote
Tharwat Posted April 1, 2012 Posted April 1, 2012 Is this what you are after ? (if (and (setq ss (ssget "x" (list (cons 0 "text,mtext") (cons 8 desired_layer)))) (not (eq (setq st (getstring t "\n enter new string :"))"")) ) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (setq e (entget sn)) (entmod (subst (cons 1 st) (assoc 1 e) e)) ) (princ) ) Quote
jan_ek Posted April 1, 2012 Author Posted April 1, 2012 ;(entwxy "ble ble" "Layer1") (defun entwxy (Sn desired_layer / ) (if (setq ss (ssget "x" (list (cons 0 "text,mtext") (cons 8 desired_layer)))) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (setq e (entget sn)) (entmod (subst (cons 1 Sn) (assoc 1 e) e)) ) (princ) ) ) ERORR ; ----- Error around expression ----- (ASSOC 1 E) ; ; error : bad argument type <(1 . <Selection set: b3f1d38>)> ; expected <STRING> at [DXF/XED DATA] He wants to take a standard feature Quote
Tharwat Posted April 1, 2012 Posted April 1, 2012 ;(entwxy "ble ble" "Layer1") (defun entwxy (Sn desired_layer / ) (if (setq ss (ssget "x" (list (cons 0 "text,mtext") (cons 8 desired_layer)))) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (setq e (entget sn)) (entmod (subst (cons 1[color=blue][b] Sn[/b][/color]) (assoc 1 e) e)) ) (princ) ) ) ERORR ; ----- Error around expression ----- (ASSOC 1 E) ; ; error : bad argument type <(1 . <Selection set: b3f1d38>)> ; expected <STRING> at [DXF/XED DATA] He wants to take a standard feature What are you trying to do ? Quote
jan_ek Posted April 1, 2012 Author Posted April 1, 2012 I want to change the text on the layer "Layer 1" to "blah blah" in the whole drawing. Quote
Tharwat Posted April 1, 2012 Posted April 1, 2012 I want to change the text on the layer "Layer 1" to "blah blah" in the whole drawing. Replace your desired string with the one in blue color .. and do not forget to add your desired layer name as well . (if (setq ss (ssget "x" (list (cons 0 "text,mtext") (cons 8[color=red][b] desired_layer[/b][/color])))) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (setq e (entget sn)) (entmod (subst (cons 1 [color=blue][b]"blah blah"[/b][/color]) (assoc 1 e) e)) ) (princ) ) Quote
jan_ek Posted April 1, 2012 Author Posted April 1, 2012 This is not the same thing? Calling "(entwxy "ble ble" "Layer1")" and function: (defun entwxy (Sn desired_layer / ) (if (setq ss (ssget "x" (list (cons 0 "text,mtext") (cons 8 desired_layer)))) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (setq e (entget sn)) (entmod (subst (cons 1 Sn) (assoc 1 e) e)) ) (princ) ) ) Quote
jan_ek Posted April 1, 2012 Author Posted April 1, 2012 Sorry it's ok. I entered the wrong argument.Thank you this is what Quote
Tharwat Posted April 1, 2012 Posted April 1, 2012 Sorry it's ok. I entered the wrong argument.Thank you this is what Not a problem . Quote
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.