# How can I change a sphere's radius with a Python script?

I have been trying to write a script that generates pictures of sphere packing's given positions and radii's that are publication quality. The most helpful post I found was here: https://gskielian.wordpress.com/2012/11/29/creating-a-red-sphere-in-blender-with-python/ .

From this post I have been able to generate multiple spheres in blender with different coordinates for their centers. What I haven't been able to do from this code is adjust their radii. I thought that setting the radii for a sphere would be found in this portion of the code:

red = makeMaterial(‘Red’,(1,0,0),(1,1,1),1)
origin = (0,0,0)
bpy.ops.transform.translate(value=(1,0,0))
setMaterial(bpy.context.object, red)


But I've tried to adjust almost everything in that line of code with no use. I'm hoping that someone can help me make adjustments to the linked code such that it generates a sphere of a specific radii, thanks!

There are many ways to do this, the least complicated approach is probably this:

import bpy

properties = [
[[-2, 0, 0], 0.2],
[[-1, 0, 0], 0.3],
[[+0, 0, 0], 0.4],
[[+1, 0, 0], 0.5],
[[+2, 0, 0], 0.6]
]