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

Does Cura always put an M107 at the end of a part?

Recommended Posts

I am writing a plugin to optimize the print order in multi-part prints where "one at a time" is selected.

I need to accurately identify the little bit of code that constitutes the transition between parts. I am thinking that I can use the M107 command to identify the transition, but I am not totally sure if I can rely on it to always be there.

Normally it looks something like this.

 


#end of part 1...
G1 X130.14 Y58.50 E466.02564
M107
G92 E0
G1 F2400 E-4.50000
G0 F9000 X130.14 Y58.50 Z38.80
G0 X115.20 Y95.00
;Layer count: 168
;LAYER:0
G0 X116.18 Y95.20 Z0.30
G0 X116.18 Y95.20
;TYPE:SKIRT
G1 F2400 E0.00000
#start of part 2...

 

Share this post


Link to post
Share on other sites

Because I need to grab the transition between parts. There isn't any comment to indicate the start of the transition. It goes strait from the last layer to preparing for the next part, which includes the jog to the correct coords to start the new parts. It would certainly make my code a lot simpler if the end of the last layer of a part was clearly marked, as well as the jog to the start of the new part.

 

Share this post


Link to post
Share on other sites

Because I need to grab the transition between parts. There isn't any comment to indicate the start of the transition. It goes strait from the last layer to preparing for the next part, which includes the jog to the correct coords to start the new parts. It would certainly make my code a lot simpler if the end of the last layer of a part was clearly marked, as well as the jog to the start of the new part.

Maybe I missed something but the code in your original post shows that the LAYER-comment marks the G0 transit to the new position. The first print move is denoted by a G1 command.

 

Share this post


Link to post
Share on other sites

Maybe I missed something but the code in your original post shows that the LAYER-comment marks the G0 transit to the new position. The first print move is denoted by a G1 command.

The bit of code I am concerned with is.

M107

G92 E0

G1 F2400 E-4.50000

G0 F9000 X130.14 Y58.50 Z38.80

G0 X115.20 Y95.00

It includes a G0 move to near the location of the next part and a retract. I decided to solve the problem by backtracking from the layer comment to the last G1 command with an X, or Y move (not sure whether or not to include Z in the search).

@Robert,

The purpose is to produce the correct print order for one at a time printing, so that parts can be closer together. Basically, printing parts that are at the front right before parts at the back left. I got a good portion of the code to sort the parts done. I am now starting to work on the code to write the gcode for the parts back out.

 

Share this post


Link to post
Share on other sites

@Robert,

The purpose is to produce the correct print order for one at a time printing, so that parts can be closer together.

 

Ok. Now, I might just be a bit dense but, wouldn't you have to do that in the source for cura for it to actually do any good? I mean, if you're not happy with the way cura organises objects on the platform, changing the produced gcode seems like the wrong way to fix it? Yes, you might be able to pack things more tightly after the fact but it's still the same number of objects.

Or is the plan to take several different gcode files and stitch them together?

 

Share this post


Link to post
Share on other sites

You can increase the packing density by adjusting the size of the head in machine settings. Currently Cura doesn't do a good job selecting the order to print parts. All I am doing with the plugin is reordering the gcode for the parts and adjusting the transition so it doesn't bang into anything when moving between parts.

The reason for doing this is some issues I have had with splitting multi part STL files in order to print one part at a time.

Ideally this would get fixed I'm Cura, but that would take a lot longer to happen. The plugin I can finish in a couple of days.

Share this post


Link to post
Share on other sites

Try downloading the STL for this thing with all the parts, select "one at a time" printing, and split the STL. http://www.thingiverse.com/thing:148159

When I did it, Cura did not provide any sensible order to printing individual parts. The result is that it takes way more space then is really needed for each part. In order to get it to fit, I had to manually organize the parts, so that the ones at the bottom right would print first.

Even when single files are loaded, as far as I can tell, Cura makes no attempt to prioritize parts by their location on the build platform. It seems to do it by the order they were loaded into Cura.

 

Share this post


Link to post
Share on other sites

Try downloading the STL for this thing with all the parts, select "one at a time" printing, and split the STL. http://www.thingiverse.com/thing:148159

When I did it, Cura did not provide any sensible order to printing individual parts. The result is that it takes way more space then is really needed for each part. In order to get it to fit, I had to manually organize the parts, so that the ones at the bottom right would print first.

Even when single files are loaded, as far as I can tell, Cura makes no attempt to prioritize parts by their location on the build platform. It seems to do it by the order they were loaded into Cura.

 

That... told me totally nothing. It does not tell me what you expected too see, and it does not tell me what you actually got. Except that you did not get what you expected. I knew that already.

I can make some assumptions about what you are trying to tell. But the answers would be "by design" or "problem would be way more complex then you immagine"

 

Share this post


Link to post
Share on other sites

Daid,

What I expect is the following. If the exclusion area around the parts are rectangles, then the rectangle need only extend above, below, left and right, to the amount the print head extends to the right and to the front from the nozzle.

It is then possible to sort the parts so that parts where the head would interfere while printing another part are printed first. (for example, if the left side of part A is adjacent the right side of part B, part A is printed before part B.)

It just takes a few lines of code to map which parts will interfere with another and then another few lines to sort them using that hierarchy. I have that part done, so I know it isn't more complex then I imagined.

If you don't get what I am talking about, then maybe once I am done with the plug-in you will. You can choose whether or not to make a similar change in Cura. I am not here to make you do anything. I just found something that annoyed me and I am trying to fix it. Don't take it personally. I get that what I want might be a niche demand that you don't have time to code into Cura.

 

Share this post


Link to post
Share on other sites

Daid,

What I expect is the following. If the exclusion area around the parts are rectangles, then the rectangle need only extend above, below, left and right, to the amount the print head extends to the right and to the front from the nozzle.

It is then possible to sort the parts so that parts where the head would interfere while printing another part are printed first. (for example, if the left side of part A is adjacent the right side of part B, part A is printed before part B.)

It just takes a few lines of code to map which parts will interfere with another and then another few lines to sort them using that hierarchy. I have that part done, so I know it isn't more complex then I imagined.

If you don't get what I am talking about, then maybe once I am done with the plug-in you will. You can choose whether or not to make a similar change in Cura. I am not here to make you do anything. I just found something that annoyed me and I am trying to fix it. Don't take it personally. I get that what I want might be a niche demand that you don't have time to code into Cura.

 

That's exactly what the code is doing. It calculates how much room the print takes (it actually uses a 2D convex hull).

Then it adds the minimal size of the head to that, which is the big shadow area you see around each print. Then it makes sure none of the big areas hit the print areas.

This guarantees that you can print it, in a specific order. (as it used the "min head size" not the actual head size) Finally it figures out in which order they need to be printed to print one at a time.

The code for this is in "Cura/util/objectScene.py"

 

Share this post


Link to post
Share on other sites

Thanks Daid.

I think I now know why it wasn't working before. I made a profile for printing thin parts, using the height of the nozzle as the gantry height and it radius for the x and y dimensions. Of course, with those +/- x and y settings being equal, your code no longer has a preference for print order.

:oops: Certainly feel pretty foolish that I didn't get what was going on sooner.

I guess just in case anyone else wants to look through some python code, this is the working portion of the project. It was written in Python 3, but I think the only thing that needs to be changed to get it working in Python 2 is switching the syntax of the 'print' statements.

https://drive.google.com/file/d/0B8uLq8bk84WeMXc4dElKaUFsQTQ/edit?usp=sharing

 

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  

  • Our picks

    • How to 3D print with reinforced engineering materials
      Ultimaker is hosting a webinar where we explain how you can achieve and maintain a high print success rate using these new reinforced engineering materials. Learn from Ultimaker's Product Manager of Materials and top chemical engineer Bart van As how you can take your 3D printing to that next level.
      • 0 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!