Skip to content

AttributeService

Canonical path: NemAll_Python_BaseElements.AttributeService

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

Classes:

Methods:

AttributeControlType

Canonical path: NemAll_Python_BaseElements.AttributeService.AttributeControlType

Bases: Enum

Available types of input controls for entering an attribute value

Methods:

Attributes:

  • Calculate

    Option for creating a formula attribute, with deactivated input field.

  • CheckBox

    Check box for true/false attribute

  • ComboBox

    Combo box with proposed values, where user can also insert a custom value

  • ComboBoxFilling

    Combo box for filling selection

  • ComboBoxFixed

    Combo box with allowed values. Custom values are not possible

  • ComboBoxHatch

    Combo box for hatch selection

  • ComboBoxPattern

    Combo box for pattern selection

  • Edit

    Simple edit field

  • Undef

    Undefined

Calculate class-attribute instance-attribute

Calculate = 66

Option for creating a formula attribute, with deactivated input field.

CheckBox class-attribute instance-attribute

CheckBox = 67

Check box for true/false attribute

ComboBox class-attribute instance-attribute

ComboBox = 76

Combo box with proposed values, where user can also insert a custom value

ComboBoxFilling class-attribute instance-attribute

ComboBoxFilling = 70

Combo box for filling selection

ComboBoxFixed class-attribute instance-attribute

ComboBoxFixed = 88

Combo box with allowed values. Custom values are not possible

ComboBoxHatch class-attribute instance-attribute

ComboBoxHatch = 83

Combo box for hatch selection

ComboBoxPattern class-attribute instance-attribute

ComboBoxPattern = 77

Combo box for pattern selection

Edit class-attribute instance-attribute

Edit = 69

Simple edit field

Undef class-attribute instance-attribute

Undef = 48

Undefined

__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

Possible options of which attributes should be shown in an attribute selection dialog

Methods:

Attributes:

eAllAttributes class-attribute instance-attribute

eAllAttributes = 0

Show all attributes

eInsertAttributes class-attribute instance-attribute

eInsertAttributes = 1

Show only attributes, where a value can be entered by the user. Internally calculated attributes are not shown.

eProjectAttributes class-attribute instance-attribute

eProjectAttributes = 2

Show only project-specific attributes

__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

Methods:

Attributes:

ByteVec class-attribute instance-attribute

ByteVec = 66

Byte vector

Date class-attribute instance-attribute

Date = 68

Date

Double class-attribute instance-attribute

Double = 82

Floating point value

DoubleVec class-attribute instance-attribute

DoubleVec = 80

Vector of floating point values

Enum class-attribute instance-attribute

Enum = 69

Enumeration

Integer class-attribute instance-attribute

Integer = 73

Integer

IntegerVec class-attribute instance-attribute

IntegerVec = 89

Vector of integers

String class-attribute instance-attribute

String = 67

String

StringVec class-attribute instance-attribute

StringVec = 83

Vector of strings

Undef class-attribute instance-attribute

Undef = 48

Undefined

WString class-attribute instance-attribute

WString = 87

Unicode string

__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