File size: 994 Bytes
1fa56f6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c3e1016
1fa56f6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c6d99f7
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
import pyvista as pv
import sys

st_mode = '-gui' not in sys.argv

if st_mode:

  import streamlit as st
  st.set_page_config(layout="wide")
  from stpyvista import stpyvista

  from stpyvista.utils import start_xvfb

  if "IS_XVFB_RUNNING" not in st.session_state:
    start_xvfb()
    st.session_state.IS_XVFB_RUNNING = True 
  

## Initialize a plotter object
plotter = pv.Plotter(window_size=[800,600])


print('Reading all the objs...')
mesh = pv.read('a_mouse.obj')
plotter.add_mesh(mesh, smooth_shading=True, color='white')

mesh2 = pv.read('full_mouse.obj')
mesh2.translate((-40,0,0), inplace=True)
plotter.add_mesh(mesh2, smooth_shading=True, color='tan')


print('Read objs...')

plotter.add_axes()
plotter.enable_mesh_picking(show_message=True)


## Final touches
plotter.view_isometric()
#plotter.add_scalar_bar()
plotter.background_color = 'white'  

if st_mode:
  ## Pass a key to avoid re-rendering at each page change
  stpyvista(plotter, key="pv_cube")
else:
  plotter.show()