CURA- 12556 formula parser in cura engine#2274
Open
wawanbreton wants to merge 29 commits intomainfrom
Open
Conversation
CURA-12556 Although this is quite counter-intuitive, it is how the front-end currently works, so we want to keep the same behavior
CURA-12556 This requires using boost::regex instead of std::regex which doesn't support named capture groups. In this context, they are useful to allow some groups to be present or not and knowing what the expression is actually composed of. Index-based capture groups don't allow that.
CURA-12556 Ported from frontend StartSliceJob.py:GcodeStartEndFormatter
Contributor
Test Results0 tests 0 ✅ 0s ⏱️ Results for commit 684bfb5. ♻️ This comment has been updated with latest results. |
casperlamboo
approved these changes
Jan 19, 2026
rburema
reviewed
Jan 21, 2026
Member
rburema
left a comment
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'C++ Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.
| Benchmark suite | Current: 4cd5086 | Previous: 2e6f6f9 | Ratio |
|---|---|---|---|
SimplifyTestFixture/simplify_slot_noplugin |
1.886970768092735 ns/iter |
1.2487941865752963 ns/iter |
1.51 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @nallath @jellespijker @wawanbreton @casperlamboo @saumyaj3 @HellAholic
casperlamboo
approved these changes
Jan 22, 2026
Contributor
casperlamboo
left a comment
There was a problem hiding this comment.
One small remark, the npm packaging seems to be broken due to this PR. If not too much trouble could you see if you can fix it here. Otherwise we'll fix it when we make the neoprep upgrade.
casperlamboo
approved these changes
Jan 23, 2026
CURA-12556 One of the values will be a duplicate of extruder_nr, however it is much less confusing because otherwise you have to know which one is available in either the start or end gcode.
CURA-12556 Otherwise it is not possible to get the extruder_nr variable when resolving the extruder number for the expression. In this case one should not specify it, but they may also do a calculation based on this number.
…rser-in-CuraEngine
CURA-12556 We have strings nowadays
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR moves the GCode-template replacement algorithm from the Cura front-end to the engine. This allows for more flexibility because the engine has more information when resolving the templates. Especially for the extruders start/end GCodes, which can now be different between each layer.
It also introduces 2 new variables that can be used in the exutrders GCode:
previous_extruder_nrin the extruder start/prestart GCode, that contains the ID of the extruder we are switching fromnext_extruder_nrin the extruder end GCode, that contains the ID of the extruder we are switching toℹ️ It was also discussed to replace the final substitution that is done in the front-end, to the engine. This is done once the whole GCode has been generated, to insert e.g. the total duration of the print. However, the GCode content is sent to the front-end immediatly after each layer is completed, at which point some layers are still to be processed. So given this process, it is currently impossible to make this change. It would require to send the whole GCode at once, which has other implications and may reduce global performance. This will be discussed further in a other ticket.
Ultimaker/Cura#21306
CURA-12556