Exemplo n.º 1
0
content = dash_vtk.View([
    dash_vtk.GeometryRepresentation(
        children=[
            dash_vtk.PolyData(
                points=[
                  0,0,0,
                  1,0,0,
                  0,1,0,
                  1,1,0,
                ],
                lines=[3, 1, 3, 2],
                polys=[3, 0, 1, 2],
                children=[
                    dash_vtk.PointData([
                        dash_vtk.DataArray(
                            #registration='setScalars', # To activate field
                            name='onPoints',
                            values=[0, 0.33, 0.66, 1],
                        )
                    ]),
                    dash_vtk.CellData([
                        dash_vtk.DataArray(
                            # registration='setScalars', # To activate field
                            name='onCells',
                            values=[0, 1],
                        )
                    ])
                ],
            ),
        ],
    ),
])
Exemplo n.º 2
0
server = app.server

vtk_view = dash_vtk.View(
    id="vtk-view",
    children=[
        dash_vtk.GeometryRepresentation(
            id="vtk-representation",
            children=[
                dash_vtk.PolyData(
                    id="vtk-polydata",
                    points=points,
                    polys=polys,
                    children=[
                        dash_vtk.PointData([
                            dash_vtk.DataArray(
                                id="vtk-array",
                                registration="setScalars",
                                name="elevation",
                                values=elevation,
                            )
                        ])
                    ],
                )
            ],
            colorMapPreset="erdc_blue2green_muted",
            colorDataRange=color_range,
            property={
                "edgeVisibility": True,
            },
        )
    ],
Exemplo n.º 3
0
import dash
import dash_html_components as html
import dash_vtk
import random

xyz = []
for i in range(10000):
    xyz.append(random.random())  # x
    xyz.append(random.random())  # y
    xyz.append(random.random() * 0.01)  # z

content = dash_vtk.View(children=[
    dash_vtk.GeometryRepresentation(
        property={'pointSize': 3},
        children=[dash_vtk.PolyData(points=xyz, connectivity='points')],
    ),
], )

# Dash setup
app = dash.Dash(__name__)
server = app.server

app.layout = html.Div(
    style={
        "width": "100%",
        "height": "calc(100vh - 15px)"
    },
    children=[content],
)

if __name__ == "__main__":
Exemplo n.º 4
0
import dash
import dash_html_components as html
import dash_vtk

content = dash_vtk.View(
    [
        dash_vtk.GeometryRepresentation(
            children=[
                dash_vtk.PolyData(
                    points=[0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0,],
                    lines=[3, 1, 3, 2],
                    polys=[3, 0, 1, 2],
                ),
            ],
        ),
    ]
)

# Dash setup
app = dash.Dash(__name__)
server = app.server
app.layout = html.Div(
    style={"width": "100%", "height": "calc(100vh - 15px)"}, children=[content],
)

if __name__ == "__main__":
    app.run_server(debug=True)
 dash_vtk.PolyData(
     points=[
         0,
         0,
         0,
         1,
         0,
         0,
         0,
         1,
         0,
         1,
         1,
         0,
     ],
     lines=[3, 1, 3, 2],
     polys=[3, 0, 1, 2],
     children=[
         dash_vtk.PointData([
             dash_vtk.DataArray(
                 registration="setScalars",
                 name="onPoints",
                 values=[0, 0.33, 0.66, 1],
             )
         ]),
         dash_vtk.CellData([
             dash_vtk.DataArray(
                 # registration='setScalars',
                 name="onCells",
                 values=[0, 1],
             )
         ]),
     ],
 ),
Exemplo n.º 6
0
import dash
import dash_html_components as html
import dash_vtk
import random

xyz = []
for i in range(10000):
    xyz.append(random.random())  # x
    xyz.append(random.random())  # y
    xyz.append(random.random() * 0.01)  # z

content = dash_vtk.View(children=[
    dash_vtk.GeometryRepresentation(
        property={"pointSize": 3},
        children=[
            dash_vtk.PolyData(points=xyz, connectivity="points"),
        ],
    ),
], )

# Dash setup
app = dash.Dash(__name__)
server = app.server

app.layout = html.Div(
    style={
        "width": "100%",
        "height": "calc(100vh - 15px)"
    },
    children=[content],
)
Exemplo n.º 7
0
                    property={
                        "pointSize": 10,
                    },
                    colorDataRange=[0, 3],
                    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)