![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| G-Code Programing Discuss G-code programing and problems here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
I am a noobie... that said I wrote the following program and it does exactly what I intended: G21 (sets the file units to millimeters. ) #1 = 38 (Rough Diameter of Post) #2 = 12.7 (Cutter diameter) #3 = -5 (Z depth increment value ) #4 = [#1 + #2] (Diameter of POST to mill... post diameter + tool diameter ) #5 = [#4 / 2] (Radius of POST to mill ) #8 = 100 (travel speed ) (rough cut the post) G90 G0 X[#5 * -1] Y0 Z5 F#8 #6 = 1 (tool depth counter) #7 = 0 (actual Z depth variable ) M98 P100 L4 (finish cut the post) #1 = 35.50 (Finish Diameter of Post) #4 = [#1 + #2] (Diameter of POST to mill... post diameter + tool diameter ) #5 = [#4 / 2] (Radius of POST to mill ) G1 X[#5 * -1] Y0 G17 G3 x[#5 * -1] y0 i#5 j0 (select the XY plane and do arc counter clockwise ) (cut relief for tube seam weld) G0 Z5 G0 X#5 Y0 G0 Z#7 G1 X [#5 - 1] (cut the hole---lighten the finished piece) #1 = 25 (Diameter of Hole) #4 = [#1 - #2] (Corrected Diameter of HOLE to mill... hole diameter - tool diameter ) #5 = [#4 / 2] (Radius of HOLE to mill ) G0 Z5 (clear the Z axis from the work surface) G0 X[#5 * -1] Y0 Z5 F#8 #6 = 1 (tool depth counter) #7 = 0 (actual Z depth variable ) M98 P110 L4 M30 O100 (mill a POST) #6 = [#6 + 1] (increment counter) #7 = [#3 * #6] (adjust tool depth for this count) G1 Z#7 (set tool depth) G17 G3 x[#5 * -1] y0 i#5 j0 (select the XY plane and do arc counter clockwise ) M99 (return from subroutine) O110 (mill a HOLE) #6 = [#6 + 1] (increment counter) #7 = [#3 * #6] (adjust tool depth for this count) G1 Z#7 (set tool depth) G17 G2 x[#5 * -1] y0 i#5 j0 (select the XY plane and do arc clockwise ) M99 (return from subroutine) Then I wrote the following and it did exactly what I expected: G21 (sets the file units to millimeters. ) #1 = 38 (Diameter of large arc) #2 = 12.7 (Cutter diameter) #3 = -5 (Z depth increment value ) #4 = [#1 + #2] (Diameter of POST to mill... post diameter + tool diameter ) #5 = [#4 / 2] (Radius of POST to mill ) #8 = 100 (travel speed ) #9 = 11.4 (diameter of small arc) G90 G0 X0 Y#5 Z5 F#8 #6 = 1 (tool depth counter) #7 = 0 (actual Z depth variable ) M98 P100 L4 M30 O100 (mill a POST) #6 = [#6 + 1] (increment counter) #7 = [#3 * #6] (adjust tool depth for this count) #4 = [#1 + #2] (Diameter of large arc to mill... post diameter + tool diameter ) #5 = [#4 / 2] (Radius of large arc ) G1 Z#7 (move the tool to starting depth) G17 G3 X0 Y[#5 * -1] i0 j[#5 * -1] (select the XY plane and do large arc counter clockwise ) #4 = [#9 + #2] (Diameter of small arc to mill... post diameter + tool diameter ) #5 = [#4 / 2] (Radius of small arc ) G1 X25.45 Y[#5 * -1] (cut to starting point of small arc) G17 G3 X25.45 Y#5 i0 j#5 (select the XY plane and do small arc counter clockwise ) #4 = [#1 + #2] (Diameter of large arc to mill... post diameter + tool diameter ) #5 = [#4 / 2] (Radius of large arc ) G1 X0 Y#5 (cut to starting point of large arc) M99 (return from subroutine) Now comes the problem: I want the second program to create the large arc and the small arc such that they end on a line that is tangent to both arcs. That way I have a smooth transition from the large arc to the small arc. I have wrote many test programs trying to understand the G3 command but try as I might... I can only seem to get it to do a half circle instead of the "little more" that I need ![]() can anyone help me? If you consider that the center point of the large arc is 0,0 I know where I want to start milling the arc and I know where I want to stop milling the arc. From there I want to mill a "straight line" to the tangent of the small arc, mill the small arc, and mill a "straight line" back to my starting point. thanks in advance cj |
|
#2
| |||
| |||
| A quick look at your program, gives me to believe that in the attached picture, the Green is the tool path that you currently achieve, but your question indicates that you want a combination of the Green Arcs and the Red Lines. The above being the case, you need to do some maths with your User MAcro code to calculate the 4 Tangent Points of the 2 circles and 2 Red lines. Having done that, you will have the Start Point, End Point, I and J values to use in the G03 command line. The blue triangles in the attached picture have to be calculated to gain this information. Its not shown in the picture, but you would use the same method to calculate the tangent points of the small circle as was used for the large circle. The following code is an example of what your coordinates should be, and how applied to the G03 command lines. Of course, you would substitute the X, Y, I, and J values where applicable with the Macro Variables used to receive the calculated data. Regards, Bill G01 X13.790 Y21.271 G03 X13.790 Y-21.271 I-13.790 J-21.271 G01 X31.005 Y-10.111 G03 X31.005 Y10.111 I-6.555 J10.111 G01 X13.790 Y21.271 Last edited by angelw; 03-22-2011 at 09:16 PM. |
|
#3
| |||
| |||
| you are correct Anglew. That is the end result I am looking for but my problem is not the math to calculate where the two tangent lines begin and end. My problem is making the arcs start and end at those tangent points. I just can't seem to make the arc begin and end where I want them to |
|
#4
| |||
| |||
| Angelw.... I love u ![]() I ran your little code snippit and it does exactly what I want. After playing with it some... commenting out some steps... I figured out why I was having problems. I'm off and running now... thanks a bunch |
|
#6
| |||
| |||
| By the way, the early Fanuc Mill, Conversational program was based on the User Macro executable, (not sure about more recent models; I haven't bothered to look). Pocket clearing was achieved by altering the value of the Macro Variable holding the Tool Radius data. This method was also used to accurately size the feature, by applying a value to the Tool Radius Variable and not using G41 or G42 (cutter radius comp). This worked pretty well, as you didn't have to worry so much about how you had the cutter approach the cutter path, as you do when using G41 or G42. You could expand your Macro program by applying a Tool Radius System Variable to #2 used in your program. That way you could tweak the size of the feature via a Tool Offset, rather than hard coding the value. You will find the reference to the System Variables in your Fanuc programming manual. Regards, Bill |
|
#7
| |||
| |||
| And you thought you were through with me ![]() I have one more question. I have figured out everything you calculated but one value: G0 X13.790 Y21.271 G03 X13.790 Y-21.271 I-13.790 J-21.271 G01 X31.005 Y-10.111 G03 X31.005 Y10.111 I-6.555 J10.111 ______ G01 X13.790 Y21.271 how did you arrive at the value I-6.555????? |
|
#8
| |||
| |||
I and J are specified in the circular interpolation (G02/G03) command line in terms of distance and direction from the Start Point of the arc, to the Center Point of the same arc. Coincidentally, during the process of calculating the tangent point of the small circle and line, you also gain the I and J value. See the attached picture. Regards, Bill |
|
#9
| |||
| |||
| This may help with your macro. R1 = radius of larger circle R2 = radius of smaller circle CC = centre to centre Angle = ASine(R1-R2) / CC X1 = Sine(Angle) * R1 Y1 = Cos(Angle) * R1 X2 = (Sine(Angle) * R2) + CC Y2 = Cos(Angle) * R2 |
|
#10
| |||
| |||
| Thanks Kiwi and thanks Angelw.... problem was this 65 year old man's brain not wanting to get back into trig and geometry ![]() I finally managed to see what I was doing wrong and have generated the following code that behaves like I wanted it to. If not for you two, I would still be working on it. Thanks again and I will probably come knocking on your doors again. A friend and I bought a Kondia Powermill 3 axis CNC running Mach 3. Neither of us are machinist so we have much to learn ![]() here is the code I wrote. I have a lot I need to add to it but the hard part was the outside shape: thanks again cj G21 (sets the file units to millimeters. ) #1 = 38 (Diameter of large arc) #2 = 12.7 (Cutter diameter) #3 = -5 (Z depth increment value ) #4 = [#1 + #2] (Diameter of large arc to mill... arc diameter + tool diameter ) #5 = [#4 / 2] (Radius of Large arc to mill ) #8 = 100 (travel speed ) #9 = 11.4 (diameter of small arc) #10 = [#9 + #2] (diameter of small arc to mill ) #11 = [#10 / 2] (radius of small arc to mill ) #12 = 25.5 (distance between the two arc centers) #13 = [2*ACOS[[#5-#11]/#12] * 57.2957795] (angle Theta in degrees start of large arc) #15 = [#5 * COS[#13]*-1] (x position to start of large arc) #16 = [#5 * SIN[#13]*-1] (y position to start of large arc) #17 = [[#9 * COS[#13]*-1] + #12] (x position to start of small arc) #18 = [#9 * SIN[#13]*-1] (y position to start of small arc) (rough cut the outside of the part) G0 X#15 Y#16 #6 = 1 (tool depth counter) #7 = 0 (actual Z depth variable ) M98 P100 L4 M30 O100 (mill the shape) #6 = [#6 + 1] (increment counter) #7 = [#3 * #6] (adjust tool depth for this count) G1 Z#7 (set tool depth) G17 G03 X[#15] Y[#16 * -1] I[#15 * -1] J[#16 * -1] G01 X#17 Y[#18*-1] (cut to start of small arc) G17 G03 X#17 Y[#18] I[[#17 - #12]*-1] J#18 (select the XY plane and do small arc counter clockwise ) G01 X#15 Y#16 (cut to starting point of large arc) M99 (return from subroutine) |
| Sponsored Links |
|
#12
| |||
| |||
I'm sure I speak for Kiwi and all contributors of this forum, when I say that its good to get some feedback and see a positive outcome as a result of suggestions made. As with most things, there are a number of ways to skin this cat. Shown in Red is one of a few ways of repeating a profile down in Z without having to be concerned about over cutting, whilst giving you the opportunity of changing the depth of cut without having to ensure that its exactly divisible into the full depth. Also, you should take a look at passing your variable values to the Macro using a simple call statement as follows. This example is only passing the values for the cut in and full depth, but other variables could be passed as well. It just makes for a more organized program; you will create better structured programs as you do more. G65 C-5.0 D0.0 I-23.0 P100 In the above example C=#3, D=#7 and I=#4 when passed to you Macro program I've just used -23.0 for full depth to show that the cut in depths don't have to be exactly divisible into the full depth. Regards, Bill M98 P100 (just call the program once without repeats) O100 (#7 = 0 (Z start level)) from main program (#3 = -5.0 (Z depth of cut)) from main program #4 = -23.0 (Z full depth) example depth N10 #7 = #7 + #3 (adjust tool depth) IF [#7 LT #4] THEN #7 = #4 (make #7 = full depth to stop over cutting) G1 Z#7 (set tool depth) G17 G03 X[#15] Y[#16 * -1] I[#15 * -1] J[#16 * -1] G01 X#17 Y[#18*-1] (cut to start of small arc) G17 G03 X#17 Y[#18] I[[#17 - #12]*-1] J#18 (select the XY plane and do small arc counter clockwise ) G01 X#15 Y#16 (cut to starting point of large arc) IF [#7 GT #4] GOTO10 (go back to N10 if not to depth) M99 (return from subroutine) |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need Help!- My Milling OKK with fanuc 6M can't recognize G-code & M-code | nessei | Fanuc | 4 | 03-29-2011 08:39 AM |
| fanuc program code vs. Haas code | sixty8frbrd | Fanuc | 6 | 03-10-2011 09:05 PM |
| Converting Fanuc G code to Seimens 840D G code | Jasbinder | Siemens Sinumerik CNC controls | 2 | 02-20-2011 10:02 AM |
| Newbie- Takeout Unused G Code commands in Mastercams Generated G Code | shneek | Mastercam | 8 | 12-15-2010 02:32 PM |
| looking for g code 3d from bobcadcam or simmilar for indexer lpt v5 with g code soft | troyswood | Ability Systems - LPT Indexer and G-Code | 2 | 12-24-2006 09:21 PM |