Machsupport Forum
G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: bandtank on March 11, 2011, 12:56:42 PM
-
I'm new to CNC, GCode, etc. I've been working with my machine for a few months in my spare time and I've finally been able to dedicate more time to this, so I'm trying my first program (I've written tons of small snippets of code, so I'm at least somewhat familiar with the language).
I am trying to drill pockets in a grid for fixture bolts. The pockets need to be every 4.5688" in the Y direction and 4.3654" in the X direction. I've incrementally written the following code to move to each location, call a subroutine to cut the pockets, and then move to the next location. Everything works except for the code to cut the pockets.
I do not know how to use G2/G3 yet, so I used one of the wizards to generate the code to cut the pocket. I know the problem is that the code was generated to run in absolute coordinates and I am trying to use incremental coordinates as it makes more sense for this program.
The first picture is the toolpath for the pocket code only when it is generated correctly.
The second picture is the toolpath for the pocket when it is in my program and obviously incorrect.
The third picture is the overall toolpath of the program. It is correct except for the slight drift to the right because of the misshapen pocket.
Below is my Gcode. I do a lot of programming in C and C++, but I've never written Gcode programs. If my code looks odd that is probably why. The idea is to call multiple routines from "main" to use the power of the language (I know you are all aware of this already). The first subroutine to be called will call the second subroutine to drill 5 holes and then move to a new row of holes. The second subroutine calls the third and fourth subroutines to drill the 2 different pockets I need in the table for the shaft and head of the bolt.
G0 G49 G40 G17 G80 G50 G64 G20
G90
G0 Z.25
G0 X0 Y0
M98 P1 L10
G90
G0 Z.25
M30
O1
M98 P2
G90
G0 Z.25
G91
G0 X-4.3654 Y-18.2752
M99
O2
M98 P3
M98 P4
G91
G0 Y4.5688
M98 P3
M98 P4
G91
G0 Y4.5688
M98 P3
M98 P4
G91
G0 Y4.5688
M98 P3
M98 P4
G91
G0 Y4.5688
M98 P3
M98 P4
M99
O3
G90
G0 G43 H0 Z0.25
G01 Z-0.1693 F15
G91
G2 Y0 X0.0375 R0.0187 F10
Y0 X-0.0375 R0.0375
Y0 X0.075 R0.0562
Y0 X-0.075 R0.075
Y0 X0.0915 R0.0832
Y0 X-0.0915 R0.0915
X0.0915 Y0 R0.0915
G90
G0 Z0.25
M99
O4
G90
G0 Z.25
G91
G0 Z-.2
M99
Finally, my question. Is it possible to use the code from the wizard to cut the pockets or am I going to have to write my own?
Thanks,
Tony
-
Look under general config and check for IJ checker box and change it to incremental.
Jeff
-
Thanks for your response. I tried checking that box but it didn't help. Is it because the pocket is cut in R mode instead of IJ mode? I don't know how to use G2/G3 so I am unable to make that pocket cut without the wizard. Since it is generating the code in R mode, I may not be able to do this in a program right now and instead will have to manually move to each location and cut each hole.
-
If you could post a drawing of what you need, I could build the code for you.
Jeff
-
That's really nice of you. Thanks.
I don't have CAD yet, but I drew you a picture by hand and marked the relevant dimensions. In case something doesn't make sense, I'll explain it in words also.
I want to make a grid of holes and pockets for tee nuts and bolts for fixturing. The center of each hole should be 4.5688" on center in the Y direction and 4.3654" on center in the X direction. The hole needs to be made of two pockets - one for the head of the bolt and one for the shaft of the bolt. The pocket for the head needs to be 0.1693" deep and 0.433" in diameter. The hole for the shaft needs to be 0.5657" deep and 0.295" in diameter. The second hole will be a through hole but I'm having the cutter stop 0.005" from the bottom surface to prevent dust from falling through. The grid of holes will need to be 10 wide in the X direction by 5 tall in the Y direction. The end mill I'm using is 0.25" in diameter and the flute length is 0.6".
Please let me know if this is sufficient information. I really appreciate you offering to do this.
-
HI.
I will need to know what kind of machine you have in order to set deep of cut, feed and RPM.
What material, thickness.
Do you have a way to clear the chips when milling the small holes. 1/4 end mill for a .295 hole will be tough for the end mill if you do not clear chips from the hole(depend of material too)
Can you drill with you machine.
Is the "0" of the part is at the bottom right corner
When you say the second hole will be a through hole but stop at 0.005 from the bottom mean that you keep the end mill from going through the part.
Jeff
-
HI.
I will need to know what kind of machine you have in order to set deep of cut, feed and RPM.
It is a CNC router with a Hitachi M12VC as the spindle (8-25k RPM, set manually). It can rapid at 150ipm. I use 15ipm for plunge feed and 20ipm for cutting feed, which were never calculated but work fine.
What material, thickness.
3/4" MDF
Do you have a way to clear the chips when milling the small holes. 1/4 end mill for a .295 hole will be tough for the end mill if you do not clear chips from the hole(depend of material too)
I have sufficient dust collection I think. I've also cut these pockets using the code from the pocket wizard and it worked fine. My code cut the deep pocket in 2 passes if that helps at all.
Can you drill with you machine.
Yes, but I don't have the right size bits. It can plunge cut with a cc end mill just fine, though.
Is the "0" of the part is at the bottom right corner
Yes...sort of. The way I drew my picture (0,0) is at the bottom right and the X axis moves would all be negative. My table is bigger than what I drew, but I wanted to show where the actual holes should be. If you put the first hole at (0,0) I could line it up where I want it and then the other holes would all be in the right place.
When you say the second hole will be a through hole but stop at 0.005 from the bottom mean that you keep the end mill from going through the part.
Yes, that is correct. I did this with my test holes and there was a tiny piece of material left at the bottom that I could pop out with a screw driver. I don't want all the dust falling on my ballscrew.
If it would be easier I could call you or you could call me. Thanks.
-
Pictures to make it clearer...
-
Try with this program.
Test it cutting above the work surface for the first time then set the Z to the right depth.(Top of part)
They're no sub program so it is a big file.
Jeff
-
It looks like it is very close to correct. There is an offset at the beginning of the program that shouldn't be there as I have shown in the attached picture. The first hole should be at (0,0), but it is moving to (-4.3654, 4.5688) and then cutting the first hole. Also, I didn't let it run the entire time, but it looks like it is only cutting the top pocket on the first pass. Is that right? Will it come around again and cut the bottom pocket?
Also, here (http://www.youtube.com/watch?v=nGLkXYyv7og) is a video of it running the tool path to demonstrate what I'm saying.
-
Forgot to attach the picture...
-
Try with this one, origin has been moved to 0,0
Jeff
-
Running it now. I'll report back in a few minutes...
-
Worked like a charm! Thank you so much.
How did you generate that file?
-
I use Mastercam, Drawing and Gcode
Happy if this helped you with your work
Jeff
-
ostie,
i have started using mastercam recently and i am really confused by it. i was wondering if you would share the file you created for me, but i understand if you dont want to. i was hoping to see it so i could try to understand how you defined the material as well as how you drew all of the holes. i have done a few tutorials but for the most part i still dont get it.
also, i seem to be missing something i think, but mastercam also has cad? it doesnt look like very powerful cad unless im missing something, but i thought it was just cam. can you clarify this for me please?
thanks,
Tony
-
What version of MasterCam do you use.
I use X4 so if you use older version, will not be able to save toolpath.
Jeff
-
I am using X5.
-
Just draw the table top and made a simple program.
I don't remember exactly if it is the same as I sent you the first time.
Jeff
-
Thanks for posting that program. Unfortunately I still have no idea how to use it or how you generated the array of holes. I think I need to get a book because Mastercam is crazy complicated. Usually I can just figure out how to use software but I can't even get it to make the simplest tool path. I knew this going in though, so I mostly expected to run into this problem. It seems like the most powerful CAM program I've ever seen, so hopefully it will be worth the trouble to become familiar with it in the end.
-
To draw all the holes, you draw the first one at 0,0, origin
Then you use XFORM RECTANGULAR ARRAY
It will open a message box and you need to made 4 entries
Distance in the X direction and number on copy or entities
Distance in the Y direction and number of copy or entities
The double arrow is for changing direction
The rectangular array icon is 4 square dots.
Jeff
-
Ah, ok, that makes sense. Thanks for being so helpful. People like you make forums a great resource.
I'll see if I can duplicate your instructions when I get home from work.