I import and object C27389_Part into the scene. I search the part by using bpy.ops.object.select_pattern(pattern="*_Part"). That's all good, however it is selected (in red outline) and not active (orange), so I cannot do anything with it at this stage. Please help. I have searched and yet cannot solve this simple riddle. bpy.context.scene.objects.active will not do it.
Asked
Active
Viewed 250 times
0
1 Answers
-1
This works after selecting the pattern.
OB = bpy.context.selected_objects[0]
OB.select_set(state=True)
bpy.context.view_layer.objects.active = OB
Michael Teiniker
- 1,094
- 1
- 12
- 26
bpy.context.selected_objects[:]after the import, and get rid of the operator. To make it active, read my answer to one of your previous questions: https://blender.stackexchange.com/questions/132825/python-selecting-object-by-name-in-2-8/132829#132829 ... "# Make the cube the active object" – brockmann Aug 23 '20 at 08:36