File size: 1,437 Bytes
76b7f87
 
 
005501c
 
76b7f87
005501c
 
76b7f87
005501c
76b7f87
 
 
 
 
 
 
005501c
 
 
76b7f87
 
005501c
76b7f87
 
005501c
 
76b7f87
005501c
 
 
 
76b7f87
005501c
 
 
76b7f87
005501c
76b7f87
005501c
76b7f87
005501c
76b7f87
005501c
76b7f87
005501c
 
 
76b7f87
005501c
76b7f87
005501c
76b7f87
005501c
76b7f87
 
005501c
 
 
 
 
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
import streamlit as st
import stpyvista.utils

from stpyvista import stpyvista as spv

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

st.set_page_config(layout="wide")
st.title("Sibernetic simple example")

import pyvista as pv
import numpy as np

import time

from load import load_points
from load import create_plotter
from load import create_mesh


filename = "position_buffer.txt"


if "step" not in st.session_state:
    st.session_state.step = 3

if "all_points" not in st.session_state:
    st.session_state.all_points, st.session_state.all_point_types = load_points(
        filename
    )

if "plotter" not in st.session_state:
    print("Creating a new plotter...")
    st.session_state.plotter = create_plotter()

global plotter

plotter = st.session_state.plotter

last_mesh = None

create_mesh(st.session_state.step, plotter)

max_time = len(st.session_state.all_points) - 1
# pl.add_slider_widget(create_mesh, rng=[0,max_time], value=max_time, title='Time point')
# pl.add_timer_event(   max_steps=len(all_points), duration=200, callback=create_mesh)

print("Ready to replay...")

st.session_state.step += 1

st.write("Step: %s" % st.session_state.step)


if st.button("Step"):
    if st.session_state.step <= len(st.session_state.all_points):
        st.write("Stepped...")
        st.session_state.step += 5
        spv(plotter, "sibernetic")