Skip to content

Commit

Permalink
Merge pull request #246 from hrntsm/feature/python-env-checker-in-bon…
Browse files Browse the repository at this point in the history
…e-component

Fix Tunny optimization environment check
  • Loading branch information
hrntsm authored Feb 18, 2024
2 parents 6e3287f + 25e544b commit 40e3a57
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Tunny/Component/Optimizer/BoneFishComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 40e3a57

Please sign in to comment.