I am using Blender v3.3.5. I am very new to Python Scripting. I want to write a script to assign a radius value (say 300) to the Select Circle in modelling. I know from Python Tooltips that the attribute name for the Select Circle radius is “VIEW3D_OT_select_circle.radius”, but don’t know what is the full line of Python Script to make it work. Appreciate for your help.
you can use the following code:
get the active object in the scene
obj = bpy.context.active_object
check if the object is a circle
if obj.type == ‘CURVE’ and obj.data.dimensions == ‘2D’:
# set the radius of the selected circle to 300 bpy.ops.transform.translate(value=(0, 0, 0)) bpy.ops.transform.resize(value=(300 / obj.dimensions.x, 300 / obj.dimensions.x, 1)) # update the view bpy.context.view_layer.update()
Hi Noah, thanks for your reply and help.
May be my question was not clear. I am referring to the Select command. There are 4 options in the Command: Tweak, Select Box, Select Circle and Select Lasso. When I use the “Select Circle” option, I can use the number field (on the upper left side of the 3D Viewport) to type in or slide the existing radius value to specify the required radius value. I found that typing and sliding are both very time consuming. Therefore, I want to write a program to simply assign a value to that field with a script. I know from Python Tooltips that the attribute name for the Select Circle radius is “VIEW3D_OT_select_circle.radius”, but don’t know what is the correct line of Python Script to set the value to that attribute.
Please let me know the proper line of that part of the script for working with Blender v.3.3.5. Thank you very much in advance.