AttributeTemplatesBuilder Class¶
-
class
NXOpen.
AttributeTemplatesBuilder
¶ Bases:
NXOpen.Builder
Represents an
NXOpen.AttributeTemplatesBuilder
to be used when creating attribute templates.An attribute template is optional for an attribute and lives in the depository. It’s main purpose is to provide extra data to further describe a referencing attribute. All attributes that are created from a template will take on the characteristics of the template, most notable the title, type, and units (for templates of type number only). The template contains other data, such as input assisting data (ranges and lists of values) to be used when creating a value on the attribute. The template may also contain a category, which allows attributes to be grouped together and easily sorted. A note may also be set on a template to provide further description about a referencing attribute.
Each template must contain a unique title and a type. If the type is number, then the units must also be set. All other data is optional.
There are six types of attribute templates: Null, Boolean, Integer, Number, String, and Date. Each type requires a title, type, and can optionally contain a note and a category. Other data varies depending on the type. Below describes the differences betweeen the types.
Null - No other data can be set for a template of type Null.
Boolean - A default boolean can be set to True or False. This can be set by calling SetDefaultBoolean.
Integer - A default integer can be set to assist when creating an attribute referencing an integer template. The integer type also allows for constraints to be set. If the constraint is set to Range, then the min integer and max integer need to be set to define the range. If the constraint is set to List, then the value integer list will need to be set to define the acceptable list of values. If constraint is set to None, then no constraints will be enforced. The default value must comply with all constraints in order for the template to be created successfully.
Number - A default floating point number and constraints can be set in the exact same fashion as with the integer, the only difference being that the number fields will be used instead of the integer fields. The units must be set to define the template’s measure. Only the measure (Length, Area, Volume, etc) is considered required information, the units themselves (mm, kg, etc) will only be used along with the default value as input assistance when creating an attribute referencing a number template.
String - A default string can be set. The string type also allows for a list of values to be set as input assistance. To do this, the constraint must be set to List and the string list will need to be populated with the desired values. The string type does not allow for the constraint to be set to Range, it must be set to either List or None. The default string must be contained in the list of values if Constraint is set to List.
Date - No other data can be set for a template of type Date. The current date will always be used as input assistance when creating an attribute referencing a date template.
This class will also allow for the import and export of attribute templates. The export feature will save all templates currently in the depository to an external catalog file so they can be imported at a later time to another part file. To use this feature, the catalog filename must be set to specify the external file. Similarly, the import feature will take all templates contained in the specified catalog file and instantiate them in the part. If the title, type, or measure of an imported template conflicts with a template already in the depository, then the template will not be imported. If the optional data of an imported template conflicts with a template already in the depository, then the data from the imported template will overwrite the data in the depository.
To create a new instance of this class, use
NXOpen.PropertiesManager.CreateAttributeTemplatesBuilder()
Default values.
Property Value Constraint None CopyAttributeOnObjectCopy True DataType String DefaultBoolean True DefaultInteger 0 DefaultNumber 0 MaxInteger 0 MaxNumber 0 MinInteger 0 MinNumber 0 ProxyAttributeForLocking New in version NX8.0.0.
Properties¶
Property | Description |
---|---|
Alias | Returns or sets the Alias. |
AllowMultipleValues | Returns or sets the flag specifying if an attribute can contain multiple values. |
CatalogFilename | Returns or sets the catalog filename. |
Category | Returns or sets the category. |
Constraint | Returns or sets the constraint. |
CopyAttributeOnObjectCopy | Returns or sets the flag specifying whether the attribute should be copied when the object is copied. |
DataType | Returns or sets the data type. |
DateConstraint | Returns the date constraint. |
DefaultBoolean | Returns or sets the default boolean. |
DefaultDate | Returns the default date. |
DefaultInteger | Returns or sets the default integer. |
DefaultNumber | Returns or sets the default number. |
DefaultString | Returns or sets the default string. |
EnforcedConstraints | Returns or sets the enforced constraints. |
LockOnSave | Returns or sets the flag specifying if the attribute should be locked on save. |
MaxInteger | Returns or sets the max integer. |
MaxNumber | Returns or sets the max number. |
MaxString | Returns or sets the max string. |
MinInteger | Returns or sets the min integer. |
MinNumber | Returns or sets the min number. |
MinString | Returns or sets the min string. |
Persistent | Returns or sets the persistent flag. |
ProxyAttributeForLocking | Returns or sets the proxy attribute for locking. |
Tag | Returns the Tag for this object. |
Templates | Returns or sets the templates option. |
Title | Returns or sets the title. |
Units | Returns or sets the units. |
Methods¶
Method | Description |
---|---|
AddAccessKey | Add a new access key to the list of access keys. |
Commit | Commits any edits that have been applied to the builder. |
Delete | Delete an attribute template by specifying the title and type of the template. |
Destroy | Deletes the builder, and cleans up any objects created by the builder. |
ExportCatalog | Exports templates to a specified external catalog. |
GetAccessKeys | Get the access keys. |
GetCommittedObjects | For builders that create more than one object, this method returns the objects that are created by commit. |
GetIntegerList | Returns the integer list. |
GetNote | Returns the note. |
GetNumberList | Returns the number list. |
GetObject | Returns the object currently being edited by this builder. |
GetStringList | Returns the string list. |
ImportCatalog | Imports templates from a specified external catalog. |
RemoveAccessKey | Remove an access key from the list of access keys. |
SetAccessKeys | Set the access keys. |
SetIntegerList | Sets the integer list. |
SetNote | Sets the note. |
SetNumberList | Sets the number list. |
SetStringList | Sets the string list. |
ShowResults | Updates the model to reflect the result of an edit to the model for all builders that support showing results. |
UpdateTemplates | Update templates in the part from the external catalog defined in customer defaults. |
Validate | Validate whether the inputs to the component are sufficient for commit to be called. |
Enumerations¶
AttributeTemplatesBuilderAccessKey Enumeration | Specifies the available access keys that determine which objects will have access to this attribute template. |
AttributeTemplatesBuilderConstraintOptions Enumeration | Specifies the constraint data associated with the template. |
AttributeTemplatesBuilderDefaultBooleanOptions Enumeration | Specifies the default value for a template of type Boolean. |
AttributeTemplatesBuilderTemplatesOptions Enumeration | Specifies the templates option when setting or displaying templates. |
Property Detail¶
Alias¶
-
AttributeTemplatesBuilder.
Alias
¶ Returns or sets the Alias.
This is the alias or synonym for the title of the template and must be unique.
-------------------------------------
Getter Method
Signature
Alias
Returns: Return type: str New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
Alias
Parameters: alias (str) – New in version NX8.0.0.
License requirements: None.
AllowMultipleValues¶
-
AttributeTemplatesBuilder.
AllowMultipleValues
¶ Returns or sets the flag specifying if an attribute can contain multiple values.
If true, then any attributes created from this template will be treated as a VLA (variable length array) and will support multiple values.
-------------------------------------
Getter Method
Signature
AllowMultipleValues
Returns: Return type: bool New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
AllowMultipleValues
Parameters: array (bool) – New in version NX8.0.0.
License requirements: None.
CatalogFilename¶
-
AttributeTemplatesBuilder.
CatalogFilename
¶ Returns or sets the catalog filename.
Used during import and export of catalogs. This should be set to a full path location on disk.
-------------------------------------
Getter Method
Signature
CatalogFilename
Returns: Return type: str New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
CatalogFilename
Parameters: catalogFilename (str) – New in version NX8.0.0.
License requirements: None.
Category¶
-
AttributeTemplatesBuilder.
Category
¶ Returns or sets the category.
Optional category for templates of all types. This allows for templates to be grouped together.
-------------------------------------
Getter Method
Signature
Category
Returns: Return type: str New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
Category
Parameters: category (str) – New in version NX8.0.0.
License requirements: None.
Constraint¶
-
AttributeTemplatesBuilder.
Constraint
¶ Returns or sets the constraint.
Informs the template which method of constraints to use. If constraints are used the default value must satisfy the given constraints. Constraints are supported by templates of type Integer, Number, String, and Date.
-------------------------------------
Getter Method
Signature
Constraint
Returns: Return type: NXOpen.AttributeTemplatesBuilderConstraintOptions
New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
Constraint
Parameters: constraint ( NXOpen.AttributeTemplatesBuilderConstraintOptions
) –New in version NX8.0.0.
License requirements: None.
CopyAttributeOnObjectCopy¶
-
AttributeTemplatesBuilder.
CopyAttributeOnObjectCopy
¶ Returns or sets the flag specifying whether the attribute should be copied when the object is copied.
If false, the attribute copy is disallowed.
-------------------------------------
Getter Method
Signature
CopyAttributeOnObjectCopy
Returns: Return type: bool New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
CopyAttributeOnObjectCopy
Parameters: copyAttributeOnObjectCopy (bool) – New in version NX8.0.0.
License requirements: None.
DataType¶
-
AttributeTemplatesBuilder.
DataType
¶ Returns or sets the data type.
Must be set for each template and cannot be changed once the template has been created.
-------------------------------------
Getter Method
Signature
DataType
Returns: Return type: NXOpen.AttributePropertiesBaseBuilderDataTypeOptions
New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
DataType
Parameters: dataType ( NXOpen.AttributePropertiesBaseBuilderDataTypeOptions
) –New in version NX8.0.0.
License requirements: None.
DateConstraint¶
-
AttributeTemplatesBuilder.
DateConstraint
¶ Returns the date constraint.
Only used if the data type is Date. The default date must satisfy the constraints defined by this object.
-------------------------------------
Getter Method
Signature
DateConstraint
Returns: Return type: NXOpen.DateBuilder
New in version NX8.0.0.
License requirements: None.
DefaultBoolean¶
-
AttributeTemplatesBuilder.
DefaultBoolean
¶ Returns or sets the default boolean.
Optional default value for a template of type Boolean.
-------------------------------------
Getter Method
Signature
DefaultBoolean
Returns: Return type: NXOpen.AttributeTemplatesBuilderDefaultBooleanOptions
New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
DefaultBoolean
Parameters: defaultBoolean ( NXOpen.AttributeTemplatesBuilderDefaultBooleanOptions
) –New in version NX8.0.0.
License requirements: None.
DefaultDate¶
-
AttributeTemplatesBuilder.
DefaultDate
¶ Returns the default date.
Optional if no date constraints exists, otherwise it must satisfy the constraint data.
-------------------------------------
Getter Method
Signature
DefaultDate
Returns: Return type: NXOpen.DateBuilder
New in version NX8.0.0.
License requirements: None.
DefaultInteger¶
-
AttributeTemplatesBuilder.
DefaultInteger
¶ Returns or sets the default integer.
Optional if the constraint is set to None, otherwise it must satisfy the constraint data.
-------------------------------------
Getter Method
Signature
DefaultInteger
Returns: Return type: int New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
DefaultInteger
Parameters: defaultInteger (int) – New in version NX8.0.0.
License requirements: None.
DefaultNumber¶
-
AttributeTemplatesBuilder.
DefaultNumber
¶ Returns or sets the default number.
Optional if the constraint is set to None, otherwise it must satisfy the constraint data.
-------------------------------------
Getter Method
Signature
DefaultNumber
Returns: Return type: float New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
DefaultNumber
Parameters: defaultNumber (float) – New in version NX8.0.0.
License requirements: None.
DefaultString¶
-
AttributeTemplatesBuilder.
DefaultString
¶ Returns or sets the default string.
Optional if the constraint is set to None, otherwise it must satisfy the constraint data.
-------------------------------------
Getter Method
Signature
DefaultString
Returns: Return type: str New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
DefaultString
Parameters: defaultString (str) – New in version NX8.0.0.
License requirements: None.
EnforcedConstraints¶
-
AttributeTemplatesBuilder.
EnforcedConstraints
¶ Returns or sets the enforced constraints.
Determines if the template constraints will be enforced.
-------------------------------------
Getter Method
Signature
EnforcedConstraints
Returns: Return type: bool New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
EnforcedConstraints
Parameters: enforcedConstraints (bool) – New in version NX8.0.0.
License requirements: None.
LockOnSave¶
-
AttributeTemplatesBuilder.
LockOnSave
¶ Returns or sets the flag specifying if the attribute should be locked on save.
If true, then any attributes created from this template will become locked when the part is saved (and reloaded).
-------------------------------------
Getter Method
Signature
LockOnSave
Returns: Return type: bool New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
LockOnSave
Parameters: lockOnSave (bool) – New in version NX8.0.0.
License requirements: None.
MaxInteger¶
-
AttributeTemplatesBuilder.
MaxInteger
¶ Returns or sets the max integer.
Only to be set if the data type is Integer and the constraint specifies an upper limit. The default integer value must be less than or equal to this value.
-------------------------------------
Getter Method
Signature
MaxInteger
Returns: Return type: int New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
MaxInteger
Parameters: maxInteger (int) – New in version NX8.0.0.
License requirements: None.
MaxNumber¶
-
AttributeTemplatesBuilder.
MaxNumber
¶ Returns or sets the max number.
Only to be set if the data type is Number and the constraint specifies an upper limit. The default number value must be less than or equal to this value.
-------------------------------------
Getter Method
Signature
MaxNumber
Returns: Return type: float New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
MaxNumber
Parameters: maxNumber (float) – New in version NX8.0.0.
License requirements: None.
MaxString¶
-
AttributeTemplatesBuilder.
MaxString
¶ Returns or sets the max string.
Only to be set if the data type is String and the constraint specifies an upper limit. The default string value must be less than or equal to this value.
-------------------------------------
Getter Method
Signature
MaxString
Returns: Return type: str New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
MaxString
Parameters: maxString (str) – New in version NX8.0.0.
License requirements: None.
MinInteger¶
-
AttributeTemplatesBuilder.
MinInteger
¶ Returns or sets the min integer.
Only to be set if the data type is Integer and the constraint specifies a lower limit. The default integer value must be greater than or equal to this value.
-------------------------------------
Getter Method
Signature
MinInteger
Returns: Return type: int New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
MinInteger
Parameters: minInteger (int) – New in version NX8.0.0.
License requirements: None.
MinNumber¶
-
AttributeTemplatesBuilder.
MinNumber
¶ Returns or sets the min number.
Only to be set if the data type is Number and the constraint specifies a lower limit. The default number value must be greater than or equal to this value.
-------------------------------------
Getter Method
Signature
MinNumber
Returns: Return type: float New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
MinNumber
Parameters: minNumber (float) – New in version NX8.0.0.
License requirements: None.
MinString¶
-
AttributeTemplatesBuilder.
MinString
¶ Returns or sets the min string.
Only to be set if the data type is String and the constraint specifies a lower limit. The default string value must be greater than or equal to this value.
-------------------------------------
Getter Method
Signature
MinString
Returns: Return type: str New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
MinString
Parameters: minString (str) – New in version NX8.0.0.
License requirements: None.
Persistent¶
-
AttributeTemplatesBuilder.
Persistent
¶ Returns or sets the persistent flag.
If a template is marked as persistent, then the template will be saved with the part when a template attribute is created. This flag is only used when editing templates in the catalog file, during which the default is false. If editing templates in the part, the template will be created in the part, making it persistent by definition.
-------------------------------------
Getter Method
Signature
Persistent
Returns: Return type: bool New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
Persistent
Parameters: persistent (bool) – New in version NX8.0.0.
License requirements: None.
ProxyAttributeForLocking¶
-
AttributeTemplatesBuilder.
ProxyAttributeForLocking
¶ Returns or sets the proxy attribute for locking.
This must be PDM attribute available in the Access Control List. This functionality is available only in managed mode. Specify relevent proxy attribute based on
NXOpen.AttributeTemplatesBuilderTemplatesOptions
.-------------------------------------
Getter Method
Signature
ProxyAttributeForLocking
Returns: Return type: str New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
ProxyAttributeForLocking
Parameters: proxyAttributeForLocking (str) – New in version NX8.0.0.
License requirements: None.
Templates¶
-
AttributeTemplatesBuilder.
Templates
¶ Returns or sets the templates option.
This option determines which set of templates will be modified.
-------------------------------------
Getter Method
Signature
Templates
Returns: Return type: NXOpen.AttributeTemplatesBuilderTemplatesOptions
New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
Templates
Parameters: dataType ( NXOpen.AttributeTemplatesBuilderTemplatesOptions
) –New in version NX8.0.0.
License requirements: None.
Title¶
-
AttributeTemplatesBuilder.
Title
¶ Returns or sets the title.
This is the identifier of the template and must be unique.
-------------------------------------
Getter Method
Signature
Title
Returns: Return type: str New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
Title
Parameters: title (str) – New in version NX8.0.0.
License requirements: None.
Units¶
-
AttributeTemplatesBuilder.
Units
¶ Returns or sets the units.
Represents the units associated with a template of type Number.
-------------------------------------
Getter Method
Signature
Units
Returns: Return type: str New in version NX8.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
Units
Parameters: units (str) – New in version NX8.0.0.
License requirements: None.
Method Detail¶
AddAccessKey¶
-
AttributeTemplatesBuilder.
AddAccessKey
¶ Add a new access key to the list of access keys.
If this access key alreadys exists, it will not be added.
Signature
AddAccessKey(accessKey)
Parameters: accessKey ( NXOpen.AttributeTemplatesBuilderAccessKey
) –New in version NX8.0.0.
License requirements: None.
Delete¶
-
AttributeTemplatesBuilder.
Delete
¶ Delete an attribute template by specifying the title and type of the template.
The template will be deleted from the depository specified by the current Templates Option. The deleted flag will return true if the template was successfully deleted.
Signature
Delete(title, type)
Parameters: - title (str) –
- type (
NXOpen.AttributePropertiesBaseBuilderDataTypeOptions
) –
Returns: Return type: bool
New in version NX8.0.0.
License requirements: None.
ExportCatalog¶
-
AttributeTemplatesBuilder.
ExportCatalog
¶ Exports templates to a specified external catalog.
All templates from the loaded catalog will be saved to disk at the location specified by the catalog filename. Any templates the previously existed in the external catalog will be deleted.
The catalog filename must be set to the location of the external catalog on disk.
Signature
ExportCatalog()
New in version NX8.0.0.
License requirements: None.
GetAccessKeys¶
-
AttributeTemplatesBuilder.
GetAccessKeys
¶ Get the access keys.
The access keys define which objects will have access to this attribute template.
Signature
GetAccessKeys()
Returns: Return type: list of NXOpen.AttributeTemplatesBuilderAccessKey
New in version NX8.0.0.
License requirements: None.
GetIntegerList¶
-
AttributeTemplatesBuilder.
GetIntegerList
¶ Returns the integer list.
Only valid if the type is Integer and the contraint is set to list.
Signature
GetIntegerList()
Returns: Return type: list of str New in version NX8.0.0.
License requirements: None.
GetNote¶
-
AttributeTemplatesBuilder.
GetNote
¶ Returns the note.
Optional data for templates of all types.
Signature
GetNote()
Returns: Return type: list of str New in version NX8.0.0.
License requirements: None.
GetNumberList¶
-
AttributeTemplatesBuilder.
GetNumberList
¶ Returns the number list.
Only valid if the type is Number and the contraint is set to list.
Signature
GetNumberList()
Returns: Return type: list of str New in version NX8.0.0.
License requirements: None.
GetStringList¶
-
AttributeTemplatesBuilder.
GetStringList
¶ Returns the string list.
Only valid if the type is String and the contraint is set to list.
Signature
GetStringList()
Returns: Return type: list of str New in version NX8.0.0.
License requirements: None.
ImportCatalog¶
-
AttributeTemplatesBuilder.
ImportCatalog
¶ Imports templates from a specified external catalog.
The current catalog of templates will be erased and replaced with the templates from the external catalog. Import will not instantiate templates in the part, it only modifies what templates are currently available in the loaded catalog.
The catalog filename must be set to the location of the external catalog on disk.
Signature
ImportCatalog()
New in version NX8.0.0.
License requirements: None.
RemoveAccessKey¶
-
AttributeTemplatesBuilder.
RemoveAccessKey
¶ Remove an access key from the list of access keys.
Signature
RemoveAccessKey(accessKey)
Parameters: accessKey ( NXOpen.AttributeTemplatesBuilderAccessKey
) –New in version NX8.0.0.
License requirements: None.
SetAccessKeys¶
-
AttributeTemplatesBuilder.
SetAccessKeys
¶ Set the access keys.
The access keys define which objects will have access to this attribute template. If no access keys are provided, the attribute template will be visible to all objects.
Signature
SetAccessKeys(accessKeys)
Parameters: accessKeys (list of NXOpen.AttributeTemplatesBuilderAccessKey
) –New in version NX8.0.0.
License requirements: None.
SetIntegerList¶
-
AttributeTemplatesBuilder.
SetIntegerList
¶ Sets the integer list.
Must be set if the type is Integer and the contraint is set to list. The default integer value must be contained in this list.
Signature
SetIntegerList(integerList)
Parameters: integerList (list of str) – New in version NX8.0.0.
License requirements: None.
SetNote¶
-
AttributeTemplatesBuilder.
SetNote
¶ Sets the note.
Optional data for templates of all types.
Signature
SetNote(note)
Parameters: note (list of str) – New in version NX8.0.0.
License requirements: None.
SetNumberList¶
-
AttributeTemplatesBuilder.
SetNumberList
¶ Sets the number list.
Must be set if the type is Number and the contraint is set to list. The default number value must be contained in this list.
Signature
SetNumberList(numberList)
Parameters: numberList (list of str) – New in version NX8.0.0.
License requirements: None.
SetStringList¶
-
AttributeTemplatesBuilder.
SetStringList
¶ Sets the string list.
Must be set if the type is String and the contraint is set to list. The default string value must be contained in this list.
Signature
SetStringList(stringList)
Parameters: stringList (list of str) – New in version NX8.0.0.
License requirements: None.
UpdateTemplates¶
-
AttributeTemplatesBuilder.
UpdateTemplates
¶ Update templates in the part from the external catalog defined in customer defaults.
The title and type must match for the update to take place.
Signature
UpdateTemplates()
New in version NX8.0.0.
License requirements: None.
Validate¶
-
AttributeTemplatesBuilder.
Validate
¶ Validate whether the inputs to the component are sufficient for commit to be called.
If the component is not in a state to commit then an exception is thrown. For example, if the component requires you to set some property, this method will throw an exception if you haven’t set it. This method throws a not-yet-implemented NXException for some components.
Signature
Validate()
Returns: Was self validation successful Return type: bool New in version NX3.0.1.
License requirements: None.