Results 1 to 7 of 7

Thread: Change Attribute Properties within an existing block...?

  1. #1
    Member
    Join Date
    2006-10
    Posts
    5
    Login to Give a bone
    0

    Default Change Attribute Properties within an existing block...?

    Hi,
    I have several blocks that have various colors of text for the attributes, what I need to do is find a way of changing the color to BYLAYER instead of let's say red, green, and yellow. I have tried updating the block but because they have changed the color of the individual attributes after insertion it is killing me to double click each one, pick PROPERTIES in the Enhanced Attribute Editor and change the color to BYLAYER. AAARRRGGG....!

    I know there have to be better ways to do this, is there some kind of command or code I can run to change everything to BYLAYER no matter if it is a nested attribute within the drawing?
    Any help will be greatly appreciated!
    Thanks,
    Brian

  2. #2
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Change Attribute Properties within an existing block...?

    Try the command setbylayer

  3. #3
    Member
    Join Date
    2006-10
    Posts
    5
    Login to Give a bone
    0

    Default Re: Change Attribute Properties within an existing block...?

    That looks like it will work, but how can I ad that into an existing LISP file? (command "-setbylayer" "all" " " "y" "y" ) does not seem to work...

  4. #4
    I could stop if I wanted to
    Join Date
    2015-12
    Posts
    385
    Login to Give a bone
    0

    Default Re: Change Attribute Properties within an existing block...?

    Quote Originally Posted by Brian.Shick View Post
    ... it is killing me to double click each one, pick PROPERTIES in the Enhanced Attribute Editor and change the color to BYLAYER. AAARRRGGG....!
    After updating the block use the attsync command.

  5. #5
    I could stop if I wanted to
    Join Date
    2015-10
    Location
    Colorado Springs, CO
    Posts
    369
    Login to Give a bone
    0

    Default Re: Change Attribute Properties within an existing block...?

    Not lisp, but I use a macro assigned to a button for my setbylayer use.

    Code:
    ^C^C_setbylayer;all;;;;

  6. #6
    Member
    Join Date
    2006-10
    Posts
    5
    Login to Give a bone
    0

    Default Re: Change Attribute Properties within an existing block...?

    I found this bit of LISP that can take care of some of my other problems, but I don't know where to make a change so that it will get all of the Mtext in a drawing without prompting to pick it.

    Code:
    (defun c:StpMtext (/ ss ent1 ent2 tstr1 tstr2)
    ; Strips Mtext of certain formating
    
    (command "_.undo" "_end")
    (command "_.undo" "_group")
    (if (setq ss (ssget '((0 . "MTEXT"))))
     (while (/= (sslength ss) 0)
      (setq ent1 (ssname ss 0))
      (setq ent2 (vlax-ename->vla-object ent1))
      (setq tstr1 (vlax-get ent2 'TextString))
      (setq tstr2 (StripString tstr1))
      (vlax-put ent2 'TextString tstr2)
      (ssdel ent1 ss)
     ); while
    ); if
    (command "_.undo" "_end")
    (princ)
    )
    
    ;-------------------------------------
    
    (defun StripString (String / cstr1 cstr2 nString cnt1 tstr1)
    ; Strips out formation for color, font, height and width.
    
    (setq cnt1 1)
    (while (and (setq cstr1 (substr String 1 1)) (> (strlen String) 0))
     (if (= cstr1 "\\")
      (progn
       (setq cstr2 (substr String 2 1))
       (if (member (strcase cstr2) '("C" "F" "H" "W"))
        (progn
         (while (/= (substr String cnt1 1) ";")
          (setq cnt1 (1+ cnt1))
         ); while
         (setq String (substr String (1+ cnt1) (strlen String)))
         (setq cnt1 1)
        ); progn
        (progn
         (if nString
          (setq nString (strcat nString (substr String 1 1)))
          (setq nString (substr String 1 1))
         ); if
         (setq String (substr String 2 (strlen String)))
        ); progn
       ); if
      ); progn
      (progn
       (if nString
        (setq nString (strcat nString (substr String 1 1)))
        (setq nString (substr String 1 1))
       ); if
       (setq String (substr String 2 (strlen String)))
      ); progn
      (princ)
    )
    [Moderator] - Potential code source: http://www.cadtutor.net/forum/showth...l=1#post278208
    Last edited by BlackBox; 2014-09-10 at 01:31 PM. Reason: Please use [CODE] Tags

  7. #7
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: Change Attribute Properties within an existing block...?

    Quote Originally Posted by Brian.Shick View Post
    I found this bit of LISP that can take care of some of my other problems, but I don't know where to make a change so that it will get all of the Mtext in a drawing without prompting to pick it.
    In the future you should add a thread for each question. Take a look at StripMtext at http://cadabyss.wordpress.com/ Nice dialog box routine that I've used many years that supports "noun/verb" selection so selecting all it will quickly remove selected Mtext formatting embedded in Mtext, Mleaders, Dimensions, Tables, and Multiline Attributes.

Similar Threads

  1. adding an attribute to an existing block
    By amasutti in forum AutoLISP
    Replies: 2
    Last Post: 2013-03-20, 04:30 PM
  2. Replies: 13
    Last Post: 2012-09-18, 07:51 PM
  3. remove attribute from an existing block
    By avatar in forum AutoCAD General
    Replies: 1
    Last Post: 2012-02-11, 10:39 PM
  4. add new attribute to existing block
    By rklee in forum AutoLISP
    Replies: 6
    Last Post: 2008-06-24, 02:46 PM
  5. How to change text properties in Attribute?
    By pravin_kul69936 in forum AutoCAD Mechanical - General
    Replies: 2
    Last Post: 2004-11-30, 10:18 AM

Tags for this Thread

Posting Permissions

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