multiple test sub return value

More
23 May 2017 12:11 #93522 by albova
hi,
I would test the return value of a sub return so that if it is 1 the program stops. The problem is that in the main gcode I can not use the if condition as it needs before a number (eg o345 if ....) and the postprocessor can not increment the number each time the sub is run. I'll explain.

main program
.....
.....
123 or <name> call
124 o345 if [<_value> GT 0]
        M30
125 o345 endif
......
......

501 or <name> call
502 o345 if [<_value> GT 0]
        M30
503 o345 endif
....
....
The problem is that o345 if, in the second case generates an error. It should be increased by the postprocessor (Vcarve) but it does not.
Is there a solution?
M2 or M30 in the sub is causing me serious problems.

regards
Ale

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

More
23 May 2017 12:39 #93530 by andypugh
It feels like the M30 belongs in the subroutine. What problems do you get with that?

A post-postprocessor could probably fix the IF statements, but that might be a lot of trouble.

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

More
23 May 2017 14:37 #93548 by albova
At the beginning I had put M30 in the sub but in the sub there is a g38.1 and, by interrupting the sub with M30, the next time it restarts the sub, G38.1 or rather it locks as soon as the probe reads.
Any idea?

regards
Ale

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

More
25 May 2017 11:57 #93610 by andypugh
The interpreter won't even see the M30 until the G38.1 has completed, so I am a bit puzzled what problem you are describing.
Maybe there is a parameter used by the subroutine that needs to be re-set before the M30?

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

More
25 May 2017 19:20 #93631 by albova
If the tool is ok, the program works regularly.
If the tool is not ok this happens:
At the first ctrlut call the tool goes to the touch probe, the error is detected and the message appears (see attached file ctrlut.ngc). The tool changes and resets on the touch probe. With an MDI command, you run the sub "primadiripartiredalinea" and then start the program with "run from here" by selecting the line where it stopped. At the next ctrlut call, the sub ctrlut stops immediately after g38.2, the z axis stops exactly on the probe reading and the program goes out. See attached files.
Linuxcnc version 2.7.3 (Maybe a bug?)

File Attachment:

File Name: Profilo1.ngc
File Size:1 KB

File Attachment:

File Name: primadirip...inea.ngc
File Size:0 KB

File Attachment:

File Name: ctrlut.ngc
File Size:1 KB
Attachments:

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

More
26 May 2017 13:37 #93659 by andypugh
run-from-line has a number of unfortunate limitations. I think that might be part of the problem.

Does the G38.2 exit with "probe already triggered" error?

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

More
26 May 2017 15:06 #93662 by albova
yes, at the trigger touchprobe, no message and the program stops.

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

More
26 May 2017 15:20 #93663 by andypugh
Does it stop/exit or stop/stall?

I wonder if feed-override or feed-per-rev is active?

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

More
27 May 2017 07:53 #93695 by albova
Sorry, I replied badly.
When the probe reads, the program goes out as if it was finished (eg M30) and no error message appears. In fact, the position is correct, with a deviation of 0.02 mm. The tool remains supported on the probe and all manual and MDI controls are enabled. It seems he can not finish the G38.2 command and exit. If, however, I start the program from the beginning, it will be fine until the second tool check is when I have to resume with the command "run from here". No use to program feed-override or feed-per-rev, obviously by default already has a G94. I would have thought of another solution. If the tool is not ok, I could do a python program where to insert the line from which it should start and cut off everything that is before (other than the headers). It seems that by resuming the program from the start and not from a point, the problem does not persist.

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

Time to create page: 0.124 seconds
Powered by Kunena Forum