add object problem

Can anyone help me out with this problem?

When you click on the blue plane it inserts an object. Then the idea is you left click on the object then right click where you want it to go (which object you want to snap to).

However as the addObject does not change the name of each object it does not work correctly.

you will see if you add more than one object it only snaps the first instance.

Is there a way i can have it use the object id instead of the name? or possibly change a property for each object.

Note that there will be many plane buttons inserting different objects into the scene.

Attachments

mouse click rev 5.blend (260 KB)

id(object), though you can have objects directly reference eachother now.
ob1[‘other’] = ob2
or…
if ‘other’ not in ob1: ob1[‘other’] = []
ob1[‘other’].append(ob2)

Not to sure what you mean.

What i really need is instead of using addObject, i need to add a copy of an object rather than an instance.