Front panel button control – Pause button

Function
Execute actions in simCNC from a hardware button, wired into the CSMIO controller.

Setup

  1. Open the settings and navigate to PyActions
  2. Click „add“ to add a new action
  3. Give it a meaningful name
  4. Set event to „IO Change“
  5. Select a port from your CSMIO, MPG module or extension module. If the button is wired correctly, the LED will light up if you press the selected button.
  1. Press the document icon next to „script name“
  2. A popup will open. Add the code from the below section
  3. Press „save as“

Code

Simple

This is the most simple setup possible for the task.

d.SetTrajectoryPause(True)

Complete

In this more complete example we will first check if the machine is in trajectory state (i.e. moving / executing GCode) before we issue the pause state.

if ( d.getState( ) == State.Trajectory ) or ( d.getState( ) == State.MDI ): 
    d.SetTrajectoryPause(True)

Some notes

  • When testing your button, make sure that the machine is in idle state (i.e. connected). Otherwise the controller will not execute any action.

Schreibe einen Kommentar 0

Your email address will not be published. Required fields are marked *