[Bf-extensions-cvs] [c4b7c508] master: Added 12 point head
Aaron Keith
noreply at git.blender.org
Wed Apr 22 23:11:15 CEST 2020
Commit: c4b7c508b92554bfcc30f65dd33516926be7aff2
Author: Aaron Keith
Date: Thu Apr 23 09:10:48 2020 +1200
Branches: master
https://developer.blender.org/rBAc4b7c508b92554bfcc30f65dd33516926be7aff2
Added 12 point head
===================================================================
M add_mesh_BoltFactory/Boltfactory.py
M add_mesh_BoltFactory/createMesh.py
M presets/operator/mesh.bolt_add/default.py
M presets/operator/mesh.bolt_add/m10.py
M presets/operator/mesh.bolt_add/m12.py
M presets/operator/mesh.bolt_add/m3.py
M presets/operator/mesh.bolt_add/m4.py
M presets/operator/mesh.bolt_add/m5.py
M presets/operator/mesh.bolt_add/m6.py
M presets/operator/mesh.bolt_add/m8.py
===================================================================
diff --git a/add_mesh_BoltFactory/Boltfactory.py b/add_mesh_BoltFactory/Boltfactory.py
index 4ade3da0..acfe5886 100644
--- a/add_mesh_BoltFactory/Boltfactory.py
+++ b/add_mesh_BoltFactory/Boltfactory.py
@@ -60,6 +60,7 @@ 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'),
@@ -83,7 +84,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_Lock', 'LOCK', 'Lock Nut'),
+ ('bf_Nut_12Pnt', '12 POINT', '12 Point Nut')]
bf_Nut_Type: EnumProperty(
attr='bf_Nut_Type',
name='Nut Type',
@@ -169,6 +171,29 @@ class add_mesh_bolt(Operator, AddObjectHelper):
description='Flat Distance of the Hex Head',
unit='LENGTH',
)
+ bf_12_Point_Head_Height: FloatProperty(
+ attr='bf_12_Point_Head_Height',
+ name='Head Height', default=3.0,
+ min=0, soft_min=0, max=MAX_INPUT_NUMBER,
+ description='Height of the 12 Point Head',
+ unit='LENGTH',
+ )
+ 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
+ max=MAX_INPUT_NUMBER,
+ description='Flat Distance of the 12 Point Head',
+ unit='LENGTH',
+ )
+ bf_12_Point_Head_Flange_Dia: FloatProperty(
+ attr='bf_12_Point_Head_Flange_Dia',
+ name='12 Point Head Flange Dia', default=5.5,
+ min=0, soft_min=0,
+ max=MAX_INPUT_NUMBER,
+ description='Flange diameter of the 12 point Head',
+ unit='LENGTH',
+ )
bf_CounterSink_Head_Dia: FloatProperty(
attr='bf_CounterSink_Head_Dia',
name='Head Dia', default=6.300000190734863,
@@ -290,7 +315,31 @@ class add_mesh_bolt(Operator, AddObjectHelper):
description='Flat distance of the Hex Nut',
unit='LENGTH',
)
-
+ bf_12_Point_Nut_Height: FloatProperty(
+ attr='bf_12_Point_Nut_Height',
+ name='12 Point Nut Height', default=2.4000000953674316,
+ min=0, soft_min=0,
+ max=MAX_INPUT_NUMBER,
+ description='Height of the 12 Point Nut',
+ unit='LENGTH',
+ )
+
+ bf_12_Point_Nut_Flat_Distance: FloatProperty(
+ attr='bf_12_Point_Nut_Flat_Distance',
+ name='12 Point Nut Flat Dist', default=3.0,
+ 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 Nut',
+ unit='LENGTH',
+ )
+ bf_12_Point_Nut_Flange_Dia: FloatProperty(
+ attr='bf_12_Point_Nut_Flange_Dia',
+ name='12 Point Nut Flange Dia', default=5.5,
+ min=0, soft_min=0,
+ max=MAX_INPUT_NUMBER,
+ description='Flange diameter of the 12 point Nut',
+ unit='LENGTH',
+ )
def draw(self, context):
layout = self.layout
col = layout.column()
@@ -307,6 +356,9 @@ class add_mesh_bolt(Operator, AddObjectHelper):
elif self.bf_Bit_Type == 'bf_Bit_Allen':
col.prop(self, 'bf_Allen_Bit_Depth')
col.prop(self, 'bf_Allen_Bit_Flat_Distance')
+ elif self.bf_Bit_Type == 'bf_Bit_Torx':
+ col.prop(self, 'bf_Torx_Bit_Depth')
+ col.prop(self, 'bf_Torx_Size_Type')
elif self.bf_Bit_Type == 'bf_Bit_Philips':
col.prop(self, 'bf_Phillips_Bit_Depth')
col.prop(self, 'bf_Philips_Bit_Dia')
@@ -317,6 +369,10 @@ class add_mesh_bolt(Operator, AddObjectHelper):
if 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':
+ col.prop(self, 'bf_12_Point_Head_Height')
+ col.prop(self, 'bf_12_Point_Head_Flat_Distance')
+ col.prop(self, 'bf_12_Point_Head_Flange_Dia')
elif self.bf_Head_Type == 'bf_Head_Cap':
col.prop(self, 'bf_Cap_Head_Height')
col.prop(self, 'bf_Cap_Head_Dia')
@@ -336,8 +392,16 @@ class add_mesh_bolt(Operator, AddObjectHelper):
# Nut
if self.bf_Model_Type == 'bf_Model_Nut':
col.prop(self, 'bf_Nut_Type')
- col.prop(self, 'bf_Hex_Nut_Height')
- col.prop(self, 'bf_Hex_Nut_Flat_Distance')
+ if self.bf_Nut_Type == "bf_Nut_12Pnt":
+ col.prop(self, 'bf_12_Point_Nut_Height')
+ col.prop(self, 'bf_12_Point_Nut_Flat_Distance')
+ col.prop(self, 'bf_12_Point_Nut_Flange_Dia')
+ else:
+ 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':
diff --git a/add_mesh_BoltFactory/createMesh.py b/add_mesh_BoltFactory/createMesh.py
index c9e5c665..96284012 100644
--- a/add_mesh_BoltFactory/createMesh.py
+++ b/add_mesh_BoltFactory/createMesh.py
@@ -20,10 +20,11 @@ import bpy
from mathutils import (
Matrix,
Vector,
+ geometry,
)
from math import (
sin, cos,
- tan, radians,
+ tan, radians,atan,degrees
)
from random import triangular
from bpy_extras.object_utils import AddObjectHelper, object_data_add
@@ -66,7 +67,7 @@ def unpack_face_list(list_of_tuples):
"""
Remove Doubles takes a list on Verts and a list of Faces and
removes the doubles, much like Blender does in edit mode.
-It doesn’t have the range function but it will round the corrdinates
+It doesn't have the range function but it will round the corrdinates
and remove verts that are very close together. The function
is useful because you can perform a "Remove Doubles" with out
having to enter Edit Mode. Having to enter edit mode has the
@@ -1072,6 +1073,280 @@ def Create_Hex_Head(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT):
return Spin_Verts, Spin_Faces, 0 - (-HEIGHT)
+
+def Create_12_Point(FLAT, HOLE_DIA, SHANK_DIA, HEIGHT,FLANGE_DIA):
+ FLANGE_HEIGHT = (1.89/8.0)*HEIGHT
+ FLAT_HEIGHT = (4.18/8.0)*HEIGHT
+# FLANGE_DIA = (13.27/8.0)*FLAT
+
+ FLANGE_RADIUS = FLANGE_DIA * 0.5
+ FLANGE_TAPPER_HEIGHT = HEIGHT - FLANGE_HEIGHT - FLAT_HEIGHT
+
+# HOLE_DIA = 0.0
+
+ verts = []
+ faces = []
+ HOLE_RADIUS = HOLE_DIA / 2
+ Half_Flat = FLAT / 2
+ TopBevelRadius = Half_Flat - (Half_Flat * (0.05 / 8))
+# Undercut_Height = (Half_Flat * (0.05 / 8))
+# Shank_Bevel = (Half_Flat * (0.05 / 8))
+# Flat_Height = HEIGHT - Undercut_Height - Shank_Bevel
+ # Undercut_Height = 5
+ SHANK_RADIUS = SHANK_DIA / 2
+ Row = 0
+
+ verts.append([0.0, 0.0, 0.0])
+
+# print("HOLE_RADIUS" + str(HOLE_RADIUS))
+# print("TopBevelRadius" + str(TopBevelRadius))
+
+ FaceStart = len(verts)
+
+ # inner hole
+ x = sin(radians(0)) * HOLE_RADIUS
+ y = cos(radians(0)) * HOLE_RADIUS
+ verts.append([x, y, 0.0])
+
+ x = sin(radians(5)) * HOLE_RADIUS
+ y = cos(radians(5)) * HOLE_RADIUS
+ verts.append([x, y, 0.0])
+
+ x = sin(radians(10)) * HOLE_RADIUS
+ y = cos(radians(10)) * HOLE_RADIUS
+ verts.append([x, y, 0.0])
+
+ x = sin(radians(15)) * HOLE_RADIUS
+ y = cos(radians(15)) * HOLE_RADIUS
+ verts.append([x, y, 0.0])
+
+ x = sin(radians(20)) * HOLE_RADIUS
+ y = cos(radians(20)) * HOLE_RADIUS
+ verts.append([x, y, 0.0])
+
+ x = sin(radians(25)) * HOLE_RADIUS
+ y = cos(radians(25)) * HOLE_RADIUS
+ verts.append([x, y, 0.0])
+
+ x = sin(radians(30)) * HOLE_RADIUS
+ y = cos(radians(30)) * HOLE_RADIUS
+ verts.append([x, y, 0.0])
+
+ Row += 1
+
+
+
+ # bevel
+ x = sin(radians(0)) * TopBevelRadius
+ y = cos(radians(0)) * TopBevelRadius
+ vec1 = Vector([x, y, 0.0])
+ verts.append([x, y, 0.0])
+
+ x = sin(radians(5)) * TopBevelRadius
+ y = cos(radians(5)) * TopBevelRadius
+ vec2 = Vector([x, y, 0.0])
+ verts.append([x, y, 0.0])
+
+ x = sin(radians(10)) * TopBevelRadius
+ y = cos(radians(10)) * TopBevelRadius
+ vec3 = Vector([x, y, 0.0])
+ verts.append([x, y, 0.0])
+
+ x = sin(radians(15)) * TopBevelRadius
+ y = cos(radians(15)) * TopBevelRadius
+ vec4 = Vector([x, y, 0.0])
+ verts.append([x, y, 0.0])
+
+ x = sin(radians(20)) * TopBevelRadius
+ y = cos(radians(20)) * TopBevelRadius
+ vec5 = Vector([x, y, 0.0])
+ verts.append([x, y, 0.0])
+
+ x = sin(radians(25)) * TopBevelRadius
+ y = cos(radians(25)) * TopBevelRadius
+ vec6 = Vector([x, y, 0.0])
+ verts.append([x, y, 0.0])
+
+ x = sin(radians(30)) * TopBevelRadius
+ y = cos(radians(30)) * TopBevelRadius
+ vec7 = Vector([x, y, 0.0])
+ verts.append([x, y, 0.0])
+
+ Row += 1
+
+
+ #45Deg bevel on the top
+
+ #First we work out how far up the Y axis the vert is
+ v_origin = Vector([0.0,0.0,0.0]) # center of the model
+ v_15Deg_Point = Vector([tan(radians(15)) * Half_Flat,Half_Flat,0.0]) #Is a know point to work back from
+
+ x = tan(radians(0)) * Half_Flat
+ Point_Distance =(tan(radians(30)) * v_15Deg_Point.x)+Half_Flat
+ dvec = vec1 - Vector([x, Point_Distance, 0.0])
+ verts.append([x, Point_Distance, -dvec.length])
+ v_0_Deg_Top_Point = Vector([x, Point_Distance, -dvec.length])
+
+ v_0_Deg_Point = Vector([x, Point_Distance,0.0])
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list