ktongue's picture
download
raw
3.11 kB
import os
from trame.app import get_server
from trame.ui.vuetify import SinglePageLayout
from trame.widgets import vtk, vuetify
from vtkmodules.vtkRenderingCore import (
vtkActor,
vtkDataSetMapper,
vtkRenderer,
vtkRenderWindow,
vtkRenderWindowInteractor,
)
# Required for interactor initialization
from vtkmodules.vtkInteractionStyle import vtkInteractorStyleSwitch # noqa
# Required for rendering initialization, not necessary for
# local rendering, but doesn't hurt to include it
import vtkmodules.vtkRenderingOpenGL2 # noqa
CURRENT_DIRECTORY = os.path.abspath(os.path.dirname(__file__))
# -----------------------------------------------------------------------------
# Constants
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# VTK pipeline
# -----------------------------------------------------------------------------
renderer = vtkRenderer()
renderWindow = vtkRenderWindow()
renderWindow.AddRenderer(renderer)
renderWindowInteractor = vtkRenderWindowInteractor()
renderWindowInteractor.SetRenderWindow(renderWindow)
renderWindowInteractor.GetInteractorStyle().SetCurrentStyleToTrackballCamera()
# Read Data
# Extract Array/Field information
# Mesh
# Mesh: Setup default representation to surface
# Mesh: Apply rainbow color map
# Mesh: Color by default array
# Contour
# Contour: ContourBy default array
# Contour: Setup default representation to surface
# Contour: Apply rainbow color map
# Contour: Color by default array
# Cube Axes
# Cube Axes: Boundaries, camera, and styling
renderer.ResetCamera()
# -----------------------------------------------------------------------------
# Trame setup
# -----------------------------------------------------------------------------
server = get_server(client_type="vue2")
state, ctrl = server.state, server.controller
# -----------------------------------------------------------------------------
# Callbacks
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# GUI elements
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# GUI
# -----------------------------------------------------------------------------
with SinglePageLayout(server) as layout:
layout.title.set_text("Viewer")
with layout.toolbar:
# toolbar components
pass
with layout.content:
# content components
with vuetify.VContainer(
fluid=True,
classes="pa-0 fill-height",
):
view = vtk.VtkLocalView(renderWindow)
ctrl.view_update = view.update
ctrl.view_reset_camera = view.reset_camera
# -----------------------------------------------------------------------------
# Main
# -----------------------------------------------------------------------------
if __name__ == "__main__":
server.start()

Xet Storage Details

Size:
3.11 kB
·
Xet hash:
5800f7b2a2e73713687754d6db3442b0d634ceccb2252ca2a5567af8d776e451

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.