Jump to content
Ultimaker Community of 3D Printing Experts
Sign in to follow this  
amirps

Start working with cura engine !

Recommended Posts

Hi ,

I'm developing an automation system for printing object directly from internet .

On the local host side, I need a program that read .STL files from a folder and do the following :

1.Generate G-Code from .stl file.

2.Generate a thumbnail view of model .

3.Estimate the price (I need printing meter,time,grams, like in cura)

:::

printer: Ultimaker .

OS:win 7 .

Experience with c++ and c# (intermediate ).

:::

My questions are :

1-Does CuraEngine provide above mentioned information ?

2-When I generate the G-code does CuraEngine has a routine to send it to the ultimaker ?

3-It's a bit vague for me, for example if we have a 4MB g-code file ,how does it transfer to the device ?

4-is there a help document on CuraEngine ? I dont want to read all the codes and figure it out myself I need to know how to use CuraEngine just to get the above mentioned information :|

thanks in advance :)

 

Share this post


Link to post
Share on other sites

The cura engine can transform stl models to G-code. Thats the main function of it all :)

Depending on the branch that you use, the model is either excepted through pipes, or via a (local) socket. It will use those to return any G-Code it computes. The socket or pipe is also used to recieve settings.

The engine does not transfer anything to the device. That is the task of the GUI. The engine only accepts models & settings and only returns a set of g-codes.

All the documentation out there is on the github page or inside Daid's head (and a tiny bit in mine, as it's not my project).

Your best bet would be to hack into the Cura python code, rip out the graphical stuff and use that to call the engine with the settings & model(s). Cura (Python part) can then send it to the printer.

 

Share this post


Link to post
Share on other sites

The cura engine can transform stl models to G-code. Thats the main function of it all :)

Depending on the branch that you use, the model is either excepted through pipes, or via a (local) socket. It will use those to return any G-Code it computes. The socket or pipe is also used to recieve settings.

The engine does not transfer anything to the device. That is the task of the GUI. The engine only accepts models & settings and only returns a set of g-codes.

All the documentation out there is on the github page or inside Daid's head (and a tiny bit in mine, as it's not my project).

Your best bet would be to hack into the Cura python code, rip out the graphical stuff and use that to call the engine with the settings & model(s). Cura (Python part) can then send it to the printer.

 

Dear Nallath,

thanks for your reply, actually after creating this topic ,I start examining the cureEngine and found out that it will only fulfill my first need (Gcode) !

then I saw in a video(ultimaker-evening video) ,that david said the Cura estimation is not precise he said and I quote "this guess can be off by 20% ",So I write a program that reads a Gcode (that CuraEngine creates) and return some useful parameter such as

 

  • exact head movement during the print

  • total layers of the object

  • 2d plots of head movement in each layer

 

here is a sample of head movement, it's the first layer of "3D Printable Wrench "

image.jpg

to calculate the price ,I need total time as well, but I have some problem calculating the time :

for example consider these two lines of a Gcode :

 


G1 F6000 X30.31 Y106.31 E2303.94952

G0 F9000 X30.87 Y106.31

the Gcode says(correct me if I'm wrong) : from point (30.31,106.31) rapidly moves to (30.87,106.31) with the speed of 9000mm per minute, SO

I calculate the Euclidean distance by :

 


distance=sqrt(((PointA(1)-PointB(1)))^2+((PointA(2)-PointB(2))^2));

which is 0.5600mm for this example ,

for calculating the time I have

 


this_move_time=this_move_distance/9000;

that gives me 6.2222e-05 min

I do this for all head movement but it seems that it's wrong!

for the previous mentioned model Cura give me 2hours/12 minutes

my code return 1hour/26 minutes

I would really appreciate your feedback and any comments on this subject :)

 

Share this post


Link to post
Share on other sites

You didn't take into account acceleration or jerk settings. These are complicated. For any polygon movement, acceleration is infinite at each vertex unless the head comes to a complete stop. To make it so the head doesn't stop at every vertex there is a "jerk" settting which is not truly "jerk" but instead the maximum instantaneous speed change. This is typically 20mm/sec. So going from 20mm/sec to 0mm/sec is allowed at a vertex. Or going from 10mm/sec in one direction to -10mm/sec an instant later is also allowed. Or at a 90 degree corner, the speed will slow to 14mm/sec (total XY magnitude instantaneous speed change is 20mm/sec on 90 degree corner).

The latest Cura takes care of this very well and now gives very very good estimates of how long a print will take.

 

Share this post


Link to post
Share on other sites

Actually, that video is quite old and the estimate is a lot better these days.

 

Dear Daid,

I'm glad that you improved time estimation on Cura :)

but the problem is I'm writing an app to generate a Gcode using CuraEngine and I have to calculate the time and the price myself ,I don't think it's possible to use cura(I mean your python scripts) in my application to get precise time estimation(or is it ?! ) , so I want some guidance on how to estimate precise time of the print from a single Gcode file ! is it achievable or it's just a far-fetched idea?!

 

Share this post


Link to post
Share on other sites

The precise time estimation is in the engine, not the python code.

https://github.com/Ultimaker/CuraEngine/blob/master/src/gcodeExport.cpp#L388

 

wow ,thanks !!! I use -v and get the time !

(still have problem using config.ini )

the only problem remaining is how to transfer gcode to the printer ! would you please tell me which script of python code does this task ?

 

Share this post


Link to post
Share on other sites

wow ,thanks !!! I use -v and get the time !

(still have problem using config.ini )

the only problem remaining is how to transfer gcode to the printer ! would you please tell me which script of python code does this task ?

 

Could you send the whole command to calculate print time , weight vs ... from STL code with spesific settings ?

Thanks

 

Share this post


Link to post
Share on other sites

Could you send the whole command to calculate print time , weight vs ... from STL code with spesific settings ?

Thanks

 

dear Raytrace Nomad,

I use curaengine.exe in c# here is a code I use to read size and p-time :

 


StreamReader myStreamReader = Cura.StandardError;

string myString = myStreamReader.ReadToEnd();

foreach (string line in myString.Split('\n'))

{

string[] parts = line.Split(':');

if (parts.Length < 2)

continue;

switch (parts[0].Trim())

{

case "Size":

log("Size " + parts[1]);

break;

case "Print time":

log("PTime " + parts[1]);

break;

default:

break;

}

}

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
Sign in to follow this  

×

Important Information

Terms of Use Privacy Policy