Jump to content

att edit help


daveyboyd

Recommended Posts

I am trying to run a script using Scriptpro. I only want to change the text in an attribute within a block.

 

I am using the GATTE command to do this, however, when it asks me to enter the block name it says *invalid selection* due to the spaces in the block name.

 

The name of the block is WILDE-TAMESIDE BORDER NEW and the attribute I am trying to change is STATUS

 

I have tried "" but to no avail, here is my code . .

 

GATTE

WILDE-TAMESIDE BORDER NEW

STATUS

FOR CONSTRUCTION

 

Can anyone tell me what I am doing wrong?

 

Thanks

Link to comment
Share on other sites

Obviously I'm going to plug my own program :P

http://www.cadtutor.net/forum/showthread.php?t=37127

 

Also, if you are having trouble with ScriptPro opening and closing AutoCAD for every drawing, my script writer program (link in my sig) may help you more.

Link to comment
Share on other sites

Or, use a LISP routine instead of the command call:

 

(defun attchng (blk tag val / i ss ent att)  
 (vl-load-com)
 ;; Lee Mac  ~  17.02.10
 
 (mapcar (function set) '(blk tag)
         (mapcar (function strcase) (list blk tag)))

 (if (setq i -1 ss (ssget "_X" (list (cons 0 "INSERT")
                                     (cons 2 blk) (cons 66 1))))
   
   (while (setq ent (ssname ss (setq i (1+ i))))

     (foreach att (vlax-invoke (vlax-ename->vla-object ent) 'GetAttributes)

       (if (eq (strcase (vla-get-TagString att)) Tag)
         (vla-put-TextString att val)))))
 
 (princ))

 

Call it in your script like this;

 

(attchng "blockname" "tagname" "newtagvalue")

 

But you will need to make sure it is being loaded in every drawing.

Link to comment
Share on other sites

Tiz a nice little program, thanks. But. . .

 

I won't to run it on a number of files (50+) without going into every single one,thats why I wanted to use scriptpro.

 

What do you use to substitute a space in the block title?

Link to comment
Share on other sites

Tiz a nice little program, thanks. But. . .

 

I won't to run it on a number of files (50+) without going into every single one,thats why I wanted to use scriptpro.

 

Are you referring to my MacAtt program? This is specifically built to run through 100's of drawings in a directory/sub-directories.

 

It uses ObjectDBX, which is 100x faster than opening every drawing in turn, as it can operate on the drawings without opening them :)

Link to comment
Share on other sites

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