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

AutoLisp for deleting value of an attribute inside a block of a block

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
pp2104
660 Views, 2 Replies

AutoLisp for deleting value of an attribute inside a block of a block

Hi! I am just new here and also a newbie in doing lisp routines. I was wondering if there is an autolisp that could possibly delete a text value of a specific attribute text inside a block of a block. I don't want to totally delete the attribute, just the value. I already tried several examples on the internet but doesn't really get to my satisfaction and as to how I want it to be. The only available lisp routine that I found so far is just, yes, deleting the value but only works if the block attribute is outside the title block or even inside the title block itself but not when the attribute block is already inside a block of the title block. I need to do this for over 80 drawings and I was hoping to not doing it in an old fashioned way of opening each drawing just to edit-in-place the title block and then deleting the value of that attribute. attached here is a sample drawing of what I mean on this post. I hope this could help to understand. Can anyone help me please? that would be very much appreciated. Thanks in advance.

Labels (3)
2 REPLIES 2
Message 2 of 3
ВeekeeCZ
in reply to: pp2104

Here is an example.

Just you should not have multiple copies of your ATT1 block. In that case it set "" value of att of nested block to all copies of ATT1 block.

 

 

(defun c:AttSetEmpty ( / n e s l)

  (if (and (setq n (nentsel "\nSelect att: "))
	   (setq e (car n))
	   )
    (progn
      (setpropertyvalue
	(cdr (assoc 330 (entget e)))  	; insert (block) in which is att
	(cdr (assoc 2 (entget e)))	; tag
	"")
      (if (= 4 (length n))		; upper insert
	(foreach i (last n)
	  (repeat (setq l (sslength (setq s (ssget "_X" (list '(0 . "INSERT") (assoc 2 (entget i)))))))
	    (entupd (ssname s (setq l (1- l)))))))))
  (princ)
  )
	  

 

Message 3 of 3
pp2104
in reply to: pp2104

@ВeekeeCZ wow!! this really works!! thank you!

in reply to having multiple copies of ATT1 block, I only have 1 block for that and another block for block1 which is nested inside ATT1. I just have duplicate copies of the same TAG1, TAG2, and TAG3 attributes on both ATT1 block and block1 because that's how my title bock has been previously created.

 

however, is there any way that I could just type in the command, then I'll just give the block name, then the attribute name of which attribute value to delete? I'd like to delete only that value but I also don't mind it if the other duplicate attribute value is deleted if there is no way to differentiate the two blocks.

 

I am trying to find a lisp for this so I could just load it directly on my drawing then using a script to do it for over 80 drawings on an autoscript program in my autocad application. Thanks again.

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

Post to forums  

Autodesk Design & Make Report

”Boost