Help with getselected for a New python user

I have been using blender for years, but just recently decided to try doing something with Python. I am in no way a programmer, but I like to learn new things.

Anyhow, I am trying to write a script that will change the selected items from the 3d window to a different object like a sphere. I have figured out how to add an object using the NMesh commands, but I can’t figure out how to address individual objects after I have selected them using the ‘getselected’ command. Can someone teach me how to address the selected objects so I can have a go at replacing them? Or could you point me to a resource that explains this function within blender.

thanks!

I believe it may be Get([name]) where [name] is the object you want to select. I haven’t had much luck answering these python questions the last few days though. I just got that off here:

Let me know how it goes

Blender.Object.GetSelected() will return a list of all the selected object.

Blender.Object.GetSelected()[0] will return the active object.

Martin