PDA

View Full Version : Need a script


DJ-Studd
09-12-2005, 02:42 AM
Hi Guys,
hopefully someone here can help out.

I need a script that does something like this:

LOOP each layer in drawing
Fetch ACI colour of currently selected layer and store as $acivariable
Select all objects within current layer
Apply material that matches $acivariable to selected objects
REPEAT LOOP


I would have a map of materials and ACI colours, something like this
MaterialName_1 <TAB> ACI#1
MaterialName_2 <TAB> ACI#43
MaterialName_3 <TAB> ACI#49

Essentially I'm after a script that does what this plugin does - ACI2MAT (http://www.habware.at/duck6.htm) - but instead works off the layer colour rather than the object colour.

I would be in debt to anyone that can help.

Cheers!
Josh

Wahooney
09-12-2005, 06:13 AM
Get it here (http://www.wahooney.net/download.php?view.25)!

:thumbsup:

DJ-Studd
09-12-2005, 06:30 AM
You, sir, are a legend! :deal:

Now I just have to figure out how to use it, doh!:shrug:

*looks around*

Many thanks!
Josh

Wahooney
09-12-2005, 09:19 AM
Simple.

Copy the script to your max\ui\macroscripts folder
Restart max.
Go into Customize \ Cusomize User Interface... \
Now you'll either go into the Keyboard tab, find Wahooney Tools in the Category Droplist, find Convert Layer ACI Colours to Materials and assign a keyboard shortcut to it.
OR

Go into the Toolbars tab, find Wahooney Tools in the Category Droplist, find Convert Layer ACI Colours to Materials and drag-and-drop it onto one of MAx's toolbars.

OR

Go into the Quads tab, find Wahooney Tools in the Category Droplist, find Convert Layer ACI Colours to Materials and drag-and-drop it into a quad menu.




Easy huh ;)

I just hope I interpreted the request properly.

DJ-Studd
09-12-2005, 10:11 AM
Cheers mate.
How do I go about defining the mapping between ACI colours and materials to apply?

Ta :)
Josh

Edit: I'm a bit tired, so what I wrote above might not make sense. Let's try re-writing that.

How do I go about telling the script which material to apply to which ACI colour.
IE, if the ACI colour is 1, apply a material named "001 RED", etc.

Cheers!

Wahooney
09-12-2005, 10:22 AM
I think I have misinterpreted your request.

All the plugin that I've made does is go through all the layers in the scene and make new materials that have the same diffuse as the layer's wirecolor. Could you tell me EXACTLY what you want the script to do. I think I'm getting the idea of what you want but I'd rather be 100% sure before I tackle it.

DJ-Studd
09-12-2005, 10:28 AM
Whoop, sorry about that. Thanks for spending the time to do this :)

I've got a scene that has about 40 layers. Each layer contains a number (could be one, could be 50) of objects. The layer has a colour set (In this case it's an ACI colour, as the drawing was imported from AutoCad).

I have a bunch of pre-made materials in my library.
For example:

001 RED
002 BLUE
003 GREEN
043 JARRAH TIMBER
047 EARTH BROWN

The numbers in the material names are just for reference. I'd like to make a text file (Or even just embed it in the script) so that if the ACI colour of my layer is ACI#1, all objects within the layer will have the material named "001 RED" applied. If the layer colour is ACI#3, the material with the name "003 GREEN" will be applied.

The ACI2MAT plugin that I spoke of earlier requires you to make a text file like so:

001 RED<tab>1
002 BLUE<tab>2
etc.


This information could be embedded within the script.

Let me read over this to make sure it makes sense...

-- Josh


Edit: I think that makes sense! I'll be around for a few hours if you need me to clarify. Cheers!

Wahooney
09-12-2005, 11:22 AM
I've had a look and it seems that maxScript doesn't have direct support for ACI colours. What I could do is get a list of ACI colours and their corresponding RGB values, this will slow the script down a bit but it should still work fine.

Do you know where I can get a list of the ACI colours? I've googled but I'm haveing no luck so far.

DJ-Studd
09-12-2005, 10:47 PM
I've had a look and it seems that maxScript doesn't have direct support for ACI colours. What I could do is get a list of ACI colours and their corresponding RGB values, this will slow the script down a bit but it should still work fine.

Do you know where I can get a list of the ACI colours? I've googled but I'm haveing no luck so far.

Forums picked a bad time to go down last night.

I spent a few hours last night doing this: http://www.djstudd.com/aci.html

Then I discovered this: https://tsc.wes.army.mil/products/tssds-tsfms/tssds/symbols/autocad/autocad_RGB.pdf

Use whichever of the two charts you please :)
(I'm tired :sad: )
-- Josh


edit: corrected some sleep-related typos.

CGTalk Moderation
09-12-2005, 10:47 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.