Other than controlling it by a spreadsheet, most of what you want to do is possible through display themes in AutoCAD Architecture. Instead you could control it by schedule or property set.
If you want to do it in Excel. Then in Excel explore the CONDITION statement.
It sort of goes "If cell A1 is 20 then the background colour of B1 should be green"
Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
As was mentioned I think it will take a specially written code to accomplish this task. I'm currently looking at other articles to see how the code is formatted. I basically need it to look in Column A of a spreadsheet and select a block with the same name. Then change the layer the block is on based off of information in Column B. The colors would be updated bi-weekly and monthly or whenever an updated print was needed. I would choose to run the command manually each time. The biggest need for this is to be able to save time as this will eventually be used to change the layer of over 300 or more blocks. Thanks for all the imput so far. I'm hoping with some more insight and learning I can get to my goal.
I do have different objective but with the same approach, hatch color with excel value,
An object's color property can be changed with the chprop command.
In the following Excel worksheet and AutoCAD drawing group names are assigned to a room's hatching. This enables the easy selection of an object by name. Excel is used to create a command that can be copied/pasted into AutoCAD to change the colors.
In the worksheet above, the cell E3 contains the following:
=CONCATENATE("(COMMAND ",CHAR(34),"chprop",CHAR(34)," ",CHAR(34),"g",CHAR(34)," ",CHAR(34),B3,CHAR(34)," ",CHAR(34),CHAR(34)," ",CHAR(34),"c",CHAR(34)," ",D3," ",CHAR(34),CHAR(34),")")
It produces the following output:
(COMMAND "chprop" "g" "ROOM1" "" "c" 2 "")
which tells AutoCAD to use the chprop command and then select group ROOM1 and change its color ("c") property to 2 (the AutoCAD color yellow). Since the Excel concatenate command uses a quote mark (") to denote a text string and a vlisp statement requires a quote mark to distinguish a text string from a variable, the ASCII character for quote (CHAR(34)) is used to output quote marks when needed.
The Excel function VLOOKUP is used to define the rules for coloring the hatch. Note that cell D3 contains:
=VLOOKUP(C3,$A$15:$C$18,3)
This takes the value in cell C3 (the percent used value for office 1) and searches the first column of the table defined by $A$15:$C$18 and returns the corresponding value in the 3rd column. Thus a % equal t to 0 but less than 50% will returns 2, 50% to less than 70% returns 96, etc. (note, $'s are used in the cell range reference $A$15:$C$18 to ensure an absolute reference when the cell is filled down for other rows.
To use the spreadsheet you should:
The hatching will change colors as specified.
The process could be more automated by having an AutoCAD script file (.scr) generated and then have AutoCAD run the script.
Here are the results.
Of course other rules can be used to define colors.