0

get id from selected branch

Using slider.py, I've been reading the labels to identify selected bus numbers and branches. How do I get the branch id of a selected branch? This is especially pertinent when I have parallel branches.

nwilson's avatar
100
nwilson
asked 2016-12-07 10:40:20 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

Once you've identified the component from your SLD, you can use GetMapString(), which contains the from bus, to bus, and circuit ID.

string = comp.GetMapString()

which gives you an output like

LI      1    7 99

which indicates from bus 1, to bus 7, and circuit ID 99.

mjinli's avatar
41
mjinli
answered 2016-12-08 16:35:33 -0500
edit flag offensive 0 remove flag delete link

Comments

Thanks, works perfect. I added .split() to be able to cleanly reference each returned item.

nwilson's avatar nwilson (2016-12-09 14:10:38 -0500) edit

Folks, I'm trying just this and haven't been able to get it to work. My procedure: I import sliderPy I select a branch from the GUI I try both running the script [string = comp.GetMapString()] or typing in the command line. No luck. Get an exception. What am I missing? Thanks.

urbancat's avatar urbancat (2017-03-17 14:02:31 -0500) edit

mydoc = sliderPy.GetActiveDocument()
mydiagram = mydoc.GetDiagram()
mycomponents = mydiagram.GetComponents()
for comp in mycomponents:
  string = comp.GetMapString()

nwilson's avatar nwilson (2017-04-28 17:09:57 -0500) edit
add a comment see more comments

Your Answer

Login/Signup to Answer