Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions commands/TNA_envelope.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import compas_rhino
import compas_rhino.conversions
import compas_rhino.objects
from compas.datastructures import Mesh
from compas_masonry.session import MasonrySession as Session
from compas_tna.diagrams import FormDiagram

Expand Down Expand Up @@ -249,6 +250,8 @@ def RunCommand():
if not thickness:
return

rs.HideObject(guid)

envelope = MeshEnvelope.from_middle_mesh(mesh_middle, thickness)

# # =============================================================================
Expand All @@ -266,25 +269,35 @@ def RunCommand():
# =============================================================================

elif option == "FromBounds":
guids_bounds = []

guid = compas_rhino.objects.select_mesh("Select intrados")
rs.UnselectAllObjects()
if not guid:
return
mesh_intrados = compas_rhino.conversions.meshobject_to_compas(guid)
rs.UnselectAllObjects()
guids_bounds.append(guid)
obj = compas_rhino.objects.find_object(guid)
mesh_intrados = compas_rhino.conversions.mesh_to_compas(obj.Geometry, cls=Mesh)

guid = compas_rhino.objects.select_mesh("Select extrados")
rs.UnselectAllObjects()
if not guid:
return
mesh_extrados = compas_rhino.conversions.meshobject_to_compas(guid)
rs.UnselectAllObjects()
guids_bounds.append(guid)
obj = compas_rhino.objects.find_object(guid)
mesh_extrados = compas_rhino.conversions.mesh_to_compas(obj.Geometry, cls=Mesh)

guid = compas_rhino.objects.select_mesh("Select middle (Optional)")
rs.UnselectAllObjects()
if not guid:
mesh_middle = None
pass
else:
mesh_middle = compas_rhino.conversions.meshobject_to_compas(guid)
rs.UnselectAllObjects()
guids_bounds.append(guid)
obj = compas_rhino.objects.find_object(guid)
mesh_middle = compas_rhino.conversions.mesh_to_compas(obj.Geometry, cls=Mesh)

rs.HideObjects(guids_bounds)

envelope = MeshEnvelope.from_meshes(mesh_intrados, mesh_extrados, mesh_middle)

Expand Down
26 changes: 24 additions & 2 deletions commands/TNA_formdiagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import rhinoscriptsyntax as rs # type: ignore

import compas_rhino
from compas.datastructures import Mesh
from compas_masonry.session import MasonrySession as Session
from compas_rui import feedback
from compas_tna.diagrams import FormDiagram
Expand Down Expand Up @@ -79,6 +81,7 @@ def RunCommand():
# =============================================================================

formdiagram = None
rs.UnselectAllObjects()

option = rs.GetString(message="FormDiagram", strings=["FromPattern", "FromLines", "FromRhinoMesh"])
if not option:
Expand All @@ -89,14 +92,33 @@ def RunCommand():
# =============================================================================

if option == "FromLines":
pass
guids = compas_rhino.objects.select_lines("Select lines")
if not guids:
return

lines = compas_rhino.objects.get_line_coordinates(guids)
if not lines:
return

mesh_formdiagram = Mesh.from_lines(lines, delete_boundary_face=True) # type: ignore
formdiagram = FormDiagram.from_mesh(mesh_formdiagram)

rs.HideObjects(guids)

# =============================================================================
# From a Rhino mesh
# =============================================================================

elif option == "FromRhinoMesh":
pass
guid = compas_rhino.objects.select_mesh("Select FormDiagram Mesh")
rs.UnselectAllObjects()
if not guid:
return
obj = compas_rhino.objects.find_object(guid)
mesh_formdiagram = compas_rhino.conversions.mesh_to_compas(obj.Geometry, cls=Mesh)
formdiagram = FormDiagram.from_mesh(mesh_formdiagram)

rs.HideObjects(guid)

# =============================================================================
# From a predefined pattern
Expand Down
Loading