NX Open C++ Reference Guide
Classes | Public Types | Public Member Functions
NXOpen::ExpressionCollection Class Reference

Represents a collection of expressions. More...

Inheritance diagram for NXOpen::ExpressionCollection:
NXOpen::TaggedObjectCollection

List of all members.

Classes

class  iterator
 Iterator for accessing the contents of the collection. More...

Public Types

enum  ExportMode { ExportModeWorkPart, ExportModeAllInAssyTree, ExportModeAllParts }
 Indicates the mode for exporting expressions. More...
enum  ImportMode { ImportModeReplace, ImportModeDontReplace, ImportModeDeleteImports }
 Indicates the mode for importing expressions. More...
enum  SortType { SortTypeAlphaNum, SortTypeTimeStamp, SortTypeReverseTimeStamp }
 Indicates the mode for sorting expressions. More...

Public Member Functions

iterator begin ()
 Returns an iterator addressing the first element.
void ChangeInterpartReferences (const NXString &oldPartName, const NXString &newPartName)
 Changes all of the references in the part "owning_part" from expressions in the part "old_part_name" to expressions in the part "new_part_name".
void ChangeInterpartReferences (const NXString &oldPartName, const NXString &newPartName, bool doUpdate, bool doChecking)
 Changes all of the references in the part "owning_part" from expressions in the part "old_part_name" to expressions in the part "new_part_name".
NXOpen::ExpressionCreate (const NXString &string)
 Creates an expression.
NXOpen::ExpressionCreateExpression (const NXString &expressionType, const NXString &string)
 Creates an expression of the specified type.
NXOpen::SuppressByExpressionBuilderCreateSuppressByExpressionBuilder ()
 Creates a SuppressByExpressionBuilder.
NXOpen::ExpressionCreateSystemExpression (const NXString &string)
 Creates a system expression.
NXOpen::ExpressionCreateSystemExpression (const NXString &expressionType, const NXString &string)
 Creates a system expression of the specified type.
NXOpen::ExpressionCreateSystemExpressionFromReferenceString (const NXString &reference)
 Creates a system string expression from a reference string in Drafting Note format.
NXOpen::ExpressionCreateSystemExpressionWithUnits (const NXString &string, NXOpen::Unit *unitType)
 Creates a system expression with units.
NXOpen::ExpressionCreateWithUnits (const NXString &string, NXOpen::Unit *unitType)
 Creates an expression with units.
void Delete (NXOpen::Expression *expression)
 Deletes an expression
Created in NX4.0.0.
void Edit (NXOpen::Expression *expression, const NXString &newRightHandSide)
 Edits an expression.
void EditWithUnits (NXOpen::Expression *expression, NXOpen::Unit *unitType, const NXString &newRightHandSide)
 Edits an expression with units.
iterator end ()
 Returns an iterator addressing one past the last element.
void ExportToFile (NXOpen::ExpressionCollection::ExportMode exportMode, const NXString &fileName, NXOpen::ExpressionCollection::SortType sortType)
 Exports the expressions to a text file, or, if 'file_name' is NULL, list the expressions in the listing window.
NXOpen::ExpressionFindObject (const NXString &journalIdentifier)
 Finds the Expression with the given identifier as recorded in a journal.
NXOpen::ExpressionGetAttributeExpression (NXOpen::NXObject *object, const NXString &title, NXOpen::NXObject::AttributeType type, int index)
 Get the attribute expression of the specified attribute title/type.
std::vector< NXStringGetInterpartReferences ()
 Returns a list of parts that are referenced from expressions in the part "owning_part".
std::vector< NXOpen::Expression * > GetVisibleExpressions ()
 Returns an array of visible expressions in the part.
void ImportFromFile (const NXString &fileName, NXOpen::ExpressionCollection::ImportMode importMode, bool *expModified, std::vector< NXString > &errorMessages)
 Imports expressions from a file.
bool RemoveInterpartReferences (const NXString &partName)
 Removes the interpart references from a part.
void Rename (NXOpen::Expression *expression, const NXString &newName)
 Changes the name of the expression.
void ReplaceAttributeExpression (NXOpen::Expression *expression, NXOpen::NXObject *object, const NXString &title, NXOpen::NXObject::AttributeType type, int index)
 Replace the attribute expression of the specified attribute title/type.
void SystemRename (NXOpen::Expression *expression, const NXString &newName)
 Changes the name of the expression without marking system expressions as user expressions.
tag_t Tag () const
 Returns the tag of this object.

Detailed Description

Represents a collection of expressions.


To obtain an instance of this class, refer to BasePart

Created in NX3.0.0.


Member Enumeration Documentation

Indicates the mode for exporting expressions.

Enumerator:
ExportModeWorkPart 

All expressions in the given part.

ExportModeAllInAssyTree 

All expressions in the given part, and in its components.

ExportModeAllParts 

All expressions in All parts in the session.

Indicates the mode for importing expressions.

Enumerator:
ImportModeReplace 

Overwrite existing expressions if the imported values differ.

ImportModeDontReplace 

Don't overwrite existing expressions.

New expressions are created

ImportModeDeleteImports 

Delete all expressions in the imported file.

Indicates the mode for sorting expressions.

Enumerator:
SortTypeAlphaNum 

Alphabetic order, with numbers in numerical order.

SortTypeTimeStamp 

Creation order - earliest first.

SortTypeReverseTimeStamp 

Creation order - latest first.


Member Function Documentation

Returns an iterator addressing the first element.

void NXOpen::ExpressionCollection::ChangeInterpartReferences ( const NXString oldPartName,
const NXString newPartName 
)

Changes all of the references in the part "owning_part" from expressions in the part "old_part_name" to expressions in the part "new_part_name".


Created in NX4.0.0.

License requirements : None

Parameters:
oldPartNamePart name whose references are being replaced
newPartNameNew part name to reference
void NXOpen::ExpressionCollection::ChangeInterpartReferences ( const NXString oldPartName,
const NXString newPartName,
bool  doUpdate,
bool  doChecking 
)

Changes all of the references in the part "owning_part" from expressions in the part "old_part_name" to expressions in the part "new_part_name".


Created in NX7.5.0.

License requirements : None

Parameters:
oldPartNamePart name whose references are being replaced
newPartNameNew part name to reference
doUpdateDo update if true
doCheckingDo checking if true

Creates an expression.

Returns:
the new expression
Created in NX3.0.0.

License requirements : None
Parameters:
stringthe equation for the expression. Must be in the format: name = right_hand_side. For example, "x = 1.2 * y + z".
NXOpen::Expression* NXOpen::ExpressionCollection::CreateExpression ( const NXString expressionType,
const NXString string 
)

Creates an expression of the specified type.

Returns:
the new expression
Created in NX5.0.0.

License requirements : None
Parameters:
expressionTypeThe type of the expression, such as "Number", "String", "Boolean", "Integer", "Point" and "Vector"
stringthe equation for the expression. Must be in the format: name = right_hand_side. For example, "x = 1.2 * y + z".

Creates a SuppressByExpressionBuilder.

Returns:
SuppressByExpressionBuilder object
Created in NX5.0.0.

License requirements : None

Creates a system expression.

After creating a system expression, you should associate it with an object, such as a sketch dimension. System expressions are deleted when the object they are associated with is deleted.

Returns:
the new expression
Created in NX3.0.0.

License requirements : None
Parameters:
stringthe equation or right-hand-side for the expression. You can specify a name for the equation by providing a string in the format: name = right_hand_side. For example, "x = 1.2 * y + z". If you do not provide a name, a name will be assigned automatically. For example, if the string is "1.2 * y + z", a name will be assigned automatically.

Creates a system expression of the specified type.

After creating a system expression, you should associate it with an object, such as a sketch dimension. System expressions are deleted when the object they are associated with is deleted.

Returns:
the new expression
Created in NX5.0.0.

License requirements : None
Parameters:
expressionTypeThe type of the expression, such as "Number", "String", "Boolean", "Integer", "Point" and "Vector"
stringthe equation or right-hand-side for the expression. You can specify a name for the equation by providing a string in the format: name = right_hand_side. For example, "x = 1.2 * y + z". If you do not provide a name, a name will be assigned automatically. For example, if the string is "1.2 * y + z", a name will be assigned automatically.

Creates a system string expression from a reference string in Drafting Note format.

Only expressions (X) and attributes (W) are supported.

Here is how the control character sequences need to be formatted: Expressions - Xm.n Part Attributes - W Object Attributes - W!obj_id

Returns:
the new expression
Created in NX7.5.0.

License requirements : None
Parameters:
referencethe reference string in Drafting Note format

Creates a system expression with units.

After creating a system expression, you should associate it with an object, such as a sketch dimension. System expressions are deleted when the object they are associated with is deleted.

Returns:
the new expression
Created in NX4.0.0.

License requirements : None
Parameters:
stringthe equation or right-hand-side for the expression. You can specify a name for the equation by providing a string in the format: name = right_hand_side. For example, "x = 1.2 * y + z". If you do not provide a name, a name will be assigned automatically. For example, if the string is "1.2 * y + z", a name will be assigned automatically.
unitTypeunits for the expression

Creates an expression with units.

Returns:
the new expression
Created in NX4.0.0.

License requirements : None
Parameters:
stringthe equation for the expression. Must be in the format: name = right_hand_side. For example, "x = 1.2 * y + z".
unitTypeunits for the expression

Deletes an expression
Created in NX4.0.0.



License requirements : None

Parameters:
expressionThe expression to be deleted
void NXOpen::ExpressionCollection::Edit ( NXOpen::Expression expression,
const NXString newRightHandSide 
)

Edits an expression.

Note, there is no difference between this method and editing the expression via Expression::SetRightHandSide if the ExpressionCollection is owned by the part that owns the expression.
Created in NX3.0.0.

License requirements : None

Parameters:
expressionThe expression to be edited, Note: if this expression is not owned by the part that owns the ExpressionCollection, a new expression will be created in the part that owns the ExpressionCollection
newRightHandSideWhat you want to change the expression to
void NXOpen::ExpressionCollection::EditWithUnits ( NXOpen::Expression expression,
NXOpen::Unit unitType,
const NXString newRightHandSide 
)

Edits an expression with units.

Changing the units on an existing expression is only allowed when the expression is not referenced yet.


Note, if you do not change the units, there is no difference between this method and editing the expression via Expression::SetRightHandSide if the ExpressionCollection is owned by the part that owns the expression.

Created in NX4.0.0.

License requirements : None

Parameters:
expressionThe expression to be edited, Note: if this expression is not owned by the part that owns the ExpressionCollection, a new expression will be created in the part that owns the ExpressionCollection
unitTypeunits for the expression
newRightHandSideWhat you want to change the expression to

Returns an iterator addressing one past the last element.

Exports the expressions to a text file, or, if 'file_name' is NULL, list the expressions in the listing window.

Throws an exception if there is any error.
NOTE: if the file already exists, an exception is thrown and the file is not overwritten.

Created in NX4.0.0.

License requirements : None

Parameters:
exportModeexport mode
fileNameFile name specification to export expressions into.
sortTypeHow to sort the exported expressions

Finds the Expression 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.

Returns:
Expression found
Created in NX3.0.0.

License requirements : None
Parameters:
journalIdentifierIdentifier to be found

Get the attribute expression of the specified attribute title/type.

Returns:
the attribute expression
Created in NX8.0.0.

License requirements : None
Parameters:
objectThe object of the attribute
titleThe title of the attribute
typeThe type of the attribute
indexThe array index if the attribute is an array (use -1 otherwise)

Returns a list of parts that are referenced from expressions in the part "owning_part".

Returns:
array of part names
Created in NX4.0.0.

License requirements : None

Returns an array of visible expressions in the part.

Returns:
array of expressions
Created in NX4.0.0.

License requirements : None
void NXOpen::ExpressionCollection::ImportFromFile ( const NXString fileName,
NXOpen::ExpressionCollection::ImportMode  importMode,
bool *  expModified,
std::vector< NXString > &  errorMessages 
)

Imports expressions from a file.

Input a file specification. When calling this method, changes are not applied to the system until Update::DoUpdate is called.
Created in NX4.0.0.

License requirements : None

Parameters:
fileNameFile name specification to import expressions from
importModeimport mode
expModifiedTRUE if any expressions were affected by the import
errorMessagestranslated list of error messages

Removes the interpart references from a part.

If a part name is given, then it removes the references to that part. If part_name is NULL, it removes all references to all parts.


References on the RHS are replaced by a numerical value, References on the LHS are deleted. E.g.


x = comp::len + z --> x = 3 + z


comp::height=5 --> (deleted)


The function returns TRUE is any references were removed, and FALSE otherwise.

Returns:
whether any changes were made
Created in NX4.0.0.

License requirements : None
Parameters:
partNamePart name to remove references for
void NXOpen::ExpressionCollection::Rename ( NXOpen::Expression expression,
const NXString newName 
)

Changes the name of the expression.


Created in NX4.0.0.

License requirements : None

Parameters:
expressionexpression to be renamed
newNamenew name of the expression

Replace the attribute expression of the specified attribute title/type.


Created in NX8.0.0.

License requirements : None

Parameters:
expressionthe attribute expression
objectThe object of the attribute
titleThe title of the attribute
typeThe type of the attribute
indexThe array index if the attribute is an array (use -1 otherwise)
void NXOpen::ExpressionCollection::SystemRename ( NXOpen::Expression expression,
const NXString newName 
)

Changes the name of the expression without marking system expressions as user expressions.


Created in NX6.0.0.

License requirements : None

Parameters:
expressionexpression to be renamed
newNamenew name of the expression

Returns the tag of this object.


The documentation for this class was generated from the following file:
Copyright 2011 Siemens Product Lifecycle Management Software Inc. All Rights Reserved.