PartOperationBuilder Class — NXOpen Python API Reference 12.0.0 documentation

# PartOperationBuilder Class

class `NXOpen.PDM.``PartOperationBuilder`

  Bases: `NXOpen.Builder`, `NXOpen.IAttributeSourceObjectBuilder`

  Represents a builder class that performs various design element operations.

  The operation can be one of `NXOpen.PDM.PartOperationBuilderOperationType` To create a new instance of this class, use `NXOpen.PDM.PdmSession.CreateOperationBuilder()`

  New in version NX9.0.0.

# Properties

Property | Description
--- | ---
DefaultDestinationFolder | Returns or sets the default destination folder string for the part being created .
DependentFileSaveAsOption | Returns or sets the Dependent files Save As option.
ReplaceAllComponents | Returns or sets the replace all components.
Tag | Returns the Tag for this object.

# Methods

Method | Description
--- | ---
AddRelatedPartToOperate | Add related part to the part undergoing an operation.
AutoAssignAttributes | Auto assigns the attributes for a given array of objects and returns an array of objects that failed to auto assign.
AutoAssignAttributesWithNamingPattern | Auto assigns the attributes for a given object and returns an array of objects that failed to auto assign.
ClearWarnings | Executes method ClearWarningCodeToLogicalObjectsSetMap() which clears m_warningCodeToLogicalObjectsSetMap
Commit | Commits any edits that have been applied to the builder.
CreateAttributeTitleToNamingPatternMap | Creates a map object of attribute titles to their corresponding naming pattern
CreateLogicalObjects | Creates the pre-creation objects for the parts
CreateNonMasterListForLogicalObject | Create NonMaster list for the selected logical Object
CreateSpecificationsForLogicalObjects | Create new specifications for Logical Objects
Destroy | Deletes the builder, and cleans up any objects created by the builder.
EditNonMasterName | Sets the name the non-master part will get saved as.
GetAlternateIDManager | Create an instance of a `NXOpen.PDM.AlternateIdManager` class that will be used to create alternate ID information while creating the new part.
GetCommittedObjects | For builders that create more than one object, this method returns the objects that are created by commit.
GetDialogOperation | Returns the dialog operation Applicable only for operation types `PartOperationBuilderOperationType.SaveAs` and `PartOperationBuilderOperationType.Revise`
GetErrorMessageHandler | Returns ErrorMessageHandler
GetNonMasterCopyOption | Get the nonmasters saveAs option for given logical object.
GetNonMasterList | Gets NonMaster list for the given logical Object
GetObject | Returns the object currently being edited by this builder.
GetOperationFailures | Returns part operation failures
IsNonMasterBeingCopied | Returns whether or not the non master part specified for the given :py:class:`NXOpen.PDM.LogicalObject`will actually get saved during the save as operation.
SetDialogOperation | Sets the dialog operation.
SetNonMasterSaveAsOption | Set the nonmasters saveAs option for given logical object
SetSelectedNonMasterToSaveAs | Sets whether or not the non-master part specified will actually get saved during the save as operation.
SetSelectedParts | Sets the selected parts.
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.
ValidateLogicalObjectsToCommit | Validates `NXOpen.PDM.LogicalObject` objects with this builder and udpates the operation failuers.

# Enumerations

PartOperationBuilderDependentFileSaveAs Enumeration | This enum is used to specify which dependent files should be saved during the save as operation.
PartOperationBuilderNonMasterSaveAs Enumeration | This enum is used to specify which non-master parts should be saved during the save as operation.
PartOperationBuilderOperationType Enumeration | Represents an operation type that can be performed on a part

# Property Detail

## DefaultDestinationFolder

`PartOperationBuilder.``DefaultDestinationFolder`

  Returns or sets the default destination folder string for the part being created .

  It will be ignored in case of revise and creation of non-masters. The default destination folder string can be &lt;username&gt;:&lt;folder&gt;:&lt;folder&gt;, or :&lt;folder&gt;:&lt;folder&gt; means username is optional. In case of :&lt;folder&gt;:&lt;folder&gt;, the first : indicates Home, for example, :Newstuff, is the Newstuff folder in current user’s Home container.

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

  Getter Method

  Signature `DefaultDestinationFolder`

  Returns: |
  Return type: | str

  New in version NX10.0.0.

  License requirements: None.

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

  Setter Method

  Signature `DefaultDestinationFolder`

  Parameters: | defaultDestinationFolder (str) –

  New in version NX10.0.0.

  License requirements: None.

## DependentFileSaveAsOption

`PartOperationBuilder.``DependentFileSaveAsOption`

  Returns or sets the Dependent files Save As option.

  Save As option can be one of these `PartOperationBuilderDependentFileSaveAs.All` and `PartOperationBuilderDependentFileSaveAs.None`

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

  Getter Method

  Signature `DependentFileSaveAsOption`

  Returns: |
  Return type: | `NXOpen.PDM.PartOperationBuilderDependentFileSaveAs`

  New in version NX9.0.0.

  Deprecated since version NX10.0.0: Use `NXOpen.PDM.PartOperationCopyBuilder.DependentFilesToCopyOption()` instead

  License requirements: None.

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

  Setter Method

  Signature `DependentFileSaveAsOption`

  Parameters: | saveOption (`NXOpen.PDM.PartOperationBuilderDependentFileSaveAs`) –

  New in version NX9.0.0.

  Deprecated since version NX10.0.0: Use `NXOpen.PDM.PartOperationCopyBuilder.SetDependentFilesToCopyOption()` instead

  License requirements: None.

## ReplaceAllComponents

`PartOperationBuilder.``ReplaceAllComponents`

  Returns or sets the replace all components.

  This option specifies whether part will be replaced or copied. Applicable only for operation types `PartOperationBuilderOperationType.SaveAs` and `PartOperationBuilderOperationType.Revise`

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

  Getter Method

  Signature `ReplaceAllComponents`

  Returns: |
  Return type: | bool

  New in version NX9.0.0.

  Deprecated since version NX10.0.0: Use `NXOpen.PDM.PartOperationCopyBuilder.ReplaceAllComponentsInSession()` instead

  License requirements: None.

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

  Setter Method

  Signature `ReplaceAllComponents`

  Parameters: | replaceAllComponents (bool) –

  New in version NX9.0.0.

  Deprecated since version NX10.0.0: Use `NXOpen.PDM.PartOperationCopyBuilder.SetReplaceAllComponentsInSession()` instead

  License requirements: None.

# Method Detail

## AddRelatedPartToOperate

`PartOperationBuilder.``AddRelatedPartToOperate`

  Add related part to the part undergoing an operation.

  Example: if user selects a part for Save As which has Linked Part Modules that should also undergo Save As, they should be added as related parts. Applicable only for operation types `PartOperationBuilderOperationType.SaveAs` and `PartOperationBuilderOperationType.Revise`

  Signature `AddRelatedPartToOperate(basePart, relatedParts, relatedPartsReasons, operation)`

  Parameters:

  - basePart (`NXOpen.BasePart`) –
  - relatedParts (list of `NXOpen.BasePart`) –
  - relatedPartsReasons (list of str) –
  - operation (`NXOpen.PDM.PartOperationBuilderOperationType`) –

  New in version NX9.0.0.

  Deprecated since version NX10.0.0: Use `NXOpen.PDM.PartOperationCopyBuilder.AddRelatedPartsToCopy()` instead

  License requirements: None.

## AutoAssignAttributes

`PartOperationBuilder.``AutoAssignAttributes`

  Auto assigns the attributes for a given array of objects and returns an array of objects that failed to auto assign.

  Signature `AutoAssignAttributes(objects)`

  Parameters: | objects (list of `NXOpen.NXObject`) –
  Returns: |
  Return type: | `NXOpen.ErrorList`

  New in version NX8.5.0.

  License requirements: None.

## AutoAssignAttributesWithNamingPattern

`PartOperationBuilder.``AutoAssignAttributesWithNamingPattern`

  Auto assigns the attributes for a given object and returns an array of objects that failed to auto assign.

  properties needs to be created using `CreateAttributeTitleToNamingPatternMap()`

  Signature `AutoAssignAttributesWithNamingPattern(objects, properties)`

  Parameters:

  - objects (list of `NXOpen.NXObject`) –
  - properties (list of `NXOpen.NXObject`) –

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

  New in version NX12.0.0.

  License requirements: None.

## ClearWarnings

`PartOperationBuilder.``ClearWarnings`

  Executes method ClearWarningCodeToLogicalObjectsSetMap() which clears m_warningCodeToLogicalObjectsSetMap

  Signature `ClearWarnings()`

  New in version NX10.0.0.

  License requirements: None.

## CreateAttributeTitleToNamingPatternMap

`PartOperationBuilder.``CreateAttributeTitleToNamingPatternMap`

  Creates a map object of attribute titles to their corresponding naming pattern

  Signature `CreateAttributeTitleToNamingPatternMap(attributeTitles, titlePatterns)`

  Parameters:

  - attributeTitles (list of str) –
  - titlePatterns (list of str) –

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

  New in version NX12.0.0.

  License requirements: None.

## CreateLogicalObjects

`PartOperationBuilder.``CreateLogicalObjects`

  Creates the pre-creation objects for the parts

  Signature `CreateLogicalObjects()`

  Returns: |
  Return type: | list of `NXOpen.PDM.LogicalObject`

  New in version NX9.0.0.

  License requirements: None.

## CreateNonMasterListForLogicalObject

`PartOperationBuilder.``CreateNonMasterListForLogicalObject`

  Create NonMaster list for the selected logical Object

  Signature `CreateNonMasterListForLogicalObject(logicalObject)`

  Parameters: | logicalObject (`NXOpen.PDM.LogicalObject`) –

  New in version NX9.0.0.

  Deprecated since version NX10.0.0: Use `NXOpen.PDM.PartOperationCopyBuilder.CreateNonMasterListForCopyLogicalObject()` instead

  License requirements: None.

## CreateSpecificationsForLogicalObjects

`PartOperationBuilder.``CreateSpecificationsForLogicalObjects`

  Create new specifications for Logical Objects

  Signature `CreateSpecificationsForLogicalObjects(logicalObjects)`

  Parameters: | logicalObjects (list of `NXOpen.PDM.LogicalObject`) –

  New in version NX9.0.0.

  License requirements: None.

## EditNonMasterName

`PartOperationBuilder.``EditNonMasterName`

  Sets the name the non-master part will get saved as.

  It will get saved as the original non-master name if this method is not called.

  Signature `EditNonMasterName(logicalObject, oldName, newName)`

  Parameters:

  - logicalObject (`NXOpen.PDM.LogicalObject`) –
  - oldName (str) – the non-master part whose save as name is being set here
  - newName (str) – the new name

  Returns: | flag to indicate whether the newName is valid
  Return type: | bool

  New in version NX9.0.0.

  Deprecated since version NX10.0.0: Use `NXOpen.PDM.PartOperationCopyBuilder.EditNonMasterToCopyName()` instead

  License requirements: None.

## GetAlternateIDManager

`PartOperationBuilder.``GetAlternateIDManager`

  Create an instance of a `NXOpen.PDM.AlternateIdManager` class that will be used to create alternate ID information while creating the new part.

  CreateSpec call should happen before calling this method.

  Signature `GetAlternateIDManager(logicalObject)`

  Parameters: | logicalObject (`NXOpen.PDM.LogicalObject`) –
  Returns: | the new `NXOpen.PDM.AlternateIdManager` instance
  Return type: | `NXOpen.PDM.AlternateIdManager`

  New in version NX9.0.0.

  License requirements: None.

## GetDialogOperation

`PartOperationBuilder.``GetDialogOperation`

  Returns the dialog operation Applicable only for operation types `PartOperationBuilderOperationType.SaveAs` and `PartOperationBuilderOperationType.Revise`

  Signature `GetDialogOperation()`

  Returns: |
  Return type: | `NXOpen.PDM.PartOperationBuilderOperationType`

  New in version NX9.0.0.

  License requirements: None.

## GetErrorMessageHandler

`PartOperationBuilder.``GetErrorMessageHandler`

  Returns ErrorMessageHandler

  Signature `GetErrorMessageHandler(refresh)`

  Parameters: | refresh (bool) –
  Returns: |
  Return type: | `NXOpen.PDM.ErrorMessageHandler`

  New in version NX12.0.0.

  License requirements: None.

## GetNonMasterCopyOption

`PartOperationBuilder.``GetNonMasterCopyOption`

  Get the nonmasters saveAs option for given logical object.

  Save As option can be one of these `PartOperationBuilderNonMasterSaveAs.All` and `PartOperationBuilderNonMasterSaveAs.None`

  Signature `GetNonMasterCopyOption(logicalObject)`

  Parameters: | logicalObject (`NXOpen.PDM.LogicalObject`) –
  Returns: |
  Return type: | `NXOpen.PDM.PartOperationBuilderNonMasterSaveAs`

  New in version NX9.0.0.

  Deprecated since version NX10.0.0: Use `NXOpen.PDM.PartOperationCopyBuilder.GetCopyNonMasterPartsOption()` instead

  License requirements: None.

## GetNonMasterList

`PartOperationBuilder.``GetNonMasterList`

  Gets NonMaster list for the given logical Object

  Signature `GetNonMasterList(logicalObject)`

  Parameters: | logicalObject (`NXOpen.PDM.LogicalObject`) –
  Returns: | Non-master part file names
  Return type: | list of str

  New in version NX9.0.0.

  Deprecated since version NX10.0.0: Use `NXOpen.PDM.PartOperationCopyBuilder.GetNonMasterListForCopyLogicalObject()` instead

  License requirements: None.

## GetOperationFailures

`PartOperationBuilder.``GetOperationFailures`

  Returns part operation failures

  Signature `GetOperationFailures()`

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

  New in version NX9.0.0.

  Deprecated since version NX12.0.0: Use `NXOpen.PDM.PartOperationBuilder.GetErrorMessageHandler()` instead

  License requirements: None.

## IsNonMasterBeingCopied

`PartOperationBuilder.``IsNonMasterBeingCopied`

  Returns whether or not the non master part specified for the given :py:class:`NXOpen.PDM.LogicalObject`will actually get saved during the save as operation.

  Signature `IsNonMasterBeingCopied(logicalObject, partName)`

  Parameters:

  - logicalObject (`NXOpen.PDM.LogicalObject`) –
  - partName (str) – the non-master part that the caller wants to save or not save

  Returns: | True means that this non-master will be saved. False means that this non master will not be saved.
  Return type: | bool

  New in version NX9.0.0.

  Deprecated since version NX10.0.0: Use `NXOpen.PDM.PartOperationCopyBuilder.IsNonMasterForLogicalObjectBeingCopied()` instead

  License requirements: None.

## SetDialogOperation

`PartOperationBuilder.``SetDialogOperation`

  Sets the dialog operation.

  Applicable only for operation types `PartOperationBuilderOperationType.SaveAs` and `PartOperationBuilderOperationType.Revise`

  Signature `SetDialogOperation(dialogOperation)`

  Parameters: | dialogOperation (`NXOpen.PDM.PartOperationBuilderOperationType`) –

  New in version NX9.0.0.

  License requirements: None.

## SetNonMasterSaveAsOption

`PartOperationBuilder.``SetNonMasterSaveAsOption`

  Set the nonmasters saveAs option for given logical object

  Signature `SetNonMasterSaveAsOption(logicalObject, saveOption)`

  Parameters:

  - logicalObject (`NXOpen.PDM.LogicalObject`) –
  - saveOption (`NXOpen.PDM.PartOperationBuilderNonMasterSaveAs`) –

  New in version NX9.0.0.

  Deprecated since version NX10.0.0: Use `NXOpen.PDM.PartOperationCopyBuilder.SetCopyNonMasterPartsOption()` instead

  License requirements: None.

## SetSelectedNonMasterToSaveAs

`PartOperationBuilder.``SetSelectedNonMasterToSaveAs`

  Sets whether or not the non-master part specified will actually get saved during the save as operation.

  True means that it will be saved. False means that it will not be saved.

  Signature `SetSelectedNonMasterToSaveAs(logicalObject, partName)`

  Parameters:

  - logicalObject (`NXOpen.PDM.LogicalObject`) –
  - partName (str) – the non-master part whose save option is being set here

  New in version NX9.0.0.

  Deprecated since version NX10.0.0: Use `NXOpen.PDM.PartOperationCopyBuilder.SetSelectedNonMasterToCopy()` instead

  License requirements: None.

## SetSelectedParts

`PartOperationBuilder.``SetSelectedParts`

  Sets the selected parts.

  Applicable only for operation types `PartOperationBuilderOperationType.SaveAs` and `PartOperationBuilderOperationType.Revise` Also returns an array of parts failed to added, these are not removed from the input array though. `NXOpen.PDM.PartOperationBuilder.GetOperationFailures()` can be called to get the errors occurred during this operation.

  Signature `SetSelectedParts(selectedParts)`

  Parameters: | selectedParts (list of `NXOpen.BasePart`) –
  Returns: |
  Return type: | list of `NXOpen.BasePart`

  New in version NX9.0.0.

  Deprecated since version NX10.0.0: Use `NXOpen.PDM.PartOperationCopyBuilder.SetSelectedPartsToCopy()` instead

  License requirements: None.

## Validate

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

## ValidateLogicalObjectsToCommit

`PartOperationBuilder.``ValidateLogicalObjectsToCommit`

  Validates `NXOpen.PDM.LogicalObject` objects with this builder and udpates the operation failuers.

  `NXOpen.PDM.PartOperationBuilder.GetOperationFailures()` can be called to get the errors occurred during this operation.

  Signature `ValidateLogicalObjectsToCommit()`

  New in version NX9.0.0.

  License requirements: None.