Skip to content

Commit 0cda38a

Browse files
authored
Merge pull request #28 from ricardoavelino/meshenvelope
Added MeshEnvelope Options
2 parents b6b596b + 937f69e commit 0cda38a

File tree

3 files changed

+46
-18
lines changed

3 files changed

+46
-18
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
* Added MeshEnvelope options to TNA_Envelope
13+
1214
### Changed
1315

1416
### Removed

commands/TNA_envelope.py

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44

55
import rhinoscriptsyntax as rs # type: ignore
66

7+
import compas_rhino
78
from compas_masonry.session import MasonrySession as Session
89
from compas_tna.diagrams import FormDiagram
910

1011
# from compas_rui import feedback
1112
from compas_tna.envelope import CrossVaultEnvelope
1213
from compas_tna.envelope import DomeEnvelope
1314
from compas_tna.envelope import Envelope
15+
from compas_tna.envelope import MeshEnvelope
1416
from compas_tna.envelope import PavillionVaultEnvelope
1517
from compas_tna.envelope import PointedVaultEnvelope
1618

@@ -71,7 +73,7 @@ def RunCommand():
7173

7274
envelope = None
7375

74-
option = rs.GetString(message="Envelope", strings=["FromLibrary", "FromMiddle", "FromIntrados", "FromBounds"])
76+
option = rs.GetString(message="Envelope", strings=["FromLibrary", "FromMiddle", "FromBounds"])
7577
if not option:
7678
return
7779

@@ -233,30 +235,54 @@ def RunCommand():
233235
# =============================================================================
234236

235237
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()
240243

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+
# # =============================================================================
244253

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
250259

251260
# =============================================================================
252261
# From the intrados and extrados meshes
253262
# =============================================================================
254263

255264
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)
260286

261287
# =============================================================================
262288
# Not supported

commands/TNA_loads.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def RunCommand():
3636
rs.UnselectAllObjects()
3737

3838
options = ["Add", "Clear All"]
39-
option = rs.GetString("Add or Remove supports", strings=options)
39+
option = rs.GetString("Add or Remove Loads in the Model", strings=options)
4040
if not option:
4141
return
4242

0 commit comments

Comments
 (0)