2
$\begingroup$

I am working on a python script and to find the right function calls I have been cutting and pasting from the top bar of the scripting window after I do the step manually. It was going great. For instance, I went into edit on an object, selected some vertices and manually did and extrude restricting it to the Z axis. Then I put the code into my script:

bpy.ops.mesh.extrude_region_move(MESH_OT_extrude_region={"mirror":False},
                                 TRANSFORM_OT_translate={"value":(0, 0, 0), 
                                 "constraint_axis":(False, False, False), 
                                 "constraint_orientation":'GLOBAL', 
                                 "mirror":False, 
                                 "proportional":'DISABLED', 
                                 "proportional_edit_falloff":'SMOOTH', 
                                 "proportional_size":1, 
                                 "snap":False, 
                                 "snap_target":'CLOSEST', 
                                 "snap_point":(0, 0, 0), 
                                 "snap_align":False, 
                                 "snap_normal":(0, 0, 0), 
                                 "gpencil_strokes":False, 
                                 "texture_space":False, 
                                 "remove_on_cancel":False, 
                                 "release_confirm":False})

and it worked fine.

But, then I selected a different ring of vertices and did an Extrude (E) -> Scale (S) then restricted the scaling to the XY plane (Shift+Z) and did the scaling extrusion. In the UI it worked fine. But, when I copy the code:

bpy.ops.mesh.extrude_region_move(MESH_OT_extrude_region={"mirror":False}, 
                                 TRANSFORM_OT_resize={"value":(2.12492, 2.12492, 2.12492), 
                                 "constraint_axis":(True, True, False), 
                                 "constraint_orientation":'GLOBAL', 
                                 "mirror":False, 
                                 "proportional":'DISABLED', 
                                 "proportional_edit_falloff":'SMOOTH', 
                                 "proportional_size":1, 
                                 "snap":False, 
                                 "snap_target":'CLOSEST', 
                                 "snap_point":(0, 0, 0), 
                                 "snap_align":False, 
                                 "snap_normal":(0, 0, 0), 
                                 "gpencil_strokes":False, 
                                 "texture_space":False, 
                                 "remove_on_cancel":False, 
                                 "release_confirm":False})

to the script and run it, it says:

TypeError: Converting py args to operator properties: : keyword "TRANSFORM_OT_resize" unrecognized

Error: Python script fail, look in the console for now...

I searched for TRANSFORM_OT_resize and I can't find any ref to it.

$\endgroup$
  • $\begingroup$ Just a hint: try splitting up your code so we don't have to scroll all the way to the side to see all of your code. It's easier to identify your code when all the text is on the screen at the same time. $\endgroup$ – FreemoX Aug 3 '17 at 22:34
  • $\begingroup$ Hi James, I'd say this is a bug, at the very least in that the reported operator call is in error. TRANSFORM_OT_resize is the class name (TYPE_OperatorType_name naming convention) of the scale operator bpy.ops.transform.resize(...). TRANSFORM_OT_resize is not a property of bpy.ops.mesh.extrude_move, TRANSFORM_OT_translate is. Suggest reporting to the Bug Tracker $\endgroup$ – batFINGER Aug 4 '17 at 6:15
  • $\begingroup$ Without testing, would say you can get around this by running extrude_move, followed by bpy.ops.transform.resize(value=(2, 2, 2), ...) $\endgroup$ – batFINGER Aug 4 '17 at 6:22
2
$\begingroup$

thanks batFINGER, your suggestion worked like a charm. this is it:

    bpy.ops.object.mode_set(mode = 'EDIT')
    bpy.ops.mesh.extrude_region_move(MESH_OT_extrude_region={"mirror":False}, ...snip...
    bpy.ops.transform.resize(value=(1.5, 1.5, 1), constraint_axis=(False, False, False))
    bpy.ops.object.mode_set(mode = 'OBJECT')

with some magic numbers.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.