5
$\begingroup$

I'm trying to change the selection mode from SET to ADD (or any other mode using python). In the ui this is easy to do by clicking on these toolbar icons:

icons

I've tried this but it's not working.

bpy.ops.view3d.select_box(xmin=0, xmax=0, ymin=0, ymax=0, wait_for_input=True, mode='ADD')

Does anyone know how to do the equivalent of clicking on the add button enter image description here in the toolbar using python?

Thanks

$\endgroup$

1 Answer 1

4
$\begingroup$

Change tool property values ​​for operators

# This script does not check anything
# You may need to check:
#     Current workspace has a 3D viewport
#     Whether the header is hidden

import bpy

ws = bpy.context.workspace
tool = ws.tools["builtin.select_box"]

p = tool.operator_properties("view3d.select_box")
p.mode =  "ADD"

# Refresh UI
for a in bpy.context.screen.areas:
    a.tag_redraw()
$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.