I've made the set of predefined named parameters user-extensible. This can now access arbitrary combinations of interpreter state and make it a predicate which can be used like so:
o100 if [#<_my_predicate>] .... o100 endif When I wrote the predefined named parameters code, I just made up a list of 'potentially useful' parameters. Since usefulness varies according to context, I generalized it you can add your own, no C++ required. The basic trick is: if a function is defined in the namedparams Python module, a predefined named parameter of same name appears automatically in the RS274NGC namespace; if the named parameter is referred to in an expression, the underlying Python function is evaluated. So for the above example, one needs: def _my_predicate(self): ... arbitrary Python code perusing interpreter intestines .. return <somevalue> # which can be refereed to as #<_my_predicate> in expressions It's documented here: http://www.linuxcnc.org/docs/devel/html/remap/structure.html#_adding_predefined_named_parameters_a_id_sec_adding_predefined_named_parameters_a and it's in master as of today. - Michael Am 23.03.2012 um 08:53 schrieb Michael Haberler: > > Am 22.03.2012 um 10:09 schrieb Erik Christiansen: > >> It is my (limited) >> understanding that LinuxCNC cannot intrinsically test the current state >> of its many modalities, so we don't seem to have anything that can be >> checked, AIUI. > > ... >> >> But LinuxCNC doesn't know its current state in an exportable way, so has >> nothing to put on a stack, AIUI. > > > As for introspection on state at the gcode level, see > http://www.linuxcnc.org/docs/devel/html/gcode/overview.html#_predefined_named_parameters_a_id_sec_predefined_named_parameters_a > . > > If that doesnt suffice, go to the embedded Python level which has practically > all of the interpreter state exposed, and then some (task). > > See tests/remap/introspect/oword.py for state access. > > Exporting state from Python is left as an exercise for the reader;) > > > -m > ------------------------------------------------------------------------------ > This SF email is sponsosred by: > Try Windows Azure free for 90 days Click Here > http://p.sf.net/sfu/sfd2d-msazure > _______________________________________________ > Emc-users mailing list > Emc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-users ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users