Skip to content

Commit e7dad06

Browse files
fix: rename SubstractCloud to CloudDifference and fix mistakes in metadata
1 parent 718a3a6 commit e7dad06

File tree

3 files changed

+89
-0
lines changed

3 files changed

+89
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from diffCheck import df_cvt_bindings as df_cvt
2+
3+
import Rhino
4+
from Grasshopper.Kernel import GH_RuntimeMessageLevel as RML
5+
6+
from ghpythonlib.componentbase import executingcomponent as component
7+
8+
class DFCloudDifference(component):
9+
def __init__(self):
10+
super(DFCloudDifference, self).__init__()
11+
def RunScript(self,
12+
i_cloud_A: Rhino.Geometry.PointCloud,
13+
i_cloud_B: Rhino.Geometry.PointCloud,
14+
i_distance_threshold: float):
15+
df_cloud = df_cvt.cvt_rhcloud_2_dfcloud(i_cloud_A)
16+
df_cloud_substract = df_cvt.cvt_rhcloud_2_dfcloud(i_cloud_B)
17+
if i_distance_threshold is None:
18+
ghenv.Component.AddRuntimeMessage(RML.Warning, "Distance threshold not defined. 0.01 used as default value.")# noqa: F821
19+
i_distance_threshold = 0.01
20+
if i_distance_threshold <= 0:
21+
ghenv.Component.AddRuntimeMessage(RML.Warning, "Distance threshold must be greater than 0. Please provide a valid distance threshold.")# noqa: F821
22+
return None
23+
df_cloud.subtract_points(df_cloud_substract, i_distance_threshold)
24+
rh_cloud = df_cvt.cvt_dfcloud_2_rhcloud(df_cloud)
25+
return [rh_cloud]
15.1 KB
Loading
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"name": "DFCloudDifference",
3+
"nickname": "Difference",
4+
"category": "diffCheck",
5+
"subcategory": "Cloud",
6+
"description": "Subtracts points from a point cloud based on a distance threshold.",
7+
"exposure": 4,
8+
"instanceGuid": "9ef299aa-76dc-4417-9b95-2a374e2b36af",
9+
"ghpython": {
10+
"hideOutput": true,
11+
"hideInput": true,
12+
"isAdvancedMode": true,
13+
"marshalOutGuids": true,
14+
"iconDisplay": 2,
15+
"inputParameters": [
16+
{
17+
"name": "i_cloud_A",
18+
"nickname": "i_cloud_A",
19+
"description": "The point cloud to subtract from.",
20+
"optional": false,
21+
"allowTreeAccess": true,
22+
"showTypeHints": true,
23+
"scriptParamAccess": "item",
24+
"wireDisplay": "default",
25+
"sourceCount": 0,
26+
"typeHintID": "pointcloud"
27+
},
28+
{
29+
"name": "i_cloud_subtract_with",
30+
"nickname": "i_cloud_subtract_with",
31+
"description": "The point cloud to subtract with.",
32+
"optional": false,
33+
"allowTreeAccess": true,
34+
"showTypeHints": true,
35+
"scriptParamAccess": "item",
36+
"wireDisplay": "default",
37+
"sourceCount": 0,
38+
"typeHintID": "pointcloud"
39+
},
40+
{
41+
"name": "i_distance_threshold",
42+
"nickname": "i_distance_threshold",
43+
"description": "The distance threshold to consider a point as too close.",
44+
"optional": true,
45+
"allowTreeAccess": true,
46+
"showTypeHints": true,
47+
"scriptParamAccess": "item",
48+
"wireDisplay": "default",
49+
"sourceCount": 0,
50+
"typeHintID": "float"
51+
}
52+
],
53+
"outputParameters": [
54+
{
55+
"name": "o_cloud_in",
56+
"nickname": "o_cloud",
57+
"description": "The resulting cloud after subtraction.",
58+
"optional": false,
59+
"sourceCount": 0,
60+
"graft": false
61+
}
62+
]
63+
}
64+
}

0 commit comments

Comments
 (0)