Units for opensbp format?

Hello,

I’m trying to create my first part, to be CNC routed from 4.7mm plywood on a ShopBot PRSAlpha machine. I’ve set the processor output to ‘opensbp’ for the ShopBot. Here’s the first lines:

'Exported by FreeCAD
'Post Processor: opensbp_post
'Output Time:2024-01-23 12:54:37.706292
' (1_4in_Endmill002)
&ToolName=2
&Tool=2
JS,,100.000000
JZ,4.9000
JS,50.000000,
J2,214.1813,317.1808
JS,,50.000000
JZ,2.9000
MZ,0.0000
CG,,118.4545,288.9902,-40.1813,-40.1813,T,-1

The line ‘JZ, 4.9000’ moves the Z axis to a point 4.9 inches above the origin. In my Job->Profile, the Clearance height is 4.9mm, which is where I’m guessing this number is coming from.

According to the ShopBot Command reference manual, for the ‘VD’ (Values for Display settings):

Linear Units (default = inches)
Sets the X, Y and Z axes to run in inches (0) or millimeters (1). One inch = 25.4mm. The default is in inches,
so the values given in the Unit Values for Different Gear Ratios assume that you are working in inches.

If I understand this correctly, without a VD command proceeding the JZ command, the ‘4.9000’ will be interpreted as inches and not millimeters. Is my understanding correct? How can I set FreeCAD to output an Open ShopBot processed file using the correct units?

Thanks so much for all your help. I’ve attached my file, if anyone’s curious.

-Kevin

OS: Ubuntu 22.04.3 LTS (ubuntu:GNOME/ubuntu-xorg)
Word size of FreeCAD: 64-bit
Version: 0.21.1.33694 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0.21.1)
Hash: f6708547a9bb3f71a4aaade12109f511a72c207c
Python 3.10.12, Qt 5.15.8, Coin 4.0.0, Vtk 9.2.5, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * A2plus 0.4.62
  * FeedsAndSpeeds 0.5.0
  * Assembly3 0.12.1 (Disabled)
  * Help 1.0.3
  * Assembly4 0.50.6
  * woodworking 0.21.1.33694

Just noticed this error, when I tried to generate the opensbp gcode file, with the ‘–inches’ argument:

15:31:30  Running the Python command 'Path_Post' failed:
Traceback (most recent call last):
  File "/tmp/.mount_freecacGePXP/usr/Mod/Path/Path/Post/Command.py", line 590, in Activated
    finalgcode += gcode

can only concatenate str (not "NoneType") to str

When I do this, with the ‘–inches’, I get these first lines:

'Exported by FreeCAD
'Post Processor: opensbp_post
'Output Time:2024-01-23 15:31:15.781036
' (1_4in_Endmill002)
&ToolName=2
&Tool=2
JS,,3.937008
JZ,0.1929
JS,1.968504,
J2,8.4323,12.4874
JS,,1.968504
JZ,0.1142
MZ,0.0000

This looks as if it’s using inches (4.9mm is about 0.1929 inches). I would have thought it would insert a VD command to ensure inches or mm, but I guess that you just have to know that ShopBots work in inches, and include the ‘–inches’ argument.

I’m really surprised at this. Are ShopBots not commonly used with FreeCAD? Am I the first person to stumble over this?

Thanks, again, for any advice or guidance. I’m looking at the post-processor Python script, at https://github.com/FreeCAD/FreeCAD/blob/main/src/Mod/Path/Path/Post/scripts/opensbp_post.py an may suggest to @sliptonic a pull request to add the VD command.

-Kevin