-
Notifications
You must be signed in to change notification settings - Fork 22
/
usage.py
79 lines (75 loc) · 2.67 KB
/
usage.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
import dash_vtk
import dash
from dash.dependencies import Input, Output
import dash_html_components as html
app = dash.Dash(__name__)
server = app.server
app.layout = html.Div(
style={"width": "100%", "height": "calc(100vh - 16px)"},
children=[
dash_vtk.View(
id="view",
children=[
dash_vtk.GeometryRepresentation(
[
dash_vtk.Algorithm(
vtkClass="vtkConeSource",
state={
"resolution": 64,
"capping": False,
},
)
]
),
dash_vtk.GeometryRepresentation(
property={
"color": [0.4, 0.4, 0.4],
},
actor={
"position": [0.5, 0.2, 0.4],
"scale": [0.3, 0.3, 0.3],
},
children=[
dash_vtk.Reader(
vtkClass="vtkOBJReader",
url="https://kitware.github.io/vtk-js-datasets/data/obj-mtl/star-wars-vader-tie-fighter.obj",
)
],
),
dash_vtk.GeometryRepresentation(
id="rep",
property={
"pointSize": 10,
},
colorDataRange=[0, 3],
showScalarBar=True,
scalarBarTitle="Temperature",
mapper={
"colorByArrayName": "Temperature",
"scalarMode": 3,
"interpolateScalarsBeforeMapping": True,
},
children=[
dash_vtk.PolyData(
id="square",
points=[0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0],
polys=[4, 0, 1, 2, 3],
children=[
dash_vtk.PointData(
children=[
dash_vtk.DataArray(
name="Temperature", values=[0, 3, 2, 1]
)
]
)
],
)
],
),
],
),
html.Div(id="output"),
],
)
if __name__ == "__main__":
app.run_server(debug=True)