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()
# - replace (pyTree) - import Generator.PyTree as G import CPlot.PyTree as CPlot import Converter.PyTree as C import time dt = 0.2 a = G.cart((0, 0, 0), (1, 1, 1), (30, 30, 30)) b = G.cartHexa((0, 0, 40), (1, 1, 1), (30, 30, 30)) t = C.newPyTree(['Base', a, b]) CPlot.display(t) time.sleep(dt) # Replace struct for i in range(10): a = G.cart((i, 0, 0), (1, 1, 1), (30, 30, 30)) CPlot.replace(t, 1, 0, a) CPlot.render() time.sleep(dt) # Replace non struct for i in range(10): a = G.cartHexa((i, 0, 40), (1, 1, 1), (30, 30, 30)) CPlot.replace(t, 1, 1, a) CPlot.render() time.sleep(dt)
# - replace (pyTree) - import Generator.PyTree as G import CPlot.PyTree as CPlot import Converter.PyTree as C import time a = G.cartTetra((0, 0, 0), (1, 1, 1), (10, 10, 10)) b = G.cartTetra((11, 0, 0), (1, 1, 1), (10, 10, 10)) c = G.cart((0, 11, 0), (1, 1, 1), (10, 10, 10)) t = C.newPyTree(['Base', a, b, c]) CPlot.display(t) time.sleep(2) d = G.cart((11, 11, 0), (1, 1, 1), (10, 10, 10)) CPlot.replace(t, 1, 0, d) CPlot.render() time.sleep(1)