diff --git a/freecad/gears/Init.py b/freecad/gears/Init.py new file mode 100644 index 0000000..66a7d21 --- /dev/null +++ b/freecad/gears/Init.py @@ -0,0 +1,19 @@ +"""Kindred Gears - Console initialization. + +Adds the gears repo root to sys.path so the pygears math library +and the freecad.gears namespace package are importable. +""" + +import os +import sys + +# mods/gears/freecad/gears/Init.py -> dirname x3 -> mods/gears/ +_repo_root = os.path.dirname( + os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +) +if _repo_root not in sys.path: + sys.path.insert(0, _repo_root) + +import FreeCAD + +FreeCAD.Console.PrintLog("kindred-gears loaded\n") diff --git a/freecad/gears/InitGui.py b/freecad/gears/InitGui.py new file mode 100644 index 0000000..45803de --- /dev/null +++ b/freecad/gears/InitGui.py @@ -0,0 +1,40 @@ +"""Kindred Gears - GUI initialization. + +Imports the upstream GearWorkbench registration and injects gear +commands into PartDesign editing contexts via the Kindred SDK. +""" + +from freecad.gears.init_gui import * # noqa: F401,F403 + + +def _inject_gear_context(): + """Inject gear commands into PartDesign editing contexts.""" + try: + from kindred_sdk import inject_commands + + gear_commands = [ + "FCGear_InvoluteGear", + "FCGear_InternalInvoluteGear", + "FCGear_InvoluteRack", + "FCGear_CycloidGear", + "FCGear_CycloidRack", + "FCGear_BevelGear", + "FCGear_CrownGear", + "FCGear_WormGear", + "FCGear_TimingGearT", + "FCGear_TimingGear", + "FCGear_LanternGear", + "FCGear_HypoCycloidGear", + "FCGear_GearConnector", + ] + inject_commands("partdesign.body", "Gear", gear_commands) + inject_commands("partdesign.feature", "Gear", gear_commands) + except Exception as e: + import FreeCAD + + FreeCAD.Console.PrintWarning(f"kindred-gears: context injection failed: {e}\n") + + +from PySide6.QtCore import QTimer + +QTimer.singleShot(500, _inject_gear_context) diff --git a/package.xml b/package.xml index 92a6d80..99475f9 100644 --- a/package.xml +++ b/package.xml @@ -1,25 +1,25 @@ - + - freecad.gears workbench - A gear workbench for FreeCAD - 1.3 - 2024-09-11 - looooo + gears + Parametric gear workbench for Kindred Create + 1.3.0 + Kindred Systems GPL-3.0-or-later - https://github.com/looooo/freecad.gears - https://github.com/looooo/freecad.gears/issues - https://wiki.freecad.org/FCGear_Workbench + https://git.kindred-systems.com/kindred/gears freecad/gears/icons/gearworkbench.svg GearWorkbench - ./ - 0.19 - gear - gears + freecad/gears - scipy + + 0.1.0 + 40 + + sdk + +