PlcMethodBuilder Class — NXOpen Python API Reference 12.0.0 documentation

# PlcMethodBuilder Class

class `NXOpen.AME.``PlcMethodBuilder`

  Bases: `NXOpen.Builder`

  The Journalling class for PlcMethodBuilder

  To create a new instance of this class, use `NXOpen.AME.AMEManager.CreatePlcMethodBuilder()`

  New in version NX11.0.0.

# Properties

Property | Description
--- | ---
InsertOnCreate | Returns or sets the automatic insertion setting
Method | Returns the method
MethodName | Returns or sets the code/data block name
Tag | Returns the Tag for this object.

# Methods

Method | Description
--- | ---
AddCompileUnitIndex | Add a index of network that will be in a method with this function is possible to add several network
AddStatementIndexes | Add a index of start statment in a network and index of end of statment
AssignCallParameterToParameter | Assign parameter to operand
AssignOperandToParameter | Assign parameter to operand
ClearCompileUnitIndexCountAndStatementIndexCount | Clear the number of statments and networks which are saved to creating a method
Commit | Commits any edits that have been applied to the builder.
CreateMethod | To Create Method
CreateParameter | Add a parameter
DeleteParameter | Delete Parameter
DeletePlcMethod | To Delete Method
DeletePosition | Delete a position
Destroy | Deletes the builder, and cleans up any objects created by the builder.
DoesMethodNameAlreadyExist | To find out that the given for method name already exist or not
GetALLParameters | Gets all existing parameter
GetCommittedObjects | For builders that create more than one object, this method returns the objects that are created by commit.
GetObject | Returns the object currently being edited by this builder.
GetSelectedCompileUnitIndexCount | Get selected compileUnitIndex size
SetNewParameterDataType | Set new data type to a parameter
SetNewParameterName | Set new name to a parameter
SetPlcCodeBlock | Set selected PlcCodeBlock
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.

# Property Detail

## InsertOnCreate

`PlcMethodBuilder.``InsertOnCreate`

  Returns or sets the automatic insertion setting

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

  Getter Method

  Signature `InsertOnCreate`

  Returns: |
  Return type: | bool

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

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

  Setter Method

  Signature `InsertOnCreate`

  Parameters: | insertOnCreate (bool) –

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

## Method

`PlcMethodBuilder.``Method`

  Returns the method

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

  Getter Method

  Signature `Method`

  Returns: |
  Return type: | `NXOpen.AME.PlcMethod`

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

## MethodName

`PlcMethodBuilder.``MethodName`

  Returns or sets the code/data block name

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

  Getter Method

  Signature `MethodName`

  Returns: |
  Return type: | str

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

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

  Setter Method

  Signature `MethodName`

  Parameters: | name (str) –

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

# Method Detail

## AddCompileUnitIndex

`PlcMethodBuilder.``AddCompileUnitIndex`

  Add a index of network that will be in a method with this function is possible to add several network

  Signature `AddCompileUnitIndex(idx)`

  Parameters: | idx (int) –

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

## AddStatementIndexes

`PlcMethodBuilder.``AddStatementIndexes`

  Add a index of start statment in a network and index of end of statment

  Signature `AddStatementIndexes(compileUnitIndex, startStatementIndex, endStatementIndex)`

  Parameters:

  - compileUnitIndex (int) –
  - startStatementIndex (int) –
  - endStatementIndex (int) –

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

## AssignCallParameterToParameter

`PlcMethodBuilder.``AssignCallParameterToParameter`

  Assign parameter to operand

  Signature `AssignCallParameterToParameter(compileUnitIndex, statementIndex, callParameterIndex, obj)`

  Parameters:

  - compileUnitIndex (int) –
  - statementIndex (int) –
  - callParameterIndex (int) –
  - obj (`NXOpen.NXObject`) –

  Returns: |
  Return type: | int

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

## AssignOperandToParameter

`PlcMethodBuilder.``AssignOperandToParameter`

  Assign parameter to operand

  Signature `AssignOperandToParameter(compileUnitIndex, statementIndex, operandIndex, obj)`

  Parameters:

  - compileUnitIndex (int) –
  - statementIndex (int) –
  - operandIndex (int) –
  - obj (`NXOpen.NXObject`) –

  Returns: |
  Return type: | int

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

## ClearCompileUnitIndexCountAndStatementIndexCount

`PlcMethodBuilder.``ClearCompileUnitIndexCountAndStatementIndexCount`

  Clear the number of statments and networks which are saved to creating a method

  Signature `ClearCompileUnitIndexCountAndStatementIndexCount()`

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

## CreateMethod

`PlcMethodBuilder.``CreateMethod`

  To Create Method

  Signature `CreateMethod()`

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

## CreateParameter

`PlcMethodBuilder.``CreateParameter`

  Add a parameter

  Signature `CreateParameter()`

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

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

## DeleteParameter

`PlcMethodBuilder.``DeleteParameter`

  Delete Parameter

  Signature `DeleteParameter(obj)`

  Parameters: | obj (`NXOpen.NXObject`) –

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

## DeletePlcMethod

`PlcMethodBuilder.``DeletePlcMethod`

  To Delete Method

  Signature `DeletePlcMethod()`

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

## DeletePosition

`PlcMethodBuilder.``DeletePosition`

  Delete a position

  Signature `DeletePosition(position)`

  Parameters: | position (`NXOpen.NXObject`) –

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

## DoesMethodNameAlreadyExist

`PlcMethodBuilder.``DoesMethodNameAlreadyExist`

  To find out that the given for method name already exist or not

  Signature `DoesMethodNameAlreadyExist(methodName)`

  Parameters: | methodName (str) –
  Returns: |
  Return type: | int

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

## GetALLParameters

`PlcMethodBuilder.``GetALLParameters`

  Gets all existing parameter

  Signature `GetALLParameters()`

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

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

## GetSelectedCompileUnitIndexCount

`PlcMethodBuilder.``GetSelectedCompileUnitIndexCount`

  Get selected compileUnitIndex size

  Signature `GetSelectedCompileUnitIndexCount()`

  Returns: |
  Return type: | int

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

## SetNewParameterDataType

`PlcMethodBuilder.``SetNewParameterDataType`

  Set new data type to a parameter

  Signature `SetNewParameterDataType(obj, newDataType)`

  Parameters:

  - obj (`NXOpen.NXObject`) –
  - newDataType (str) –

  Returns: |
  Return type: | int

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

## SetNewParameterName

`PlcMethodBuilder.``SetNewParameterName`

  Set new name to a parameter

  Signature `SetNewParameterName(obj, newName)`

  Parameters:

  - obj (`NXOpen.NXObject`) –
  - newName (str) –

  Returns: |
  Return type: | int

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

## SetPlcCodeBlock

`PlcMethodBuilder.``SetPlcCodeBlock`

  Set selected PlcCodeBlock

  Signature `SetPlcCodeBlock(plcBlock)`

  Parameters: | plcBlock (`NXOpen.AME.PlcBlock`) –

  New in version NX11.0.0.

  License requirements: ad_automation_design (“FULL AUTOMATION DESIGNER”)

## Validate

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