Hi again. I got there in the end. The transformations to get the components facing the centre of the sphere were quite complex, with exceptions for z< 0, altitude (elevation) > pi/2 etc etc. The final code and test render are below. The input variables were:

n_divs = 10 (circles per hemisphere)

sub_divs = 7 (number of insertion points on each circle)

alt = the altitude (elevation) of the vector at the centre of the circles

azi = the azimuth of the same vector

rad = sphere radius

new_rad = circle radius

new_alt = the altitude (elevation) of the top/bottom of the circle, where the component is first placed

The final rotation, placing the components around each circle was simple, orienting them towards the centre was not and took 4 separate rotations!

Thanks to all who contributed for the invaluable help.

Jack.

#
calculate component rotation values

```
angle_1 = (pi/2 + azi*pi/180)
angle_2 = pi/2
angle_3 = (pi/2 - alt*pi/180)
if z < 0
angle_1 = angle_1 * -1
angle_3 = angle_3 * -1
end
if face_origin == 0
angle_2 = 0
angle_3 = 0
end
if z_scale == 0
z_scale = new_scale
z_scale = z_scale + scale_inc
end
# insert, scale and rotate components
if sub_divs > 0 # points code block and loop
circ_rad = rad * new_scale
circ_angle = 2 * pi / sub_divs
# calculate x1, y1 & z1 (top/bottom point of circle)
if z >= 0
new_alt = pi*alt/180 + Math::atan(circ_rad/new_rad)
else
new_alt = pi*alt/180 - Math::atan(circ_rad/new_rad)
end
if (-pi/2..pi/2) === new_alt
angle_3a = pi/2 - new_alt
else
angle_3a = new_alt - pi/2
end
x1 = rad * Math::sin(pi/2 - new_alt) * Math::cos(azi * pi/180)
y1 = rad * Math::sin(pi/2 - new_alt) * Math::sin(azi * pi/180)
z1 = rad * Math::cos(pi/2 - new_alt)
if z1 < 0
angle_3a = angle_3a * -1
end
nnn = 1
loop do # points loop
if z > 0
angle_5 = (nnn + 0.5) * circ_angle
else
angle_5 = ((nnn + 0.5) * circ_angle) + pi
end
ent = Sketchup.active_model.entities
t0 = Geom::Transformation.scaling new_scale, 0.5, 1
t1 = Geom::Transformation.translation [x1, y1, z1]
t2 = Geom::Transformation.rotation [x1, y1, z1], [0, 0, z1], angle_1
t3 = Geom::Transformation.rotation [x1, y1, z1], [0, 0, z1], angle_2
t4 = Geom::Transformation.rotation [x1, y1, z1], [x1, y1+0.00000001, 0], angle_3a
t5 = Geom::Transformation.rotation [x1, y1, z1], [0, 0, z1], angle_2
t6 = Geom::Transformation.rotation [0, 0, 0], [x, y, z], angle_5
inst = ent.add_instance comp_def_4, t6 * t5 * t4 * t3 * t2 * t1 * t0
nnn = nnn + 1
if nnn > sub_divs
break
end
end # close points loop
end # close points code block and loop
```