Jump to content

Recommended Posts

Posted

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. Can anyone help me please? that would be very much appreciated. Thanks in advance.

Posted

attached here is a sample drawing of what I mean on this post. I hope this could help to understand. Thanks.

sample drawing.dwg

Posted

Have you tried FIND and replace ?

Posted

@ronjonp yes, find and replace works but, as much as possible, I wouldn't want to go over each drawing trying to find and replace each values.

 

@Steven P this works fine too but, 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 am trying to find a lisp for this that makes me save time interacting with each drawing without going through selecting and typing on another prompting window, 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.

Posted

If nentsel supported pick by point would be real easy. Anyway the block has two nested blocks understand block repeated, ok so which gets set to nothing the left or the right they both have tag3. 

Posted

yes both blocks have the same tag attributes, the only difference is just that, the other block is nested inside ATT1 block. I really would like to only remove the value of tag3 on the right side but, if there's no way to differentiate the two blocks on a single lisp routine then I don't mind having both left and right tag3 attributes value to be emptied.

 

I actually posted this same problem in another forum and find a quicker way solution to this. It can be found here:

 

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autolisp-for-deleting-value-of-an-attribute-inside-a-block-of-a/m-p/10142462#M412132

 

I tried and tested and it really worked, saved me a lot of time than doing the old way, but the only thing is that, I want not to pick the attribute as it will cause me to still open each drawings. is there any way that I could just give the block name, then the attribute tag?

Posted

The link is for using nentsel which is not the way to go. Try this.

 

(defun c:test2 ( / blk ent att oldtag )
(setq blk "ATT1" oldtag "TAG3")
(setq ent (tblobjname "block" blk))
    (while (setq ent (entnext ent))
		(setq edata (entget ent))
		(if (= (cdr (assoc 0 edata))"ATTRIB") ; process all entities that are attributes
			(progn
			(setq att (vlax-ename->vla-object ent))
			(if (= oldtag (strcase (vla-get-tagstring att)))
				(vla-put-textstring att "")
			)
			)
		)
	)
(command "_.regen")
(princ)
)
(c:test2)

 

Posted

@BIGAL thanks to you! it works really well. you saved my fingers from being too tired of clicking attributes. thanks again! 🙂

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