loop cycle?

Post anything you want to discuss with others about the software.

loop cycle?

Postby Raider192 » Tue Jun 06, 2017 8:45 pm

How do I run a loop in a program? Is it in the realm of WHILE and END WHILE? If so, what is the correct format?
Thanks for your help?
Raider192
 
Posts: 13
Joined: Wed May 31, 2017 8:35 pm

Re: loop cycle?

Postby dezsoe » Tue Jun 06, 2017 8:54 pm

What do you mean by program? Is it g-code or macro? Do you need conditional cycle?
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: loop cycle?

Postby cncdrive » Tue Jun 06, 2017 9:38 pm

The syntax is C#, it is a C based language with some more object orientation than Ansi C.
C# does not use the END word at all, the END statement is used by Basic and Pascal language for example.

A while statement in C# can look like:

while(condition test)
{
//Do something
}

do
{
//Do something
}
while(condition test);

With the first one the condition is tested at the beginning, so if the condition check is false then the cycle does not run at all,
and the second type tests the condition at the end, so with this one the cycle runs at least once even if the condition was false from the beginning.

For the syntax of different things in C# I advice you to read after the C# language. It is one of the worlds' most popular programming languages today, so you can find lots of informations about it online.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: loop cycle?

Postby cncdrive » Tue Jun 06, 2017 9:44 pm

I was talking about macros and plugins in my previous post.
If you want to add loops in your g-code file then you may use subroutines M98/M99,
or you may call macros which running the loops inside the macro code.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm


Return to General discussion about the UCCNC software

Who is online

Users browsing this forum: Bing [Bot] and 8 guests