Jump to content
Ultimaker Community of 3D Printing Experts
Antifx

Gcode for different filament?

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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")

Share this post


Link to post
Share on other sites

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 1

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


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

    • Introducing Ultimaker Cura 3.6 | Beta
      Ultimaker Cura 3.6 | Beta is available. It comes with new features, bug fixes, and UX improvements. We would really like to have your feedback on it to make our stable release as good as it can be. As always, you can download the beta for free from our website, for Windows, MacOS, and Linux.
        • Like
      • 95 replies
    • Print Core CC | Red for Ruby
      Q: For some users, abrasive materials may be a new subject matter. Can you explain what it is that makes a material abrasive when you are not sure which print core to use?
      A: Materials which are hard in a solid piece (like metals, ceramics and carbon fibers) will generally also wear down the nozzle. In general one should assume...
        • Like
      • 30 replies
    • "Back To The Future" using Generative Design & Investment Casting
      Designing for light-weight parts is becoming more important, and I’m a firm believer in the need to produce lighter weight, less over-engineered parts for the future. This is for sustainability reasons because we need to be using less raw materials and, in things like transportation, it impacts the energy usage of the product during it’s service life.
        • Like
      • 12 replies
×

Important Information

Welcome to the Ultimaker Community of 3D printing experts. Visit the following links to read more about our Terms of Use or our Privacy Policy. Thank you!