Definitions#
Definition Map#
- class mhi.xml.pscad.definitions.DefinitionMapping#
The project’s
Definitiondictionary.Example:
for defn_name in project.definition: print(defn_name) main_defn = project.definition['Main'] del project.definition['not_needed']
- create(name: str) UserCmpDefn#
Create a new UserCmp Definition
Definition#
- class mhi.xml.pscad.Definition#
Definition node
- property group: str#
A comma separated list of groups this definition belongs to.
Examples:
'(null)' 'Miscellaneous,I/O Devices' 'Meters,Breakers Faults,Machines,Miscellaneous'
Form#
- class mhi.xml.pscad.Form#
A collection of categories of parameters, along with their descriptions and validity constraints.
Examples:
form = definition.form # Create a "Extra" category, add 'Author', 'Version' parameters. extra = form.category.create("Extra") extra.add_text('Author', "Creator") extra.add_integer('Version', "Revision number", min=1, default=1) # Remove the "Extra" category del form.category["Extra"]
- property w: int#
Width of the dialog form, in pixels.
Does not include additional width added by dynamic help.
- property category: KeyMapping[Category]#
Form category dictionary
- property parameter: KeyMapping[Parameter]#
Form parameter dictionary
Form Category#
- class mhi.xml.pscad.Category#
A form category
Contains 1 or more parameters, and a condition for when the category is enabled.
- property cond#
Category enabled condition expression (read/write)
- property parameter: KeyMapping[Parameter]#
Category parameter dictionary
- add_text(name: str, description: str, default: str = '', empty_allowed=True, **kwargs) Parameter#
Create a text parameter.
Form Parameter#
- class mhi.xml.pscad.Parameter#
A parameter definition.
Gives the parameter a symbol name, description, type, units, default value, validation attributes (minimum and/or maximum limits, regex), and help attributes.
Graphics#
- class mhi.xml.pscad.Graphics#
A <graphics/> container node
- add_text(*coords, text: str, color: str = 'Black', full_font: str = 'Tahoma, 12world', font_size: int = 0, align: str | Align | int = Align.CENTER, angle: int = 0, cond: str = 'true')#
Add a line of text to the definition graphics
- add_line(*coords, color: str = 'Black', line_style: str | LineStyle | int = LineStyle.SOLID, thickness: int = 0, port: str = '', cond: str = 'true')#
Add a line to the definition graphics
- add_rect(*coords, color: str = 'Black', line_style: str | LineStyle | int = LineStyle.SOLID, thickness: int = 0, port: str = '', fill_style: str | FillStyle | int = FillStyle.HOLLOW, fill_fg: str = 'Black', fill_bg: str = 'White', cond: str = 'true')#
Add a rectangle to the definition graphics
- add_ellipse(*coords, color: str = 'Black', line_style: str | LineStyle | int = LineStyle.SOLID, thickness: int = 0, port: str = '', fill_style: str | FillStyle | int = FillStyle.HOLLOW, fill_fg: str = 'Black', fill_bg: str = 'White', cond: str = 'true')#
Add an ellipse to the definition graphics
- add_circle(*coords, color: str = 'Black', line_style: str | LineStyle | int = LineStyle.SOLID, thickness: int = 0, port: str = '', fill_style: str | FillStyle | int = FillStyle.HOLLOW, fill_fg: str = 'Black', fill_bg: str = 'White', cond: str = 'true')#
Add a circle to the definition graphics
- ports(name: str | None = None) list[Port]#
Retrieve the list of ports defined in the component graphics
- add_input(x: int, y: int, name: str, *, dim: int = 1, cond: str = 'true', internal: bool = False, datatype: SignalType | str | int = SignalType.REAL) Port#
Add an input port to the graphic definition
Graphic Elements#
- class mhi.xml.pscad.GfxText#
Gfx Text
- property color: Colour#
The ‘color’ property of a visible Gfx item
- class mhi.xml.pscad.GfxLine#
Gfx Line
- property color: Colour#
The ‘color’ property of a visible Gfx item
- class mhi.xml.pscad.GfxRectangle#
Gfx Rectangle
- property color: Colour#
The ‘color’ property of a visible Gfx item
- property fill_fg: Colour#
The ‘Foreground color’ of a painted Gfx item
- property fill_bg: Colour#
The ‘Background Color’ of a painted Gfx item
- class mhi.xml.pscad.GfxEllipse#
Gfx Ellipse
- property color: Colour#
The ‘color’ property of a visible Gfx item
- property fill_fg: Colour#
The ‘Foreground color’ of a painted Gfx item
- property fill_bg: Colour#
The ‘Background Color’ of a painted Gfx item
- class mhi.xml.pscad.Port#
Graphics Port
- property datatype: SignalType#
The ‘data type’ of input/output Port (Logical, Integer, Real, …)
- property electype: ElectricalType#
The ‘type’ of an Electrical Port (Fixed, Removable, Ground, …)