add prototype for gear connector
This commit is contained in:
@@ -21,6 +21,7 @@ import FreeCAD
|
||||
import FreeCADGui as Gui
|
||||
from .features import ViewProviderGear, InvoluteGear, InternalInvoluteGear, InvoluteGearRack, CycloidGearRack
|
||||
from .features import CycloidGear, BevelGear, CrownGear, WormGear, TimingGear, LanternGear, HypoCycloidGear
|
||||
from .connector import GearConnector, ViewProviderGearConnector
|
||||
|
||||
|
||||
class BaseCommand(object):
|
||||
@@ -157,3 +158,19 @@ class CreateLanternGear(BaseCommand):
|
||||
Pixmap = os.path.join(BaseCommand.ICONDIR, 'lanterngear.svg')
|
||||
MenuText = '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):
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", self.NAME)
|
||||
gear1 = Gui.Selection.getSelection()[0]
|
||||
gear2 = Gui.Selection.getSelection()[1]
|
||||
# check if selected objects are beams
|
||||
GearConnector(obj, gear1, gear2)
|
||||
ViewProviderGearConnector(obj.ViewObject)
|
||||
return obj
|
||||
|
||||
@@ -55,7 +55,7 @@ def fcvec(x):
|
||||
|
||||
class ViewProviderGear(object):
|
||||
def __init__(self, obj, icon_fn=None):
|
||||
''' Set this object to the proxy object of the actual view provider '''
|
||||
# Set this object to the proxy object of the actual view provider
|
||||
obj.Proxy = self
|
||||
self._check_attr()
|
||||
dirname = os.path.dirname(__file__)
|
||||
|
||||
@@ -46,7 +46,8 @@ class GearWorkbench(Workbench):
|
||||
"CreateWormGear",
|
||||
"CreateTimingGear",
|
||||
"CreateLanternGear",
|
||||
"CreateHypoCycloidGear"]
|
||||
"CreateHypoCycloidGear",
|
||||
"CreateGearConnector"]
|
||||
|
||||
def GetClassName(self):
|
||||
return "Gui::PythonWorkbench"
|
||||
@@ -56,6 +57,7 @@ class GearWorkbench(Workbench):
|
||||
from .commands import CreateBevelGear, CreateInvoluteRack, CreateCrownGear
|
||||
from .commands import CreateWormGear, CreateTimingGear, CreateLanternGear
|
||||
from .commands import CreateHypoCycloidGear, CreateCycloidRack
|
||||
from .commands import CreateGearConnector
|
||||
|
||||
self.appendToolbar("Gear", self.commands)
|
||||
self.appendMenu("Gear", self.commands)
|
||||
@@ -71,6 +73,7 @@ class GearWorkbench(Workbench):
|
||||
Gui.addCommand('CreateTimingGear', CreateTimingGear())
|
||||
Gui.addCommand('CreateLanternGear', CreateLanternGear())
|
||||
Gui.addCommand('CreateHypoCycloidGear', CreateHypoCycloidGear())
|
||||
Gui.addCommand('CreateGearConnector', CreateGearConnector())
|
||||
|
||||
def Activated(self):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user