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

Reduce the interleaved prime tower wasted filament #2094

Merged
merged 58 commits into from
Jul 2, 2024

Conversation

wawanbreton
Copy link
Contributor

@wawanbreton wawanbreton commented Jun 12, 2024

Description

The current version of the interleaved prime tower still prints a lot of material that is only required for supporting the upper layer. However, by priming always the same extruder at the same position in the tower, the required support amount is quite high and can be reduced a lot when priming each extruder on top of each other:

image
image

This also allows for reducing the diameter of the prime tower, which can save room on the building plate.

In case of multi-color printing, this also allows for decreasing the required amount of support when the number of used extruder decreases. Thus we can end with a very thin tower at the end of the print, reducing wasted filament a lot:
image

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • New setting in Cura: "Prime Tower Minimum Shell Thickness"

How Has This Been Tested?

  • Sliced multiple models with multiple extruder configurations, for multiple printers
  • Tested on UM S5 dual color
  • Tested on own printer with single nozzle dual color

Test Configuration:

  • Operating System: Ubuntu

Checklist:

  • My code follows the style guidelines of this project as described in UltiMaker Meta
  • I have read the Contribution guide
  • I have commented my code, particularly in hard-to-understand areas
  • I have uploaded any files required to test this change

Other improvements:

This PR also provides a few other improvements along the way:

  • Add a class called LayerVector which helps safely storing values by LayerIndex instead of size_t. This removes some redundant but necessary check and values conversion warnings, and helps make the code more readable.
  • Fix the start positions of the prime tower when using a base (they didn't take care of the base extra size and could end up inside the base instead of around it).
  • Fix the raft with interleaved prime tower (which has been cherry-picked into 5.7 already)
  • Splitted the PrimeTower into a base class and two implementation PrimeTowerNormal and PrimeTowerInterleaved. This makes it easier to work on one or the other without breaking each other. Also, it helps computing only what is really necessary for each of them.
  • The prime tower object now provides an "occupation outline" and an "extrusion outline". The occupation is an approximation that can be calculated at the very beginning and can then be used by otherparts of the engine, e.g. support calculation. The extrusion it the actual occupation of the extrusion, which may be slightly smaller than the occupation (depending on line width), and can be calculated only later in the process.
  • Fix a few crashes here and there

Comes with https://github.com/Ultimaker/Cura/pull/19249/files

wawanbreton and others added 30 commits April 17, 2024 21:29
The previous implementation could generate a circle with a final point
very close to the first one, or not, depending on double-precision
rouding imprecision. This new version makes sure that the last generated
point is always the same (non-explicitely closed polygon)
The previous versions used an embedded object which was always present
as a member variable. We now instantiate the primer tower object only if
a prime tower will be actually generated, and use this pointer presence
as a test to having a prime tower. This is also in prevision of a future
change where multiple implementations of the prime tower will exist.
We now have specific classes for normal and interleaved prime towers, so
that it will become easier to fine-tune their behavior without breaking
each other.
Now the whole logic of computation of how each extruder should be primed
is done inside the PrimeTowerInterleaved and PrimeTowerNormal classes,
because this is very related to how they will process this data later.
This will later allow for more fine-tuning of these behaviors without a
big risk of breaking each other.
This new vector allows for storing items using a LayerIndex, which can
be negative. Thus we can store items also on negative (raft) layers in
the same list and avoid having two lists to store the same items.
This simplifies some code logic in the prime tower that is common and
can now be delegated to LayerVector
This simplifies the common behavior in PrimeTower and allows for more
modifications inside each class without breaking each other
With the new prime tower, the base is now calculated much later on the
process, because it requires to know the extruders uses orders. However,
the interation with support and bed adhesion features is calculated
before that. So we can calculate an approximate outline as soon as the
tower is initialized, and later we calculate the exact toolpaths.
@github-actions github-actions bot added the PR: Community Contribution 👑 Community Contribution PR's label Jun 12, 2024
include/PrimeTower/PrimeTowerInterleaved.h Show resolved Hide resolved
include/PrimeTower/PrimeTowerNormal.h Show resolved Hide resolved
include/utils/LayerVector.h Outdated Show resolved Hide resolved
src/FffGcodeWriter.cpp Outdated Show resolved Hide resolved
@wawanbreton wawanbreton requested a review from nallath June 28, 2024 09:43
@HellAholic HellAholic merged commit 493383f into Ultimaker:main Jul 2, 2024
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Community Contribution 👑 Community Contribution PR's
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants