Fix for #1: Countersink Head angle vs nominal size #12

Open
sw-tya wants to merge 3 commits from sw-tya/add_mesh_BoltFactory:swtya_CounterSinkHead into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
10 changed files with 22 additions and 9 deletions
Showing only changes of commit adf1991c77 - Show all commits

View File

@ -188,6 +188,14 @@ class add_mesh_bolt(Operator, AddObjectHelper):
description='Diameter of the Counter Sink Head',
unit='LENGTH',
)
bf_CounterSink_Head_Angle: FloatProperty(
attr='bf_CounterSink_Head_Angle',
name='Head angle', default=1.5708,
min=0.5, soft_min=2.62,
max=2.62,
description='Included Angle of the Counter Sink Head',
unit='ROTATION',
)
bf_Cap_Head_Height: FloatProperty(
attr='bf_Cap_Head_Height',
name='Head Height', default=3 * createMesh.GLOBAL_SCALE,
@ -369,6 +377,7 @@ class add_mesh_bolt(Operator, AddObjectHelper):
col.prop(self, 'bf_Pan_Head_Dia')
elif self.bf_Head_Type == 'bf_Head_CounterSink':
col.prop(self, 'bf_CounterSink_Head_Dia')
col.prop(self, 'bf_CounterSink_Head_Angle')
col.separator()
# Shank
if self.bf_Model_Type == 'bf_Model_Bolt':
@ -524,6 +533,7 @@ def BoltParameters():
"bf_Hex_Head_Height",
"bf_Hex_Head_Flat_Distance",
"bf_CounterSink_Head_Dia",
"bf_CounterSink_Head_Angle",
"bf_Cap_Head_Height",
"bf_Cap_Head_Dia",
"bf_Dome_Head_Dia",

View File

@ -778,7 +778,7 @@ def Create_Dome_Head(HOLE_DIA, HEAD_DIA, SHANK_DIA, HEIGHT, RAD1, RAD2, FACE_OFF
return sVerts, faces, Dome_Height
def Create_CounterSink_Head(HOLE_DIA, HEAD_DIA, SHANK_DIA, HEIGHT, RAD1, DIV_COUNT):
def Create_CounterSink_Head(HOLE_DIA, HEAD_DIA, SHANK_DIA, HEAD_ANGLE, RAD1, DIV_COUNT):
HOLE_RADIUS = HOLE_DIA * 0.5
HEAD_RADIUS = HEAD_DIA * 0.5
@ -789,13 +789,8 @@ def Create_CounterSink_Head(HOLE_DIA, HEAD_DIA, SHANK_DIA, HEIGHT, RAD1, DIV_COU
Row = 0
# As per ISO 10642 the angle of the head is not constant with nominal diameter.
# Between 20 and 22mm the head angle changes.
# Note, this is not suitable for cheating a rivet - due to a different angle, see ISO 1051.
# The input arg of HEIGHT is not passed from the GUI, it must be created here:
if SHANK_DIA < 21:
HEIGHT = tan(radians(45)) * (HEAD_RADIUS - SHANK_RADIUS) + RAD1
else:
HEIGHT = tan(radians(60)) * (HEAD_RADIUS - SHANK_RADIUS) + RAD1
# Between 20 and 22mm shank the head angle changes 90 to 60.
HEIGHT = tan((1.5708 - HEAD_ANGLE / 2.0)) * (HEAD_RADIUS - SHANK_RADIUS) + RAD1
FaceStart = len(verts)

I certainly applaud your research and initiative, but my concern is “the best thing about standards is there are so many to choose from.” Would there be a reason this couldn’t be an additional parameter in the GUI? I would love if the default value changed according to the shank diameter, but based on my own previous experimentation, I expect this may be a taller order. I expect other standards bodies will declare other counter sink angles in their own ecosystems parameterized off other cutoff values.

I certainly applaud your research and initiative, but my concern is “the best thing about standards is there are so many to choose from.” Would there be a reason this couldn’t be an additional parameter in the GUI? I would love if the default value changed according to the shank diameter, but based on my own previous experimentation, I expect this may be a taller order. I expect other standards bodies will declare other counter sink angles in their own ecosystems parameterized off other cutoff values.

Yep, I hear what you are saying....

"Would there be a reason this couldn’t"

Indeed that wold be best. Having had a look this it will touch some of the same lines already touched in #10 & #11. To do a complete job the new angle should make it into the presets too.

How would I do it:

  1. Update Create_CounterSink_Head() so the not used HEIGHT becomes the HEAD_ANGLE.
  2. My new lines get scrubbed and the HEAD_ANGLE is used to make the height.
  3. Define a new property "props.bf_CounterSink_Head_Angle" in the class add_mesh_bolt.
    3a) Make new property appear in the GUI draw() function adding "col.prop(self, 'bf_CounterSink_Head_Angle')"
  4. Pass that new property via Bolt_Mesh()
  5. For each of the preset files add the required angle property.

I understand GIT can manage this, but can I....
Less scary to wait until those other changes are on main. Then I can "rebase main" to avoid conflicts.

Yep, I hear what you are saying.... >> "Would there be a reason this couldn’t" Indeed that wold be best. Having had a look this it will touch some of the same lines already touched in #10 & #11. To do a complete job the new angle should make it into the presets too. How would I do it: 1) Update Create_CounterSink_Head() so the not used HEIGHT becomes the HEAD_ANGLE. 2) My new lines get scrubbed and the HEAD_ANGLE is used to make the height. 3) Define a new property "props.bf_CounterSink_Head_Angle" in the class add_mesh_bolt. 3a) Make new property appear in the GUI draw() function adding "col.prop(self, 'bf_CounterSink_Head_Angle')" 4) Pass that new property via Bolt_Mesh() 5) For each of the preset files add the required angle property. I understand GIT can manage this, but can I.... Less scary to wait until those other changes are on main. Then I can "rebase main" to avoid conflicts.

I would love if the default value changed according to the shank diameter, but based on my own previous experimentation, I expect this may be a taller order.

@linux_dr Did yo find this documentation page?: https://docs.blender.org/api/current/bpy.props.html

def update_func(self, context):
    print("my test function", self)
bpy.types.Scene.testprop = bpy.props.FloatProperty(update=update_func)
> I would love if the default value changed according to the shank diameter, but based on my own previous experimentation, I expect this may be a taller order. @linux_dr Did yo find this documentation page?: [https://docs.blender.org/api/current/bpy.props.html](https://docs.blender.org/api/current/bpy.props.html#update-example) ``` def update_func(self, context): print("my test function", self) bpy.types.Scene.testprop = bpy.props.FloatProperty(update=update_func) ```
@ -2424,7 +2419,7 @@ def Bolt_Mesh(props, context):
elif props.bf_Head_Type == 'bf_Head_CounterSink':
Head_Verts, Head_Faces, Head_Height = Create_CounterSink_Head(
Bit_Dia, props.bf_CounterSink_Head_Dia / GLOBAL_SCALE,
props.bf_Shank_Dia / GLOBAL_SCALE, props.bf_CounterSink_Head_Dia / GLOBAL_SCALE,
props.bf_Shank_Dia / GLOBAL_SCALE, props.bf_CounterSink_Head_Angle,
props.bf_CounterSink_Head_Dia / GLOBAL_SCALE * (0.09 / 6.31),
props.bf_Div_Count
)

View File

@ -18,6 +18,7 @@ op.bf_12_Point_Head_Height = 3.0 / 1000.0
op.bf_12_Point_Head_Flat_Distance = 3.0 / 1000.0
op.bf_12_Point_Head_Flange_Dia = 5.72 / 1000.0
op.bf_CounterSink_Head_Dia = 6.300000190734863 / 1000.0
op.bf_CounterSink_Head_Angle = 1.5708
op.bf_Cap_Head_Height = 3.0 / 1000.0
op.bf_Cap_Head_Dia = 5.5 / 1000.0
op.bf_Dome_Head_Dia = 5.599999904632568 / 1000.0

View File

@ -18,6 +18,7 @@ op.bf_12_Point_Head_Height = 3.0 / 1000.0
op.bf_12_Point_Head_Flat_Distance = 3.0 / 1000.0
op.bf_12_Point_Head_Flange_Dia = 5.72 / 1000.0
op.bf_CounterSink_Head_Dia = 6.300000190734863 / 1000.0
op.bf_CounterSink_Head_Angle = 1.5708
op.bf_Cap_Head_Height = 3.0 / 1000.0
op.bf_Cap_Head_Dia = 5.5 / 1000.0
op.bf_Dome_Head_Dia = 5.599999904632568 / 1000.0

View File

@ -18,6 +18,7 @@ op.bf_12_Point_Head_Height = 4.0 / 1000.0
op.bf_12_Point_Head_Flat_Distance = 4.0 / 1000.0
op.bf_12_Point_Head_Flange_Dia = 7.22 / 1000.0
op.bf_CounterSink_Head_Dia = 9.399999618530273 / 1000.0
op.bf_CounterSink_Head_Angle = 1.5708
op.bf_Cap_Head_Height = 4.0 / 1000.0
op.bf_Cap_Head_Dia = 7.0 / 1000.0
op.bf_Dome_Head_Dia = 8.0 / 1000.0

View File

@ -18,6 +18,7 @@ op.bf_12_Point_Head_Height = 5.0 / 1000.0
op.bf_12_Point_Head_Flat_Distance = 5.0 / 1000.0
op.bf_12_Point_Head_Flange_Dia = 8.72 / 1000.0
op.bf_CounterSink_Head_Dia = 10.399999618530273 / 1000.0
op.bf_CounterSink_Head_Angle = 1.5708
op.bf_Cap_Head_Height = 5.0 / 1000.0
op.bf_Cap_Head_Dia = 8.5 / 1000.0
op.bf_Dome_Head_Dia = 9.5 / 1000.0

View File

@ -18,6 +18,7 @@ op.bf_12_Point_Head_Height = 6.0 / 1000.0
op.bf_12_Point_Head_Flat_Distance = 6.0 / 1000.0
op.bf_12_Point_Head_Flange_Dia = 10.22 / 1000.0
op.bf_CounterSink_Head_Dia = 12.600000381469727 / 1000.0
op.bf_CounterSink_Head_Angle = 1.5708
op.bf_Cap_Head_Height = 6.0 / 1000.0
op.bf_Cap_Head_Dia = 10.0 / 1000.0
op.bf_Dome_Head_Dia = 12.0 / 1000.0

View File

@ -18,6 +18,7 @@ op.bf_12_Point_Head_Height = 8.0 / 1000.0
op.bf_12_Point_Head_Flat_Distance = 8.0 / 1000.0
op.bf_12_Point_Head_Flange_Dia = 13.27 / 1000.0
op.bf_CounterSink_Head_Dia = 17.299999237060547 / 1000.0
op.bf_CounterSink_Head_Angle = 1.5708
op.bf_Cap_Head_Height = 8.0 / 1000.0
op.bf_Cap_Head_Dia = 13.5 / 1000.0
op.bf_Dome_Head_Dia = 16.0 / 1000.0

View File

@ -18,6 +18,7 @@ op.bf_12_Point_Head_Height = 10.0 / 1000.0
op.bf_12_Point_Head_Flat_Distance = 10.0 / 1000.0
op.bf_12_Point_Head_Flange_Dia = 16.27 / 1000.0
op.bf_CounterSink_Head_Dia = 20.0 / 1000.0
op.bf_CounterSink_Head_Angle = 1.5708
op.bf_Cap_Head_Height = 10.0 / 1000.0
op.bf_Cap_Head_Dia = 16.0 / 1000.0
op.bf_Dome_Head_Dia = 20.0 / 1000.0

View File

@ -18,6 +18,7 @@ op.bf_12_Point_Head_Height = 12.0 / 1000.0
op.bf_12_Point_Head_Flat_Distance = 12.0 / 1000.0
op.bf_12_Point_Head_Flange_Dia = 18.27 / 1000.0
op.bf_CounterSink_Head_Dia = 22.0 / 1000.0
op.bf_CounterSink_Head_Angle = 1.5708
op.bf_Cap_Head_Height = 12.0 / 1000.0
op.bf_Cap_Head_Dia = 18.5 / 1000.0
op.bf_Dome_Head_Dia = 24.0 / 1000.0