Jump to content
Ultimaker Community of 3D Printing Experts
gearsawe

Post Process Plugin for Cura 15.06 guidance

Recommended Posts

I am still very new to Cura. In 15.04 I made a simple post process plugin which modifies the g-code to work with a specific printer. The plugin has some parameters which could be adjusted and it would modify the gcode at save. This was pretty simple in 15.04. Now in 15.06 I am starting to understand how to add parameters to a printer configuration in the "fixes" catagory but how to pass these values to let sat a new GCodeWriter plugin is where I am completely lost. I tried to make my own "GCodeWrinerM3DMicro" but since it uses the same extension ".gcode" only the original gcode writer seem to be used. I did not want to modify the the Orignal GCodeWrite process and hard code settings into it. But make it optional for those who would like to use the software for more than one type of printer on the same system.

I am not a programmer by trade so I learn as I go. Forgive my lack of terminology understanding when it comes to pointers, imports, object, mutli-dimensional arrays and so forth.

So in my custom printer config if have a small snippet of code which show a value in to adjust in the fixes category. Maybe I am going about this all wrong. But how to pass these values into a custom gcode writer is where I am clueless. Any guidance would be appreciated.

 

"micro": {           "label": "Micro",           "visible": true,           "icon": "category_fixes",           "settings": {               "micro_prefs": {                   "label": "Use Micro Prefs",                   "description": "Use Micro preferences",                   "type": "boolean",                   "default": false,                   "visible": false               },               "chop_len": {                   "label": "Max Line Dist",                   "description": "Longest a line can be before is it chopped.",                   "unit": "mm",                   "type": "float",                   "default": 2.5,                   "visible": false,                   "active_if": {                       "setting": "micro_prefs",                       "value": true                   }               }           }       }

 

Share this post


Link to post
Share on other sites

@daid - can you answer this? He has written plugins for the older cura but having trouble with the latest.

@gearsawe - it might be simply that you need to wait another month or two before you can write fancy plugins like this. You should know that there are ".json" files that you can mess with to partly customize to another printer design but that might not be enough - you might indeed have to write a plugin:

C:\Program Files (x86)\Cura_15.05.95\resources\settings

Share this post


Link to post
Share on other sites

... it might be simply that you need to wait another month or two before you can write  fancy plugins like this.  You should know that there are ".json" files that you can mess with...

C:\Program Files (x86)\Cura_15.05.95\resources\settings

 

The above is actually from the .json file. Along with a bunch of other custom settings for the printer. I actually have a model of the printer with the print volume in the correct position. Displaying correctly. Just took a while to find where everything is stored

Till then I might just have to modify the original GCodeWriter and hardcode the code to modify the gcode there. I made my own "GCodeWriterMicro" it actually shows up in the save as options but when saving it still only use the original writer. I think I am doing it right but the new system just is now supporting what I need it to do like you said.

It would be great if the settings in the json file could be used by the script when saving. Would make things a whole lot better.  I really don't want to see the g-code paths in the viewer since the pathing looks like a mess because of the backlash movement and offset put in place.

One thing that did not make sense is in the Plugins my custom GcodeWriterMicro was showing up but I could not turn it off. The check box would always stay on no matter how much I clicked. And then it acts like it is not being used when saving. So there might be a bug there. Not sure. Don't know enough about the new system.

Share this post


Link to post
Share on other sites

@gearsawe: I think you are not writing a plugin for the new Cura but changing its code (nothing wrong with that but I think it's not the way intended by UM).

@nallath has put a very quick description of the new plugin system onto Github somewhere under Ultimaker/Uranium.

Btw: json-files should be nested for variations of the same printer. In order to find out how it is done you best open the UMO or UM2 json file and see how it is connected with the more fundamental fdmprinter.json.

Edited by Guest

Share this post


Link to post
Share on other sites
. The check box would always stay on no matter how much I clicked.

I played with a beta version of this latest Cura and there were a few bugs related to checkboxes so I suspect this is just another one.

I think you should report all this on the issue tracker because programmers love to help other programmers. If Daid sees these bugs he'll probably fix them quickly.

Share this post


Link to post
Share on other sites

so to get the value of a setting for a printer config...

in the printer config you have a category "MyCategory" and a value "MyValue" in that category

 

from UM.Application import ApplicationMyValue = Application.getInstance().getActiveMachine().getSettingsCategory("MyCategory").getSettingByKey("MyValue").getValue()

 

THe code above is not formatting correctly It keeps putting url tags automatically in the posting. There should be be no urls inside code brackets. GRR

But still having that one problem making my own custom GCodeWriter. I have gone a head and reported the bug but still not sure if I am not setting something up right.

Edited by Guest

Share this post


Link to post
Share on other sites

@daid - can you answer this?  He has written plugins for the older cura but having trouble with the latest.

 

Daid has had very little to do with the new Cura, so he wont be able to answer in depth answers about it.

Plugins in itself have little to do with the .json files. The json files are for printer settings. The plugins are much, much more. If you have settings for your plugin, they don't really have a place in the printer json files (because if someone uses a custom printer, the plugin wouldnt work).

The disabling of plugins is indeed a bit broken. Its on our list.

You should not use values / methods that start with an underscore! Python does not have private / protected members, so we indicate those by starting with an underscore. You should -not- acces _value directly but use .getValue() or setValue() respectively. If you directly change the value no events are passed to other parts of the code (hence it being private).

Share this post


Link to post
Share on other sites

Thanks missed the getValue() will use that. (corrected posting above)

As for the settings I am retrieving is a printer settings such as backlash which is specific to this type of printer. I don't necessarily want to see the actual tooling path with backlash in the viewer since it will look like a mess. This will be something that is done at save. But now I am able to pull the set values into the gcode writer which makes me very happy. And will hopefully be useful for those who also own a M3D Micro.

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

    • Ultimaker Cura | a new interface
      We're not only trying to always make Ultimaker Cura better with the usual new features and improvements we build, but we're also trying to make it more pleasant to operate. The interface was the focus for the upcoming release, from which we would already like to present you the first glance. 
        • Like
      • 19 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!