Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

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

Posted
;(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 ?

Posted

I want to change the text on the layer "Layer 1" to "blah blah" in the whole drawing.

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

Posted

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

Posted

Sorry it's ok. I entered the wrong argument.Thank you this is what

Posted
Sorry it's ok. I entered the wrong argument.Thank you this is what

 

Not a problem .

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