Files
create/src/Mod/Create/Init.py
forbes c59c704da3
Some checks failed
Build and Test / build (pull_request) Has been cancelled
refactor: rewire silo submodule for silo-mod split
- .gitmodules: silo.git -> silo-mod.git (FreeCAD workbench only)
- Init.py: silo/pkg/freecad -> silo/freecad (new repo layout)
- InitGui.py: same path update

The silo monorepo has been split into:
- silo-client: shared Python API client (submodule of silo-mod)
- silo-mod: FreeCAD workbench (this submodule)
- silo-calc: LibreOffice Calc extension (separate repo)
- silo: server only (no longer a Create submodule)
2026-02-06 11:15:30 -06:00

49 lines
1.7 KiB
Python

# Kindred Create - Core Module
# Console initialization - loads ztools and Silo addons
import os
import sys
import FreeCAD
def setup_kindred_addons():
"""Add Kindred Create addon paths and load their Init.py files."""
# Get the FreeCAD home directory (where src/Mod/Create is installed)
home = FreeCAD.getHomePath()
mods_dir = os.path.join(home, "mods")
# Define built-in addons with their paths relative to mods/
addons = [
("ztools", "ztools/ztools"), # mods/ztools/ztools/
("silo", "silo/freecad"), # mods/silo/freecad/
]
for name, subpath in addons:
addon_path = os.path.join(mods_dir, subpath)
if os.path.isdir(addon_path):
# Add to sys.path if not already present
if addon_path not in sys.path:
sys.path.insert(0, addon_path)
# Execute Init.py if it exists
init_file = os.path.join(addon_path, "Init.py")
if os.path.isfile(init_file):
try:
with open(init_file) as f:
exec_globals = globals().copy()
exec_globals["__file__"] = init_file
exec_globals["__name__"] = name
exec(compile(f.read(), init_file, "exec"), exec_globals)
FreeCAD.Console.PrintLog(f"Create: Loaded {name} Init.py\n")
except Exception as e:
FreeCAD.Console.PrintWarning(
f"Create: Failed to load {name}: {e}\n"
)
else:
FreeCAD.Console.PrintLog(f"Create: Addon path not found: {addon_path}\n")
setup_kindred_addons()
FreeCAD.Console.PrintLog("Create module initialized\n")