AttributePropertiesBaseBuilder Class — NXOpen Python API Reference 12.0.0 documentation

# AttributePropertiesBaseBuilder Class

class `NXOpen.``AttributePropertiesBaseBuilder`

  Bases: `NXOpen.Builder`

  Represents an `NXOpen.AttributePropertiesBaseBuilder` to be used for creating attributes.

  A basic attribute consists of a title, a type, and a value. There are six types of attributes: Null, Boolean, Integer, Number, String, and Date. The type detemines which value field will be read during creation. An attribute may reference an expression instead of setting a value. In this case, the referenced expression’s value will also serve as the attribute’s value and will update when the expression changes.

  If an attribute template exists with the same title as the attribute, then the attribute will assume all characteristics of the cooresponding template including the type. Attribute templates reside at the part level and provide extra information for referencing attributes. They are created using `NXOpen.AttributeTemplatesBuilder`.

  The attribute will be distributed to all objects supplied in the selected object list.

  This is an abstract class, and cannot be instantiated.

  New in version NX8.0.0.

# Properties

Property | Description
--- | ---
ArrayIndex | Returns or sets the array index.
BooleanValue | Returns or sets the boolean value.
Category | Returns or sets the category.
DataType | Returns or sets the data type, which determines the type of attribute to be created.
DateValue | Returns the date value.
Expression | Returns or sets the expression referenced from this attribute.
IntegerValue | Returns or sets the integer value.
IsArray | Returns or sets the ‘is array’ flag is set for attributes that have more than one value.
IsReferenceType | Returns or sets the ‘is reference type’ flag is set for attributes that are linked to system expressions.
LockOnSave | Returns or sets the ‘LockOnSave’ flag is set for attributes that will be locked once the part is saved (and reloaded)
NumberValue | Returns or sets the number value.
ObjectPicker | Returns or sets the object picker.
SelectedObjects | Returns the selected object(s) list.
StringValue | Returns or sets the string value.
Tag | Returns the Tag for this object.
Title | Returns or sets the attribute title.
Units | Returns or sets the units associated with an attribute of type Number.
ValueAlias | Returns or sets the value alias.

# Methods

Method | Description
--- | ---
ApplyUnits | Apply the units currently set on the builder to any objects that have a value set for the current attribute.
Commit | Commits any edits that have been applied to the builder.
CreateAttribute | Create the attribute from the data set in the builder.
Delete | Delete the attribute from the given object.
DeleteArray | Delete the attribute array from the given object.
Destroy | Deletes the builder, and cleans up any objects created by the builder.
GetCommittedObjects | For builders that create more than one object, this method returns the objects that are created by commit.
GetObject | Returns the object currently being edited by this builder.
SetAttributeObjects | Sets the array of objects that have this attribute
ShowResults | Updates the model to reflect the result of an edit to the model for all builders that support showing results.
Validate | Validate whether the inputs to the component are sufficient for commit to be called.

# Enumerations

AttributePropertiesBaseBuilderBooleanValueOptions Enumeration | The value choices for an attribute of type Boolean
AttributePropertiesBaseBuilderDataTypeOptions Enumeration | Specifies the data type of the attribute, this cannot be changed once the attribute has been created
AttributePropertiesBaseBuilderObjectOptions Enumeration | Specifies which object will be used when applying attributes.

# Property Detail

## ArrayIndex

`AttributePropertiesBaseBuilder.``ArrayIndex`

  Returns or sets the array index.

  Required if modifying an attribute that has more than one value. The IsArray flag must also be set.

  `-------------------------------------`

  Getter Method

  Signature `ArrayIndex`

  Returns: |
  Return type: | int

  New in version NX8.0.0.

  License requirements: None.

  `-------------------------------------`

  Setter Method

  Signature `ArrayIndex`

  Parameters: | arrayIndex (int) –

  New in version NX8.0.0.

  License requirements: None.

## BooleanValue

`AttributePropertiesBaseBuilder.``BooleanValue`

  Returns or sets the boolean value.

  Required if creating an attribute of type Boolean.

  `-------------------------------------`

  Getter Method

  Signature `BooleanValue`

  Returns: |
  Return type: | `NXOpen.AttributePropertiesBaseBuilderBooleanValueOptions`

  New in version NX8.0.0.

  License requirements: None.

  `-------------------------------------`

  Setter Method

  Signature `BooleanValue`

  Parameters: | boolValue (`NXOpen.AttributePropertiesBaseBuilderBooleanValueOptions`) –

  New in version NX8.0.0.

  License requirements: None.

## Category

`AttributePropertiesBaseBuilder.``Category`

  Returns or sets the category.

  The category is an optional, user-defined string that allows attributes 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.

## DataType

`AttributePropertiesBaseBuilder.``DataType`

  Returns or sets the data type, which determines the type of attribute to be created.

  Once the attribute is created, the data type cannot be modified.

  `-------------------------------------`

  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.

## DateValue

`AttributePropertiesBaseBuilder.``DateValue`

  Returns the date value.

  The Date object will contain the value for an attribute of type Date.

  `-------------------------------------`

  Getter Method

  Signature `DateValue`

  Returns: |
  Return type: | `NXOpen.DateBuilder`

  New in version NX8.0.0.

  License requirements: None.

## Expression

`AttributePropertiesBaseBuilder.``Expression`

  Returns or sets the expression referenced from this attribute.

  Only used for attributes of type Number, Integer, Boolean, and String. If an expression is referenced, no value fields need to be set, as the attribute uses the value from the expression.

  `-------------------------------------`

  Getter Method

  Signature `Expression`

  Returns: |
  Return type: | `NXOpen.Expression`

  New in version NX8.0.0.

  License requirements: None.

  `-------------------------------------`

  Setter Method

  Signature `Expression`

  Parameters: | expression (`NXOpen.Expression`) –

  New in version NX8.0.0.

  License requirements: None.

## IntegerValue

`AttributePropertiesBaseBuilder.``IntegerValue`

  Returns or sets the integer value.

  Required if creating an attribute of type Integer.

  `-------------------------------------`

  Getter Method

  Signature `IntegerValue`

  Returns: |
  Return type: | int

  New in version NX8.0.0.

  License requirements: None.

  `-------------------------------------`

  Setter Method

  Signature `IntegerValue`

  Parameters: | integerValue (int) –

  New in version NX8.0.0.

  License requirements: None.

## IsArray

`AttributePropertiesBaseBuilder.``IsArray`

  Returns or sets the ‘is array’ flag is set for attributes that have more than one value.

  When this is set, the index needs to be provided to indicate which element will be modified.

  `-------------------------------------`

  Getter Method

  Signature `IsArray`

  Returns: |
  Return type: | bool

  New in version NX8.0.0.

  License requirements: None.

  `-------------------------------------`

  Setter Method

  Signature `IsArray`

  Parameters: | isArray (bool) –

  New in version NX8.0.0.

  License requirements: None.

## IsReferenceType

`AttributePropertiesBaseBuilder.``IsReferenceType`

  Returns or sets the ‘is reference type’ flag is set for attributes that are linked to system expressions.

  The type must also be set to String for the Reference attribut to be created/edited. If a Reference attribute is no longer linked to a system expression, it will become a String attribute.

  `-------------------------------------`

  Getter Method

  Signature `IsReferenceType`

  Returns: |
  Return type: | bool

  New in version NX8.0.0.

  License requirements: None.

  `-------------------------------------`

  Setter Method

  Signature `IsReferenceType`

  Parameters: | isReferenceType (bool) –

  New in version NX8.0.0.

  License requirements: None.

## LockOnSave

`AttributePropertiesBaseBuilder.``LockOnSave`

  Returns or sets the ‘LockOnSave’ flag is set for attributes that will be locked once 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.

## NumberValue

`AttributePropertiesBaseBuilder.``NumberValue`

  Returns or sets the number value.

  Required if creating an attribute of type Number.

  `-------------------------------------`

  Getter Method

  Signature `NumberValue`

  Returns: |
  Return type: | float

  New in version NX8.0.0.

  License requirements: None.

  `-------------------------------------`

  Setter Method

  Signature `NumberValue`

  Parameters: | numberValue (float) –

  New in version NX8.0.0.

  License requirements: None.

## ObjectPicker

`AttributePropertiesBaseBuilder.``ObjectPicker`

  Returns or sets the object picker.

  This determines what objects the attribute will be applied to. If modified, the select object list will change based on this value.

  `-------------------------------------`

  Getter Method

  Signature `ObjectPicker`

  Returns: |
  Return type: | `NXOpen.AttributePropertiesBaseBuilderObjectOptions`

  New in version NX8.0.0.

  Deprecated since version NX10.0.0: Use `NXOpen.AttributePropertiesBaseBuilder.SetAttributeObjects()` instead.

  License requirements: None.

  `-------------------------------------`

  Setter Method

  Signature `ObjectPicker`

  Parameters: | objectPicker (`NXOpen.AttributePropertiesBaseBuilderObjectOptions`) –

  New in version NX8.0.0.

  Deprecated since version NX10.0.0: Use `NXOpen.AttributePropertiesBaseBuilder.SetAttributeObjects()` instead.

  License requirements: None.

## SelectedObjects

`AttributePropertiesBaseBuilder.``SelectedObjects`

  Returns the selected object(s) list.

  The created attribute will be applied to all objects in this list.

  `-------------------------------------`

  Getter Method

  Signature `SelectedObjects`

  Returns: |
  Return type: | `NXOpen.SelectNXObjectList`

  New in version NX8.0.0.

  License requirements: None.

## StringValue

`AttributePropertiesBaseBuilder.``StringValue`

  Returns or sets the string value.

  Required if creating an attribute of type String.

  `-------------------------------------`

  Getter Method

  Signature `StringValue`

  Returns: |
  Return type: | str

  New in version NX8.0.0.

  License requirements: None.

  `-------------------------------------`

  Setter Method

  Signature `StringValue`

  Parameters: | stringValue (str) –

  New in version NX8.0.0.

  License requirements: None.

## Title

`AttributePropertiesBaseBuilder.``Title`

  Returns or sets the attribute title.

  The title is required for creating an attribute and must be unique on the given object. Once the attribute is created, the title cannot be modified.

  `-------------------------------------`

  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

`AttributePropertiesBaseBuilder.``Units`

  Returns or sets the units associated with an attribute of type Number.

  Once the attribute is created, the unit measure (length, area, etc) cannot be changed. However the units (mm, ft, etc) within the measure can be changed.

  `-------------------------------------`

  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.

## ValueAlias

`AttributePropertiesBaseBuilder.``ValueAlias`

  Returns or sets the value alias.

  Optional for any attribute.

  `-------------------------------------`

  Getter Method

  Signature `ValueAlias`

  Returns: |
  Return type: | str

  New in version NX10.0.0.

  License requirements: None.

  `-------------------------------------`

  Setter Method

  Signature `ValueAlias`

  Parameters: | valueAlias (str) –

  New in version NX10.0.0.

  License requirements: None.

# Method Detail

## ApplyUnits

`AttributePropertiesBaseBuilder.``ApplyUnits`

  Apply the units currently set on the builder to any objects that have a value set for the current attribute.

  This method does not apply the current value set on the builder. `NXOpen.AttributePropertiesBaseBuilder.CreateAttribute()` should be used for doing that.

  Signature `ApplyUnits()`

  Returns: | True if attributes were updated successfully
  Return type: | bool

  New in version NX11.0.0.

  License requirements: None.

## CreateAttribute

`AttributePropertiesBaseBuilder.``CreateAttribute`

  Create the attribute from the data set in the builder.

  Unlike calling commit, this method will not perform an update.

  Signature `CreateAttribute()`

  Returns: | True if the attribute was created/edited successfully
  Return type: | bool

  New in version NX8.0.0.

  License requirements: None.

## Delete

`AttributePropertiesBaseBuilder.``Delete`

  Delete the attribute from the given object.

  Signature `Delete(object)`

  Parameters: | object (`NXOpen.NXObject`) – The object containing the attribute

  New in version NX8.0.0.

  License requirements: None.

## DeleteArray

`AttributePropertiesBaseBuilder.``DeleteArray`

  Delete the attribute array from the given object.

  Signature `DeleteArray(object)`

  Parameters: | object (`NXOpen.NXObject`) – The object containing the attribute

  New in version NX8.0.0.

  License requirements: None.

## SetAttributeObjects

`AttributePropertiesBaseBuilder.``SetAttributeObjects`

  Sets the array of objects that have this attribute

  Signature `SetAttributeObjects(objects)`

  Parameters: | objects (list of `NXOpen.NXObject`) – the array of objects

  New in version NX8.5.0.

  License requirements: None.

## Validate

`AttributePropertiesBaseBuilder.``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.