WIP for hypocycloid disk creation

This commit is contained in:
bevin
2020-08-25 21:47:30 +02:00
committed by lorenz
parent beb484ea64
commit 933d962dc6
4 changed files with 82 additions and 2 deletions

View File

@@ -23,7 +23,7 @@ import os
import FreeCAD
import FreeCADGui as Gui
from .features import ViewProviderGear, InvoluteGear, InvoluteGearRack
from .features import CycloideGear, BevelGear, CrownGear, WormGear, TimingGear, LanternGear
from .features import CycloideGear, BevelGear, CrownGear, WormGear, TimingGear, LanternGear, HypoCycloidGear
class BaseCommand(object):
@@ -110,6 +110,13 @@ class CreateBevelGear(BaseCommand):
MenuText = 'Bevel gear'
ToolTip = 'Create a Bevel gear'
class CreateHypoCycloidGear(BaseCommand):
NAME = "hypocycloidgear"
GEAR_FUNCTION = HypoCycloidGear
Pixmap = os.path.join(BaseCommand.ICONDIR, 'hypocycloidgear.svg')
MenuText = 'HypoCycloid gear'
ToolTip = 'Create a HypoCycloid gear with its pins'
class CreateWormGear(BaseCommand):
NAME = "wormgear"

View File

@@ -943,7 +943,35 @@ class LanternGear(object):
def __setstate__(self, state):
pass
class HypoCycloidGear(object):
"""parameters:
pressure_angle: pressureangle, 10-30°
pitch_angle: cone angle, 0 < pitch_angle < pi/4
"""
def __init__(self, obj):
obj.addProperty("App::PropertyFloat","pin_circle_diameter", "gear_parameter","Pin bold circle diameter(overrides Tooth Pitch")
obj.addProperty("App::PropertyFloat","roller_diameter", "gear_parameter","Roller Diameter")
obj.addProperty("App::PropertyFloat","eccentricity", "gear_parameter","Eccentricity")
obj.addProperty("App::PropertyAngle","pressure_angle_lim", "gear_parameter","Pressure angle limit")
obj.addProperty("App::PropertyFloat","pressure_angle_offset", "gear_parameter","Offset in pressure angle")
obj.addProperty("App::PropertyInteger","teeth_number", "gear_parameter","Number of teeth in Cam")
obj.addProperty(
"App::PropertyLength", "height", "gear_parameter", "height")
obj.pin_circle_diameter = 92
obj.roller_diameter = 6
obj.eccentricity = 3
obj.pressure_angle_lim = '50.0 deg'
obj.pressure_angle_offset = 0.01
obj.teeth_number = 20
obj.height = '5. mm'
self.obj = obj
obj.Proxy = self
def execute(self, fp):
def part_arc_from_points_and_center(p_1, p_2, m):
p_1, p_12, p_2 = arc_from_points_and_center(p_1, p_2, m)

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="236.000000pt" height="236.000000pt" viewBox="0 0 236.000000 236.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.16, written by Peter Selinger 2001-2019
</metadata>
<g transform="translate(0.000000,236.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M686 2225 c-56 -52 -19 -145 59 -145 49 0 85 36 85 85 0 76 -87 113
-144 60z"/>
<path d="M1502 2230 c-85 -79 26 -202 114 -126 59 50 22 146 -56 146 -23 0
-44 -8 -58 -20z"/>
<path d="M1078 2167 c-55 -16 -107 -53 -145 -105 -41 -55 -82 -91 -137 -119
-41 -21 -66 -26 -145 -28 -154 -4 -228 -43 -281 -149 -35 -69 -39 -128 -14
-214 20 -69 15 -162 -14 -218 -11 -22 -39 -62 -61 -89 -57 -69 -84 -145 -75
-209 15 -111 68 -179 180 -231 116 -53 168 -119 199 -251 9 -38 27 -87 40
-110 72 -122 232 -159 370 -83 50 28 72 33 141 37 79 4 85 3 171 -37 74 -34
101 -41 149 -41 136 1 238 92 265 238 23 121 87 198 212 256 106 49 167 138
167 242 0 61 -30 134 -78 191 -79 93 -106 208 -72 308 36 106 1 230 -82 298
-59 47 -97 58 -210 62 -125 4 -184 29 -248 105 -71 83 -105 115 -142 133 -49
23 -134 29 -190 14z m159 -347 c206 -26 390 -155 482 -338 50 -100 72 -188 72
-295 0 -114 -14 -178 -64 -282 -52 -108 -122 -188 -221 -254 -88 -58 -109 -67
-210 -91 -464 -112 -883 317 -766 782 64 253 275 444 528 477 95 12 89 12 179
1z"/>
<path d="M129 1665 c-15 -8 -32 -28 -37 -45 -27 -75 49 -141 119 -105 57 30
66 90 20 136 -32 32 -62 36 -102 14z"/>
<path d="M2088 1663 c-34 -21 -51 -65 -38 -96 19 -46 38 -60 81 -60 82 0 118
86 60 144 -33 33 -63 36 -103 12z"/>
<path d="M133 854 c-45 -22 -59 -66 -36 -113 31 -63 103 -67 146 -9 28 38 17
92 -26 118 -38 24 -43 24 -84 4z"/>
<path d="M2110 863 c-52 -19 -76 -70 -56 -118 25 -60 84 -72 135 -29 49 41 40
108 -19 139 -31 16 -36 17 -60 8z"/>
<path d="M686 264 c-35 -35 -35 -86 -1 -119 33 -34 87 -34 120 0 54 53 16 145
-58 145 -24 0 -42 -8 -61 -26z"/>
<path d="M1513 278 c-72 -35 -41 -158 41 -158 67 0 110 63 81 120 -25 48 -72
62 -122 38z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -46,7 +46,8 @@ class GearWorkbench(Workbench):
"CreateCrownGear",
"CreateWormGear",
"CreateTimingGear",
"CreateLanternGear"]
"CreateLanternGear",
"CreateHypoCycloidGear"]
def GetClassName(self):
return "Gui::PythonWorkbench"
@@ -55,6 +56,8 @@ class GearWorkbench(Workbench):
from .commands import CreateCycloideGear, CreateInvoluteGear
from .commands import CreateBevelGear, CreateInvoluteRack, CreateCrownGear
from .commands import CreateWormGear, CreateTimingGear, CreateLanternGear
from .commands import CreateHypoCycloidGear
self.appendToolbar("Gear", self.commands)
self.appendMenu("Gear", self.commands)
# Gui.addIconPath(App.getHomePath()+"Mod/gear/icons/")
@@ -66,6 +69,7 @@ class GearWorkbench(Workbench):
Gui.addCommand('CreateWormGear', CreateWormGear())
Gui.addCommand('CreateTimingGear', CreateTimingGear())
Gui.addCommand('CreateLanternGear', CreateLanternGear())
Gui.addCommand('CreateHypoCycloidGear', CreateHypoCycloidGear())
def Activated(self):
pass