Circle Selection in python

Hey Guys,

I´m pretty new to Blender and Python but I think i have a question,
which is not so easy to answer. So I developed a script in Python where
Blender does some easy operations on a 3D model. For further purposes I want
to (circle) select a part on my 3-dimensional model, which has a high mesh density
(many faces).
I use the follwing command:

" for area in bpy.context.screen.areas:
if area.type == ‘VIEW_3D’:
for region in area.regions:
if region.type == ‘WINDOW’:
override = {‘area’: area, ‘region’: region, ‘edit_object’: bpy.context.edit_object}

            bpy.ops.view3d.select_circle(override, x=10, y=10, radius=10) "

python API:

" bpy.ops.view3d.select_circle(x=0, y=0, radius=0, gesture_mode=0)

Select items using circle selection
Parameters:	

    x (int in [-inf, inf], (optional)) – X
    y (int in [-inf, inf], (optional)) – Y
    radius (int in [-inf, inf], (optional)) – Radius
    gesture_mode (int in [-inf, inf], (optional)) – Event Type "

The problem is: When I enter both x and y coordinate (a point on the surface of the 3D object)
nothing happens at all. Additionally I wonder how Blender should know about the
z-coordinate, which I cannot enter. I couldn´t find anything at all and hope
you guys can help me with this.

Thank you in advance
Isabell

my guess would be that x and y coordinates are probably the mouse position on screen…

I agree with little-me, it’s probably in screen space, relative to bottom left corner of the area. And since select_circle is a 2d operation, there is of course no z-property for the operator.

And how can I get the screen coordinates?

The only way I know of is to create an operator and using the event.mouse_x/y or mouse_region_x/y etc… options.
You can find a simple way to do this in the second example on the blender API operator docs:
http://www.blender.org/documentation/blender_python_api_2_72b_release/bpy.types.Operator.html

There are utility functions:
http://www.blender.org/documentation/blender_python_api_2_72b_release/bpy_extras.view3d_utils.html
http://www.blender.org/documentation/blender_python_api_2_72b_release/bpy.types.View2D.html#bpy.types.View2D

But I don’t think you should use select_circle() at all, but write some low-level code to select what you desire