584,846 active members*
3,867 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Dynomotion/Kflop/Kanalog > Tool length Offset activated as part of Initialization file
Results 1 to 11 of 11
  1. #1
    Join Date
    Feb 2008
    Posts
    216

    Tool length Offset activated as part of Initialization file

    Hi Tom,

    My current work flow is the following:

    -Turn on KmotionCNC and hit “initialize”
    -Run home sequence
    -Have to perform a tool change and spindle must pick up a tool in order for it to start reading the tool offset for Z. (I have ATC)
    -Run home again and then zero the Fixture offset global values.

    I find that these steps have to be performed in order for it to operate correctly otherwise it is unreliable and will crash into a limit of the material.

    I think the biggest issue is making sure that the Tool length parameter is active when I start to set the XYZ for part zero. I’ve done all of this without performing the initial tool change and then Kmotion doesn’t taken the tool length into consideration until it starts running G code and crashes deep into the table bed is there a way to have the initialization file automatically ask for and set the tool height offset right when it turns on? I’m thinking a prompt screen that asks what too is in the spindle, and then applies that tool height and makes it active right away, before homing would be best? Or would the tool offset have to be applied after the machine homing sequence?

  2. #2
    Join Date
    May 2006
    Posts
    4043

    Re: Tool length Offset activated as part of Initialization file

    Hi slimneil,

    You didn't describe your workflow for how you determine and use offsets (Tool and Fixture). Here are some thoughts:

    Running the home sequence a 2nd time shouldn't change anything (unless your Home program does something unusual).

    Of course the Fixture/Global offsets must be set correctly before running a Job. Most Users use the "Save Always" option to keep the same values that were last used. Optionally you can use the Settings file (see Default.set) to force them to zero on KMotionCNC startup if that helps.


    I think the biggest issue is making sure that the Tool length parameter is active when I start to set the XYZ for part zero.
    When using a Tool to touch off and set a fixture offset it is important to have the Tool length compensation for that Tool active. Tool Length Compensation for a tool is enabled in GCode with G43Hn and turned off with G49. The Tool Length/Offset Immediately Option will have Tool Length Compensation turned on for a Tool Selected using the on screen Tool Drop Down Selector. The 1st Tool will be selected on KMotionCNC Start up.


    is there a way to have the initialization file automatically ask for and set the tool height offset right when it turns on? I’m thinking a prompt screen that asks what too is in the spindle, and then applies that tool height and makes it active right away
    Yes. Is there an automatic way to determine what Tool is in the Spindle on Startup? Many Users write the Last Tool to a disk file every time a Tool is changed. Then recover the Last Tool on startup or Initialization.

    However you determine the current Tool on startup (by reading the Disk file or asking the Operator) you could set KMotionCNC to that Tool and apply the compensation for that tool with code such as:

    Code:
    #include "KMotionDef.h"
     
    #define TMP 10 // which spare persist to use to transfer data
    #include "KflopToKMotionCNCFunctions.c"
     
    #define LAST_TOOL_VAR 8     //  -1=Spindle empty, 0=unknown, 1-4 Tool Slot loaded into Spindle
     
    main()
    {
        char s[80];
        sprintf(s,"T%dG43H%d",persist.UserData[LAST_TOOL_VAR],persist.UserData[LAST_TOOL_VAR]);
        MDI(s);  //send the T and H words and Turn on Compensation
    }
    TK
    http://dynomotion.com

  3. #3
    Join Date
    Feb 2008
    Posts
    216

    Re: Tool length Offset activated as part of Initialization file

    Quote Originally Posted by TomKerekes View Post
    Of course the Fixture/Global offsets must be set correctly before running a Job. Most Users use the "Save Always" option to keep the same values that were last used. Optionally you can use the Settings file (see Default.set) to force them to zero on KMotionCNC startup if that helps.
    -We have the offsets set to save always also.

    Quote Originally Posted by TomKerekes View Post
    Tool Length Compensation for a tool is enabled in GCode with G43Hn and turned off with G49. The Tool Length/Offset Immediately Option will have Tool Length Compensation turned on for a Tool Selected using the on screen Tool Drop Down Selector. The 1st Tool will be selected on KMotionCNC Start up.
    -This is what i noticed also, I had to use the tool drop down to prompt a tool change and then the corresponding Tool length compensation would apply.

    Are you telling me that the Tool 1 compensation is automatically applied on start up when the "Tool Length/Offset Immediately Option" is active? My Tool 1 is the shortest tool so this could explains why i have crashes. If is by default assumes that T1 is in it at start up this could cause issues when (taking a short cut) and using the cutting tool to set the part zero.

    Quote Originally Posted by TomKerekes View Post
    However you determine the current Tool on startup (by reading the Disk file or asking the Operator) you could set KMotionCNC to that Tool and apply the compensation for that tool with code such as:.....
    Do i add this code to my Initialization file? Am i correct in assuming that once the operator enters the tool in the machine that offset is loaded right then and there? So if i used that tool to zero the part height the correct offset would be applied and then all other tool changes would use their correct tool offset.

    Another issue we found is that the Spindle won't actually turn on when running a G code file for the first time if we haven't performed a tool change either from drop down menu or M6 command. Can this be corrected in the initialization file also? is it because it is waiting for a tool to be selected and by using the above code, the issue should be addressed?

  4. #4
    Join Date
    May 2006
    Posts
    4043

    Re: Tool length Offset activated as part of Initialization file

    Hi slimneil,

    We have the offsets set to save always also.
    It isn't clear why you would want/need to clear these to zero. They would either be set previously and still correct, or if using different stock they would need to be determined again. When setting the offsets the previous values shouldn't have any effect.


    Are you telling me that the Tool 1 compensation is automatically applied on start up when the "Tool Length/Offset Immediately Option" is active?
    Yes, on startup the first Tool in the dropdown list is shown and the compensation for the shown tool is in effect.


    Do i add this code to my Initialization file? Am i correct in assuming that once the operator enters the tool in the machine that offset is loaded right then and there? So if i used that tool to zero the part height the correct offset would be applied and then all other tool changes would use their correct tool offset.
    You didn't explain how your ATC works and if/how the current tool can be determined. If it can't then you might add code in the Initialization file to:

    #1 check if the Last Tool is known or unknown.
    #2 if unknown, ask the Operator
    #3 after the Operator enters the Tool number use the code to set the loaded tool and have the compensation for that tool immediately applied.


    Another issue we found is that the Spindle won't actually turn on when running a G code file for the first time if we haven't performed a tool change either from drop down menu or M6 command. Can this be corrected in the initialization file also? is it because it is waiting for a tool to be selected and by using the above code, the issue should be addressed?
    You haven't told us how your Spindle works or how your ATC works or the code used to control them. But I would guess that you have some protection code to prevent the the Spindle from being turned on while a Tool Change is in progress. That is probably not being initialized properly.
    TK
    http://dynomotion.com

  5. #5
    Join Date
    Feb 2008
    Posts
    216

    Re: Tool length Offset activated as part of Initialization file

    Hi Tom,

    -I think i worked out my issues with the tool height, it all comes back to where the machine is on start up because the Global offset values screw me up when i am working in fixture offsets when i home the machine, they don't automatically clear. Do you have any example code in the C folder of what i can add to my homing C Code to clear the Global offset values once it homes? I've attached my Homing file.

    -I've fixed the issue with the machine not knowing the tool offset until i perform a tool change. I added code to the Initialization file so that it asks what tool is in the spindle.

    -The only item left is the fact that Upon power up the spindle won't turn on until I've done a tool change. Kmotion CNC knows the tool and offset in the spindle but won't turn on until a proper tool change occurs. It's like my initialization file doesn't activate the Spindle axis, i looked but couldn't figure out where i was going wrong in the initilization/ M3 / M6 C code . I've also attached my Tool change and spindle on C code file for your reference.

    Thanks for the help!
    -Dan

  6. #6
    Join Date
    May 2006
    Posts
    4043

    Re: Tool length Offset activated as part of Initialization file

    Hi Dan,

    I think i worked out my issues with the tool height, it all comes back to where the machine is on start up because the Global offset values screw me up when i am working in fixture offsets when i home the machine, they don't automatically clear. Do you have any example code in the C folder of what i can add to my homing C Code to clear the Global offset values once it homes?
    If offsets are screwing up when finding tool height then I would think you would want to clear them when finding tool height not only when homing.

    You could clear the Global Offset by issuing an MDI("G52Z0")



    The only item left is the fact that Upon power up the spindle won't turn on until I've done a tool change. Kmotion CNC knows the tool and offset in the spindle but won't turn on until a proper tool change occurs. It's like my initialization file doesn't activate the Spindle axis, i looked but couldn't figure out where i was going wrong in the initilization/ M3 / M6 C code . I've also attached my Tool change and spindle on C code file for your reference.
    I don't find any attachments.
    TK
    http://dynomotion.com

  7. #7
    Join Date
    Feb 2008
    Posts
    216

    Re: Tool length Offset activated as part of Initialization file

    How do I add that "MDI("G52Z0")" line to my Home C code? I get an error "undefined symbol" when i try to add it at the end.

    Files attached this time...
    Attached Files Attached Files

  8. #8
    Join Date
    May 2006
    Posts
    4043

    Re: Tool length Offset activated as part of Initialization file

    Hi Dan,

    How do I add that "MDI("G52Z0")" line to my Home C code? I get an error "undefined symbol" when i try to add it at the end.
    You must include the MDI and related functions with:

    #define TMP 10 // which spare persist to use to transfer data
    #include "KflopToKMotionCNCFunctions.c"

    like in the other examples


    The only item left is the fact that Upon power up the spindle won't turn on until I've done a tool change. Kmotion CNC knows the tool and offset in the spindle but won't turn on until a proper tool change occurs. It's like my initialization file doesn't activate the Spindle axis, i looked but couldn't figure out where i was going wrong in the initilization/ M3 / M6 C code . I've also attached my Tool change and spindle on C code file for your reference.
    You forgot to include your Initialization C Program.

    Also please include a screen shot of how you have the Actions in KMotionCNC configured for S, M3,M4,M5,M6

    You would need to troubleshoot why the Spindle doesn't run. Your Spindle Jog Program just commands the Axis to Jog Assuming it is enabled. I don't know how your system is built and wired. Is there some sort of interlock? I see the Tool Change manipulates many IO bits such as:

    ClearBit(ToolChangeSafety); //Turns on the Active Toolchange signal
    ClearBit(Schroud_Up); //Clear Schroud Up Signal
    ClearBit(Spindle_CW_On);//Turns off the Spindle On Signal

    Check the states of all your IO before and after the Tool Change to see what is different and makes the difference on the Spindle working or not.

    HTH
    TK
    http://dynomotion.com

  9. #9
    Join Date
    Feb 2008
    Posts
    216

    Re: Tool length Offset activated as part of Initialization file

    Thanks Tom, i'll check these out when I'm back in town.

  10. #10
    Join Date
    Feb 2008
    Posts
    216

    Re: Tool length Offset activated as part of Initialization file

    Hi Tom,

    I figure out why the spindle wouldn’t turn on until after a tool change had occurred. My Spindle On (M3) C Code was looking for persist.UserData[9] which is what the tool change code uses to identify the current tool. Upon initial machine start up that Persist Variable had no designated value so it would get stuck in the M3 command C Code. I’ve added that Persist Variable to the Initialization code where I ask what tool is in the spindle upon start up and now the spindle will start without a tool change being required. Problem Solved


    The other issue I was having with the fixture offsets not working has lead me to another issue I didn’t know I had.

    I’ve added the MDI G52 X0Y0Z0 to my homing code and now the Global Coordinates automatically zero which I think will be helpful.

    I have found that the code I use to probe the Part Zero with a aluminum touch plate (which finds the corner of the part and then Zero’s the DRO’s for X, Y, Z) moves the offset values into the Global offset and not the fixture offsets.

    I use the lines DoPCFloat to clear the DRO. What command should I be using so that when it zero’s the DRO it moves the values into the fixture offset. Because once I use the Part Zero code and the DRO’s are set to Zero the fixture Offset Set button does nothing.

    Current Part Zero Code attached.
    DoPCFloat(PC_COMM_SET_X,0.00);
    DoPCFloat(PC_COMM_SET_Y,0.00);
    DoPCFloat(PC_COMM_SET_Z,0.00);
    Attached Files Attached Files

  11. #11
    Join Date
    May 2006
    Posts
    4043

    Re: Tool length Offset activated as part of Initialization file

    Hi Dan,


    I’ve added the MDI G52 X0Y0Z0 to my homing code and now the Global Coordinates automatically zero which I think will be helpful.
    It's more common to have the Homing Program Zero the KFLOP coordinates (Machine Coordinates) rather than setting an offset.


    I use the lines DoPCFloat to clear the DRO. What command should I be using so that when it zero’s the DRO it moves the values into the fixture offset. .
    See the SetFixtureX.c, SetFixtureY.c, SetFixtureZ.c examples. Its a bit more complicated. The Fixture Offset Tables are saved in special GCode Variables. You must first determine which Fixture is in use in order to know what table entries to change. Then update the appropriate GCode Vars. Finally to update the Fixture offsets in use do:

    DoPC(PC_COMM_UPDATE_FIXTURE);

    Let us know if you understand.


    Because once I use the Part Zero code and the DRO’s are set to Zero the fixture Offset Set button does nothing
    I don't really understand this. But note KMotionCNC is configurable in the Tool Setup to have the Set/Zero buttons either effect the Global Offsets or the Fixture Offsets.
    TK
    http://dynomotion.com

Similar Threads

  1. Tool length offset table in combination with undefined tool
    By extrapilot in forum Mach Software (ArtSoft software)
    Replies: 2
    Last Post: 09-01-2018, 01:33 PM
  2. Tool length offset changed during file
    By ddgman2001 in forum Fadal
    Replies: 0
    Last Post: 07-16-2013, 06:22 PM
  3. Tool Length Offset
    By masterfabr in forum Fadal
    Replies: 22
    Last Post: 09-26-2011, 01:38 AM
  4. part setup Z &tool length offset
    By boilerx in forum HURCO
    Replies: 3
    Last Post: 06-27-2010, 08:59 PM
  5. tool length offset
    By ahmed4040 in forum Fanuc
    Replies: 16
    Last Post: 06-15-2010, 05:49 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
  •