WIP: Fix to ensure consistent bolt sizes regardless of the user's unit scale preference. #16
@ -28,6 +28,11 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
||||
|
||||
MAX_INPUT_NUMBER = 250 # mm
|
||||
|
||||
def update_head_type(self, context):
|
||||
# Reset bit type when head type is set to None.
|
||||
if self.bf_Head_Type == 'bf_Head_None':
|
||||
self.bf_Bit_Type = 'bf_Bit_None'
|
||||
|
||||
Bolt: BoolProperty(name="Bolt",
|
||||
default=True,
|
||||
description="Bolt")
|
||||
@ -45,7 +50,8 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
||||
items=Model_Type_List, default='bf_Model_Bolt'
|
||||
)
|
||||
# Head Types
|
||||
Model_Type_List = [('bf_Head_Hex', 'HEX', 'Hex Head'),
|
||||
Model_Type_List = [('bf_Head_None', 'NONE', 'No Head'),
|
||||
('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'),
|
||||
@ -55,7 +61,8 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
||||
attr='bf_Head_Type',
|
||||
name='Head',
|
||||
description='Choose the type off Head you would like',
|
||||
items=Model_Type_List, default='bf_Head_Hex'
|
||||
items=Model_Type_List, default='bf_Head_Hex',
|
||||
update=update_head_type # Call this function when the head type changes
|
||||
)
|
||||
# Bit Types
|
||||
Bit_Type_List = [('bf_Bit_None', 'NONE', 'No Bit Type'),
|
||||
@ -337,7 +344,10 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
||||
|
||||
# Bit
|
||||
if self.bf_Model_Type == 'bf_Model_Bolt':
|
||||
col.prop(self, 'bf_Bit_Type')
|
||||
if self.bf_Head_Type == 'bf_Head_None':
|
||||
col.label(text="No bit type availabe when Head is None.")
|
||||
else:
|
||||
col.prop(self, 'bf_Bit_Type')
|
||||
if self.bf_Bit_Type == 'bf_Bit_None':
|
||||
pass
|
||||
elif self.bf_Bit_Type == 'bf_Bit_Allen':
|
||||
@ -353,7 +363,9 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
||||
# Head
|
||||
if self.bf_Model_Type == 'bf_Model_Bolt':
|
||||
col.prop(self, 'bf_Head_Type')
|
||||
if self.bf_Head_Type == 'bf_Head_Hex':
|
||||
if self.bf_Head_Type == 'bf_Head_None':
|
||||
pass
|
||||
elif self.bf_Head_Type == 'bf_Head_Hex':
|
||||
col.prop(self, 'bf_Hex_Head_Height')
|
||||
col.prop(self, 'bf_Hex_Head_Flat_Distance')
|
||||
elif self.bf_Head_Type == 'bf_Head_12Pnt':
|
||||
|
Loading…
Reference in New Issue
Block a user