def modifyPoint(event=None): if CTK.t == []: return nzs = CPlot.getSelectedZones() if nzs == []: CTK.TXT.insert('START', 'Selection is empty.\n') CTK.TXT.insert('START', 'Error: ', 'Error') return if len(nzs) > 1: CTK.TXT.insert('START', 'Please, select only one zone.\n') CTK.TXT.insert('START', 'Error: ', 'Error') return point = CTK.varsFromWidget(VARS[0].get(), type=1) if len(point) != 3: CTK.TXT.insert('START', 'Point coords are incorrect.\n') CTK.TXT.insert('START', 'Error: ', 'Error') return nz = nzs[0] nob = CTK.Nb[nz] + 1 noz = CTK.Nz[nz] z = CTK.t[2][nob][2][noz] ind = CPlot.getActivePointIndex() if ind == []: CTK.TXT.insert('START', 'No selected point.\n') CTK.TXT.insert('START', 'Error: ', 'Error') return ind = ind[0] CTK.saveTree() zp = Internal.copyTree(z) C.setValue(zp, 'CoordinateX', ind, point[0]) C.setValue(zp, 'CoordinateY', ind, point[1]) C.setValue(zp, 'CoordinateZ', ind, point[2]) CPlot.replace(CTK.t, nob, noz, zp) CTK.TXT.insert('START', 'Point modified.\n') CPlot.render()
# - copyTree (pyTree) - import Converter.PyTree as C import Generator.PyTree as G import Converter.Internal as Internal import KCore.test as test a = G.cart((0,0,0), (1,1,1), (10,10,10)) t = C.newPyTree(['Base',a]) # t2 is a full copy of t (values/numpys are also copied) t2 = Internal.copyTree(t) test.testT(t2, 1)