Jump to content

Plugin priority during slicing


awit

Recommended Posts

Posted · Plugin priority during slicing

Hi!

 

I have created 2 plugins, X and Y, and I want them to process the gcode sequentially - first X, then Y. However, when I set up both of them, and they work properly on their own, the issue I am facing is that Cura seems to firstly focus on plugin Y, then X, which produces the wrong result. My question is if there is a setting, which can assign a priority to plugins, ie. Cura starts with the most 'important' plugin first.

 

I could merge them into one plugin, and ensure the proper order, but I also want to use them separately.

 

Best regards,

AW

  • Link to post
    Share on other sites

    Posted · Plugin priority during slicing

    Question seems to be quite similar to this post : 

     

     

    So same answer The execution of the plugins follow I think the order of loading and the order of loading is according to the alphabetical order.

     

    Try to dhange the names of the plugins to change the order ?

    • Like 1
    Link to post
    Share on other sites

    Posted · Plugin priority during slicing

    Have you created plugins, or scripts for the PostProcessing plugin to use?

     

    With plugins you have (slightly) more control over the order of things by delaying when you register your postprocessing callback (eg when the plugin is loaded, or delay until after all loading of plugins has been performed).

    • Like 2
    Link to post
    Share on other sites

    Posted · Plugin priority during slicing

    I have created plugins, I have some post-processing scripts also, but they are not relevant to the current issue.

     

    6 minutes ago, ahoeben said:

    by delaying when you register your postprocessing callback

     

    I am not entirely sure I understand. Plugins can be executed in the order of them loading, or being executed all at once, when all of them finish loading?

     

     

     

    12 minutes ago, Cuq said:

    Try to dhange the names of the plugins to change the order ?

     

    On 2/8/2023 at 5:49 PM, ahoeben said:
    On 2/8/2023 at 11:54 AM, Cuq said:

    I don't think there is a possibility to solve this problem via a parameter.  Maybe @ahoeben could give a more accurate answer. 

    Not without modifying code.

     

    I will try the alphabetical workaround, but I would be glad for any information regarding the code modification.

  • Link to post
    Share on other sites

    Posted (edited) · Plugin priority during slicing
    1 hour ago, awit said:

    I am not entirely sure I understand. Plugins can be executed in the order of them loading, or being executed all at once, when all of them finish loading?

     

    At some point in your code, probably in your __init__ function, you register your postprocessor function like this:

        def __init__(self):
            (....)
            self._app = Application.getInstance()
          
            self._app.getOutputDeviceManager().writeStarted.connect(
                self._filterGcode
            )

     

    Instead of making that "connection" in the __init__ function, you can delay it to connect later, after other plugins have connected. The order in which the plugins are executed is the order in which they connected to the writeStarted signal.

     

        def __init__(self):
            (....)
            self._app = Application.getInstance()
          
            self._app.pluginsLoaded.connect(self._onPluginsLoaded)
    
        def _onPluginsLoaded(self):
            # this will run after all other plugins have connected  to the
            # writeStarted signal, so this plugin will execute last
    
            self._app.getOutputDeviceManager().writeStarted.connect(
                self._filterGcode
            )

     

     

    The order scripts in the PostProcessing plugin are executed is directly influenced by the order they are added in the interface. However you cannot change the order of other plugins in that interface.

    Edited by ahoeben
    • Like 1
    • Heart 1
    Link to post
    Share on other sites

    Posted · Plugin priority during slicing

    Do note that the trick I posted above is a bit of a hack, and if every plugin starts doing things like that it is going to be a game of wits who finds out the way to delay things the most. It would be cool if UM.Signal at least would support some sort of execution priority.

    • Like 2
    Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    • Our picks

      • UltiMaker Cura 5.7 stable released
        Cura 5.7 is here and it brings a handy new workflow improvement when using Thingiverse and Cura together, as well as additional capabilities for Method series printers, and a powerful way of sharing print settings using new printer-agnostic project files! Read on to find out about all of these improvements and more. 
         
          • Like
        • 26 replies
      • S-Line Firmware 8.3.0 was released Nov. 20th on the "Latest" firmware branch.
        (Sorry, was out of office when this released)

        This update is for...
        All UltiMaker S series  
        New features
         
        Temperature status. During print preparation, the temperatures of the print cores and build plate will be shown on the display. This gives a better indication of the progress and remaining wait time. Save log files in paused state. It is now possible to save the printer's log files to USB if the currently active print job is paused. Previously, the Dump logs to USB option was only enabled if the printer was in idle state. Confirm print removal via Digital Factory. If the printer is connected to the Digital Factory, it is now possible to confirm the removal of a previous print job via the Digital Factory interface. This is useful in situations where the build plate is clear, but the operator forgot to select Confirm removal on the printer’s display. Visit this page for more information about this feature.
          • Like
        • 0 replies
    ×
    ×
    • Create New...