[Solved] Filament getting stuck

Having a problem? Post it here and someone will be along shortly to help
Post Reply
User avatar
Eaglezsoar
ULTIMATE 3D JEDI
Posts: 7159
Joined: Sun Apr 01, 2012 5:26 pm

Re: Filament getting stuck

Post by Eaglezsoar »

enggmaug wrote:Ok, then just let me comment my code for it to be understood easily, and, I'll share it.

Should I just copy the script code here, or give a link to a file hosted somewhere else?
I would copy the script code here by adding it as an attachment and thank you!
“ Do Not Regret Growing Older. It is a Privilege Denied to Many. ”
enggmaug
Printmaster!
Posts: 301
Joined: Wed Nov 13, 2013 3:54 am
Location: Antony, France

Re: Filament getting stuck

Post by enggmaug »

Ok, so you need to have Python (2.7) installed, and you can configure Slic3r to run this script after generating GCode.
This code would not run under python 3.x.
Just copy paste the code in a text file that you rename "WhateverName.py", and place it in a folder of your choice.
You can alternatively run it manually, by changing the path to the Gcode in the script.

Here is the script code :

Code: Select all

#Script to analyse GCode and saturate Extruder commands to SATURATION value
#Guillaume Maugein - Jan 2014

import sys
import re
import os
import Tkinter as tkinter
import tkMessageBox as mbox

#if launched from Slic3r, the filename is passed in parameter automatically
#else, if launched manually, it will parse the file indicated thereafter
if len(sys.argv)>1 :
    filename = sys.argv[1]
else :
    filename = "C:/Users/Guillaume/AppData/Local/RepetierHost/composition.gcode"

#While parsed, modifications are saved to a temporary file in the same folder
#as parsed gcode file
tmpname = os.path.dirname(filename) + "tmp.gcode"

#SATURATION value (in mm)
SATURATION = 10.0

#Variables Initialisations
count = 0 #counting lines in GCode
MaxLine = 0 #Line with Max Extrusion value - for display only
MaxDist = 0.0 #Max Extrusion value - for display only
E = 0.0 #Current Line extrusion value
OldE= 0.0 #Changed Extrusion value of previous line
PreviousE = 0.0 #Actual Extrusion value of previous line
SupSat = 0 #Number of saturated lines - for display only

outputfile = open(tmpname,'w')
inputfile = open(filename,'r')
for line in inputfile:
    count = count + 1
    if line.count(";") > 0 : #Removing comments that could be troublesome
        tmpline = line[0:line.find(";")]
    else :
        tmpline = line

    Out = tmpline.split(" ")
    GCommand = (tmpline.count("G92") != -1) #Searching for G92 commands reseting Extruding distances
    if GCommand :
        for Command in Out:

            Command = Command.upper()
            if Command.count("E0") >= 1:
                E = 0.0
                OldE = 0.0
                PreviousE = 0.0

    GCommand = (tmpline.count("G0") != -1) or (tmpline.count("G1") != -1) #Searching for Extruding commands
    if GCommand :
        for Command in Out:

            CommandU = Command.upper()
            if CommandU.count("E") == 1 : #if there is an extruding command
               OldE = E 
               E = float(CommandU[1:])
               Dist = E - OldE

               if Dist > SATURATION : #if Extruding more than SATURATION mm
                   if E - PreviousE > 0 : 
                       print "Modified Line " + str(count)
                       print "   - Was Extruding " + str(E - PreviousE) + "mm"
                       E = SATURATION+OldE
                       line = re.sub(Command,"E{:.5f}".format(E),line)
                       line = line[0:line.find("\n")-1] + "; Modified by script \n"
                       SupSat = SupSat+1
                   else : 
                       E = OldE + E - PreviousE
                       line = re.sub(Command,"E{:.5f}".format(E),line)
                       line = line[0:line.find("\n")-1] + "; Modified by script \n"
                       print "Modified Line " + str(count)
                       SupSat = SupSat+1
                   
               PreviousE = float(CommandU[1:])
               
               if (Dist > MaxDist) : #Saving Maximum Extruding command (For display only)
                   MaxDist = float(Dist)
                   MaxLine = count



    outputfile.write(line) #Writting to temporary file



outputfile.close()
inputfile.close()



if SupSat > 0 : #If no command is saturated, there is no message
    window = tkinter.Tk()
    window.wm_withdraw()
    #Message to ask if you want to replace GCode or not
    if mbox.askyesno ('GCode Extruder Check',"Extruder Limite Reached : " + str(MaxDist) + " mm in Ligne nb : " + str(MaxLine) + ". \nReplace GCode ?") :
        os.remove(filename)
        os.rename(tmpname, filename)
        print str(SupSat) + " modified lines." #Message Nb of modified lines.
    else :
        os.remove(tmpname) #removing Temporary file
else :
    os.remove(tmpname) #removing Temporary file
    print "Clean Code."

If you need help with it, feel free to ask.
User avatar
Eaglezsoar
ULTIMATE 3D JEDI
Posts: 7159
Joined: Sun Apr 01, 2012 5:26 pm

Re: Filament getting stuck

Post by Eaglezsoar »

Is it possible for you to post a "how to" on configuring Slic3r to run this script after generating the gcode? (some of us need a dummies guide).
“ Do Not Regret Growing Older. It is a Privilege Denied to Many. ”
enggmaug
Printmaster!
Posts: 301
Joined: Wed Nov 13, 2013 3:54 am
Location: Antony, France

Re: Filament getting stuck

Post by enggmaug »

You can set it up in Slic3r print settings - output options tab - as follows (just enter the path of the script as I did):

[img]http://imagizer.imageshack.us/v2/800x60 ... 2/cl0u.png[/img]

I believe I saw a way to launch a script after every Gcode generation, independently of the settings, but I could not find it anymore.
User avatar
Eaglezsoar
ULTIMATE 3D JEDI
Posts: 7159
Joined: Sun Apr 01, 2012 5:26 pm

Re: Filament getting stuck

Post by Eaglezsoar »

Great! Just what we needed to know how to launch your script. Thank you!
“ Do Not Regret Growing Older. It is a Privilege Denied to Many. ”
enggmaug
Printmaster!
Posts: 301
Joined: Wed Nov 13, 2013 3:54 am
Location: Antony, France

Re: Filament getting stuck

Post by enggmaug »

If you do try it, let me know how it works, and if it helps you solve your stuck filament issue.
JonAdkins
Prints-a-lot
Posts: 34
Joined: Wed Nov 27, 2013 12:38 am

Re: Filament getting stuck

Post by JonAdkins »

After running several tests with different filaments, speeds, temperatures my issue has essentially come down to a "Bad Slice" with Slic3r as I ran the same model through Kiss Slicer and everything worked beautifully.

It turns out that the issue was exactly what enggmaug pointed out where it was trying to extrude 100mm instead of 10mm and the hot-end was getting gummed up.

I've found that Slic3r handles manifold models quite well, however, when feeding it non-manifold models things tend to become quite dicey. This is understandable as slicing non-manifold models requires the Slicer to make several assumptions about what you actually want and the math just doesn't always work out for the best.

I found that Cura actually has the best support for non-manifold models in that it allows you to configure how sub-models and cavities are dealt with within the Expert Config section of the tool.

In my case I had created my own supports and baked them into my model file as I wanted to see what the difference would be between a custom support structure and the standard ones that are created automatically. My supports were made up of many interpenetrating posts and struts which ended up working out well from a removal standpoint, but obviously caused the software a bit of grief. In Cura I used Combine Everything Type-B which sounds like it only raycasts the models exterior while slicing, which is exactly what I needed.

The model ended up printing well in Cura, however, Cura doesn't appear to offer the option to set custom Extrusion Width which is a clear issue as I've calibrated my Extrusion Width and Flow as per Polygon Hell's tutorial ( http://forum.seemecnc.com/viewtopic.php?f=54&t=1163 ). I've since printed the same model in Kiss Slicer with stellar results.

I suppose the moral of the story is that every slicer is going to excel in different capacities and it pays to know all the slicers out there, it's really easy to run things through a few different slicers when you're having trouble and choose the one that works best.

The ultimate solution though, as enggmaug pointed out, is to understand enough of what's going on under the hood to at least figure out what the problem is and either ignore it and use a different slicer ( which is what I've done ), or fix it yourself and continue on.

Thanks for all the help with this issue, you guys make up a great community.

-jon
enggmaug
Printmaster!
Posts: 301
Joined: Wed Nov 13, 2013 3:54 am
Location: Antony, France

Re: [Solved] Filament getting stuck

Post by enggmaug »

I have just been lucky enough to be near the machine when it tried to extrude more and more filament while not moving the plateform...

Is there a guide out there to help picking a slicer for a given model ?

The model I was trying to print when I found this problem was indeed manifold.

So I understand you recommend that whenever my script tells me slic3r is trying to extrude too much at a time, I should switch to KissSlicer ?
JonAdkins
Prints-a-lot
Posts: 34
Joined: Wed Nov 27, 2013 12:38 am

Re: [Solved] Filament getting stuck

Post by JonAdkins »

enggmaug wrote:I have just been lucky enough to be near the machine when it tried to extrude more and more filament while not moving the plateform...

Is there a guide out there to help picking a slicer for a given model ?

The model I was trying to print when I found this problem was indeed manifold.

So I understand you recommend that whenever my script tells me slic3r is trying to extrude too much at a time, I should switch to KissSlicer ?
I imagine that this bug will be fixed at some point in the near future as the random addition of zeros to the extrusion calculations is far from normal. I'm going to email the Slic3r developer my STL and GCode and hopefully he can track it down and address the issue. Seeing as over 50% of the community is using Slic3r I'm almost certain they already know about it.

For my issue changing up slicer's worked well, and after digging around various forums and such it really does seem like it pays to have at least a couple slicers installed and configured. I've had the most consistent results with Kisslicer with Cura being a close second. I do like Slic3r, however, some of my models have taken upwards of 4 hours to slice, which is a clear issue when Kiss and Cura can do the same job in less than a minute.

I've only started my journey in the world of 3D Printing and my opinion thus far is that the hardware side of things and the act of extruding filament in layers seems quite known from a development standpoint, however, the software is currently in its infancy. Most of the available slicing software seems to be programmer driven endeavors with little to no thought about the user-experience. This is where companies like Stratasys and 3D Systems are really trying to capitalize. They clearly have a team of engineers working on both the underlying tech and the user experience in an attempt to give users as pleasant of an experience as possible. They realize that the majority of people who are going to become interested in this technology simply want to feed a machine a model and have it come out with reasonable results, they don't want to mess with 30 magic numbers that work together in mysterious ways to produce a result.

Guys like us are always going to gravitate towards solutions that allow us to tweak and tune things to get the best results. For myself, the decision to build a Rostock Max wasn't a financial one, it was one that was aimed at being able to tune a machine to get the results I was looking for, not the ones that Stratasys decided were good enough for me.

My prediction is that an actual software company like Autodesk will swoop in and create commercial tools that produce results far better than anything out there. They'll start, as they already have, by partnering up with one of the big players and then quickly add support for the more DIY oriented printer community.

-jon
User avatar
mhackney
ULTIMATE 3D JEDI
Posts: 5391
Joined: Mon Mar 26, 2012 4:15 pm
Location: MA, USA
Contact:

Re: [Solved] Filament getting stuck

Post by mhackney »

Jon, nice work. Last year about this time I described and researched a similar issue I called hydraulic plugging. This was with the original Steve's extruder. I switched to KISS at the time and have no longer had the problem.

Sublime Layers - my blog on Musings and Experiments in 3D Printing Technology and Art

Start Here:
A Strategy for Successful (and Great) Prints

Strategies for Resolving Print Artifacts

The Eclectic Angler
Post Reply

Return to “Troubleshooting”