[REMAP FOR M6] Why does linuxcnc run the .ngc file on startup?

More
28 Aug 2021 11:36 - 28 Aug 2021 11:42 #218983 by mugurlu
Hello,

Yes, really Why does linuxcnc run the .ngc file on startup?
(P1.png linuxcnc startup)

What I want to do is to run only when M6 command is given.

My other question is;
Why does it stay in No Tool status? (P3 ... P4.png P5.png)

Can you help with these issues?

Best regards,
mugurlu









Attachments:
Last edit: 28 Aug 2021 11:42 by mugurlu.

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

More
28 Aug 2021 11:47 #218985 by andypugh
Do you by any chance have an M6 in the [RS274NGC]STARTHUP_GCODES in the .ini file?

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

More
28 Aug 2021 11:55 - 28 Aug 2021 12:14 #218986 by Aciera
Not sure why it's running at startup.

But as to why you have a tool offset but no tool loaded:
In line 23 of your 'tool_change.ngc' you are only telling the controller to enable tool length compensation using the tool length offset value of the 'selected_tool' but you never actually tell the controller to change the tool.

Note that you can actually use M6 inside a custom remap:

Have a look at section 5.6 here:
linuxcnc.org/docs/html/remap/remap.html#...lated_codes_t_m6_m61

So maybe changing line 23 to this will do what you want:
T#<_selected_tool> M6 G43
 
Last edit: 28 Aug 2021 12:14 by Aciera.

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

More
28 Aug 2021 12:57 - 28 Aug 2021 13:01 #218995 by mugurlu

Do you by any chance have an M6 in the [RS274NGC]STARTHUP_GCODES in the .ini file?

No, my ini file:

Warning: Spoiler!
Last edit: 28 Aug 2021 13:01 by mugurlu.

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

More
28 Aug 2021 13:02 #218997 by mugurlu

So maybe changing line 23 to this will do what you want:
T#<_selected_tool> M6 G4

caused an endless M6 loop! 

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

More
28 Aug 2021 14:05 - 28 Aug 2021 14:11 #219004 by mugurlu

Why does it stay in No Tool status? (P3 ... P4.png P5.png)


Answer:
linuxcnc.org/docs/html/remap/remap.html#...lated_codes_t_m6_m61 [Step 1]
Section :4. Upgrading an existing configuration for remapping
Create  stdglue.py file.

[Step]
Section 5.3. Specifying the M6 replacement

I edited stdglue.py for two headers as below;
def change_prolog(self, **words):
try:
if self.selected_pocket < 0:
return "M6: no tool prepared"

if self.cutter_comp_side:
return "Cannot change tools with cutter radius compensation on"

self.params["tool_in_spindle"] = self.current_tool
self.params["selected_tool"] = self.selected_tool
self.params["current_pocket"] = self.current_pocket
self.params["selected_pocket"] = self.selected_pocket
return INTERP_OK
except Exception, e:
return "M6/change_prolog: %s" % (e)

def change_epilog(self, **words):
try:
if self.return_value > 0.0:
# commit change
self.selected_pocket = int(self.params["selected_pocket"])
emccanon.CHANGE_TOOL(self.selected_pocket)
# cause a sync()
self.tool_change_flag = True
self.set_tool_parameters()
return INTERP_OK
else:
return "M6 aborted (return code %.1f)" % (self.return_value)

except Exception, e:
return "M6/change_epilog: %s" % (e)

everything is fine so far

However,

I can't find the answer to the question in the title.


What should I do to prevent tool change every time the machine is turned on? (M6 why are you working?)

Best regards,
mugurlu
Last edit: 28 Aug 2021 14:11 by mugurlu.

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

More
28 Aug 2021 14:17 - 28 Aug 2021 14:28 #219006 by bevins
You have to test for milltask mode in ypur remap and return if it is not so it doesnt run the remap and move the machine. When Lcnc loads a file it is in preview mode. Thats the best way I can explain it. Maybe someone can chime in.
if self.task==0: 
    return INTERP_OK
Last edit: 28 Aug 2021 14:28 by bevins.

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

More
28 Aug 2021 14:41 #219007 by mugurlu
Hi,
but i use to .ngc file...
REMAP=M6   modalgroup=6  prolog=change_prolog ngc=tool_change epilog=change_epilog
Where should I add the part you mentioned?
if self.task==0: 
    return INTERP_OK

 

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

More
28 Aug 2021 14:54 - 28 Aug 2021 14:55 #219009 by bevins
/Edit   Sorry I didnt see that. Your remap line up farther didnt show it.
Last edit: 28 Aug 2021 14:55 by bevins.

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

More
28 Aug 2021 14:55 - 28 Aug 2021 15:41 #219010 by Aciera
Unrelated:  Note that the FEATURES tag in the [RS274NGC] Section does no longer work in Version 2.8 and up.
linuxcnc.org/docs/html/config/ini-config...l#gcode:ini-features
Last edit: 28 Aug 2021 15:41 by Aciera.

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

Time to create page: 0.170 seconds
Powered by Kunena Forum