Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Working with sliderPy can be quite tricky — the API is very thin, the documentation only shows raw method signatures, and I learned that you have to manually cast between SldComponent, SldSymbol, SldBranch, and SldLink to get what you need.

The approach I found that works is:

Start with a generic SldComponent, cast it step by step to SldSymbol and then to SldBranch so you can access its network links (at this point branch should be an SldBranch).

Pick one of the two links, cast it to SldLink, create a SldPoint at the desired coordinates, and finally call diagram.CreateKneePoint() to insert a new knee point on that link.

component                           # Sld component
symbol = component.SldSymbol()      # Cast SldComponent -> SldSymbol
branch = symbol.SldBranch()         # Cast SldSymbol    -> SldBranch
links  = branch.GetLinks()          # Gets 2 links to from and to bus ports
link0  = links[0].SldLink()         # Cast SldComponent -> SldSymbol

x, y = 1, 0
point = sliderPy.SldPoint(x, y)     # Position to add the kneepoint
kneepoint = diagram.CreateKneePoint(point, link0)