ValueHelper#

class ansys.sam.sysml2.classes.value_helper.ValueHelper(prefix: str)#

Helper class for feature value resolve.

Overview#

is_value_capable

Return True if the element can carry a feature value (a Feature or descendant).

get_value_for_sysml_element

Get the value of the feature.

serialize

Render a value element (literal or operator expression) to its text form.

set_or_update_value

Create the commit to set or update the value of type value_type.

escape_kerml_string

Escape a string for use inside a KerML string literal.

unescape_kerml_string

Decode KerML escapes; leave already-decoded strings (real n/r/t) unchanged.

Import detail#

from ansys.sam.sysml2.classes.value_helper import ValueHelper

Attribute detail#

ValueHelper.prefix#

Method detail#

static ValueHelper.is_value_capable(element) → bool#

Return True if the element can carry a feature value (a Feature or descendant).

static ValueHelper.get_value_for_sysml_element(element)#

Get the value of the feature.

static ValueHelper.serialize(value)#

Render a value element (literal or operator expression) to its text form.

static ValueHelper.set_or_update_value(element, value_type: type, new_value: str | int | float | bool)#

Create the commit to set or update the value of type value_type.

Parameters:
elementElement

Element whose feature value is updated.

value_typetype

Value type of the new value.

new_valuestr | int | float | bool

New value to update to.

static ValueHelper.escape_kerml_string(text: str) → str#

Escape a string for use inside a KerML string literal.

static ValueHelper.unescape_kerml_string(text: str) → str#

Decode KerML escapes; leave already-decoded strings (real n/r/t) unchanged.