From 1e6c3a006452d4bb72005416440b09e3e35659bb Mon Sep 17 00:00:00 2001 From: sw-tya Date: Mon, 19 Aug 2024 00:15:12 +0100 Subject: [PATCH 1/2] Fix for #1: Contersink Head angle vs nominal size --- source/createMesh.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/createMesh.py b/source/createMesh.py index 83d4355..42e03c4 100644 --- a/source/createMesh.py +++ b/source/createMesh.py @@ -788,8 +788,14 @@ def Create_CounterSink_Head(HOLE_DIA, HEAD_DIA, SHANK_DIA, HEIGHT, RAD1, DIV_COU faces = [] Row = 0 - # HEAD_RADIUS = (HEIGHT/tan(radians(60))) + SHANK_RADIUS - HEIGHT = tan(radians(60)) * (HEAD_RADIUS - SHANK_RADIUS) + # 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 FaceStart = len(verts) -- 2.30.2 From adf1991c776f12838c11b44ed6e8faabdb5cfaac Mon Sep 17 00:00:00 2001 From: sw-tya Date: Wed, 21 Aug 2024 22:47:51 +0100 Subject: [PATCH 2/2] Fix for #1: Contersink Head angle via GUI --- source/Boltfactory.py | 10 ++++++++++ source/createMesh.py | 13 ++++--------- source/presets/operator/mesh.bolt_add/_default.py | 1 + source/presets/operator/mesh.bolt_add/_m3.py | 1 + source/presets/operator/mesh.bolt_add/_m4.py | 1 + source/presets/operator/mesh.bolt_add/_m5.py | 1 + source/presets/operator/mesh.bolt_add/_m6.py | 1 + source/presets/operator/mesh.bolt_add/_m8.py | 1 + source/presets/operator/mesh.bolt_add/m10.py | 1 + source/presets/operator/mesh.bolt_add/m12.py | 1 + 10 files changed, 22 insertions(+), 9 deletions(-) diff --git a/source/Boltfactory.py b/source/Boltfactory.py index 5c3c99f..cb73eb9 100644 --- a/source/Boltfactory.py +++ b/source/Boltfactory.py @@ -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", diff --git a/source/createMesh.py b/source/createMesh.py index 46d30cd..5522461 100644 --- a/source/createMesh.py +++ b/source/createMesh.py @@ -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) @@ -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 ) diff --git a/source/presets/operator/mesh.bolt_add/_default.py b/source/presets/operator/mesh.bolt_add/_default.py index f0f29de..8902af0 100644 --- a/source/presets/operator/mesh.bolt_add/_default.py +++ b/source/presets/operator/mesh.bolt_add/_default.py @@ -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 diff --git a/source/presets/operator/mesh.bolt_add/_m3.py b/source/presets/operator/mesh.bolt_add/_m3.py index f0f29de..8902af0 100644 --- a/source/presets/operator/mesh.bolt_add/_m3.py +++ b/source/presets/operator/mesh.bolt_add/_m3.py @@ -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 diff --git a/source/presets/operator/mesh.bolt_add/_m4.py b/source/presets/operator/mesh.bolt_add/_m4.py index 8513f9f..aa7548b 100644 --- a/source/presets/operator/mesh.bolt_add/_m4.py +++ b/source/presets/operator/mesh.bolt_add/_m4.py @@ -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 diff --git a/source/presets/operator/mesh.bolt_add/_m5.py b/source/presets/operator/mesh.bolt_add/_m5.py index 1a43a52..62e3917 100644 --- a/source/presets/operator/mesh.bolt_add/_m5.py +++ b/source/presets/operator/mesh.bolt_add/_m5.py @@ -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 diff --git a/source/presets/operator/mesh.bolt_add/_m6.py b/source/presets/operator/mesh.bolt_add/_m6.py index 33d82d7..4587d59 100644 --- a/source/presets/operator/mesh.bolt_add/_m6.py +++ b/source/presets/operator/mesh.bolt_add/_m6.py @@ -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 diff --git a/source/presets/operator/mesh.bolt_add/_m8.py b/source/presets/operator/mesh.bolt_add/_m8.py index 8f7bb49..dac570c 100644 --- a/source/presets/operator/mesh.bolt_add/_m8.py +++ b/source/presets/operator/mesh.bolt_add/_m8.py @@ -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 diff --git a/source/presets/operator/mesh.bolt_add/m10.py b/source/presets/operator/mesh.bolt_add/m10.py index faf892a..fbe9ba7 100644 --- a/source/presets/operator/mesh.bolt_add/m10.py +++ b/source/presets/operator/mesh.bolt_add/m10.py @@ -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 diff --git a/source/presets/operator/mesh.bolt_add/m12.py b/source/presets/operator/mesh.bolt_add/m12.py index 8ffc693..43e6816 100644 --- a/source/presets/operator/mesh.bolt_add/m12.py +++ b/source/presets/operator/mesh.bolt_add/m12.py @@ -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 -- 2.30.2