question

Mark S3 avatar image
0 Likes"
Mark S3 asked Felix Möhlmann answered

How to use code to turn off a light?

In my model, I want to turn off one light, but the other lights are on. How do I control this in code .L Look forward to your help .

lightV21.1.fsm

FlexSim 22.1.2
light
lightv211.fsm (33.2 KiB)
5 |100000

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

1 Answer

Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered

Either switch the value of the "enabled" node (0 = off, 1 = on) or edit the value of the "intensity" to change the brightness of the light.

1673248345616.png

Object light = Model.find("AreaLight1");
light.setVariable("enabled", 0)

1673248345616.png (6.0 KiB)
5 |100000

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