584,802 active members*
4,926 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Dynomotion/Kflop/Kanalog > Problem, tool length from the table is not used when executing G-code
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Jan 2023
    Posts
    2

    Problem, tool length from the table is not used when executing G-code

    Hello Tom.
    I have such a problem. When executing an G code, any M6 command of the T slot number does not apply the tool lenght specified in the tool table. Remains the length used before running the G-code. Amount when manually selected everything works fine. It also doesn't work when collecting code transfer via MDI. The variable in the converted M6 code is designated as 9, stream 4. Code With inclusion.
    Code:
    #include "KMotionDef.h"
    #define TMP 10
    #include "KflopToKMotionCNCFunctions.c"
    #define X_axis 		0
    #define Z_axis 		2
    #define X_SENSOR (268.828 * 800)
    #define SPINDLE_ON_OFF 	29
    #define EMERGENCE	23
    #define Z_Parking (-4 * 1000)
    #define VALVE		33
    
    
    
    main()
    {
    	int Answer, Units, TWORD, HWORD, DWORD, oldTool;
    	double Length, ToolDiameter;
    	char str[80];
    
    	SetBitDirection(SPINDLE_ON_OFF, 1);
    	SetBitDirection(VALVE, 1);
    	SetBitDirection(EMERGENCE, 0);
    	
    	if (ch0->Enable &&  ch1->Enable  && ch2->Enable  && ReadBit(EMERGENCE))
    	{
    		ClearBit(SPINDLE_ON_OFF);
    		FPGA(IO_PWMS+1) = 1;    // enable the PWM
    		FPGA(IO_PWMS)   = 0; 	// set the PWM off
    		printf("Spindle OFF \n");
    	
    		oldTool = persist.UserData[8];
    		printf("Old Tool %d\n", oldTool);
    		int slot = persist.UserData[9];  // value stored is an int 
    		int id = persist.UserData[9+1];  // value stored is an int
    	
    		GetMiscSettings(&Units, &TWORD, &HWORD, &DWORD);
    		printf("Units=%d T=%d  H=%d  D=%d\n",Units, TWORD, HWORD, DWORD);
    
    		
    		if (oldTool != slot)
    		{
    			MoveAtVel(Z_axis, Z_Parking, 100000);
    			while (ch2->Dest != Z_Parking);
    			MoveAtVel(X_axis, X_SENSOR, 100000);
    			while (ch0->Dest != X_SENSOR);
    			SetBit(VALVE);	
    			GetToolDiameter(TWORD,&ToolDiameter);
    			GetToolLength(TWORD, &Length);
    			printf ("Tool Length L = %3.4f\n", Length);
    	
    			sprintf(str, "?????????????n   T%d ??????2g ?n", slot, ToolDiameter);
    			Answer = MsgBox(str, MB_YESNO|MB_ICONEXCLAMATION);
    			if (Answer == IDNO)
    			{
    				Answer = MsgBox("?????????????",MB_OK|MB_ICONEXCLAMATION);
    				DoPC(PC_COMM_HALT);
    				return;
    			}
    	
    			else {;}
    
    
    
    
    		printf("Tool Set to slot %d id %d \n",slot, id);  // print the slot and id
    		printf("Answer %d\n", Answer);
    		oldTool = slot;
    		persist.UserData[8] = oldTool;
    		Delay_sec(0.3);
    								
    
    	}
    		else {;}
    	}
    	else {;}
    }

  2. #2
    Join Date
    Jan 2023
    Posts
    2

    Re: Problem, tool length from the table is not used when executing G-code

    Thanks to the forum, I figured it out. My just had to use the G43 instruction with the tool index. Corrected the postprocessor, now everything is fine.

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. Replies: 6
    Last Post: 06-27-2015, 10:04 PM
  3. Tool length setting from C code
    By RichChant in forum Dynomotion/Kflop/Kanalog
    Replies: 1
    Last Post: 02-06-2015, 09:50 PM
  4. Replies: 7
    Last Post: 01-23-2013, 05:46 PM
  5. Table length cutting problem?
    By Blacksunshine in forum WoodWorking Topics
    Replies: 4
    Last Post: 03-14-2008, 02:00 AM

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
  •