Skip to content

Commit 515608f

Browse files
committed
skeleton
1 parent ceda06f commit 515608f

File tree

5 files changed

+54
-8
lines changed

5 files changed

+54
-8
lines changed

CHANGELOG.md

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

1010
### Added
1111

12+
* Added "Pattern from Skeleton".
13+
1214
### Changed
1315

1416
* Changed `compas_rui` minimal requirements.
17+
* Fixed bug in selection by edge loop of pattern vertices.
1518

1619
### Removed
1720

commands/RV_pattern.py

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# r: compas_rv>=0.6.0
44

55
import rhinoscriptsyntax as rs # type: ignore
6+
from compas_skeleton.datastructures import Skeleton
67
from compas_triangle.delaunay import conforming_delaunay_triangulation
78
from compas_triangle.rhino import discretise_boundary
89
from compas_triangle.rhino import discretise_constraints
@@ -37,7 +38,17 @@ def RunCommand():
3738
# Make a Force "Pattern"
3839
# =============================================================================
3940

40-
option = rs.GetString(message="Pattern From", strings=["RhinoLines", "RhinoMesh", "RhinoSurface", "MeshGrid", "Triangulation"])
41+
option = rs.GetString(
42+
message="Pattern From",
43+
strings=[
44+
"RhinoLines",
45+
"RhinoMesh",
46+
"RhinoSurface",
47+
"MeshGrid",
48+
"Triangulation",
49+
"Skeleton",
50+
],
51+
)
4152

4253
if option == "RhinoLines":
4354
guids = compas_rhino.objects.select_lines("Select lines")
@@ -154,7 +165,33 @@ def RunCommand():
154165
pattern.smooth_area(fixed=fixed)
155166

156167
elif option == "Skeleton":
157-
raise NotImplementedError
168+
guids = compas_rhino.objects.select_lines("Select skeleton lines.")
169+
if not guids:
170+
return
171+
172+
rs.UnselectAllObjects()
173+
174+
width = rs.GetReal("Specifiy skeleton width.", 1.0)
175+
if not width:
176+
return
177+
178+
angle = rs.GetReal("Specifiy skeleton leaf angle (degrees).", 30)
179+
if not angle:
180+
return
181+
182+
density = rs.GetInteger("Specifiy skeleton density.", 2)
183+
if not density:
184+
return
185+
186+
objects = [compas_rhino.objects.find_object(guid) for guid in guids]
187+
curves = [obj.Geometry for obj in objects]
188+
lines = [compas_rhino.conversions.curve_to_compas_line(curve) for curve in curves]
189+
190+
skeleton = Skeleton(lines)
191+
skeleton.node_width = width
192+
skeleton.leaf_angle = angle
193+
skeleton.density = density
194+
pattern = skeleton.pattern.copy(cls=Pattern)
158195

159196
else:
160197
return

commands/RV_pattern_modify.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,18 @@ def RunCommand():
3434

3535
if option == "VertexAttributes":
3636
pattern.show_vertices = list(pattern.mesh.vertices())
37-
pattern.redraw_vertices()
37+
pattern.show_edges = list(pattern.mesh.edges())
38+
pattern.redraw()
39+
3840
selected = pattern.select_vertices()
3941
if selected:
4042
pattern.update_vertex_attributes(selected)
4143

4244
elif option == "EdgeAttributes":
45+
pattern.show_vertices = False
4346
pattern.show_edges = list(pattern.mesh.edges())
44-
pattern.redraw_edges()
47+
pattern.redraw()
48+
4549
selected = pattern.select_edges()
4650
if selected:
4751
pattern.update_edge_attributes(selected)

commands/RV_pattern_supports.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,18 @@ def RunCommand():
5757

5858
if option == "Add":
5959
pattern.show_vertices = list(pattern.mesh.vertices())
60-
pattern.redraw_vertices()
60+
pattern.show_edges = list(pattern.mesh.edges())
61+
pattern.redraw()
6162

6263
selected = pattern.select_vertices()
6364

6465
if selected:
6566
pattern.mesh.vertices_attribute(name="is_support", value=True, keys=selected)
6667

6768
elif option == "Remove":
68-
pattern.show_vertices = list(pattern.mesh.vertices_where(is_support=True))
69-
pattern.redraw_vertices()
69+
pattern.show_vertices = list(pattern.mesh.vertices())
70+
pattern.show_edges = list(pattern.mesh.edges())
71+
pattern.redraw()
7072

7173
selected = pattern.select_vertices()
7274

compas-RV.rhproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"id": "a6dc4669-0e8e-40ea-8d71-b9b0f4764ec1",
99
"identity": {
1010
"name": "COMPAS-RhinoVAULT",
11-
"version": "0.6.4",
11+
"version": "0.6.7",
1212
"publisher": {
1313
"email": "[email protected]",
1414
"name": "Tom Van Mele",

0 commit comments

Comments
 (0)