Skip to content

Commit 2b37e63

Browse files
committed
Initial implementation hooking up the View3D integration script
1 parent 6f2e40d commit 2b37e63

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

src/EnergyPlus/CommandLineInterface.cc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,28 @@ main_gui(True)
287287
cmd += R"python(
288288
from ghedesigner.main import run_manager_from_cli
289289
run_manager_from_cli()
290+
)python";
291+
try {
292+
engine.exec(cmd);
293+
exit(0);
294+
} catch (std::runtime_error &) {
295+
exit(1);
296+
}
297+
});
298+
299+
auto *viewfactorsSubCommand = auxiliaryToolsSubcommand->add_subcommand("viewfactors", "View Factors");
300+
viewfactorsSubCommand->add_option("args", python_fwd_args, "Extra Arguments forwarded to energyplus_viewfactors")->option_text("ARG ...");
301+
viewfactorsSubCommand->positionals_at_end(true);
302+
viewfactorsSubCommand->footer(
303+
"You can pass extra arguments after the ghedesigner keyword, they should be the input file and output directory.");
304+
305+
viewfactorsSubCommand->callback([&state, &python_fwd_args] {
306+
EnergyPlus::Python::PythonEngine engine(state);
307+
// There's probably better to be done, like instantiating the pythonEngine with the argc/argv then calling PyRun_SimpleFile but whatever
308+
std::string cmd = Python::PythonEngine::getTclPreppedPreamble(python_fwd_args);
309+
cmd += R"python(
310+
from energyplus_viewfactors import EnergyPlusViewFactors
311+
EnergyPlusViewFactors().run()
290312
)python";
291313
try {
292314
engine.exec(cmd);

0 commit comments

Comments
 (0)