question

Zach B2 avatar image
0 Likes"
Zach B2 asked Benjamin W2 commented

Code to Change Fluid Material Color

I was wondering if there is a line of code that can change the fluid material's color on a fluid conveyor. I can only find a line of code to change the transparency of the fluid, but I am unable to figure out how to change the material color. Is there a scripting reference you can point me to or help me figure out the line of code? Thanks!

FlexSim 19.1.1
codefluidfluid conveyormaterial color
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

zacharyh avatar image zacharyh ♦ commented ·

Was Josh's answer helpful? If so please accept his answer. Thanks

0 Likes 0 ·

1 Answer

Joshua S avatar image
0 Likes"
Joshua S answered Benjamin W2 commented

Here is a script that you can run that changes the material color to aqua

Color materialColor = Color.aqua;
treenode materialColorNode = getvarnode(Model.find("FluidConveyor1"),"materialcolor");
materialColorNode.subnodes[1].value = materialColor.r;
materialColorNode.subnodes[2].value = materialColor.g;
materialColorNode.subnodes[3].value = materialColor.b;
materialColorNode.subnodes[4].value = materialColor.a;
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Benjamin W2 avatar image Benjamin W2 commented ·

Hi @Zach B2,

Was Josh able to answer your question? If so, please click Accept. If not, how else can we help?

0 Likes 0 ·