Change 3D cursor tool property (python)

I’d like to enable Surface Project and set the orientation mode of the 3D Cursor from python, as if I did it from the header’s tool settings.
Note that I only want to change its settings, not move the cursor in the process.

For example I’m pretty sure that

bpy.ops.view3d.cursor3d(use_depth=True, orientation='GEOM')

requires to move the cursor.

So I looked inside



by tabbing like crazy in the tree but didn’t find those settings.

Is it actually possible to change them from python?

It might be a good idea to use

for attr in dir(object):

a few times, for example, replace object with, then with whichever tool catches your interest. This will list all the attributes that belong to that object. This is how I find stuff if it isn’t in the Python API reference, or if it isn’t easy to find and I assume it isn’t in there.


Thanks for the tip.
I still didn’t find those cursor tool properties using that method though.

Ok so I found them but I also found something fishy :
On the factory Startup file, the keys for those properties don’t exist until you either click on their related buttons or assign them a value like 0 or 1 from python.

So if you load the factory settings and just run:[''].operator_properties('view3d.cursor3d')['use_depth']

it will throw you a KeyError. But if you then click twice on the “Surface Project” checkbox, the same command will now work!

Is this a bug or is it intended?

More detail in my StackExchange post if needed.

1 Like

That is certainly very weird! Python commands should make it possible to do anything in the UI … without the UI. Otherwise, there’s no point. You should definitely make a bug report.

well, you can still change them from python even on the startup file, you just can’t ask what their value is until you’ve assigned one, either from python or from the interface. So I’m not sure it’s really an issue.