Hi,
I have created a script to hide a component at start of a simulation.
def hideMyComp(simulation, isRunning):
if isRunning:
comp.Visible = False
else:
comp.Visible = True
app = getApplication()
comp = getComponent()
sim = app.Simulation
sim.OnStartStop = hideMyComp
I also want to select the component to show the “Component Properties” window so it’s visible to view and change the properties. Can anyone help with the python to select the component that contains the script please?
Thanks
VC_JW
March 19, 2022, 8:29am
2
Try it with
from vcCommand import *
app = getApplication()
sm = app.SelectionManager
comp = app.findComponent("Name_of_your_Comp")
sm.setSelection(comp)
please post if it worked for you
It is explained in 4th here:
Thanks JW, it worked with:
from vcScript import *
def hideMyComp(simulation, isRunning):
if isRunning:
comp.Visible = False
sm.setSelection(comp)
else:
comp.Visible = True
app = getApplication()
comp = getComponent()
sim = app.Simulation
sim.OnStartStop = hideMyComp
sm = app.SelectionManager
=======================
I assume if my script is in another component then I would need to use:
comp = app.findComponent(“Name_of_your_Comp”)