Exemplo n.º 1
0
def getSelectedZones2():
    import CPlot
    nzs = CPlot.getSelectedZones()
    if nzs == []: return None
    if len(nzs) == len(Internal.getZones(CTK.t)):
        bases = Internal.getBases(CTK.t)
        ret = ['zonesPath = []']
        for b in bases:
            path = Internal.getPath(b)
            ret.append('zonesPath.append(%s)' % path)
        return ret
    nobu = -1
    for nz in nzs:
        nob = CTK.Nb[nz] + 1
        if nobu == -1: nobu = nob
        elif nobu != nob:
            nobu = -2
            break
    if nobu > 0:
        path = Internal.getPath(t[2][nobu])
        return ['zonesPath = [%s]' % path]

    ret = ['zonesPath = []']
    for nz in nzs:
        nob = CTK.Nb[nz] + 1
        noz = CTK.Nz[nz]
        path = Internal.getPath(CTK.t, CTK.t[2][nob][2][noz])
        ret.append('zonesPath.append(%s)' % (path))
    return ret
Exemplo n.º 2
0
def getSelectedZones():
    import CPlot
    nzs = CPlot.getSelectedZones()
    if nzs == []: return None
    if len(nzs) == len(Internal.getZones(CTK.t)):
        return ['zones = Internal.getZones(t)']
    nobu = -1
    for nz in nzs:
        nob = CTK.Nb[nz] + 1
        if nobu == -1: nobu = nob
        elif nobu != nob:
            nobu = -2
            break

    if nobu > 0:
        base = Internal.getBases(CTK.t)[nobu - 1]
        if len(nzs) == len(Internal.getZones(base)):
            return [
                'base = Internal.getBases(t)[%d]' % (nobu - 1),
                'zones = Internal.getZones(base)'
            ]
    ret = ['zones = []']
    for nz in nzs:
        nob = CTK.Nb[nz] + 1
        noz = CTK.Nz[nz]
        ret.append('zones.append(t[2][%d][2][%d])' % (nob, noz))
    return ret
# - getSelectedZones (array) -
import Generator as G
import CPlot
import time

a1 = G.cart( (0,0,0), (1,1,1), (5,5,5) )
a2 = G.cart( (7,0,0), (1,1,1), (3,3,3) )
CPlot.display([a1, a2])

ret = []
while ret == []:
    ret = CPlot.getSelectedZones(); time.sleep(2.)
print('Zones have been selected: ', ret)
# - getSelectedZones (array) -
import Generator as G
import CPlot
import time

a1 = G.cart((0, 0, 0), (1, 1, 1), (5, 5, 5))
a2 = G.cart((7, 0, 0), (1, 1, 1), (3, 3, 3))
CPlot.display([a1, a2])

ret = []
while (ret == []):
    ret = CPlot.getSelectedZones()
    time.sleep(2.)
print 'Zones have been selected: ', ret
Exemplo n.º 5
0
def getSelectedZones():
    """Return the selected zones in plotter.
    Usage: list=getSelectedZones()"""
    return CPlot.getSelectedZones()