Jupyter Notebook as a CNC machinist notebook


(William Adams) #1

I’ve been trying to find something well-suited as a CNC machining notebook — Jupyter Notebook seems a good choice, so here are some thoughts, notes, and sample code.

Google has a server up: https://colab.research.google.com/notebooks/welcome.ipynb

Here’s a bit of code which will allow one to calibrate the machine for belt stretch per: http://docs.carbide3d.com/shapeoko-faq/how-to-calibrate-the-machine-for-belt-stretch/

#@title Calibration for belt stretch

Units = 'Millimeters' #@param ["Inches", "Millimeters"]

X = 40.0 #@param {type:"number"}
Y = 40.0 #@param {type:"number"}
Z = 40.0 #@param {type:"number"}

X_steps_mm = 40.0 #@param {type:"number"}
Y_steps_mm = 40.0 #@param {type:"number"}
Z_steps_mm = 40.0 #@param {type:"number"}

Measured_X = 40.0 #@param {type:"number"}
Measured_Y = 40.0 #@param {type:"number"}
Measured_Z = 40.0 #@param {type:"number"}

Calibrated_X = X / Measured_X * X_steps_mm
Calibrated_Y = Y / Measured_Y * Y_steps_mm
Calibrated_Z = Z / Measured_Z * Z_steps_mm

print ('Calibrated steps for X is: ', Calibrated_X)
print ('Calibrated steps for Y is: ', Calibrated_Y)
print ('Calibrated steps for Z is: ', Calibrated_Z)