Skip to content
Snippets Groups Projects
add_dimension.py 128 KiB
Newer Older
  • Learn to ignore specific revisions
  •         props2 = layout.operator("curve.dimension", text = 'Add 3D angle dimension')
            props2.Dimension_Change = False
            props2.Dimension_Type = 'Angular1'
            props2.Dimension_width_or_location = 'location'
            props2.Dimension_startlocation = startvertex
            props2.Dimension_endlocation = endvertex
            props2.Dimension_endanglelocation = endanglevertex
            props2.Dimension_liberty = '3D'
            props2.Dimension_rotation = 0
            props2.Dimension_parent = obj.name
    
    
    def Dimension_button(self, context):
        oper = self.layout.operator(Dimension.bl_idname, text = "Dimension", icon = "PLUGIN")
        oper.Dimension_Change = False
        oper.Dimension_width_or_location = 'width'
        oper.Dimension_liberty = '2D'
    
    
    ################################################################################
    ##### REGISTER #####
    classes = [
        Dimension,
    ]
    
    
        from bpy.utils import register_class
        for cls in classes:
            register_class(cls)
    
        bpy.types.VIEW3D_MT_curve_add.append(Dimension_button)
    
        bpy.types.VIEW3D_MT_object_context_menu.prepend(Dimension_object_menu)
        bpy.types.VIEW3D_MT_edit_mesh_context_menu.append(Dimension_edit_menu)
    
        bpy.types.VIEW3D_MT_edit_mesh_context_menu.remove(Dimension_edit_menu)
        bpy.types.VIEW3D_MT_object_context_menu.remove(Dimension_object_menu)
    
        bpy.types.VIEW3D_MT_curve_add.remove(Dimension_button)
    
        from bpy.utils import unregister_class
        for cls in reversed(classes):
            unregister_class(cls)
    
    
    if __name__ == "__main__":
        register()