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

More
28 Aug 2021 15:05 #219011 by bevins

Hi,
but i use to .ngc file...
REMAP=M6 modalgroup=6 prolog=change_prolog ngc=tool_change epilog=change_epilogWhere should I add the part you mentioned?

[code]if self.task==0: 
    return INTERP_OK

 
[/code]

The way to address this issue is to test in your procedure whether it executes in preview or execution mode. This can be checked for by testing the 
#<_task>
  predefined named parameter  - it will be 1 during actual execution and 0 during preview. See configs/sim/axis/remap/manual-toolchange-with-tool-length-switch/nc_subroutines/manual_change.ngc for a complete usage example.Within Embedded Python, the task instance can be checked for by testing self.task - this will be 1 in the milltask instance, and 0 in the preview instance(s).

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

More
28 Aug 2021 15:16 - 28 Aug 2021 15:18 #219012 by bevins
if [[#<_task> GT 0]

This should be true if it is in milltask. Maybe check if it is less than 1 (preview mode), then exit. I think thats how its done in ngc remap.
Something like that. Not 100% sure as I have not done an NGC remap, I only have done python remaps.
Last edit: 28 Aug 2021 15:18 by bevins.
The following user(s) said Thank You: Aciera, mugurlu

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

More
28 Aug 2021 15:18 - 28 Aug 2021 15:37 #219013 by Aciera
Ok, I can confirm on a simulation config that the code in a M6 ngc remap is executed at start up.


[edit] Just learned something. Thanks bevins.

o<tool_change > sub

o100 if [#<_task> GT 0]
         ; code here
o100 endif

o<tool_change> endsub
m2
Last edit: 28 Aug 2021 15:37 by Aciera.
The following user(s) said Thank You: bevins, ehb

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

More
28 Aug 2021 15:33 #219014 by mugurlu
this is how it works, we now prevent it from running directly on boot
thank you  bevins  
o<tool_change> sub

O300 if [#<_task> EQ 0]

O300 else

    (print, rack_change: loaded tool=#<_current_tool> current pocket: #<_current_pocket>)
    (print, rack_change: selected tool=#<_selected_tool> selected pocket: #<_selected_pocket>)


    M68 E0 Q#<_selected_tool> ;Set target tool number
    M64 P0 ;Enable tool changer
    
    G4 P0.5
    
    M66 P0 L3 Q10; wait for carousel-locked = false
        o202 if [#5399 EQ 0]
            M65 P0 ;Disable tool changer
            (abort, carousel still locked hello)
        o202 endif    
    
    M65 P0 ;Disable tool changer
    
    G43 H#<_selected_tool>
    
    (print,mcode end)
O300 endif

o<tool_change> endsub [1]
M2
The following user(s) said Thank You: bevins

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

More
28 Aug 2021 16:39 #219020 by bevins
I really need to challenge my fear of an ngc remap and just do one....

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

Time to create page: 0.152 seconds
Powered by Kunena Forum