-
Notifications
You must be signed in to change notification settings - Fork 6
/
mesh.py
102 lines (82 loc) · 2.66 KB
/
mesh.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# mesh gittree menu
# definition of ui_card
from uicard import ui_card, ui_subcard, server
from trame.widgets import vuetify
from su2_json import *
from materials import *
#from vtk_helper import *
import vtk
from vtkmodules.vtkCommonDataModel import (
VTK_HEXAHEDRON,
VTK_LINE,
VTK_POLYGON,
VTK_QUAD,
VTK_TETRA,
VTK_TRIANGLE,
VTK_PYRAMID,
VTK_WEDGE,
VTK_TRIANGLE_STRIP,
VTK_VERTEX,
vtkUnstructuredGrid)
from vtkmodules.vtkCommonDataModel import vtkMultiBlockDataSet
from vtkmodules.vtkRenderingCore import (
vtkActor,
vtkDataSetMapper,
vtkRenderer,
vtkRenderWindow,
vtkRenderWindowInteractor,
)
from vtkmodules.vtkCommonCore import vtkLookupTable
state, ctrl = server.state, server.controller
############################################################################
# Mesh models - global mesh variables #
############################################################################
# define initial square (counterclockwise)
x = [[0.0, 0.0, 0.0],[1.0, 0.0, 0.0],[1.0, 1.0, 0.0],[0.0, 1.0, 0.0]]
pts=[[0,1,2,3]]
points = vtk.vtkPoints()
for i in range(0, len(x)):
points.InsertPoint(i, x[i])
# We need this global structure
grid = vtkUnstructuredGrid()
# all the markers
markergrid = []
root = vtkMultiBlockDataSet()
# initial mesh
grid.SetPoints(points)
grid.InsertNextCell(VTK_QUAD,4,pts[0])
# Mesh
mesh_mapper = vtkDataSetMapper()
mesh_mapper.SetScalarVisibility(True)
mesh_mapper.SetUseLookupTableScalarRange(True)
lut = vtkLookupTable()
lut.Build()
mesh_mapper.SetLookupTable(lut)
mesh_actor = vtkActor()
############################################################################
# Mesh models - list options #
############################################################################
#
###############################################################
# PIPELINE CARD : MESH
###############################################################
def mesh_card():
with ui_card(title="Mesh", ui_name="Mesh"):
log("info", "## Mesh Selection ##")
vuetify.VTextarea(
label="mesh info:",
rows="5",
v_model=("meshText", "blablabla"),
)
###############################################################
# PIPELINE SUBCARD : MESH
###############################################################
# secondary card
def mesh_subcard():
# for the card to be visible, we have to set state.active_sub_ui = "submesh_none"
with ui_subcard(title="no mesh submodels", sub_ui_name="submesh_none"):
vuetify.VTextarea(
label="no mesh submodels:",
rows="5",
v_model=("submodeltext", "no mesh submodel"),
)