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 is_extruder_used #1422

Merged
merged 1 commit into from
Jun 25, 2023
Merged

Conversation

macdylan
Copy link
Contributor

No description provided.

// case of "is_extruder_used[]" as Slicer may lie about availability of such non-existent extruder. We rather
// sacrifice 256B of memory before we change the behavior of the PlaceholderParser, which should really only fill in
// the non-existent vector elements for filament parameters.
std::vector<unsigned char> is_extruder_used(std::max(size_t(255), print.config().filament_diameter.size()), 0);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I understanding correctly that the purpose of this change is to handle cases where the user tries to access a non-existent extruder in his custom G-code? For example, using is_extruder_used[18] when only 3 extruders/filaments are set in the slicer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I use it with my IDEX device (Snapmaker J1), and when only one filament is added in the slicer, it used to return true when attempting to check is_extruder_used[1] in the Start Gcode. Now it will return false.

@SoftFever
Copy link
Owner

LGTM
Thanks, merged.

@SoftFever SoftFever merged commit e925db8 into SoftFever:main Jun 25, 2023
@macdylan macdylan deleted the fix-is_extruder_used branch June 27, 2023 02:23
@bubnikv
Copy link
Contributor

bubnikv commented Jul 5, 2023

Thanks for merging my code into OrcaSlicer.
Next time you do it, I would respectfully ask you to give the author credit, for example by using
Co-authored-by: name name@example.com
in the change log, see

https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors

@SoftFever
Copy link
Owner

@bubnikv
Thanks for the heads up.

Can you kindly point out where are original codes located?

@macdylan
Copy link
Contributor Author

macdylan commented Jul 7, 2023

https://github.com/prusa3d/PrusaSlicer/blob/e0f7263a4c8d3574ff9ab09b08363be55ef17da3/src/libslic3r/GCode.cpp#L1304

I like slicing in Orca, so i copied this code for my printer to work correctly.
Thanks @bubnikv

@SoftFever
Copy link
Owner

@macdylan Thanks for clarification.

@bubnikv I will add section of "how to credit" in the doc.
The Co-authored-by link is nice 👍

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