daveyboyd Posted February 17, 2010 Share Posted February 17, 2010 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 Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 17, 2010 Share Posted February 17, 2010 Obviously I'm going to plug my own program 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. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 17, 2010 Share Posted February 17, 2010 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. Quote Link to comment Share on other sites More sharing options...
daveyboyd Posted February 17, 2010 Author Share Posted February 17, 2010 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? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 17, 2010 Share Posted February 17, 2010 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.