From 25e544b31bb9a997d0e9eb598a1da4dc4de6ba64 Mon Sep 17 00:00:00 2001 From: hrntsm Date: Sun, 18 Feb 2024 19:53:08 +0900 Subject: [PATCH] Fix Tunny optimization environment check --- Tunny/Component/Optimizer/BoneFishComponent.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Tunny/Component/Optimizer/BoneFishComponent.cs b/Tunny/Component/Optimizer/BoneFishComponent.cs index d63650e9..7cc210f4 100644 --- a/Tunny/Component/Optimizer/BoneFishComponent.cs +++ b/Tunny/Component/Optimizer/BoneFishComponent.cs @@ -62,6 +62,14 @@ protected override void SolveInstance(IGH_DataAccess DA) CheckObjectivesInput(Params.Input[1].Sources.Select(ghParam => ghParam.InstanceGuid)); CheckArtifactsInput(Params.Input[3].Sources.Select(ghParam => ghParam.InstanceGuid)); + var settings = TunnySettings.LoadFromJson(); + string tunnyAssembleVersion = TEnvVariables.Version.ToString(3); + if (settings.CheckPythonLibraries || settings.Version != tunnyAssembleVersion) + { + AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "The optimization environment has not been built; launch the UI of the Tunny component once and install Python."); + return; + } + bool start = false; bool stop = false; if (!DA.GetData(4, ref start)) { return; } @@ -96,7 +104,7 @@ protected override void SolveInstance(IGH_DataAccess DA) Params.Output[1].ClearData(); Params.Output[2].ClearData(); - OptimizeLoop.Settings = TunnySettings.LoadFromJson(); + OptimizeLoop.Settings = settings; var worker = new BackgroundWorker { WorkerReportsProgress = true,