-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Custom G-code: wrong extruder IDs injected #3574
Comments
@platsch I've edited your post to include a reproduction test case. I've set the perimeter extruder to 2 and left infill at 1 (in config) and added output gcode for tool change that writes. In the provided output g code, confirm by observing line 96-100 and 1226-1229. |
I can see one of two places to fix this, either in the UI (by changing the initial ID to 0 from 1) or libslic3r. I think fixing it in the config/UI side is the appropriate option as it has less opportunity for special-casing, but reading older configs will cause the program to do things people don't expect. |
Actually, I considered providing a PR to fix this and the reason I didn't was exactly this question. I have the impression that fixing the UI is the cleaner solution since the extruder numbering was always inconsistent with the firmware. On the other hand: what was the original reason to design the GUI as it is? Are we neglecting an important point? Breaking basically all existing configs would probably be a major problem... |
Another solution, IMHO better one, would be to finally implement an It is really just a convention, whether the extruders are numbered from 0 On Fri, Nov 18, 2016 at 9:19 AM, platsch [email protected] wrote:
|
Oh. Right. Damn, I should have used zero-numbering everywhere. It makes no sense to use different numbers than what machine uses. I'm afraid now it's too late to switch how they are stored in config files in backwards compatible way. Maybe we should just subtract 1 whenever we use them as placeholders. |
I think 0 in the GUI has a special meaning now, though (not sure) |
@bubnikv an expression parser would technically solve this problem, but it is not very intuitive to have some variables counting from 0 and some from 1 in the same evaluation context. I suggest we let the PlaceholderParser subtract 1 for all extruder-related placeholders. Sadly, this requires a number of parser exceptions, but I just see no better solution. Does this affect anything aside from the 5 extruder variables? |
I will use the "0th" extruder for the support and support interface extruders to indicate "does not matter, use the last one" to minimize the number of extruder exchanges. Therefore it makes sense to reserve "0" as a "default" value as it is done everywhere else in Slic3r. |
Maybe we just need to change No need to change the expression parser. Or just add another two sets of variables: The 2nd solution would be backward compatible. |
Version
1.3.0 dev
Behavior
The placeholder variable for extruder IDs e.g. for tool change G-code are directly evaluated to the config values, starting with 1. This behavior makes it impossible to use placeholders as gcode variables, since the firmware counts extruders starting with 0.
[previous_extruder]
and[next_extruder]
are correctly replaced, i.e. starting with 0.Example:
;perimeter_extruder: [perimeter_extruder]
-> 1;previous_extruder: [previous_extruder]
-> 0but both are actually the same extruder.
The reason is, that
GCode::set_extruder
explicitly injects the correct "special" variables but directly imports all settings viaPlaceholderParser::process
.Reproduction files
3574.zip
The text was updated successfully, but these errors were encountered: