diff options
author | FormerLurker <hochgebe@gmail.com> | 2021-02-19 01:48:42 +0300 |
---|---|---|
committer | FormerLurker <hochgebe@gmail.com> | 2021-02-19 01:48:42 +0300 |
commit | fe18f18b4c005a2c4e4b69a5866d0d065bde82aa (patch) | |
tree | fba8715841a51b75befe0454318a959991d8e29f /ArcWelderInverseProcessor | |
parent | efb6c54e9f07edb25304a35e58431fdfe321c705 (diff) |
Support relative extrusion, limit feedrate output, and add comments to the inverse processor. Solves #49.
Diffstat (limited to 'ArcWelderInverseProcessor')
-rw-r--r-- | ArcWelderInverseProcessor/ArcWelderInverseProcessor.vcxproj | 1 | ||||
-rw-r--r-- | ArcWelderInverseProcessor/inverse_processor.cpp | 24 |
2 files changed, 22 insertions, 3 deletions
diff --git a/ArcWelderInverseProcessor/ArcWelderInverseProcessor.vcxproj b/ArcWelderInverseProcessor/ArcWelderInverseProcessor.vcxproj index 08f2524..37ec7d0 100644 --- a/ArcWelderInverseProcessor/ArcWelderInverseProcessor.vcxproj +++ b/ArcWelderInverseProcessor/ArcWelderInverseProcessor.vcxproj @@ -175,6 +175,7 @@ <SDLCheck>true</SDLCheck> <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <ConformanceMode>true</ConformanceMode> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> </ClCompile> <Link> <SubSystem>Console</SubSystem> diff --git a/ArcWelderInverseProcessor/inverse_processor.cpp b/ArcWelderInverseProcessor/inverse_processor.cpp index 59f24e2..c2f0b4d 100644 --- a/ArcWelderInverseProcessor/inverse_processor.cpp +++ b/ArcWelderInverseProcessor/inverse_processor.cpp @@ -413,15 +413,33 @@ void inverse_processor::plan_buffer_line(float x, float y, bool has_z, float z, std::stringstream stream; stream << std::fixed; - //output_file_ << + position * previous_pos = p_source_position_->get_previous_position_ptr(); + position* current_pos = p_source_position_->get_current_position_ptr(); stream << "G1 X" << std::setprecision(3) << x << " Y" << y; if (has_z) { stream << " Z" << z; } - stream << std::setprecision(5) << " E" << e; + + double output_e = e; + if (previous_pos->is_extruder_relative) + { + output_e = e - previous_pos->get_current_extruder().get_offset_e(); + } + + stream << std::setprecision(5) << " E" << output_e; + - stream << std::setprecision(0) << " F" << feed_rate << "\n"; + if (feed_rate != previous_pos->f) + { + stream << std::setprecision(0) << " F" << feed_rate; + } + + if (!current_pos->command.comment.empty()) + { + stream << ";" << current_pos->command.comment; + } + stream << "\n"; output_file_ << stream.str(); } |