+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15
  1. #1
    Senior Member TimZilla's Avatar
    Using
    AutoCAD 2009
    Join Date
    Mar 2008
    Location
    North Carolina
    Posts
    120

    Default Edit Multiple Blocks (color) at once?

    Registered forum members do not see this ad.

    Let's say I have a whole bunch of blocks, and they are all different colors. I want to make them all one color without having to go into the block editor screen for each one.

    there has to be a way.
    I thank all of you who take time out of your life to help me. I hope this is not asking to much of those who do help, but could you give detailed instructions because I know only the basics. -Thanks a million

  2. #2
    Junior Member
    Using
    AutoCAD 2010
    Join Date
    Apr 2010
    Posts
    18

    Default

    Redefine the block with the color you need. Autocad will ask you if you want to update the current block definitions in the drawing.

  3. #3
    Luminous Being dbroada's Avatar
    Computer Details
    dbroada's Computer Details
    Operating System:
    Windows 7 Professional
    Computer:
    Dell
    CPU:
    Intel Xeon E5-1603@2,80GHz
    RAM:
    4GB
    Graphics:
    NVIDA Quadro K600
    Monitor:
    DELL 23" & SAMSUNG 21"
    Using
    not applicable
    Join Date
    Nov 2005
    Location
    Kenley, Surrey, UK
    Posts
    5,644

    Default

    This really does come down to doing it right in the first place. You should only define colours & layers in blocks if you REALLY need to. It is far better to create your geometry on Layer 0 and use colour byLayer or byBlock. That way all you need do is put your blocks on a different layer or assign them a different clour and its all done.
    "That's it. It's one thing for a ghost to terrorize my children, but quite another for him to play my Theremin." Homer Simpson
    "Everything in drafting is logical. Except what isn’t." - Gavin Guile. (from the Lightbringer series of books by Brent Weeks)

    Dave

  4. #4
    Senior Member TimZilla's Avatar
    Using
    AutoCAD 2009
    Join Date
    Mar 2008
    Location
    North Carolina
    Posts
    120

    Default

    Quote Originally Posted by dbroada View Post
    This really does come down to doing it right in the first place. You should only define colours & layers in blocks if you REALLY need to. It is far better to create your geometry on Layer 0 and use colour byLayer or byBlock. That way all you need do is put your blocks on a different layer or assign them a different clour and its all done.

    Well, I have to put other peoples plans into my drawing. For instance the HVAC, machanical drawings. Those guys use about 20 different colors, and everything is a block. I like making all the other trades stuff a certain color and lock it. That way when I draw my piping I can focus.

    If everyone did like you say, it would work just fine.
    I thank all of you who take time out of your life to help me. I hope this is not asking to much of those who do help, but could you give detailed instructions because I know only the basics. -Thanks a million

  5. #5
    Luminous Being dbroada's Avatar
    Computer Details
    dbroada's Computer Details
    Operating System:
    Windows 7 Professional
    Computer:
    Dell
    CPU:
    Intel Xeon E5-1603@2,80GHz
    RAM:
    4GB
    Graphics:
    NVIDA Quadro K600
    Monitor:
    DELL 23" & SAMSUNG 21"
    Using
    not applicable
    Join Date
    Nov 2005
    Location
    Kenley, Surrey, UK
    Posts
    5,644

    Default

    in that case to answer your original question, I think programatically is about the only way.
    "That's it. It's one thing for a ghost to terrorize my children, but quite another for him to play my Theremin." Homer Simpson
    "Everything in drafting is logical. Except what isn’t." - Gavin Guile. (from the Lightbringer series of books by Brent Weeks)

    Dave

  6. #6
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,720

    Default

    You can edit a block and change all the stuff inside heres a lisp about changing the line type in every block where a particular line type was found to a different one.

    I got the source from the forum here its called block edit
    Code:
    ; my line only change
    ;(defun c:normblocks (/ adoc) 
      (vl-load-com) 
      (setq adoc (vla-get-activedocument (vlax-get-acad-object))) 
      (vla-startundomark adoc) 
      (vlax-for block (vla-get-blocks adoc) 
        (if   (not (wcmatch (strcase (vla-get-name block) t) "*_space*")) 
          (vlax-for   ent block 
     
    (if  (= (vla-get-linetype ent ) "solid" ) 
    (progn
    (vla-put-linetype ent "Continuous")
    (princ (vla-get-name block))
    )
    );_ end of if
     
       ) ;_ end of vlax-for 
          ) ;_ end of if 
        ) ;_ end of vlax-for 
      (vla-regen adoc acactiveviewport) 
      (vla-endundomark adoc) 
      (princ) 
    ;)
    complete code should be easy to change color
    Code:
    (defun c:normblocks (/ adoc) 
      (vl-load-com) 
      (setq adoc (vla-get-activedocument (vlax-get-acad-object))) 
      (vla-startundomark adoc) 
      (vlax-for block (vla-get-blocks adoc) 
        (if   (not (wcmatch (strcase (vla-get-name block) t) "*_space*")) 
          (vlax-for   ent block 
      ; (vla-put-color ent 0) 
       (vla-put-linetype ent "Bylayer") 
       (vla-put-lineweight ent aclnwtbyblock) 
       ) ;_ end of vlax-for 
          ) ;_ end of if 
        ) ;_ end of vlax-for 
      (vla-regen adoc acactiveviewport) 
      (vla-endundomark adoc) 
      (princ) 
      ) ;_ end of defun
    (defun c:normblock (/ adoc selset) 
      (vl-load-com) 
      (setq adoc (vla-get-activedocument (vlax-get-acad-object))) 
      (vla-startundomark adoc) 
      (if (setq selset (ssget "_:S:L" '((0 . "INSERT")))) 
        (vlax-for ent (vla-item 
              (vla-get-blocks adoc) 
              (cdr (assoc 2 (entget (ssname selset 0)))) 
              ) ;_ end of vla-item 
          (vla-put-color ent 0) 
          (vla-put-linetype ent "ByBlock") 
          (vla-put-lineweight ent aclnwtbyblock) 
          ) ;_ end of vlax-for 
        ) ;_ end of if 
      (vla-endundomark adoc) 
      (princ) 
      ) ;_ end of defun
    found color by layer
    Code:
      (vl-load-com) 
      (setq adoc (vla-get-activedocument (vlax-get-acad-object))) 
      (vla-startundomark adoc) 
      (vlax-for block (vla-get-blocks adoc) 
        (if   (not (wcmatch (strcase (vla-get-name block) t) "*_space*")) 
          (vlax-for   ent block 
       (vla-put-color ent 0) 
       (vla-put-linetype ent "Bylayer") 
       (vla-put-lineweight ent aclnwtbyblock) 
       ) ;_ end of vlax-for 
          ) ;_ end of if 
        ) ;_ end of vlax-for 
      (vla-regen adoc acactiveviewport) 
      (vla-endundomark adoc) 
      (princ)

  7. #7
    Senior Member TimZilla's Avatar
    Using
    AutoCAD 2009
    Join Date
    Mar 2008
    Location
    North Carolina
    Posts
    120

    Default

    This is wonderful BigAL, hopefully it works.
    I thank all of you who take time out of your life to help me. I hope this is not asking to much of those who do help, but could you give detailed instructions because I know only the basics. -Thanks a million

  8. #8
    Senior Member TimZilla's Avatar
    Using
    AutoCAD 2009
    Join Date
    Mar 2008
    Location
    North Carolina
    Posts
    120

    Default

    wow, I made all of these a Lisp file, loaded them into CAD. AND BOOM!

    I can change ever single block to what ever color I want! simply by clicking on it and changing the color!

    I do not have to go into the block edit!

    just load, and it automatically makes every block perfect.

    this is going to save me so much time BigAL. Just wanted to let you know you made somebody's life easier. Wow, I feel like I can take longer breaks now! Coffee? sounds good to me
    I thank all of you who take time out of your life to help me. I hope this is not asking to much of those who do help, but could you give detailed instructions because I know only the basics. -Thanks a million

  9. #9
    Senior Member Geobuilder's Avatar
    Computer Details
    Geobuilder's Computer Details
    Operating System:
    Windows 7 Professional
    CPU:
    Intel(R) Corel(TM) i7 860 @ 2.80GHz 2.80 GHz
    RAM:
    8 GB DDR2
    Graphics:
    NVIDIA GeForce GTS 250 (Microsoft Corporation - WDDM v1.1)
    Monitor:
    22 "
    Using
    AutoCAD 2013
    Join Date
    Jan 2010
    Location
    Russia, Siberia
    Posts
    211

    Default

    Another program for normalizing blocks the current drawing
    Example call:
    (Norm-blocks bit)
    Invocation Arguments:
    bit sum of any number of the following values:
    1; layer of the object - "0"
    2, line type of object - ByBlock
    4, line weight of the object - ByBlock
    8, line color object - ByBlock
    16; scale line object - 1
    nil or <1 - Exit Program


    (Norm-blocks 1); transfer all objects of all the blocks in the layer "0", without changing other settings
    (Norm-blocks 2); change the type of lines of all objects of all the blocks on the "ByBlock", without changing other properties
    (Norm-blocks 7); change the layer to "0" (1), the type of coils - at ByBlock (2); weight line - at ByBlock (4)
    Attached Files
    On this site I not only study AutoCAD but I also practice my English. If you find rough grammatical errors in my messages, please inform me with a personal message.

  10. #10
    Forum Newbie
    Using
    AutoCAD 2013
    Join Date
    Nov 2012
    Posts
    1

    Default

    Registered forum members do not see this ad.

    Can you please explain how to load the lisp file, i don't know how to use lisps. I have many blocks I want changed to the same color and cannot do it otherwise

    Quote Originally Posted by BIGAL View Post
    You can edit a block and change all the stuff inside heres a lisp about changing the line type in every block where a particular line type was found to a different one.

    I got the source from the forum here its called block edit


    complete code should be easy to change color
    Code:
    (defun c:normblocks (/ adoc) 
      (vl-load-com) 
      (setq adoc (vla-get-activedocument (vlax-get-acad-object))) 
      (vla-startundomark adoc) 
      (vlax-for block (vla-get-blocks adoc) 
        (if   (not (wcmatch (strcase (vla-get-name block) t) "*_space*")) 
          (vlax-for   ent block 
      ; (vla-put-color ent 0) 
       (vla-put-linetype ent "Bylayer") 
       (vla-put-lineweight ent aclnwtbyblock) 
       ) ;_ end of vlax-for 
          ) ;_ end of if 
        ) ;_ end of vlax-for 
      (vla-regen adoc acactiveviewport) 
      (vla-endundomark adoc) 
      (princ) 
      ) ;_ end of defun
    (defun c:normblock (/ adoc selset) 
      (vl-load-com) 
      (setq adoc (vla-get-activedocument (vlax-get-acad-object))) 
      (vla-startundomark adoc) 
      (if (setq selset (ssget "_:S:L" '((0 . "INSERT")))) 
        (vlax-for ent (vla-item 
              (vla-get-blocks adoc) 
              (cdr (assoc 2 (entget (ssname selset 0)))) 
              ) ;_ end of vla-item 
          (vla-put-color ent 0) 
          (vla-put-linetype ent "ByBlock") 
          (vla-put-lineweight ent aclnwtbyblock) 
          ) ;_ end of vlax-for 
        ) ;_ end of if 
      (vla-endundomark adoc) 
      (princ) 
      ) ;_ end of defun

Similar Threads

  1. Multiple Atrribute Edit
    By _dk_ in forum AutoLISP, Visual LISP & DCL
    Replies: 13
    Last Post: 9th Nov 2009, 08:19 pm
  2. Edit Multiple Layouts Simultaniously
    By LineDrawer5 in forum AutoCAD General
    Replies: 1
    Last Post: 9th Apr 2009, 08:06 pm
  3. edit attributes color
    By DA ICHI UKU in forum AutoCAD General
    Replies: 10
    Last Post: 2nd Dec 2007, 07:05 pm
  4. Edit multiple dimension texts at once?
    By Lucid in forum AutoCAD Drawing Management & Output
    Replies: 11
    Last Post: 6th Nov 2007, 10:08 am
  5. MULTIPLE attribute edit
    By Cparnell in forum AutoCAD General
    Replies: 3
    Last Post: 14th Feb 2003, 02:06 pm

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