Skip to content

Commit

Permalink
message param
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvanmele committed Nov 1, 2024
1 parent 9ed47d0 commit 3e76c1b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

* Added `message` param to `compas_rui.scene.RhinoMeshObject.select_vertices`.
* Added `message` param to `compas_rui.scene.RhinoMeshObject.select_edges`.

### Changed

### Removed
Expand Down
19 changes: 4 additions & 15 deletions src/compas_rui/scene/meshobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class RUIMeshObject(RhinoMeshObject):
# =============================================================================
# =============================================================================

def select_vertices(self, selectable: list[int]):
option = rs.GetString(message="Select Vertices", strings=["All", "Boundary", "Degree", "EdgeLoop", "Manual"])
def select_vertices(self, selectable: list[int], message="Select Vertices"):
option = rs.GetString(message=message, strings=["All", "Boundary", "Degree", "EdgeLoop", "Manual"])
if not option:
return

Expand All @@ -41,12 +41,9 @@ def select_vertices(self, selectable: list[int]):

elif option == "EdgeLoop":
show_edges = self.show_edges

self.show_edges = True
rs.EnableRedraw(False)
self.clear_edges()
self.draw_edges()
rs.EnableRedraw(True)
rs.Redraw()

guids = compas_rhino.objects.select_lines(message="Select Edges")
Expand All @@ -59,27 +56,23 @@ def select_vertices(self, selectable: list[int]):
vertices = list(set(temp))

self.show_edges = show_edges
rs.EnableRedraw(False)
self.clear_edges()
self.draw_edges()
rs.EnableRedraw(True)
rs.Redraw()

elif option == "Manual":
self.show_vertices = selectable
rs.EnableRedraw(False)
self.clear_vertices()
self.draw_vertices()
rs.EnableRedraw(True)
rs.Redraw()

guids = compas_rhino.objects.select_points(message="Select Vertices")
vertices = [self._guid_vertex[guid] for guid in guids if guid in self._guid_vertex] if guids else []

return list(set(vertices) & set(selectable))

def select_edges(self, selectable: list[tuple[int, int]]):
option = rs.GetString(message="Select Edges", strings=["All", "Boundary", "EdgeLoop", "Manual"])
def select_edges(self, selectable: list[tuple[int, int]], message="Select Edges"):
option = rs.GetString(message=message, strings=["All", "Boundary", "EdgeLoop", "Manual"])
if not option:
return

Expand All @@ -94,10 +87,8 @@ def select_edges(self, selectable: list[tuple[int, int]]):
edges = [(u, v) if self.mesh.has_edge((u, v)) else (v, u) for u, v in edges]

elif option == "EdgeLoop":
rs.EnableRedraw(False)
self.clear_edges()
self.draw_edges()
rs.EnableRedraw(True)
rs.Redraw()

guids = compas_rhino.objects.select_lines(message="Select Edges")
Expand All @@ -108,10 +99,8 @@ def select_edges(self, selectable: list[tuple[int, int]]):
edges.append(edge)

elif option == "Manual":
rs.EnableRedraw(False)
self.clear_edges()
self.draw_edges()
rs.EnableRedraw(True)
rs.Redraw()

guids = compas_rhino.objects.select_lines(message="Select Edges")
Expand Down

0 comments on commit 3e76c1b

Please sign in to comment.