i would like to simulate an “illuminated pushbutton” which is often used in machines for acknowledge buttons.
The button should basically be an output (pressing the button) and an input (button light ON/OFF).
The only way I could figure out is to change the property name of the button for the highlighting:
button light ON -> btnProperty.Name = ‘Button ◎’
button light OFF -> btnProperty.Name = ‘Button ◉’
In the “Component Graph”, the name changes as desired, but in the “Component Properties”, its not changing. Is there a way, that it’s changing in the “Component Properties” too during the simulation?
Is there another approach? Such as setting the button color.
Thank you very much in advance!
I tried changing the name of a property and it changed on both panels immediately “Component Graph” and “Component Properties”.
This worked when the simulation was running as well as when the simulation was paused.
Nevertheless are you sure you want to change the property name instead of the property value?
Yes you can also change the button color, for that you need to get the button feature.
greenMaterial = getApplication().findMaterial('green')
feature = buttonComponent.findFeature(‘button’)
feature.Material = greenMaterial
Whether property name is updated properly or not might depend on the application version. For me it worked like Johnny mentioned. If you want to change the button color on the property panel (and not on the 3D scene) I think it is not possible.
This kind of interactive button could be made on the 3D scene by using JogInfo behaviours. Check the attached component ButtonWithLight. To test the component load two instances of it and connect button1’s input to button2’s output and vice versa. Run the simulation and click the buttons on the 3D scene with “Interact”. They should light up each other by changing to material to lighter green. This is a little sketchy solution as you always also select the button component when interacting with it on the 3D scene but it is still functional. On eCat there is also component “Signal Tester” which does something similar.
ButtonWithLight.vcmx (36.5 KB)
Thank you very much for your responses!
@Johnny: The reason why I wanted to change the name is because I want to highlight the states of the input signal.
That’s true, changing the color of a component’s feature does exactly what I am looking for. My initial idea was to change the color of the property “Button” which is not possible as Keke mentioned.
@Keke: It’s unfortunate, that there is no coloring possible for the “Button” properties. I had a look at the “ButtonWithLight.vcmx”. I really like it and it does exactly what I was searching for! Thanks a lot!
@Johnny and Keke: I tried changing the name of the button (VC version 4.1.1). In my case, it only worked properly, when I coded the behaviour, saved and restarted the project. In this case, I used the OnChanged event of the Button to change the name.
However, when I used the Input signal event to change the button name, only the “Component Graph” upated the name, but the “Component Properties” did not. This case would be my desired behaviour.
If you want to have a look, I applied the test cases in the “ButtonWithLight.vcmx”.
ButtonWithLight_2.vcmx (18.2 KB)
I tested your component and experienced similar behaviour. During simulation the name is not updated correctly on the component properties pane.
the support confirmed the bug and it’s handled with the bug number 23406.