Definitions#
- class mhi.pscad.Definition(*, _ctx: Context | None = None, _ident: Dict[str, Any] | None = None)#
Component Definition
- property scoped_name: str#
The scoped definition name is the project and definition names, separated by a colon (read-only)
- property instances: int#
Number of live instances of this definition (read-only)
Added in version 2.8.
- property form_codec: FormCodec#
The definition’s parameter form codec
- is_module() bool#
Check to see if this component has its own canvas, with in turn, can contain additional components.
- Returns:
True if the component has an internal canvas, False otherwise.
- Return type:
- parameters() Dict[str, str]#
- parameters(*, name: str | None = None, desc: str | None = None, url: str | None = None, group: str | None = None, tags: str | None = None) None
Set or get the definition’s parameters.
- Parameters:
name (str) – The definition name. Must be unique, alphanumeric, and a maximum of 30 characters
desc (str) – A short description for the definition
url (str) – Location if loaded from an external resource
group (str) – One or more labels to describe group categorization (Comma separated)
tags (str) – One or more tags to help find this definition (Comma separated)
- Returns:
A dictionary of parameter values (if no parameters are being set), or None.
Attempt to navigate to the first instance if possible
- Returns:
The definition’s canvas
- Return type:
- set_view(view: str | View) None#
Activate the appropriate definition editor tab
Valid view tabs are one of the strings: “Schematic”, “Graphic”, “Parameters”, “Script”, “Fortran”, “Data”, or the equivalent
Viewconstant.- Parameters:
view – The desired view tab
- graphics() GfxCanvas#
Get the
graphics canvasAdded in version 2.2.