G12 code ignored by shark hd4

Discussion/questions about software used with your CNC Shark and programming issues

Moderators: al wolford, sbk, Bob, Kayvon

Post Reply
rknelson
Posts: 2
Joined: Sat Dec 22, 2018 12:57 am

G12 code ignored by shark hd4

Post by rknelson »

Merry Christmas all!

I apologize if this is a question that’s already been asked. I searched the forum and couldn’t find any similar topics, so here goes.
My father has a Shark HD4 machine that he uses to carve toy cars out of pieces of wood. All the g codes in the file seem to work just fine except for the following line: G12 I0.0300 F 25.0. This line is supposed to enlarge an existing hole that was successfully drilled/routed by a previous line in the .tap file. I have edited this line several times, adding different codes, modifying existing codes and nothing seems to have any effect. I also downloaded one of the post processors from NWA and wasn’t sure if G12 & G13 are valid codes for the Shark. What we’re trying to do is slightly enlarge an existing 1/4” hole to allow a 1/4” wooden dowel to turn freely in the finished toy car. Dad is not much into computers and I’m a newbie at Sharks, CNC and g code!

Thanks,

Roger

SteveM
Posts: 168
Joined: Thu Sep 08, 2016 1:29 pm
Location: Franklin, Wisconsin

Re: G12 code ignored by shark hd4

Post by SteveM »

If you are using V-carve, you could use a 1/8" bit and in V-carve make a circle of .251 and do a pocket cut. You should wind up with a slightly larger hole than 1/4". If .251 isn't large enough just make a few practice cuts to get the hole size you need.
There should be no need to mess with any gcode.

rknelson
Posts: 2
Joined: Sat Dec 22, 2018 12:57 am

Re: G12 code ignored by shark hd4

Post by rknelson »

Unfortunately we’re not using vcarve. The .tap file was supplied to us on a USB stick. We’re trying to figure out why the machine is ignoring the g12 line in the file.

User avatar
Kayvon
Posts: 560
Joined: Tue Oct 21, 2014 11:46 pm

Re: G12 code ignored by shark hd4

Post by Kayvon »

The Shark just ignores gcode commands that it doesn't understand. Unfortunately, this appears to be one of them. The good news is that you can write some code to get around it. Let's break this out first:

Code: Select all

G12 I0.0300 F 25.0
G12 means to enlarge a(n existing?) hole by milling clockwise. It's identical to G13, except that G13 is counterclockwise.
I0.0300 (That's a capital i like "eye") means we want the circle to be 0.03" large*.
F 25.0 means we'll run at 25" (I'm assuming this is all in inches) per minute.

Usually G12 expects a D parameter (e.g., D0.25). This tells it the current diameter of the bit you're using. If it doesn't see one, like in this case, it "remembers" the last time you told it a D parameter earlier in the file. In this case, I think it's like that your file specifies a "D00" somewhere, which tells the interpreter, "The bit I'm using has no width to it." This is obviously untrue, but that's okay, because...

*The I0.0300 parameter will enlarge the hole by [paremeter]-[bitsize] = 0.03 - 0 = 0.03". The hole will end up 0.03" larger than the actual bit size. If you actually have a 1/4" bit, this results in a hole that's 0.28".

---

Okay, you've made it this far and you're wondering, "Fine, fine... when do we get to the new code?" Here it is, but it will require some modifications:

Code: Select all

G1 X0.0000 Y0.0150 Z-0.1000
G02 X0.0150 Y0.0000 I0.0000 J-0.0150
G02 X0.0000 Y-0.0150 I-0.0150 J0.0000
G02 X-0.0150 Y0.0000 I0.0000 J0.0150
G02 X0.0000 Y0.0150 I0.0150 J0.0000
You'll need to change this to work for your situation. My code will make a 0.28" hole at (0,0) assuming you have a 1/4" bit. The line before the G12 in your code should have a G1 that moves the bit to its current position (the center of the hole), which is unlikely to be (0,0). So you'll need to adjust the X,Y,Z in my code by the amount shown in your code. If you find that your hole is at (5,5), and the Z depth is -0.25, you'll want the first line to be:

Code: Select all

G1 X5.0000 Y5.0150 Z-0.2500
See, I just added the X,Y into my code. You'll need to do that for every X and Y in my code.

---

For the curious, here's what the commands are doing:
G1 says, "Move from the current position (the circle's center, hopefully) to the top of the new, enlarged circle."
G2 says, "Rotate from the top of the circle to the left side." The other G2 statement go to the bottom, right side, then top.
You may ask why we didn't just take G2 in a full circle. Some interpreters allow this, but some don't. The gcode "standard" says you can't do a full circle, so I've split it up into four arcs, which is allowed in all circumstances.

Hope that helps!

Post Reply