From c5a350ce578146ef9e2c2238a9c99cc9caea01bb Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Mon, 3 Jun 2024 18:03:11 +0200 Subject: [PATCH] Tux: Detect and fix BIM addon (#14391) * Tux: Detect and fix BIM addon - fixes #14072 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- src/Mod/Tux/InitGui.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Mod/Tux/InitGui.py b/src/Mod/Tux/InitGui.py index e02e7da59a..8b76401b2a 100644 --- a/src/Mod/Tux/InitGui.py +++ b/src/Mod/Tux/InitGui.py @@ -33,3 +33,23 @@ if p.GetGroup("PersistentToolbars").GetBool("Enabled", 1): import PersistentToolbarsGui else: pass + +# Temporary - for FreeCAD v1.0 +# Detect a possible clash between the built-in BIM WB in v1.0 +# and the BIM addon. Resolve this by renaming the BIM add-on path +try: + import Arch_rc + + # we could import Arch_rc, nothing to be done, either we are + # running built-in BIM without the addon, or the addon without built-in BIM +except: + # Arch_rc not importable: We have both the BIM addon and the built-in BIM + import os + import FreeCAD + + modpath = os.path.join(FreeCAD.getUserAppDataDir(), "Mod") + if "BIM" in os.listdir(modpath): + os.rename(os.path.join(modpath, "BIM"), os.path.join(modpath, "BIM021")) + FreeCAD.Console.PrintWarning( + "BIM addon path has been renamed to BIM021 to avoid conflicts with the builtin BIM workbench. Please restart FreeCAD\n" + )