Exemplo n.º 1
0
        def transf_interpret(cmd, smb, turtle):
            ls = lpy.Lstring(cmd)
            #print 'interpret', ls, cmd

            turtle.push()
            sc = lpy.turtle_partial_interpretation(ls, turtle)
            turtle.customGeometry(smb)
            turtle.pop()
Exemplo n.º 2
0
 def check_push_pop(lstring, res):
     global __push_string, __pop_string, __string_stack
     if not __push_string is None:
         __string_stack[__push_string] = lpy.Lstring(lstring)
         __push_string = None
     if not __pop_string is None:
         oldlstring = __string_stack[__pop_string]
         del __string_stack[__pop_string]
         __pop_string = None
         return oldlstring
     return res
Exemplo n.º 3
0
 def wrapped(lstring, *args):
     global __string_discarded, __last_string
     if __string_discarded:
         __string_discarded = False
         return __last_string
     res = endeach(lstring, *args)
     if __string_discarded:
         __string_discarded = False
         return __last_string
     __last_string = lpy.Lstring(lstring)
     return res
Exemplo n.º 4
0
 def get_lstring(self):
     if self.__derivationStep < len(self.__trees):
         return lpy.Lstring(self.__trees[self.__derivationStep])
     return lpy.Lstring()
Exemplo n.º 5
0
def test():
    import openalea.lpy as lpy
    l = lpy.Lstring('FF(3)[+F][-(80)F]F')
    export_to_json(l, 'test.json')
Exemplo n.º 6
0
def __check_discard_string(lstring):
    global __string_discarded, __last_string
    if __string_discarded:
        __string_discarded = False
        return __laststring
    __last_string = lpy.Lstring(lstring)
Exemplo n.º 7
0
 def smb_interpret(cmd, turtle):
     ls = lpy.Lstring(cmd)
     lpy.turtle_interpretation(ls, turtle)