I'm trying to use a "simple" dynamic map function to regenerate a filigree mesh based on the size input by the slider widget. However, sliding either ends up hanging the notebook (it's still "thinking") or if it finishes, it doesn't actually update the map (size is always 30)
# create mesh equivalent to case100.txt/.2dm
poly_exterior = [
[-150.0, -140.0],
[-150.0, -130.0],
[-150.0, -120.0],
[-150.0, -110.0],
[-150.0, -100.0],
[-150.0, -90.0],
[-150.0, -80.0],
[-150.0, -70.0],
[-150.0, -60.0],
[-150.0, -50.0],
[-150.0, -40.0],
[-150.0, -30.0],
[-150.0, -20.0],
[-150.0, -10.0],
[-150.0, 0.0],
[-150.0, 10.0],
[-150.0, 20.0],
[-150.0, 30.0],
[-150.0, 40.0],
[-150.0, 50.0],
[-150.0, 60.0],
[-150.0, 70.0],
[-150.0, 80.0],
[-150.0, 90.0],
[-150.0, 100.0],
[-150.0, 110.0],
[-150.0, 120.0],
[-150.0, 130.0],
[-150.0, 140.0],
[-150.0, 150.0],
[-150.0, 160.0],
[-150.0, 170.0],
[-150.0, 180.0],
[-150.0, 190.0],
[-150.0, 200.0],
[-150.0, 210.0],
[-150.0, 220.0],
[-150.0, 230.0],
[-150.0, 240.0],
[-150.0, 250.0],
[-150.0, 260.0],
[-150.0, 270.0],
[-150.0, 280.0],
[-150.0, 290.0],
[-150.0, 300.0],
[-150.0, 310.0],
[-150.0, 320.0],
[-150.0, 330.0],
[-150.0, 340.0],
[-150.0, 350.0],
[-140.0, 350.0],
[-130.0, 350.0],
[-120.0, 350.0],
[-110.0, 350.0],
[-100.0, 350.0],
[-90.0, 350.0],
[-80.0, 350.0],
[-70.0, 350.0],
[-60.0, 350.0],
[-50.0, 350.0],
[-40.0, 350.0],
[-30.0, 350.0],
[-20.0, 350.0],
[-10.0, 350.0],
[0.0, 350.0],
[10.0, 350.0],
[20.0, 350.0],
[30.0, 350.0],
[40.0, 350.0],
[50.0, 350.0],
[60.0, 350.0],
[70.0, 350.0],
[80.0, 350.0],
[90.0, 350.0],
[100.0, 350.0],
[110.0, 350.0],
[120.0, 350.0],
[130.0, 350.0],
[140.0, 350.0],
[150.0, 350.0],
[160.0, 350.0],
[170.0, 350.0],
[180.0, 350.0],
[190.0, 350.0],
[200.0, 350.0],
[210.0, 350.0],
[220.0, 350.0],
[230.0, 350.0],
[240.0, 350.0],
[250.0, 350.0],
[260.0, 350.0],
[270.0, 350.0],
[280.0, 350.0],
[290.0, 350.0],
[300.0, 350.0],
[310.0, 350.0],
[320.0, 350.0],
[330.0, 350.0],
[340.0, 350.0],
[350.0, 350.0],
[350.0, 340.0],
[350.0, 330.0],
[350.0, 320.0],
[350.0, 310.0],
[350.0, 300.0],
[350.0, 290.0],
[350.0, 280.0],
[350.0, 270.0],
[350.0, 260.0],
[350.0, 250.0],
[350.0, 240.0],
[350.0, 230.0],
[350.0, 220.0],
[350.0, 210.0],
[350.0, 200.0],
[350.0, 190.0],
[350.0, 180.0],
[350.0, 170.0],
[350.0, 160.0],
[350.0, 150.0],
[350.0, 140.0],
[350.0, 130.0],
[350.0, 120.0],
[350.0, 110.0],
[350.0, 100.0],
[350.0, 90.0],
[350.0, 80.0],
[350.0, 70.0],
[350.0, 60.0],
[350.0, 50.0],
[350.0, 40.0],
[350.0, 30.0],
[350.0, 20.0],
[350.0, 10.0],
[350.0, 0.0],
[350.0, -10.0],
[350.0, -20.0],
[350.0, -30.0],
[350.0, -40.0],
[350.0, -50.0],
[350.0, -60.0],
[350.0, -70.0],
[350.0, -80.0],
[350.0, -90.0],
[350.0, -100.0],
[350.0, -110.0],
[350.0, -120.0],
[350.0, -130.0],
[350.0, -140.0],
[350.0, -150.0],
[340.0, -150.0],
[330.0, -150.0],
[320.0, -150.0],
[310.0, -150.0],
[300.0, -150.0],
[290.0, -150.0],
[280.0, -150.0],
[270.0, -150.0],
[260.0, -150.0],
[250.0, -150.0],
[240.0, -150.0],
[230.0, -150.0],
[220.0, -150.0],
[210.0, -150.0],
[200.0, -150.0],
[190.0, -150.0],
[180.0, -150.0],
[170.0, -150.0],
[160.0, -150.0],
[150.0, -150.0],
[140.0, -150.0],
[130.0, -150.0],
[120.0, -150.0],
[110.0, -150.0],
[100.0, -150.0],
[90.0, -150.0],
[80.0, -150.0],
[70.0, -150.0],
[60.0, -150.0],
[50.0, -150.0],
[40.0, -150.0],
[30.0, -150.0],
[20.0, -150.0],
[10.0, -150.0],
[0.0, -150.0],
[-10.0, -150.0],
[-20.0, -150.0],
[-30.0, -150.0],
[-40.0, -150.0],
[-50.0, -150.0],
[-60.0, -150.0],
[-70.0, -150.0],
[-80.0, -150.0],
[-90.0, -150.0],
[-100.0, -150.0],
[-110.0, -150.0],
[-120.0, -150.0],
[-130.0, -150.0],
[-140.0, -150.0],
[-150.0, -150.0]
]
poly_holes = [
[[0.0, 0.0],
[10.0, 0.0],
[20.0, 0.0],
[30.0, 0.0],
[40.0, 0.0],
[50.0, 0.0],
[60.0, 0.0],
[70.0, 0.0],
[80.0, 0.0],
[90.0, 0.0],
[90.0, 10.0],
[90.0, 20.0],
[90.0, 30.0],
[90.0, 40.0],
[80.0, 40.0],
[70.0, 40.0],
[60.0, 40.0],
[50.0, 40.0],
[50.0, 50.0],
[50.0, 60.0],
[50.0, 70.0],
[50.0, 80.0],
[50.0, 90.0],
[50.0, 100.0],
[50.0, 110.0],
[50.0, 120.0],
[50.0, 130.0],
[50.0, 140.0],
[50.0, 150.0],
[60.0, 150.0],
[70.0, 150.0],
[80.0, 150.0],
[90.0, 150.0],
[100.0, 150.0],
[110.0, 150.0],
[120.0, 150.0],
[130.0, 150.0],
[140.0, 150.0],
[150.0, 150.0],
[150.0, 140.0],
[150.0, 130.0],
[150.0, 120.0],
[150.0, 110.0],
[150.0, 100.0],
[150.0, 90.0],
[150.0, 80.0],
[150.0, 70.0],
[150.0, 60.0],
[150.0, 50.0],
[150.0, 40.0],
[140.0, 40.0],
[130.0, 40.0],
[120.0, 40.0],
[110.0, 40.0],
[110.0, 30.0],
[110.0, 20.0],
[110.0, 10.0],
[110.0, 0.0],
[120.0, 0.0],
[130.0, 0.0],
[140.0, 0.0],
[150.0, 0.0],
[160.0, 0.0],
[170.0, 0.0],
[180.0, 0.0],
[190.0, 0.0],
[200.0, 0.0],
[200.0, 10.0],
[200.0, 20.0],
[200.0, 30.0],
[200.0, 40.0],
[200.0, 50.0],
[200.0, 60.0],
[200.0, 70.0],
[200.0, 80.0],
[200.0, 90.0],
[200.0, 100.0],
[200.0, 110.0],
[200.0, 120.0],
[200.0, 130.0],
[200.0, 140.0],
[200.0, 150.0],
[200.0, 160.0],
[200.0, 170.0],
[200.0, 180.0],
[200.0, 190.0],
[200.0, 200.0],
[190.0, 200.0],
[180.0, 200.0],
[170.0, 200.0],
[160.0, 200.0],
[150.0, 200.0],
[140.0, 200.0],
[130.0, 200.0],
[120.0, 200.0],
[110.0, 200.0],
[100.0, 200.0],
[90.0, 200.0],
[80.0, 200.0],
[70.0, 200.0],
[60.0, 200.0],
[50.0, 200.0],
[40.0, 200.0],
[30.0, 200.0],
[20.0, 200.0],
[10.0, 200.0],
[0.0, 200.0],
[0.0, 190.0],
[0.0, 180.0],
[0.0, 170.0],
[0.0, 160.0],
[0.0, 150.0],
[0.0, 140.0],
[0.0, 130.0],
[0.0, 120.0],
[0.0, 110.0],
[0.0, 100.0],
[0.0, 90.0],
[0.0, 80.0],
[0.0, 70.0],
[0.0, 60.0],
[0.0, 50.0],
[0.0, 40.0],
[0.0, 30.0],
[0.0, 20.0],
[0.0, 10.0]]
]
p = Polygon(poly_exterior, poly_holes)
# x, y, size
coords = [
[-200.0, 400.0, 20.0],
[400.0, 400.0, 20.0],
[-200.0, -200.0, 20.0],
[400.0, -200.0, 10.0],
[100.0, 100.0, 20.0],
[-75.0, -75.0, 10.0],
[275.0, -75.0, 10.0],
]
def update_mesh(size):
mesh = filigree.FiligreeMesh()
sz = mesh.create_size_function(coords, 'linear')
mesh.add_polygon(p, size_function=sz)
mesh.add_refine_point(-75.0, 275.0, size, 1)
mesh.add_refine_point(275.0, 275.0, size, 0)
verts, tris = mesh.create_mesh()
points = hv.Points(verts, vdims=['z'])
return hv.TriMesh((tris, points))
dmap = hv.DynamicMap(update_mesh, kdims=['size'])
dmap.redim.range(size=(30,40))