AssociativeText Class

class NXOpen.Annotations.AssociativeText

Bases: NXOpen.TransientObject

Associative text class creates text associated to object and part attributes as well as object properties such as a drawing sheet name.

The associative text is constructed using special NX text control sequences.

The text created using this class can be added to a table cell, note text, dimension appended text etc…

Use functions in this class to query/extract information from text and create associative text.

The client shouldn’t parse NX text control sequences to extract informtation. The text control sequences can change from release to release.

New in version NX8.0.0.

Methods

Method Description
Dispose Frees the object from memory.
GetEvaluatedText Evaluate the associative text specified.
GetObjectAttribute Returns the title and owning object of the object attribute referenced in the associative text.
GetObjectAttributeText Returns the associative text for the input object and attribute title.
GetObjectPropertyText Returns the associative text for the input object and its property.
GetPartAttribute Returns the title of the part attribute referenced in the associative text.
GetPartAttributeText Returns the associative text for the part attribute title.

Enumerations

AssociativeTextPropertyType Enumeration the associative text property type to be used with the object

Method Detail

Dispose

AssociativeText.Dispose

Frees the object from memory.

After this method is called, it is illegal to use the object. In .NET, this method is automatically called when the object is deleted by the garbage collector.

Signature Dispose()

New in version NX8.0.0.

License requirements: None.

GetEvaluatedText

AssociativeText.GetEvaluatedText

Evaluate the associative text specified.

Convert associative text to the string that it represents. The following associative text control sequences will be evaluated: part attribute references, object attribute references, expression references, and object property references. Example: The value of part attribute “ATT1” is “Value1”. The text that represents the reference to part attribute “ATT1” is “<W<@>ATT1>” The value of expression “p1” is “3.00”. The text that represents the reference to expression “p1” is “<X0.2<@>p1>”. The value of object property “<WRef1*0<@>$SH_SHEET_NAME>” is “Sheet 1”. Given the input text “<WRef1*0<@>$SH_SHEET_NAME> <X0.2<@>p1> <W<@>ATT1>” the evaluated text returned will be “Sheet 1 3.00 Value1”

Signature GetEvaluatedText(ann, text)

Parameters:
  • ann (NXOpen.Annotations.Annotation) – Annotation used to determine the object property value when the object is not specified. For example, given annotation 123 and 456 where 123 resides in “Sheet 1” and 456 resides in “Sheet 2” then the evaluated text returned for the input text “<W<@>$SH_SHEET_NAME>” for annotation 123 is “Sheet 1” and for annotation 456 is “Sheet 2”
  • text (str) – the text containing associative text to evaluate
Returns:

the text with the evaluated associative text

Return type:

str

New in version NX8.0.0.

License requirements: None.

GetObjectAttribute

AssociativeText.GetObjectAttribute

Returns the title and owning object of the object attribute referenced in the associative text.

The reference is considered found if the syntax of the text control sequence reflects an object attribute reference.

**Example 1:</b> “<WRef2*0@PartAttTitle>” is an existing reference to part attribute “PartAttTitle” so the reference will be considered a part attribute reference. No object or title will be returned.

**Example 2:</b> “<W@AttTitle>” uses the part attribute syntax so the reference will be considered a part attribute reference. No object or title will be returned.

**Example 3:</b> “<WRef1*0@ObjAttTitle>” is an existing reference to object attribute “ObjAttTitle” so the reference will be considered an object attribute reference. The object containing the attribute and “ObjAttTitle” will be returned as the attribute title. Note that the object that contains the attribute will reside in the part that owns the associative text object.

**Example 4:</b> “<WRef10*0@AttTitle>” where “Ref10*0” reference does not exist will be considered an object attribute reference. No object will be returned but “AttTitle” will be returned as the attribute title. Note that the existance of “Ref10*0” is only checked for in the part that owns the associative text object.

Signature GetObjectAttribute(text)

Parameters:text (str) – the associative text to query
Returns:a tuple
Return type:A tuple consisting of (found, object, attributeTitle). found is a bool. the object attribute reference was found. object is a NXOpen.NXObject. the object attributeTitle is a str. the object attribute title

New in version NX8.5.3.

License requirements: None.

GetObjectAttributeText

AssociativeText.GetObjectAttributeText

Returns the associative text for the input object and attribute title.

Signature GetObjectAttributeText(object, attributeTitle)

Parameters:
  • object (NXOpen.NXObject) – the object
  • attributeTitle (str) – the object attribute title
Returns:

the associative text

Return type:

str

New in version NX8.0.0.

License requirements: None.

GetObjectPropertyText

AssociativeText.GetObjectPropertyText

Returns the associative text for the input object and its property.

For example, to obtain a reference to a drawing name, the object is the NXOpen.Drawings.DraftingView of the NXOpen.Drawings.DrawingSheet. It is not the NXOpen.Drawings.DrawingSheet itself, but rather the type is NXOpen.Annotations.AssociativeTextPropertyType.DrawingSheetName.

Signature GetObjectPropertyText(object, type)

Parameters:
Returns:

the associative text

Return type:

str

New in version NX8.0.0.

License requirements: None.

GetPartAttribute

AssociativeText.GetPartAttribute

Returns the title of the part attribute referenced in the associative text.

Text references such as “Ref2*0” “<WRef2*0<@>title>” must exist as a part attribute reference in the part that owns the associative text object in order to be considered part attributes. The reference is considered found if the syntax of the text control sequence reflects a part attribute reference.

**Example 1:</b> “<WRef2*0<@>PartAttTitle>” is an existing reference to part attribute “PartAttTitle” so the reference will be considered a part attribute reference. “PartAttTitle” will be returned as the title. Note that “Ref2*0” must exist as a part attribute reference in the part that owns the associative text.

**Example 2:</b> “<W<@>AttTitle>” uses the part attribute syntax so the reference will be considered a part attribute reference. “AttTitle” will be returned as the title.

**Example 3:</b> “<WRef1*0<@>ObjAttTitle>” is an existing reference to object attribute “ObjAttTitle” so the reference will be considered an object attribute reference. No title will be returned.

**Example 4:</b> “<WRef10*0<@>AttTitle>” where “Ref10*0” reference does not exist will be considered an object attribute reference. No title will be returned.

Signature GetPartAttribute(text)

Parameters:text (str) – the text containing associative text to query
Returns:a tuple
Return type:A tuple consisting of (found, attributeTitle) found is a bool. the part attribute reference was found attributeTitle is a str. the part attribute title

New in version NX8.5.3.

License requirements: None.

GetPartAttributeText

AssociativeText.GetPartAttributeText

Returns the associative text for the part attribute title.

Signature GetPartAttributeText(attributeTitle)

Parameters:attributeTitle (str) – the part attribute title
Returns:the associative text
Return type:str

New in version NX8.0.0.

License requirements: None.