+ Reply to Thread
Results 1 to 5 of 5

Thread: att edit help

  1. #1
    Senior Member daveyboyd's Avatar
    Using
    AutoCAD 2010
    Join Date
    Apr 2006
    Location
    Liverpool, UK
    Posts
    127

    Default att edit help

    Registered forum members do not see this ad.

    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

  2. #2
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,707

    Default

    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.
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  3. #3
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,707

    Default

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

    Code:
    (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;

    Code:
    (attchng "blockname" "tagname" "newtagvalue")
    But you will need to make sure it is being loaded in every drawing.
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  4. #4
    Senior Member daveyboyd's Avatar
    Using
    AutoCAD 2010
    Join Date
    Apr 2006
    Location
    Liverpool, UK
    Posts
    127

    Default

    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?

  5. #5
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,707

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by daveyboyd View Post
    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
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

Similar Threads

  1. Cannot edit!!!
    By slowsilver! in forum AutoCAD Drawing Management & Output
    Replies: 7
    Last Post: 4th Feb 2010, 07:41 pm
  2. Edit DWF
    By Fire Alarm in forum AutoCAD General
    Replies: 6
    Last Post: 10th Nov 2009, 02:29 pm
  3. edit ground in view edit corridor sections
    By ikapo in forum Civil 3D & LDD
    Replies: 3
    Last Post: 10th Apr 2009, 10:24 am
  4. x-ref edit
    By venuj99 in forum AutoCAD General
    Replies: 2
    Last Post: 28th Nov 2008, 11:13 am
  5. 3D Edit
    By Aravinthan in forum AutoCAD 3D Modelling & Rendering
    Replies: 16
    Last Post: 7th Nov 2007, 11:16 am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts