There are multiple options to store settings required to run your machine.
- Individually in each script
- Machine Parameters
- In a settings file
Option 1: Individually in each script
Not the best option but get’s you working fast. Add your settings (i.e. pins of your CSMIO controller) directly in the code, individual for every of your scripts.
Disadvantage: You are creating redundancies and the settings are harder to maintain.
feedrate = 500
coordinates[X] = 123.456
d.moveToPosition(CoordMode.Machine, coordinates, feedrate)
Option 2: Machine Parameters
Can be found under Diagnostics/Parameters and looks something like this.
Paramters 1-4000 are permanently stored, other parameters are volatile (i.e. only exist until next time you close the software.
Here you can put configurations which are changing during the software is running (i.e. offsets,
You can read and write parameters from your Python scripts using the following commands:
d.setMachineParam( int paramNumber, float value )
d.getMachineParam( int paramNumber )
Option 3: In a settings file
Good option for constant settings / things which do not change during runtime. i.e. the position of your tool pockets, input/output pins used in scripts, etc.
Create a .py file in your Profile/<yourmachine> folder and reference to this information from all of your scripts. My file is calles ___CONF.py and you can find it in my git repository.
Some example blocks:
#-----------------------------------------------------------
# Ports & Pins
#-----------------------------------------------------------
out_opencollet = 10 # open spindle tool clamping
out_cleancone = 12 # activate cone cleaning / purging
out_curtain = 14 # move dust hood / curtain up
out_vac = None # enable vacuum
....
# positions
pos_atc_z_toolget = -115.450 # Z position of tools if not defined different
pos_atc_z_purge = -80 # Position at which purging is activated
pos_atc_pockets = {1: ['X': 100, 'Y': 100, 'Z': -100], 2: ['X': 100, 'Y': 100, 'Z': -100]}
In order to include this configuration file in any other script (button scripts, M-scripts, etc.), just place the following code on top of your scripts. The asterisc at the end makes sure your script will throw an error should the file not be available.
from ___CONF import *
I recommend using a fixed nomenclature, which makes it easy to identify the actual purpose. My setup looks like this:
- out_
for digital output pins - in_
for digital input pins - pos
Positions like the tool pocket X/Y/Z coordinates - feed_
For feed rates, i.e. feed_atc_xy defines the X/Y axis feed rate during tool change operations - conf_
For general configuration, i.e. conf_probe_tool_active = True enables the tool length sensor