From 7dbebbbb081ae930988cfd4699a28c5157254336 Mon Sep 17 00:00:00 2001 From: Syres916 <46537884+Syres916@users.noreply.github.com> Date: Mon, 3 Jun 2024 18:08:17 +0100 Subject: [PATCH] [BIM] Add fallback installation for Python 3.10, 3.11 & 3.12 systems --- src/Mod/BIM/bimcommands/BimSetup.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Mod/BIM/bimcommands/BimSetup.py b/src/Mod/BIM/bimcommands/BimSetup.py index 65308fc376..bf788254dd 100644 --- a/src/Mod/BIM/bimcommands/BimSetup.py +++ b/src/Mod/BIM/bimcommands/BimSetup.py @@ -687,7 +687,7 @@ class BIM_Setup: elif sys.platform.startswith("darwin"): plat = "macos" else: - print("Error - unknown platform") + FreeCAD.Console.PrintError("Error - unknown platform") return if sys.maxsize > 2**32: plat += "64" @@ -721,7 +721,19 @@ class BIM_Setup: print("Successfully installed IfcOpenShell to", fp) break else: - print("Unable to find a build for your version") - + FreeCAD.Console.PrintWarning( + "Unable to find a build for your version therefore falling back to a pip install" + ) + try: + import pip + except ModuleNotFoundError: + FreeCAD.Console.PrintError( + "Please install pip on your system, restart FreeCAD," + " change to BIM Wb and use Utils menu > ifcOpenShell update" + ) + return + from nativeifc import ifc_openshell + + FreeCADGui.runCommand('IFC_UpdateIOS',1) FreeCADGui.addCommand("BIM_Setup", BIM_Setup())