loop with several parts and conditions

More
19 Jul 2020 17:39 #175169 by christian99x
Please take a look at the attached program. The intention is, that you can configure how many pieces of part_a and part_b you want to mill (up to total 9).
Unfortunately if count_part_b is 0, part_b is milled though. In this case I would actually expect elseif in line #53 not to be true and the operations below being skipped, but that's not the case.
Can somebody explain why?! Thanks!
Attachments:

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

More
19 Jul 2020 17:56 #175172 by tommylight
Not here. Here is what i get:
Part a 2
Part b 0

Part A 0
Part b 2

You should also add
G92.1
M2
at the end of the file, as LinuxCNC complains with no M2 or % sign, and the G92 offsets remain active, so the next batch of parts will be milled at the top right of the green dotted line.
Attachments:

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

More
19 Jul 2020 19:49 #175190 by MaHa
The while loop is cycling trough, until #<position> reached 9. To avoid that, after countdown a+b reached 0, insert this after the position counter. ' #<position> = [#<position> + 1] '

    o115 if [[#<count_part_a> EQ 0] and [#<count_part_b> EQ 0]]
    o100 break
    o115 endif

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

More
21 Jul 2020 16:59 #175352 by christian99x
Thanks for your feedback!

In the meantime I found the (a) solution by myself: if I create a new "if" instead of using "elseif" it's working like expected. Still I don't understand why "elseif" is not working. I thought "elseif" and a new "if" has the same effect?!

@tommylight:
Try it with 2 part a and 2 part b! ...and yes, I know that M2 etc is still missing. I wanted to get the loop working first and camotics (which I use for visualising the gcode) is not complaining about it ;-) !

@MaHa
Did you try it with a mixture of parts? I don't think it helps....
Attachments:

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

More
21 Jul 2020 17:47 #175354 by tommylight
Here it is with 2+2

And the new one you just uploaded.
Attachments:

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

More
21 Jul 2020 18:18 - 22 Jul 2020 16:47 #175356 by MaHa
Warning: Spoiler!
Last edit: 22 Jul 2020 16:47 by MaHa.

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

Time to create page: 0.128 seconds
Powered by Kunena Forum