Wipe tower postprocessing, wipe tower block on 3D plate improved.

- it renders red with one egde as indeterminate, the front edge is where the wipe tower will start
- changing width changes depth of the block (as requested)
- the block shows the brim of the wipe tower
- after slicing, the block is rendered in usual dark green and takes the exact shape of the tower (also with brim)
- moving or rotationg the block after slicing does not invalidate the wipe tower (and hence the exact block dimensions are preserved)
- changing anything that invalidates the wipe tower reverts the block back to the "indeterminate" shape
- the block is not shown after slicing, if the wipe tower is not actually generated (printing single color object with the wipe tower enabled)

This required changes in the wipe tower generator, which now generates the tower
at origin with no rotation. Resulting gcode is postprocessed and transformed during
gcode export. This means the wipe tower needs not be invalidated when it is moved or rotated.
This commit is contained in:
Lukas Matena 2018-07-27 15:56:27 +02:00
parent dd724e9dab
commit d5f042b4b8
14 changed files with 264 additions and 77 deletions

View file

@ -83,8 +83,10 @@ public:
const WipeTower::ToolChangeResult &priming,
const std::vector<std::vector<WipeTower::ToolChangeResult>> &tool_changes,
const WipeTower::ToolChangeResult &final_purge) :
m_left(float(print_config.wipe_tower_x.value)),
m_right(float(print_config.wipe_tower_x.value + print_config.wipe_tower_width.value)),
m_left(/*float(print_config.wipe_tower_x.value)*/ 0.f),
m_right(float(/*print_config.wipe_tower_x.value +*/ print_config.wipe_tower_width.value)),
m_wipe_tower_pos(float(print_config.wipe_tower_x.value), float(print_config.wipe_tower_y.value)),
m_wipe_tower_rotation(float(print_config.wipe_tower_rotation_angle)),
m_priming(priming),
m_tool_changes(tool_changes),
m_final_purge(final_purge),
@ -101,9 +103,14 @@ private:
WipeTowerIntegration& operator=(const WipeTowerIntegration&);
std::string append_tcr(GCode &gcodegen, const WipeTower::ToolChangeResult &tcr, int new_extruder_id) const;
// Postprocesses gcode: rotates and moves all G1 extrusions and returns result
std::string rotate_wipe_tower_moves(const std::string& gcode_original, const WipeTower::xy& start_pos, const WipeTower::xy& translation, float angle) const;
// Left / right edges of the wipe tower, for the planning of wipe moves.
const float m_left;
const float m_right;
const WipeTower::xy m_wipe_tower_pos;
const float m_wipe_tower_rotation;
// Reference to cached values at the Printer class.
const WipeTower::ToolChangeResult &m_priming;
const std::vector<std::vector<WipeTower::ToolChangeResult>> &m_tool_changes;
@ -112,6 +119,7 @@ private:
int m_layer_idx;
int m_tool_change_idx;
bool m_brim_done;
bool i_have_brim = false;
};
class GCode {