Glen Smith Posted August 3, 2009 Posted August 3, 2009 Is there a way to build a block in such a way that it will change the color of a hatch based on an attribute? I'm using Electrical 2010. I'm building a block to hold keying information for a large, secure, building, what I want to do is have the same block on each door with (at least) 4 attributes: key type, key change code, door number and lock type. It is much easier visually to pick out door sets (those on the same master) if they are color coded. Thus if the key change code is 1, a hatched area in the block would be red, 2 = blue ... There are enough possible combinations that I need to be able to control 2 different hatched area colors independantly. Oh, and just to make it challenging, ideally the solution would be compatible with '05LT, since that is what the guy I'm covering for is using. His current solution is copy/pasting a group - not a block - with text in it around the drawing. Any thoughts? Glen Quote
BIGAL Posted August 4, 2009 Posted August 4, 2009 It can be done only thing is the hatch may have to be seperate from the block not sure you can change hatch colour in block which is not that bad because you always know where the hatch is relative to the block so therefore based on attribute value change colour. The other way would be if limited colours say 5 then create 5 blocks and substitute block with new colour block and update attributes. There is definatley code here on forum for itterogate block to find attributes delete block add new block with old attributes I would go down that path Also LT is a problem can not run lisp or VBA but may be able to use attsync to copy values from one block to a new block. Quote
dbroada Posted August 4, 2009 Posted August 4, 2009 I don't know if electrical has any special constructs but in plain AutoCAD 2 independant colours in one block is not easy but is possible. You could create all other items with their colours set and then have one hatch "by layer" and one hatch "by block" and then the colour can be controled by what layer the block is put on and by what colour you chose for the block. Another alternative is using a dynamic block but unless you can now have 2 visibility parameters (you can't with 2008/2009) you are left having to have one visibility state for each possible combination. I don't think either of these solutions can be automatic but could probably be suitable for coding. Quote
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.