Front panel button control – Start 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.StartTrajectory()

Complete

In this more complete example we will first check if the machine is in idle state (i.e. not in emergency stop), before we start GCode execution.

if ( d.getState( ) == State.Idle ) ):
    d.StartTrajectory()

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 4

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


Marek

Marek

Hallo André

habe eben deinen Start und Pause Knopf, im simcnc integriert. Muss da irgendwas in die klammern eingefügt werden?
Mein PC spuckt einen error aus.
Invalidität Syntax
Wie kann ich dies beheben?

Gruß Marek

Marek

Marek

Hallo Andrè

So wie es aussieht funktioniert es mit S.StartTrajectory()
Sobald ich die erste Zeile einfüge kommt der Syntax fehler. Muss ich dort etwas ändern?

Gruß Marek

Christoph

Christoph

Hallo, erstmal finde ich es super dass du dein Wissen und deine Erfahrungen hier teilst.

ich habe gerade mit SIM-CNC begonnen und versuche mich gerade an dem Start-Button.
Ich habe nun folgendes Problem. Wenn ich es wie von dir beschrieben mache leuchtet die LED von meinem Eingang nicht. Die LED leuchtet wenn ich das Signal schon vor dem auswählen anlege. Dann leuchtet die LED, aber es passiert nichts wenn ich den Taster drücker oder wieder loslasse. Gibt es dafür eine einfache erklärung??
Schon mal vielen Dank im Voraus

andre

andre

Hallo Christoph,
freut mich zu lesen, dass dir die Sammlung gefällt!

Müsste ich mir noch einmal anschauen das Verhalten, eventuell hat sich zwischenzeitig etwas in simCNC verändert… Denke die Tage werde ich dazu kommen und Poste noch einmal ein Update.

Viele Grüße,
André