File indexing completed on 2026-04-10 07:50:27
0001
0002 from np.fold import Fold
0003 import os, numpy as np
0004
0005 try:
0006 import pyvista as pv
0007 except ImportError:
0008 pv = None
0009 pass
0010
0011 SIZE = np.array([1280, 720])
0012
0013 if __name__ == '__main__':
0014 a = Fold.Load("$FOLD", symbol="f")
0015 print(repr(a))
0016 title = os.environ.get("TITLE", "U4Mesh_test.sh")
0017
0018 pl = pv.Plotter(window_size=SIZE*2)
0019 pl.add_text(title, position="upper_left")
0020
0021 colors = ['red', 'green', 'blue', 'cyan', 'magenta', 'yellow', 'black', 'pink']
0022
0023 legend_labels = []
0024
0025 for i, name in enumerate(sorted(a.names)):
0026 f = getattr(a, name)
0027 color = colors[i % len(colors)]
0028 offset = np.array([i*200,0,0], dtype=np.float32)
0029 pd = pv.PolyData(f.vtx + offset, f.tpd)
0030 pl.add_mesh(pd, opacity=1.0, color=color, show_edges=True, lighting=True, name=name )
0031 legend_labels.append([name, color])
0032 pass
0033 pl.add_legend(legend_labels)
0034 pl.show()
0035 pass
0036 pass
0037
0038