Files
datums/InitGui.py
forbes-0023 e075dc9256 feat(datums): initial commit — unified datum creator addon
Standalone addon that replaces three stock PartDesign datum commands
(Plane, Line, Point) with a single unified Create_DatumCreator command.

Features:
- 16 smart creation modes (7 plane, 4 axis, 5 point)
- Auto-detection engine: selects best mode from geometry selection
- Mode override combo for manual selection
- Dynamic parameter UI (offset, angle, position, XYZ)
- Edit panel with real-time parameter updates via AttachExtension
- Catppuccin Mocha themed plane styling via SDK theme tokens
- Injected into partdesign.body and partdesign.feature contexts
2026-03-03 07:17:26 -06:00

41 lines
1.1 KiB
Python

"""Datums addon — GUI initialization.
Registers the unified datum creator command and injects it into
PartDesign editing contexts via the Kindred SDK.
"""
def _register_datum_commands():
"""Register datum creator command and inject into PartDesign contexts."""
try:
from datums.command import register_commands
register_commands()
except Exception as e:
import FreeCAD
FreeCAD.Console.PrintWarning(f"kindred-datums: command registration failed: {e}\n")
try:
from kindred_sdk import inject_commands
inject_commands(
"partdesign.body",
"Part Design Helper Features",
["Create_DatumCreator"],
)
inject_commands(
"partdesign.feature",
"Part Design Helper Features",
["Create_DatumCreator"],
)
except Exception as e:
import FreeCAD
FreeCAD.Console.PrintWarning(f"kindred-datums: context injection failed: {e}\n")
from PySide6.QtCore import QTimer
QTimer.singleShot(500, _register_datum_commands)