Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix polyline handling #1362

Closed
wants to merge 33 commits into from
Closed

Fix polyline handling #1362

wants to merge 33 commits into from

Conversation

BagelOrb
Copy link
Contributor

@BagelOrb BagelOrb commented Nov 23, 2020

This PR combines the past few PRs of mine which ar all related to processing polylines.
This concerns polylines in surface mode, but also for all infill patterns.

  • the simplify() function is edited so that it can also process polylines
  • the pathOrderOptimizer is extended so that it can handle polylines of size > 2
  • in various places in the engine we make use of this by actually generating polylines instead of immediately cutting them up into 2 vert segments
  • a PolylineStitcher class is introduced which further stitches together polylines into chains
  • the chaining functionality which used to be inside pathOrderOptimizer is removed
  • simplification is now applied in between chaining and order optimization
  • the infill unit test has various bugs fixed
  • a new test case showing a bug in clipper is added (which currently always fails)
  • the modifier mesh functionality has also been applied to surface mode meshes - making it possible to design and test an infill pattern outside of Cura

As such this PR has the following advantages:

  • surface mode for high poly models can now be printed without constant stuttering
  • surface mode doesn't start somewhere in the middle of a polyline anymore, which would leave blobs in the middle of curved surfaces
  • connected infill also doesn't start somewhere in the middle of a polyline anymore. I can recall a bug which caused the connections to be printed in the wrong directions sometimes (see below), but I'm not sure that failure mode is still present.
  • surface mode meshes can now be used as infill, meaning that people (both internal and external) can more easily prototype a novel infill pattern - without actually implementing it.
  • for some models the computation time is considerably reduced (9%)
  • for some models the print time is also reduced. (simplifyPolylines() removes verts, which removes the need to slow down for a corner there. )
  • fixed an issue where surface mode meshes would be printed twice

PS: the zigzag order bug I recall: Left infill line is printed first, right one last.
image

alter the simplify function to also work on polylines
make the original function private and create some indirection,
so that no programmer can accidentally call the wrong simplify on a polygon / polyline object
it doesn't make sense to chain together polylines if they are so far away
also applies wipe correctly to a whole chained line
generated polyliens used to be cut up into single line segment polylines, because we weren't able to process longer polylines
Now we are able to process longer polylines, so we directly put generated polylines into the result_polylines
when there are colinear line segments within the same polyline,
clipper produces extraneous or missing segments in the result of an intersection clipping operation.
it was implemented double and made use of home grown functions rather than built in functionality
clipper doesnt handle polylines well when they are longer than single segments,
so we split polylines into segments before calling intersectionPolylines
always stitch polylines after intersection
polygons aren't guaranteed to represent correct areas.
Arbitrary zigzagged patterns can be connected into polygons which violate the even-odd rule
because of the zig-zag econnections walking along the outline of the polygon,
there might be overextrusion there.

The worse case scenario is a long polyon which fits one infill line,
but also has a zig-zag connector running along the legnth of the polygon
at nearly the same location as the infill line.
It's now performed in a separate function
It's better to keep the code for extra security
An extruder which was only used to print a surface mode mesh wasnt marked as being used,
which resulted in the mesh not being processed and thus not printed.
when the outer wall extruder was set to something different than extruder selected for the surface mesh,
the mesh would be printed using both extruders, but an assertion would fail.
limit the open polylines and closed polygons to the infill area of the other meshes
@BagelOrb
Copy link
Contributor Author

BagelOrb commented Nov 23, 2020

Slice time can reduce drastically, depending on the model.

UM3_armadillo_Deform__support.3mf.rename.zip
PR: -9% slice time, -3% gcode size

Uploading UM3_dragon_65__support.3mf.rename.zip…
PR: -1% slice time, -2% gcode size

UM3_jet_engine_part.3mf.rename.zip
PR: +0% slice time, +0% gcode size

slice time comparison.xlsx

For surface mode it's a more clear advantage
UM3_gyroid.3mf.rename.zip
on 4.8: gcode of 31MB, 2h1min print time
on PR: gcode of 5MB, 1h27min print time

@BagelOrb
Copy link
Contributor Author

See above three linked PRs for more example results.

@BagelOrb BagelOrb changed the title All polyline fixes Fix polyline handling Nov 24, 2020
@TheRooster13
Copy link

Has this been abandoned? These features would be so helpful for me...

@Ghostkeeper
Copy link
Collaborator

Yeah, this was sort of abandoned in favour of Arachne (#1210). We are unsure if there are still pieces of this that we now need to merge in. There's a lot of changes here though so it's hard to say.

@TheRooster13
Copy link

Yeah, this was sort of abandoned in favour of Arachne (#1210). We are unsure if there are still pieces of this that we now need to merge in. There's a lot of changes here though so it's hard to say.

The part that I'm most interested in is correctly handling polylines for surface mode. Currently, surface mode doesn't respect some settings like resolution, so if the mesh is highly detailed, the prints take a long time because the polyline created from slicing has tons of tiny line segments. Sometimes the print order of the polylines is odd too. Like starting in the middle of what should be one long line segment.

I'm not sure if Arachne handles those cases or not. If so, great!

This was referenced Jan 8, 2022
@BagelOrb BagelOrb closed this Jan 11, 2022
@Ghostkeeper Ghostkeeper deleted the all_polyline_fixes branch January 11, 2022 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants