# How to call F6 menu after calling solidify mesh command?

When you call bpy.ops.mesh.solidify() Blender will add the mesh but NOT show you the solidify dialog. To adjust it you have to press F6.

I assumed that adding bpy.ops.redo_last() afterwards would do the trick but I think this does not work as expected as no UI appears. And if I press F6 I think a UI opens that appears more to show the dialog for the class I defined and not the solidify command that is part of the class.

Do you have an idea how you have to script this so when executing the script the solidify command is executed and then the F6 menu for the solidify command will be displayed.

class SolidifyDialog(bpy.types.Operator):
bl_idname = "solidify.dialog"
bl_label = "Solidify Dialog"
bl_options = {'REGISTER', 'UNDO'}

def execute(self, context):
bpy.ops.mesh.solidify()
bpy.ops.redo_last()
return {'FINISHED'}


Since you are wrapping the Solidify operator inside your operator :

• create a property (variable ) to hold the thickness and pass it to the solidify operator.
• create a draw() function and call it ( the F6 will also call this draw() function )
• you can display the menu of your operator to control the solidify operator through the property.

import bpy
from bpy.props import FloatProperty

class SolidifyDialog(bpy.types.Operator):
bl_idname = "solidify.dialog"
bl_label = "Solidify Dialog"
bl_options = {'REGISTER', 'UNDO'}

thickness = FloatProperty(
name = "thickness",
default = 0.001,
min = -10,
max = 10,
unit ='LENGTH'
)
def execute(self, context):
bpy.ops.mesh.solidify(thickness = self.thickness)
return {'FINISHED'}

def draw(self, context):
layout = self.layout
row = layout.row()
row.prop(self,"thickness")

def invoke(self, context, event):
wm = context.window_manager
return wm.invoke_props_popup(self, event)

def register():
bpy.utils.register_class(SolidifyDialog)

def unregister():
bpy.utils.unregister_class(SolidifyDialog)

if __name__ == "__main__":
register()


note : wm.invoke_props_dialog() didn't work as expected , it doesn't update the view while changing the value so i switched to wm.invoke_props_popup()

• Thank you very much, I have to study how this is structured. QUESTION Do you know how to display the unite system with this dialog like Metric or imperial? – Claas Kuhnen Jan 17 '16 at 18:40
• @ClaasKuhnen edited the answer see unit ='LENGTH' – Chebhou Jan 17 '16 at 18:52
• May I ask where you got this from? I ask because before posting I spend time online and in the Py API to find this myself but did not. – Claas Kuhnen Jan 17 '16 at 18:54
• I have used it before, and you can find it in the API here blender.org/api/blender_python_api_2_74_0/… – Chebhou Jan 17 '16 at 18:56
• I htink I should forget about using Google and only do this inside the Blender.org API website which has also a search field. Thank you very much! – Claas Kuhnen Jan 17 '16 at 19:00

While the correct operator name is bpy.ops.screen.redo_last() it fails when called from within an operator. As you are in the process of executing an operator the redo will want to refer to the current action being run not the sub action that just finished.

You may notice that if you remove the bl_options and call only the solidify operator then the redo will work on the action before your operator not the solidify that you would expect. This implies that as the undo stack only works on the last action performed, the redo does not support adjusting any sub actions.

• If understand you correctly take the " bl_idname = "solidify.dialog" bl_label = "Solidify Dialog" bl_options = {'REGISTER', 'UNDO'}" out but keep the redo.last wrapped inside this operator? Or do you mean without the BL_ data and the redo.last inside the operator calling F6 afterwards will work. – Claas Kuhnen Jan 17 '16 at 17:07
• If you remove the bl_options then run your operator and press f6, then the previous actions options will show not the solidify options that you call from your execute method. With the bl_options f6 will bring up your operator (with no options) not the solidify you called. But Chebhou figured a way past this. – sambler Jan 18 '16 at 6:11