G codes for 3D printing

Moderators: TomKerekes, dynomotion

boss4
Posts: 2
Joined: Sun Apr 29, 2018 9:36 pm

G codes for 3D printing

Post by boss4 » Mon Apr 30, 2018 4:45 am

I am planning to make a 3D printer attachment for my 3 axis CNC mill which us run by kanalog and kflop. This seems very strait forward, its just 1 stepper motor for the extruder and a couple of simple loops running the bed and hot end.

Anyways the real question in all of this, it seems like kmotion CNC doesn't support some of the M-Codes that are commonly used with 3D printers such as M140 and 190. I would also like to have the extruder labeled as the E axis (instead of A,B or C) to make this fully compatible with G code used by another 3D printer that I occasionally use.

Is there an easy way to do this that I am missing?

Here is a reference:
(http://)dfabresearch(dotcom)/xo15/wp-content/uploads/2015/01/Marlin_GCodes7.pdf

User avatar
TomKerekes
Posts: 242
Joined: Mon Dec 04, 2017 1:49 am

Re: G codes for 3D printing

Post by TomKerekes » Mon Apr 30, 2018 4:42 pm

Hi boss4,

Those changes would be somewhat difficult. Can you change the Post Processor?

Craftware doesn't seem to have a customizable Post Processor so we wrote a simple program to make the conversions to the GCode. You can find it here

There is also some code for controlling KNozz Temperatures via MCodes in this Thread.
Regards,

Tom Kerekes
Dynomotion, Inc.

boss4
Posts: 2
Joined: Sun Apr 29, 2018 9:36 pm

Re: G codes for 3D printing

Post by boss4 » Tue May 01, 2018 5:24 pm

Thanks TK, I think I will go with the re post processing route.

MichaelMet
Posts: 2
Joined: Tue Jun 19, 2018 9:31 am
Location: Virgin Islands
Contact:

G codes for 3D printing

Post by MichaelMet » Fri Jul 06, 2018 10:28 pm

Bought multiple codes from seller and did not have any issues with him at all.


Thanks for making things so smooth

KarlWKirchhofer
Posts: 4
Joined: Mon Dec 10, 2018 2:22 am

Re: G codes for 3D printing

Post by KarlWKirchhofer » Mon Dec 10, 2018 3:12 am

Hi Tom, I am doing what I can to help Carl Bruce help me to get a kmotion based 3d printer going. We have the x,y, and z axes going and have figured that we’ll use the A axis as for the extruder as the “U” commands that are pumped out in the translator that you reference are still a mystery to both of us.
My understanding in this is limited but I am trying to to figure this out.
This is where I am right now...

( GCode generated by CraftWare)
G28 X0 Y0
G28 Z0
M104 S215 (set head temp no wait)
(M190) S60 (set bed temp wait)
(M109) S215 (set head temp wait)

I believe that I need to set something up for the m commands. I imagine (best I can do with limited experience in this) that they are associated with the pins that the heater for the bed, nozzle, and fan are connected to? Is this correct?

I believe the “S” references the way to manage temps in the sample C program. Is this correct?

Does that sample C program that you reference for temp control get added to the init file? If the answer is “yes” then my next question will be “where does it go?”

Thanks a lot. This is neat stuff and I have been lucky to have Carl willing to help when I run into Cnc issues but this is something that I would like to get my head around and hopefully take some pressure off of him. I hope you have the time to help me figure this out.

User avatar
TomKerekes
Posts: 242
Joined: Mon Dec 04, 2017 1:49 am

Re: G codes for 3D printing

Post by TomKerekes » Mon Dec 10, 2018 4:09 am

Hi Karl!
Hi Tom, I am doing what I can to help Carl Bruce help me to get a kmotion based 3d printer going. We have the x,y, and z axes going and have figured that we’ll use the A axis as for the extruder as the “U” commands that are pumped out in the translator that you reference are still a mystery to both of us.
The 3D Printer we built actually had 7 axes. XYZABC + Extruder. Craftware emits 'E' commands for the Extruder with no way we could find to change it. So we mad a translator that converts the 'E' to 'U' commands. The KMotionCNC Interpreter handles 8 axes (XYZABCUV). To configure an XYZ+U system like yours you can define the axes with:

DefineCoordSystem8(0,1,2,-1,-1,-1,3,-1);

You can use the A axes for the extruder if you wish, but you will need to change the Translator and if you ever build a system with an A axis you would need to change it. It would be great if everyone could use the same Method and Translator.
I believe that I need to set something up for the m commands. I imagine (best I can do with limited experience in this) that they are associated with the pins that the heater for the bed, nozzle, and fan are connected to? Is this correct?

I believe the “S” references the way to manage temps in the sample C program. Is this correct?
To be honest on our system we never developed it to the point where you could configure Craftware to set the Temperatures and it would generate the GCode to set the temperatures automatically. We just set the temperatures manually then ran the Job.

We wrote a program for a User to control the temperatures with MCodes. See this Thread

See also how to set persist Variables in KFLOP with MCodes

You will need to change the translator to change whatever Craftware outputs (S + M commands?) to something that KMotionCNC can accept such as M100 - M119 with P and Q parameters as temperature setpoints.

The KNozz temperature control needs to be called continuously to read in the temperatures from KNozz and set the Heater outputs on KNozz. So you might call it from your forever loop in your Init program. It will slow down the forever loop rate so if that is an issue you will need to handle it from another Thread or something.

Let me know how much of this makes sense.
Regards,

Tom Kerekes
Dynomotion, Inc.

KarlWKirchhofer
Posts: 4
Joined: Mon Dec 10, 2018 2:22 am

Re: G codes for 3D printing.

Post by KarlWKirchhofer » Mon Dec 10, 2018 7:39 pm

Morning Tom,
Thx. For the reply!
This makes sense conceptually. I have an idea of what to do for the code setup up, not much of an idea on the programming side.

To get the extruder working off of A I find and replace the U with an A in the kmotion edit dialog screen.
Would be great to use this directly out of the translator but I do not know what to do with the following line:

DefineCoordSystem8(0,1,2,-1,-1,-1,3,-1);

I have looked at the program in that thread on the Cnc zone but, as it is with the above command, I don’t know quite what to do with it. I assume it goes in the init program somehow and needs to follow a particular form.

I did not expect anything to work but I copied and pasted that heater control program to the end of my init file anyhow to see what would happen. Not a complete bust because I found out that for some reason, the x,y,z,a axes didn’t work. :D The parts are there but they are not tied together correctly.

User avatar
TomKerekes
Posts: 242
Joined: Mon Dec 04, 2017 1:49 am

Re: G codes for 3D printing

Post by TomKerekes » Mon Dec 10, 2018 8:13 pm

Hi Carl,
To get the extruder working off of A I find and replace the U with an A in the kmotion edit dialog screen.
I asked that you use Axis U instead. Why not use U instead of A like I asked?
Would be great to use this directly out of the translator
If you use the existing Translator which outputs U commands everything should work as is.
but I do not know what to do with the following line:

DefineCoordSystem8(0,1,2,-1,-1,-1,3,-1);
Every KFLOP Init program should have such a line already to define which GCode Axes Letters to associate with which KFLOP Axis Number. This line maps your Axis U to KFLOP axis channel #3. Can you understand this?
I did not expect anything to work but I copied and pasted that heater control program to the end of my init file anyhow to see what would happen. Not a complete bust because I found out that for some reason, the x,y,z,a axes didn’t work
You will need to study C Programs a bit to understand their basic structure. As you expected you can not just paste code at the end of a program. You will need to understand curly brackets and how they define the beginning and end of things. Then you will need to find the beginning and end of the main function. Within the main function there needs to be a forever loop. Find the beginning and end of the Forever loop. The call to the Service function needs to be within the loop. After you make changes push the "Compile" button to check if the code compiles without any errors. You might see:

See this

And especially this and this.
Regards,

Tom Kerekes
Dynomotion, Inc.

KarlWKirchhofer
Posts: 4
Joined: Mon Dec 10, 2018 2:22 am

Re: G codes for 3D printing

Post by KarlWKirchhofer » Mon Dec 10, 2018 8:46 pm

Hi Tom,

If I could have used the U command I would have. We spent quite a bit of time trying to figure it out but at a certain point I had to revert to what I DID understand and that was how to edit the code so at the very least I could see how the mechanical things worked together.

Now that I have more of an idea where to look for that line and have some sense of what it does I’ll see what I can figure out. Thanks for explaining what that does in a way that someone with little programming experience, like me, can understand.

Thanks for sending the links. I’ll check those out and see what I can figure out.

Karl

KarlWKirchhofer
Posts: 4
Joined: Mon Dec 10, 2018 2:22 am

Re: G codes for 3D printing

Post by KarlWKirchhofer » Sat Dec 15, 2018 2:43 am

Good evening Tom,
Got things heated up today! Couldn’t get the nozzle temp past 150 degrees. There is some weird stuff that happens past 150.

You addressed this in this thread:

https://www.cnczone.com/forums/dynomoti ... setup.html

When you get to the part of changing the code to get the ADC counts does that T value translate directly to the counts?

Thanks,
Karl

Post Reply