|
4 | 4 |
|
5 | 5 | import rhinoscriptsyntax as rs # type: ignore |
6 | 6 |
|
| 7 | +import compas_rhino |
7 | 8 | from compas_masonry.session import MasonrySession as Session |
8 | 9 | from compas_tna.diagrams import FormDiagram |
9 | 10 |
|
10 | 11 | # from compas_rui import feedback |
11 | 12 | from compas_tna.envelope import CrossVaultEnvelope |
12 | 13 | from compas_tna.envelope import DomeEnvelope |
13 | 14 | from compas_tna.envelope import Envelope |
| 15 | +from compas_tna.envelope import MeshEnvelope |
14 | 16 | from compas_tna.envelope import PavillionVaultEnvelope |
15 | 17 | from compas_tna.envelope import PointedVaultEnvelope |
16 | 18 |
|
@@ -71,7 +73,7 @@ def RunCommand(): |
71 | 73 |
|
72 | 74 | envelope = None |
73 | 75 |
|
74 | | - option = rs.GetString(message="Envelope", strings=["FromLibrary", "FromMiddle", "FromIntrados", "FromBounds"]) |
| 76 | + option = rs.GetString(message="Envelope", strings=["FromLibrary", "FromMiddle", "FromBounds"]) |
75 | 77 | if not option: |
76 | 78 | return |
77 | 79 |
|
@@ -233,30 +235,54 @@ def RunCommand(): |
233 | 235 | # ============================================================================= |
234 | 236 |
|
235 | 237 | elif option == "FromMiddle": |
236 | | - # select the middle surface mesh |
237 | | - # specify the thickness |
238 | | - # compute the envelope |
239 | | - pass |
| 238 | + guid = compas_rhino.objects.select_mesh("Select middle surface") |
| 239 | + if not guid: |
| 240 | + return |
| 241 | + mesh_middle = compas_rhino.conversions.meshobject_to_compas(guid) |
| 242 | + rs.UnselectAllObjects() |
240 | 243 |
|
241 | | - # ============================================================================= |
242 | | - # From the intrados mesh |
243 | | - # ============================================================================= |
| 244 | + thickness = rs.GetReal("Thickness", 0.5, 0.0, 100) |
| 245 | + if not thickness: |
| 246 | + return |
| 247 | + |
| 248 | + envelope = MeshEnvelope.from_middle_mesh(mesh_middle, thickness) |
| 249 | + |
| 250 | + # # ============================================================================= |
| 251 | + # # From the intrados mesh - This is not available yet. I would not show. |
| 252 | + # # ============================================================================= |
244 | 253 |
|
245 | | - elif option == "FromIntrados": |
246 | | - # select the intrados mesh |
247 | | - # specify the thickness |
248 | | - # compute the envelope |
249 | | - pass |
| 254 | + # elif option == "FromIntrados": |
| 255 | + # # select the intrados mesh |
| 256 | + # # specify the thickness |
| 257 | + # # compute the envelope |
| 258 | + # pass |
250 | 259 |
|
251 | 260 | # ============================================================================= |
252 | 261 | # From the intrados and extrados meshes |
253 | 262 | # ============================================================================= |
254 | 263 |
|
255 | 264 | elif option == "FromBounds": |
256 | | - # select the intrados mesh |
257 | | - # select the extrados mesh |
258 | | - # compute the envelope |
259 | | - pass |
| 265 | + guid = compas_rhino.objects.select_mesh("Select intrados") |
| 266 | + if not guid: |
| 267 | + return |
| 268 | + mesh_intrados = compas_rhino.conversions.meshobject_to_compas(guid) |
| 269 | + rs.UnselectAllObjects() |
| 270 | + |
| 271 | + guid = compas_rhino.objects.select_mesh("Select extrados") |
| 272 | + if not guid: |
| 273 | + return |
| 274 | + mesh_extrados = compas_rhino.conversions.meshobject_to_compas(guid) |
| 275 | + rs.UnselectAllObjects() |
| 276 | + |
| 277 | + guid = compas_rhino.objects.select_mesh("Select middle (Optional)") |
| 278 | + if not guid: |
| 279 | + mesh_middle = None |
| 280 | + pass |
| 281 | + else: |
| 282 | + mesh_middle = compas_rhino.conversions.meshobject_to_compas(guid) |
| 283 | + rs.UnselectAllObjects() |
| 284 | + |
| 285 | + envelope = MeshEnvelope.from_meshes(mesh_intrados, mesh_extrados, mesh_middle) |
260 | 286 |
|
261 | 287 | # ============================================================================= |
262 | 288 | # Not supported |
|
0 commit comments