Skip to content

AttributeService

Canonical path: NemAll_Python_BaseElements.AttributeService

Service for reading existing attributes definitions and creating new user-defined attributes

AttributeControlType

Canonical path: NemAll_Python_BaseElements.AttributeService.AttributeControlType

Bases: Enum

Attribute control types

__getitem__

__getitem__(key: str | int | float) -> AttributeControlType

get the item for a key

Parameters:

  • key (str | int | float) –

    value key

Returns:

AttributeSelectionDialogType

Canonical path: NemAll_Python_BaseElements.AttributeService.AttributeSelectionDialogType

Bases: Enum

Type of the attribute selection dialog

eAllAttributes : eInsertAttributes : eProjectAttributes:

__getitem__

__getitem__(key: str | int | float) -> AttributeSelectionDialogType

get the item for a key

Parameters:

  • key (str | int | float) –

    value key

Returns:

AttributeType

Canonical path: NemAll_Python_BaseElements.AttributeService.AttributeType

Bases: Enum

Attribute types

__getitem__

__getitem__(key: str | int | float) -> AttributeType

get the item for a key

Parameters:

  • key (str | int | float) –

    value key

Returns:

AddUserAttribute staticmethod

AddUserAttribute(
    doc: DocumentAdapter,
    attributeType: AttributeType,
    attributeName: str,
    attributeDefaultValue: str,
    attributeMinValue: float,
    attributeMaxValue: float,
    attributeDimension: str,
    attributeCtrlType: AttributeControlType,
    attributeListValues: VecStringList,
) -> int

Add a user attribute

Parameters:

  • doc (DocumentAdapter) –

    Document

  • attributeType (AttributeType) –

    Type

  • attributeName (str) –

    Name

  • attributeDefaultValue (str) –

    Default value

  • attributeMinValue (float) –

    Minimal value

  • attributeMaxValue (float) –

    Maximal value

  • attributeDimension (str) –

    Dimension

  • attributeCtrlType (AttributeControlType) –

    Control type

  • attributeListValues (VecStringList) –

    List with the allowed attribute values

Returns:

  • int

    ID of the added user attribute, -1 = not possible to add

GetAttributeControlType staticmethod

GetAttributeControlType(
    doc: DocumentAdapter, attributeID: int
) -> AttributeControlType

Get the control type of the attribute

Parameters:

Returns:

GetAttributeID staticmethod

GetAttributeID(doc: DocumentAdapter, attributeName: str) -> int

Get the attribute ID

Parameters:

  • doc (DocumentAdapter) –

    Document

  • attributeName (str) –

    Attribute name

Returns:

  • int

    Attribute ID

GetAttributeName staticmethod

GetAttributeName(doc: DocumentAdapter, attributeID: int) -> str

Get the attribute name

Parameters:

Returns:

  • str

    Attribute name

GetAttributeType staticmethod

GetAttributeType(doc: DocumentAdapter, attributeID: int) -> AttributeType

Get the attribute type

Parameters:

Returns:

GetAttributeUnit staticmethod

GetAttributeUnit(doc: DocumentAdapter, attributeID: int) -> str

Get the attribute unit

Parameters:

Returns:

  • str

    Attribute unit

GetDefaultValue staticmethod

GetDefaultValue(doc: DocumentAdapter, attributeID: int) -> int | float | str

Get the default value of an attribute

Parameters:

Returns:

  • int | float | str

    Default value of the attribute

GetEnumIDFromValueString staticmethod

GetEnumIDFromValueString(attributeID: int, valueString: str) -> int

Get the enumeration ID from the value string

Parameters:

  • attributeID (int) –

    Attribute ID

  • valueString (str) –

    Value string

Returns:

  • int

    Enumeration ID

GetEnumValueStringFromID staticmethod

GetEnumValueStringFromID(attributeID: int, enumID: int) -> str

Get the enumeration value string from the enumeration ID

Parameters:

  • attributeID (int) –

    Attribute ID

  • enumID (int) –

    Enumeration ID

Returns:

  • str

    Enumeration value string

GetEnumValues staticmethod

GetEnumValues(doc: DocumentAdapter, attributeID: int) -> VecStringList

Get the enum attribute values

Parameters:

Returns:

GetGroupAttributeIDs staticmethod

GetGroupAttributeIDs(
    ele: BaseElementAdapter,
    attributes: list[tuple[int, int | float | str]],
    excludeHidden: bool,
) -> list[tuple[str, list[int] | VecIntList]]

Get the attribute IDs and the name of the attribute groups

Parameters:

  • ele (BaseElementAdapter) –

    Element for the attributes

  • attributes (list[tuple[int, int | float | str]]) –

    Attributes of the element

  • excludeHidden (bool) –

    Exclude the hidden attributes

Returns:

GetInputListValues staticmethod

GetInputListValues(doc: DocumentAdapter, attributeID: int) -> VecStringList

Get the input list values

Parameters:

Returns:

OpenAttributeSelectionDialog staticmethod

OpenAttributeSelectionDialog(
    doc: DocumentAdapter, dialogType: AttributeSelectionDialogType
) -> int

Open the attribute selection dialog

Parameters:

Returns:

  • int

    Attribute ID

Placeholder