loop with several parts and conditions

More
6 years 3 months ago #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!

Please Log in to join the conversation.

More
6 years 3 months ago #175172 by tommylight
Not here. Here is what i get:
Part a 2
Part b 0

Attachment not found


Part A 0
Part b 2

Attachment not found


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.

Please Log in to join the conversation.

More
6 years 3 months ago #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] '

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

Please Log in to join the conversation.

More
6 years 3 months ago #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....

Please Log in to join the conversation.

More
6 years 3 months ago #175354 by tommylight
Here it is with 2+2

Attachment not found


And the new one you just uploaded.

Attachment not found

Please Log in to join the conversation.

More
6 years 3 months ago #175356 by MaHa
Warning: Spoiler!

Please Log in to join the conversation.

Time to create page: 0.095 seconds
Powered by Kunena Forum