there are three different cases in my last post.
a) bottom hemisphere
b) top hemisphere
c) general case (both hemispheres - one full sphere), hence 2*1000 steps
and you are right, there was a typo in code, circle on each layer would have radius r2, not z2
this is how it looks like from KUKA perspective. i added on the right just the circle with three three points and coordinate system for reference.
1. first point (P0) is at radius r2 in the X direction (90deg)
2. second point (P1) is at radius r2 in the Y direction (180deg)
3. third point (P2) is at radius r2 in the negative X direction (270deg)
of course one can choose any other three unique points
tis was just meant as an idea. for example it does not handle cases where circle radius is too small.
here is corrected code
DECL REAL r1,r2,z0,z1,z2,dZ
DECL INT n,steps
DECL FRAME p0,p1,p2
r1=150; mm (sphere radius)
steps = 1000; number of increments 0..r1
dZ = r1/steps
z0 = 225; mm (elevation where center of sphere is)
; set tool, base, speeds, etc.
FOR n=0 to 2*steps
; do the math
z=z0-r1+n*dZ ; working elevation for each circle
z2=r1-n*dZ ; vertical distance between z0 and working elevation
r2=SQRT(r1*r1-z2*z2)
; then do the circles, layer by layer
; a) initialize points for circle
p0=$NULLFRAME
p0.z=z ; and set elevation
p1=p0 ; copy to other points
p2=p0
; b) move to first point of circle (one layer)
p0.x=r2
LIN p0
; c) do a circle
p1.y=r2
p2.x=-r2
CIRC p1, p2, CA 360
END FOR
Display More