On bone-stock AXIS / EMC2 2.3.1... I'm polishing a G-Code program for my next Digital Machinist column and, of course, managed to improve the code to the point where it doesn't quite work.
Upon loading the program, an error popup appears... Near line 262 of Trench.ngc: Named parameter not defined It'd be really helpful if the message gave a hint as to *which* parameter wasn't defined, but usually my finger fumbles are fairly obvious. Alas, this one is more subtle. Line 262 is blank, so the offending line is probably 261, a WHILE statement closing a loop. All the named parameters therein are, in fact, properly defined, which I've verified by having the editor search and find them elsewhere in the rest of the file. Line 263 has a single parameter that's also defined. What's peculiar is that the entire section of code lies within an IF statement testing a condition that's guaranteed to be false. The skeleton looks like this: #<_DoTrenchBall> = 0 <--- this is at the top of the program O874 IF [#<_DoTrenchBall>] O530 DO #<CurrentZ> = [#<CurrentZ> - #<_BallStepZ>] O530 WHILE [#<CurrentZ> GE [#<_TrenchCtrZ> -#<TrenchRadius>]] O874 ENDIF There are two similar sections of code preceding this one, for coarse and fine milling. The fine milling section is also turned off, so the program only does ball milling. If I set #<_DoTrenchBall> equal to 1 to enable the section and reload the program, then there's no error message. Whatever parameter the interpreter is looking for is now defined inside the enabled code. If I set #<_DoTrenchBall> to 0 again to disable the section and reload the program, there's *now* no error message, even though the ball milling section is properly disabled. Evidently, the interpreter remembers all the parameters ever defined since it started, which is pretty much how I expected it to work. It seems as though the "Is this parameter defined?" question gets asked for statements within blocks that aren't actually executed. Obviously, the interpreter must parse each statement as it goes along, but it's getting tripped up in the conditional. So I tweaked the loop to store the test condition in a throwaway variable and restarted AXIS: O530 DO #<CurrentZ> = [#<CurrentZ> - #<_BallStepZ>] #999 = [#<CurrentZ> GE [#<_TrenchCtrZ> - #<TrenchRadius>]] O530 WHILE [#999] (until tangent point is at bottom of trench) That does *not* generate the error with the section disabled: it works properly. Using a named parameter as the throwaway *does* generate the error, after restarting AXIS: O530 DO #<CurrentZ> = [#<CurrentZ> - #<_BallStepZ>] #<test> = [#<CurrentZ> GE [#<_TrenchCtrZ> - #<TrenchRadius>]] O530 WHILE [#<test>] So there's a difference between named parameters and numbered parameters in a WHILE conditional. A very similar loop in the fine milling section does *not* generate the error, even though fine milling is just as disabled as ball milling: #<_DoTrenchFine> = 0 <--- this is at the top of the program O872 IF [#<_DoTrenchFine>] O520 DO O4100 CALL [#<_TrenchCtrZ> - #<CurrentZ>] [#<_SeatBarRadius> - #<_FineAllowX>] [992] O520 WHILE [#992 GE [#<_FineDia> / 2]] O872 ENDIF The O4100 subroutine sets parameter #992 using the ##x indexed notation. Dunno what to make of all this, but I think there's a bug in there somewhere. On the other paw, if this turns out to be something I've misunderstood, well, it sure won't be the first time... <grin> The entire offending program is at: http://pastebin.ca/1454620 Thanks... -- Ed ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users