Volume sensor based on material

Hello
I am trying to model a volume sensor. I got it working with some simple lines of code but I want it to only trigger with a certain material. From what I understand is that with the ComponentSignal I should be able to extract this property. The file included I am just trying to print the material (“white”) to test it. I am no sure how to access this property.

Now I have sensor.Component.Material and this returns none, so i don’t know if I should use something like sensor.ComponentSignal … or something else.

Ps. don’t mind the other components on the conveyor, it is the first orange one after the feeder
Cylinder_In_VC.vcmx (106.9 KB)

Thanks in advance.

1 Like

Hey kamiel,

I modified your code snippet so it will now print correctly.
Change the line 8 to:
test = sensor.ComponentSignal.Value.Material.Name
and then you should print out “white”

I would also recommend checking the Help file > vcBehaviour → search for “volume sensor” behaviour so you can see its exact attributes.

bR
Lefa

2 Likes

Thank you so much I tried that line but I forgot the “.Value” in there