Jump to content
Ultimaker Community of 3D Printing Experts

Gcode for different filament?


Recommended Posts

Posted · Gcode for different filament?

I was wondering if there is a way to insert custom GCode for each different filament in cura?

 

It doesn't appear that there is an option to do it in default cura, but are there any plugins that can do it?

 

The reason is I would like to use linear advance, but different types of filament (PLA, PETG, Flexible) require different values for linear advance.

  • Link to post
    Share on other sites
    Posted · Gcode for different filament?

    Well maybe you could create a different machine for each type of filament?  Then each machine could have different start codes.  You could also create a plugin to do this easily and the plugin input value (the gcode) could show up as one of the many profile settings.  This would probably be a plugin that other people would use.  It's easiest to look at an existing plugin and just make the minor modifications to make it do your gcode insertion thing.

  • Link to post
    Share on other sites
    Posted · Gcode for different filament?

    The start gcode can contain replacement patterns such as {material_print_temperature} which will be automatically replaced with -in this case- the material temperature. Now there is no setting for linear advance in Cura, so no replacement pattern either (or is there?).

     

    I recently wrote a plugin to be able to enter a Z Offset in the sidebar. I can easily adapt that to add a Linear Advance setting that you can use in your start gcode (but that has no other effect). Does that make sense? I must admit I don’t know what gcode you need for linear advance.

     

     

    If you really want different start gcode, and you are not affraid of editing text-files, you can manually edit your quality profiles to include start gcode snippets.

     

    In the Configuration folder, there’s a folder named “definition_changes”, which has a .inst.cfg file for your printer(s) containing the changes you make in Machine Settings - including start gcode. The “quality_changes” folder contains very similar files, for the quality profiles you created. You can copy and edit the gcode snippets to the quality_changes files, and that will override what is set in the machine settings.

     

    I would NOT recommend the latter route.

  • Link to post
    Share on other sites
    Posted · Gcode for different filament?

    So, help me out here... how many settings do you want?

     

    From the documentation I see that you either use one setting: Linear Advance Ratio) which ends up as eg M900 R{material_linear_advance_ratio}

    Or you can have a Factor, Width and Height as well as the material(?) diameter.

     

    Would just having the former be enough, or is there a case for requiring the latter?

  • Link to post
    Share on other sites
    Posted · Gcode for different filament?

    All examples that i have seen so far are using the 'K factor' only, so M900 K{material_linear_advance_factor} should be sufficient.

     

    http://marlinfw.org/docs/features/lin_advance.html#setting-the-k-factor-for-production

     

    But i also found a note that for Cura an additional "M900 W[width] H[height] D[diam]" works better.

    And layer height, filament diameter, and extrusion width are already known. Should be possible.

     

    https://mattshub.com/2017/10/02/linear-advance/

    (search for "One small note")

  • Link to post
    Share on other sites
    Posted · Gcode for different filament?

    Here's a quick plugin: http://files.fieldofview.com/temp/LinearAdvanceSettingPlugin.curaplugin

    Source: https://github.com/fieldofview/LinearAdvanceSettingPlugin

     

    The plugin adds a single setting named "Linear Advance Factor" to the material category in the sidebar (use the search field!). Note that by itself setting this value has no effect whatsoever on the gcode. Only by using the value in eg the start gcode snippet will there be any effect, eg like this:

    M900 K{material_linear_advance_factor}
    M900 W{line_width} H{layer_height} D{material_diameter}

    Note that beyond a smoke-test in Cura, this plugin has not been tested at all, and I currently have no plans to have it included in the plugin browser. Feedback is welcome.

    • Like 1
    • Thanks 2
    Link to post
    Share on other sites
    Posted · Gcode for different filament?
    On 2/10/2018 at 5:06 AM, ahoeben said:

     

    Resurrecting for a bit - I'm in a similar situation, but I actually use two gcodes per filament - Linear Advance (M900) and Steps/mm (M92). Both of these can vary per filament - material type, viscosity, that kind of thing. I suppose I can reverse engineer the above plugin and add an additional setting for Steps/mm - any chance there's been discussion of adding a generic 'Start Gcode' field to the Material Preference tab? I'm accustomed to doing this in Slic3r and Simplify and prefer supported solutions when possible.

  • Link to post
    Share on other sites
    Posted · Gcode for different filament?

    Editing the plugin is trivial. Adding a multi-line textedit widget to the Cura sidebar is far less so.

     

    I have already outlined a way to edit configuration files to add start gcode to your quality profiles.

  • Link to post
    Share on other sites
    Posted · Gcode for different filament?

    K. I'll likely do the multiple machine profiles approach - settings in there aren't often changed, short of a wholesale revision of the start/end codes. After all you say manually editing config files is not recommended. Still think it's valid to have filament specific codes, but fine working through an adaptation in process from one slicer to another. Thanks.

    -owl

  • 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
    ×
    ×
    • Create New...