Skip to content

Commit b1a74b7

Browse files
WIP-ADD: scan_segmentation component
1 parent c021636 commit b1a74b7

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import Rhino
2+
import diffCheck.df_cvt_bindings as df_cvt
3+
import diffCheck.df_geometries as df_geo
4+
import diffCheck.diffcheck_bindings as df_bindings
5+
6+
def main(model, voxel_size, normal_threshold, min_cluster_size):
7+
a = []
8+
df_scan = df_cvt.cvt_rhcloud_2_dfcloud(scan)
9+
res = df_bindings.dfb_segmentation.DFSegmentation.segmentation_point_cloud(df_scan, voxel_size, normal_threshold, min_cluster_size)
10+
print(len(res))
11+
for pc in res:
12+
a.append(pc)
13+
14+
15+
16+
for brep in model:
17+
brep_faces = brep.Faces
18+
center_points = []
19+
for i in range(brep_faces.Count):
20+
brep_face = brep_faces.ExtractFace(i)
21+
face_vertices = brep_face.Vertices
22+
center_point = Rhino.Geometry.Point3d(0, 0, 0)
23+
for j in range(face_vertices.Count):
24+
vertex = face_vertices[j]
25+
center_point += vertex.Location
26+
center_point /= face_vertices.Count
27+
for face in a:
28+
initial_distance = center_point - face.get_center_point()
29+
print(initial_distance)
30+
return a, center_points
31+
32+
if __name__ == "__main__":
33+
a, center_points = main(model, voxel_size, normal_threshold, min_cluster_size)
1.07 KB
Loading
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"name": "DFScanSegmentation",
3+
"nickname": "Geo2Pcd",
4+
"category": "diffCheck",
5+
"subcategory": "Cloud",
6+
"description": "Segments a point cloud from a list of breps.",
7+
"exposure": 4,
8+
"instanceGuid": "08a53777-80c0-454a-b016-4d924fc5934c",
9+
"ghpython": {
10+
"hideOutput": true,
11+
"hideInput": true,
12+
"isAdvancedMode": true,
13+
"marshalOutGuids": true,
14+
"iconDisplay": 2,
15+
"inputParameters": [
16+
{
17+
"name": "i_breps",
18+
"nickname": "i_breps",
19+
"description": "Breps to segment the point cloud.",
20+
"optional": true,
21+
"allowTreeAccess": true,
22+
"showTypeHints": true,
23+
"scriptParamAccess": "item",
24+
"wireDisplay": "default",
25+
"sourceCount": 0,
26+
"typeHintID": "brep"
27+
},
28+
{
29+
"name": "i_scan",
30+
"nickname": "i_scan",
31+
"description": "The point cloud of the scan.",
32+
"optional": false,
33+
"allowTreeAccess": true,
34+
"showTypeHints": true,
35+
"scriptParamAccess": "item",
36+
"wireDisplay": "default",
37+
"sourceCount": 0,
38+
"typeHintID": "pointcloud"
39+
}
40+
],
41+
"outputParameters": [
42+
{
43+
"name": "o_rh_segmented_cloud",
44+
"nickname": "o_rh_segmented_cloud",
45+
"description": "The output segmented cloud.",
46+
"optional": false,
47+
"sourceCount": 0,
48+
"graft": false
49+
}
50+
]
51+
}
52+
}

0 commit comments

Comments
 (0)