Need Help! Thread Milling using macro - Page 3


Page 3 of 3 FirstFirst 123
Results 41 to 49 of 49

Thread: Thread Milling using macro

  1. #41
    Registered
    Join Date
    Aug 2016
    Location
    India
    Posts
    23
    Downloads
    0
    Uploads
    0

    Default Re: Thread Milling using macro

    Quote Originally Posted by samu View Post

    G0 G90 G17 G54 X... Y... M3 S.... (GO TO CENTER OF THE FIRST HOLE START SPINDLE)
    ..
    G0 G91 G28 Z0 M9 (RETURN TO Z HOME, STOP COOLANT)

    %
    O9202

    G91 G03 X-[[#3-#7]/2 Y0 I-[[#3-#7]/4] Z[#17/2] (HELICAL LEAD IN, HALF CIRCLE WITH A RADIUS OF (THREAD DIAMETER-CUTTER DIAMETER)/4 AND A Z MOVE OF PITCH/2)
    ..
    G0 G90 Z[#18+1.](RETRACT 1MM ABOVE SURFACE)

    %

    macro should'nt operate the tool change and activate tool lenght offset because it should work for evry tool, that's why I do that in the main in my example, but if you want that macro do it, you can define the tool in the line of the macro call with one more argument(an argument is a value that you define in the macro call and this value is passed to the macro, each letter in the line of the macro call represent an argument),think carrfully at wath exactly you want the macro does, your the only one to know your need, and remember, with macro programming, you are the boss you choose wath each letter represent and wath this custom cycle do exactly. Give me more details and I will suggest you a way to do wath you want.
    I understood the program that you've written and I can feel that this would be easy for the operator. One thing which bugs me is do we need to write program in incremental form?
    You've wrote the program based on the need that there are many repetitions of same hole which is absolutely what I want. But I write all the programs in absolute mode, because I hate calculating values every time for incremental mode and is confusing to my mind. So in such case where my application is the same, can the same program be written only in absolute mode or do I need to get along with incremental? It's NOT that I don't know anything about incremental but I refrain from using it wherever possible. If there's no option I'm ready to use it.

    Thanks



  2. #42
    Registered
    Join Date
    Aug 2016
    Location
    India
    Posts
    23
    Downloads
    0
    Uploads
    0

    Default Re: Thread Milling using macro

    Quote Originally Posted by samu View Post
    This is exactly wath I've done in my previous post!!! Read the chapter 15 of your operator manual, there is evry thing you have to know about macro.

    Before writting a macro, you have to know exactly wath you want it does
    ..
    ..
    macro should'nt operate the tool change and activate tool lenght offset because it should work for evry tool, that's why I do that in the main in my example, but if you want that macro do it, you can define the tool in the line of the macro call with one more argument(an argument is a value that you define in the macro call and this value is passed to the macro, each letter in the line of the macro call represent an argument),think carrfully at wath exactly you want the macro does, your the only one to know your need, and remember, with macro programming, you are the boss you choose wath each letter represent and wath this custom cycle do exactly. Give me more details and I will suggest you a way to do wath you want.
    Yes, even I do the same for tool compensation so that's not an issue for me.
    And as for learning macro, I'm getting a grip of it even as I type this thread.
    Yes I'll surely post it here if I'm stuck in between, since this forum has become a new knowledge centre for me.

    - - - Updated - - -

    I don't know how am I suppose to thank everyone for helping me so much. Seriously guys, this forum has been of great help to me. Thanks to this forum and to you guys for spending your valuable time for people like me. I'm very much obliged.



  3. #43
    Member samu's Avatar
    Join Date
    Feb 2007
    Location
    Canada
    Posts
    314
    Downloads
    0
    Uploads
    0

    Default Re: Thread Milling using macro

    you can avoid incremental mode but it's a little bit tricky and in my opinion, much more complicated than use G91, there is a system variable that store current position in the workpiece coordinate system #5041 for X and #5042 for Y. Since we are at the center point of the hole before entering the macro, the first step of the macro could be to save these value on another variable to use them when needed.

    %
    O9202
    #1=#5041 (SAVE X CENTER IN #1)
    #2=#5042(SAVE Y CENTER IN #2)
    G1 Z[#18-#26] F200 [FEED TO THE BOTTOM)
    G03 X[#1-[#3-#7]/2 Y#2 I-[[#3-#7]/4] Z[#18-#26+#17/2] (HELICAL LEAD IN, HALF CIRCLE WITH A RADIUS OF (THREAD DIAMETER-CUTTER DIAMETER)/4 AND A Z MOVE OF PITCH/2)
    I[[#3-#7]/2] J0 Z[#18-#26+1.5*#17] (THREAD CUTTING, FULL TURN AND Z MOVE OF THE PITCH)
    X#1 Y#2 I[[#3-#7]/4] Z[#18-#26+2*#17] (HELICAL LEAD OUT, HALF CIRCLE WITH A RADIUS OF (THREAD DIAMETER-CUTTER DIAMETER)/4 AND A Z MOVE OF PITCH/2)
    G0 G90 Z[#18+1.](RETRACT 1MM ABOVE SURFACE)
    M99
    %

    Last edited by samu; 09-15-2016 at 07:18 PM.


  4. #44
    Registered
    Join Date
    Aug 2016
    Location
    India
    Posts
    23
    Downloads
    0
    Uploads
    0

    Default Re: Thread Milling using macro

    I guess this is far more complex to understand.
    What I meant by my previous post was that if we are adding G54 in absolute mode and shifting the origin to the centre of the hole then what is the need to write G91?
    By shifting the origin it kind of makes it easy to calculate the co-ordinates.

    G91 G03 X-[[#3-#7]/2 Y0 I-[[#3-#7]/4] Z[#17/2] (HELICAL LEAD IN, HALF CIRCLE WITH A RADIUS OF (THREAD DIAMETER-CUTTER DIAMETER)/4 AND A Z MOVE OF PITCH/2)
    I[[#3-#7]/2] J0 Z#17 (THREAD CUTTING, FULL TURN AND Z MOVE OF THE PITCH)
    After the end of first line it will be at the start of threading. But for second line, the current position is (X=2, Y=0), I think because of writing G91 it will execute the circle in +ve X-direction from its current point and not in -ve X-direction. Since, we need the circle to interpolate in -ve X-direction from it's last position.
    Hope I'm clear about explaining this. But G91 really makes it confusing since calculations are suppose to be done from it's current position. G91 only helps in saving calculations in Z direction for up movement of pitch.
    You can correct it by changing the X co-ordinate to :
    G91 G03 X-[[#3-#7]/2 Y0 I-[[#3-#7]/4] Z[#17/2]
    X[[#3-#7] Y0 I[[#3-#7]/2] J0 Z#17 {co-ordinates now are X= -4, Y=0}

    What I would do is to write in absolute mode with setting G54 co-ordinates as origin to the hole and write the macro w.r.t the origin co-ordinates. I don't think there is need of G91 if we write it in this way.

    These are the variables you used before:
    #3 = 18
    #7 = 22
    #17 = 1.5
    #18 = surface of hole, 0 in my case since surface is flat and offset is set to respective height of the part
    #19 = increment in Z direction /Value to be set in Macro program/ {I don't know if initially we need to set it to 0 since we'll be setting it's value in macro program, PLEASE let me know if this is correct}
    #24 = X co-ordinate /I don't feel this is required/
    #25 = Y co-ordinate /I don't feel this is required/
    #26 = -19.5

    %
    O9202
    #19= #26 +[#17/2] {#26 - Depth of hole, #17- pitch of thread, #19 = -18.75, it will store -19.5+1.5/2= -18.25}
    G1 Z[#26]
    G03 X-[[#3-#7]/2] Y0 R-[[#3-#7]/4] Z[#19] /Using R format since I,J bugs me/ {Z=-18.75}
    X[[#3-#7]/2] Y0 I[[#3-#7]/2] J0 Z[#19+#17] {Z= -17.25} /Using I,J to be sure it makes full circle rather breaking it into 2 cycles by writing in R/
    #19= #19+ #17 {#19= -17.25}
    X-[[#3-#7]/2] Y0 R-[[#3-#7]/4] Z[#19+#17/2] {Z= -16.5}
    G0 Z[#18+5]
    M99
    %

    Adding another variable will be confusing too, so instead we can use simple arithmetic operations by doing some math like you've done. I appreciate that you've done calculations perfectly for Z movement.
    Z[#26 + #17/2] {Z movement for lead-in}
    Z[#26 + 1.5*#17] {Z movement for full pitch}
    Z[#26 + 2*#17] {Z movement for lead-out}
    Please correct me if I'm wrong and feel free to give suggestions.
    Thanks.



  5. #45
    Member samu's Avatar
    Join Date
    Feb 2007
    Location
    Canada
    Posts
    314
    Downloads
    0
    Uploads
    0

    Default Re: Thread Milling using macro

    maybe i'm wrong, but i suspect that you have a some confusion about wath G54 does. G54 X5. Y8. does not shift your origin. It just call a move to the point X5. Y8. in the workpiece coordinate system G54 that is set in the menu offset/work page. If you have machined the previos operation in the G54 work offset, you can add as many G54 you want in the program, it won't affect anything. G52 establish a local coordinate system in relation to the current work offset, If i'm in G54 and y call G52 x10. y10. it will set a new coordinate system at X+10. end Y+10 from the G54. But G52, althought a usefull thing, can cause dnagerous behavior, it is not compatible with G68(rotation of the coordinate system) and if not cancelled, can cause some crash.



  6. #46
    Member
    Join Date
    Jun 2010
    Location
    Australia
    Posts
    4256
    Downloads
    4
    Uploads
    0

    Default Re: Thread Milling using macro

    But G52, althought a usefull thing, can cause dnagerous behavior, it is not compatible with G68(rotation of the coordinate system) and if not cancelled, can cause some crash.
    I suspect that might only apply to some controllers (eg Fanuc?). I don't think it applies to Mach3. I am sure I have combined them successfully in Mach3.
    Cheers
    Roger



  7. #47
    Registered
    Join Date
    Aug 2016
    Location
    India
    Posts
    23
    Downloads
    0
    Uploads
    0

    Default Re: Thread Milling using macro

    Quote Originally Posted by samu View Post
    maybe i'm wrong, but i suspect that you have a some confusion about wath G54 does. G54 X5. Y8. does not shift your origin. It just call a move to the point X5. Y8. in the workpiece coordinate system G54 that is set in the menu offset/work page. If you have machined the previos operation in the G54 work offset, you can add as many G54 you want in the program, it won't affect anything. G52 establish a local coordinate system in relation to the current work offset, If i'm in G54 and y call G52 x10. y10. it will set a new coordinate system at X+10. end Y+10 from the G54. But G52, althought a usefull thing, can cause dnagerous behavior, it is not compatible with G68(rotation of the coordinate system) and if not cancelled, can cause some crash.
    By saying "What I meant by my previous post was that if we are adding G54 in absolute mode and shifting the origin to the centre of the hole then what is the need to write G91?
    By shifting the origin it kind of makes it easy to calculate the co-ordinates.
    " I very well know it doesn't actually shift your origin, I was out of words to explain what I meant so in layman terms I used the above sentence. Yes, it only crates new workpiece co-ordinate system by not affecting the global/ machine co-ordinate system. So what I meant was it is kind of easy to calculate the new co-ordinates regarding thread milling rather than calculating in machine co-ordinate system or by using G41 comp.

    I don't know if by not using G41 there are more chances of crashing or by using it. You guys can help me on this. But I know for sure that G41 is complex for me.

    Is my program correct from post #44?

    And can you simulate that program for me with multiple values? Like using M22 then M26, M36, M45 with pitch as 1, 1.5 (or for any standard thread BSP, UNF etc.)

    Do you guys know some best simulators for Macro? (Fanuc controller supported).

    Thanks.



  8. #48
    Member samu's Avatar
    Join Date
    Feb 2007
    Location
    Canada
    Posts
    314
    Downloads
    0
    Uploads
    0

    Default Re: Thread Milling using macro

    Heu.. i'm not sure i well understand wath you mean! Nobody program in machine coordinate!!! If so each time you do a set up, your part need to be exactly at the same point! No sense, usually all the program coordinate are from a point on the geometry of your part, usualy a corner that you find with a edge finder and set your work offset according to that corner. Sure you have to mess with the ccordinate calculation if you do all your work in machine coordinate. In fact, G91 is the way to go,it is like you tell to me:" I don't like to turn left with my car, I find it easier to tur 270deg right instead of 90deg left." About G41, the risk of crashing with G41 is if you sometime use the actual radius of the tool for offset value, and other time, programed path is the center of the tool and you juste use small value to corect the geometry. But it is defenitely a feature to add to adjust over or under cutting. You are alaways talkin of calculation, but, the goal of a macro is to to the calculation for you. Once it is done, you never touch it again. It is a non-sens to use an origin shift for each hole. Let me know how is your main program, and how is your macro call, for multiple hole with same parameter, and I tell you wath I think of. Your macro seems o.k but like I said it work only for a hole located at x0 y0. Trust me, G91 is the way to go.



  9. #49
    Registered
    Join Date
    Aug 2016
    Location
    India
    Posts
    23
    Downloads
    0
    Uploads
    0

    Default Re: Thread Milling using macro

    Quote Originally Posted by samu View Post
    Let me know how is your main program, and how is your macro call, for multiple hole with same parameter, and I tell you wath I think of. Your macro seems o.k but like I said it work only for a hole located at x0 y0. Trust me, G91 is the way to go.
    Thread Milling using macro-fixture-png

    Okay cool. This is the part that I'm going to machine within next 4-5 days. I've a code already written by our operators and I want to further develop it and make it easy using macro wherever I can.
    It is for making 3/8" BSP Port on the both faces.
    This is a rough layout of my fixture (not drawn to scale, drawn in a haste just to represent the distance between 2 workpieces and centers of port). Blue circle is the origin for the entire batch and it is the work offset for entire operation.
    You'll find 0.2 - 0.4mm variation is co-ordinates, it's because the raw material is extra 1-2mm, so don't worry about co-ordinates.
    Centre of BSP Port on right job is X 26.0 Y-17.0, for left job is X -65.2 Y-16.8.
    Some operations like drill 7 are additional operations to be carried out which are not included in standard BSP Ports, so if you want you can ignore.


    %
    O0281 (3/8"BSP port)
    N1 (face milling)
    G0 G28 G91 Z0.0
    M6 T1
    G0 G90 G95 G54 X35.0 Y42.0
    G43 Z50.0 H1
    M03 S1000
    M7
    G0 Z2.0
    G01 Z-0.8 F0.5
    Y-80.0 F0.6
    X-72.0 F2.5
    Z-1.8
    Y42.0 F0.6
    G0 G80 Z50.0
    M5
    M9
    G0 G28 G91 Z0.0
    N2 (DRILL 7.0)
    G0 G28 G91 Z0.0
    M6 T2
    G0 G90 G95 G54 X26.0 Y-17.0
    G43 Z50.0 H2
    M03 S1400
    M7
    G83 Z-47.2 R1.0 Q10 F0.07
    X-65.2 Y-16.8 Z-48.2
    G0 G80 Z50.0
    M5
    M9
    G0 G28 G91 Z0.0
    N3 (DRILL-15.0)
    G0 G28 G91 Z0.0
    M6 T3
    G0 G90 G95 G54 X26.0 Y-17.0
    G43 Z50.0 H3
    M7
    M03 S700
    G83 Z-20.5 R1.0 Q10 F0.15
    X-65.2 Y-16.8 Z-21.5
    G0 G80 Z50.0
    M5
    M9
    G0 G28 G91 Z0.0
    N4 (SPOTFACE-25.0)
    G28 G91 G0 Z0.0
    M6 T4
    G0 G90 G95 G54 X26.0 Y-17.0
    G43 Z50.0 H4
    M03 S300
    M7
    G82 Z-4.7 R-2.5 P800 F0.08
    X-65.2 Y-16.8 Z-5.7
    G0 G80 Z50.0
    M5
    M9
    G0 G91 G28 Z0.0
    N5 (3/8" Threading)
    G0 G28 G91 Z0.0
    M6 T5
    G52 G54 X26.0 Y-17.0
    M98 P041
    G52 G54 X-65.2 Y-16.8
    M98 P042
    G52 G54 X0.0 Y0.0
    G0 G28 G91 Z0.0
    N21 (Face milling)
    G0 G28 G91 Z0.0
    M6 T1
    G0 G90 G95 G54 X35.0 Y42.0
    G43 Z50.0 H1
    M03 S1000
    M7
    G0 Z2.0
    G01 Z-1.0 F0.5
    Y-80.0 F0.6
    X-72.0 F2.5
    Z-2.0 F2.5
    Y42.0 F0.6
    G0 G80 Z50.0
    M5
    M9
    G0 G28 G91 Z0.0
    G0 G28 G91 Z0.0 Y0.0
    M30
    %

    %
    O0041 (G3/8 BSP THREADING)
    G0 G90 G54 G17 G43 H5 X0.000 Y0.000 Z50.0
    S2000 M03
    Z5.0
    G01 Z-13.9 F5000 M07
    G91
    G41 D5 X1.790 Y-1.790 Z0.000 F50
    G03 X1.790 Y1.790 Z0.167 I0.000 J1.790 F50
    G03 X0.000 Y0.000 Z1.337 I-3.581 J0.000
    G03 X-1.790 Y1.790 Z0.167 I-1.790 J0.000
    G01 G40 X-1.790 Y-1.790 Z0.000 F5000
    G01 X0.0 Y0.0
    G90 Z50.0
    M5
    M9
    M99
    %

    %
    O0042 (G3/8 BSP THREADING)
    G0 G90 G54 G17 G43 H5 X0.000 Y0.000 Z50.0
    S2000 M03
    Z5.0
    G01 Z-14.9 F5000 M07
    G91
    G41 D5 X1.790 Y-1.790 Z0.000 F50
    G03 X1.790 Y1.790 Z0.167 I0.000 J1.790 F50
    G03 X0.000 Y0.000 Z1.337 I-3.581 J0.000
    G03 X-1.790 Y1.790 Z0.167 I-1.790 J0.000
    G01 G40 X-1.790 Y-1.790 Z0.000 F5000
    G01 X0.0 Y0.0
    G90 Z50.0
    M5
    M9
    M99
    %


    P.S- Main program is solely written by operators and threading sub programs by insert provider Carmex. I know there are lot of blocks which are unnecessary, is written vaguely, very long, consumes more space, but first I want input from you guys as to how well it can be written so even I can learn and make my operators aware what is to be done.

    TIA



Page 3 of 3 FirstFirst 123

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Thread Milling using macro

Thread Milling using macro