way to pip
@@ -1,9 +0,0 @@
|
||||
<RCC>
|
||||
<qresource>
|
||||
<file>icons/gearworkbench.svg</file>
|
||||
<file>icons/involutegear.svg</file>
|
||||
<file>icons/cycloidegear.svg</file>
|
||||
<file>icons/involuterack.svg</file>
|
||||
<file>icons/bevelgear.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -1,7 +0,0 @@
|
||||
<RCC>
|
||||
<qresource>
|
||||
<file>icons/gearworkbench.svg</file>
|
||||
<file>icons/involutegear.svg</file>
|
||||
<file>icons/cycloidegear.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -3,18 +3,5 @@
|
||||
from gearfunc._involute_tooth import involute_rack, involute_tooth
|
||||
from gearfunc._cycloide_tooth import cycloide_tooth
|
||||
from gearfunc._bevel_tooth import bevel_tooth
|
||||
from gearfunc import CreateInvoluteRack, CreateCycloideGear, CreateInvoluteGear, CreateBevelGear
|
||||
|
||||
from tests import bspline_surf
|
||||
|
||||
|
||||
__All__ = [
|
||||
"CreateInvoluteRack",
|
||||
"CreateCycloideGear",
|
||||
"CreateInvoluteGear",
|
||||
"CreateBevelGear",
|
||||
"involute_rack",
|
||||
"involute_tooth",
|
||||
"bevel_tooth"
|
||||
]
|
||||
|
||||
import gear.freecad
|
||||
|
||||
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 145 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
83
gear/freecad/__init__.py
Normal file
@@ -0,0 +1,83 @@
|
||||
#***************************************************************************
|
||||
#* *
|
||||
#* This program is free software; you can redistribute it and/or modify *
|
||||
#* it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
#* as published by the Free Software Foundation; either version 2 of *
|
||||
#* 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, *
|
||||
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
#* GNU Library General Public License for more details. *
|
||||
#* *
|
||||
#* You should have received a copy of the GNU Library General Public *
|
||||
#* 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
|
||||
|
||||
from PySide import QtGui
|
||||
import FreeCADGui as Gui
|
||||
import FreeCAD as App
|
||||
import gear_rc
|
||||
|
||||
import gear
|
||||
from gear.freecad.commands import (createInvoluteGear,
|
||||
createCycloidGear, createBevelGear, createInvoluteRack)
|
||||
|
||||
|
||||
|
||||
def add_gear_wb(*args):
|
||||
print("Workbench_changed")
|
||||
try:
|
||||
wb = Gui.activeWorkbench()
|
||||
except Exception as e:
|
||||
return
|
||||
|
||||
if "PartWorkbench" in str(wb):
|
||||
|
||||
mainWindow = Gui.getMainWindow()
|
||||
|
||||
# add the module to Freecad
|
||||
App.gear = gear
|
||||
|
||||
# create toolbar
|
||||
App.gear.gear_toolbar = mainWindow.addToolBar("Part: GearToolbar")
|
||||
App.gear.gear_toolbar.setObjectName("GearToolbar")
|
||||
|
||||
this_path = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
# create commands
|
||||
icon = QtGui.QIcon(this_path + "/Resources/icons/involutegear.svg")
|
||||
involuteGearAction = QtGui.QAction(icon, "involute gear", App.gear.gear_toolbar)
|
||||
involuteGearAction.setObjectName("GearToolbar")
|
||||
involuteGearAction.triggered.connect(createInvoluteGear)
|
||||
|
||||
icon = QtGui.QIcon(this_path + "/Resources/icons/involuterack.svg")
|
||||
involuteRackAction = QtGui.QAction(icon, "involute rack", App.gear.gear_toolbar)
|
||||
involuteRackAction.setObjectName("GearToolbar")
|
||||
involuteRackAction.triggered.connect(createInvoluteRack)
|
||||
|
||||
icon = QtGui.QIcon(this_path + "/Resources/icons/cycloidegear.svg")
|
||||
cycloidGearAction = QtGui.QAction(icon, "cycloid gear", App.gear.gear_toolbar)
|
||||
cycloidGearAction.setObjectName("GearToolbar")
|
||||
cycloidGearAction.triggered.connect(createCycloidGear)
|
||||
|
||||
icon = QtGui.QIcon(this_path + "/Resources/icons/bevelgear.svg")
|
||||
bevelGearAction = QtGui.QAction(icon, "bevel gear", App.gear.gear_toolbar)
|
||||
bevelGearAction.setObjectName("GearToolbar")
|
||||
bevelGearAction.triggered.connect(createBevelGear)
|
||||
|
||||
temp1 = App.gear.gear_toolbar.addAction(involuteGearAction)
|
||||
temp2 = App.gear.gear_toolbar.addAction(involuteRackAction)
|
||||
temp3 = App.gear.gear_toolbar.addAction(cycloidGearAction)
|
||||
temp4 = App.gear.gear_toolbar.addAction(bevelGearAction)
|
||||
|
||||
mw = Gui.getMainWindow()
|
||||
add_gear_wb()
|
||||
mw.workbenchActivated.connect(add_gear_wb)
|
||||
@@ -18,37 +18,35 @@
|
||||
#* *
|
||||
#***************************************************************************
|
||||
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
import FreeCAD
|
||||
import gear_rc
|
||||
from gear.gearfunc._Classes import involute_gear, cycloide_gear, bevel_gear, involute_gear_rack
|
||||
|
||||
|
||||
class gearWorkbench(Workbench):
|
||||
"""glider workbench"""
|
||||
MenuText = "gear"
|
||||
ToolTip = "gear workbench"
|
||||
Icon = "gearworkbench.svg"
|
||||
def createInvoluteGear(*args):
|
||||
a = App.ActiveDocument.addObject("Part::FeaturePython", "involute_gear")
|
||||
involute_gear(a)
|
||||
a.ViewObject.Proxy = 0.
|
||||
App.ActiveDocument.recompute()
|
||||
Gui.SendMsgToActiveView("ViewFit")
|
||||
|
||||
def GetClassName(self):
|
||||
return "Gui::PythonWorkbench"
|
||||
def createInvoluteRack(*args):
|
||||
a = App.ActiveDocument.addObject("Part::FeaturePython", "involute_gear")
|
||||
involute_gear_rack(a)
|
||||
a.ViewObject.Proxy = 0.
|
||||
App.ActiveDocument.recompute()
|
||||
Gui.SendMsgToActiveView("ViewFit")
|
||||
|
||||
def Initialize(self):
|
||||
def createBevelGear(*args):
|
||||
a = App.ActiveDocument.addObject("Part::FeaturePython", "bevel_gear")
|
||||
bevel_gear(a)
|
||||
a.ViewObject.Proxy = 0.
|
||||
App.ActiveDocument.recompute()
|
||||
Gui.SendMsgToActiveView("ViewFit")
|
||||
|
||||
from gearfunc import CreateCycloideGear, CreateInvoluteGear, CreateBevelGear, CreateInvoluteRack
|
||||
|
||||
self.appendToolbar("Gear", ["CreateInvoluteGear", "CreateInvoluteRack", "CreateCycloideGear", "CreateBevelGear"])
|
||||
self.appendMenu("Gear", ["CreateInvoluteGear", "CreateInvoluteRack", "CreateCycloideGear","CreateBevelGear"])
|
||||
Gui.addIconPath(FreeCAD.getHomePath()+"Mod/gear/icons/")
|
||||
Gui.addCommand('CreateInvoluteGear', CreateInvoluteGear())
|
||||
Gui.addCommand('CreateCycloideGear', CreateCycloideGear())
|
||||
Gui.addCommand('CreateBevelGear', CreateBevelGear())
|
||||
Gui.addCommand('CreateInvoluteRack', CreateInvoluteRack())
|
||||
|
||||
def Activated(self):
|
||||
pass
|
||||
|
||||
|
||||
def Deactivated(self):
|
||||
pass
|
||||
|
||||
Gui.addWorkbench(gearWorkbench())
|
||||
def createCycloidGear(*args):
|
||||
a = App.ActiveDocument.addObject("Part::FeaturePython", "cycloide_gear")
|
||||
cycloide_gear(a)
|
||||
a.ViewObject.Proxy = 0.
|
||||
App.ActiveDocument.recompute()
|
||||
Gui.SendMsgToActiveView("ViewFit")
|
||||
12892
gear/gear_rc.py
@@ -1,108 +0,0 @@
|
||||
#***************************************************************************
|
||||
#* *
|
||||
#* This program is free software; you can redistribute it and/or modify *
|
||||
#* it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
#* as published by the Free Software Foundation; either version 2 of *
|
||||
#* 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, *
|
||||
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
#* GNU Library General Public License for more details. *
|
||||
#* *
|
||||
#* You should have received a copy of the GNU Library General Public *
|
||||
#* 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 FreeCAD
|
||||
import FreeCADGui as Gui
|
||||
from _Classes import involute_gear, cycloide_gear, bevel_gear, involute_gear_rack
|
||||
|
||||
|
||||
class CreateInvoluteGear():
|
||||
"""create an involute gear"""
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def GetResources(self):
|
||||
return {'Pixmap': 'involutegear.svg', 'MenuText': 'involute gear', 'ToolTip': 'involute gear'}
|
||||
|
||||
def IsActive(self):
|
||||
if FreeCAD.ActiveDocument is None:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def Activated(self):
|
||||
a = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", "involute_gear")
|
||||
involute_gear(a)
|
||||
a.ViewObject.Proxy = 0.
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
Gui.SendMsgToActiveView("ViewFit")
|
||||
|
||||
|
||||
class CreateInvoluteRack():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def GetResources(self):
|
||||
return {'Pixmap': 'involuterack.svg', 'MenuText': 'involute rack', 'ToolTip': 'involute rack'}
|
||||
|
||||
def IsActive(self):
|
||||
if FreeCAD.ActiveDocument is None:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def Activated(self):
|
||||
a = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", "involute_rack")
|
||||
involute_gear_rack(a)
|
||||
a.ViewObject.Proxy = 0.
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
Gui.SendMsgToActiveView("ViewFit")
|
||||
|
||||
|
||||
class CreateCycloideGear():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def GetResources(self):
|
||||
return {'Pixmap': 'cycloidegear.svg', 'MenuText': 'cycloide gear', 'ToolTip': 'cycloide gear'}
|
||||
|
||||
def IsActive(self):
|
||||
if FreeCAD.ActiveDocument is None:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def Activated(self):
|
||||
a = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", "cycloide_gear")
|
||||
cycloide_gear(a)
|
||||
a.ViewObject.Proxy = 0.
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
Gui.SendMsgToActiveView("ViewFit")
|
||||
|
||||
class CreateBevelGear():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def GetResources(self):
|
||||
return {'Pixmap': 'bevelgear.svg', 'MenuText': 'bevel gear', 'ToolTip': 'bevel gear'}
|
||||
|
||||
def IsActive(self):
|
||||
if FreeCAD.ActiveDocument is None:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def Activated(self):
|
||||
a = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", "bevel_gear")
|
||||
bevel_gear(a)
|
||||
a.ViewObject.Proxy = 0.
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
Gui.SendMsgToActiveView("ViewFit")
|
||||