Jump to content

Recommended Posts

Posted · New Plugin - Swap At Height

Hello,

I'm working on a small plugin in Cura to swap gcode at a given height. The goal is to make it possible to merge gcodes with different settings like different infill.

So far I find the layer at z replace the content from that point and until the end or the given z. Recalculate layer count and layer indices, add G0 movements to travel to layer start point, recalculate E.

I haven't tried to print yet. The preview in Cura is working but the layer view doesnt display new layers (if other gcode as different layer height) and the print time is not updated.

Is there anything I'm missing? This is my first time playing with gcodes and plugins...

swap at height

 

EDIT:

Available on Youmagine

https://www.youmagine.com/designs/swap-at-z

 

  • Link to post
    Share on other sites

    • Replies 68
    • Created
    • Last Reply

    Top Posters In This Topic

    Posted · New Plugin - Swap At Height

    The tricky part is the E values. Nice work.

    As far as I can tell, the layer view takes the outer shell directly from the slicer, but then the second pass (inner shell, infill, brim, support, etc) comes from the gcode after your plugin. This means it can show the wrong shell but the correct infill. To truly visualize the gcode it's best to "clear platform" and then "load model file" and load the gcode result.

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

    Although this feature is built into the new Cura (pink unicorn) which isn't out yet but I assume will be soon - maybe one of those announcements on September 18.

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

    Inner shell is good. It display the good one.

    The display isn't good if you change geometry between the gcodes. When the swapped section is in focus on the layer view it does display the good one but not when out of focus.

    Loading the gcode on a clear platform give weird results. Thanks for the tip. It will help me figure it out.

    Are you sure the feature you refer to in PU is not different settings per object?

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

    I found some issues with loading a gcode file on a clear platform more than once. This was performed with a regular gcode (it did not include swapped content)

    - load gcode, display is correct

    - switch to normal view

    - switch back to layer view

    - clear platform

    - load gcode. The second gcode doesnt display the same content.

    * If you dont switch to normal view the second gcode is correct.

    ** output log display an error about a division by zero. Could be related (or not).

     


    Traceback (most recent call last):
    File "Cura\gui\sceneView.py", line 553, in _onRunEngine
    self._engine.runEngine(self._scene)
    File "Cura\util\sliceEngine.py", line 295, in runEngine
    for k, v in self._engineSettings(extruderCount).iteritems():
    File "Cura\util\sliceEngine.py", line 498, in _engineSettings
    settings['fanFullOnLayerNr'] = (fanFullHeight - settings['initialLayerThickness'] - 1) / settings['layerThickness'] + 1
    ZeroDivisionError: integer division or modulo by zero

    Also when loading a gcode the layers are placed properly but the camera height is still dependent on layer height setting. It doesnt follow the Z value of the displayed layer.

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

    I think Daid would normally fix this but I think he is working on PU instead. I'm pretty sure PU will let you switch by height as well as by object.

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

     

    Swapping is advancing nicely.

    - Swap start and end are working properly.

    - Material usage is updated but doesn't show in Cura.

    - I dont know how to recalculate the time (other plugins dont seems to do it)

    - Works for different layer heights

    layer thickness

     

    - Seems to works with all settings so far (speed, shell, infill, ...).

    swap settings

     

    - Stacking multiple swap plugins works to. You could transition you infill settings from 10% to 20% to 30%.

     

    *I have not tested any other gcode flavor or dual material. I have not tested every single settings.

     

    Test print

    IMG 20140909 234452

     

    You can test it yourself here (download SwapAtZ.py)

    https://github.com/pmsimard/Cura/tree/SteamEngine/plugins

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

    I think Daid would normally fix this but I think he is working on PU instead. I'm pretty sure PU will let you switch by height as well as by object.

     

    Yeah these are pretty minor and I prefer investing Daid's time on PU too :D. Hopefully PU will do. If not it will eventually

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

    Good evening,

     

    How to install your plugin?

    Is it that you can not necessarily use all the time?

     

    I'm interested in some parts.

     

    Thank you.

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

    -Go on GitHub (link above)

    -Right click on SwapAtZ.py and select save link as ...

    -Save the .py file in your currently installed Cura (..\Cura_14.07\plugins\) folder.

    -Start Cura

    -Plugin should show up.

    -Make sure to check the layer view.

    Be warned that this is still a very early version.

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

    Ok!

     

    Thank you very much for the information. I will follow very closely the progress of your code.

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

    @pm_dude: Hope you don't mind me making suggestions for improvements. On the Dutch forum section there is interest to use this plugin to change layer height mid print. I foresee some problems when at the switch height both or one gcode files doesn't have a layer at that height. Like printing a 0.3mm layer only 0.1mm above the previous layer resulting in over extrusion. So I want to try to build in some warning when there is a mismatch of layer height. when switching.

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

    Yes there is a risk for that and for the opposite case too. I dont mind suggestions :).

    There are needs for improvements such as:

    - Using the travel speed instead of the print speed when moving toward the end point of the previous layer.

    - Currently it travel but dont trigger retraction.

    - Layer gap/compression could be added too. (your point)

    - I have not tested with the "Z hop when retracting" option

    - I still dont support dual extrusion or non UltiGCode flavor.

    - Calculating proper time estimate.

    - Need support for print one at the time mode.

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

    @gr5 Do you think I can simply multiply the E value to compensate a potential over extrusion?

    If the next layer is planned for a thickness of 0.3mm but there is space for 0.2mm I could scale E by 2/3 and reduce the extrusion. Could that also cause spacing between the lines?

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height
    @gr5 Do you think I can simply multiply the E value to compensate a potential over extrusion?

     

    Yes. But it's complicated by the fact that E values are sums/totals for "the entire print so far".

    I was wondering how you handle switching to the other print with different E starting value. Do you adjust all the new values? Or do you use the G92 command (reset position)?

    For example lets say you cut off the first print at E1000 (1000 cubic mm of filament used so far) and the layer to start next happens to start at E2000. You can either do a G92 E2000 to reset the position or you can subtract 1000 from all the future E values.

    Now with your multiplier - lets call it 1.5. If the next line goes to E2001 you don't want to multiply by 1.5 to get E3001.5 - you want to go to E2001.5

    So you are multiplying the deltas by your multiplier. Not the absolute values.

    Alternatively you can multiply all the new E values by the multiplier but do a G92 3000 just before this.

    Too many choices!

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

    I calculate the delta between the last E value and the E value of the other gcode and update all the E values that will be inserted. It should be easy to do it also with multiplying the delta of E and offsetting everything afterward.

    what is G92 code? I really need to read more about the codes. I think the Marlin github has a list of the implemented codes.

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

    It does. But I usually look it up on http://reprap.org/wiki/G-code

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

    Interesting. That G92 command would have been useful but its done already... :D

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

    Hello,

    I submitter a new version on git:

    https://github.com/pmsimard/Cura/blob/SteamEngine/plugins/swapAtZ.py

    Update on the previous list:

    - Using the travel speed instead of the print speed when moving toward the end point of the previous layer. No G0 travel needed.

    - Currently it travel but dont trigger retraction.

    - Layer gap/compression could be added too. (your point)

    - I have not tested with the "Z hop when retracting" option

    - I still dont support dual extrusion or non UltiGCode flavor.

    - Calculating proper time estimate.

    - Need support for print one at the time mode.

     

    Additionally:

    - I rewrote most of it to make it simpler to read and to support more features.

    - More log but in output.txt

    - Adding ;SwapAtZ in resulting gcode to easily locate the swap

     

    Thanks Dirkels for testing and your inputs :)

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

    I have updated the SwapAtZ plugin in github. It now include some changes provided by Dirkels and better support layer height differences.

    If you test with a different gcode flavor please let me know if you find anything suspicious.

    Always check the result by loading the saved gcode in Cura.

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

    the delta of E and offsetting everything afterward.

     

    You should stick with G92. The problem is Marlin runs on a wimpy computer that can't handle E values larger than a few thousand so every 9999 (not sure the exact roll over number) or so Marlin resets E back to zero (and adds a G92). If you modify the remaining E values with an offset you will be requesting negative E values.

    So you either need to detect G92 values that already exist in the code and modify your offsets when found. Or you should do your own G92 value when swapping.

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

    Thanks for the heads up! I'll change that.

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

    Hello,

    i save the swapAtZ.py File in the Cura_14.07\plugins Folder. But the plugin isn´t starting with cura.

    pauseAtZ and TweakAtZ starts!

    What is the problem?

    greeting Thorsten

     

  • Link to post
    Share on other sites

    Posted · New Plugin - Swap At Height

    good question. Can you see any errors in the output.txt file located in your install folder?

     

  • 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.9 stable released!
        Here comes Cura 5.9 and in this stable release we have lots of material and printer profiles for UltiMaker printers, including the newly released Sketch Sprint. Additionally, scarf seams have been introduced alongside even more print settings and improvements.  Check out the rest of this article to find out the details on all of that and more
          • Like
        • 5 replies
      • Introducing the UltiMaker Factor 4
        We are happy to announce the next evolution in the UltiMaker 3D printer lineup: the UltiMaker Factor 4 industrial-grade 3D printer, designed to take manufacturing to new levels of efficiency and reliability. Factor 4 is an end-to-end 3D printing solution for light industrial applications
          • Heart
          • Thanks
          • Like
        • 4 replies
    ×
    ×
    • Create New...