Rounded Square

(name,Rounded Square)
 
(dlgname,Rounded Square)
(dlg,Size, dec=2, def=30, min=0, max=1000, store, param=size)
(dlg,Radius, dec=2, def=5, min=0, max=250, store, param=rad)
(dlg,Speed, dec=1, def=1000, min=1, max=50000, store, param=speed)
(dlg,Loop, dec=0, def=1, min=1, max=100, store, param=loop)
(dlgshow)
 
;Uniform circular motion
 
;The acceleration due to change in the direction is:
;a = v^2 / r
 
;Radius that machine can make without lowering speed is:
;r = v^2 / a
 
;Note that both speed and acceleration must use same units.
;Normally speeds are set in units/minute and need to be converted to units/second.
 
(clear)
#<s> = [#<speed> / 60]
#<a> = [#<s>*#<s> / #<rad>]
(print,The acceleration due to change in the direction at)
(print,  speed #<speed,1>#<_unitsname>/min and radius #<rad,2>#<_unitsname> is #<a,3>#<_unitsname>/s^2)
 
#<r> = [#<s>*#<s> / #<_motion_maxacc>]
(print,Radius that machine can make without lowering speed at)
(print,  speed #<speed,1>#<_unitsname>/min and acceleration #<_motion_maxacc,3>#<_unitsname>/s^2 is #<r,3>#<_unitsname>)
 
#<v> = [SQRT[#<_motion_maxacc> * #<rad>] * 60]
(print,Speed that machine can run radius #<rad,3>#<_unitsname> without lowering speed at)
(print,  acceleration #<_motion_maxacc,3>#<_unitsname>/s^2 is #<v,3>#<_unitsname>/min)
 
 
F#<speed>
G00 X[#<rad>] Y0
 
o<loop> repeat[#<loop>]
  G01 X[#<size>] Y0
  G03 X[#<size>+#<rad>] Y[#<rad>] J[#<rad>]
  G01 Y[#<size>]
  G03 X[#<size>] Y[#<size>+#<rad>] I-[#<rad>]
  G01 X[#<rad>]
  G03 X0 Y[#<size>] J-[#<rad>]
  G01 Y[#<rad>]
  G03 X[#<rad>] Y0 I[#<rad>]
o<loop> endrepeat
 
M02