G code line jump?


Page 1 of 2 12 LastLast
Results 1 to 12 of 16

Thread: G code line jump?

  1. #1
    Registered
    Join Date
    Nov 2013
    Posts
    45
    Downloads
    0
    Uploads
    0

    Default G code line jump?

    Hello,

    Is there a G code supported that will allow a line jump? An M99 P12 will jump to line 12 for example on a Fanuc and some others . I have also seen GOTO used in the G code.

    Thanks.

    Similar Threads:


  2. #2
    Registered tauntdesigns's Avatar
    Join Date
    Nov 2005
    Location
    USA
    Posts
    655
    Downloads
    0
    Uploads
    0

    Default Re: G code line jump?

    There's a block delete/block skip function.......... By putting a symbol(/) in front of the line to be skipped and turning on the block delete button.
    Block Delete button activated = skip lines with / in front of it

    Is that what you're looking for?

    Walking is highly over-rated


  3. #3
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2419
    Downloads
    0
    Uploads
    0

    Default Re: G code line jump?

    Hi Epiphany,

    KMotionCNC supports Jumps to Subroutines which is similar to a Jump if you simply never return.

    M98 Pxxx

    can be used to Jump to the GCode Line with the Label:

    Oxxx

    The Jump can be conditional as well by specifying a Subroutine Loop Count of either 0 or 1. See the included example

    SubroutineWithConditionals.ngc

    Code:
    G20
    #100 = 5
    
    (examples of logical operations)
    (result is 1 if condition is true)
    (result is 0 if condition is false)
    
    #101 = [#100 >  5]
    #102 = [#100 >= 5]
    #103 = [#100 <  5]
    #104 = [#100 <= 5]
    #105 = [#100 =  5]
    #106 = [#100 <> 5]
    
    (subroutine call can be looped a number of times)
    (the L or Q word may be used to specify the count)
    (if neither L or Q is specified a count of 1 is used)
    (if the count is 0 the subroutine will not be called at all)
    
    M98 P1 L3  (example using L to specify the loop count)
    M98 P1 Q3  (example using Q to specify the loop count)
    
    M98 P1 L#100  (example using a variable loop count)
    
    M98 P1 L[5 > 4]  (example using a conditional as a loop count)
    M2
    
    O1
    #200 = [#200+1]
    M99
    HTH
    Regards

    TK
    http://dynomotion.com


  4. #4
    Registered
    Join Date
    Nov 2013
    Posts
    45
    Downloads
    0
    Uploads
    0

    Default Re: G code line jump?

    Thanks for the replys,

    I am writing a tool setting routine and just attempting to simplify the code.

    Here is what I have now.


    Code:
    (***Tool Setting Macro with Manual Tool Change***)
    
    #100=1
    #101=1
    M98 P1 L[#101=1]
    M98 P1 L[#101=1]
    M98 P1 L[#101=1]
    M98 P1 L[#101=1] (This will need to be repeated about 20 times)
    G10L2P9X0Y0Z0
    #100=0
    #101=0
    (MSG,Tool Setting Complete)
    M2
    
    O1
    (Change Tool)
    M6 T#100
    (Set Fixture Offset)
    G59.3
    (Set Height Offset & Save XY Offset to G59.3)
    M101
    (Go Home)
    G00 G53 G90 Z0.
    G00 G53 G90 X0. Y0.
    (Send Message and pause)
    (MSG,Change to next Tool!)
    (Pause)
    M00 (Uncheck "Block Delete" To End)
    /#101=0
    /M99
    G00 G59.3 G90 X0. Y0.
    #100=[#100 + 1]
    M00 (Move Z to desired Offset Height)
    M99
    Repeating the M98 P1 L[#101=1] gets the job done I was just looking for another way.

    I have done this before.
    Code:
    (***Tool Setting Macro with Manual Tool Change***)
    
    N1 #100=1
    N2 (Change Tool)
    N3 M6 T#100
    N4 (Set Fixture Offset)
    N5 G59.3
    N6 (Set Height Offset & Save XY Offset to G59.3)
    N7 M101
    N8 (Go Home)
    N9 G00 G53 G90 Z0.
    N10 G00 G53 G90 X0. Y0.
    N11 (Send Message and pause)
    N12 (MSG,Change to next Tool!)
    N13 (Pause)
    N14 M00 (Uncheck "Block Delete" To End)
    N15 /M99 P20
    N16 G00 G59.3 G90 X0. Y0.
    N17 #100=[#100 + 1]
    N18 M00 (Move Z to desired Offset Height)
    N19 M99 P3
    N20 G10L2P9X0Y0Z0
    N21 #100=0
    N22 (MSG,Tool Setting Complete)
    N23 M2
    This would allow for "infinite" tools to be set.

    Cheers.



  5. #5
    Registered
    Join Date
    Nov 2013
    Posts
    45
    Downloads
    0
    Uploads
    0

    Default Re: G code line jump?

    Need help with the setting of the tool table.

    Here is the sequence.

    The X & Y & Z are jogged to a position.
    Press cycle start, the M101 will execute and do 2 things.
    1. Update the Length of the currently selected tool to the current machine coords.
    2. Update the X & Y coords of the G59.3 to the current X & Y machine coords.

    Here is the problem

    G code line jump?-tt-start-jpg

    Tool table at start

    G code line jump?-tt1-jpg

    After first tool

    G code line jump?-tt2-jpg

    After second tool. This is overwriting the pocket and ID of tool 1.

    Here is the C program.

    Code:
    #include "KMotionDef.h"
    
    #define TMP 10 // which spare persist to use to transfer data
    #include "KflopToKMotionCNCFunctions.c"
    
    #define Zaxis 2
    
    main()
    {
    	int FixtureIndex,Units, TWORD, HWORD, DWORD;
    	double NewToolLength,OriginOffsetZ,AxisOffsetZ,NewX,NewY,NewZ;
    	double Machinex,Machiney,Machinez,Machinea,Machineb,Machinec;
    
    	GetMiscSettings(&Units, &TWORD, &HWORD, &DWORD);
    
    	GetFixtureIndex(&FixtureIndex);
    
    	GetOriginOffset(&OriginOffsetZ, FixtureIndex, Zaxis);
    
    	GetAxisOffset(&AxisOffsetZ, Zaxis);
    	
    	GetMachine(&Machinex,&Machiney,&Machinez,&Machinea,&Machineb,&Machinec);
    
    	// Compute Tool Offset to make DRO zero when Tool Length selected and enabled
    	//
    	// Since Machine = DRO + OriginOffset + AxisOffset + ToolOffset
    	//
    	// Set DRO = 0 and solve for ToolOffset
    	//
    	
        
        printf("X is %d & Y is %d Z is %d\n",Machinex,Machiney,Machinez); 
      
    	// Change Currently Selected Tool Length
    	
    		
        NewToolLength = Machinez - OriginOffsetZ - AxisOffsetZ;
    
    	// Change Currently Selected Tool Length
    	SetToolLength(TWORD,NewToolLength);	
    	
    		
    	// Change Fixture Offset X
    	NewX= Machinex;
    
    	pD[TMP]=NewX;
    	SetVars(5201+FixtureIndex*20+0, 1, TMP);
    
    	DoPC(PC_COMM_UPDATE_FIXTURE);
    	
    	// Change Fixture Offset Y
    	NewY = Machiney;
    
    	pD[TMP]=NewY;
    	SetVars(5201+FixtureIndex*20+1, 1, TMP);
    
    	DoPC(PC_COMM_UPDATE_FIXTURE);
    	
    	
    }
    Using version 431s currently.

    Thanks.



  6. #6
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2419
    Downloads
    0
    Uploads
    0

    Default Re: G code line jump?

    Hi Epiphany,

    Still a bit clumsy but here is a way to eliminate your list of repeated conditional subroutine calls by using a looped surbroutine:

    Code:
    #100=1
    #101=1
    M98 P2 L100 (Do up to 100 tools)
    G10L2P9X0Y0Z0
    #100=0
    #101=0
    (MSG,Tool Setting Complete)
    M2
    
    O2 (Sub to conditionally call another sub)
    M98 P1 L[#101=1]
    M99
    
    O1
    (Change Tool)
    M6 T#100
    (Set Fixture Offset)
    G59.3
    (Set Height Offset & Save XY Offset to G59.3)
    M101
    (Go Home)
    G00 G53 G90 Z0.
    G00 G53 G90 X0. Y0.
    (Send Message and pause)
    (MSG,Change to next Tool!)
    (Pause)
    M00 (Uncheck "Block Delete" To End)
    /#101=0
    /M99
    G00 G59.3 G90 X0. Y0.
    #100=[#100 + 1]
    M00 (Move Z to desired Offset Height)
    M99
    Regarding Tool Table Problem. Please use latest Version 4.33b with the new Tool Table Format I believe that has been fixed

    See the Thread on our Yahoo Group regarding this:
    https://groups.yahoo.com/neo/groups/.../messages/9522

    HTH
    Regards

    TK
    http://dynomotion.com


  7. #7
    Registered
    Join Date
    Oct 2011
    Location
    Australia
    Posts
    15
    Downloads
    0
    Uploads
    0

    Default Re: G code line jump?

    Sorry Guys, I am sure to be on the wrong thread, but is there any string of Gcode that I can use that after leaving XY Zero, I can traverse to new co-ordinace ( X199 Y45 anywhere) STOP and RESET to ZERO at that point Thanks for any suggestions



  8. #8
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2419
    Downloads
    0
    Uploads
    0

    Default Re: G code line jump?

    Hi Aarwhy,

    One way would be to use G92

    G0 X199 Y45 (Traverse somewhere)
    G92 X0 Y0 (Set current position to zero)

    See here for more info.

    Regards

    TK
    http://dynomotion.com


  9. #9
    Registered
    Join Date
    Oct 2011
    Location
    Australia
    Posts
    15
    Downloads
    0
    Uploads
    0

    Default Re: G code line jump?

    Thanks Tom, I must be doing something wrong, that unfortunately does not work. Cheers Rod



  10. #10
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2419
    Downloads
    0
    Uploads
    0

    Default Re: G code line jump?

    Hi Rod,

    Are you looking at Machine Coordinates or Work Coordinates? What type of system/software do you have? What are you doing exactly? What happens?

    Regards

    TK
    http://dynomotion.com


  11. #11
    Registered
    Join Date
    Oct 2011
    Location
    Australia
    Posts
    15
    Downloads
    0
    Uploads
    0

    Default Re: G code line jump?

    Thanks. What I have in mind is a generic G, or Mcode Leader/Starter script I could include ahead of any program code.
    That would use/maintain/keep my MACHINE HOME X0 Y0. coordinates, intact.

    Then, Traverse to an entered Work location ie: X156 Y23 (create an artificial X0Y0 or whatever) but Start/Run the program from that (fake Zero) point,
    Yet, still able to maintain the integrity of original MACHINE HOME X0 Y0. coordinates, able to return to my original MACHINE HOME X0 Y0.

    Bottom line, if I create a tool-path in Aspire, it will start at Zero, be that, at a corner, or center of the program.
    I just want the ability to set the program start coordinates.
    Tell it to go to anywhere on the table I want, and start running the program as if that is Zero from there.
    I don't want to manually shift to that point, and reset Zero at that point , thus screwing all my machine coordinates
    Sorry, I hope you are not totally bewildered. But If so, I understand, I KNOW what I mean
    Here's Hoping! Cheers Rod



  12. #12
    Registered
    Join Date
    Nov 2013
    Posts
    45
    Downloads
    0
    Uploads
    0

    Default Re: G code line jump?

    Aarwhy,

    It sounds like you are refering to the work offsets already in the program. G54 thru G59.3 will do exactly what you are saying. A G53 will return you to machine coordinates. If you check the "Zero using fixture offsets" box in the Trajectory Planner the zero button next to the axis will apply the current X or Y position to the active offset. If you wanted to do this through a c program via M code or push button there are examples in the c program folder.

    SetFixtureX.c

    Code:
    #include "KMotionDef.h"
    
    #define TMP 10 // which spare persist to use to transfer data
    #include "KflopToKMotionCNCFunctions.c"
    
    #define Xaxis 0
    
    main()
    {
    	int FixtureIndex;
    	double NewOriginOffset,OriginOffsetX,AxisOffsetX;
    	double Machinex,Machiney,Machinez,Machinea,Machineb,Machinec;
    
    	GetFixtureIndex(&FixtureIndex);
    
    	GetOriginOffset(&OriginOffsetX, FixtureIndex, Xaxis);
    
    	GetAxisOffset(&AxisOffsetX, Xaxis);
    	
    	GetMachine(&Machinex,&Machiney,&Machinez,&Machinea,&Machineb,&Machinec);
    
    	// Compute Origin Offset to make DRO zero
    	//
    	// Since Machine = DRO + OriginOffset + AxisOffset
    	//
    	// Set DRO = 0 and solve for OriginOffset
    	//
    	NewOriginOffset = Machinex -  AxisOffsetX;
    
    	pD[TMP]=NewOriginOffset;
    	SetVars(5201+FixtureIndex*20+0, 1, TMP);
    
    	DoPC(PC_COMM_UPDATE_FIXTURE);
    }
    This will set the X value of the active fixture offset to the "Machine X - X Axis Offset" . There are also files for the Y.

    Hope that helps,

    Cheers



Page 1 of 2 12 LastLast

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

G code line jump?
G code line jump?