585,557 active members*
3,439 visitors online*
Register for free
Login
IndustryArena Forum > MetalWorking Machines > Okuma > Can one generate a modal subroutine.
Results 1 to 16 of 16
  1. #1
    Join Date
    Jun 2007
    Posts
    99

    Can one generate a modal subroutine.

    Like many users, I use G73 a lot. The problem is the retract is in rapid mode. I can generate my own G-code but I believe it is just a call to a sub. I have G111 to use the tool setter.
    Is there a way to write code like the following:
    G112 X0 Y0 Z-.2 R.02 F8 Q.1 (the code would have constants and loops, etc.)
    X1 Y0
    X2 Y0
    ETC.
    without having to use a CALL statement between each coordinate set?

    If so, please provide a simple example.
    Thanks

  2. #2
    Join Date
    Jun 2015
    Posts
    4154

    Re: Can one generate a modal subroutine.

    hello, i am sorry, i can't really understand what you need; i found this explanations :

    G73 : grooving cycle
    G111 : constant speed cutting on turret B
    G112 : circular threading

    if G73 is a groving cycle, then why do you need to remove or replace the rapid ?

    also i can't understand where you need the modal behaviour / kindly
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  3. #3
    Join Date
    Apr 2009
    Posts
    1262

    Re: Can one generate a modal subroutine.

    It an be easily accomplished using MODIN and MODOUT commands. Some addresses are not available for you use but local variables can be assigned such as LEN=1.5 DIA=.75 but it will be able to do a routine that repeats with every coordinate just like a drilling routine.

    Good luck,
    Experience is what you get just after you needed it.

  4. #4
    Join Date
    Jun 2007
    Posts
    99

    Re: Can one generate a modal subroutine.

    G73 on my machine, a milling center, is a partial retract/chip breaker drilling cycle. Sorry for not being clear about that. G111 through G(number) are names one can code and then use freely.

    Last night, I looked at the MODIN and MODOUT and it looked promising but the manual is not clear at all.

    My machine is running now, I cannot test, but does the format look like the following?:

    M6T1
    G56H1
    S5555M3
    M12
    (MOVES TO THREE LOCATIONS AND DOES A SIMPLE PLUNGE AT EACH)

    MODIN O123 (NO MOVEMENT HERE)
    X1Y3 (MOVES TO THIS LOCATION AND DOES WHAT O123 COMMANDS. IT PICKS UP G0 FROM THE LAST MOVEMENT OF SUB)
    X2 Y2 (REPEATS AT THIS LOCATION)
    X1 Y4 (ETC.)
    MODOUT ( A RESET/CLEAR FOR THE ABOVE)
    G0Z12
    M2

    O123
    G1 Z-.1 F8
    G1Z0 F50
    G0Z.5 F100
    RTS

  5. #5
    Join Date
    Jun 2015
    Posts
    4154

    Re: Can one generate a modal subroutine.

    hi graemeian, i got it now i was looking for those codes inside the lathe manual

    why don't you like the rapid inside G73 ? why do you wanna replace it ?


    coding those without repeating the CALL requires MODIN / MODOUT, just like how mr Wizard said

    onestly, i don't use MODIN & MODOUT, because there will be too many lines; i preffer using CALL; for example this code :

    CALL LVX = x_coord_1 LVY = y_coord_1
    CALL LVX = x_coord_2 LVY = y_coord_2
    CALL LVX = x_coord_3 LVY = y_coord_3

    requires less lines than using MODIN / MODOUT i don't like codes that are all over the place however, depending how you create that code, it may matter to have a shorter syntax ...



    if you don't like the rapid retreat, try this :
    Code:
        G01 Z-10      F0.123 G95
             Z-10+0.3            ( small retreat executed without changing the feed )
             Z2.5     F4000  G94 ( out of the hole, but not at full rapid, but at a feed that is specified in mm/min, without relation to the cutting feed that is specified in mm/o )
    the problem with rapids is that Okuma controller does not allow editing their parameters from code; if you wish, pls check this thread : https://www.cnczone.com/forums/okuma...apid-feed.html


    kindly
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  6. #6
    Join Date
    Apr 2009
    Posts
    1262

    Re: Can one generate a modal subroutine.

    Quote Originally Posted by graemeian View Post
    G73 on my machine, a milling center, is a partial retract/chip breaker drilling cycle. Sorry for not being clear about that. G111 through G(number) are names one can code and then use freely.

    Last night, I looked at the MODIN and MODOUT and it looked promising but the manual is not clear at all.

    My machine is running now, I cannot test, but does the format look like the following?:

    M6T1
    G56H1
    S5555M3
    M12
    (MOVES TO THREE LOCATIONS AND DOES A SIMPLE PLUNGE AT EACH)

    MODIN O123 (NO MOVEMENT HERE)
    X1Y3 (MOVES TO THIS LOCATION AND DOES WHAT O123 COMMANDS. IT PICKS UP G0 FROM THE LAST MOVEMENT OF SUB)
    X2 Y2 (REPEATS AT THIS LOCATION)
    X1 Y4 (ETC.)
    MODOUT ( A RESET/CLEAR FOR THE ABOVE)
    G0Z12
    M2

    O123
    G1 Z-.1 F8
    G1Z0 F50
    G0Z.5 F100
    RTS

    Your code looks good to me.
    I'm not positive if it will not move on the MODIN line or not - you may need to be in position. (It's been a long time since I've done it.)

    Best regards,
    Experience is what you get just after you needed it.

  7. #7
    Join Date
    Jun 2007
    Posts
    99

    Re: Can one generate a modal subroutine.

    Thanks all.
    I wrote the following simple code

    MODIN O125 ( THE DRILLING PROCEDURE )
    CALL O100 (SEVERAL HUNDRED X Y COORDINATES)

    MODOUT

    M2


    AND IT WORKED THE FIRST TIME.

    It saved me from putting a CALL between each coordinate and making opportunities for errors.

  8. #8
    Join Date
    Jun 2015
    Posts
    4154

    Re: Can one generate a modal subroutine.

    hi graemeian, nice combo to put CALL between MODIN and MODOUT


    all those coordinates, are on a pattern ? you know, just to simplify the program by using a soubroutine


    how do you handle the midd-program restart ? if the 254th hole is failing, how do you restart it ? do you know about the internal sequence counter, that allows restarting on something like "12345" instead of "N100" ? it is a very fast restart method / kindly
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  9. #9
    Join Date
    Jun 2007
    Posts
    99

    Re: Can one generate a modal subroutine.

    Quote Originally Posted by deadlykitten View Post
    hi graemeian, nice combo to put CALL between MODIN and MODOUT


    all those coordinates, are on a pattern ? you know, just to simplify the program by using a soubroutine


    how do you handle the midd-program restart ? if the 254th hole is failing, how do you restart it ? do you know about the internal sequence counter, that allows restarting on something like "12345" instead of "N100" ? it is a very fast restart method / kindly
    I knowing nothing about the ISC. I usually have to cut air or if I remember, I put a tag in the quick edit and edit the code with a GOTO.
    Sometimes, I cut and paste the header and put it at the restart point if I need to make more parts. I then toggle to that point to start.

    Thanks again.

  10. #10
    Join Date
    Jun 2015
    Posts
    4154

    Re: Can one generate a modal subroutine.

    i will show you how it works i have osp300



    also, if there are many holes that are not on a patten, or if they are located on a patten but the code is not generated on a pattern algorithm, than downtime occurs ( during positioning ); do you wish for an optimizaton example for your holes ? hundreds of holes ? is not a big thing, only computing the shortest path



    you may need to change the ipw so to increase droop amount between a movement in XY plane and a movement in Z plane ( or between 2 movements in Z plane, etc ); this speeds up the positiong movements, and reduces servo stress mr Wizard revealed this technique at post #20 & 22 in here : https://www.cnczone.com/forums/okuma...precision.html



    also, if there are many holes, then tool life spam may be drastically affected during the program : thus the tool starts with a fresh cutting edge, and wear appears pretty soon, as the program goes on :
    ... one way to handle it, is to change the tool after x holes
    ... another way is to lower the feed, and/or rpm, and/or lower the peck distance (etc) after x holes
    ... another way is to begin with lower cutting specs, so to avoid changing them later ( using medium cutting specs, that are too low for a new tool, but perfect for a tool with a bit of wear )
    * if you wish for on-demand cutting specs & peck distance changing, or whatever else ( like variable peck distance, or on-demand retract position, or lower feed specs as the tool goes deeper, etc ), without interrupting the program, pls consider that it may be possible : is like running trials on a long program, without reseting + restarting the program

    there are also other things : hi-g + M300 + low clearances

    i hope you find these usefull / kindly
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  11. #11
    Join Date
    Jun 2007
    Posts
    99

    Re: Can one generate a modal subroutine.

    Looking back at that other post, I do not believe G1 segmenting adds much stress to the servos as they are hunting all the time even in a straight line. Also, the G1 segments are made smooth by the acceleration parameters. I went this path because G1 is smoother than G0. Also, I believe G0 will stop when it transitions to a G1. I seldom run my G0 over 30 percent. I have performed the following test numerous times. I use a common G83 or G73 drill code. I then mimic this code using a SUB and only G1s and usually faster than G0 @ 30%. The result, the cabinetry does not rattle using G1 moves. Another issue... It may be better for the tooling and part to retract instantly. It is also better for the smaller tooling to cut aluminum at 10K rpm but I seldom go over 8K and that is for short cycles. I want to save the machine.

    The MODIN and MODOUT work well for me and thank you again. On a week-end project I had to drill several hundred holes .015" in diameter. Using these commands, I did not have to insert CALLs between each. I also have a 24K rpm spindle mounted to a CAT 40 holder and it is amazing to see how it blasts the chips out of the holes. I use mostly PCB drills. Using only G1s and the main spindle not spinning, it was the quietest machine time in a while.

  12. #12
    Join Date
    Jun 2015
    Posts
    4154

    Re: Can one generate a modal subroutine.

    hi graemeian


    [ about smooth movement ]


    what you did about replacing G0s with G1s, that are moving faster than 30%rapid, is a good thing to do

    is not the only way

    depending on machine condition, axis movement type, etc, it is possible to input much more wear only with the rapids : for example, if a machine cuts 85%feed and 15%rapid, those 15%rapids may input much more wear inside the machine then those 85%feed; by 15% rapid i don't mean that the rapid is at 15%, but that the program length is 100%, and it has 15%rapids and 85%feed movements (15+85=100)

    G1 adds stress because it requires a cinematic diagram with smooth corners ( smooth corners is ok for feeding, but is not critical for positioning )

    G0 requires a sharp diagram that is less servo-demanding, but it achieves higher speeds and uses higher acc/decc that leads to shocks; also rapids may not be linear interpolated

    ... you may keep the G0 at 100% and edit the ipw to smooth out movement and achieve faster times
    ... you may edit the hi-g paramaters, so to keep the speed up, but to increase the acc/decc time, so to avoid shocks

    i will send you some codes, so you should feel the difference


    [ about protecting the spindle ]


    is good to use lower rpm so to protect the spindle; consider using also gear-attachements-with-ratio<>1:1

    depending on your spindle specs ( normal, wide range, high speed ) it may be better to think about protecting it : for example, a "wide range" type may have comparable top speed like a "high speed type", only that it has more torque at lower rpms, and bigger mass ( so to handle bigger tapers )

    depends what you do, how you feel the machine, but anyway, is very good to be preventive


    [ about faster restart ]


    i did not had time to run a trial about faster restating : it takes much less time for me to write this post


    [ about program creation ]


    about modin/modout, is how you create the program; imagine : open dwg \ select holes \ edit some parameters through an interface \ send code to cnc \ go at the cnc and push 'program select'




    also, the G1 segments are made smooth by the acceleration parameters
    far as i know, there are parameters only for rapids acceleration, not also for feed; pls, will you share the location of those parameters ?

    I use a common G83 or G73 drill code ...The result, the cabinetry does not rattle using G1 moves

    especially on drilling, rapids are among Z axis, and this may lead to some vertical shocks; it would be nice if it would be possible to make this setting ( from code ) : Xrapid80%, Y&Zrapid30%, thus treating each axis in a different manner

    kindly
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  13. #13
    Join Date
    Jun 2007
    Posts
    99

    Re: Can one generate a modal subroutine.

    Deadlykitten,

    I did not know that there is an acceleration control for rapid. In my manual, I have VPF1C marked where I tried it before. I just tried it and no noticeable change for a G73 cycle. Somewhere, there is a parameter for heavy parts.

    The Okuma controlled machine is the only VMC I have. I had Renishaw, touch probe, and air blast added when purchased. It is a standard 40, 20, 25 with a 10K spindle. I made the high speed CAT40 connected spindle router. One problem is its size as it would cause damage if a tool change occurred. I plan to make a smaller holder for the router motor someday. I bored the holder in the machine so it should be trammed. I also put a limit switch in the ceiling above the machine. so when the Z axis is fully retracted, the router is switched off. I also made a rack for some space in the rear cabinet to store holders and collets.

    If you have time to provide some code for smooth operation, please share.
    Thanks.

  14. #14
    Join Date
    Jun 2015
    Posts
    4154

    Re: Can one generate a modal subroutine.

    hi graemeian, this post is about osp300 ( at least )

    run this code at 100% rapid, with and without the brakets

    Code:
        VC1 = 25
        G00 X0    Y0
    
    
      ( VINPX = 0 )
      ( VINPY = 0 )
    
    
            X+VC1 Y+VC1 G91
            X+VC1 Y-VC1
            X+VC1 Y+VC1
            X+VC1 Y-VC1
            X+VC1 Y+VC1
            X+VC1 Y-VC1
            X+VC1 Y+VC1
            X+VC1 Y-VC1
            X0    Y0    G90
    
    
        VINPX = 0.005
        VINPY = 0.005
    that zig-zag toolpath should be executed more smoothly when vinp* is there

    it may be a good idea to write down the vinp* values before you run this code ... so run this before :

    Code:
        VC1 = VINPX
        VC2 = VINPY
        VC3 = VINPZ  write down vc1 2 3, on a piece of paper, on a dirty window, in sand ? use chalk ?
    pls check attached image, so to see the interface for the vinp*


    In my manual, I have VPF1C marked where I tried it before. I just tried it and no noticeable change for a G73 cycle. Somewhere, there is a parameter for heavy parts
    that vpf1c seems to be a parameter that targets acc/decc for the predefined F1, when using the option "F1-digit parameter"

    seems to be a limitated behaviour / whatever ...

    I did not know that there is an acceleration control for rapid
    check post 28 in next link ( about vinp, hig, bits, etc ): it is a bit old, but is still ok : https://www.cnczone.com/forums/okuma...precision.html

    important thing : vinp*=0 delivers a smooth movement, and a cycle time comparable to when using hi-g at 100%; hi-g uses higher speeds and more agrresive acceleration, while vinp* keeps a moderate speed for a longer time

    vinp is cutting corners, or is stepping on the grass ( just a bit )





    about boosting a drill cycle, etc, consider reading the " cycle time reduction " chapter for mills try also this code with and without brakets

    Code:
        G00 Z_safe_plane
        M08
        S3456 M03
        G00 X0 Y0
    
    
      ( VINPZ = 0 )
    
    
        G00 Z2.5
        G01 Z-5 F0.369 G95
        G00 Z-5+0.3
            Z+2.5
            Z-5+0.6
    
    
        G01 Z-10
        G00 Z-10+0.3
            Z+2.5
            Z-10+0.6
    
    
        G01 Z-15
        G00 Z-15+0.3
            Z+2.5
    
    
        M05 M300
    
    
        VINPZ = 0.005
    
    
        G00 Z_safe_plane
    if you replace G00s with G01s, than you may no longer see the vinp* effect, because it does not affect transition "from or to" feed movements, but only "from or to" rapid movements and static positions ( pls check attached image )

    kindly
    Attached Thumbnails Attached Thumbnails ipw.png   untitled.PNG  
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  15. #15
    Join Date
    Jun 2015
    Posts
    4154

    Re: Can one generate a modal subroutine.

    [ using the internal sequence counter, aka block counter, to restart a program ]

    hello graemeian the code in this post drills 4 holes; code structure is similar to yours : all coordinates are inside a soubroutine, and the soubroutine is located between modin & modout

    in image 01 is shown that when the execution ( up arrow char ) reached 3rd hole, the "internal sequence counter" reaches 14

    in image 02 is shown the interface of the restart procedure, where i input 14; when i execute the restart sequence, machining will begin from 3rd hole

    the " internal sequence counter " may also be reffered as " block counter ", but a program with 100 lines may require more than 100 sequences to be performed by the controller : consider a " looped-code ", or a " roughing cycle ", etc. The controller processes the line syntax, and decides how many sequences are needed. Each sequence is count, and the counter is displayed.

    the "internal sequence counter value", that is displayed on the screen, does not reset in case of an emergency-stop, or if reset button is hit; this helps a lot to restart programs that have been stopped randomly, simply by restarting on actual value minus 1 2 3 .. 10 units, depending on code layout

    i hope you find it usefull kindly

    ps : code also uses :
    ... an absolute retreat position, that is not relative to the table ( fixture ), but to the max Z travel ( cabinet ceiling ) ( in this case, end Z position is 50 mm lower then Z+ soft limit ) means better control
    ... ctr : code will perform faster; targets tens of a second; requires " cas disabling codes "
    ... noex : code will perform faster; targets tens to thousands of a second; helps when there is a lot of math, it smooths out the buffer reading, etc

    the seqeunces where drilling begins for each hole are inside brakets; pls check line " OXY ( 06 10 14 18 ) "

    Code:
    
    
    
        NOEX VC1 = 0350         (  o / min  )
        NOEX VC2 = 0.25 * 10    (  mm / o   )
    
    
      ( * )
    
    
        M510 ( cas off )
    
    
        G15 H50
        G56 HA
      ( M08 )
        S + VC1 M03 M300
        G00 Z + 200 + 2.5
    
    
        MODIN OSUB
        CALL OXY
        MODOUT
    
    
      ( M09 )
        M05 M300
    
    
        NOEX VC4 = VPPLZ - VWKAZ + VWKBZ - 50
        G00 Z + VC4
    
    
        M511 ( cas on  )
    
    
        M02
    
    
    OSUB
    
    
        G01   Z + 200   - 2.5   F + VC2  G95
      ( NOEX LV01 = + VWKBZ + 0.3            )
      (       Z + LV01                       )
              Z + 0.3                    G91
        NOEX                             G90
              Z + 200   + 2.5   F + 4500 G94
        NOEX G00
    
    
    RTS ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )
    
    
    OXY ( 06 10 14 18 )
    
    
        X10   Y10
         X20   Y20
          X30   Y30
           X40   Y40
    
    
    RTS ( . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . )
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  16. #16
    Join Date
    Jun 2007
    Posts
    99

    Re: Can one generate a modal subroutine.

    I want to say thank you. It has been a while and I just re-posted this question again. I remembered trying a variation of the above and it appeared to work. Recently, did some cleaning chips under the shields and pressing buttons I should not have and I think that is the source of my heavy acceleration. I want to apologize for forgetting this post.
    Thanks again.

Similar Threads

  1. G-Code Modal and non-modal
    By R2D3 in forum PlanetCNC
    Replies: 4
    Last Post: 01-26-2018, 04:09 PM
  2. DX-32 G17, G18, and G19 Modal?
    By md63825 in forum Bridgeport / Hardinge Mills
    Replies: 9
    Last Post: 09-29-2011, 04:59 PM
  3. Modal question
    By nelZ in forum CamSoft Products
    Replies: 2
    Last Post: 06-28-2011, 10:07 PM
  4. MODAL IS OUT OF G80 ERROR
    By erdemkaraman in forum Uncategorised MetalWorking Machines
    Replies: 4
    Last Post: 03-25-2008, 02:10 PM
  5. Non-modal G00,G01...G03
    By cncuser1 in forum Mastercam
    Replies: 4
    Last Post: 05-30-2007, 07:39 PM

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
  •