feat: add Kindred Create integration

- Replace package.xml with Kindred-extended manifest (priority 40, sdk dependency)
- Add Init.py: console bootstrap with sys.path setup for pygears/namespace package
- Add InitGui.py: workbench import + gear command injection into PartDesign contexts
This commit is contained in:
forbes-0023
2026-02-28 15:16:50 -06:00
parent 16858bea80
commit 1e26c393f3
3 changed files with 73 additions and 14 deletions

19
freecad/gears/Init.py Normal file
View File

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

40
freecad/gears/InitGui.py Normal file
View File

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

View File

@@ -1,25 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<?xml version="1.0" encoding="UTF-8"?>
<package format="1" xmlns="https://wiki.freecad.org/Package_Metadata">
<name>freecad.gears workbench</name>
<description>A gear workbench for FreeCAD</description>
<version>1.3</version>
<date>2024-09-11</date>
<maintainer email="sppedflyer@gmail.com">looooo</maintainer>
<name>gears</name>
<description>Parametric gear workbench for Kindred Create</description>
<version>1.3.0</version>
<maintainer email="development@kindred-systems.com">Kindred Systems</maintainer>
<license file="LICENSE">GPL-3.0-or-later</license>
<url type="repository" branch="master">https://github.com/looooo/freecad.gears</url>
<url type="bugtracker">https://github.com/looooo/freecad.gears/issues</url>
<url type="documentation">https://wiki.freecad.org/FCGear_Workbench</url>
<url type="repository">https://git.kindred-systems.com/kindred/gears</url>
<icon>freecad/gears/icons/gearworkbench.svg</icon>
<content>
<workbench>
<classname>GearWorkbench</classname>
<subdirectory>./</subdirectory>
<freecadmin>0.19</freecadmin>
<tag>gear</tag>
<tag>gears</tag>
<subdirectory>freecad/gears</subdirectory>
</workbench>
<depend>scipy</depend>
</content>
<kindred>
<min_create_version>0.1.0</min_create_version>
<load_priority>40</load_priority>
<dependencies>
<dependency>sdk</dependency>
</dependencies>
</kindred>
</package>