IscDiagram

class ipsa.IscDiagram

The IscDiagram class provides access to graphical data on a single IPSA diagram. These functions allow network components to be drawn, display options to be set and deleted.

The creation of items on the diagram also creates the associated network components. The parameters of these components can then be set using the functions described for the particular component types.

The origin for the co-ordinates is normally the top left corner of the diagram. Positive values of X are to the right whilst positive values of Y are down below the origin.

GetName() str

Returns the name of the diagram.

Returns:

The name of the diagram.

Return type:

str

SetName(strName: str) None

Sets the name of the diagram.

Parameters:

strName (str) – The name of the diagram.

GetUID() int

Returns the unique diagram ID.

Returns:

The ID of the diagram.

Return type:

int

CreateBusbarPoint(strName: str, dX: float, dY: float) int

Creates a new busbar component on the diagram. A point busbar symbol is a small dot which does not resize as the diagram zoom level is changed.

Parameters:
  • strName (str) – The busbar name.

  • dX (float) – The busbar x coordinate.

  • dY (float) – The busbar y coordinate.

Returns:

The unique ID of the new busbar.

Return type:

int

CreateBusbarJunction(strName: str, dX: float, dY: float) int

Creates a new busbar component on the diagram. A junction busbar symbol is the circular junction symbol.

Parameters:
  • strName (str) – The busbar name.

  • dX (float) – The busbar x coordinate.

  • dY (float) – The busbar y coordinate.

Returns:

The unique ID of the new busbar.

Return type:

int

CreateBusbarHexagonal(strName: str, dX: float, dY: float) int

Creates a new busbar component on the diagram. A hexagonal busbar symbol has six sides.

Parameters:
  • strName (str) – The busbar name.

  • dX (float) – The busbar x coordinate.

  • dY (float) – The busbar y coordinate.

Returns:

The unique ID of the new busbar.

Return type:

int

CreateBusbarCircular(strName: str, dX: float, dY: float) int

Creates a new busbar component on the diagram. A circular busbar symbol is a circle.

Parameters:
  • strName (str) – The busbar name.

  • dX (float) – The busbar x coordinate.

  • dY (float) – The busbar y coordinate.

Returns:

The unique ID of the new busbar.

Return type:

int

CreateBusbarRectangular(strName: str, bHorizontal: bool, dX: float, dY: float) int

Creates a new busbar component on the diagram. The rectangular symbol is the standard horizontal or vertical busbar.

Parameters:
  • strName (str) – The busbar name.

  • bHorizontal (bool) – True draws a horizontal rectangular busbar, while False draws a vertical busbar.

  • dX (float) – The busbar x coordinate.

  • dY (float) – The busbar y coordinate.

Returns:

The unique ID of the new busbar.

Return type:

int

DrawBusbarPoint(nUID: int, dX: float, dY: float) bool

Draws an existing busbar component on the diagram as defined by the busbar UID. A point busbar symbol is displayed as a small dot which does not resize as the diagram zoom level is changed.

Note this will only have an effect if the busbar is not already drawn.

Parameters:
  • nUID (int) – The busbar UID.

  • dX (float) – The busbar x coordinate.

  • dY (float) – The busbar y coordinate.

Returns:

Boolean denoting whether the busbar was drawn.

Return type:

bool

DrawBusbarJunction(nUID: int, dX: float, dY: float) bool

Draws an existing busbar component on the diagram as defined by the busbar UID. A junction busbar symbol is the solid circular junction symbol.

Note this will only have an effect if the busbar is not already drawn.

Parameters:
  • nUID (int) – The busbar UID.

  • dX (float) – The busbar x coordinate.

  • dY (float) – The busbar y coordinate.

Returns:

Boolean denoting whether the busbar was drawn.

Return type:

bool

DrawBusbarHexagonal(nUID: int, dX: float, dY: float) bool

Draws an existing busbar component on the diagram as defined by the busbar UID. The hexagonal symbol is the standard filled hexagonal busbar.

Note this will only have an effect if the busbar is not already drawn.

Parameters:
  • nUID (int) – The busbar UID.

  • dX (float) – The busbar x coordinate.

  • dY (float) – The busbar y coordinate.

Returns:

Boolean denoting whether the busbar was drawn.

Return type:

bool

DrawBusbarRectangular(nUID: int, bHorizontal: bool, dSize: float, dX: float, dY: float) bool

Draws an existing busbar component on the diagram as defined by the busbar UID. The rectangular symbol is the standard horizontal or vertical busbar.

Note this will only have an effect if the busbar is not already drawn.

Parameters:
  • nUID (int) – The busbar UID.

  • bHorizontal (bool) – True draws a horizontal rectangular busbar, while False draws a vertical busbar.

  • dSize (float) – The length of the busbar symbol.

  • dX (float) – The busbar x coordinate.

  • dY (float) – The busbar y coordinate.

Returns:

Boolean denoting whether the busbar was drawn.

Return type:

bool

DrawBusbarCircular(nUID: int, dSize: float, dX: float, dY: float) bool

Draws an existing busbar component on the diagram as defined by the busbar UID. The circular symbol is the larger unfilled circle.

Note this will only have an effect if the busbar is not already drawn.

Parameters:
  • nUID (int) – The busbar UID.

  • dSize (float) – The radius of the busbar symbol.

  • dX (float) – The busbar x coordinate.

  • dY (float) – The busbar y coordinate.

Returns:

Boolean denoting whether the busbar was drawn.

Return type:

bool

CreateLine(strName: str, dXFrom: float, dYFrom: float, dXTo: float, dYTo: float) int

Deprecated in IPSA 2.10.2. Instead, use CreateBranch.

Creates a new branch component on the diagram.

Parameters:
  • strName (str) – The branch name.

  • dXFrom (float) – The x coordinate of the busbar where the branch starts.

  • dYFrom (float) – The y coordinate of the busbar where the branch starts.

  • dXTo (float) – The x coordinate of the busbar where the branch ends.

  • dYTo (float) – The y coordinate of the busbar where the branch ends.

Returns:

The unique positive ID of the new branch. A negative value is returned if the “from” end busbar is not found, and zero is returned if the “to” end busbar is not found.

Return type:

int

CreateBranch(strName: str, dXFrom: float, dYFrom: float, dXTo: float, dYTo: float) int

Creates a new branch component on the diagram.

Parameters:
  • strName (str) – The branch name.

  • dXFrom (float) – The x coordinate of the busbar where the branch starts.

  • dYFrom (float) – The y coordinate of the busbar where the branch starts.

  • dXTo (float) – The x coordinate of the busbar where the branch ends.

  • dYTo (float) – The y coordinate of the busbar where the branch ends.

Returns:

The unique positive ID of the new branch. If the branch cannot be drawn, the return value is 0.

Return type:

int

DrawLine(nUID: int) bool

Draws the symbol for the line identified by the unique ID. The line is drawn as a single segment between two busbars.

Note this will only have an effect if the line is not already drawn.

Parameters:

nUID (int) – The line UID.

Returns:

Boolean denoting whether the line was drawn.

Return type:

bool

CreateBreaker(strName: str, dX: float, dY: float) int

Creates a new circuit breaker on the diagram. Note branch has to have already been drawn.

Parameters:
  • strName (str) – The breaker name.

  • dX (float) – The x coordinate of the circuit breaker.

  • dY (float) – The y coordinate of the circuit breaker.

Returns:

The unique positive ID of the new circuit breaker. If the breaker cannot be drawn, the return value is 0.

Return type:

int

DrawBreaker(nBreakerUID: int, dX: float, dY: float) bool

Draws the symbol for the breaker identified by the unique ID nBreakerUID at the location dX,dY.

Parameters:
  • nBreakerUID (int) – The breaker UID.

  • dX (float) – The x coordinate of the circuit breaker.

  • dY (float) – The y coordinate of the circuit breaker.

Returns:

The function returns True if the breaker was drawn

Return type:

bool

CreateTransformer(strName: str, dXFrom: float, dYFrom: float, dXTo: float, dYTo: float) int

Deprecated in IPSA 2.10.2. Instead, use Create2WTransformer.

Creates a new transformer component on the diagram.

Parameters:
  • strName (str) – The branch name.

  • dXFrom (float) – The x coordinate of the busbar where the branch starts.

  • dYFrom (float) – The y coordinate of the busbar where the branch starts.

  • dXTo (float) – The x coordinate of the busbar where the branch ends.

  • dYTo (float) – The y coordinate of the busbar where the branch ends.

Returns:

The unique positive ID of the new transformer. A negative value is returned if the “from” end busbar is not found, and zero is returned if the “to” end busbar is not found.

Return type:

int

Create2WTransformer(strName: str, dXFrom: float, dYFrom: float, dXTo: float, dYTo: float) int

Creates a new transformer component on the diagram.

Parameters:
  • strName (str) – The transformer name.

  • dXFrom (float) – The x coordinate of the busbar where the transformer starts.

  • dYFrom (float) – The y coordinate of the busbar where the transformer starts.

  • dXTo (float) – The x coordinate of the busbar where the transformer ends.

  • dYTo (float) – The y coordinate of the busbar where the transformer ends.

Returns:

The unique positive ID of the new transformer. If the transformer cannot be drawn, the return value is 0.

Return type:

int

DrawTransformer(nUID: int) bool

Draws the symbol for the transformer identified by the unique ID. The transformer is drawn as a single segment between two busbars.

Note this will only have an effect if the transformer is not already drawn.

Parameters:

nUID (int) – The transformer UID.

Returns:

Boolean denoting whether the transformer was drawn.

Return type:

bool

CreateUnbalancedLine(strName: str, dXFrom: float, dYFrom: float, dXTo: float, dYTo: float) int

Deprecated in IPSA 2.10.2. Instead, use CreateUnbalancedBranch.

Creates a new unbalanced line component on the diagram.

Parameters:
  • strName (str) – The unbalanced line name.

  • dXFrom (float) – The x coordinate of the busbar where the branch starts.

  • dYFrom (float) – The y coordinate of the busbar where the branch starts.

  • dXTo (float) – The x coordinate of the busbar where the branch ends.

  • dYTo (float) – The y coordinate of the busbar where the branch ends.

Returns:

The unique positive ID of the new unbalanced line component. A negative value is returned if the “from” end busbar is not found, and zero is returned if the “to” end busbar is not found.

Return type:

int

CreateUnbalancedBranch(strName: str, dXFrom: float, dYFrom: float, dXTo: float, dYTo: float) int

Creates a new unbalanced line component on the diagram.

Parameters:
  • strName (str) – The unbalanced line name.

  • dXFrom (float) – The x coordinate of the busbar where the unbalanced line starts.

  • dYFrom (float) – The y coordinate of the busbar where the unbalanced line starts.

  • dXTo (float) – The x coordinate of the busbar where the unbalanced line ends.

  • dYTo (float) – The y coordinate of the busbar where the unbalanced line ends.

Returns:

The unique positive ID of the new unbalanced line component. If the unbalanced line cannot be drawn, the return value is 0.

Return type:

int

CreateUnbalancedTransformer(strName: str, dXFrom: float, dYFrom: float, dXTo: float, dYTo: float) int

Deprecated in IPSA 2.10.2. Instead, use CreateUnbalanced2WTransformer.

Creates a new unbalanced transformer component on the diagram.

Parameters:
  • strName (str) – The unbalanced transformer name.

  • dXFrom (float) – The x coordinate of the busbar where the branch starts.

  • dYFrom (float) – The y coordinate of the busbar where the branch starts.

  • dXTo (float) – The x coordinate of the busbar where the branch ends.

  • dYTo (float) – The y coordinate of the busbar where the branch ends.

Returns:

The unique positive ID of the new unbalanced transformer component. A negative value is returned if the “from” end busbar is not found, and zero is returned if the “to” end busbar is not found.

Return type:

int

CreateUnbalanced2WTransformer(strName: str, dXFrom: float, dYFrom: float, dXTo: float, dYTo: float) int

Creates a new unbalanced transformer component on the diagram.

Parameters:
  • strName (str) – The unbalanced transformer name.

  • dXFrom (float) – The x coordinate of the busbar where the unbalanced transformer starts.

  • dYFrom (float) – The y coordinate of the busbar where the unbalanced transformer starts.

  • dXTo (float) – The x coordinate of the busbar where the unbalanced transformer ends.

  • dYTo (float) – The y coordinate of the busbar where the unbalanced transformer ends.

Returns:

The unique positive ID of the new unbalanced transformer component. If the unbalanced transformer cannot be drawn, the return value is 0.

Return type:

int

AddPointToLine(nLineUID: int, dX: float, dY: float, bFromEnd: bool, bRefreshLine: bool) bool

Adds a knee point to the line identified by the unique ID. By default, this function will fully redraw the line the knee point has been added to. This can be disabled by setting bRefreshLine to False. The kneepoint will be added nearest to the line centrepoint on the from or to end.

Deprecated in IPSA 2.10.3 instead use AddKneepoint

Parameters:
  • nLineUID (int) – The line UID.

  • dX (float) – The knee point x coordinate.

  • dY (float) – The knee point y coordinate.

  • bFromEnd (float) – If True then the knee point is added to the last segment, i.e. furthest from the From end. If False then the knee point is added to the first segment.

  • bRefreshLine (bool) – Defaults to True. If True, the line is fully redrawn when the knee point is added.

Returns:

Boolean denoting whether the knee point was added.

Return type:

bool

AddKneepoint(nLineUID: int, dX: float, dY: float, bFromEnd: bool, bRefreshLine: bool) bool

Adds a knee point to the line identified by the unique ID. By default, this function will fully redraw the line the knee point has been added to. This can be disabled by setting bRefreshLine to False. The kneepoint will be added nearest to the line centrepoint on the from or to end.

Parameters:
  • nLineUID (int) – The line UID.

  • dX (float) – The knee point x coordinate.

  • dY (float) – The knee point y coordinate.

  • bFromEnd (float) – If True then the knee point is added to the last segment, i.e. furthest from the From end. If False then the knee point is added to the first segment.

  • bRefreshLine (bool) – Defaults to True. If True, the line is fully redrawn when the knee point is added.

Returns:

Boolean denoting whether the knee point was added.

Return type:

bool

AddKneepoints(nLineUID: int, listX: List[float], listY: List[float], bFromEnd: bool, bRefreshLine: bool) bool

Adds multiple knee points to the line identified by the unique ID. By default, this function will fully redraw the line the knee point has been added to. This can be disabled by setting bRefreshLine to False. The kneepoints will be added in order of from end to to end.

If listX and listY are not of the same length, no kneepoints will be added.

Parameters:
  • nLineUID (int) – The line UID.

  • listX (list(float)) – A list of x coordinates for each knee point to be added.

  • listY (list(float)) – A corresponding list of y coordinates for each knee point to be added.

  • bFromEnd (float) – If True then the knee point is added to the last segment, i.e. furthest from the From end. If False then the knee point is added to the first segment.

  • bRefreshLine (bool) – Defaults to True. If True, the line is fully redrawn when the knee point is added.

Returns:

Boolean denoting whether the knee points were added.

Return type:

bool

DeleteKneepoint(nLineUID: int, dX: float, dY: float) bool

Deletes a specific knee point from the line identified by the unique ID. If no kneepoint is found at the provided coordinates, nothing will occur.

Parameters:
  • nLineUID (int) – The line UID.

  • dX (float) – The knee point x coordinate.

  • dY (float) – The knee point y coordinate.

Returns:

Boolean denoting whether the knee point was added.

Return type:

bool

DeleteAllKneepoints(nLineUID: int) bool

Deletes all the knee points from the line identified by the unique ID.

Parameters:

nLineUID (int) – The line UID.

Returns:

Boolean denoting whether all the knee points were deleted.

Return type:

bool

RefreshLine(nLineUID: int) None

Redraws the line identified by the line UID after knee points have been added.

Parameters:

nLineUID (int) – The line UID.

SplitBranch(nLineUID: int, nSection: int, dRatio: float, strName: str) int

Deprecated. Instead, use IscNetwork.SplitBranch. Splits a branch into two sections connected by a new busbar. This will only act if the branch is only drawn in this IscDiagram instance.

Parameters:
  • nLineUID (int) – The line UID.

  • nSection (int) – Specifies which section of a multi-section branch is split. For branches with only one section then nSection should be set to 0.

  • dRatio (float) – Specifies how the branch impedances are divided between the new branches. A value of 0.0 sets the split position to be at the “From” end whilst a value of 1.0 specifies the “To” end. Values between 0.0 and 1.0 split the branch in proportion. For multi-section branches dRatio splits the section identified by nSection.

  • strName (str) – The name of the busbar.

Returns:

The UID of the new branch if it is greater than 0. ) if the branch has not been split. This is because there is a circuit breaker on the branch or the branch is drawn on more than one diagram.

Return type:

int

DrawRadial(nRadialUID: int, dX: float, dY: float) bool

Draws the symbol for the radial object (i.e., an object connected to one busbar only) identified by the unique ID nRadialUID. The radial symbol will be drawn at the location dX,dY and connected to its busbar.

Note this function will return false if the provided UID is not a radial or is already drawn.

Parameters:
  • nRadialUID (int) – The radial UID.

  • dX (float) – The x coordinate of the radial symbol.

  • dY (float) – The y coordinate of the radial symbol.

Returns:

The function returns True if the radial was drawn

Return type:

bool

DrawBranchItem(nBranchItemUID: int) bool

Draws the symbol for the branch item object (i.e., an object connected to exactly two busbars) identified by the unique ID nBranchItemUID. The branch item will be drawn as a straight line between its busbars.

Note this function will return false if the provided UID is not a branch item or is already drawn.

Parameters:

nBranchItemUID (int) – The branch item UID.

Returns:

The function returns True if the branch item was drawn

Return type:

bool

Draw3Port(n3PortUID: int, dX: float, dY: float) bool

Draws the symbol for the 3Port object (i.e., an object connected to exactly three busbars) identified by the unique ID nRadialUID. The 3Port symbol will be drawn at the location dX,dY and connected with straight lines to its busbars.

Note this function will return false if the provided UID is not a 3Port component or is already drawn.

Parameters:
  • n3PortUID (int) – The 3Port UID.

  • dX (float) – The x coordinate of the 3Port symbol.

  • dY (float) – The y coordinate of the 3Port symbol.

Returns:

The function returns True if the 3Port was drawn

Return type:

bool

DrawInline(nInlineUID: int, dX: float, dY: float) bool

Draws the symbol for the inline object (i.e., an object that sits upon a branch item) identified by the unique ID nInlineUID. The inline symbol will be drawn on its branch at the nearest point to the location dx,dY.

Note this function will return false if the provided UID is not an inline or is already drawn.

Parameters:
  • nInlineUID (int) – The inline UID.

  • dX (float) – The x coordinate of the inline symbol.

  • dY (float) – The y coordinate of the inline symbol.

Returns:

The function returns True if the inline was drawn

Return type:

bool

MoveItemCentre(nItemUID: int, dX: float, dY: float) bool

Moves the item specifed by nItemUID to the location dX,dY. For busbars this will relocate the busbar (bringing its connected radials). For radials and 3Ports this will relocate the symbol of the object, leaving its busbars inplace. For inlines this will move the inline to the point on its branch closest to the specified point. For branch items this will move the branch as close to the specified point as possible if the branch is free to move.

Note this function will return false if the provided UID is not already drawn.

Parameters:
  • nItemUID (int) – The item UID.

  • dX (float) – The x coordinate of the symbol.

  • dY (float) – The y coordinate of the symbol.

Returns:

The function returns True if the item graphic was found

Return type:

bool

DrawUndrawnItemsAttachedToBusbar(nBusbarUID: int) None

Draws items attached to the busbar identified by the busbar UID if they are not already drawn on the diagram. Note that this will draw branch items as well.

Parameters:

nBusbarUID (int) – The busbar UID.

DeleteItem(nUID: int) bool

Deletes the graphic item identified by the UID. This may be a line, radial component or busbar.

Parameters:

nUID (int) – The graphical item UID.

Returns:

True if deletion is successful.

Return type:

bool

GetLineLength(nUID: int) float
GetLineLength(pComponent) float

Returns the component length for the graphic symbol on the current diagram. On geographic diagrams this function returns the actual line length, assuming that the diagram is correctly scaled.

Parameters:
  • nUID (int) – The line UID.

  • pComponent (IscBranch) – The line IscBranch instance.

Returns:

The component length for the graphic symbol.

Return type:

float

SetItemPenColour(nUID: int, nRed: int, nGreen: int, nBlue: int, nAlpha: int)

Sets the outline colour of the diagram object. The colour is set by the RGB parameters. All colour parameters should be between 0 and 255.

Parameters:
  • nUID (int) – The diagram object UID.

  • nRed (int) – The red colour.

  • nGreen (int) – The green colour.

  • nBlue (int) – The blue colour.

  • nAlpha (int) – The transparency of the colour with 255 being opaque, and 0 being invisible.

SetItemBrushColour(nUID: int, nRed: int, nGreen: int, nBlue: int, nAlpha: int)

Sets the fill colour of the diagram object. The colour is set by the RGB parameters. All colour parameters should be between 0 and 255.

Parameters:
  • nUID (int) – The diagram object UID.

  • nRed (int) – The red colour.

  • nGreen (int) – The green colour.

  • nBlue (int) – The blue colour.

  • nAlpha (int) – The transparency of the colour with 255 being opaque, and 0 being invisible.

MapToLatLong(dDiagramX: float, dDiagramY: float) Tuple[float]

Returns the latitude and longitude in decimal degrees of the specified diagram pixel position. Note that the diagram X is south/north and diagram Y is east/west.

This function will return (0.0, 0.0) unless the diagram has a tiled geographic map.

Parameters:
  • dDiagramX (float) – The diagram x coordinate.

  • dDiagramY (float) – The diagram y coordinate.

Returns:

The latitude and longitude of the diagram position.

Return type:

tuple(float)

LatLongToMap(fN: float, fE: float) Tuple[float]

Returns the diagram pixel X and Y coordinates of the latitude and longitude. Note that the diagram X is south/north and diagram Y is east/west.

This function will return (0.0, 0.0) unless the diagram has a tiled geographic map.

Parameters:
  • fN (float) – The latitude.

  • fE (float) – The longitude.

Returns:

The diagram X and Y coordinates.

Return type:

tuple(float)

GetUIDFromCoordinates(dX: float, dY: float) int

Returns the UID of a component at coordinates (dX, dY).

Parameters:
  • dX (float) – The diagram X coordinate.

  • dY (float) – The diagram Y coordinate.

Returns:

The UID of the component located. Returns 0, if the component cannot be found,

Return type:

int

GetBusbarUIDFromCoordinates(dX: float, dY: float) int

Returns the UID of a busbar at coordinates (dX, dY).

Parameters:
  • dX (float) – The diagram X coordinate.

  • dY (float) – The diagram Y coordinate.

Returns:

The UID of the component located. Returns 0, if the component cannot be found,

Return type:

int

GetItemX(nUID: int) float

Returns the diagram X coordinate of the specified item. Note for branches and transformers this will return the midpoint of the object.

Parameters:

nUID (int) – The item UID.

Returns:

The diagram X coordinate.

Return type:

float

GetItemY(nUID: int) float

Returns the diagram Y coordinate of the specified item. Note for branches and transformers this will return the midpoint of the object.

Parameters:

nUID (int) – The item UID.

Returns:

The diagram Y coordinate.

Return type:

float

GetItemFromXPoints(nUID: int) List[float]

Returns a list of floats for the diagram X coordinates of the edge of the FROM busbar, the middle point of the line or the edge of the central graphic and all knee points lying on the branch item between these two points. The coordinates are for the FROM end of the line.

Parameters:

nUID (int) – The line UID.

Returns:

The diagram X coordinates.

Return type:

float

GetItemFromYPoints(nUID: int) List[float]

Returns a list of floats for the diagram Y coordinates of the edge of the FROM busbar, the middle point of the line or the edge of the central graphic and all knee points lying on the branch item between these two points. The coordinates are for the FROM end of the line.

Parameters:

nUID (int) – The line UID.

Returns:

The diagram Y coordinates.

Return type:

float

GetItemToXPoints(nUID: int) List[float]

Returns a list of floats for the diagram X coordinates of the edge of the TO busbar, the middle point of the line or the edge of the central graphic and all knee points lying on the branch item between these two points. The coordinates are for the TO end of the line.

Parameters:

nUID (int) – The line UID.

Returns:

The diagram X coordinates.

Return type:

float

GetItemToYPoints(nUID: int) List[float]

Returns a list of floats for the diagram Y coordinates of the edge of the TO busbar,the middle point of the line or the edge of the central graphic and all knee points lying on the branch item between these two points. The coordinates are for the TO end of the line.

Parameters:

nUID (int) – The line UID.

Returns:

The diagram Y coordinates.

Return type:

float

CreateAnnotation(strName: str, strAnnotationText: str, dX: float, dY: float) int

Creates a new diagram annotation.

Parameters:
  • strName (str) – The strName is not used and can be an empty string.

  • strAnnotationText (str) – The text to be displayed on the diagram. The text string can include simple html for text formatting.

  • dX (float) – The x coordinate of the diagram.

  • dY (float) – The y coordinate of the diagram.

Returns:

The diagram annotation.

Return type:

int

PrintPDF(strFileName: str, bRefreshDiagram: bool = True) None

Print the diagram to a PDF format file with name strFileName.

Parameters:
  • strFileName (str) – The path and filename where the PDF should be saved (including the .pdf extension).

  • bRefreshDiagram (bool) – If True, calls RefreshDiagram before saving, so the diagram is up-to-date with any changes made in scripting.

SetLabelCharacteristics(nUID: int, bShowLabel: bool, bFixedSize: bool) bool

Sets whether the label for the component identified by the given UID is visible, and whether it scales with zoom. This can also be set from Data Display Styles.

Parameters:
  • nUID (int) – The UID of the component with the label to be modified.

  • bShowLabel (bool) – True if the label should be visible.

  • bFixedSize (bool) – True if the label has a fixed size on scaling.

Returns:

Returns True if the values have been set.

Return type:

bool

SetBackgroundColour(strHexColour: str) None

Sets the diagram background colour to the specified hex colour. strHexColour can either be set as a hex colour code (i.e., “#BA4675”) or as one of the SVG color keyword names.

Parameters:

strHexColour (str) – The hex colour to set the diagram background to.

SetBackgroundImage(dOpacity: float, strImageFile: str, dWidth: float, dHeight: float, bKeepAspectRatio: bool) None

Sets the background image of a diagram to the image found in strImageFile. The background image is displayed with the opacity defined by dOpacity, and the image size defined by dWidth and dHeight. If bKeepAspectRatio is set to True, dHeight is ignored, and the image is displayed with the width determined by dWidth and a height automatically calculated to maintain the image aspect ratio.

Note, if strImageFile is not a valid image path, the background image will be cleared.

Parameters:
  • dOpacity (float) – The opacity of the background image in the range 0-1.

  • strImageFile (str) – The path to the new background image.

  • dWidth (float) – The pixel width the background image will be displayed with.

  • dHeight (float) – The pixel height the background image will be displayed with.

  • bKeepAspectRatio (bool) – If True, dHeight is auto-calculated to maintain the provided image aspect ratio.

RemoveBackgroundImage() None

Removes the background image of a diagram.

RefreshDiagram() None

Refreshes the diagram to ensure that the diagram window is up to date with the data held in IPSA.

GetBusbarSize(nUID: int) float

Returns the size of the graphical item for the busbar identified by nUID. This will return 0.0 if the busbar isn’t found. Note this returns the radius of circular busbars.

Parameters:

nUID (int) – The busbar UID.

Returns:

The size of the busbar graphic.

Return type:

float

GetBusbarGraphicsType(nUID: int) int

Returns an int identifying what type of graphic the busbar identified by nUID is drawn with. This will return -1 if the busbar isn’t found. The busbar graphic types are:

  • 0 = Horizontal rectangular

  • 1 = Vertical rectangular

  • 2 = Junction

  • 3 = Circular

  • 4 = Point

  • 5 = Hexagonal

Parameters:

nUID (int) – The busbar UID.

Returns:

The busbar graphic type.

Return type:

int

IsGeographic() bool

Returns if the diagram is a geographic diagram or a single line diagram.

Returns:

True if the diagram is a geographic diagram and false if it is an SLD.

Return type:

bool

HasTiledGeographicMap() bool

Returns if the diagram has a tiled geographic map.

Returns:

True if the diagram has a tiled geographic map.

Return type:

bool

GetMapCentre() Tuple[float]

Returns the centre position of the map. Returns lat-long centre for diagrams with tiled geographic maps and (0,0) otherwise.

Returns:

The diagram lat-long centre position.

Return type:

tuple(float)

AddTiledGeographicMap(dBaseLatitude: float, dBaseLongitude: float) bool

Adds a tiled geographic map to the diagram if the diagram is geographic. The geographic map centre will be at the specified coordinates (dBaseLatitude, dBaseLongitude).

Parameters:
  • dBaseLatitude (float) – The centre latitude of the tiled geographic map.

  • dBaseLongitude (float) – The centre longitude of the tiled geographic map.

Returns:

True if the map is successfully added.

Return type:

bool

RemoveTiledGeographicMap() bool

Removes the tiled geographic map from the diagram if there is one.

Returns:

True if the map is successfully removed

Return type:

bool