Attribute Service
Class full path: NemAll_Python_BaseElements.AttributeService
Implementation of the attribute service
Classes
AttributeControlType
Bases: IntEnum
Attribute control types
AttributeSelectionDialogType
Bases: IntEnum
Type of the attribute selection dialog
AttributeType
Bases: IntEnum
Attribute types
Functions
AddUserAttribute(doc, attributeType, attributeName, attributeDefaultValue, attributeMinValue, attributeMaxValue, attributeDimension, attributeCtrlType, attributeListValues)
staticmethod
Add a user attribute to the attribute definition collection
Parameters:
Name | Type | Description | Default |
---|---|---|---|
doc
|
DocumentAdapter
|
document |
required |
attributeType
|
AttributeType
|
type |
required |
attributeName
|
str
|
name |
required |
attributeDefaultValue
|
str
|
default value |
required |
attributeMinValue
|
float
|
minimum value |
required |
attributeMaxValue
|
float
|
maximum value |
required |
attributeDimension
|
str
|
dimension |
required |
attributeCtrlType
|
AttributeControlType
|
control type |
required |
attributeListValues
|
VecStringList
|
list of values |
required |
Returns:
Type | Description |
---|---|
int
|
ID of the newly created attribute |
GetAttributeControlType(doc, attributeID)
staticmethod
Get the control type of the attribute
Parameters:
Name | Type | Description | Default |
---|---|---|---|
doc
|
DocumentAdapter
|
document |
required |
attributeID
|
int
|
attribute ID |
required |
Returns:
Type | Description |
---|---|
AttributeControlType
|
attribute control type |
GetAttributeID(doc, attributeName)
staticmethod
Get the attribute ID
Parameters:
Name | Type | Description | Default |
---|---|---|---|
doc
|
DocumentAdapter
|
document |
required |
attributeName
|
str
|
attribute name |
required |
Returns:
Type | Description |
---|---|
int
|
attribute ID |
GetAttributeName(doc, attributeID)
staticmethod
Get the attribute name
Parameters:
Name | Type | Description | Default |
---|---|---|---|
doc
|
DocumentAdapter
|
Document |
required |
attributeID
|
int
|
Attribute ID |
required |
Returns:
Type | Description |
---|---|
str
|
attribute name |
GetAttributeType(doc, attributeID)
staticmethod
Get the attribute type
Parameters:
Name | Type | Description | Default |
---|---|---|---|
doc
|
DocumentAdapter
|
Document |
required |
attributeID
|
int
|
Attribute ID |
required |
Returns:
Type | Description |
---|---|
AttributeType
|
attribute type |
GetDefaultValue(doc, attributeID)
staticmethod
Get the default value of an attribute
Parameters:
Name | Type | Description | Default |
---|---|---|---|
doc
|
DocumentAdapter
|
Document |
required |
attributeID
|
int
|
Attribute ID |
required |
Returns:
Type | Description |
---|---|
Union[int, float, str]
|
Default value of the attribute |
GetEnumIDFromValueString(attributeID, valueString)
staticmethod
Get the enumeration ID from the value string
Parameters:
Name | Type | Description | Default |
---|---|---|---|
attributeID
|
int
|
Attribute ID |
required |
valueString
|
str
|
value string |
required |
Returns:
Type | Description |
---|---|
int
|
enumeration ID |
GetEnumValueStringFromID(attributeID, enumID)
staticmethod
Get the enumeration value string from the enumeration ID
Parameters:
Name | Type | Description | Default |
---|---|---|---|
attributeID
|
int
|
Attribute ID |
required |
enumID
|
int
|
value string |
required |
Returns:
Type | Description |
---|---|
str
|
enumeration value string |
GetEnumValues(doc, attributeID)
staticmethod
Get the enum attribute values Args: doc: Document
attributeID: Attribute ID
Returns:
Type | Description |
---|---|
List[str]
|
list with enumeration values |
GetInputListValues(doc, attributeID)
staticmethod
Get the input list values Args: doc: Document
attributeID: Attribute ID
Returns:
Type | Description |
---|---|
List[str]
|
list with input values |
OpenAttributeSelectionDialog(doc, dialogType)
staticmethod
Open the attribute selection dialog Args: doc: Document
dialogType: dialog type
Returns:
Type | Description |
---|---|
int
|
selected attribute ID |