MotionSimulation Class — NXOpen Python API Reference 12.0.0 documentation

# MotionSimulation Class

class `NXOpen.Motion.``MotionSimulation`

  Bases: `object`

  Represents Motion.

  Simulation To obtain an instance of this class, refer to `NXOpen.Session`

  New in version NX5.0.0.

# Methods

Method | Description
--- | ---
AddMaster | Creates a new `NXOpen.Assemblies.Component` in this motion simulation assembly as master part
AddSuppressedObjectForAllSolutions | Deactivates a motion object for all solutions
CalculateGrueblerCount | Calculate the gruebler count of given motion part
CreateAddSubmechanismBuilder | Returns `NXOpen.Motion.AddSubmechanismBuilder` object
ExportRecurdynSdk | Export Recurdyn sdk data, need an active solution in simulation
GetMasterCadPart | Gets the loaded master part in this motion simulation assembly.
LoadSimulation | Load the simulation
ReadDeactivatedStates | Copies the deactivated states of motion objects occurrences belonging to a given submechanism from a given solution to the motion assembly.
RemoveMaster | Removes existing master part in this motion simulation assembly
RemoveSuppressedObjectForAllSolutions | Activates a motion object for all solutions
RenameSimulation | Rename the simulation
RenameSubmechanism | Sets the custom name of the Submechanism object.
SaveSimulation | Save the simulation through input part name
UnloadSimulation | Unload the simulation through input part name

# Method Detail

## AddMaster

`MotionSimulation.``AddMaster`

  Creates a new `NXOpen.Assemblies.Component` in this motion simulation assembly as master part

  Signature `AddMaster(motionPart, masterPart)`

  Parameters:

  - motionPart (`NXOpen.Part`) – the motion part to add master part into it
  - masterPart (`NXOpen.NXObject`) – the master part to be added, it can be a part occurrence tag or part tag

  New in version NX12.0.0.

  License requirements: mechanisms (“MECHANISMS”)

## AddSuppressedObjectForAllSolutions

`MotionSimulation.``AddSuppressedObjectForAllSolutions`

  Deactivates a motion object for all solutions

  Signature `AddSuppressedObjectForAllSolutions(motionPart, obj)`

  Parameters:

  - motionPart (`NXOpen.Part`) –
  - obj (`NXOpen.NXObject`) –

  New in version NX12.0.0.

  License requirements: mechanisms (“MECHANISMS”)

## CalculateGrueblerCount

`MotionSimulation.``CalculateGrueblerCount`

  Calculate the gruebler count of given motion part

  Signature `CalculateGrueblerCount(motionPart)`

  Parameters: | motionPart (`NXOpen.NXObject`) – motion part object
  Returns: | gruebler count
  Return type: | int

  New in version NX7.5.0.

  License requirements: None.

## CreateAddSubmechanismBuilder

`MotionSimulation.``CreateAddSubmechanismBuilder`

  Returns `NXOpen.Motion.AddSubmechanismBuilder` object

  Signature `CreateAddSubmechanismBuilder(part)`

  Parameters: | part (`NXOpen.NXObject`) – the part object
  Returns: | `NXOpen.Motion.AddSubmechanismBuilder` object
  Return type: | `NXOpen.Motion.AddSubmechanismBuilder`

  New in version NX12.0.0.

  License requirements: mechanisms (“MECHANISMS”)

## ExportRecurdynSdk

`MotionSimulation.``ExportRecurdynSdk`

  Export Recurdyn sdk data, need an active solution in simulation

  Signature `ExportRecurdynSdk(fullFileName)`

  Parameters: | fullFileName (str) – full name with directory and extension

  New in version NX7.0.0.

  License requirements: mechanisms (“MECHANISMS”)

## GetMasterCadPart

`MotionSimulation.``GetMasterCadPart`

  Gets the loaded master part in this motion simulation assembly.

  Signature `GetMasterCadPart(motionPart)`

  Parameters: | motionPart (`NXOpen.Part`) – the motion part to remove master part from it
  Returns: | the loaded master part
  Return type: | `NXOpen.Part`

  New in version NX12.0.0.

  License requirements: mechanisms (“MECHANISMS”)

## LoadSimulation

`MotionSimulation.``LoadSimulation`

  Load the simulation

  Signature `LoadSimulation(masterPart, motionSimName)`

  Parameters:

  - masterPart (`NXOpen.NXObject`) – the master part object
  - motionSimName (str) – the motion simulation name to load

  New in version NX5.0.0.

  Deprecated since version NX12.0.0: Use `NXOpen.PartCollection.OpenDisplay()` and `NXOpen.Motion.MotionSession.InitializeSimulation()`

  License requirements: mechanisms (“MECHANISMS”)

## ReadDeactivatedStates

`MotionSimulation.``ReadDeactivatedStates`

  Copies the deactivated states of motion objects occurrences belonging to a given submechanism from a given solution to the motion assembly.

  The motion objects deactivated from the given solution will become “Deactivated for All” in the motion assembly. If submechanism tag is NULL then will copy the deactivated states from the selected solution to the active one.

  Signature `ReadDeactivatedStates(sumbmechanism, solution)`

  Parameters:

  - sumbmechanism (`NXOpen.NXObject`) – submechanism child of current root part
  - solution (`NXOpen.Motion.MotionSolution`) – the solution, from the submechanism part, from which the deactivated states are read

  New in version NX12.0.0.

  License requirements: mechanisms (“MECHANISMS”)

## RemoveMaster

`MotionSimulation.``RemoveMaster`

  Removes existing master part in this motion simulation assembly

  Signature `RemoveMaster(motionPart, deleteMotionObjects)`

  Parameters:

  - motionPart (`NXOpen.Part`) – the motion part to remove master part from it
  - deleteMotionObjects (bool) – the tag whether to keep or delete motion objects referencing master part

  New in version NX12.0.0.

  License requirements: mechanisms (“MECHANISMS”)

## RemoveSuppressedObjectForAllSolutions

`MotionSimulation.``RemoveSuppressedObjectForAllSolutions`

  Activates a motion object for all solutions

  Signature `RemoveSuppressedObjectForAllSolutions(motionPart, obj)`

  Parameters:

  - motionPart (`NXOpen.Part`) –
  - obj (`NXOpen.NXObject`) –

  New in version NX12.0.0.

  License requirements: mechanisms (“MECHANISMS”)

## RenameSimulation

`MotionSimulation.``RenameSimulation`

  Rename the simulation

  Signature `RenameSimulation(masterPart, oldMotionSimName, newMotionSimName)`

  Parameters:

  - masterPart (`NXOpen.NXObject`) – the master part object
  - oldMotionSimName (str) – the motion simulation part name which ready to be renamed
  - newMotionSimName (str) – the new motion simulation part name

  New in version NX5.0.0.

  Deprecated since version NX12.0.0: Use `NXOpen.BasePart.SaveAs()`

  License requirements: mechanisms (“MECHANISMS”)

## RenameSubmechanism

`MotionSimulation.``RenameSubmechanism`

  Sets the custom name of the Submechanism object.

  Signature `RenameSubmechanism(submechanism, name)`

  Parameters:

  - submechanism (`NXOpen.NXObject`) –
  - name (str) –

  New in version NX12.0.0.

  License requirements: mechanisms (“MECHANISMS”)

## SaveSimulation

`MotionSimulation.``SaveSimulation`

  Overloaded method SaveSimulation

  - `SaveSimulation(masterPart, motionSimName)`
  - `SaveSimulation(masterPart, motionSimPart)`

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

  Save the simulation through input part name

  Signature `SaveSimulation(masterPart, motionSimName)`

  Parameters:

  - masterPart (`NXOpen.NXObject`) – the master part object
  - motionSimName (str) – the motion simulation part name which ready to be saved

  New in version NX5.0.0.

  Deprecated since version NX12.0.0: Use `NXOpen.BasePart.Save()`

  License requirements: mechanisms (“MECHANISMS”)

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

  Save the simulation through input part object

  Signature `SaveSimulation(masterPart, motionSimPart)`

  Parameters:

  - masterPart (`NXOpen.NXObject`) – the master part object
  - motionSimPart (`NXOpen.NXObject`) – the motion simulation part which ready to be saved

  New in version NX7.5.0.

  Deprecated since version NX12.0.0: Use `NXOpen.BasePart.Save()`

  License requirements: mechanisms (“MECHANISMS”)

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

## UnloadSimulation

`MotionSimulation.``UnloadSimulation`

  Overloaded method UnloadSimulation

  - `UnloadSimulation(masterPart, motionSimName)`
  - `UnloadSimulation(masterPart, motionSimPart)`

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

  Unload the simulation through input part name

  Signature `UnloadSimulation(masterPart, motionSimName)`

  Parameters:

  - masterPart (`NXOpen.NXObject`) – the master part object
  - motionSimName (str) – the motion simulation name to unload

  New in version NX5.0.0.

  Deprecated since version NX12.0.0: Use `NXOpen.BasePart.Close()`

  License requirements: mechanisms (“MECHANISMS”)

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

  Unload the simulation through input part object

  Signature `UnloadSimulation(masterPart, motionSimPart)`

  Parameters:

  - masterPart (`NXOpen.NXObject`) – the master part object
  - motionSimPart (`NXOpen.NXObject`) – the motion simulation to unload

  New in version NX7.5.0.

  Deprecated since version NX12.0.0: Use `NXOpen.BasePart.Close()`

  License requirements: mechanisms (“MECHANISMS”)

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