Skip to content

Commit 07eccda

Browse files
fix: associate all clusters before calling clean_unassociated_clusters
1 parent f03a7d3 commit 07eccda

File tree

1 file changed

+9
-3
lines changed
  • src/gh/components/DF_CAD_segmentator

1 file changed

+9
-3
lines changed

src/gh/components/DF_CAD_segmentator/code.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def RunScript(self,
3737
df_clouds = [df_cvt_bindings.cvt_rhcloud_2_dfcloud(cloud.Duplicate()) for cloud in i_clouds]
3838

3939
df_beams = i_assembly.beams
40+
df_asssociated_cluster_faces_per_beam = []
4041

4142
for df_b in df_beams:
4243
o_face_clusters.append([])
@@ -53,20 +54,25 @@ def RunScript(self,
5354
association_threshold=i_association_threshold,
5455
angle_association_threshold=i_angle_association_threshold
5556
)
57+
df_asssociated_cluster_faces_per_beam.append(df_asssociated_cluster_faces)
58+
59+
for i, df_b in enumerate(df_beams):
60+
rh_b_mesh_faces = [df_b_f.to_mesh() for df_b_f in df_b.side_faces]
61+
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]
5662

5763
dfb_segmentation.DFSegmentation.clean_unassociated_clusters(
5864
is_roundwood=df_b.is_roundwood,
5965
unassociated_clusters=df_clouds,
60-
associated_clusters=[df_asssociated_cluster_faces],
66+
associated_clusters=[df_asssociated_cluster_faces_per_beam[i]],
6167
reference_mesh=[df_b_mesh_faces],
6268
angle_threshold=i_angle_threshold,
6369
association_threshold=i_association_threshold
6470
)
6571

66-
o_face_clusters[-1] = [df_cvt_bindings.cvt_dfcloud_2_rhcloud(cluster) for cluster in df_asssociated_cluster_faces]
72+
o_face_clusters[-1] = [df_cvt_bindings.cvt_dfcloud_2_rhcloud(cluster) for cluster in df_asssociated_cluster_faces_per_beam[i]]
6773

6874
df_asssociated_cluster = dfb_geometry.DFPointCloud()
69-
for df_associated_face in df_asssociated_cluster_faces:
75+
for df_associated_face in df_asssociated_cluster_faces_per_beam[i]:
7076
df_asssociated_cluster.add_points(df_associated_face)
7177

7278
df_clusters.append(df_asssociated_cluster)

0 commit comments

Comments
 (0)