Ejemplo n.º 1
0
                    id="tubes-mesh",
                    state=viz.getTubesMesh("p"),
                )
            ],
        ),
        dash_vtk.GeometryRepresentation(
            id="seed-rep",
            property={
                "color": [0.8, 0, 0],
                "representation": 0,
                "pointSize": 8,
            },
            children=[
                dash_vtk.Algorithm(
                    id="seed-line",
                    vtkClass="vtkLineSource",
                    state=viz.getSeedState(),
                )
            ],
        ),
    ],
)

# -----------------------------------------------------------------------------
# Control UI
# -----------------------------------------------------------------------------

high = 0.6
low = -0.55

controls = [
Ejemplo n.º 2
0
    dash_vtk.GeometryRepresentation(
        mapper={
            "colorByArrayName": "layer",
            "scalarMode": 4,
            "interpolateScalarsBeforeMapping": False,
        },
        colorMapPreset="jet",
        colorDataRange=[0.2, 0.9],
        children=[
            dash_vtk.Algorithm(
                vtkClass="vtkConcentricCylinderSource",
                state={
                    "height": 0.25,
                    "radius": [0.2, 0.3, 0.4, 0.6, 0.7, 0.8, 0.9, 1],
                    "cellFields": [0, 0.2, 0.4, 0.6, 0.7, 0.8, 0.9, 1],
                    "mask": [1, 0, 1, 0, 1, 0, 1, 1],
                    "resolution": 60,
                    "skipInnerFaces": True,
                    "startTheta": 45,
                    "endTheta": 315,
                    "center": [0, 0, 0.5],
                },
            ),
        ],
    ),
])

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

app.layout = html.Div(
Ejemplo n.º 3
0
                    ],
                )
            ],
            colorMapPreset="erdc_blue2green_muted",
            colorDataRange=color_range,
            property={"edgeVisibility": True},
            showCubeAxes=True,
            cubeAxesStyle={"axisLabels": ["", "", "Altitude"]},
        ),
        dash_vtk.GeometryRepresentation(
            id="pick-rep",
            actor={"visibility": False},
            children=[
                dash_vtk.Algorithm(
                    id="pick-sphere",
                    vtkClass="vtkSphereSource",
                    state={"radius": 100},
                )
            ],
        ),
    ],
)

app.layout = dbc.Container(
    fluid=True,
    style={"height": "100vh"},
    children=[
        dbc.Row(
            [
                dbc.Col(children=dcc.Slider(
                    id="scale-factor",
Ejemplo n.º 4
0
    dash_vtk.GeometryRepresentation(
        mapper={
            'colorByArrayName': 'layer',
            'scalarMode': 4,
            'interpolateScalarsBeforeMapping': False,
        },
        colorMapPreset="jet",
        colorDataRange=[0.2, 0.9],
        children=[
            dash_vtk.Algorithm(
                vtkClass="vtkConcentricCylinderSource",
                state={
                    'height': 0.25,
                    'radius': [0.2, 0.3, 0.4, 0.6, 0.7, 0.8, 0.9, 1],
                    'cellFields': [0, 0.2, 0.4, 0.6, 0.7, 0.8, 0.9, 1],
                    'mask': [1, 0, 1, 0, 1, 0, 1, 1],
                    'resolution': 60,
                    'skipInnerFaces': True,
                    'startTheta': 45,
                    'endTheta': 315,
                    'center': [0, 0, 0.5],
                },
            ),
        ]),
])

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

app.layout = html.Div(
    style={
Ejemplo n.º 5
0
import dash_core_components as dcc
from dash.dependencies import Input, Output, State

random.seed(42)

app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
server = app.server

vtk_view = dash_vtk.View(
    id="geometry-view",
    children=[
        dash_vtk.GeometryRepresentation([
            dash_vtk.Algorithm(
                id="vtk-algorithm",
                vtkClass="vtkConeSource",
                state={
                    "capping": False,
                    "resolution": 60
                },
            )
        ])
    ],
)

controls = dbc.Card([
    dbc.CardHeader("Controls"),
    dbc.CardBody([
        html.P("Resolution:"),
        dcc.Slider(
            id="slider-resolution",
            min=10,
            max=100,
Ejemplo n.º 6
0
vehicle_vtk = []
for filename in glob.glob(os.path.join(DATA_PATH, "vehicle") + "/*.vtp"):
    mesh = _load_vtp(filename, point_arrays=['U', 'p'])
    part_name = filename.split("/")[-1].replace(".vtp", "")
    child = dash_vtk.GeometryRepresentation(
        id=f"{part_name}",
        colorMapPreset="erdc_rainbow_bright",
        colorDataRange=[0, 100],
        mapper={"scalarVisibility": False},
        children=[dash_vtk.Mesh(state=mesh, )],
    )
    vehicle_vtk.append(child)

cone_pointer = dash_vtk.GeometryRepresentation(
    property={"color": [1, 0, 0]},
    children=[dash_vtk.Algorithm(id="pointer", vtkClass="vtkConeSource")])

# -----------------------------------------------------------------------------
# 3D Viz
# -----------------------------------------------------------------------------

vtk_view = dash_vtk.View(id="vtk-view",
                         pickingModes=['hover'],
                         children=vehicle_vtk + [cone_pointer])

# -----------------------------------------------------------------------------
# App UI
# -----------------------------------------------------------------------------

app.layout = dbc.Container(
    fluid=True,
Ejemplo n.º 7
0
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",