Expression Class¶
-
class
NXOpen.
Expression
¶ Bases:
NXOpen.NXObject
Represents an expression.
To create a new instance of this class, use
NXOpen.ExpressionCollection.CreateWithUnits()
New in version NX3.0.0.
Properties¶
Property | Description |
---|---|
BooleanValue | Returns the boolean value of the expression. |
Description | Returns the description of the expression. |
Equation | Returns the equation of the expression in the form: name = right_hand_side. |
IntegerValue | Returns the integer value of the expression. |
IsGeometricExpression | Returns whether the expression is a geometric expression. |
IsInterpartExpression | Returns whether the expression is an interpart expression. |
IsMeasurementExpression | Returns whether the expression is owned by a measurement. |
IsNoEdit | Returns or sets whether the expression is edit locked. |
IsNoUpdate | Returns or sets whether the expression is update locked. |
IsOccurrence | Returns whether this object is an occurrence or not. |
IsUserLocked | Returns or sets whether the expression is user locked. |
JournalIdentifier | Returns the identifier that would be recorded in a journal for this object. |
Name | Returns the custom name of the object. |
OwningComponent | Returns the owning component, if this object is an occurrence. |
OwningPart | Returns the owning part of this object |
PointValue | Returns the point value of the expression. |
Prototype | Returns the prototype of this object if it is an occurrence. |
RightHandSide | Returns or sets the right hand side of the expression. |
StringValue | Returns the string value of the expression. |
Tag | Returns the Tag for this object. |
Type | Returns the type of the expression. |
Units | Returns or sets the units for the expression. |
Value | Returns or sets the value of the expression in base units. |
VectorValue | Returns the vector value of the expression. |
Methods¶
Method | Description |
---|---|
CreateAttributeIterator | Create an attribute iterator @return A new attribute iterator object |
DeleteAllAttributesByType | Deletes all attributes of a specific type. |
DeleteAttributeByTypeAndTitle | Deletes an attribute by type and title. |
DeleteUserAttribute | Deletes the first attribute encountered with the given Type, Title. |
DeleteUserAttributes | Deletes the attributes on the object, if any, that satisfy the given iterator |
EditComment | Changes the comment. |
FindObject | Finds the NXOpen.NXObject with the given identifier as recorded in a journal. |
GetAttributeTitlesByType | Gets all the attribute titles of a specific type. |
GetBooleanUserAttribute | Gets a boolean attribute by Title and array Index. |
GetComputationalTimeUserAttribute | Gets a time attribute by Title and array Index. |
GetDescriptor | Returns the descriptor for the expression, or None if there is no descriptor. |
GetIntegerAttribute | Gets an integer attribute by title. |
GetIntegerUserAttribute | Gets an integer attribute by Title and array Index. |
GetInterpartExpressionNames | The source part name and source expression name of the interpart expression |
GetListValue | Returns the list value of the expression. |
GetNextUserAttribute | Gets the next attribute encountered on the object, if any, that satisfies the given iterator. |
GetOwningFeature | Returns the feature that created the supplied expression. |
GetOwningRpoFeature | Returns the feature whose rpo_transform created the supplied positioning dimension expression. |
GetRealAttribute | Gets a real attribute by title. |
GetRealUserAttribute | Gets a real attribute by Title and array Index. |
GetReferenceAttribute | Gets the reference string (not the calculated value) of a string attribute that uses a reference string. |
GetReferencingExpressions | Returns all the referencing expressions of the expression @return |
GetStringAttribute | Gets a string attribute value by title. |
GetStringUserAttribute | Gets a string attribute by Title and array Index. |
GetTimeAttribute | Gets a time attribute by title. |
GetTimeUserAttribute | Gets a time attribute by Title and array Index. |
GetUserAttribute | Gets the first attribute encountered on the object, if any, with a given Title, Type and array Index. |
GetUserAttributeAsString | Gets the first attribute encountered on the object, if any, with a given title, type and array index. |
GetUserAttributeCount | Gets the count of set attributes on the object, if any, that satisfy the given iterator. |
GetUserAttributeLock | Determine the lock of the given attribute. |
GetUserAttributeSize | Gets the size of the first attribute encountered on the object, if any, with a given Title and Type. |
GetUserAttributeSourceObjects | Returns an array of objects from which this object presents attributes. |
GetUserAttributes | Gets all the attributes that have been set on the given object, if any, that satisfy the given iterator. |
GetUserAttributesAsStrings | Gets all the attributes that have been set on the given object. |
GetUsingFeatures | Returns an array of the features that use the supplied expression. |
GetValueUsingUnits | Get the value of the expression, in either base units or the expression’s units. |
HasUserAttribute | Determines if an attribute exists on the object, that satisfies the given iterator @return |
Prints a representation of this object to the system log file. | |
SetAttribute | Creates or modifies an integer attribute. |
SetBooleanUserAttribute | Creates or modifies a boolean attribute with the option to update or not. |
SetName | Sets the custom name of the object. |
SetReferenceAttribute | Creates or modifies a string attribute which uses a reference string. |
SetTimeAttribute | Creates or modifies a time attribute. |
SetTimeUserAttribute | Creates or modifies a time attribute with the option to update or not. |
SetUserAttribute | Creates or modifies an attribute with the option to update or not. |
SetUserAttributeLock | Lock or unlock the given attribute. |
Enumerations¶
ExpressionUnitsOption Enumeration | Indicates the units to use when getting an expression’s value. |
Property Detail¶
BooleanValue¶
-
Expression.
BooleanValue
¶ Returns the boolean value of the expression.
This must only be used on boolean expressions.
-------------------------------------
Getter Method
Signature
BooleanValue()
Returns: Return type: bool New in version NX6.0.0.
License requirements: None.
Description¶
-
Expression.
Description
¶ Returns the description of the expression.
This can be used to get the “A”::x formatted name for interpart expressions.
-------------------------------------
Getter Method
Signature
Description()
Returns: Return type: str New in version NX5.0.2.
License requirements: None.
Equation¶
-
Expression.
Equation
¶ Returns the equation of the expression in the form: name = right_hand_side.
-------------------------------------
Getter Method
Signature
Equation()
Returns: Return type: str New in version NX3.0.0.
License requirements: None.
IntegerValue¶
-
Expression.
IntegerValue
¶ Returns the integer value of the expression.
This must only be used on integer expressions.
-------------------------------------
Getter Method
Signature
IntegerValue()
Returns: Return type: int New in version NX6.0.0.
License requirements: None.
IsGeometricExpression¶
-
Expression.
IsGeometricExpression
¶ Returns whether the expression is a geometric expression.
-------------------------------------
Getter Method
Signature
IsGeometricExpression()
Returns: Return type: bool New in version NX4.0.0.
License requirements: None.
IsInterpartExpression¶
-
Expression.
IsInterpartExpression
¶ Returns whether the expression is an interpart expression.
-------------------------------------
Getter Method
Signature
IsInterpartExpression()
Returns: Return type: bool New in version NX11.0.0.
License requirements: None.
IsMeasurementExpression¶
-
Expression.
IsMeasurementExpression
¶ Returns whether the expression is owned by a measurement.
-------------------------------------
Getter Method
Signature
IsMeasurementExpression()
Returns: Return type: bool New in version NX5.0.0.
License requirements: None.
IsNoEdit¶
-
Expression.
IsNoEdit
¶ Returns or sets whether the expression is edit locked.
If this property is false, then the expression can be edited. (This is the default state for newly created expressions.) If this property is true, then the expression cannot be edited. This corresponds to the interactive option RMB Lock Formula/RMB Unlock Formula.
-------------------------------------
Getter Method
Signature
IsNoEdit()
Returns: Return type: bool New in version NX8.5.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
IsNoEdit(isNoEdit)
Parameters: isNoEdit (bool) – New in version NX8.5.0.
License requirements: None.
IsNoUpdate¶
-
Expression.
IsNoUpdate
¶ Returns or sets whether the expression is update locked.
If this property is false, then the expression can update. (This is the default state for newly created expressions.) If this property is true, then the expression cannot update.
-------------------------------------
Getter Method
Signature
IsNoUpdate()
Returns: Return type: bool New in version NX10.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
IsNoUpdate(isNoUpdate)
Parameters: isNoUpdate (bool) – New in version NX10.0.0.
License requirements: None.
IsOccurrence¶
-
Expression.
IsOccurrence
¶ Returns whether this object is an occurrence or not.
-------------------------------------
Getter Method
Signature
IsOccurrence()
Returns: This object is an occurrence Return type: bool New in version NX3.0.0.
License requirements: None.
IsUserLocked¶
-
Expression.
IsUserLocked
¶ Returns or sets whether the expression is user locked.
If this property is false, then the expression can be over-ridden from another part. (This is the default state for newly created expressions.) If this property is true, you are not allowed to over-ride it. This corresponds to the interactive option RMB Toggle Interpart Override Lock.
Note that if an expression is currently over-ridden, you cannot set its lock property. In this instance, an exception will be thrown.
-------------------------------------
Getter Method
Signature
IsUserLocked()
Returns: Return type: bool New in version NX4.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
IsUserLocked(isLocked)
Parameters: isLocked (bool) – New in version NX4.0.0.
License requirements: None.
JournalIdentifier¶
-
Expression.
JournalIdentifier
¶ Returns the identifier that would be recorded in a journal for this object.
This may not be the same across different releases of the software.
-------------------------------------
Getter Method
Signature
JournalIdentifier()
Returns: Return type: str New in version NX3.0.0.
License requirements: None.
Name¶
-
Expression.
Name
¶ Returns the custom name of the object.
-------------------------------------
Getter Method
Signature
Name()
Returns: Return type: str New in version NX3.0.0.
License requirements: None.
OwningComponent¶
-
Expression.
OwningComponent
¶ Returns the owning component, if this object is an occurrence.
-------------------------------------
Getter Method
Signature
OwningComponent()
Returns: Return type: NXOpen.Assemblies.Component
New in version NX3.0.0.
License requirements: None.
OwningPart¶
-
Expression.
OwningPart
¶ Returns the owning part of this object
-------------------------------------
Getter Method
Signature
OwningPart()
Returns: The owning part of this object or null if it does not have an owner Return type: NXOpen.BasePart
New in version NX3.0.0.
License requirements: None.
PointValue¶
-
Expression.
PointValue
¶ Returns the point value of the expression.
This must only be used on point expressions.
-------------------------------------
Getter Method
Signature
PointValue()
Returns: Return type: NXOpen.Point3d
New in version NX6.0.0.
License requirements: None.
Prototype¶
-
Expression.
Prototype
¶ Returns the prototype of this object if it is an occurrence.
-------------------------------------
Getter Method
Signature
Prototype()
Returns: The prototype of this object or null if this object is not an occurrence Return type: NXOpen.INXObject
New in version NX3.0.0.
License requirements: None.
RightHandSide¶
-
Expression.
RightHandSide
¶ Returns or sets the right hand side of the expression.
When setting the property, changes are not applied to the system until
Update.DoUpdate()
is called-------------------------------------
Getter Method
Signature
RightHandSide()
Returns: Return type: str New in version NX3.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
RightHandSide(rightHandSide)
Parameters: rightHandSide (str) – New in version NX3.0.0.
License requirements: None.
StringValue¶
-
Expression.
StringValue
¶ Returns the string value of the expression.
This must only be used on string expressions.
-------------------------------------
Getter Method
Signature
StringValue()
Returns: Return type: str New in version NX5.0.0.
License requirements: None.
Type¶
-
Expression.
Type
¶ Returns the type of the expression.
-------------------------------------
Getter Method
Signature
Type()
Returns: a text string for the expression type Return type: str New in version NX5.0.0.
License requirements: None.
Units¶
-
Expression.
Units
¶ Returns or sets the units for the expression.
This must only be used on number expressions.
-------------------------------------
Getter Method
Signature
Units()
Returns: None if the expression has no units Return type: NXOpen.Unit
New in version NX4.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
Units(unitType)
Parameters: unitType ( NXOpen.Unit
) –New in version NX5.0.0.
License requirements: None.
Value¶
-
Expression.
Value
¶ Returns or sets the value of the expression in base units.
This method must only be used on number expressions. When setting the value, any formula in the expression is replaced by a numeric value, even if the value is the same as the value that the formula evaluates to.
-------------------------------------
Getter Method
Signature
Value()
Returns: Return type: float New in version NX3.0.0.
License requirements: None.
-------------------------------------
Setter Method
Signature
Value(expressionValue)
Parameters: expressionValue (float) – New in version NX6.0.1.
License requirements: None.
VectorValue¶
-
Expression.
VectorValue
¶ Returns the vector value of the expression.
This must only be used on vector expressions.
-------------------------------------
Getter Method
Signature
VectorValue()
Returns: Return type: NXOpen.Vector3d
New in version NX6.0.0.
License requirements: None.
Method Detail¶
EditComment¶
-
Expression.
EditComment
¶ Changes the comment.
Signature
EditComment(newComment)
Parameters: newComment (str) – comment New in version NX4.0.0.
License requirements: None.
FindObject¶
-
Expression.
FindObject
¶ Finds the
NXOpen.NXObject
with the given identifier as recorded in a journal.An object may not return the same value as its JournalIdentifier in different versions of the software. However newer versions of the software should find the same object when FindObject is passed older versions of its journal identifier. In general, this method should not be used in handwritten code and exists to support record and playback of journals.
An exception will be thrown if no object can be found with the given journal identifier.
Signature
FindObject(journalIdentifier)
Parameters: journalIdentifier (str) – Journal identifier of the object Returns: Return type: NXOpen.INXObject
New in version NX3.0.0.
License requirements: None.
GetDescriptor¶
-
Expression.
GetDescriptor
¶ Returns the descriptor for the expression, or None if there is no descriptor.
Currently, only feature expressions have descriptors.
Signature
GetDescriptor()
Returns: Expression descriptor. Return type: str New in version NX4.0.0.
License requirements: None.
GetInterpartExpressionNames¶
-
Expression.
GetInterpartExpressionNames
¶ The source part name and source expression name of the interpart expression
Signature
GetInterpartExpressionNames()
Returns: a tuple Return type: A tuple consisting of (partName, expName). partName is a str. expName is a str. New in version NX10.0.0.
License requirements: None.
GetListValue¶
GetOwningFeature¶
-
Expression.
GetOwningFeature
¶ Returns the feature that created the supplied expression.
This is the feature that created it during feature creation. For example, the expression “p0 = x” is owned by feature “BLOCK(0)”.
This works with both normal expressions and expressions created by the geometric expression feature.
Signature
GetOwningFeature()
Returns: owning feature or None Return type: NXOpen.Features.Feature
New in version NX4.0.0.
License requirements: None.
GetOwningRpoFeature¶
-
Expression.
GetOwningRpoFeature
¶ Returns the feature whose rpo_transform created the supplied positioning dimension expression.
This is the feature that created it during positioning the feature. For example, the expression “p0 = x” is owned by the Transform of feature “Boss(2)”.
This works with expressions created by the feature with rpo.
Signature
GetOwningRpoFeature()
Returns: owning rpo feature or None Return type: NXOpen.Features.Feature
New in version NX7.5.0.
License requirements: None.
GetReferencingExpressions¶
-
Expression.
GetReferencingExpressions
¶ Returns all the referencing expressions of the expression
Signature
GetReferencingExpressions()
Returns: Return type: list of NXOpen.Expression
New in version NX8.0.0.
License requirements: None.
GetUsingFeatures¶
-
Expression.
GetUsingFeatures
¶ Returns an array of the features that use the supplied expression.
Signature
GetUsingFeatures()
Returns: array of features, or empty array Return type: list of NXOpen.Features.Feature
New in version NX4.0.0.
License requirements: None.
GetValueUsingUnits¶
-
Expression.
GetValueUsingUnits
¶ Get the value of the expression, in either base units or the expression’s units.
This method must only be used on number expressions.
Signature
GetValueUsingUnits(unitsOption)
Parameters: unitsOption ( NXOpen.ExpressionUnitsOption
) – use base units or expression unitsReturns: Return type: float New in version NX4.0.0.
License requirements: None.
Print¶
-
Expression.
Print
¶ Prints a representation of this object to the system log file.
Signature
Print()
New in version NX3.0.0.
License requirements: None.
SetName¶
-
Expression.
SetName
¶ Sets the custom name of the object.
NOTE: This method should not be used to edit a read-only object such as a Mirrored PMI object. If it is, the changes will be overridden when the part is updated.
Signature
SetName(name)
Parameters: name (str) – New in version NX3.0.0.
License requirements: None.