This feature allows you to reference configuration values from any config file in /opt/fabmo/config/ directly in your OpenSBP cut files using dot notation.
%<config_name>.<property>.<nested_property>
machine- Machine configuration (machine.json)driverorg2- G2 driver configuration (g2.json)opensbp- OpenSBP runtime configuration (opensbp.json)engine- Engine configuration (engine.json)instance- Instance configuration (instance.json)
' Get the maximum X table limit (returns 36 for default config)
$xmax = %machine.envelope.xmax
' Get other envelope values
$ymax = %machine.envelope.ymax
$zmin = %machine.envelope.zmin
' Get current units setting
$units = %machine.units
' Get move speeds
$xy_speed = %opensbp.movexy_speed
$z_speed = %opensbp.movez_speed
' Get jog speeds
$jog_speed = %opensbp.jogxy_speed
' Get G55 offsets
$x_offset = %driver.g55x
$y_offset = %driver.g55y
' Or use g2 alias
$x_offset = %g2.g55x
' Calculate center of table
$x_center = %machine.envelope.xmax / 2
$y_center = %machine.envelope.ymax / 2
' Move to center
MX, $x_center, $y_center
The traditional numeric system variable format %(n) continues to work:
' Traditional format still works
$movexy = %(71)
- runtime/opensbp/sbp_parser.pegjs - Grammar updated to support dot notation
- runtime/opensbp/sbp_parser.js - Parser regenerated from grammar
- runtime/opensbp/opensbp.js - Runtime evaluator updated to handle config paths
- Parser recognizes
%identifier.property.property...syntax - Creates a
configPatharray:["MACHINE", "ENVELOPE", "XMAX"] - Runtime evaluator:
- Maps first element to config object (e.g., "MACHINE" → config.machine)
- Navigates through
_cacheusing remaining path elements - Returns the value
- Unknown config object:
Error: Unknown config object: <name> - Invalid property path:
Error: Property <path> not found in config - Variable not defined: Proper error message with line number
Test files created in /fabmo/runtime/opensbp/:
test_config_vars.sbp- Sample OpenSBP codetest_config_parser.js- Parser teststest_runtime_config.js- Runtime evaluation tests
Run tests:
cd /fabmo/runtime/opensbp
node test_config_parser.js
node test_runtime_config.js- Config names are case-insensitive
- Property names are case-insensitive
- Nested properties are fully supported
- Values are retrieved from the in-memory cache for performance