CuraEngine Plugin

Need help, or want to share a macro? Post here!
User avatar
cblt2l
Posts: 155
Joined: Sat May 15, 2010 3:59 am

CuraEngine Plugin

Postby cblt2l » Sat Jan 25, 2014 5:16 am

This is a macro I've been working on for integrating CuraEngine into freecad. For those not familiar, CuraEngine is the command line program used by Cura for gcode generation. I'm not an expert so the code may be a bit rough (but functional ;) ). I didn't add all of the slice settings into the Gui yet but plan on doing so in the near future. I haven't figured out a way to save the settings either so they have to be entered every time you run the script. If anyone knows a good way to store these (preferably inside the freecad document) please let me know.

To use do the following:
1) install the official Cura package (CuraEngine is installed to /usr/share/cura/CuraEngine) or compile CuraEngine from source.
2) Clone the git repo into ~/.FreeCAD/Mod

Code: Select all

cd ~/.FreeCAD/Mod
git clone https://github.com/cblt2l/FreeCAD-CuraEngine-Plugin.git
3) Restart FreeCAD.
4) Select '3D Printing' from the workbench dropdown menu

Running the CuraEngine plugin
1) Switch to 3D Printing workbench
2) Select 'CuraEngine Slicer Tool' from toolbar
3) Enter settings and select part/parts
4) Click OK. Gcode, log and stl files will be created in the same directory as the fcstd file

** Update 5/14/14
- Created a 3D Printing workbench. Macros no longer run as macros.

**Update 4/23/14
- Fixed minimal layer time setting
- Created github repo. Removed tgz attachment

**Updated 4/11/14
- Fixed settings output to gcode

**Updated 4/9/14
- Added many more slicer options
- Settings are saved internally
curaengine_plugin_3.png
curaengine_plugin_3.png (121.61 KiB) Viewed 17818 times
Last edited by cblt2l on Thu May 15, 2014 1:38 am, edited 5 times in total.
User avatar
quick61
Posts: 3803
Joined: Sat Aug 24, 2013 2:49 am
Location: u.S.A.

Re: CuraEngine Plugin

Postby quick61 » Sat Jan 25, 2014 6:27 am

You would pick the one slicer that I still haven't been able to get to work on my 64 bit Linux. ;) And I really like Cura!

Can't you have the script save the settings to a text file and save it to where ever you save the macros? Just give it an extension like .CUC (CUra Config) or something so it won't show up in the macro list.

Found this - http://www.landmap.ac.uk/index.php/Lear ... text-files

I am by no measure a Python guy, but it might point you in the right direction?

Mark
This post made with 0.0% Micro$oft products - GOT LINUX?
wmayer
Site Admin
Posts: 16875
Joined: Thu Feb 19, 2009 10:32 am

Re: CuraEngine Plugin

Postby wmayer » Sat Jan 25, 2014 10:42 am

Instead of having a separate file you can use FreeCAD's config file.

Code: Select all

grp = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/CuraEngine")
The 'grp' object offers a couple of getter and setter methods for various basic types like integer, float, string, ...
User avatar
jriegel
Site Admin
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: CuraEngine Plugin

Postby jriegel » Sat Jan 25, 2014 11:21 am

Hey thats great! Since I own a Ultimaker ;) I will take a look!

This could be the beginning of a 3D printing workbench!!
Stop whining - start coding!
User avatar
jriegel
Site Admin
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: CuraEngine Plugin

Postby jriegel » Sat Jan 25, 2014 11:23 am

Oh, unfortunately AGPL :(
Stop whining - start coding!
mario52
Posts: 3311
Joined: Wed May 16, 2012 2:13 pm

Re: CuraEngine Plugin

Postby mario52 » Sat Jan 25, 2014 11:35 am

hi
interesting if you want, you can create a page Macros_recipes on utility topic
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting, Dialog creation. My macros on Gist.github.
User avatar
cblt2l
Posts: 155
Joined: Sat May 15, 2010 3:59 am

Re: CuraEngine Plugin

Postby cblt2l » Sat Jan 25, 2014 5:12 pm

quick61 wrote:You would pick the one slicer that I still haven't been able to get to work on my 64 bit Linux. ;) And I really like Cura!
What distro do you use? I'm on Debian Wheezy 64 bit and everything has worked out of the box using the package from ultimaker. If all else fails compiling CuraEngine is pretty easy.

wmayer wrote:Instead of having a separate file you can use FreeCAD's config file.

Code: Select all

grp = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/CuraEngine")
The 'grp' object offers a couple of getter and setter methods for various basic types like integer, float, string, ...
Thanks, that looks like it will work. What is the difference between User and System parameters? Is one used for setting default values? Are they both stored in the freecad document or is one stored in ~/.FreeCAD

jriegel wrote:Oh, unfortunately AGPL :(
That's strange. I figured since CuraEngine is a stand-alone program and the macro ran it through a shell it wouldn't matter what the license is. But I don't know much about software licenses......

mario52 wrote:hi
interesting if you want, you can create a page Macros_recipes on utility topic
mario
When its all said and done I will put it there. I still want to add some features.
User avatar
shoogen
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: CuraEngine Plugin

Postby shoogen » Sat Jan 25, 2014 5:36 pm

cblt2l wrote:
wmayer wrote:Instead of having a separate file you can use FreeCAD's config file.

Code: Select all

grp = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/CuraEngine")
The 'grp' object offers a couple of getter and setter methods for various basic types like integer, float, string, ...
Thanks, that looks like it will work. What is the difference between User and System parameters? Is one used for setting default values? Are they both stored in the freecad document or is one stored in ~/.FreeCAD
The Preferences are stored per user not per document. You should provide a default value as the second parameter for the getter. I would shugest to have a look into the existing Modules implemented in python (Draft, Arch, OpenSCAD) (I'm not sure if preferences are used in the ship, spreadsheet and plot modules).
cblt2l wrote:
jriegel wrote:Oh, unfortunately AGPL :(
That's strange. I figured since CuraEngine is a stand-alone program and the macro ran it through a shell it wouldn't matter what the license is. But I don't know much about software licenses......
Having the user download it seperatly and interfacing through a pipe is not the most beautiful way to design software. I guess Jürgen would like to rather 'intergrate' such feature.
User avatar
quick61
Posts: 3803
Joined: Sat Aug 24, 2013 2:49 am
Location: u.S.A.

Re: CuraEngine Plugin

Postby quick61 » Sat Jan 25, 2014 5:48 pm

cblt2l wrote:
quick61 wrote:You would pick the one slicer that I still haven't been able to get to work on my 64 bit Linux. ;) And I really like Cura!
What distro do you use? I'm on Debian Wheezy 64 bit and everything has worked out of the box using the package from ultimaker. If all else fails compiling CuraEngine is pretty easy.


I'm using Kubuntu 13.10 64 bit and it's a known issue with Cura. I haven't tried the workaround yet and will give it a go later today. The last time I tried a compile, it didn't work either, but I'll give it another try as well. We'll see how it goes.

Mark
This post made with 0.0% Micro$oft products - GOT LINUX?
User avatar
cblt2l
Posts: 155
Joined: Sat May 15, 2010 3:59 am

Re: CuraEngine Plugin

Postby cblt2l » Sat Jan 25, 2014 7:53 pm

shoogen wrote:The Preferences are stored per user not per document. You should provide a default value as the second parameter for the getter. I would shugest to have a look into the existing Modules implemented in python (Draft, Arch, OpenSCAD) (I'm not sure if preferences are used in the ship, spreadsheet and plot modules).
I looked through Draft and now have a pretty good idea how the settings mechanism works. I'll probably add that next.
quick61 wrote:I'm using Kubuntu 13.10 64 bit and it's a known issue with Cura. I haven't tried the workaround yet and will give it a go later today. The last time I tried a compile, it didn't work either, but I'll give it another try as well. We'll see how it goes.
That bug report looks specific to Cura and not CuraEngine so you may be ok. I always use Pronterface for running the printer so I never experienced the issue.