From 2b37e63c719e4c610c93c359fa4d4dbbb2d1518e Mon Sep 17 00:00:00 2001 From: "Jason W. DeGraw" Date: Tue, 31 Mar 2026 23:53:21 -0400 Subject: [PATCH] Initial implementation hooking up the View3D integration script --- src/EnergyPlus/CommandLineInterface.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/EnergyPlus/CommandLineInterface.cc b/src/EnergyPlus/CommandLineInterface.cc index 84d1d8e43e4..f62cbde4bfe 100644 --- a/src/EnergyPlus/CommandLineInterface.cc +++ b/src/EnergyPlus/CommandLineInterface.cc @@ -287,6 +287,28 @@ main_gui(True) cmd += R"python( from ghedesigner.main import run_manager_from_cli run_manager_from_cli() +)python"; + try { + engine.exec(cmd); + exit(0); + } catch (std::runtime_error &) { + exit(1); + } + }); + + auto *viewfactorsSubCommand = auxiliaryToolsSubcommand->add_subcommand("viewfactors", "View Factors"); + viewfactorsSubCommand->add_option("args", python_fwd_args, "Extra Arguments forwarded to energyplus_viewfactors")->option_text("ARG ..."); + viewfactorsSubCommand->positionals_at_end(true); + viewfactorsSubCommand->footer( + "You can pass extra arguments after the ghedesigner keyword, they should be the input file and output directory."); + + viewfactorsSubCommand->callback([&state, &python_fwd_args] { + EnergyPlus::Python::PythonEngine engine(state); + // There's probably better to be done, like instantiating the pythonEngine with the argc/argv then calling PyRun_SimpleFile but whatever + std::string cmd = Python::PythonEngine::getTclPreppedPreamble(python_fwd_args); + cmd += R"python( +from energyplus_viewfactors import EnergyPlusViewFactors +EnergyPlusViewFactors().run() )python"; try { engine.exec(cmd);