Skip to content

Commit cedfcc1

Browse files
feat: add max id to CAD segmentation to allow segmentation during fabrication process
1 parent 2181ad9 commit cedfcc1

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/gh/components/DF_CAD_segmentator/code.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ def RunScript(self,
1919
i_clouds: System.Collections.Generic.IList[Rhino.Geometry.PointCloud],
2020
i_assembly,
2121
i_angle_threshold: float = 0.1,
22-
i_association_threshold: float = 0.1) -> Rhino.Geometry.PointCloud:
22+
i_association_threshold: float = 0.1,
23+
i_stop_after_id: int = None) -> Rhino.Geometry.PointCloud:
2324

2425
if i_clouds is None or i_assembly is None:
2526
self.AddRuntimeMessage(RML.Warning, "Please provide a cloud and an assembly to segment.")
@@ -38,7 +39,9 @@ def RunScript(self,
3839
df_beams_meshes = []
3940
rh_beams_meshes = []
4041

41-
for df_b in df_beams:
42+
stop_after_id = i_stop_after_id if i_stop_after_id is not None else len(df_beams)
43+
44+
for df_b in df_beams[:stop_after_id]:
4245
rh_b_mesh_faces = [df_b_f.to_mesh() for df_b_f in df_b.side_faces]
4346
df_b_mesh_faces = [df_cvt_bindings.cvt_rhmesh_2_dfmesh(rh_b_mesh_face) for rh_b_mesh_face in rh_b_mesh_faces]
4447
df_beams_meshes.append(df_b_mesh_faces)

src/gh/components/DF_CAD_segmentator/metadata.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,18 @@
6060
"wireDisplay": "default",
6161
"sourceCount": 0,
6262
"typeHintID": "float"
63+
},
64+
{
65+
"name": "i_stop_after_id",
66+
"nickname": "i_stop_after_id",
67+
"description": "The ID of the beam to stop processing after. This is intended for evaluating an assembly before its construction is completed.",
68+
"optional": true,
69+
"allowTreeAccess": true,
70+
"showTypeHints": true,
71+
"scriptParamAccess": "item",
72+
"wireDisplay": "default",
73+
"sourceCount": 0,
74+
"typeHintID": "int"
6375
}
6476
],
6577
"outputParameters": [

0 commit comments

Comments
 (0)