Fanuc-Style Toolchange

More
11 Apr 2015 11:02 #57674 by gmills46
Fanuc-Style Toolchange was created by gmills46
Hi Rick
Thank you for your help.
I assume that I need to to more than what I just tried. I copied the attached file toolchange.ngc to my nc_files directory and added the line
REMAP = T prolog=get_T_number ngc=toolchange
to my [RS274NGC] section of the ini file
I also added tools 10001 - 10008 to my tool offset data in linuxcnc.
I get the message " pycall(remap.get_T_number) failed " when I enter t0101 in mdi.
I am sure that I need to do more than what I have done. I'm pretty new to setting up Linuxcnc, do I need to add some python code somewhare?
I have never done anything with that type of code and I am sure that I need a complete walk through with the process.
I would also like to add ngc files and the remaps that have G code "GO A0" when I call tool 1 and " G0 A 45." when I call tool 2 ect, up to tool 8?
Attachments:

Please Log in or Create an account to join the conversation.

More
11 Apr 2015 16:08 #57679 by andypugh
Replied by andypugh on topic Fanuc-Style Toolchange


REMAP = T prolog=get_T_number ngc=toolchange

I get the message " pycall(remap.get_T_number) failed " when I enter t0101 in mdi.


The REMAP line says that the "T" word should now run a python routine called "get_T_number" before running the ngc subroutine.

The get_T_number routine is inside the remap.py file, and that file is linked into LinuxCNC by toplevel.py

You need to add both these files to your config folder. You will find them in the sim configs folder, or you can get them from the git links (right-click the file-name at the end of the path near the top and select save-as)

Please Log in or Create an account to join the conversation.

More
25 Aug 2024 15:06 #308604 by Jakemestre1
Replied by Jakemestre1 on topic Fanuc-Style Toolchange
Hi Andy,
I'm also having trouble setting up this T toolchange. I've got remap.py and toplevel.py in my config folder but when I run gmocappy I get an error file not open. I've remapped M6 as well and I'm wondering if they're conflicting with each other.  Any ideas to troubleshoot?   Thanks for all your help on everything known to linuxcnc.
Attachments:

Please Log in or Create an account to join the conversation.

More
21 Sep 2024 16:43 #310557 by Jakemestre1
Replied by Jakemestre1 on topic Fanuc-Style Toolchange
Hello All,
I've been struggling with using T for toolchange for a while now and I need a little help.  I've got a turret that is written as an A axis and I remapped m6 to get the correct tool in position. I've attached that toolchange.ngc  It's cludgy but it works.  If I try to remap T with the "index_lathe_tool_with_wear" from standardglue the T only causes a virtual toolchange but it won't call the M6 and physically change the tool.  Here's my ini snippet for RS274NGC
RS274NGC]
SUBROUTINE_PATH = ./macros/,./:../
PARAMETER_FILE = linuxcnc.var
RS274NGC_STARTUP_CODE = G7 G18 G20 G90 G94 G0 S500 F60
REMAP=T  python=index_lathe_tool_with_wear ngc=Ttotool
REMAP= M6 modalgroup=6 prolog=change_prolog ngc=toolchange epilog=change_epilog
Do I need to write a python script that translates my current ngc toolchange into the standardglue? 
What am I missing here?  Thanks in advance!



 
Attachments:

Please Log in or Create an account to join the conversation.

More
21 Sep 2024 17:07 - 21 Sep 2024 17:20 #310559 by Aciera
Replied by Aciera on topic Fanuc-Style Toolchange
This might not be the reason for your issue but this seems wrong:
REMAP=T python=index_lathe_tool_with_wear ngc=Ttotool


Did you maybe mean something like this instead:
REMAP=T python=index_lathe_tool_with_wear

[edit]
If you start your config from a terminal ($ linuxcnc) are you getting any error messages when calling your remap?
Last edit: 21 Sep 2024 17:20 by Aciera.

Please Log in or Create an account to join the conversation.

More
21 Sep 2024 17:42 - 21 Sep 2024 18:06 #310561 by Jakemestre1
Replied by Jakemestre1 on topic Fanuc-Style Toolchange
You're correct you can't call a python and ngc on the same remap line, that was my mistake
in the stdglue.py I was thinking that maybe I could change the line ~481 in the index_lathe_tool_with_wear section from: mccanon.CHANGE_TOOL(self.selected_pocket)
to: self.execute("M6 T%d"% (tool))
Where do I find documentation on the syntax of that python line? Also is this even a good idea to change the stdglue or should I be writing my own python script?
Last edit: 21 Sep 2024 18:06 by Jakemestre1.

Please Log in or Create an account to join the conversation.

More
21 Sep 2024 18:05 #310563 by Aciera
Replied by Aciera on topic Fanuc-Style Toolchange
seems odd that 'emccanon.CHANGE_TOOL()' should not work but sure try
self.execute("M6 T%d"% tool)

Please Log in or Create an account to join the conversation.

More
21 Sep 2024 18:16 #310564 by Jakemestre1
Replied by Jakemestre1 on topic Fanuc-Style Toolchange
No dice, all I get is an error code"T change aborted (return code 0.0)" It seems like the emccannon.change_tool is skipping over my remapped m6.
What would be an efficient way to find out why it's not executing the M6 in stdglue?
also I edited my last post just after you posted Aciera:
Where do I find documentation on the syntax of that python line? Also is this even a good idea to change the stdglue or should I be writing my own python script?

Please Log in or Create an account to join the conversation.

More
21 Sep 2024 21:25 - 21 Sep 2024 21:38 #310573 by Aciera
Replied by Aciera on topic Fanuc-Style Toolchange
I feel we should try to glean some more information about why it fails in the first place.
Not sure if this will work as I cannot test on this machine but in the 'index_lathe_tool_with_wear' function replace:

except:
self.set_errormsg("T change aborted (return code %.1f)" % (self.return_value))
yield INTERP_ERROR

with this:


except Exception as error:
self.set_errormsg('T change error: ', error)
self.set_errormsg('T change self.selected_pocket = ', self.selected_pocket)
yield INTERP_ERROR

Then run again from the terminal and check the output for the above error message, which will hopefully relay the actual error.
Last edit: 21 Sep 2024 21:38 by Aciera. Reason: fix script

Please Log in or Create an account to join the conversation.

More
22 Sep 2024 02:25 #310582 by Jakemestre1
Replied by Jakemestre1 on topic Fanuc-Style Toolchange
emc/task/emctask.cc 68: interp_error: remap_finished: got -6 - not in cblock.remappings!
remap_finished: got -6 - not in cblock.remappings!
/home/jake/linuxcnc/configs/Lathatron2-9/Lathatron2-9.ini:66: executing 'import sys
sys.path.insert(0,"/home/jake/linuxcnc/python")'
/home/jake/linuxcnc/configs/Lathatron2-9/Lathatron2-9.ini:68: executing 'import sys
sys.path.append("/home/jake/linuxcnc/python")'

Please Log in or Create an account to join the conversation.

Time to create page: 0.070 seconds
Powered by Kunena Forum