Notifications
Clear all

[Closed] Need a script

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

8 Replies

Get it here!

You, sir, are a legend! :deal:

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

looks around

Many thanks!
Josh

Simple.
[ol]
[li]Copy the script to your max\ui\macroscripts folder [/li][li]Restart max. [/li][li]Go into Customize \ Cusomize User Interface… \ [/li][li]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.[/li] OR

 [left]Go into the Toolbars tab, find [b]Wahooney Tools[/b] in the Category Droplist, find [b]Convert Layer ACI Colours to Materials[/b] and drag-and-drop it onto one of MAx's toolbars.
 
 [center]OR
 
 [left]Go into the Quads tab, find [b]Wahooney Tools[/b] in the Category Droplist, find [b]Convert Layer ACI Colours to Materials[/b] and drag-and-drop it into a quad menu.[/left]
 
 [/left]
 [/center]

[/ol] Easy huh

I just hope I interpreted the request properly.

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!

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.

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!

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.

1 Reply
(@dj-studd)
Joined: 2 years ago

Posts: 0

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 🙁 )
– Josh

edit: corrected some sleep-related typos.