WIP: white space changes to BoltFactory to fix flake8 #105083
@ -26,15 +26,14 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||||||
bl_options = {'REGISTER', 'UNDO', 'PRESET'}
|
bl_options = {'REGISTER', 'UNDO', 'PRESET'}
|
||||||
bl_description = "Construct many types of Bolts"
|
bl_description = "Construct many types of Bolts"
|
||||||
|
|
||||||
|
|
||||||
MAX_INPUT_NUMBER = 50
|
MAX_INPUT_NUMBER = 50
|
||||||
|
|
||||||
Bolt : BoolProperty(name = "Bolt",
|
Bolt: BoolProperty(name="Bolt",
|
||||||
default = True,
|
default=True,
|
||||||
description = "Bolt")
|
description="Bolt")
|
||||||
change : BoolProperty(name = "Change",
|
change: BoolProperty(name="Change",
|
||||||
default = False,
|
default=False,
|
||||||
description = "change Bolt")
|
description="change Bolt")
|
||||||
|
|
||||||
# Model Types
|
# Model Types
|
||||||
Model_Type_List = [('bf_Model_Bolt', 'BOLT', 'Bolt Model'),
|
Model_Type_List = [('bf_Model_Bolt', 'BOLT', 'Bolt Model'),
|
||||||
@ -48,10 +47,10 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||||||
# Head Types
|
# Head Types
|
||||||
Model_Type_List = [('bf_Head_Hex', 'HEX', 'Hex Head'),
|
Model_Type_List = [('bf_Head_Hex', 'HEX', 'Hex Head'),
|
||||||
('bf_Head_12Pnt', '12 POINT', '12 Point Head'),
|
('bf_Head_12Pnt', '12 POINT', '12 Point Head'),
|
||||||
('bf_Head_Cap', 'CAP', 'Cap Head'),
|
('bf_Head_Cap', 'CAP', 'Cap Head'),
|
||||||
('bf_Head_Dome', 'DOME', 'Dome Head'),
|
('bf_Head_Dome', 'DOME', 'Dome Head'),
|
||||||
('bf_Head_Pan', 'PAN', 'Pan Head'),
|
('bf_Head_Pan', 'PAN', 'Pan Head'),
|
||||||
('bf_Head_CounterSink', 'COUNTER SINK', 'Counter Sink Head')]
|
('bf_Head_CounterSink', 'COUNTER SINK', 'Counter Sink Head')]
|
||||||
bf_Head_Type: EnumProperty(
|
bf_Head_Type: EnumProperty(
|
||||||
attr='bf_Head_Type',
|
attr='bf_Head_Type',
|
||||||
name='Head',
|
name='Head',
|
||||||
@ -60,9 +59,9 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||||||
)
|
)
|
||||||
# Bit Types
|
# Bit Types
|
||||||
Bit_Type_List = [('bf_Bit_None', 'NONE', 'No Bit Type'),
|
Bit_Type_List = [('bf_Bit_None', 'NONE', 'No Bit Type'),
|
||||||
('bf_Bit_Allen', 'ALLEN', 'Allen Bit Type'),
|
('bf_Bit_Allen', 'ALLEN', 'Allen Bit Type'),
|
||||||
('bf_Bit_Torx', 'TORX', 'Torx Bit Type'),
|
('bf_Bit_Torx', 'TORX', 'Torx Bit Type'),
|
||||||
('bf_Bit_Philips', 'PHILLIPS', 'Phillips Bit Type')]
|
('bf_Bit_Philips', 'PHILLIPS', 'Phillips Bit Type')]
|
||||||
bf_Bit_Type: EnumProperty(
|
bf_Bit_Type: EnumProperty(
|
||||||
attr='bf_Bit_Type',
|
attr='bf_Bit_Type',
|
||||||
name='Bit Type',
|
name='Bit Type',
|
||||||
@ -71,8 +70,8 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||||||
)
|
)
|
||||||
# Nut Types
|
# Nut Types
|
||||||
Nut_Type_List = [('bf_Nut_Hex', 'HEX', 'Hex Nut'),
|
Nut_Type_List = [('bf_Nut_Hex', 'HEX', 'Hex Nut'),
|
||||||
('bf_Nut_Lock', 'LOCK', 'Lock Nut'),
|
('bf_Nut_Lock', 'LOCK', 'Lock Nut'),
|
||||||
('bf_Nut_12Pnt', '12 POINT', '12 Point Nut')]
|
('bf_Nut_12Pnt', '12 POINT', '12 Point Nut')]
|
||||||
bf_Nut_Type: EnumProperty(
|
bf_Nut_Type: EnumProperty(
|
||||||
attr='bf_Nut_Type',
|
attr='bf_Nut_Type',
|
||||||
name='Nut Type',
|
name='Nut Type',
|
||||||
@ -121,13 +120,13 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||||||
)
|
)
|
||||||
# Torx Size Types
|
# Torx Size Types
|
||||||
Torx_Size_Type_List = [('bf_Torx_T10', 'T10', 'T10'),
|
Torx_Size_Type_List = [('bf_Torx_T10', 'T10', 'T10'),
|
||||||
('bf_Torx_T20', 'T20', 'T20'),
|
('bf_Torx_T20', 'T20', 'T20'),
|
||||||
('bf_Torx_T25', 'T25', 'T25'),
|
('bf_Torx_T25', 'T25', 'T25'),
|
||||||
('bf_Torx_T30', 'T30', 'T30'),
|
('bf_Torx_T30', 'T30', 'T30'),
|
||||||
('bf_Torx_T40', 'T40', 'T40'),
|
('bf_Torx_T40', 'T40', 'T40'),
|
||||||
('bf_Torx_T50', 'T50', 'T50'),
|
('bf_Torx_T50', 'T50', 'T50'),
|
||||||
('bf_Torx_T55', 'T55', 'T55'),
|
('bf_Torx_T55', 'T55', 'T55'),
|
||||||
]
|
]
|
||||||
|
|
||||||
bf_Torx_Size_Type: EnumProperty(
|
bf_Torx_Size_Type: EnumProperty(
|
||||||
attr='bf_Torx_Size_Type',
|
attr='bf_Torx_Size_Type',
|
||||||
@ -168,7 +167,7 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||||||
bf_12_Point_Head_Flat_Distance: FloatProperty(
|
bf_12_Point_Head_Flat_Distance: FloatProperty(
|
||||||
attr='bf_12_Point_Head_Flat_Distance',
|
attr='bf_12_Point_Head_Flat_Distance',
|
||||||
name='Flat Dist', default=3.0,
|
name='Flat Dist', default=3.0,
|
||||||
min=0.001, soft_min=0, #limit to 0.001 to avoid calculation error
|
min=0.001, soft_min=0, # limit to 0.001 to avoid calculation error
|
||||||
max=MAX_INPUT_NUMBER,
|
max=MAX_INPUT_NUMBER,
|
||||||
description='Flat Distance of the 12 Point Head',
|
description='Flat Distance of the 12 Point Head',
|
||||||
unit='LENGTH',
|
unit='LENGTH',
|
||||||
@ -327,6 +326,7 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||||||
description='Flange diameter of the 12 point Nut',
|
description='Flange diameter of the 12 point Nut',
|
||||||
unit='LENGTH',
|
unit='LENGTH',
|
||||||
)
|
)
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
col = layout.column()
|
col = layout.column()
|
||||||
@ -387,8 +387,6 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||||||
col.prop(self, 'bf_Hex_Nut_Height')
|
col.prop(self, 'bf_Hex_Nut_Height')
|
||||||
col.prop(self, 'bf_Hex_Nut_Flat_Distance')
|
col.prop(self, 'bf_Hex_Nut_Flat_Distance')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Thread
|
# Thread
|
||||||
col.label(text='Thread')
|
col.label(text='Thread')
|
||||||
if self.bf_Model_Type == 'bf_Model_Bolt':
|
if self.bf_Model_Type == 'bf_Model_Bolt':
|
||||||
@ -416,7 +414,7 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||||||
if bpy.context.mode == "OBJECT":
|
if bpy.context.mode == "OBJECT":
|
||||||
if context.selected_objects != [] and context.active_object and \
|
if context.selected_objects != [] and context.active_object and \
|
||||||
(context.active_object.data is not None) and ('Bolt' in context.active_object.data.keys()) and \
|
(context.active_object.data is not None) and ('Bolt' in context.active_object.data.keys()) and \
|
||||||
(self.change == True):
|
(self.change == True):
|
||||||
obj = context.active_object
|
obj = context.active_object
|
||||||
use_smooth = bool(obj.data.polygons[0].use_smooth) # Copy value, do not take a reference
|
use_smooth = bool(obj.data.polygons[0].use_smooth) # Copy value, do not take a reference
|
||||||
|
|
||||||
@ -467,6 +465,7 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
# Register:
|
# Register:
|
||||||
def Bolt_contex_menu(self, context):
|
def Bolt_contex_menu(self, context):
|
||||||
bl_label = 'Change'
|
bl_label = 'Change'
|
||||||
@ -481,18 +480,19 @@ def Bolt_contex_menu(self, context):
|
|||||||
setattr(props, prm, obj.data[prm])
|
setattr(props, prm, obj.data[prm])
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
|
|
||||||
def menu_func_bolt(self, context):
|
def menu_func_bolt(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
layout.separator()
|
layout.separator()
|
||||||
oper = self.layout.operator(add_mesh_bolt.bl_idname, text="Bolt", icon="MOD_SCREW")
|
oper = self.layout.operator(add_mesh_bolt.bl_idname, text="Bolt", icon="MOD_SCREW")
|
||||||
oper.change = False
|
oper.change = False
|
||||||
|
|
||||||
|
|
||||||
classes = (
|
classes = (
|
||||||
add_mesh_bolt,
|
add_mesh_bolt,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
for cls in classes:
|
for cls in classes:
|
||||||
bpy.utils.register_class(cls)
|
bpy.utils.register_class(cls)
|
||||||
@ -506,35 +506,36 @@ def unregister():
|
|||||||
for cls in reversed(classes):
|
for cls in reversed(classes):
|
||||||
bpy.utils.unregister_class(cls)
|
bpy.utils.unregister_class(cls)
|
||||||
|
|
||||||
|
|
||||||
def BoltParameters():
|
def BoltParameters():
|
||||||
BoltParameters = [
|
BoltParameters = [
|
||||||
"bf_Model_Type",
|
"bf_Model_Type",
|
||||||
"bf_Head_Type",
|
"bf_Head_Type",
|
||||||
"bf_Bit_Type",
|
"bf_Bit_Type",
|
||||||
"bf_Nut_Type",
|
"bf_Nut_Type",
|
||||||
"bf_Shank_Length",
|
"bf_Shank_Length",
|
||||||
"bf_Shank_Dia",
|
"bf_Shank_Dia",
|
||||||
"bf_Phillips_Bit_Depth",
|
"bf_Phillips_Bit_Depth",
|
||||||
"bf_Allen_Bit_Depth",
|
"bf_Allen_Bit_Depth",
|
||||||
"bf_Allen_Bit_Flat_Distance",
|
"bf_Allen_Bit_Flat_Distance",
|
||||||
"bf_Torx_Bit_Depth",
|
"bf_Torx_Bit_Depth",
|
||||||
"bf_Torx_Size_Type",
|
"bf_Torx_Size_Type",
|
||||||
"bf_Hex_Head_Height",
|
"bf_Hex_Head_Height",
|
||||||
"bf_Hex_Head_Flat_Distance",
|
"bf_Hex_Head_Flat_Distance",
|
||||||
"bf_CounterSink_Head_Dia",
|
"bf_CounterSink_Head_Dia",
|
||||||
"bf_Cap_Head_Height",
|
"bf_Cap_Head_Height",
|
||||||
"bf_Cap_Head_Dia",
|
"bf_Cap_Head_Dia",
|
||||||
"bf_Dome_Head_Dia",
|
"bf_Dome_Head_Dia",
|
||||||
"bf_Pan_Head_Dia",
|
"bf_Pan_Head_Dia",
|
||||||
"bf_Philips_Bit_Dia",
|
"bf_Philips_Bit_Dia",
|
||||||
"bf_Thread_Length",
|
"bf_Thread_Length",
|
||||||
"bf_Major_Dia",
|
"bf_Major_Dia",
|
||||||
"bf_Pitch",
|
"bf_Pitch",
|
||||||
"bf_Minor_Dia",
|
"bf_Minor_Dia",
|
||||||
"bf_Crest_Percent",
|
"bf_Crest_Percent",
|
||||||
"bf_Root_Percent",
|
"bf_Root_Percent",
|
||||||
"bf_Div_Count",
|
"bf_Div_Count",
|
||||||
"bf_Hex_Nut_Height",
|
"bf_Hex_Nut_Height",
|
||||||
"bf_Hex_Nut_Flat_Distance",
|
"bf_Hex_Nut_Flat_Distance",
|
||||||
]
|
]
|
||||||
return BoltParameters
|
return BoltParameters
|
||||||
|
Loading…
Reference in New Issue
Block a user