Skip to content

Commit

Permalink
python module: only load planes if they exist
Browse files Browse the repository at this point in the history
  • Loading branch information
carrotIndustries committed Oct 3, 2022
1 parent 2645798 commit fdf04ee
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/python_module/board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "pool/project_pool.hpp"
#include "rules/rule_descr.hpp"
#include "3d_image_exporter.hpp"
#include <filesystem>

class BoardWrapper : public horizon::DocumentBoard {
public:
Expand Down Expand Up @@ -97,11 +98,16 @@ BoardWrapper::BoardWrapper(const horizon::Project &prj, PlaneMode plane_mode)
: pool(prj.pool_directory, false), block(get_flattend_block(prj.blocks_filename, pool)),
board(horizon::Board::new_from_file(prj.board_filename, block, pool))
{
namespace fs = std::filesystem;

board.expand();
if (plane_mode == PlaneMode::LOAD_FROM_FILE)
board.load_planes_from_file(prj.planes_filename);
else
if (plane_mode == PlaneMode::LOAD_FROM_FILE) {
if (fs::is_regular_file(fs::u8path(prj.planes_filename)))
board.load_planes_from_file(prj.planes_filename);
}
else {
board.update_planes();
}
}


Expand Down

0 comments on commit fdf04ee

Please sign in to comment.