fieldofview / cura-linearadvancesettingplugin Goto Github PK
View Code? Open in Web Editor NEWA Cura plugin that adds a Linear Advance Factor setting for use in start gcode snippets
License: GNU Affero General Public License v3.0
A Cura plugin that adds a Linear Advance Factor setting for use in start gcode snippets
License: GNU Affero General Public License v3.0
Running MacOS 10.14, immediately after installing this plugin from the Marketplace, Cura will no longer save 3MF files for me. If I uninstall it, Cura can save again.
I seem to have a ton of these now being inserted:
;TYPE:XXX
M900 K0.090000 T0 ;added by LinearAdvanceSettingPlugin
When Marlin hits one of these, it causes the print head to pause which is causing defects in the print.
I only have a single extruder, so I think 1 would be enough. Maybe keep track of the last extruder_nr
and only insert the M900 if it changes. I'll take the tweak on my side and see if that helps.
This helps me. Not sure about multiple extruders. It should work:
last_extruder_factors = {}
for layer_nr, layer in enumerate(gcode_list):
lines = layer.split("\n")
lines_changed = False
for line_nr, line in enumerate(lines):
if line.startswith(";TYPE:"):
# Changed line type
feature_type = line[6:] # remove ";TYPE:"
try:
setting_key = self.__gcode_type_to_setting_key[feature_type]
except KeyError:
Logger.log("w", "Unknown feature type in gcode: ", feature_type)
setting_key = ""
for extruder_stack in used_extruder_stacks:
if setting_key:
linear_advance_factor = extruder_stack.getProperty(setting_key, "value")
else: # unknown feature type
linear_advance_factor = 0 # no linear advance compensation for this feature
extruder_nr = extruder_stack.getProperty("extruder_nr", "value")
last_linear_advance_factor = last_extruder_factors.get(extruder_nr, -1)
if linear_advance_factor != last_linear_advance_factor:
last_extruder_factors[extruder_nr] = linear_advance_factor
lines.insert(line_nr + 1, "M900 K%f T%d ;added by LinearAdvanceSettingPlugin" % (linear_advance_factor, extruder_nr))
lines_changed = True
I went from 101 M900 calls in my calibration cube, to a single M900 at the very top.
Edit: Looking at the source for M900 in Marin, it will cause the planner to execute all the buffered commands before it sets the value, which makes sense, but, this causes, at least over Octoprint, a long enough pause that it can cause artifacts on the print.
Edit Again: I just noticed you are also using the feature type. So my example fix is probably not fully baked at the moment.
Question 1:
Is there any chance you may add languages to this plugin?
Question 2:
If I try to realize what above in a PR (not sure I can do it), is there any chance it will be merged?
Thanks for your attention
Hey ;)
There are no comma numbers taken over.
for example 0.4
I need that for Linear Advance> v1.5
Thanks in advance.
Greets David
Is this still active? Or have I missed something?
Thanks
Hi @fieldOfView
Marlin's documentation is a bit vague about it.
Some slicers have options to control the nozzle pressure. Common names are: Pressure advance, Coast at end, extra restart length after retract. Disable these options as they will interfere with Linear Advance.
Also disable options like wipe while retract or combing. There should be almost no ooze, once the proper K-Factor is found.
Recheck retraction distance, once Linear Advance is calibrated and working well. It may even be as low as 0, since pressure control reduces the material pressure at the end of a line to nearly zero.
Of course they must focus on the firmware and cannot exemplify every slicer. So I think your plugin can be a good place to properly document this options for Cura.
As you surely have more experience with Linear Advance, I want to ask you what exactly these options are.
This could be documented in the readme, but it would be interesting to show it in the same GUI as a tooltip, warning, or disable it directly.
Thanks for all,
Regards
Matias.
Depuis Marlin 1.1.9 le facteur K à changé si je rentre 0.35 ça me fait un k0 dans mon start gcode.
New K value required
As the unit of K has changed, you have to redo the K calibration procedure. See next chapter for details. While old v1 K values for PLA might be between 30-130, you can now expect K to be around 0.1-2.0.
http://marlinfw.org/docs/features/lin_advance.html#special-notes-for-v1.5
Hi.
I do not know if this should be better implemented in marlin but it would increase print speed if travel moves are not done with linear advance. This would increase gcode size but results in a faster print.
Hello,
I installed Ultimaker Cura 5.0.0 and the Linear Advance Settings plugin version 3.6.0.
I entered the following into the material file:
<cura:setting key="material_linear_advance_factor">1.43</cura:setting>
I entered the following into the intent profile:
material_linear_advance_enable = True
When I call up the corresponding profile in Cura (after Cura restart), Linear Advance is always deactivated. When activated, the values are visible.
Even if I put material_linear_advance_factor in the intent profile it doesn't work.
You always have to activate Linear Advance manually.
Bug or am I doing something wrong?
The documentation has an invalid GCODE M900 conversion macro that doesn't work on current versions of klipper (maybe past versions too?). Instead, you should update the readme to this valid alternative:
[gcode_macro M900]
gcode:
# Parameters
{% set pa = params.K|float %}
SET_PRESSURE_ADVANCE ADVANCE={pa}
When I set the option to 0, it does not add the command to the gcode. The printer then uses the previously set value, instead of disabling linear advance.
When attempting to use a separate extruder for support, I get an Error 1
when saving a GCode file or sending it to OctoPrint, or even when saving a Cura project file once it is sliced.
I'm using Cura 4.8 on Windows. I use Extruder 1 as my main extruder, and it has extensive speed/acc/K adjustments. Extruder 2 is my support extruder and has no explicit K values set. When I remove all K adjustments from Extruder 1 or change the support extruder back to Extruder 1, the files save just fine.
Setting the adhesion extruder to Extruder 2 doesn't seem to cause any issues.
I was trying to print a couple calibration cubes with different values as it's hard for me to tell which is best with a tower. Is it possible to get this to work in the Settings for "Select Settings to Customize for this Model' dialog, which is the per model settings?
When reviewing the latest version of the plugin, I first tried with the attached file, which only prints a single layer.
It seems it attaches the 'M900' line near the end rather than at the beginning in this case. Other files where fine.
I couldn't reproduce this with 4.7 or current main branch, but that might be because the original project didn't give any layers at all. If I tried to scale it up (120%) I did get a single layer, but the 'M900' appears in the correct place in those particular cases.
This didn't seem like an issue big enough to reject it over, but you might still want to know about it :-)
Thank you very much for this great plugin.
I use this plugin mostly to disable LA for the first layer. But it seems if I only set the Initial Layer Linear Advance Factor to 0. Nothing would happen.
There is only ONE line of M900 in the sliced G code file.
But if I changed any one of the other Factors in Cura, it seems the problem is gone.
There are multiple M900, with the M900 K0 just before the first layer.
I am wondering, is this a problem ? or did I miss something on the correct usage ?
Thank you once again!
Hey there. I saw a crash go by through Cura's issue reporter that occurs in the code of this plug-in:
https://sentry.io/share/issue/ff9a2d954c384a52ab9652e8e182e097/
I'm not entirely sure what to do with this. It's not able to find a container called artillery_sidewinder_x1_0.4
, but apparently you are getting an _onContainerLoadComplete
call from it. This Artillery Sidewinder is not a printer that's by default in Cura, and I know it as a printer that people regularly mod into Cura by copy-pasting files in there.
I'm unable to reproduce the crash myself. Maybe this could happen somewhere in multi-threading, if something deletes the variant before it gets to process your callback? It looks like this is a nozzle profile so you wouldn't be interested in it anyway. In any case, maybe it'd be good to skip this function if the ID doesn't exist.
The K factor depends only of material and printer. Many people may have only 1 printer so it may be a good option to save the factor with the material. Changing material could then automatically change the K same as it does for plate and nozzle temperature.
People with several printers may duplicate the material for each printer that requires different K.
Hi,
First and foremost: thanks for this plugin and your work on Cura itself. Much appreciated. Now, my suggestion:
Currently you add the LA Factor to the Custom print profile. However with Cura 4.0 you can configure different materials and brands of filament (like PLA, PETG, ABS) and use those material profiles to for example adjust Hotend and Bed temperature. So you basically keep your print profile, change the material and voila, you got the correct temps for the chosen material.
I'd love to see this for LinearAdvance too. So instead of having to maintain different print profiles for various LA values, you'd just like the LA value to the material database. This way you can still use a single custom print profile, but adjust LA by just switching materials.
Here's where i'd like to see the option:
The results from the Marlin calibration pattern don't seem to translate to real world prints, so I'd like to be able to calibrate K by printing an array of test objects, each with a different K.
Alternatively, if K could be adjusted in the 'ChangeAtZ' post processing plugin, one could create K towers similar to what Klipper provides for calibrating pressure advance. I've already made K towers for my printer by hand editing G Code, but other Marlin users might be interested in K arrays or K towers.
Right now, using the plugin will always cause a M900 to be included in the GCODE, as far as I'm aware.
For some prints I don't want to override the firmware value. Leaving the Linear Advance factor at 0 will still include a M900 K0.
Can you include a checkbox like "Enable Linear Advance Control", silimar to Curas "Enable Acceleration control" that will toggle the entire feature?
Hi!
I have several different printers configurated in Cura, some of them do not support Linear Advance, some do. If I install the plugin, it puts a M572 or M900 in every G-code file, which causes the printers that do not support LA to throw an error.
I tried to do a post-processing via Search&Replace, but it seems that the LA plugin runs after the Post Processing Plugin, therefor I cannot get rid of the unwanted command.
The Post Processing steps are saved per printer, so it would normally work.
Is there a way to deactivate the plugin per printer oder at least run the plugin before the Post Processing Plugin?
Application Version
4.11.x and above
Printer
Ender 5 Plus with BTT SKR PRO 1.2 / BTT TFT50v3 / Marlin 2.9.0.1 and above
Reproduction steps
Installed Cura 4.11.x / 4.12.x / 4.13.0b
Installed LinearAdvance Plugin (latest version)
Sliced the Thingiverse Calibration Cube in Cura 4.11.x and above
Start Print: Ender 5 Plus with BTT SKR PRO 1.2 / BTT TFT50v3 / Marlin 2.9.0.1 and above.
Actual results:
In Marlin LinearAdvance ist activated (see attached files).
In Cura the PlugIn "LinearAdvance" is installed (see attached files).
Test 1:
Sliced in Cura 4.11.x and above without Linear Advance (0.0): Print is successful
Test 2:
Sliced in Cura 4.11.x and above with Linear Advance (>0.0): Print fails after 4-5 layers (Position of fail: random position in outer wall, inner wall or infill
Configuration_2.9.0.1.zip
Configuration_2.9.0.3.zip
)
While I find this extension really useful since I don't need to tool with the firmware to change the linear advance, I think that it would be a great idea to add a field in the filament manager to store each filament specific K-value for the linear advance, and use that one automatically unless a different K-value is defined in the slicer.
Just to be sure I'm explaining myself, this is the menu I'm talking about.
I believe both Cura and this plugin would benefit a lot from this feature, since the K-value can differ between spools of the same material and even the same brand, but the value remains mostly consistent in the same spool.
I may look to add this myself, but I'm not familiar with Cura plugins so I'd love to know the feasibility of making this a feature.
Hi,
I am new to all this, so I hope this is the right place to ask.
Would it be possible to extend the plugin so that you can also set the pressure advance for Klipper Firmware?
I have seen that your Plugin, which is very useful by the way, thanks very much for your work, got an update and noticed while looking for changes that with commit 51fd561 the maximum allowed value of the linear advance setting has, as I understand it, been changed from a warning at 2 without maximum to a maximum of 10.
Could you please revert that change? Some users among us are stuck with linear advance 1.0 and would need to enter larger values.
I haven't updated yet in fear of breaking my existing print profiles...
Hey,
i hope you are able to help me and I am at the right place.
I have to write my own plugin and i am trying to own settings with some subsettings to the settings container. I am able to add one setting, like you did in this plugin.
But I need more than one setting and need the option to enable and disable this plugin in the Print Settings.
self._setting_dict = {
"label": "Enable my special plugin with childs",
"description": "Enbales my special plugin!",
"type": "bool",
"default_value": 0,
"settable_per_mesh": False,
"settable_per_extruder": False,
"settable_per_meshgroup": False,
"children":
{
"experimental_my_plugin_float_setting":
{
"label": "Diameter",
"description": "Adjusts the diameter of the filament used. Match this value with the diameter of the used filament.",
"unit": "mm",
"type": "float",
"default_value": 2.85,
"minimum_value": "0.0001",
"minimum_value_warning": "0.4",
"maximum_value_warning": "3.5",
"settable_per_mesh": False,
"settable_per_extruder": True
}
}
}
I added a "children" to the dict like it is in the FDMPrinter.json.def
The "Setting Visibility" shows the childs, but they are not shown in the Print settings.
You can download my test plugin here: https://drive.google.com/drive/folders/15o8DGH0I47gQZc3c8LiP2Wh-YlmXRimc?usp=sharing
Greetings
Timo
This error is exposed on dual extruder systems when the linear advance settings don't match on the extruders.
It shows the error message with the text of "0" in the description in Cura
Error text:
2021-02-22 18:32:02,759 - ERROR - [MainThread] UM.Logger.logException [110]: File "C:\Users\currentuser\AppData\Roaming\cura\4.8\plugins\LinearAdvanceSettingPlugin\LinearAdvanceSettingPlugin\LinearAdvanceSettingPlugin.py", line 191, in _filterGcode
2021-02-22 18:32:02,762 - ERROR - [MainThread] UM.Logger.logException [110]: if not apply_factor_per_feature[extruder_nr]:
2021-02-22 18:32:02,764 - ERROR - [MainThread] UM.Logger.logException [110]: KeyError: 0
My immediate fix was achieved by removing the Linear Advance Setting Plugin.
Upon upgrading to 5.0, Cura notified me that this plugin was not compatible and required reinstallation, however it doesn't appear to be available for installation in the marketplace either, so it seems this plugin needs to be updated for compatibility with Cura 5.0.
@fieldOfView this plugin broke saving file or print via octorpint for a long time.
I use this plugin with a fix:
gcode_command_pattern = "M900 K%f T%s"
Originally posted by @dankatanka in Ultimaker/Cura#8156 (comment)
I noticed that simply having this plugin installed causes M900 K0.000000 T0 ;added by LinearAdvanceSettingPlugin
to be written out to the gcode regardless of whether or not I have explicitly set a value.
My printer config file (klipper based) has a pressure_advance value set as default and I would like this to be used unless I choose to override it with this plugin. How can I achieve this?
I tinkered with this little plugin to add other features. While doing so i encountered a possible bug: As long as this plugin is enabled, i can't save gcode twice in a row without (re-)slicing it.
How to reproduce:
I expected to be able to save as many times as i wanted to without having to slice again by changing a random setting in Cura. Here's the error log i got:
https://gist.github.com/DruckiMcDruck/11675a2a1fdccd853dc236017e651da9
There are several speed/acceleration settings in Cura for which there are no K settings:
material_linear_advance_factor_ironing
material_linear_advance_factor_roofing
(top surface skin)material_linear_advance_factor_support
material_linear_advance_factor_support_infill
material_linear_advance_factor_support_interface
material_linear_advance_factor_support_roof
material_linear_advance_factor_support_bottom
raft_material_linear_advance_factor
raft_surface_material_linear_advance_factor
raft_interface_material_linear_advance_factor
raft_base_material_linear_advance_factor
bridge_wall_material_linear_advance_factor
bridge_skin_material_linear_advance_factor
bridge_skin_material_linear_advance_factor_2
bridge_skin_material_linear_advance_factor_3
Of these, I am most interested in the first two, ironing and roofing.
The suggested raft and bridge setting names are backwards from the rest to match the naming convention of related settings in fdmprinter.def.json
.
The bridge acceleration and jerk settings are available in @smartavionics' fork of Cura, though not for the _2
or _3
variants yet.
I use this in Cura 4.13 and found out the hard way my LA was not changing as it went to skin (where I could care less on LA) to outer walls, where it's important. There is just one M900 call in the Gcode and there are walls and they are even denoted with labels. No other M900s which renders the plugin worthless. I thought maybe since main K was 0, it disabled it, but that's not affecting it.
Cura: v4.9.1
Plugin: v3.5.11
Below is fragment of generated G-code, just after the start G-code:
G92 E0
G92 E0
G1 F2700 E-5
;LAYER_COUNT:100M900 K0.750000 T0 ;added by LinearAdvanceSettingPlugin
;LAYER:0
M107
A newline is missing after ;LAYER_COUNT:100
.
Hi,
This issue could be on my end, but I thought I'd reach out and see if you have any idea what might be causing this.
I'm working on Cura configuration for a printer I am developing. Everything works fine with the definition I made, but when I try to install the Linear Advance Plugin, or really any plugin that adds settings fields to the sidebar, it causes Cura to crash.
I've tested this several time, the plugin and my definition work fine on their own, but when both are installed Cura won't launch. I've tested this on both MasOS and Window and the problem persists on both.
Any ideas?
My first layers do not print well with LA on, and it might not really be that much needed at first layer speed.
It would be nice if this plugin had option to disable LA for initial layer (or have separate settings for initial layer, but that would really be too many settings) or option to enable LA only at layer N or at height H forward.
In Marlin 2 with linear advance version 1.5, a value of 0 is supposed to be "disabled". With most settings seeming to be in the 0.09 to 0.11 range, a default value of 1 might be a little high.
Also, in the readme, I see you mention M900 with other settings, but looking at the marlin documentation for M900 I don't see those values. Maybe that is for an older version of linear advance?
When using combined infills , for ex : Outlines in 0.1mm in 4 passes , and Infills in 0.4mm in one pass (for gain of time )
An issue appears , the machine doesn't have the ' linear advance setting for the 0.4mm layer height ' and each lines in 0.4 are shorter , don't overlap , and infills are SHIT ! . If i use only one linear advance setting , either i have big corners or i have unglued infills... Linear Advance not ' really linear in vertical mode 😄', because depending of the nozzle size, layer height , direct drive or bowden , solid filament or flexible , two many parameters in the equation 😢
IDEA
Add a gcode comment like this ' Current layer height = xxxx ' in the flavor , and it's all
Every time CURA change the layer height , the machine receive the information
I don't want LA
I don't want to use LA in cura
I HAVE IT in the machine
I just want CURA send the information to the machine when changing printing strategy
Thks
ps: I will make a PR in MarlinFirmware to apply the right LA , but i need the slicer HELP ME !
Installed the Linear Advance Plugin in Cura 3.6.0 (I would use 4.anything if they would work on my computer- see numerous error logs sent). When I set a value of anything greater than zero, say .5 for example and check the start code I see no M900 command added. Without the M900 command entering a value has no effect on printing.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.