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


Results 1 to 2 of 2

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

  1. #1
    Member mial's Avatar
    Join Date
    Jan 2023
    Posts
    2
    Downloads
    0
    Uploads
    0

    Default 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 {;}
    }


    Similar Threads:


  2. #2
    Member mial's Avatar
    Join Date
    Jan 2023
    Posts
    2
    Downloads
    0
    Uploads
    0

    Default 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.



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

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

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