Skip to content

Commit

Permalink
fix duplicate lines in g-code
Browse files Browse the repository at this point in the history
  • Loading branch information
astrowander committed Jun 20, 2023
1 parent 6f28fb1 commit 25904f1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions source/MRMesh/MRToolPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ tl::expected<ToolPathResult, std::string> lacingToolPath( const Mesh& inputMesh,
if ( bottomLeftIt < bottomRightIt )
{
res.commands.reserve( res.commands.size() + std::distance( bottomLeftIt, bottomRightIt ) + 1 );
for ( auto it = bottomLeftIt; it <= bottomRightIt; ++it )
for ( auto it = bottomLeftIt + 1; it <= bottomRightIt; ++it )
{
res.commands.push_back( { .y = it->y, .z = it->z } );
}
}
else
{
res.commands.reserve( res.commands.size() + std::distance( bottomLeftIt, contour.end() ) + std::distance( contour.begin(), bottomRightIt ) );
for ( auto it = bottomLeftIt; it < contour.end(); ++it )
for ( auto it = bottomLeftIt + 1; it < contour.end(); ++it )
{
res.commands.push_back( { .y = it->y, .z = it->z } );
}
Expand Down Expand Up @@ -191,7 +191,7 @@ tl::expected<ToolPathResult, std::string> lacingToolPath( const Mesh& inputMesh,
}
else
{
for ( auto it = bottomRightIt; it > contour.begin(); --it )
for ( auto it = bottomRightIt - 1; it > contour.begin(); --it )
{
res.commands.push_back( { .y = it->y, .z = it->z } );
}
Expand Down Expand Up @@ -607,7 +607,6 @@ std::vector<GCommand> replaceLineSegmentsWithCircularArcs( const std::span<GComm
return {};

std::vector<GCommand> res;
res.push_back( path[0] );

int startIdx = 0, endIdx = 0;
Vector2f bestArcCenter, bestArcStart, bestArcEnd;
Expand Down

0 comments on commit 25904f1

Please sign in to comment.