[Bf-extensions-cvs] [4fc5558f] master: Addon: Mesh Extra Objects: Removed limiters in Gear and WormGear

Spivak Vladimir cwolf3d noreply at git.blender.org
Thu Sep 19 23:50:47 CEST 2019


Commit: 4fc5558f68a3d514c40f1e2d36524e9f51f85fc3
Author: Spivak Vladimir (cwolf3d)
Date:   Fri Sep 20 00:49:59 2019 +0300
Branches: master
https://developer.blender.org/rBA4fc5558f68a3d514c40f1e2d36524e9f51f85fc3

Addon: Mesh Extra Objects: Removed limiters in Gear and WormGear

===================================================================

M	add_mesh_extra_objects/add_mesh_gears.py

===================================================================

diff --git a/add_mesh_extra_objects/add_mesh_gears.py b/add_mesh_extra_objects/add_mesh_gears.py
index 0ccc265d..e92857b8 100644
--- a/add_mesh_extra_objects/add_mesh_gears.py
+++ b/add_mesh_extra_objects/add_mesh_gears.py
@@ -123,7 +123,10 @@ def add_tooth(a, t, d, radius, Ad, De, base, p_angle, rack=0, crown=0.0):
 
     # Pressure angle calc
     O = Ad * tan(p_angle)
-    p_angle = atan(O / Ra)
+    if Ra != 0:
+        p_angle = atan(O / Ra)
+    else:
+        p_angle = atan(O)
 
     if radius < 0:
         p_angle = -p_angle
@@ -250,7 +253,10 @@ def add_gear(teethNum, radius, Ad, De, base, p_angle,
         teethNum = 1
 
     #print(radius, width, conangle)
-    scale = (radius - 2 * width * tan(conangle)) / radius
+    if radius != 0:
+        scale = (radius - 2 * width * tan(conangle)) / radius
+    else:
+        scale = radius - 2 * width * tan(conangle)
 
     verts = []
     faces = []
@@ -580,69 +586,69 @@ class AddGear(Operator):
     number_of_teeth: IntProperty(name="Number of Teeth",
             description="Number of teeth on the gear",
             min=2,
-            max=265,
+            #max=265,
             default=12
             )
     radius: FloatProperty(name="Radius",
             description="Radius of the gear, negative for crown gear",
-            min=-100.0,
-            max=100.0,
+            #min=-100.0,
+            #max=100.0,
             unit='LENGTH',
             default=1.0
             )
     addendum: FloatProperty(name="Addendum",
             description="Addendum, extent of tooth above radius",
-            min=0.01,
-            max=100.0,
+            #min=0.0,
+            #max=100.0,
             unit='LENGTH',
             default=0.1
             )
     dedendum: FloatProperty(name="Dedendum",
             description="Dedendum, extent of tooth below radius",
-            min=0.0,
-            max=100.0,
+            #min=0.0,
+            #max=100.0,
             unit='LENGTH',
             default=0.1
             )
     angle: FloatProperty(name="Pressure Angle",
             description="Pressure angle, skewness of tooth tip",
-            min=0.0,
-            max=radians(45.0),
+            #min=0.0,
+            #max=radians(45.0),
             unit='ROTATION',
             default=radians(20.0)
             )
     base: FloatProperty(name="Base",
             description="Base, extent of gear below radius",
-            min=0.0,
-            max=100.0,
+            #min=0.0,
+            #max=100.0,
             unit='LENGTH',
             default=0.2
             )
     width: FloatProperty(name="Width",
             description="Width, thickness of gear",
-            min=0.05,
-            max=100.0,
+            #min=0.0,
+            #max=100.0,
             unit='LENGTH',
             default=0.2
             )
     skew: FloatProperty(name="Skewness",
             description="Skew of teeth",
-            min=radians(-90.0),
-            max=radians(90.0),
+            #min=radians(-90.0),
+            #max=radians(90.0),
             unit='ROTATION',
             default=radians(0.0)
             )
     conangle: FloatProperty(name="Conical angle",
             description="Conical angle of gear",
-            min=0.0,
-            max=radians(90.0),
+            #min=0.0,
+            #max=radians(90.0),
             unit='ROTATION',
             default=radians(0.0)
             )
     crown: FloatProperty(name="Crown",
             description="Inward pointing extend of crown teeth",
-            min=0.0,
-            max=100.0,
+            #min=0.0,
+            #max=100.0,
             unit='LENGTH',
             default=0.0
             )
@@ -780,70 +786,70 @@ class AddWormGear(Operator):
     number_of_teeth: IntProperty(
             name="Number of Teeth",
             description="Number of teeth on the gear",
-            min=2,
-            max=265,
+            min=1,
+            #max=265,
             default=12
             )
     number_of_rows: IntProperty(
             name="Number of Rows",
             description="Number of rows on the worm gear",
-            min=2,
-            max=265,
+            min=0,
+            #max=265,
             default=32
             )
     radius: FloatProperty(
             name="Radius",
             description="Radius of the gear, negative for crown gear",
-            min=-100.0,
-            max=100.0,
+            #min=-100.0,
+            #max=100.0,
             unit='LENGTH',
             default=1.0
             )
     addendum: FloatProperty(
             name="Addendum",
             description="Addendum, extent of tooth above radius",
-            min=0.01,
-            max=100.0,
+            #min=0.01,
+            #max=100.0,
             unit='LENGTH',
             default=0.1
             )
     dedendum: FloatProperty(
             name="Dedendum",
             description="Dedendum, extent of tooth below radius",
-            min=0.0,
-            max=100.0,
+            #min=0.0,
+            #max=100.0,
             unit='LENGTH',
             default=0.1
             )
     angle: FloatProperty(
             name="Pressure Angle",
             description="Pressure angle, skewness of tooth tip",
-            min=0.0,
-            max=radians(45.0),
+            #min=0.0,
+            #max=radians(45.0),
             default=radians(20.0),
             unit='ROTATION'
             )
     row_height: FloatProperty(
             name="Row Height",
             description="Height of each Row",
-            min=0.05,
-            max=100.0,
+            #min=0.05,
+            #max=100.0,
             unit='LENGTH',
             default=0.2
             )
     skew: FloatProperty(
             name="Skewness per Row",
             description="Skew of each row",
-            min=radians(-90.0),
-            max=radians(90.0),
+            #min=radians(-90.0),
+            #max=radians(90.0),
             default=radians(11.25),
             unit='ROTATION'
             )
     crown: FloatProperty(
             name="Crown",
             description="Inward pointing extend of crown teeth",
-            min=0.0,
-            max=100.0,
+            #min=0.0,
+            #max=100.0,
             unit='LENGTH',
             default=0.0
             )



More information about the Bf-extensions-cvs mailing list