Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/EnergyPlus/CommandLineInterface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading