View Single Post
  #4   Report Post  
Posted to rec.crafts.metalworking
Ignoramus4120 Ignoramus4120 is offline
external usenet poster
 
Posts: 7
Default Made a Turner's cube

On 2011-03-19, JB wrote:

"Ignoramus4120" wrote in message
...
It is 2" in size.

https://picasaweb.google.com/lh/phot...eat=directlink


That is really, really cool. I also like the 'demo samples' the rapid
prototyping guys have on their stands at exhibitions. Spheres within cubes
within ellipsoids etc....


I saw some cool examples too.

The code to do it, is actually a recursive G code function (which is
understandable, since the shapes are recursively nested).


(Makes a turner's cube. See projects.txt for formulas).

Oturners_cube sub
#xc = #1 (X Center)
#yc = #2 (Y Center)
#z = #3 (Current Z)
#size = #4 (Side)
#milld = #5 (Mill Diameter)
#k1 = #6
#k2 = #7

#R = [#k1 * #size/2]

Oif if [ #R gt #milld]
G0 X#xc Y#yc
Owithdraw call [#z + 0.01]
#d = [ [#x/2 - #R] + #k2*#R*[1 - 1/sqrt[ 2 ]]]

Odeepcylindricalpocket call [#xc] [#yc] [#z + 0.01] [#z - #d] [#R] [#milld]

#X1 = [#size - 2*#d]

Oturners_cube call [#xc] [#yc] [#z - #d] [#X1] [#milld] [#k1] [#k2]
Oif endif

G0 X#xc Y#yc
Owithdraw call [#z + 0.01]
Oturners_cube endsub

M2