In the current version of simCNC, control over the soft limit setting is only possible via a checkbox (see default screen). In case you wish to control soft limits via a button (i.e. toggle the status) or control it from a Python script, here is the solution for you.

How to
Add button
First, add a button to your screen. I went for an LED button as it can also display the status without any additional work.

The following settings are important. Don’t forget to set the button interval to 0… mine was first set to 1, which themes to be miliseconds and caused the button to flicker.

Create the script
Nothing to be scared about, it will just take a few lines of code. Give your script an easy to identify name and save it in your profile/<yourprofile>/scripts or screen/<yourscreen>/scripts folder. Mine is called btn_globalsoftlimits.
# if softlimits are currently ON, switch them OFF. And vice versa...
if d.areAllSoftLimitsIgnored() == True:
d.ignoreAllSoftLimits(False)
else:
d.ignoreAllSoftLimits(True)
Hi Andre, das funktioniert schon mal prima! Wäre das auch möglich für das umschalten zwischen den Maschinenkoordinaten und G54?… also was sie andere Checkbox ist.
Hi Daniel,
freut mich dass du das Script bzw. die Anleitung nutzen konntest!
Über die Umschaltung Prog/Machine-Koordinaten habe ich noch gar nicht nachgedacht, da ich in meinem Screen beides immer nebeneinander anzeige. Ich mache recht viel über die absoluten Koordinaten.
Soweit ich weiß kannst du die Anzeige nicht direkt über Python einstellen, es gibt keine get() oder set() Funktionen dafür.
Du könntest mit d.executeGCode(„G53“) bzw. d.executeGCode(„G54“) das Koordinatensystem steuern, das hat dann allerdings nicht nur Auswirkungen auf die Anzeige sondern auch deine Befehle. Den aktuellen Status bekommst du mit getCurrentWorkOffset().
Hallo Andre, habe den Sotlimit Button eingefügt und es funktioniert prima.
Könnte man das auch mit der anderen Checkbox für das Umschalten zwischen G53 und G54 machen bzw. weißt was man da ins script schreiben muß?
Hi Daniel, für deine 2. Frage passt der Code von oben dann 🙂