Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Distinguished Contributor fk
Distinguished Contributor
fk
Posts: 108
Registered: ‎11-13-2006
Message 1 of 5 (165 Views)

How to empty a multiline attribute?

165 Views, 4 Replies
10-19-2012 04:41 AM

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

*Expert Elite*
pbejse
Posts: 2,502
Registered: ‎11-24-2009
Message 2 of 5 (162 Views)

Re: How to empty a multiline attribute?

10-19-2012 04:58 AM 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?

 

*Expert Elite*
pbejse
Posts: 2,502
Registered: ‎11-24-2009
Message 3 of 5 (156 Views)

Re: How to empty a multiline attribute?

10-19-2012 05:22 AM 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

 

*Expert Elite*
3wood
Posts: 1,130
Registered: ‎03-25-2009
Message 4 of 5 (148 Views)

Re: How to empty a multiline attribute?

10-19-2012 06:07 AM 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.

 

Distinguished Contributor fk
Distinguished Contributor
fk
Posts: 108
Registered: ‎11-13-2006
Message 5 of 5 (142 Views)

Re: How to empty a multiline attribute?

10-19-2012 06:19 AM in reply to: pbejse

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

 

\Freddy

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!