0
$\begingroup$

I'm making a script to automate some steps I do quite often. In the script I need to change the active selection from one object to another to work on that object and then return the active selection to the first one, e.g. I have a cube and a circle, both separated objects, I do some things with the cube and then I have to select the circle to do some other operations, then when I'm done with that, I want to select the cube to keep working with it, thanks in advance.

$\endgroup$
2
  • $\begingroup$ see if this helps blender.stackexchange.com/questions/44382/… $\endgroup$
    – m.ardito
    Commented Aug 19, 2017 at 6:55
  • $\begingroup$ That helps to select it, but I want to change the "active" property, so when you go bpy.context.active_object the object is now the second one. In other words I need to convert a secondary selection into the active and the active into the secondary, thanks for the reply nonetheless. $\endgroup$
    – DeNapes
    Commented Aug 19, 2017 at 18:42

1 Answer 1

1
$\begingroup$

I found the answer here.

The way you make an object active is through the overwrite of:

bpy.context.scene.objects.active 

so if you have a Cube named 'Cube', and you want to make it active, you will do:

cube = bpy.data.objects['Cube']
bpy.context.scene.objects.active = cube
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .