Skip to content

Duplicate (import/export) Processing Scripts#21501

Open
Ken Davidson (kenjdavidson) wants to merge 4 commits into
Ultimaker:mainfrom
kenjdavidson:CURA-13367-export-import-post-processing-scripts
Open

Duplicate (import/export) Processing Scripts#21501
Ken Davidson (kenjdavidson) wants to merge 4 commits into
Ultimaker:mainfrom
kenjdavidson:CURA-13367-export-import-post-processing-scripts

Conversation

@kenjdavidson
Copy link
Copy Markdown

Description

Added the ability to duplicate Processing Scripts and their content.

Also snuck in the ability to export/import the script configuration, instead of having to do this from scratch. Just a nicety to have since I have to setup a bunch of pauses at different layers for different prints in order to change filament.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

I'll be completely honest, ran this through Copilot and let Jesus take the wheel I've been trying to get Cura running locally for the last two days with no luck, so at this point hopefully someone else can verify it or just close it. I appreciate how ridiculous seems, but even following the instructions I just can't get things running locally (keep getting stuck up on UM and pyArcus versioning).

Test Configuration:
Windows 11

Checklist:

Verified that Copilot had all the best practices and contributing content resolved.

No specific files, should just be able to duplicate and import/export the Script config.

@github-actions github-actions Bot added the PR: Community Contribution 👑 Community Contribution PR's label Mar 28, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 29, 2026

Test Results

24 572 tests  ±0   24 570 ✅ ±0   51s ⏱️ ±0s
     1 suites ±0        2 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit b86c207. ± Comparison against base commit 042b38e.

♻️ This comment has been updated with latest results.

@kenjdavidson
Copy link
Copy Markdown
Author

I can resolve or remove the tests lost likely without running it locally. I noticed that they were added but it isn't a practice in that file tests.

@GregValiant
Copy link
Copy Markdown
Collaborator

I have a PR 21327 in for PauseAtHeight (cleverly renamed "Pause At Layer or Height".
A couple of the changes are:

  • Ability to use the same settings for multiple layers.
  • Addition of more Pause Command options.
  • Unload and Reload the filament at each pause.
  • Option for "Filament Change" or "All Others" which would include things like nut or magnet insertions that don't require loading, unloading, etc..
  • Flow Rate setting if Redo Layer is selected.
image

@kenjdavidson
Copy link
Copy Markdown
Author

Ken Davidson (kenjdavidson) commented Mar 29, 2026

I have a PR 21327 in for PauseAtHeight (cleverly renamed "Pause At Layer or Height". A couple of the changes are:

  • Ability to use the same settings for multiple layers.
  • Addition of more Pause Command options.
  • Unload and Reload the filament at each pause.
  • Option for "Filament Change" or "All Others" which would include things like nut or magnet insertions that don't require loading, unloading, etc..
  • Flow Rate setting if Redo Layer is selected.

This will definitely make the layer height repetition way better! The other main issues that I tried to sneak in is the import/export/clear. With the script configuration tied to the printer config, isn't optimal for my workflow. But having the ability export a yml file of the configuration along side my 3mf (and conversely import it back with the same 3mf) would save even the time of applying even this plus a couple other custom scripts I have been using.

Sadly day 3 of attempting to get the local environment working has led too... alcohol and me thinking that it'll just never happen :(

@HellAholic HellAholic changed the title [CURA_13367] Duplicate (import/export) Processing Scripts Duplicate (import/export) Processing Scripts Mar 30, 2026
@kenjdavidson Ken Davidson (kenjdavidson) force-pushed the CURA-13367-export-import-post-processing-scripts branch from c33e910 to a82cd6c Compare April 1, 2026 20:05
@PartySausage
Copy link
Copy Markdown

Had a little look at this. Not much to report although I am seeing a slight alignment issue with the hamburger icon

image

@kenjdavidson
Copy link
Copy Markdown
Author

Had a little look at this. Not much to report although I am seeing a slight alignment issue with the hamburger icon

Hey, appreciate you taking a peak. I gave up trying to get this working on my windows machine, this weekends goal was getting it going on my Mac (maybe friendlier). Super weird, it's using the standard hamburger (found while looking at current icons)

                {
                    id: scriptOptionsButton
                    Layout.preferredWidth: height
                    iconSource: UM.Theme.getIcon("Hamburger")
                    tooltip: catalog.i18nc("@info:tooltip", "Import, export or clear scripts")
                    onClicked: scriptOptionsMenu.open()
                }

If I get it up and running this weekend I'll take a peak.

@PartySausage
Copy link
Copy Markdown

I don't think the icon is responsible for this but the SecondaryButton has a 15px indent

I'm by no means a QML expert so I don't know if it would be considered a approved solution but you could change.

Layout.preferredWidth: height to Layout.preferredWidth: height + 15

Another possibility would be to use UM.BurgerButton but I wouldn't know how to attach a tooltip to it.

            RowLayout
            {
                anchors.left: parent.left
                anchors.right: parent.right
                spacing: UM.Theme.getSize("narrow_margin").width

                Cura.SecondaryButton
                {
                    id: addButton
                    Layout.fillWidth: true
                    text: catalog.i18nc("@action", "Add a script")
                    onClicked: scriptsMenu.open()
                }
								
								UM.BurgerButton
								{
									id: settingVisibilityMenu

									anchors
									{
											right: parent.right
									}

									onClicked:
									{
											scriptOptionsMenu.open()
									}
								}
            }
        }

image

@PartySausage
Copy link
Copy Markdown

PartySausage commented Apr 2, 2026

For a bit of learning I had a little play with the QML and moved the Hamburger Bar to the top of the window, which seems to work in the new position

image

As an aside. I think the 'Clear Scripts' menu item really needs an 'Are You Sure Y/N?' step before clearing them in case of an inadvertent click

@PartySausage
Copy link
Copy Markdown

As a follow up to my last post. I've had a go at adding a confirmation dialog to the QML for when 'Clear Scripts is selected. I've attached to file to see if it may be of use to you.

image

Liking the idea that the script config can be exported/imported as I've had times in the past where I've made a mod some of my personal scripts, which hasn't gone well & have had to reconfigure them after reverting the changes

PostProcessingPlugin.zip

@kenjdavidson
Copy link
Copy Markdown
Author

Was super lazy over the weekend, but I did run the request through Copilot and updated the PR. I didn't use your zip, but it looks like the changes are relatively the same.

I still haven't gotten Cura running locally, sadly, so I really appreciate the checks.

@kenjdavidson Ken Davidson (kenjdavidson) force-pushed the CURA-13367-export-import-post-processing-scripts branch 2 times, most recently from a7eacd3 to a88cc46 Compare April 13, 2026 13:01
Copilot AI and others added 3 commits April 14, 2026 23:17
* Initial plan

* Add post processing script duplication feature

- Add DuplicateScript.svg icon (copy of MeshTypeIntersect.svg)
- Add duplicateScriptByIndex() method to PostProcessingPlugin
- Add duplicate button in QML (left of Move Down button)
- Add tests for duplicateScriptByIndex

Co-authored-by: kenjdavidson <6210735+kenjdavidson@users.noreply.github.com>

* Fix missing type annotations in test helpers and functions

Add mypy type annotations to the new test helper functions and test
functions introduced for duplicateScriptByIndex, as required by the
Python code conventions (all new code MUST be typed).

Co-authored-by: kenjdavidson <6210735+kenjdavidson@users.noreply.github.com>

* Remove obvious comments that restate code intent

Per coding conventions, comments that simply rephrase the code must be
removed. Deleted docstrings from duplicateScriptByIndex, test helper
functions, and all test functions added for script duplication.

Co-authored-by: kenjdavidson <6210735+kenjdavidson@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kenjdavidson <6210735+kenjdavidson@users.noreply.github.com>
* Initial plan

* Add export, import, and clear functionality for Post Processing Scripts

Co-authored-by: kenjdavidson <6210735+kenjdavidson@users.noreply.github.com>

* Fix code convention violations: use .format() for log messages and add type hints

Co-authored-by: kenjdavidson <6210735+kenjdavidson@users.noreply.github.com>

* Remove obvious comments that restate the code

Co-authored-by: kenjdavidson <6210735+kenjdavidson@users.noreply.github.com>

* Fix import ordering in TestPostProcessingPlugin.py

Co-authored-by: kenjdavidson <6210735+kenjdavidson@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kenjdavidson <6210735+kenjdavidson@users.noreply.github.com>
Co-authored-by: Ken Davidson <ken.j.davidson@live.ca>
@kenjdavidson Ken Davidson (kenjdavidson) force-pushed the CURA-13367-export-import-post-processing-scripts branch from a88cc46 to af83280 Compare April 15, 2026 03:17
@PartySausage
Copy link
Copy Markdown

Was super lazy over the weekend, but I did run the request through Copilot and updated the PR. I didn't use your zip, but it looks like the changes are relatively the same.

Hi Just got round to taking a look at your PR. Functionally both implementations work pretty much the same. The difference is mainly in the aesthetic

With your version you get an offset bounding box around the hamburger icon & in my alternate you don't have the bounding box.

PP Scripts KD PP Scripts HD

There is also a slight cosmetic difference with the Add Post-Processing Script button

The 2nd difference is with the Clear Scripts confirmation dialog where in the PR version the Yes button is highlighted as the primary button whereas in my alternate the No button is the primary, highlighted button and is the default action, which I thought would be a good idea for what the action would be doing

image

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.

4 participants