19 Commits
py2 ... 0.3.1

Author SHA1 Message Date
looooo
8db1141a57 version 2015-06-26 13:37:19 +02:00
looooo
b1e1d7467d icons 2015-06-26 13:36:45 +02:00
looooo
c44738a6f6 working 2015-06-26 13:36:25 +02:00
looooo
f3ec22f524 0.2.6 2015-06-26 12:11:07 +02:00
looooo
1b46e4b39a 0.2.6 2015-06-26 11:56:50 +02:00
looooo
62909966f2 manifest 2015-06-26 11:14:11 +02:00
looooo
ecc42b23ca umbenannt 2015-06-25 11:49:07 +02:00
looooo
00d814e8bd schas 2015-06-25 11:44:11 +02:00
looooo
ab50047800 es nervt 2015-06-25 11:42:09 +02:00
looooo
23f8dbaf19 manifest.in 2015-06-25 11:26:44 +02:00
looooo
a511a2835d setup version 2015-06-25 11:01:15 +02:00
looooo
ff1fe8bdb3 bla 2015-06-25 10:32:24 +02:00
looooo
f68653d442 setup 2015-06-25 10:27:36 +02:00
looooo
4c7f5410b0 not working 2015-06-25 09:45:12 +02:00
looooo
6abbeb1fef tag nr 2015-06-25 08:42:39 +02:00
looooo
146767418a integration 2015-06-25 08:37:02 +02:00
looooo
97df5a8077 gui stuff 2015-06-23 06:48:00 +02:00
looooo
5fc6b813e3 way towards pip 2015-06-19 21:38:22 +02:00
looooo
25aafca940 way to pip 2015-06-19 19:04:08 +02:00
23 changed files with 197 additions and 13064 deletions

1
MANIFEST.in Normal file
View File

@@ -0,0 +1 @@
recursive-include freecad_gear/freecad/icons *

7
freecad_gear/__init__.py Normal file
View File

@@ -0,0 +1,7 @@
#!/usr/lib/python
from freecad_gear.gearfunc._involute_tooth import involute_rack, involute_tooth
from freecad_gear.gearfunc._cycloide_tooth import cycloide_tooth
from freecad_gear.gearfunc._bevel_tooth import bevel_tooth
import freecad_gear.freecad

View File

@@ -0,0 +1,143 @@
#***************************************************************************
#* *
#* 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, QtCore
freecad_found = True
try:
import FreeCADGui as Gui
import Part
import FreeCAD as App
except ImportError:
freecad_found = False
if freecad_found:
import freecad_gear as gear
from freecad_gear.freecad.commands import (createInvoluteGear,
createCycloidGear, createBevelGear, createInvoluteRack)
class gearToolBox(object):
def __init__(self):
mw = Gui.getMainWindow()
[
self.involuteGearAction,
self.involuteRackAction,
self.bevelGearAction,
self.cycloidGearAction,
self.dropdown_action] = [None, None, None, None, None]
self.defaultAction = createInvoluteGear
self.add_gear_wb()
mw.workbenchActivated.connect(self.add_gear_wb)
timer = mw.findChild(QtCore.QTimer, "activityTimer")
timer.connect(timer, QtCore.SIGNAL("timeout()"), self.checkDocument)
def add_gear_wb(self, *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
try:
if Gui.gear.gear_toolbar:
Gui.gear.gear_toolbar.show()
except:
pass
Gui.gear = gear.__class__("gear")
print(type(gear))
# create toolbar
Gui.gear.gear_toolbar = mainWindow.addToolBar("Part: GearToolbar")
Gui.gear.gear_toolbar.setObjectName("GearToolbar")
this_path = os.path.dirname(os.path.realpath(__file__))
self.dropdown = QtGui.QMenu("gear_menu", Gui.gear.gear_toolbar)
# create commands
icon = QtGui.QIcon(this_path + "/icons/involutegear.svg")
self.involuteGearAction = QtGui.QAction(icon, "involute gear", self.dropdown)
self.involuteGearAction.setObjectName("GearToolbar")
self.involuteGearAction.triggered.connect(
self.set_default_action(self.involuteGearAction, createInvoluteGear))
icon = QtGui.QIcon(this_path + "/icons/involuterack.svg")
self.involuteRackAction = QtGui.QAction(icon, "involute rack", self.dropdown)
self.involuteRackAction.setObjectName("GearToolbar")
self.involuteRackAction.triggered.connect(
self.set_default_action(self.involuteRackAction, createInvoluteRack))
icon = QtGui.QIcon(this_path + "/icons/cycloidegear.svg")
self.cycloidGearAction = QtGui.QAction(icon, "cycloid gear", self.dropdown)
self.cycloidGearAction.setObjectName("GearToolbar")
self.cycloidGearAction.triggered.connect(
self.set_default_action(self.cycloidGearAction, createCycloidGear))
icon = QtGui.QIcon(this_path + "/icons/bevelgear.svg")
self.bevelGearAction = QtGui.QAction(icon, "bevel gear", self.dropdown)
self.bevelGearAction.setObjectName("GearToolbar")
self.bevelGearAction.triggered.connect(
self.set_default_action(self.bevelGearAction, createBevelGear))
temp1 = self.dropdown.addAction(self.involuteGearAction)
temp2 = self.dropdown.addAction(self.involuteRackAction)
temp3 = self.dropdown.addAction(self.cycloidGearAction)
temp4 = self.dropdown.addAction(self.bevelGearAction)
self.dropdown.setIcon(self.involuteGearAction.icon())
temp5 = Gui.gear.gear_toolbar.addAction(self.dropdown.menuAction())
self.checkDocument()
self.defaultCommand = createInvoluteGear
self.dropdown.menuAction().triggered.connect(self.defaultCommand)
def set_default_action(self, action, command):
def cb(*args):
self.dropdown.setIcon(action.icon())
self.defaultCommand = command
command()
return cb
def checkDocument(self, *args):
enable = False
if App.ActiveDocument:
enable = True
for action in [self.involuteGearAction, self.involuteRackAction,
self.bevelGearAction, self.cycloidGearAction, self.dropdown.menuAction()]:
if action:
action.setEnabled(enable)
if freecad_found:
a = gearToolBox()

View File

@@ -18,37 +18,35 @@
#* *
#***************************************************************************
import FreeCAD as App
import FreeCADGui as Gui
import FreeCAD
import gear_rc
from freecad_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")

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 145 KiB

After

Width:  |  Height:  |  Size: 145 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

View File

@@ -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>

View File

@@ -1,7 +0,0 @@
<RCC>
<qresource>
<file>icons/gearworkbench.svg</file>
<file>icons/involutegear.svg</file>
<file>icons/cycloidegear.svg</file>
</qresource>
</RCC>

View File

@@ -1,20 +0,0 @@
#!/usr/lib/python
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"
]

File diff suppressed because it is too large Load Diff

View File

@@ -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")

2
setup.cfg Normal file
View File

@@ -0,0 +1,2 @@
[metadata]
description-file = README.md

18
setup.py Normal file
View File

@@ -0,0 +1,18 @@
import sys
import os
from setuptools import setup, find_packages
setup(
name = 'freecad_gear',
version = '0.3',
packages = ["freecad_gear", "freecad_gear/freecad/", "freecad_gear/gearfunc/"],
include_package_data=True,
description = 'Some gears for freecad',
author = 'Lorenz L',
author_email = 'sppedflyer@gmail.com',
url = 'https://github.com/looooo/FCGear',
download_url = 'https://github.com/looooo/FCGear/tarball/0.3',
keywords = ['gear', 'freecad'],
classifiers = [],
)