Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1c80bd963 | ||
|
|
109df352a9 | ||
|
|
165f1a0aea | ||
|
|
8258477645 | ||
|
|
6ce203ea8f | ||
|
|
69ff30d65e | ||
|
|
3c86d12dc7 | ||
|
|
d489dfb841 | ||
|
|
1b19d16264 | ||
|
|
d5e12ef116 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -59,3 +59,6 @@ target/
|
|||||||
.ipynb_checkpoints/
|
.ipynb_checkpoints/
|
||||||
results/
|
results/
|
||||||
*.vtk
|
*.vtk
|
||||||
|
|
||||||
|
# VIM
|
||||||
|
*.swp
|
||||||
|
|||||||
@@ -26,10 +26,6 @@ __python > 3 (for python2 use branch py2)__
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Cycloid Rack
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Spherical Involute Bevel-Gear
|
### Spherical Involute Bevel-Gear
|
||||||
* Spiral
|
* Spiral
|
||||||
|
|
||||||
|
|||||||
6
TODO.md
6
TODO.md
@@ -1,6 +0,0 @@
|
|||||||
#TODO:
|
|
||||||
|
|
||||||
## refactoring
|
|
||||||
|
|
||||||
- [ ] fp.gear.z -> fp.gear.num_teeth
|
|
||||||
- [ ] fp.teeth -> fp.gear.num_teeth
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 188 KiB |
@@ -1,18 +1,21 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
# * *
|
# * *
|
||||||
# * This program is free software: you can redistribute it and/or modify *
|
# * This program is free software; you can redistribute it and/or modify *
|
||||||
# * it under the terms of the GNU General Public License as published by *
|
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||||
# * the Free Software Foundation, either version 3 of the License, or *
|
# * as published by the Free Software Foundation; either version 2 of *
|
||||||
# * (at your option) any later version. *
|
# * the License, or (at your option) any later version. *
|
||||||
|
# * for detail see the LICENCE text file. *
|
||||||
# * *
|
# * *
|
||||||
# * This program is distributed in the hope that it will be useful, *
|
# * This program is distributed in the hope that it will be useful, *
|
||||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
# * GNU General Public License for more details. *
|
# * GNU Library General Public License for more details. *
|
||||||
# * *
|
# * *
|
||||||
# * You should have received a copy of the GNU General Public License *
|
# * You should have received a copy of the GNU Library General Public *
|
||||||
# * along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
# * License along with this program; if not, write to the Free Software *
|
||||||
|
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||||
|
# * USA *
|
||||||
# * *
|
# * *
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
|
|
||||||
|
|||||||
@@ -1,27 +1,29 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
# * *
|
# * *
|
||||||
# * This program is free software: you can redistribute it and/or modify *
|
# * This program is free software; you can redistribute it and/or modify *
|
||||||
# * it under the terms of the GNU General Public License as published by *
|
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||||
# * the Free Software Foundation, either version 3 of the License, or *
|
# * as published by the Free Software Foundation; either version 2 of *
|
||||||
# * (at your option) any later version. *
|
# * the License, or (at your option) any later version. *
|
||||||
|
# * for detail see the LICENCE text file. *
|
||||||
# * *
|
# * *
|
||||||
# * This program is distributed in the hope that it will be useful, *
|
# * This program is distributed in the hope that it will be useful, *
|
||||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
# * GNU General Public License for more details. *
|
# * GNU Library General Public License for more details. *
|
||||||
# * *
|
# * *
|
||||||
# * You should have received a copy of the GNU General Public License *
|
# * You should have received a copy of the GNU Library General Public *
|
||||||
# * along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
# * License along with this program; if not, write to the Free Software *
|
||||||
|
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||||
|
# * USA *
|
||||||
# * *
|
# * *
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import FreeCAD
|
import FreeCAD
|
||||||
import FreeCADGui as Gui
|
import FreeCADGui as Gui
|
||||||
from .features import ViewProviderGear, InvoluteGear, InternalInvoluteGear, InvoluteGearRack, CycloidGearRack
|
from .features import ViewProviderGear, InvoluteGear, InvoluteGearRack
|
||||||
from .features import CycloidGear, BevelGear, CrownGear, WormGear, TimingGear, LanternGear, HypoCycloidGear, BaseGear
|
from .features import CycloidGear, BevelGear, CrownGear, WormGear, TimingGear, LanternGear, HypoCycloidGear
|
||||||
from .connector import GearConnector, ViewProviderGearConnector
|
|
||||||
|
|
||||||
|
|
||||||
class BaseCommand(object):
|
class BaseCommand(object):
|
||||||
@@ -39,10 +41,13 @@ class BaseCommand(object):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def Activated(self):
|
def Activated(self):
|
||||||
|
doc = FreeCAD.ActiveDocument
|
||||||
Gui.doCommandGui("import freecad.gears.commands")
|
Gui.doCommandGui("import freecad.gears.commands")
|
||||||
|
doc.openTransaction(self.ToolTip)
|
||||||
Gui.doCommandGui("freecad.gears.commands.{}.create()".format(
|
Gui.doCommandGui("freecad.gears.commands.{}.create()".format(
|
||||||
self.__class__.__name__))
|
self.__class__.__name__))
|
||||||
FreeCAD.ActiveDocument.recompute()
|
doc.commitTransaction()
|
||||||
|
doc.recompute()
|
||||||
Gui.SendMsgToActiveView("ViewFit")
|
Gui.SendMsgToActiveView("ViewFit")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -57,7 +62,7 @@ class BaseCommand(object):
|
|||||||
obj = FreeCAD.ActiveDocument.addObject("PartDesign::FeaturePython", cls.NAME)
|
obj = FreeCAD.ActiveDocument.addObject("PartDesign::FeaturePython", cls.NAME)
|
||||||
else:
|
else:
|
||||||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", cls.NAME)
|
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", cls.NAME)
|
||||||
ViewProviderGear(obj.ViewObject, cls.Pixmap)
|
ViewProviderGear(obj.ViewObject)
|
||||||
cls.GEAR_FUNCTION(obj)
|
cls.GEAR_FUNCTION(obj)
|
||||||
|
|
||||||
if body:
|
if body:
|
||||||
@@ -76,108 +81,70 @@ class BaseCommand(object):
|
|||||||
|
|
||||||
|
|
||||||
class CreateInvoluteGear(BaseCommand):
|
class CreateInvoluteGear(BaseCommand):
|
||||||
NAME = "InvoluteGear"
|
NAME = "involutegear"
|
||||||
GEAR_FUNCTION = InvoluteGear
|
GEAR_FUNCTION = InvoluteGear
|
||||||
Pixmap = os.path.join(BaseCommand.ICONDIR, 'involutegear.svg')
|
Pixmap = os.path.join(BaseCommand.ICONDIR, 'involutegear.svg')
|
||||||
MenuText = 'Involute Gear'
|
MenuText = 'Involute gear'
|
||||||
ToolTip = 'Create an external involute gear'
|
ToolTip = 'Create an Involute gear'
|
||||||
|
|
||||||
|
|
||||||
class CreateInternalInvoluteGear(BaseCommand):
|
|
||||||
NAME = "InternalInvoluteGear"
|
|
||||||
GEAR_FUNCTION = InternalInvoluteGear
|
|
||||||
Pixmap = os.path.join(BaseCommand.ICONDIR, 'internalinvolutegear.svg')
|
|
||||||
MenuText = 'Internal Involute Gear'
|
|
||||||
ToolTip = 'Create an internal involute gear'
|
|
||||||
|
|
||||||
|
|
||||||
class CreateInvoluteRack(BaseCommand):
|
class CreateInvoluteRack(BaseCommand):
|
||||||
NAME = "InvoluteRack"
|
NAME = "involuterack"
|
||||||
GEAR_FUNCTION = InvoluteGearRack
|
GEAR_FUNCTION = InvoluteGearRack
|
||||||
Pixmap = os.path.join(BaseCommand.ICONDIR, 'involuterack.svg')
|
Pixmap = os.path.join(BaseCommand.ICONDIR, 'involuterack.svg')
|
||||||
MenuText = 'Involute Rack'
|
MenuText = 'Involute rack'
|
||||||
ToolTip = 'Create an Involute rack'
|
ToolTip = 'Create an Involute rack'
|
||||||
|
|
||||||
class CreateCycloidRack(BaseCommand):
|
|
||||||
NAME = "CycloidRack"
|
|
||||||
GEAR_FUNCTION = CycloidGearRack
|
|
||||||
Pixmap = os.path.join(BaseCommand.ICONDIR, 'cycloidrack.svg')
|
|
||||||
MenuText = 'Cycloid Rack'
|
|
||||||
ToolTip = 'Create an Cycloid rack'
|
|
||||||
|
|
||||||
|
|
||||||
class CreateCrownGear(BaseCommand):
|
class CreateCrownGear(BaseCommand):
|
||||||
NAME = "CrownGear"
|
NAME = "crowngear"
|
||||||
GEAR_FUNCTION = CrownGear
|
GEAR_FUNCTION = CrownGear
|
||||||
Pixmap = os.path.join(BaseCommand.ICONDIR, 'crowngear.svg')
|
Pixmap = os.path.join(BaseCommand.ICONDIR, 'crowngear.svg')
|
||||||
MenuText = 'Crown Gear'
|
MenuText = 'Crown gear'
|
||||||
ToolTip = 'Create a Crown gear'
|
ToolTip = 'Create a Crown gear'
|
||||||
|
|
||||||
|
|
||||||
class CreateCycloidGear(BaseCommand):
|
class CreateCycloidGear(BaseCommand):
|
||||||
NAME = "CycloidGear"
|
NAME = "cycloidgear"
|
||||||
GEAR_FUNCTION = CycloidGear
|
GEAR_FUNCTION = CycloidGear
|
||||||
Pixmap = os.path.join(BaseCommand.ICONDIR, 'cycloidgear.svg')
|
Pixmap = os.path.join(BaseCommand.ICONDIR, 'cycloidgear.svg')
|
||||||
MenuText = 'Cycloid Gear'
|
MenuText = 'Cycloid gear'
|
||||||
ToolTip = 'Create a Cycloid gear'
|
ToolTip = 'Create a Cycloid gear'
|
||||||
|
|
||||||
|
|
||||||
class CreateBevelGear(BaseCommand):
|
class CreateBevelGear(BaseCommand):
|
||||||
NAME = "BevelGear"
|
NAME = "bevelgear"
|
||||||
GEAR_FUNCTION = BevelGear
|
GEAR_FUNCTION = BevelGear
|
||||||
Pixmap = os.path.join(BaseCommand.ICONDIR, 'bevelgear.svg')
|
Pixmap = os.path.join(BaseCommand.ICONDIR, 'bevelgear.svg')
|
||||||
MenuText = 'Bevel Gear'
|
MenuText = 'Bevel gear'
|
||||||
ToolTip = 'Create a Bevel gear'
|
ToolTip = 'Create a Bevel gear'
|
||||||
|
|
||||||
class CreateHypoCycloidGear(BaseCommand):
|
class CreateHypoCycloidGear(BaseCommand):
|
||||||
NAME = "HypocycloidGear"
|
NAME = "hypocycloidgear"
|
||||||
GEAR_FUNCTION = HypoCycloidGear
|
GEAR_FUNCTION = HypoCycloidGear
|
||||||
Pixmap = os.path.join(BaseCommand.ICONDIR, 'hypocycloidgear.svg')
|
Pixmap = os.path.join(BaseCommand.ICONDIR, 'hypocycloidgear.svg')
|
||||||
MenuText = 'HypoCycloid Gear'
|
MenuText = 'HypoCycloid gear'
|
||||||
ToolTip = 'Create a HypoCycloid gear with its pins'
|
ToolTip = 'Create a HypoCycloid gear with its pins'
|
||||||
|
|
||||||
|
|
||||||
class CreateWormGear(BaseCommand):
|
class CreateWormGear(BaseCommand):
|
||||||
NAME = "WormGear"
|
NAME = "wormgear"
|
||||||
GEAR_FUNCTION = WormGear
|
GEAR_FUNCTION = WormGear
|
||||||
Pixmap = os.path.join(BaseCommand.ICONDIR, 'wormgear.svg')
|
Pixmap = os.path.join(BaseCommand.ICONDIR, 'wormgear.svg')
|
||||||
MenuText = 'Worm Gear'
|
MenuText = 'Worm gear'
|
||||||
ToolTip = 'Create a Worm gear'
|
ToolTip = 'Create a Worm gear'
|
||||||
|
|
||||||
|
|
||||||
class CreateTimingGear(BaseCommand):
|
class CreateTimingGear(BaseCommand):
|
||||||
NAME = "TimingGear"
|
NAME = "timinggear"
|
||||||
GEAR_FUNCTION = TimingGear
|
GEAR_FUNCTION = TimingGear
|
||||||
Pixmap = os.path.join(BaseCommand.ICONDIR, 'timinggear.svg')
|
Pixmap = os.path.join(BaseCommand.ICONDIR, 'timinggear.svg')
|
||||||
MenuText = 'Timing Gear'
|
MenuText = 'Timing gear'
|
||||||
ToolTip = 'Create a Timing gear'
|
ToolTip = 'Create a Timing gear'
|
||||||
|
|
||||||
class CreateLanternGear(BaseCommand):
|
class CreateLanternGear(BaseCommand):
|
||||||
NAME = "LanternGear"
|
NAME = "lanterngear"
|
||||||
GEAR_FUNCTION = LanternGear
|
GEAR_FUNCTION = LanternGear
|
||||||
Pixmap = os.path.join(BaseCommand.ICONDIR, 'lanterngear.svg')
|
Pixmap = os.path.join(BaseCommand.ICONDIR, 'lanterngear.svg')
|
||||||
MenuText = 'Lantern Gear'
|
MenuText = 'Lantern gear'
|
||||||
ToolTip = 'Create a Lantern gear'
|
ToolTip = 'Create a Lantern gear'
|
||||||
|
|
||||||
class CreateGearConnector(BaseCommand):
|
|
||||||
NAME = "GearConnector"
|
|
||||||
GEAR_FUNCTION = GearConnector
|
|
||||||
Pixmap = os.path.join(BaseCommand.ICONDIR, 'gearconnector.svg')
|
|
||||||
MenuText = 'Combine two gears'
|
|
||||||
ToolTip = 'Combine two gears'
|
|
||||||
|
|
||||||
def Activated(self):
|
|
||||||
gear1 = Gui.Selection.getSelection()[0]
|
|
||||||
assert isinstance(gear1.Proxy, BaseGear)
|
|
||||||
|
|
||||||
gear2 = Gui.Selection.getSelection()[1]
|
|
||||||
assert isinstance(gear2.Proxy, BaseGear)
|
|
||||||
|
|
||||||
# check if selected objects are beams
|
|
||||||
|
|
||||||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", self.NAME)
|
|
||||||
GearConnector(obj, gear1, gear2)
|
|
||||||
ViewProviderGearConnector(obj.ViewObject)
|
|
||||||
|
|
||||||
FreeCAD.ActiveDocument.recompute()
|
|
||||||
return obj
|
|
||||||
|
|||||||
@@ -1,161 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# ***************************************************************************
|
|
||||||
# * *
|
|
||||||
# * This program is free software: you can redistribute it and/or modify *
|
|
||||||
# * it under the terms of the GNU General Public License as published by *
|
|
||||||
# * the Free Software Foundation, either version 3 of the License, or *
|
|
||||||
# * (at your option) any later version. *
|
|
||||||
# * *
|
|
||||||
# * This program is distributed in the hope that it will be useful, *
|
|
||||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
# * GNU General Public License for more details. *
|
|
||||||
# * *
|
|
||||||
# * You should have received a copy of the GNU General Public License *
|
|
||||||
# * along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
||||||
# * *
|
|
||||||
# ***************************************************************************
|
|
||||||
|
|
||||||
import os
|
|
||||||
import copy
|
|
||||||
import numpy as np
|
|
||||||
import FreeCAD
|
|
||||||
from pygears import __version__
|
|
||||||
from .features import InvoluteGear, CycloidGear, InvoluteGearRack, CycloidGearRack, InternalInvoluteGear
|
|
||||||
from pygears.computation import compute_shifted_gears
|
|
||||||
|
|
||||||
class ViewProviderGearConnector(object):
|
|
||||||
def __init__(self, vobj, icon_fn=None):
|
|
||||||
# Set this object to the proxy object of the actual view provider
|
|
||||||
vobj.Proxy = self
|
|
||||||
dirname = os.path.dirname(__file__)
|
|
||||||
self.icon_fn = icon_fn or os.path.join(dirname, "icons", "gearconnector.svg")
|
|
||||||
|
|
||||||
def attach(self, vobj):
|
|
||||||
self.vobj = vobj
|
|
||||||
|
|
||||||
def getIcon(self):
|
|
||||||
return self.icon_fn
|
|
||||||
|
|
||||||
def __getstate__(self):
|
|
||||||
return {"icon_fn": self.icon_fn}
|
|
||||||
|
|
||||||
def __setstate__(self, state):
|
|
||||||
self.icon_fn = state["icon_fn"]
|
|
||||||
|
|
||||||
|
|
||||||
class GearConnector(object):
|
|
||||||
def __init__(self, obj, master_gear, slave_gear):
|
|
||||||
obj.addProperty("App::PropertyString", "version", "version", "freecad.gears-version", 1)
|
|
||||||
obj.addProperty("App::PropertyLink","master_gear","gear","master gear", 1)
|
|
||||||
obj.addProperty("App::PropertyLink","slave_gear","gear","slave gear", 1)
|
|
||||||
obj.addProperty("App::PropertyAngle", "angle1", "gear", "angle at which second gear is placed", 0)
|
|
||||||
obj.addProperty("App::PropertyAngle", "angle2", "gear", "angle at which second gear is placed", 1)
|
|
||||||
obj.version = __version__
|
|
||||||
obj.master_gear = master_gear
|
|
||||||
obj.slave_gear = slave_gear
|
|
||||||
obj.angle1 = 0
|
|
||||||
obj.angle2 = 0
|
|
||||||
obj.Proxy = self
|
|
||||||
|
|
||||||
def onChanged(self, fp, prop):
|
|
||||||
# fp.angle2 = fp.master_gear.Placement.Rotation.Angle
|
|
||||||
if isinstance(fp.master_gear.Proxy, InvoluteGear) and isinstance(fp.slave_gear.Proxy, InvoluteGear):
|
|
||||||
angle_master = fp.master_gear.Placement.Rotation.Angle * sum(fp.master_gear.Placement.Rotation.Axis)
|
|
||||||
dw_master = fp.master_gear.dw
|
|
||||||
dw_slave = fp.slave_gear.dw
|
|
||||||
dist = (dw_master + dw_slave) / 2
|
|
||||||
if fp.master_gear.shift != 0 or fp.slave_gear.shift != 0:
|
|
||||||
dist, alpha_w = compute_shifted_gears(
|
|
||||||
fp.master_gear.module,
|
|
||||||
np.deg2rad(fp.master_gear.pressure_angle.Value),
|
|
||||||
fp.master_gear.teeth,
|
|
||||||
fp.slave_gear.teeth,
|
|
||||||
fp.master_gear.shift,
|
|
||||||
fp.slave_gear.shift)
|
|
||||||
|
|
||||||
mat0 = FreeCAD.Matrix() # unity matrix
|
|
||||||
trans = FreeCAD.Vector(dist)
|
|
||||||
mat0.move(trans)
|
|
||||||
rot = FreeCAD.Rotation(FreeCAD.Vector(0,0,1), fp.angle1).toMatrix()
|
|
||||||
angle2 = dw_master / dw_slave * fp.angle1.Value
|
|
||||||
angle4 = dw_master / dw_slave * np.rad2deg(angle_master)
|
|
||||||
rot2 = FreeCAD.Rotation(FreeCAD.Vector(0,0,1), angle2).toMatrix()
|
|
||||||
angle3 = abs(fp.slave_gear.teeth % 2 - 1) * 180. / fp.slave_gear.teeth
|
|
||||||
rot3 = FreeCAD.Rotation(FreeCAD.Vector(0,0,1), angle3).toMatrix()
|
|
||||||
rot4 = FreeCAD.Rotation(FreeCAD.Vector(0,0,1), -angle4).toMatrix()
|
|
||||||
mat1 = rot * mat0 * rot2 * rot3 * rot4
|
|
||||||
mat1.move(fp.master_gear.Placement.Base)
|
|
||||||
fp.slave_gear.Placement = mat1
|
|
||||||
|
|
||||||
if isinstance(fp.master_gear.Proxy, InternalInvoluteGear) and isinstance(fp.slave_gear.Proxy, InvoluteGear):
|
|
||||||
angle_master = fp.master_gear.Placement.Rotation.Angle * sum(fp.master_gear.Placement.Rotation.Axis)
|
|
||||||
dw_master = fp.master_gear.dw
|
|
||||||
dw_slave = fp.slave_gear.dw
|
|
||||||
dist = (dw_master - dw_slave) / 2
|
|
||||||
if fp.master_gear.shift != 0 or fp.slave_gear.shift != 0:
|
|
||||||
dist, alpha_w = compute_shifted_gears(
|
|
||||||
fp.master_gear.module,
|
|
||||||
np.deg2rad(fp.master_gear.pressure_angle.Value),
|
|
||||||
fp.master_gear.teeth,
|
|
||||||
fp.slave_gear.teeth,
|
|
||||||
fp.master_gear.shift,
|
|
||||||
fp.slave_gear.shift)
|
|
||||||
|
|
||||||
mat0 = FreeCAD.Matrix() # unity matrix
|
|
||||||
trans = FreeCAD.Vector(dist)
|
|
||||||
mat0.move(trans)
|
|
||||||
rot = FreeCAD.Rotation(FreeCAD.Vector(0,0,1), fp.angle1).toMatrix()
|
|
||||||
angle2 = -dw_master / dw_slave * fp.angle1.Value
|
|
||||||
angle4 = -dw_master / dw_slave * np.rad2deg(angle_master)
|
|
||||||
rot2 = FreeCAD.Rotation(FreeCAD.Vector(0,0,1), angle2).toMatrix()
|
|
||||||
angle3 = abs(fp.slave_gear.teeth % 2 - 1) * 180. / fp.slave_gear.teeth
|
|
||||||
rot3 = FreeCAD.Rotation(FreeCAD.Vector(0,0,1), angle3).toMatrix()
|
|
||||||
rot4 = FreeCAD.Rotation(FreeCAD.Vector(0,0,1), -angle4).toMatrix()
|
|
||||||
mat1 = rot * mat0 * rot2 * rot3 * rot4
|
|
||||||
mat1.move(fp.master_gear.Placement.Base)
|
|
||||||
fp.slave_gear.Placement = mat1
|
|
||||||
|
|
||||||
if ((isinstance(fp.master_gear.Proxy, InvoluteGear) and isinstance(fp.slave_gear.Proxy, InvoluteGearRack))
|
|
||||||
or (isinstance(fp.master_gear.Proxy, CycloidGear) and isinstance(fp.slave_gear.Proxy, CycloidGearRack))):
|
|
||||||
angle_master = fp.master_gear.Placement.Rotation.Angle * sum(fp.master_gear.Placement.Rotation.Axis)
|
|
||||||
dw_master = fp.master_gear.dw.Value
|
|
||||||
dw_slave = 0
|
|
||||||
dist = -(dw_master + dw_slave) / 2
|
|
||||||
mat0 = FreeCAD.Matrix() # unity matrix
|
|
||||||
mat0.move(FreeCAD.Vector(dist, 0, 0))
|
|
||||||
mat1 = FreeCAD.Matrix()
|
|
||||||
mat1.move(FreeCAD.Vector(0, np.deg2rad(fp.angle1.Value) * dw_master / 2, 0))
|
|
||||||
mat2 = FreeCAD.Matrix()
|
|
||||||
mat2.move(FreeCAD.Vector(0, -np.deg2rad(fp.angle2.Value) * dw_master / 2, 0))
|
|
||||||
rot = FreeCAD.Rotation(FreeCAD.Vector(0,0,1), fp.angle1).toMatrix()
|
|
||||||
mat3 = rot * mat2 *mat1 * mat0
|
|
||||||
mat3.move(fp.master_gear.Placement.Base)
|
|
||||||
fp.slave_gear.Placement = mat3
|
|
||||||
|
|
||||||
if isinstance(fp.master_gear.Proxy, CycloidGear) and isinstance(fp.slave_gear.Proxy, CycloidGear):
|
|
||||||
angle_master = fp.master_gear.Placement.Rotation.Angle * sum(fp.master_gear.Placement.Rotation.Axis)
|
|
||||||
dw_master = fp.master_gear.dw
|
|
||||||
dw_slave = fp.slave_gear.dw
|
|
||||||
dist = (dw_master + dw_slave) / 2
|
|
||||||
mat0 = FreeCAD.Matrix() # unity matrix
|
|
||||||
trans = FreeCAD.Vector(dist, 0, 0)
|
|
||||||
mat0.move(trans)
|
|
||||||
rot = FreeCAD.Rotation(FreeCAD.Vector(0,0,1), fp.angle1).toMatrix()
|
|
||||||
angle2 = dw_master / dw_slave * fp.angle1.Value
|
|
||||||
angle4 = dw_master / dw_slave * np.rad2deg(angle_master)
|
|
||||||
rot2 = FreeCAD.Rotation(FreeCAD.Vector(0,0,1), angle2).toMatrix()
|
|
||||||
angle3 = abs(fp.slave_gear.teeth % 2 - 1) * 180. / fp.slave_gear.teeth
|
|
||||||
rot3 = FreeCAD.Rotation(FreeCAD.Vector(0,0,1), angle3).toMatrix()
|
|
||||||
rot4 = FreeCAD.Rotation(FreeCAD.Vector(0,0,1), -angle4).toMatrix()
|
|
||||||
mat1 = rot * mat0 * rot2 * rot3 * rot4
|
|
||||||
mat1.move(fp.master_gear.Placement.Base)
|
|
||||||
fp.slave_gear.Placement = mat1
|
|
||||||
|
|
||||||
def execute(self, fp):
|
|
||||||
self.onChanged(fp, None)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 21 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 18 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 14 KiB |
@@ -1,18 +1,21 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
# * *
|
# * *
|
||||||
# * This program is free software: you can redistribute it and/or modify *
|
# * This program is free software; you can redistribute it and/or modify *
|
||||||
# * it under the terms of the GNU General Public License as published by *
|
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||||
# * the Free Software Foundation, either version 3 of the License, or *
|
# * as published by the Free Software Foundation; either version 2 of *
|
||||||
# * (at your option) any later version. *
|
# * the License, or (at your option) any later version. *
|
||||||
|
# * for detail see the LICENCE text file. *
|
||||||
# * *
|
# * *
|
||||||
# * This program is distributed in the hope that it will be useful, *
|
# * This program is distributed in the hope that it will be useful, *
|
||||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
# * GNU General Public License for more details. *
|
# * GNU Library General Public License for more details. *
|
||||||
# * *
|
# * *
|
||||||
# * You should have received a copy of the GNU General Public License *
|
# * You should have received a copy of the GNU Library General Public *
|
||||||
# * along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
# * License along with this program; if not, write to the Free Software *
|
||||||
|
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||||
|
# * USA *
|
||||||
# * *
|
# * *
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
|
|
||||||
@@ -37,35 +40,29 @@ class GearWorkbench(Workbench):
|
|||||||
Icon = os.path.join(__dirname__, 'icons', 'gearworkbench.svg')
|
Icon = os.path.join(__dirname__, 'icons', 'gearworkbench.svg')
|
||||||
commands = [
|
commands = [
|
||||||
"CreateInvoluteGear",
|
"CreateInvoluteGear",
|
||||||
"CreateInternalInvoluteGear",
|
|
||||||
"CreateInvoluteRack",
|
"CreateInvoluteRack",
|
||||||
"CreateCycloidGear",
|
"CreateCycloidGear",
|
||||||
"CreateCycloidRack",
|
|
||||||
"CreateBevelGear",
|
"CreateBevelGear",
|
||||||
"CreateCrownGear",
|
"CreateCrownGear",
|
||||||
"CreateWormGear",
|
"CreateWormGear",
|
||||||
"CreateTimingGear",
|
"CreateTimingGear",
|
||||||
"CreateLanternGear",
|
"CreateLanternGear",
|
||||||
"CreateHypoCycloidGear",
|
"CreateHypoCycloidGear"]
|
||||||
"CreateGearConnector"]
|
|
||||||
|
|
||||||
def GetClassName(self):
|
def GetClassName(self):
|
||||||
return "Gui::PythonWorkbench"
|
return "Gui::PythonWorkbench"
|
||||||
|
|
||||||
def Initialize(self):
|
def Initialize(self):
|
||||||
from .commands import CreateCycloidGear, CreateInvoluteGear, CreateInternalInvoluteGear
|
from .commands import CreateCycloidGear, CreateInvoluteGear
|
||||||
from .commands import CreateBevelGear, CreateInvoluteRack, CreateCrownGear
|
from .commands import CreateBevelGear, CreateInvoluteRack, CreateCrownGear
|
||||||
from .commands import CreateWormGear, CreateTimingGear, CreateLanternGear
|
from .commands import CreateWormGear, CreateTimingGear, CreateLanternGear
|
||||||
from .commands import CreateHypoCycloidGear, CreateCycloidRack
|
from .commands import CreateHypoCycloidGear
|
||||||
from .commands import CreateGearConnector
|
|
||||||
|
|
||||||
self.appendToolbar("Gear", self.commands)
|
self.appendToolbar("Gear", self.commands)
|
||||||
self.appendMenu("Gear", self.commands)
|
self.appendMenu("Gear", self.commands)
|
||||||
# Gui.addIconPath(App.getHomePath()+"Mod/gear/icons/")
|
# Gui.addIconPath(App.getHomePath()+"Mod/gear/icons/")
|
||||||
Gui.addCommand('CreateInvoluteGear', CreateInvoluteGear())
|
Gui.addCommand('CreateInvoluteGear', CreateInvoluteGear())
|
||||||
Gui.addCommand('CreateInternalInvoluteGear', CreateInternalInvoluteGear())
|
|
||||||
Gui.addCommand('CreateCycloidGear', CreateCycloidGear())
|
Gui.addCommand('CreateCycloidGear', CreateCycloidGear())
|
||||||
Gui.addCommand('CreateCycloidRack', CreateCycloidRack())
|
|
||||||
Gui.addCommand('CreateBevelGear', CreateBevelGear())
|
Gui.addCommand('CreateBevelGear', CreateBevelGear())
|
||||||
Gui.addCommand('CreateInvoluteRack', CreateInvoluteRack())
|
Gui.addCommand('CreateInvoluteRack', CreateInvoluteRack())
|
||||||
Gui.addCommand('CreateCrownGear', CreateCrownGear())
|
Gui.addCommand('CreateCrownGear', CreateCrownGear())
|
||||||
@@ -73,7 +70,6 @@ class GearWorkbench(Workbench):
|
|||||||
Gui.addCommand('CreateTimingGear', CreateTimingGear())
|
Gui.addCommand('CreateTimingGear', CreateTimingGear())
|
||||||
Gui.addCommand('CreateLanternGear', CreateLanternGear())
|
Gui.addCommand('CreateLanternGear', CreateLanternGear())
|
||||||
Gui.addCommand('CreateHypoCycloidGear', CreateHypoCycloidGear())
|
Gui.addCommand('CreateHypoCycloidGear', CreateHypoCycloidGear())
|
||||||
Gui.addCommand('CreateGearConnector', CreateGearConnector())
|
|
||||||
|
|
||||||
def Activated(self):
|
def Activated(self):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
<date>2022-02-07</date>
|
<date>2022-02-07</date>
|
||||||
<maintainer email="sppedflyer@gmail.com">looooo</maintainer>
|
<maintainer email="sppedflyer@gmail.com">looooo</maintainer>
|
||||||
<license file="LICENSE">GPL 3</license>
|
<license file="LICENSE">GPL 3</license>
|
||||||
|
<dep>scipy</dep>
|
||||||
<url type="repository" branch="develop">https://github.com/looooo/freecad.gears</url>
|
<url type="repository" branch="develop">https://github.com/looooo/freecad.gears</url>
|
||||||
<url type="bugtracker">https://github.com/looooo/freecad.gears/issues</url>
|
<url type="bugtracker">https://github.com/looooo/freecad.gears/issues</url>
|
||||||
<url type="documentation">https://wiki.freecad.org/FCGear_Workbench</url>
|
<url type="documentation">https://wiki.freecad.org/FCGear_Workbench</url>
|
||||||
|
|||||||
@@ -1,19 +1,22 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
# * *
|
# * *
|
||||||
# * This program is free software: you can redistribute it and/or modify *
|
# * This program is free software; you can redistribute it and/or modify *
|
||||||
# * it under the terms of the GNU General Public License as published by *
|
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||||
# * the Free Software Foundation, either version 3 of the License, or *
|
# * as published by the Free Software Foundation; either version 2 of *
|
||||||
# * (at your option) any later version. *
|
# * the License, or (at your option) any later version. *
|
||||||
|
# * for detail see the LICENCE text file. *
|
||||||
# * *
|
# * *
|
||||||
# * This program is distributed in the hope that it will be useful, *
|
# * This program is distributed in the hope that it will be useful, *
|
||||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
# * GNU General Public License for more details. *
|
# * GNU Library General Public License for more details. *
|
||||||
# * *
|
# * *
|
||||||
# * You should have received a copy of the GNU General Public License *
|
# * You should have received a copy of the GNU Library General Public *
|
||||||
# * along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
# * License along with this program; if not, write to the Free Software *
|
||||||
|
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||||
|
# * USA *
|
||||||
# * *
|
# * *
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
|
|
||||||
__version__ = "0.0.4"
|
__version__ = "0.0.3"
|
||||||
@@ -1,18 +1,21 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
# * *
|
# * *
|
||||||
# * This program is free software: you can redistribute it and/or modify *
|
# * This program is free software; you can redistribute it and/or modify *
|
||||||
# * it under the terms of the GNU General Public License as published by *
|
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||||
# * the Free Software Foundation, either version 3 of the License, or *
|
# * as published by the Free Software Foundation; either version 2 of *
|
||||||
# * (at your option) any later version. *
|
# * the License, or (at your option) any later version. *
|
||||||
|
# * for detail see the LICENCE text file. *
|
||||||
# * *
|
# * *
|
||||||
# * This program is distributed in the hope that it will be useful, *
|
# * This program is distributed in the hope that it will be useful, *
|
||||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
# * GNU General Public License for more details. *
|
# * GNU Library General Public License for more details. *
|
||||||
# * *
|
# * *
|
||||||
# * You should have received a copy of the GNU General Public License *
|
# * You should have received a copy of the GNU Library General Public *
|
||||||
# * along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
# * License along with this program; if not, write to the Free Software *
|
||||||
|
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||||
|
# * USA *
|
||||||
# * *
|
# * *
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,21 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
# * *
|
# * *
|
||||||
# * This program is free software: you can redistribute it and/or modify *
|
# * This program is free software; you can redistribute it and/or modify *
|
||||||
# * it under the terms of the GNU General Public License as published by *
|
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||||
# * the Free Software Foundation, either version 3 of the License, or *
|
# * as published by the Free Software Foundation; either version 2 of *
|
||||||
# * (at your option) any later version. *
|
# * the License, or (at your option) any later version. *
|
||||||
|
# * for detail see the LICENCE text file. *
|
||||||
# * *
|
# * *
|
||||||
# * This program is distributed in the hope that it will be useful, *
|
# * This program is distributed in the hope that it will be useful, *
|
||||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
# * GNU General Public License for more details. *
|
# * GNU Library General Public License for more details. *
|
||||||
# * *
|
# * *
|
||||||
# * You should have received a copy of the GNU General Public License *
|
# * You should have received a copy of the GNU Library General Public *
|
||||||
# * along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
# * License along with this program; if not, write to the Free Software *
|
||||||
|
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||||
|
# * USA *
|
||||||
# * *
|
# * *
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
|
|
||||||
@@ -30,7 +33,6 @@ class BevelTooth(object):
|
|||||||
self.z = z
|
self.z = z
|
||||||
self.clearance = clearance
|
self.clearance = clearance
|
||||||
self.backlash = backlash
|
self.backlash = backlash
|
||||||
self.angular_backlash = backlash / (z * module / 2)
|
|
||||||
self.module = module
|
self.module = module
|
||||||
|
|
||||||
self.involute_end = arccos(
|
self.involute_end = arccos(
|
||||||
@@ -109,7 +111,7 @@ class BevelTooth(object):
|
|||||||
intersection_point = intersection_line_circle(xy[i], point, r_cut)
|
intersection_point = intersection_line_circle(xy[i], point, r_cut)
|
||||||
xy = array([intersection_point] + list(xy[i+1:]))
|
xy = array([intersection_point] + list(xy[i+1:]))
|
||||||
xyz = [[p[0], p[1], 1] for p in xy]
|
xyz = [[p[0], p[1], 1] for p in xy]
|
||||||
backlash_rot = rotation3D(self.angular_backlash / 2)
|
backlash_rot = rotation3D(self.backlash / 4)
|
||||||
xyz = backlash_rot(xyz)
|
xyz = backlash_rot(xyz)
|
||||||
return(xyz)
|
return(xyz)
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,26 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
# * *
|
# * *
|
||||||
# * This program is free software: you can redistribute it and/or modify *
|
# * This program is free software; you can redistribute it and/or modify *
|
||||||
# * it under the terms of the GNU General Public License as published by *
|
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||||
# * the Free Software Foundation, either version 3 of the License, or *
|
# * as published by the Free Software Foundation; either version 2 of *
|
||||||
# * (at your option) any later version. *
|
# * the License, or (at your option) any later version. *
|
||||||
|
# * for detail see the LICENCE text file. *
|
||||||
# * *
|
# * *
|
||||||
# * This program is distributed in the hope that it will be useful, *
|
# * This program is distributed in the hope that it will be useful, *
|
||||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
# * GNU General Public License for more details. *
|
# * GNU Library General Public License for more details. *
|
||||||
# * *
|
# * *
|
||||||
# * You should have received a copy of the GNU General Public License *
|
# * You should have received a copy of the GNU Library General Public *
|
||||||
# * along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
# * License along with this program; if not, write to the Free Software *
|
||||||
|
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||||
|
# * USA *
|
||||||
# * *
|
# * *
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from scipy import optimize as opt
|
||||||
|
|
||||||
|
|
||||||
def compute_shifted_gears(m, alpha, t1, t2, x1, x2):
|
def compute_shifted_gears(m, alpha, t1, t2, x1, x2):
|
||||||
@@ -33,32 +37,10 @@ def compute_shifted_gears(m, alpha, t1, t2, x1, x2):
|
|||||||
Returns:
|
Returns:
|
||||||
(float, float): distance between gears [length], pressure angle of the assembly [rad]
|
(float, float): distance between gears [length], pressure angle of the assembly [rad]
|
||||||
"""
|
"""
|
||||||
def inv(x):
|
def inv(x): return np.tan(x) - x
|
||||||
return np.tan(x) - x
|
|
||||||
|
|
||||||
inv_alpha_w = inv(alpha) + 2 * np.tan(alpha) * (x1 + x2) / (t1 + t2)
|
inv_alpha_w = inv(alpha) + 2 * np.tan(alpha) * (x1 + x2) / (t1 + t2)
|
||||||
|
|
||||||
def root_inv(x):
|
def root_inv(x): return inv(x) - inv_alpha_w
|
||||||
return inv(x) - inv_alpha_w
|
alpha_w = opt.fsolve(root_inv, 0.)
|
||||||
|
|
||||||
def d_root_inv(x):
|
|
||||||
return 1. / np.cos(x) - 1
|
|
||||||
|
|
||||||
alpha_w = find_root(alpha, root_inv, d_root_inv)
|
|
||||||
dist = m * (t1 + t2) / 2 * np.cos(alpha) / np.cos(alpha_w)
|
dist = m * (t1 + t2) / 2 * np.cos(alpha) / np.cos(alpha_w)
|
||||||
return dist, alpha_w
|
return dist, alpha_w
|
||||||
|
|
||||||
|
|
||||||
def find_root(x0, f, df, epsilon=2e-10, max_iter=100):
|
|
||||||
x_n = x0
|
|
||||||
for i in range(max_iter):
|
|
||||||
f_xn = f(x_n)
|
|
||||||
if abs(f_xn) < epsilon:
|
|
||||||
return x_n
|
|
||||||
else:
|
|
||||||
df_xn = df(x_n)
|
|
||||||
if df_xn == 0:
|
|
||||||
return None
|
|
||||||
else:
|
|
||||||
x_n = x_n - f_xn / df_xn / 2 # adding (/ 2) to avoid oscillation
|
|
||||||
return None
|
|
||||||
@@ -1,18 +1,21 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
# * *
|
# * *
|
||||||
# * This program is free software: you can redistribute it and/or modify *
|
# * This program is free software; you can redistribute it and/or modify *
|
||||||
# * it under the terms of the GNU General Public License as published by *
|
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||||
# * the Free Software Foundation, either version 3 of the License, or *
|
# * as published by the Free Software Foundation; either version 2 of *
|
||||||
# * (at your option) any later version. *
|
# * the License, or (at your option) any later version. *
|
||||||
|
# * for detail see the LICENCE text file. *
|
||||||
# * *
|
# * *
|
||||||
# * This program is distributed in the hope that it will be useful, *
|
# * This program is distributed in the hope that it will be useful, *
|
||||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
# * GNU General Public License for more details. *
|
# * GNU Library General Public License for more details. *
|
||||||
# * *
|
# * *
|
||||||
# * You should have received a copy of the GNU General Public License *
|
# * You should have received a copy of the GNU Library General Public *
|
||||||
# * along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
# * License along with this program; if not, write to the Free Software *
|
||||||
|
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||||
|
# * USA *
|
||||||
# * *
|
# * *
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
|
|
||||||
@@ -22,14 +25,14 @@ from ._functions import rotation, reflection
|
|||||||
|
|
||||||
|
|
||||||
class CycloidTooth():
|
class CycloidTooth():
|
||||||
def __init__(self, z1=5, z2=5, z=14, m=5, clearance=0.25, backlash=0.00, head=0.0):
|
def __init__(self, z1=5, z2=5, z=14, m=5, clearance=0.12, backlash=0.00, head=0.0):
|
||||||
self.m = m
|
self.m = m
|
||||||
self.z = z
|
self.z = z
|
||||||
self.clearance = clearance
|
self.clearance = clearance
|
||||||
|
self.head = head
|
||||||
self.backlash = backlash
|
self.backlash = backlash
|
||||||
self.z1 = z1
|
self.z1 = z1
|
||||||
self.z2 = z2
|
self.z2 = z2
|
||||||
self.head = head
|
|
||||||
self._calc_gear_factors()
|
self._calc_gear_factors()
|
||||||
|
|
||||||
def _calc_gear_factors(self):
|
def _calc_gear_factors(self):
|
||||||
@@ -37,10 +40,9 @@ class CycloidTooth():
|
|||||||
self.d2 = self.z2 * self.m
|
self.d2 = self.z2 * self.m
|
||||||
self.phi = self.m * pi
|
self.phi = self.m * pi
|
||||||
self.d = self.z * self.m
|
self.d = self.z * self.m
|
||||||
self.da = self.d + 2 * (1 + self.head) * self.m
|
self.da = self.d + 2*self.m + self.head * self.m
|
||||||
self.di = self.d - 2 * (1 + self.clearance) * self.m
|
self.di = self.d - 2*self.m - self.clearance * self.m
|
||||||
self.phipart = 2 * pi / self.z
|
self.phipart = 2 * pi / self.z
|
||||||
self.angular_backlash = self.backlash / (self.d / 2)
|
|
||||||
|
|
||||||
def epicycloid_x(self):
|
def epicycloid_x(self):
|
||||||
def func(t):
|
def func(t):
|
||||||
@@ -93,7 +95,7 @@ class CycloidTooth():
|
|||||||
pts_outer = transpose([pts_outer_x, pts_outer_y])
|
pts_outer = transpose([pts_outer_x, pts_outer_y])
|
||||||
pts_inner = transpose([pts_inner_x, pts_inner_y])
|
pts_inner = transpose([pts_inner_x, pts_inner_y])
|
||||||
pts1 = vstack([pts_inner[:-2], pts_outer])
|
pts1 = vstack([pts_inner[:-2], pts_outer])
|
||||||
rot = rotation(self.phipart / 4 - self.angular_backlash / 2)
|
rot = rotation(self.phipart / 4 - self.backlash)
|
||||||
pts1 = rot(pts1)
|
pts1 = rot(pts1)
|
||||||
ref = reflection(0.)
|
ref = reflection(0.)
|
||||||
pts2 = ref(pts1)[::-1]
|
pts2 = ref(pts1)[::-1]
|
||||||
|
|||||||
@@ -1,18 +1,21 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
# * *
|
# * *
|
||||||
# * This program is free software: you can redistribute it and/or modify *
|
# * This program is free software; you can redistribute it and/or modify *
|
||||||
# * it under the terms of the GNU General Public License as published by *
|
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||||
# * the Free Software Foundation, either version 3 of the License, or *
|
# * as published by the Free Software Foundation; either version 2 of *
|
||||||
# * (at your option) any later version. *
|
# * the License, or (at your option) any later version. *
|
||||||
|
# * for detail see the LICENCE text file. *
|
||||||
# * *
|
# * *
|
||||||
# * This program is distributed in the hope that it will be useful, *
|
# * This program is distributed in the hope that it will be useful, *
|
||||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
# * GNU General Public License for more details. *
|
# * GNU Library General Public License for more details. *
|
||||||
# * *
|
# * *
|
||||||
# * You should have received a copy of the GNU General Public License *
|
# * You should have received a copy of the GNU Library General Public *
|
||||||
# * along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
# * License along with this program; if not, write to the Free Software *
|
||||||
|
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||||
|
# * USA *
|
||||||
# * *
|
# * *
|
||||||
# ***************************************************************************
|
# ***************************************************************************
|
||||||
|
|
||||||
@@ -69,7 +72,6 @@ class InvoluteTooth():
|
|||||||
self.involute_rot2 = 1 / self.z * \
|
self.involute_rot2 = 1 / self.z * \
|
||||||
(pi / 2 + 2 * self.shift * tan(self.pressure_angle_t))
|
(pi / 2 + 2 * self.shift * tan(self.pressure_angle_t))
|
||||||
self.involute_rot = self.involute_rot1 + self.involute_rot2
|
self.involute_rot = self.involute_rot1 + self.involute_rot2
|
||||||
self.angular_backlash = self.backlash / (self.d / 2)
|
|
||||||
self.involute_start = 0.
|
self.involute_start = 0.
|
||||||
if self.dg <= self.df:
|
if self.dg <= self.df:
|
||||||
self.involute_start = sqrt(self.df ** 2 - self.dg ** 2) / self.dg
|
self.involute_start = sqrt(self.df ** 2 - self.dg ** 2) / self.dg
|
||||||
@@ -82,7 +84,7 @@ class InvoluteTooth():
|
|||||||
y = array(list(map(fy, pts)))
|
y = array(list(map(fy, pts)))
|
||||||
xy = transpose([x, y])
|
xy = transpose([x, y])
|
||||||
rotate = rotation(
|
rotate = rotation(
|
||||||
self.undercut_rot + self.phipart / 2 - self.angular_backlash / 2)
|
self.undercut_rot + self.phipart / 2 - self.backlash / 4)
|
||||||
xy = rotate(xy)
|
xy = rotate(xy)
|
||||||
return(array(xy))
|
return(array(xy))
|
||||||
|
|
||||||
@@ -92,7 +94,7 @@ class InvoluteTooth():
|
|||||||
x = array(list(map(fx, pts)))
|
x = array(list(map(fx, pts)))
|
||||||
fy = self.involute_function_y()
|
fy = self.involute_function_y()
|
||||||
y = array(list(map(fy, pts)))
|
y = array(list(map(fy, pts)))
|
||||||
rot = rotation(self.involute_rot - self.angular_backlash / 2)
|
rot = rotation(self.involute_rot - self.backlash / 4)
|
||||||
xy = rot(transpose(array([x, y])))
|
xy = rot(transpose(array([x, y])))
|
||||||
return(xy)
|
return(xy)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user