Page MenuHome

Python script- snap cursor to selected
Closed, ResolvedPublic

Description

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce GTX 1060 6GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 432.00

Blender Version
Broken: version: 2.83.0 Beta, branch: master, commit date: 2020-05-29 17:42, hash: rB691a1e3357e1
Worked: (newest version of Blender that worked as expected)

Short description of error
[bpy.ops.view3d.snap_cursor_to_selected() . I have many codes using this script, where I select an object, snap the cursor to the selected object and import an stl file to the exact location. Blender 2.83 does not work ]

Exact steps for others to reproduce the error
[Create an object, place the cursor somewhere else on the viewport, then in the text editor run the script bpy.ops.view3d.snap_cursor_to_selected()]
[Based on the default startup or an attached .blend file (as simple as possible)]

Event Timeline

RuntimeError: Operator bpy.ops.view3d.snap_cursor_to_selected.poll() failed, context is incorrect
Error: Python script failed, check the message in the system console

Sorry, I may have made a mistake. It works if you have created a menu item.

Philipp Oeser (lichtwerk) closed this task as Resolved.Jun 2 2020, 10:01 AM
Philipp Oeser (lichtwerk) claimed this task.

Sorry, I may have made a mistake. It works if you have created a menu item

Think we can close this then (feel free to comment again if issues persist though...)