Changing Colors Dynamic Component


#1

I have created a dynamic componat that has 2 options to change the materials on 2 diffrent parts in the componant.
What I want to do i just to make 1 option that switches the materials on both those parts with the same option.
It has to be 2 different materials for the 2 parts.
Here is a link to the file: http://www.filedropper.com/test_49

Any1 that can help?


Component Options drop-down list material schemes (more than two)
#2

Use an If Statement in the materials.
If the Parent (overall) option says Material 1
Then the 2 parts’ materials will be whatever 2 different combo you want


#3

Thanks for the quick reply, however Im not able to get it to work. Im getting this error message when I put in the function. I probably have the wrong function or something, can you tell me whats wrong?


#4

I think that you are making this too complex. Just set the Material attribute equal to the value selected by the user:

For the Topp, Material = (then click on the Custom Topp value) then hit Enter. After this, when you change the top material in the UI and click Apply, it changes.


#5

Well the thing is:
Lets say I have component of two cubes, Cube 1 and Cube 2.
When I select color scheme “A”, Cube 1 will be Red and Cube 2 will be Green.
When I select color scheme “B”, Cube 1 will be Blue and Cube 2 will be Yellow.

This is the principle that I am after, I dont want change the cubs materials separately.

Thanks for the reply anyway.


#6

In that case… yes, you will need to set a “flag” with the UI and have the material change, based on that flag.

You do, however, have to load the material into the model first.


#7

Yes i am aware of that. But how does the formula look like to get it to work.
Or am I doing this wrong?

I have attached a simple model.If Function.skp (84.4 KB)


#8

Hey, not on a computer to check, but it’ll be something like this:
The parent attribute:
Custom Atttribute: a dropdown menu where you assigned Scheme A a value of A

Child attribute for Cube 1
Material= IF(Parent!Custom=“A”,ColourRed,ColourBlue)

Child attribute for Cube 2
Material= IF(Parent!Custom=“A”,ColourBlue,ColourYellow)


#9

This is what I have been trying to do but cant get it to work. :frowning:


#10

Made it work, need to put the material I wanted to use between “”. :slight_smile:

Thanks for all the help and have a nice day!


#11

Gah! I knew it was something like that! Good job figuring it out!