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_description = "Construct many types of Bolts"
|
||||
|
||||
|
||||
MAX_INPUT_NUMBER = 50
|
||||
|
||||
Bolt : BoolProperty(name = "Bolt",
|
||||
default = True,
|
||||
description = "Bolt")
|
||||
change : BoolProperty(name = "Change",
|
||||
default = False,
|
||||
description = "change Bolt")
|
||||
Bolt: BoolProperty(name="Bolt",
|
||||
default=True,
|
||||
description="Bolt")
|
||||
change: BoolProperty(name="Change",
|
||||
default=False,
|
||||
description="change Bolt")
|
||||
|
||||
# Model Types
|
||||
Model_Type_List = [('bf_Model_Bolt', 'BOLT', 'Bolt Model'),
|
||||
@ -48,10 +47,10 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
||||
# Head Types
|
||||
Model_Type_List = [('bf_Head_Hex', 'HEX', 'Hex Head'),
|
||||
('bf_Head_12Pnt', '12 POINT', '12 Point Head'),
|
||||
('bf_Head_Cap', 'CAP', 'Cap Head'),
|
||||
('bf_Head_Dome', 'DOME', 'Dome Head'),
|
||||
('bf_Head_Pan', 'PAN', 'Pan Head'),
|
||||
('bf_Head_CounterSink', 'COUNTER SINK', 'Counter Sink Head')]
|
||||
('bf_Head_Cap', 'CAP', 'Cap Head'),
|
||||
('bf_Head_Dome', 'DOME', 'Dome Head'),
|
||||
('bf_Head_Pan', 'PAN', 'Pan Head'),
|
||||
('bf_Head_CounterSink', 'COUNTER SINK', 'Counter Sink Head')]
|
||||
bf_Head_Type: EnumProperty(
|
||||
attr='bf_Head_Type',
|
||||
name='Head',
|
||||
@ -60,9 +59,9 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
||||
)
|
||||
# Bit Types
|
||||
Bit_Type_List = [('bf_Bit_None', 'NONE', 'No Bit Type'),
|
||||
('bf_Bit_Allen', 'ALLEN', 'Allen Bit Type'),
|
||||
('bf_Bit_Torx', 'TORX', 'Torx Bit Type'),
|
||||
('bf_Bit_Philips', 'PHILLIPS', 'Phillips Bit Type')]
|
||||
('bf_Bit_Allen', 'ALLEN', 'Allen Bit Type'),
|
||||
('bf_Bit_Torx', 'TORX', 'Torx Bit Type'),
|
||||
('bf_Bit_Philips', 'PHILLIPS', 'Phillips Bit Type')]
|
||||
bf_Bit_Type: EnumProperty(
|
||||
attr='bf_Bit_Type',
|
||||
name='Bit Type',
|
||||
@ -71,8 +70,8 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
||||
)
|
||||
# Nut Types
|
||||
Nut_Type_List = [('bf_Nut_Hex', 'HEX', 'Hex Nut'),
|
||||
('bf_Nut_Lock', 'LOCK', 'Lock Nut'),
|
||||
('bf_Nut_12Pnt', '12 POINT', '12 Point Nut')]
|
||||
('bf_Nut_Lock', 'LOCK', 'Lock Nut'),
|
||||
('bf_Nut_12Pnt', '12 POINT', '12 Point Nut')]
|
||||
bf_Nut_Type: EnumProperty(
|
||||
attr='bf_Nut_Type',
|
||||
name='Nut Type',
|
||||
@ -121,13 +120,13 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
||||
)
|
||||
# Torx Size Types
|
||||
Torx_Size_Type_List = [('bf_Torx_T10', 'T10', 'T10'),
|
||||
('bf_Torx_T20', 'T20', 'T20'),
|
||||
('bf_Torx_T25', 'T25', 'T25'),
|
||||
('bf_Torx_T30', 'T30', 'T30'),
|
||||
('bf_Torx_T40', 'T40', 'T40'),
|
||||
('bf_Torx_T50', 'T50', 'T50'),
|
||||
('bf_Torx_T55', 'T55', 'T55'),
|
||||
]
|
||||
('bf_Torx_T20', 'T20', 'T20'),
|
||||
('bf_Torx_T25', 'T25', 'T25'),
|
||||
('bf_Torx_T30', 'T30', 'T30'),
|
||||
('bf_Torx_T40', 'T40', 'T40'),
|
||||
('bf_Torx_T50', 'T50', 'T50'),
|
||||
('bf_Torx_T55', 'T55', 'T55'),
|
||||
]
|
||||
|
||||
bf_Torx_Size_Type: EnumProperty(
|
||||
attr='bf_Torx_Size_Type',
|
||||
@ -168,7 +167,7 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
||||
bf_12_Point_Head_Flat_Distance: FloatProperty(
|
||||
attr='bf_12_Point_Head_Flat_Distance',
|
||||
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,
|
||||
description='Flat Distance of the 12 Point Head',
|
||||
unit='LENGTH',
|
||||
@ -327,6 +326,7 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
||||
description='Flange diameter of the 12 point Nut',
|
||||
unit='LENGTH',
|
||||
)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
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_Flat_Distance')
|
||||
|
||||
|
||||
|
||||
# Thread
|
||||
col.label(text='Thread')
|
||||
if self.bf_Model_Type == 'bf_Model_Bolt':
|
||||
@ -416,7 +414,7 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
||||
if bpy.context.mode == "OBJECT":
|
||||
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 \
|
||||
(self.change == True):
|
||||
(self.change == True):
|
||||
obj = context.active_object
|
||||
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'}
|
||||
|
||||
|
||||
# Register:
|
||||
def Bolt_contex_menu(self, context):
|
||||
bl_label = 'Change'
|
||||
@ -481,18 +480,19 @@ def Bolt_contex_menu(self, context):
|
||||
setattr(props, prm, obj.data[prm])
|
||||
layout.separator()
|
||||
|
||||
|
||||
def menu_func_bolt(self, context):
|
||||
layout = self.layout
|
||||
layout.separator()
|
||||
oper = self.layout.operator(add_mesh_bolt.bl_idname, text="Bolt", icon="MOD_SCREW")
|
||||
oper.change = False
|
||||
|
||||
|
||||
classes = (
|
||||
add_mesh_bolt,
|
||||
)
|
||||
|
||||
|
||||
|
||||
def register():
|
||||
for cls in classes:
|
||||
bpy.utils.register_class(cls)
|
||||
@ -506,35 +506,36 @@ def unregister():
|
||||
for cls in reversed(classes):
|
||||
bpy.utils.unregister_class(cls)
|
||||
|
||||
|
||||
def BoltParameters():
|
||||
BoltParameters = [
|
||||
"bf_Model_Type",
|
||||
"bf_Head_Type",
|
||||
"bf_Bit_Type",
|
||||
"bf_Nut_Type",
|
||||
"bf_Shank_Length",
|
||||
"bf_Shank_Dia",
|
||||
"bf_Phillips_Bit_Depth",
|
||||
"bf_Allen_Bit_Depth",
|
||||
"bf_Allen_Bit_Flat_Distance",
|
||||
"bf_Torx_Bit_Depth",
|
||||
"bf_Torx_Size_Type",
|
||||
"bf_Hex_Head_Height",
|
||||
"bf_Hex_Head_Flat_Distance",
|
||||
"bf_CounterSink_Head_Dia",
|
||||
"bf_Cap_Head_Height",
|
||||
"bf_Cap_Head_Dia",
|
||||
"bf_Dome_Head_Dia",
|
||||
"bf_Pan_Head_Dia",
|
||||
"bf_Philips_Bit_Dia",
|
||||
"bf_Thread_Length",
|
||||
"bf_Major_Dia",
|
||||
"bf_Pitch",
|
||||
"bf_Minor_Dia",
|
||||
"bf_Crest_Percent",
|
||||
"bf_Root_Percent",
|
||||
"bf_Div_Count",
|
||||
"bf_Hex_Nut_Height",
|
||||
"bf_Hex_Nut_Flat_Distance",
|
||||
"bf_Model_Type",
|
||||
"bf_Head_Type",
|
||||
"bf_Bit_Type",
|
||||
"bf_Nut_Type",
|
||||
"bf_Shank_Length",
|
||||
"bf_Shank_Dia",
|
||||
"bf_Phillips_Bit_Depth",
|
||||
"bf_Allen_Bit_Depth",
|
||||
"bf_Allen_Bit_Flat_Distance",
|
||||
"bf_Torx_Bit_Depth",
|
||||
"bf_Torx_Size_Type",
|
||||
"bf_Hex_Head_Height",
|
||||
"bf_Hex_Head_Flat_Distance",
|
||||
"bf_CounterSink_Head_Dia",
|
||||
"bf_Cap_Head_Height",
|
||||
"bf_Cap_Head_Dia",
|
||||
"bf_Dome_Head_Dia",
|
||||
"bf_Pan_Head_Dia",
|
||||
"bf_Philips_Bit_Dia",
|
||||
"bf_Thread_Length",
|
||||
"bf_Major_Dia",
|
||||
"bf_Pitch",
|
||||
"bf_Minor_Dia",
|
||||
"bf_Crest_Percent",
|
||||
"bf_Root_Percent",
|
||||
"bf_Div_Count",
|
||||
"bf_Hex_Nut_Height",
|
||||
"bf_Hex_Nut_Flat_Distance",
|
||||
]
|
||||
return BoltParameters
|
||||
|
Loading…
Reference in New Issue
Block a user