AttributeService
Canonical path: NemAll_Python_BaseElements.AttributeService
Service for reading existing attributes definitions and creating new user-defined attributes
Classes:
-
AttributeControlType–Attribute control types
-
AttributeSelectionDialogType–Type of the attribute selection dialog
-
AttributeType–Attribute types
Methods:
-
AddUserAttribute–Add a user attribute
-
GetAttributeControlType–Get the control type of the attribute
-
GetAttributeID–Get the attribute ID
-
GetAttributeName–Get the attribute name
-
GetAttributeType–Get the attribute type
-
GetAttributeUnit–Get the attribute unit
-
GetDefaultValue–Get the default value of an attribute
-
GetEnumIDFromValueString–Get the enumeration ID from the value string
-
GetEnumValueStringFromID–Get the enumeration value string from the enumeration ID
-
GetEnumValues–Get the enum attribute values
-
GetGroupAttributeIDs–Get the attribute IDs and the name of the attribute groups
-
GetInputListValues–Get the input list values
-
OpenAttributeSelectionDialog–Open the attribute selection dialog
AttributeControlType
Canonical path: NemAll_Python_BaseElements.AttributeService.AttributeControlType
Bases: Enum
Attribute control types
Methods:
-
__getitem__–get the item for a key
__getitem__
__getitem__(key: str | int | float) -> AttributeControlType
get the item for a key
Parameters:
-
key(str | int | float) –value key
Returns:
-
AttributeControlType–value for the key
AttributeSelectionDialogType
Canonical path: NemAll_Python_BaseElements.AttributeService.AttributeSelectionDialogType
Bases: Enum
Type of the attribute selection dialog
eAllAttributes : eInsertAttributes : eProjectAttributes:
Methods:
-
__getitem__–get the item for a key
__getitem__
__getitem__(key: str | int | float) -> AttributeSelectionDialogType
get the item for a key
Parameters:
-
key(str | int | float) –value key
Returns:
-
AttributeSelectionDialogType–value for the key
AttributeType
Canonical path: NemAll_Python_BaseElements.AttributeService.AttributeType
Bases: Enum
Attribute types
Methods:
-
__getitem__–get the item for a key
__getitem__
__getitem__(key: str | int | float) -> AttributeType
get the item for a key
Parameters:
-
key(str | int | float) –value key
Returns:
-
AttributeType–value for the key
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:
-
doc(DocumentAdapter) –Document
-
attributeID(int) –Attribute ID
Returns:
-
AttributeControlType–Control type of the attribute
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:
-
doc(DocumentAdapter) –Document
-
attributeID(int) –Attribute ID
Returns:
-
str–Attribute name
GetAttributeType
staticmethod
GetAttributeType(doc: DocumentAdapter, attributeID: int) -> AttributeType
Get the attribute type
Parameters:
-
doc(DocumentAdapter) –Document
-
attributeID(int) –Attribute ID
Returns:
-
AttributeType–Attribute type
GetAttributeUnit
staticmethod
GetAttributeUnit(doc: DocumentAdapter, attributeID: int) -> str
Get the attribute unit
Parameters:
-
doc(DocumentAdapter) –Document
-
attributeID(int) –Attribute ID
Returns:
-
str–Attribute unit
GetDefaultValue
staticmethod
GetDefaultValue(doc: DocumentAdapter, attributeID: int) -> int | float | str
Get the default value of an attribute
Parameters:
-
doc(DocumentAdapter) –Document
-
attributeID(int) –Attribute ID
Returns:
-
int | float | str–Default value of the attribute
GetEnumIDFromValueString
staticmethod
Get the enumeration ID from the value string
Parameters:
-
attributeID(int) –Attribute ID
-
valueString(str) –Value string
Returns:
-
int–Enumeration ID
GetEnumValueStringFromID
staticmethod
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:
-
doc(DocumentAdapter) –Document
-
attributeID(int) –Attribute ID
Returns:
-
VecStringList–Default attribute value
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:
-
list[tuple[str, list[int] | VecIntList]]–Group name, group IDs
GetInputListValues
staticmethod
GetInputListValues(doc: DocumentAdapter, attributeID: int) -> VecStringList
Get the input list values
Parameters:
-
doc(DocumentAdapter) –Document
-
attributeID(int) –Attribute ID
Returns:
-
VecStringList–Attribute input list values
OpenAttributeSelectionDialog
staticmethod
OpenAttributeSelectionDialog(
doc: DocumentAdapter, dialogType: AttributeSelectionDialogType
) -> int
Open the attribute selection dialog
Parameters:
-
doc(DocumentAdapter) –Document
-
dialogType(AttributeSelectionDialogType) –Dialog type
Returns:
-
int–Attribute ID