Page 1 of 1

Codelist sub routines :-(

PostPosted: Sun Jun 04, 2023 9:35 pm
by Battwell
I have a fully working program using vars and a sub routine that runs fine.

When I run it in a macro with codelist ( exactly same program) but vars are given in the macro
It only moves on 1 axis .
It’s a simple spiral down move using g3 and j

I have put status messages in to confirm the vars are set the same as originals I used .

https://youtu.be/OgP-XrV4Cwk
This is what it should do

Is there any limitations with codelist ?

Re: Codelist sub routines :-(

PostPosted: Mon Jun 05, 2023 9:13 am
by Battwell
ok... seems codelist doesnt like the subroutine.

gives error m99 could not read if i rem out the m30 as below.

:-(

back to the drawing board for how im going to get this job done

List<string> codelist = new List<string>();
codelist.Add("G91");
codelist.Add("g91 g1 x0 y#22 f300"); //moveout
codelist.Add("g90 g0 z#23"); // work height
codelist.Add(" M98 P001 L5"); //call sub 5 times
codelist.Add("g91 g1 y#21 f#24"); //movein
codelist.Add("g90 g0 z#18"); // rapid height
//codelist.Add(" m30");

codelist.Add("O001");
codelist.Add("G91");
codelist.Add("g91 g3 j#21 z#25 f#24");
codelist.Add("M99");


exec.Codelist(codelist); //Execute the List of g-codes.

Re: Codelist sub routines :-(

PostPosted: Mon Jun 05, 2023 11:17 pm
by cncdrive
Yes, i think this is a limitation we did not even think about.
And it happens because the subroutine must be at the end of the main g code program and the end of the program is defined with m30 or m47.
The same is with the codelist, the software looks for subroutines only after the main program end.

Re: Codelist sub routines :-(

PostPosted: Tue Jun 06, 2023 9:59 am
by Battwell
i dont find many limitations with uccnc. this would probably be the same on most "top end" controls.

this one was annoying as it took me ages to remember how to write a subroutine. :-)
once i had it working as code i thought it was going to be simple to just edit it into codelist.

i know its not a big thing as 99.99% of people wouldn't have ever attempted it .

its for the one button parametric machine that all runs from 1 macro.
i will think of another way :-)

Re: Codelist sub routines :-(

PostPosted: Tue Jun 06, 2023 5:52 pm
by Vmax549
HIYA Batwell. The problem with codelist and subs has been around as long as codelist has existed. I am probably the reason CodeList exists today

IF I were you I would create a Conditional Wizard to generate the needed Gcode program with the needed sub routine then simply run the code. It could easily be a one button process.

Just a thought, (;-) TP

Re: Codelist sub routines :-(

PostPosted: Tue Jun 06, 2023 10:39 pm
by Battwell
i got around it. for the spiral down i used a for i loop. no whileismoving{} after each line and it works ok ...on screen!

its been a fun thing to write. lots of for loops!
quick video below
will test on real machine tomorrow.

the screen will be very basic once finished. no dros etc. just 1 length box and a go button. the config screen will be on another tab- but hidden from idiots!

https://youtu.be/M8T4xY0tQFY