Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to empty a multiline attribute?

4 REPLIES 4
Reply
Message 1 of 5
fk
Advocate
306 Views, 4 Replies

How to empty a multiline attribute?

Hi.

I have some multiline attributes that contain strings that are longer than 250 characters. Someone that know how to empty the attribute using autolisp?

 

Thanks in advance.

 

\Freddy

4 REPLIES 4
Message 2 of 5
pbejse
in reply to: fk


@FK wrote:

Hi.

I have some multiline attributes that contain strings that are longer than 250 characters. Someone that know how to empty the attribute using autolisp?

 

Thanks in advance.

 

\Freddy


Are there other attributes on the block besides the multiline?  or blank all attributes regardless if its multiline or not?

 

Message 3 of 5
pbejse
in reply to: pbejse


@pbejse wrote:

Are there other attributes on the block besides the multiline?  or blank all attributes regardless if its multiline or not?

 


(defun c:begone (/ atr)(vl-load-com)
  (while (setq atr (car (nentsel "\nSelect Attribute:" )))
    		(vla-put-textstring (vlax-ename->vla-object atr) "")))
	 
(defun c:begonem (/ atr)(vl-load-com)
  (while (setq atr (car (nentsel "\nSelect Attribute:" )))
    		(if (eq (vla-get-MTextAttribute (setq atr (vlax-ename->vla-object atr))) :vlax-true)
    		(vla-put-textstring atr "")))
  )
  
(defun c:begoneML (/ ss)(vl-load-com)
  	(if (setq ss (ssget ":L" '((0 . "INSERT")(66 . 1))))
	  	(repeat (sslength ss)
		  (foreach itm (vlax-invoke (vlax-ename->vla-object (ssname ss 0)) 'Getattributes)
		    	(if (eq (vla-get-MTextAttribute itm) :vlax-true)
			  	(vla-put-textstring itm "")))
		  (ssdel (ssname ss 0) ss)
		  )))

(defun c:begoner ( / ss)(vl-load-com)
  	(if (setq ss (ssget ":L" '((0 . "INSERT")(66 . 1))))
	  	(repeat (sslength ss)
		  (foreach itm (vlax-invoke (vlax-ename->vla-object (ssname ss 0)) 'Getattributes)
		  			  	(vla-put-textstring itm ""))
		  (ssdel (ssname ss 0) ss)
		  ))
  )

 

GTG

 

Message 4 of 5
3wood
in reply to: fk

Please try attached routine, select blocks, specify which attribute, then in the dialogue box set "Replace mode" as "New" and "New text" as a space.

 

Message 5 of 5
fk
Advocate
in reply to: pbejse

This is great! Thanks  a lot "pbejse". You saved my day.

 

\Freddy

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost