I would use a dictionary to store the axis names and have the lookup 
match the axis numbers assuming your speaking in Python...

axis_name = {0:'X', 1:'Y', 2:'Z', etc.}

The using eval() to pull out the axis names like this in a for loop.

for i in axes:
    print eval('axis.' + axis_name[i] + '.jog-enable')

JT

On 5/15/2016 10:29 AM, andy pugh wrote:
> Currently the update_ini script does the following substitutions:
>
> 'axis.(.).jog-enable':        'joint.\\1.jog-enable',
>
> and so on for other jog pins.
>
> When the substitution list is created the script does know the axis to
> joint mapping, so in cases where it makes sense, the above could
> (almost) be
>
> 'axis.(.).jog-enable':        'joint.\\1.jog-enable =>
> axis."XYZABCUVW"[\\1].jog-enable'
>
> except that obviously won't work for a number of reasons.
>
> I think I could use:
>
> 'axis.0.jog-enable':        'joint.0.jog-enable => axis.%s.jog-enable'
> % coordinates[0]
> 'axis.1.jog-enable':        'joint.1.jog-enable => axis.%s.jog-enable'
> % coordinates[1]
> 'axis.2.jog-enable':        'joint.2.jog-enable => axis.%s.jog-enable'
> % coordinates[2]
> ..
> to create a set of 9 individual regexes with replacements tailored at
> the point when the substation set is created.
> However this is a lot of extra substitutions, basically multiplying
> the 4 jog pin substations into 36. Not that that is necessarily a
> disaster.
>
> However I would quite like to make the whole second part itself variable, 
> i.e.:
>
> if kinstype==IDENTITY:
>      jogsubs = '=> axis.{magic here}.jog-enable'
> else:
>     jogsubs = ''
> ...
> 'axis.1.jog-enable':        'joint.1.jog-enable %s'  % jogsubs
>
> So that the world-mode incremental jog pins only get auto-linked in
> identity kins. But this rather breaks the first idea. (unless I can
> use a syntax like:
>
> 'string %s 1' % ('string %s 2' % coordinates[1]))
>
> But I need to think harder about that
>
> One possible way this could be forced to work is if a regex capture
> can return something other than the captured value.:
>
> axis.(1=X)?(2=Y).jog-enable     axis.\\1\\2.jog-enable
>
> Where my fictional (1=X) syntax returns "X" in \\1 if it finds "1"
>
> Writing this email has actually clarified my thoughts a little. The
> code runs the substations in sequence. I can insert the pin as
> axis.1.jog-enable initially, then substitute all axis.1 with axis.Y in
> a later entry.
>
> But I would still be interested to hear if anyone with more regex-fu
> than me has better ideas.
>
>
>


------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to