SysMLTools#
- class ansys.sam.sysml2.tools.sysmltools.SysMLTools#
Provides tools operating on SysML elements.
Overview#
Check the type of an element. |
|
Render a value element to its text form. |
|
Return the visibility of an element, read from its owning membership. |
|
Set the visibility of an element on its owning membership. |
|
Parse an expression and set it as the feature’s value. |
|
Resolve a connection end within the connection’s own context. |
|
Resolve both ends of a connector at once. |
Import detail#
from ansys.sam.sysml2.tools.sysmltools import SysMLTools
Method detail#
- static SysMLTools.serialize_expression(value)#
Render a value element to its text form.
- static SysMLTools.get_element_visibility(element)#
Return the visibility of an element, read from its owning membership.
Visibility lives on the membership that owns the element. That membership is an
OwningMembershipfor most elements and aFeatureMembershipfor features, so this helper falls back to the owning feature membership when the generic owning membership is not set.- Parameters:
- element
Element Element whose visibility is read.
- element
- Returns:
VisibilityKindorNoneThe owning membership’s visibility, or
Nonewhen the element has no owning membership.
- static SysMLTools.set_element_visibility(element, visibility)#
Set the visibility of an element on its owning membership.
Visibility lives on the membership that owns the element (an
OwningMembershipfor most elements, aFeatureMembershipfor features). This helper writes the value on that membership. Useget_element_visibility()to read it back.- Parameters:
- element
Element Element whose visibility is set.
- visibility
VisibilityKind New visibility value.
- element
- Raises:
AttributeErrorIf the element has no owning membership to store the value on.
- static SysMLTools.parse_and_set_value(feature, expression: str)#
Parse an expression and set it as the feature’s value.
The text is sent as-is to the server, which builds the corresponding SysML v2 expression (for example a unit expression, an arithmetic expression, or a reference expression). Use
serialize_expression()to render the resulting value element back to text.- Parameters:
- feature
Element Feature whose value is set or updated.
- expression
str Expression text to parse (for example
"10 [m]"or"5 + 5").
- feature