22# venv: rhinovault
33# r: compas>=2.5, compas_rui>=0.3.1, compas_session>=0.4.1, compas_tna>=0.5
44
5-
65import rhinoscriptsyntax as rs # type: ignore
76
8- from compas_rv .datastructures import ThrustDiagram
9- from compas_rv .scene import RhinoThrustObject
107from compas_rv .session import RVSession
118
129
1310def RunCommand ():
1411 session = RVSession ()
1512
16- thrust : RhinoThrustObject = session .scene .find_by_itemtype (ThrustDiagram )
13+ form = session .find_formdiagram ()
14+ if not form :
15+ return
16+
17+ force = session .find_forcediagram ()
18+ if not force :
19+ return
20+
21+ thrust = session .find_thrustdiagram ()
1722 if not thrust :
1823 return
1924
@@ -23,45 +28,65 @@ def RunCommand():
2328
2429 rs .UnselectAllObjects ()
2530
26- options = ["VertexAttributes" , "EdgeAttributes" ]
31+ options = ["VertexAttributes" , "EdgeAttributes" , "FaceAttributes" , "MoveSupports" ]
2732 option = rs .GetString ("Modify the Thrust Diagram" , strings = options )
2833 if not option :
2934 return
3035
3136 if option == "VertexAttributes" :
32- selectable = list (thrust .mesh .vertices ())
33- selected = thrust .select_vertices (selectable )
37+ thrust .show_vertices = list (thrust .diagram .vertices ())
38+ thrust .redraw_vertices ()
39+
40+ selected = thrust .select_vertices ()
41+
3442 if selected :
3543 thrust .update_vertex_attributes (selected )
3644
3745 elif option == "EdgeAttributes" :
38- selectable = list (thrust .mesh .edges_where (_is_edge = True ))
39- selected = thrust .select_edges (selectable )
46+ thrust .show_edges = list (thrust .diagram .edges_where (_is_edge = True ))
47+ thrust .redraw_edges ()
48+
49+ selected = thrust .select_edges ()
50+
4051 if selected :
4152 thrust .update_edge_attributes (selected )
4253
54+ elif option == "MoveSupports" :
55+ form .show_vertices = False
56+ form .redraw_vertices ()
57+
58+ thrust .show_vertices = list (thrust .diagram .vertices_where (is_support = True ))
59+ thrust .redraw_vertices ()
60+
61+ selected = thrust .select_vertices ()
62+
63+ if not selected :
64+ return
65+
66+ thrust .move_vertices_direction (selected , direction = "Z" )
67+
4368 else :
4469 raise NotImplementedError
4570
71+ if session .settings .autoupdate :
72+ rs .MessageBox ("Automatic equilibrium updates are not available yet." , title = "Info" )
73+
4674 # =============================================================================
4775 # Update scene
4876 # =============================================================================
4977
5078 rs .UnselectAllObjects ()
5179
80+ form .show_vertices = True
81+ form .redraw_vertices ()
82+
5283 thrust .show_vertices = True
5384 thrust .show_free = False
5485 thrust .show_fixed = True
5586 thrust .show_supports = True
56- thrust .show_edges = True
57- thrust .clear ()
58- thrust .draw ()
59-
60- rs .Redraw ()
87+ thrust .show_edges = False
6188
62- # =============================================================================
63- # Save session
64- # =============================================================================
89+ thrust .redraw ()
6590
6691 if session .settings .autosave :
6792 session .record (name = "Modify Thrust Diagram" )
0 commit comments