Jump to content

How to deal with Post-processing script "Retract Continue"


Supramaker
Go to solution Solved by GregValiant,

Recommended Posts

Posted · How to deal with Post-processing script "Retract Continue"

 

 

I did some investigations and found out that my problem with underextrusion immediately after retraction is caused by quirks in the gcode, which only happen when I use a specific quality profile. Essentially, actual retraction is larger than the value configured in the settings and priming won't compensate.

 

 

 

When I use a different, but similar quality profile (which I used heavily in the past with a different printer), all retractions and priming value in the gcode make perfect sense.

 

Using the current quality profile in question, I get underextrusion and strange things appear in the gcode.

 

I removed post-processing scripts, set extra prime amount and coasting to zero, and used a retraction of 2 mm in both cases.

 

This is just an example:

G1 X133.18 Y219.808 E191.60831                last extrusion of previous line
G0 F1710 X132.305 Y219.808 E191.60831         travel
M566 X1800 Y1800
G1 F7200 E182.56831                           questionable retraction of 9.04 mm (setting is only 2 mm) 
G1 F18000 Z1.4                                z-hop
G0 F42000 X132.305 Y218.868 Z1.4 E189.60831   priming 7.04 mm - why?
G0 X167.7 Y214.946 E189.60831                 travel
M566 X600 Y600
G1 F18000 Z1                                  nozzle down
G1 F7200 E184.56831                           retraction of 5.04 mm, why?
G1 F1800 X167.568 Y213.748 E191.65641         priming 7.088 mm (this is too much for a small move)

 

Either I am not able to understand what cura does or we have a bug. I have been perusing gcode files for a while now (along with printing models) and I am cocksure that Cura is misbehaving. 

 

I am still looking at the differences between the two profiles, and am going to align the settings one by one, in order to find the culprit. Something causes Cura to run riot.

 

This is somehow a relief for me because the results of my efforts to fix this issue at at best very puzzling. A bug would be an plausible explanation.

 

At this point I won't follow the path of using post-processing scripts to fix this by now, they are the wrong solution.

 

My confidence in Cura has been shattered a bit. I will definitely write some scripts to quickly analyse and check the soundness of gcode files, that should save a lot of time and material (I will be using script tools that I master, not Python). 

 

Nevertheless, RetractContinue and ScalableExtraPrime are very interesting tools that I will keep in mind in for cases where they are suitable.

 

Honestly, the best thing to do would be replacing the nozzle with one having a valve... perhaps someday.

 

  • Link to post
    Share on other sites

    Posted · How to deal with Post-processing script "Retract Continue"

    What OS and Cura version are you running? Whoever wrote this seems to have absolutely no idea how navigating file systems works in Python.

     

    Anyway... in ScalableExtraPrime.py try changing line 14 so that it's just:

    import ScalableExtraPrimeAdjuster

     

  • Link to post
    Share on other sites

    Posted · How to deal with Post-processing script "Retract Continue"

    The same import line has to be corrected in the file _init_.py too.

    But there is a new issue.

     

    After restarting Cura. Cura rejects the plugin and proposes to remove it (directly in the GUI:

     

    image.thumb.gif.ef7fe539c09a0951c2cd61ee571e99b8.gif

    Re-installing does not help.

    From the log:

     

    2023-11-18 11:35:36,622 - WARNING - [MainThread] UM.PluginRegistry.loadPlugin [541]: Plugin [ScalableExtraPrime] failed to register: 'module' object is not callable
    2023-11-18 11:35:36,626 - ERROR - [MainThread] UM.PluginRegistry.removeCorruptedPluginMessage [575]: Exception: Error loading plugin ScalableExtraPrime:
    2023-11-18 11:35:36,628 - ERROR - [MainThread] UM.PluginRegistry.removeCorruptedPluginMessage [575]: Traceback (most recent call last):
    2023-11-18 11:35:36,628 - ERROR - [MainThread] UM.PluginRegistry.removeCorruptedPluginMessage [575]:   File "UM\PluginRegistry.py", line 510, in loadPlugin
    2023-11-18 11:35:36,629 - ERROR - [MainThread] UM.PluginRegistry.removeCorruptedPluginMessage [575]:     to_register = plugin.register(self._application)  # type: ignore  # We catch AttributeError on this in case register() doesn't exist.
    2023-11-18 11:35:36,630 - ERROR - [MainThread] UM.PluginRegistry.removeCorruptedPluginMessage [575]:   File "C:\Users\rcast\AppData\Roaming\cura\5.5\plugins\ScalableExtraPrime\ScalableExtraPrime\__init__.py", line 12, in register
    2023-11-18 11:35:36,630 - ERROR - [MainThread] UM.PluginRegistry.removeCorruptedPluginMessage [575]:     return {"extension": ScalableExtraPrime.ScalableExtraPrime()}
    2023-11-18 11:35:36,631 - ERROR - [MainThread] UM.PluginRegistry.removeCorruptedPluginMessage [575]: TypeError: 'module' object is not callable

     

    It's your turn 🙂

  • Link to post
    Share on other sites

    Posted · How to deal with Post-processing script "Retract Continue"
    46 minutes ago, Supramaker said:

    It's your turn 🙂

     

    Okay, revert the from . import blah blah changes. Cura's Python interpreter must be calling the script from outside its own directory (since Python 3.3, for a file in the same directory, usually you can just import AnotherFile but not if it's called from outside its own directory in which case it does need to use . to refer to its own directory).

     

    What can I say - it works fine for me. The error you posted earlier about it being considered a post-processing script clearly shows you have (or at least had, at the time) put some (or all) of the plugin files into the directory for posts:

    File "C:\Program Files\UltiMaker Cura 5.5.0\share\cura\plugins\PostProcessingPlugin\PostProcessingPlugin.py", line 207, in loadScripts
         spec.loader.exec_module(loaded_script)  # type: ignore
       File "<frozen importlib._bootstrap_external>", line 883, in exec_module
       File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
       File "C:\Users\rcast\AppData\Roaming\cura\5.5\scripts\ScalableExtraPrime.py", line 14, in <module>

    Specifically, that last line there is a dead giveaway. Have you already made sure to nuke any trace of this plugin from everywhere in the configuration directory except its own subdirectory in the plugins folder?

  • Link to post
    Share on other sites

    Posted · How to deal with Post-processing script "Retract Continue"
    6 minutes ago, Slashee_the_Cow said:

    What can I say - it works fine for me.

    What do you mean with that? The GUI elements appear in the settings (see my posting above), but that does not prove that it is effectively doing what it should. My practical tests have shown no effect in the printing, and I did not even look at the gcode to verify that, because it is obvious that if the subroutine ScalableExtraPrimeAdjust (which is invoked in ScalableExtraPrime) cannot be loaded, the main script won't work. 

     

    So for me, it looks as though it would work, but it does not. The script ScalableExtraPrimeAdjust must be put in the same directory, it is called from there. And as you yourself confirmed, it is part of the plugin, not just an independent script that could be taken out.

     

    Where are the places to look in order to remove the remains of the plugin, in order to have a clean state for reload?

    Why do you assume that such remains are still there?

     

    In the logs, Cura confirmed the clean removal of the plugin. Since the deinstallation was done by Cura itself, it should have gone well.

     

    The line in the log:

     

    2023-11-18 11:35:40,445 - ERROR - [MainThread] PostProcessingPlugin.PostProcessingPlugin.loadScripts [227]: AttributeError: module 'PostProcessingPlugin.PostProcessingPlugin.ScalableExtraPrimeAdjuster' has no attribute 'ScalableExtraPrimeAdjuster'

     

    states clearly that we have an ERROR (not a warning, not a notice or something else) and should not be trivialized.

     

    We got stuck in the troubleshooting work, I fear.

     

  • Link to post
    Share on other sites

    Posted · How to deal with Post-processing script "Retract Continue"

    PostProcessingPlugin searches only the scripts directory in the configuration directory, as well as Cura's own install folder.

     

    From C:\Program Files\UltiMaker Cura 5.5.0\share\cura\plugins\PostProcessingPlugin\PostProcessingPlugin.py

    # Make sure a "scripts" folder exists in the main configuration folder and the preferences folder.
            # On some platforms the resources and preferences folders resolve to the same folder,
            # but on Linux they can be different.
            for path in set([os.path.join(Resources.getStoragePath(r), "scripts") for r in [Resources.Resources, Resources.Preferences]]):
                if not os.path.isdir(path):
                    try:
                        os.makedirs(path)
                    except OSError:
                        Logger.log("w", "Unable to create a folder for scripts: " + path)
    
            # The PostProcessingPlugin path is for built-in scripts.
            # The Resources path is where the user should store custom scripts.
            # The Preferences path is legacy, where the user may previously have stored scripts.
            resource_folders = [PluginRegistry.getInstance().getPluginPath("PostProcessingPlugin"), Resources.getStoragePath(Resources.Preferences)]
            resource_folders.extend(Resources.getAllPathsForType(Resources.Resources))
    
            for root in resource_folders:
                if root is None:
                    continue
                path = os.path.join(root, "scripts")
                if not os.path.isdir(path):
                    continue
                self.loadScripts(path)

     

    If you are getting an error related to PostProcessingPlugin it's for something which has to be in the scripts folder.

     

    Cura probably wouldn't remove stray files in the scripts folder because it wouldn't expect them to be there in the first place.

     

    So please, humour me, just look.

  • Link to post
    Share on other sites

    Posted · How to deal with Post-processing script "Retract Continue"
    1 hour ago, Slashee_the_Cow said:

    Cura probably wouldn't remove stray files in the scripts folder because it wouldn't expect them to be there in the first place.

    I asked not out of skepticism, on the contrary. I noticed that even after removing the scripts from the user-script folder I was still seeing messages about those scripts in the log.

     

    Thanks for that tip - I am still learning.

     

    I reverted the scripts and the plugin is loaded. I also found that the script ScalableExtraPrimeTest can be completely ignored, it is not invoked anywhere.

     

     

  • Link to post
    Share on other sites

    Posted · How to deal with Post-processing script "Retract Continue"
    1 hour ago, Supramaker said:

    I also found that the script ScalableExtraPrimeTest can be completely ignored, it is not invoked anywhere.

    It's unit testing used in development - automated tests that you can run at any time that have an expected result, so you can tell if you've broken anything. It's only there because that GitHub repo is the whole development environment.

  • Link to post
    Share on other sites

    Posted · How to deal with Post-processing script "Retract Continue"

    After I did a clean reload the plugin was loaded without any dubious messages in the log.

     

    While Marketplace Plugins can be managed in the GUI, Cura seems to lack a controlled method for removing user plugins (to my limited knowledge).

     

    Loading is one thing, the actual effect of the script is the other one. Anyway, it can be tested now.

  • Link to post
    Share on other sites

    Posted · How to deal with Post-processing script "Retract Continue"

    I could not see any difference in the gcode using the plugin ScalablaExtraPrime.

    It does not work, it changes nothing.

    But it makes a good impression 🤩

     

  • Link to post
    Share on other sites

    Posted · How to deal with Post-processing script "Retract Continue"
    53 minutes ago, Supramaker said:

    It does not work, it changes nothing.

    But it makes a good impression 🤩

     

    On 11/18/2023 at 3:19 AM, GregValiant said:

    The plugin was put together in 2018.  On August 25, 2023 the author added a note to the ReadMe.md file.

    "This plugin is no longer being developed or updated and should not be used.".

    The note appears to have been added after the author made an attempt to get the plugin to work with Relative Extrusion.  At that point it appears that the towel came flying into the ring.

    You can leave a note on the GitHub page.  Maybe showing some interest will get Pheneeny to think about it some more.

    Doubt @GregValiant at your own risk.

  • Link to post
    Share on other sites

    Posted · How to deal with Post-processing script "Retract Continue"

    I started this thread about post-processing scripts, because I thought I would need them.

    In the meantime I realized that my problem with underextrusion right after retraction was due with something wrong in the settings (after analyzing the gcode files directly), why I interpreted as a bug in Cura (debatable).

     

    I found the culprit and corrected the settings. No underextrusion any more. Great relief.

     

    The post-processing scripts could still be a help in subtle improvements, assuming that they work at all. And I wonder if there is a repository for such post-processing scripts somewhere, at least I don't see them in Cura's Marketplace.

  • Link to post
    Share on other sites

    Posted · How to deal with Post-processing script "Retract Continue"
    6 hours ago, Supramaker said:

    The post-processing scripts could still be a help in subtle improvements, assuming that they work at all. And I wonder if there is a repository for such post-processing scripts somewhere, at least I don't see them in Cura's Marketplace.

    Nope, no single place. Which actually seems like an oversight, really, although a lot of Cura users will never need them.

     

    I would say it's not that hard to write your own posts, but my view is probably slanted by the fact that I've known Python since long before I used Cura.

  • Link to post
    Share on other sites

    Posted · How to deal with Post-processing script "Retract Continue"

    "The post-processing scripts ... assuming that they work at all."

     

    I don't want to toot my own horn, but I might be the best at post processing scripts that barely work.  I don't collect them per se.  They just magicly appear from the ends of my fingers.

  • Link to post
    Share on other sites

    Posted · How to deal with Post-processing script "Retract Continue"

    I am determined to write a post-processing script aiming to give an overview of what is happening layerwise (not changing anything).

    After what I experience with troubles due to unexpected quirks of Cura, I got tired of looking at the Gcode and numbers to figure out what is happening.

     

    I actually have begun trying to process the Gcode, using awk (since it is actually just text).

    At some point, I will do it in Python as a post-processing script.

     

    And nobody asks what actually was spoiling my prints... My post must be very boring. Had I have that analysis tool, I would have recognized the problem at once. That's why I will write one.

  • Link to post
    Share on other sites

    Posted · How to deal with Post-processing script "Retract Continue"
    5 hours ago, Supramaker said:

    And nobody asks what actually was spoiling my prints... My post must be very boring. Had I have that analysis tool, I would have recognized the problem at once. That's why I will write one.

    We're a trusting bunch. If you say you need help with the retract continue script, we help you with the retract continue script, not ask "what's going wrong" so we can question whether the retract continue script is what you need.

  • 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
        • 23 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...