NXOpen .NET Reference  12.0.0
Public Types | Public Member Functions | Protected Member Functions | Properties | List of all members
NXOpen.ExpressionCollection Class Reference

Represents a collection of expressions. More...

Inheritance diagram for NXOpen.ExpressionCollection:

Public Types

enum  ImportMode { Replace, DontReplace, DeleteImports }
 Indicates the mode for importing expressions. More...
 
enum  ExportMode { WorkPart, AllInAssyTree, AllParts }
 Indicates the mode for exporting expressions. More...
 
enum  SortType { AlphaNum, TimeStamp, ReverseTimeStamp }
 Indicates the mode for sorting expressions. More...
 

Public Member Functions

NXOpen.Expression[] ToArray ()
 Returns an array of NXOpen.Expression objects. More...
 
unsafe NXOpen.Expression Create (string @string)
 Creates an expression More...
 
unsafe NXOpen.Expression CreateWithUnits (string @string, NXOpen.Unit unitType)
 Creates an expression with units. More...
 
unsafe NXOpen.Expression CreateSystemExpression (string @string)
 Creates a system expression. More...
 
unsafe NXOpen.Expression CreateSystemExpressionWithUnits (string @string, NXOpen.Unit unitType)
 Creates a system expression with units. More...
 
unsafe NXOpen.Expression CreateExpression (string expressionType, string @string)
 Creates an expression of the specified type. More...
 
unsafe NXOpen.Expression CreateSystemExpression (string expressionType, string @string)
 Creates a system expression of the specified type. More...
 
unsafe void Edit (NXOpen.Expression expression, string newRightHandSide)
 Edits an expression. More...
 
unsafe void EditWithUnits (NXOpen.Expression expression, NXOpen.Unit unitType, string newRightHandSide)
 Edits an expression with units. More...
 
unsafe void Delete (NXOpen.Expression expression)
 Deletes an expression More...
 
unsafe NXOpen.Expression FindObject (string journalIdentifier)
 Finds the NXOpen.Expression with the given identifier as recorded in a journal. More...
 
unsafe void ImportFromFile (string fileName, NXOpen.ExpressionCollection.ImportMode importMode, out bool expModified, out string[] errorMessages)
 Imports expressions from a file. More...
 
unsafe void ExportToFile (NXOpen.ExpressionCollection.ExportMode exportMode, string fileName, NXOpen.ExpressionCollection.SortType sortType)
 Exports the expressions to a text file, or, if 'file_name' is a null reference (Nothing in Visual Basic), list the expressions in the listing window. More...
 
unsafe string[] GetInterpartReferences ()
 Returns a list of parts that are referenced from expressions in the part "owning_part". More...
 
unsafe void GetInterpartReferencesWithDisplayNames (out string[] referencedPartNames, out string[] referencedDispNames)
 Returns a list of parts that are referenced from expressions in the part "owning_part". More...
 
unsafe void GetInterpartReferencesFor4gd (out string[] referencedPartNames, out string[] referencedDispNames, out NXOpen.NXObject[] referencedParts)
 Interface for 4gd More...
 
unsafe bool RemoveInterpartReferences (string partName)
 Removes the interpart references from a part. More...
 
unsafe void ChangeInterpartReferences (string oldPartName, string 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". More...
 
unsafe void ChangeInterpartReferences (string oldPartName, string 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". More...
 
unsafe void ChangeInterpartReferencesFor4gd (NXOpen.Assemblies.Component targetPartOccTag, string oldSourcePartName, NXOpen.Assemblies.Component newSourcePartOccTag, bool doUpdate, bool doChecking)
 Interface for 4gd More...
 
unsafe NXOpen.Expression[] GetVisibleExpressions ()
 Returns an array of visible "Number" expressions in the part. More...
 
unsafe void Rename (NXOpen.Expression expression, string newName)
 Changes the name of the expression. More...
 
unsafe void SystemRename (NXOpen.Expression expression, string newName)
 Changes the name of the expression without marking system expressions as user expressions. More...
 
unsafe void Replace (string currentName, string replaceName)
 Replaces references to an expression with another expression. More...
 
unsafe
NXOpen.SuppressByExpressionBuilder 
CreateSuppressByExpressionBuilder ()
 Creates a NXOpen.SuppressByExpressionBuilder More...
 
unsafe NXOpen.Expression CreateSystemExpressionFromReferenceString (string reference)
 Creates a system string expression from a reference string in Drafting Note format. More...
 
unsafe NXOpen.Expression GetAttributeExpression (NXOpen.NXObject @object, string title, NXOpen.NXObject.AttributeType type, int index)
 Get the attribute expression of the specified attribute title/type. More...
 
unsafe void ReplaceAttributeExpression (NXOpen.Expression expression, NXOpen.NXObject @object, string title, NXOpen.NXObject.AttributeType type, int index)
 Replace the attribute expression of the specified attribute title/type. More...
 
unsafe
NXOpen.InterpartExpressionsBuilder 
CreateInterpartExpressionsBuilder ()
 Creates interpart expressions. More...
 
unsafe
NXOpen.ReplaceExpressionsBuilder 
CreateReplaceExpressionsBuilder ()
 Replace expressions. More...
 
unsafe string AskInterpartRhsName (NXOpen.Expression sourceExpression)
 Creates the right hand side name for an interpart expression reference. More...
 
unsafe string AskInterpartLhsName (NXOpen.Expression sourceExpression)
 Creates the left hand side name for an overriding interpart expression reference. More...
 
unsafe void ReplaceRhsInterpartExpression (NXOpen.Expression oldRhsIpe, NXOpen.Expression newRhsIpe)
 Replaces the old right hand side interpart expression references with those of the new right hand side interpart expression. More...
 

Protected Member Functions

override int EnumerateMoveNext (ref Tag currentTag, byte[] state)
 Advances the enumerator to the next element of the collection. More...
 

Properties

Tag Tag [get]
 Returns the tag of this object. More...
 

Detailed Description

Represents a collection of expressions.

To obtain an instance of this class, refer to NXOpen.BasePart

Created in NX3.0.0

Member Enumeration Documentation

Indicates the mode for exporting expressions.

Enumerator
WorkPart 

All expressions in the given part

AllInAssyTree 

All expressions in the given part, and in its components

AllParts 

All expressions in All parts in the session

Indicates the mode for importing expressions.

Enumerator
Replace 

Overwrite existing expressions if the imported values differ

DontReplace 

Don't overwrite existing expressions.

New expressions are created

DeleteImports 

Delete all expressions in the imported file

Indicates the mode for sorting expressions.

Enumerator
AlphaNum 

Alphabetic order, with numbers in numerical order

TimeStamp 

Creation order - earliest first

ReverseTimeStamp 

Creation order - latest first

Member Function Documentation

unsafe string NXOpen.ExpressionCollection.AskInterpartLhsName ( NXOpen.Expression  sourceExpression)

Creates the left hand side name for an overriding interpart expression reference.

For example, if the destination part is A and the source expression is X from part B then NX will create/return the expression for the A::x overrdding interpart expression reference.

Created in NX10.0.0

License requirements: None.

Parameters
sourceExpressionexpression in source part
Returns
left hand side name
unsafe string NXOpen.ExpressionCollection.AskInterpartRhsName ( NXOpen.Expression  sourceExpression)

Creates the right hand side name for an interpart expression reference.

For example, if the destination part is A and the source expression is X from part B then NX will create/return the expression for the A::x interpart expression reference.

Created in NX10.0.0

License requirements: None.

Parameters
sourceExpressionexpression in source part
Returns
right hand side name
unsafe void NXOpen.ExpressionCollection.ChangeInterpartReferences ( string  oldPartName,
string  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
unsafe void NXOpen.ExpressionCollection.ChangeInterpartReferences ( string  oldPartName,
string  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
unsafe void NXOpen.ExpressionCollection.ChangeInterpartReferencesFor4gd ( NXOpen.Assemblies.Component  targetPartOccTag,
string  oldSourcePartName,
NXOpen.Assemblies.Component  newSourcePartOccTag,
bool  doUpdate,
bool  doChecking 
)

Interface for 4gd

Created in NX11.0.0

License requirements: None.

Parameters
targetPartOccTagPart occ of target part
oldSourcePartNamePart name whose references are being replaced
newSourcePartOccTagPart occ of new source part
doUpdateDo update if true
doCheckingDo checking if true
unsafe NXOpen.Expression NXOpen.ExpressionCollection.Create ( string @  string)

Creates an 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".
Returns
the new expression
unsafe NXOpen.Expression NXOpen.ExpressionCollection.CreateExpression ( string  expressionType,
string @  string 
)

Creates an expression of the specified type.

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".
Returns
the new expression
unsafe NXOpen.InterpartExpressionsBuilder NXOpen.ExpressionCollection.CreateInterpartExpressionsBuilder ( )

Creates interpart expressions.

Created in NX8.5.0

License requirements: None.

Returns
unsafe NXOpen.ReplaceExpressionsBuilder NXOpen.ExpressionCollection.CreateReplaceExpressionsBuilder ( )

Replace expressions.

Created in NX10.0.0

License requirements: None.

Returns
unsafe NXOpen.SuppressByExpressionBuilder NXOpen.ExpressionCollection.CreateSuppressByExpressionBuilder ( )

Creates a NXOpen.SuppressByExpressionBuilder

Created in NX5.0.0

License requirements: None.

Returns
SuppressByExpressionBuilder object
unsafe NXOpen.Expression NXOpen.ExpressionCollection.CreateSystemExpression ( string @  string)

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.

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.
Returns
the new expression
unsafe NXOpen.Expression NXOpen.ExpressionCollection.CreateSystemExpression ( string  expressionType,
string @  string 
)

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.

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.
Returns
the new expression
unsafe NXOpen.Expression NXOpen.ExpressionCollection.CreateSystemExpressionFromReferenceString ( string  reference)

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

Created in NX7.5.0

License requirements: None.

Parameters
referencethe reference string in Drafting Note format
Returns
the new expression
unsafe NXOpen.Expression NXOpen.ExpressionCollection.CreateSystemExpressionWithUnits ( string @  string,
NXOpen.Unit  unitType 
)

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.

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
Returns
the new expression
unsafe NXOpen.Expression NXOpen.ExpressionCollection.CreateWithUnits ( string @  string,
NXOpen.Unit  unitType 
)

Creates an expression with units.

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
Returns
the new expression
unsafe void NXOpen.ExpressionCollection.Delete ( NXOpen.Expression  expression)

Deletes an expression

Created in NX4.0.0

License requirements: None.

Parameters
expressionThe expression to be deleted
unsafe void NXOpen.ExpressionCollection.Edit ( NXOpen.Expression  expression,
string  newRightHandSide 
)

Edits an expression.

Note, there is no difference between this method and editing the expression via NXOpen.Expression.RightHandSide 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
unsafe void NXOpen.ExpressionCollection.EditWithUnits ( NXOpen.Expression  expression,
NXOpen.Unit  unitType,
string  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 NXOpen.Expression.RightHandSide 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
override int NXOpen.ExpressionCollection.EnumerateMoveNext ( ref Tag  currentTag,
byte[]  state 
)
protected

Advances the enumerator to the next element of the collection.

unsafe void NXOpen.ExpressionCollection.ExportToFile ( NXOpen.ExpressionCollection.ExportMode  exportMode,
string  fileName,
NXOpen.ExpressionCollection.SortType  sortType 
)

Exports the expressions to a text file, or, if 'file_name' is a null reference (Nothing in Visual Basic), 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
unsafe NXOpen.Expression NXOpen.ExpressionCollection.FindObject ( string  journalIdentifier)

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

Created in NX3.0.0

License requirements: None.

Parameters
journalIdentifierIdentifier to be found
Returns
Expression found
unsafe NXOpen.Expression NXOpen.ExpressionCollection.GetAttributeExpression ( NXOpen.NXObject object,
string  title,
NXOpen.NXObject.AttributeType  type,
int  index 
)

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

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
the attribute expression
unsafe string [] NXOpen.ExpressionCollection.GetInterpartReferences ( )

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

Created in NX4.0.0

License requirements: None.

Returns
array of part names
unsafe void NXOpen.ExpressionCollection.GetInterpartReferencesFor4gd ( out string[]  referencedPartNames,
out string[]  referencedDispNames,
out NXOpen.NXObject[]  referencedParts 
)

Interface for 4gd

Created in NX11.0.0

License requirements: None.

Parameters
referencedPartNamesarray of internal part names
referencedDispNamesarray of display part names
referencedPartsarray of occ parts and part occs
unsafe void NXOpen.ExpressionCollection.GetInterpartReferencesWithDisplayNames ( out string[]  referencedPartNames,
out string[]  referencedDispNames 
)

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

Created in NX10.0.0

License requirements: None.

Parameters
referencedPartNamesarray of internal part names
referencedDispNamesarray of display part names
unsafe NXOpen.Expression [] NXOpen.ExpressionCollection.GetVisibleExpressions ( )

Returns an array of visible "Number" expressions in the part.

Created in NX4.0.0

License requirements: None.

Returns
array of "Number" expressions
unsafe void NXOpen.ExpressionCollection.ImportFromFile ( string  fileName,
NXOpen.ExpressionCollection.ImportMode  importMode,
out bool  expModified,
out string[]  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
unsafe bool NXOpen.ExpressionCollection.RemoveInterpartReferences ( string  partName)

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 a null reference (Nothing in Visual Basic), 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.

Created in NX4.0.0

License requirements: None.

Parameters
partNamePart name to remove references for
Returns
whether any changes were made
unsafe void NXOpen.ExpressionCollection.Rename ( NXOpen.Expression  expression,
string  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
unsafe void NXOpen.ExpressionCollection.Replace ( string  currentName,
string  replaceName 
)

Replaces references to an expression with another expression.

Created in NX10.0.0

License requirements: None.

Parameters
currentNamecurrent expression name
replaceNamereplace expression name
unsafe void NXOpen.ExpressionCollection.ReplaceAttributeExpression ( NXOpen.Expression  expression,
NXOpen.NXObject object,
string  title,
NXOpen.NXObject.AttributeType  type,
int  index 
)

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)
unsafe void NXOpen.ExpressionCollection.ReplaceRhsInterpartExpression ( NXOpen.Expression  oldRhsIpe,
NXOpen.Expression  newRhsIpe 
)

Replaces the old right hand side interpart expression references with those of the new right hand side interpart expression.

For example, replacing x="A"x with y="B"y with result in right hand interpart expression x="B"y and expression y=x.

Created in NX11.0.0

License requirements: None.

Parameters
oldRhsIperight hand side interpart expression to be replaced
newRhsIperight hand side interpart expression to be replaced with
unsafe void NXOpen.ExpressionCollection.SystemRename ( NXOpen.Expression  expression,
string  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
NXOpen.Expression [] NXOpen.ExpressionCollection.ToArray ( )

Returns an array of NXOpen.Expression objects.

Property Documentation

Tag NXOpen.ExpressionCollection.Tag
get

Returns the tag of this object.


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