Skip to content

Commit a0289fc

Browse files
fix: simplify cropping component
1 parent f07431f commit a0289fc

File tree

2 files changed

+5
-96
lines changed

2 files changed

+5
-96
lines changed

src/gh/components/DF_crop_cloud/code.py

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,7 @@ def __init__(self):
1212
super(DFCloudCrop, self).__init__()
1313
def RunScript(self,
1414
i_cloud: Rhino.Geometry.PointCloud,
15-
i_box: Rhino.Geometry.Brep,
16-
i_x_min: float,
17-
i_y_min: float,
18-
i_z_min: float,
19-
i_x_max: float,
20-
i_y_max: float,
21-
i_z_max: float):
15+
i_box: Rhino.Geometry.Brep):
2216
if i_cloud is None:
2317
ghenv.Component.AddRuntimeMessage(RML.Warning, "No point cloud provided. Please connect a point cloud to the input.") # noqa: F821
2418
return None
@@ -28,22 +22,9 @@ def RunScript(self,
2822
bb_min_as_array = np.asarray([bbox.Min.X, bbox.Min.Y, bbox.Min.Z])
2923
bb_max_as_array = np.asarray([bbox.Max.X, bbox.Max.Y, bbox.Max.Z])
3024

31-
ghenv.Component.AddRuntimeMessage(RML.Remark, "A box is provided and is used to crop the point cloud, all other inputs neglected. To use min/max values, disconnect the box") # noqa: F821
3225
else:
33-
if i_x_min is None:
34-
i_x_min = -np.inf
35-
if i_y_min is None:
36-
i_y_min = -np.inf
37-
if i_z_min is None:
38-
i_z_min = -np.inf
39-
if i_x_max is None:
40-
i_x_max = np.inf
41-
if i_y_max is None:
42-
i_y_max = np.inf
43-
if i_z_max is None:
44-
i_z_max = np.inf
45-
bb_min_as_array = np.asarray([i_x_min, i_y_min, i_z_min])
46-
bb_max_as_array = np.asarray([i_x_max, i_y_max, i_z_max])
26+
ghenv.Component.AddRuntimeMessage(RML.Warning, "Please provide a box to crop the point cloud with") # noqa: F821
27+
4728
df_cloud = df_cvt.cvt_rhcloud_2_dfcloud(i_cloud)
4829
df_cloud.crop(bb_min_as_array, bb_max_as_array)
4930
rh_cloud = df_cvt.cvt_dfcloud_2_rhcloud(df_cloud)

src/gh/components/DF_crop_cloud/metadata.json

Lines changed: 2 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"name": "i_cloud",
1818
"nickname": "i_cloud",
1919
"description": "The point cloud to crop.",
20-
"optional": true,
20+
"optional": false,
2121
"allowTreeAccess": true,
2222
"showTypeHints": true,
2323
"scriptParamAccess": "item",
@@ -29,85 +29,13 @@
2929
"name": "i_box",
3030
"nickname": "i_box",
3131
"description": "The brep box to crop the point cloud with.",
32-
"optional": true,
32+
"optional": false,
3333
"allowTreeAccess": true,
3434
"showTypeHints": true,
3535
"scriptParamAccess": "item",
3636
"wireDisplay": "default",
3737
"sourceCount": 0,
3838
"typeHintID": "brep"
39-
},
40-
{
41-
"name": "i_x_min",
42-
"nickname": "i_x_min",
43-
"description": "The minimum x value to crop the point cloud with.",
44-
"optional": true,
45-
"allowTreeAccess": true,
46-
"showTypeHints": true,
47-
"scriptParamAccess": "item",
48-
"wireDisplay": "default",
49-
"sourceCount": 0,
50-
"typeHintID": "float"
51-
},
52-
{
53-
"name": "i_y_min",
54-
"nickname": "i_y_min",
55-
"description": "The minimum y value to crop the point cloud with.",
56-
"optional": true,
57-
"allowTreeAccess": true,
58-
"showTypeHints": true,
59-
"scriptParamAccess": "item",
60-
"wireDisplay": "default",
61-
"sourceCount": 0,
62-
"typeHintID": "float"
63-
},
64-
{
65-
"name": "i_z_min",
66-
"nickname": "i_z_min",
67-
"description": "The minimum z value to crop the point cloud with.",
68-
"optional": true,
69-
"allowTreeAccess": true,
70-
"showTypeHints": true,
71-
"scriptParamAccess": "item",
72-
"wireDisplay": "default",
73-
"sourceCount": 0,
74-
"typeHintID": "float"
75-
},
76-
{
77-
"name": "i_x_max",
78-
"nickname": "i_x_max",
79-
"description": "The maximum x value to crop the point cloud with.",
80-
"optional": true,
81-
"allowTreeAccess": true,
82-
"showTypeHints": true,
83-
"scriptParamAccess": "item",
84-
"wireDisplay": "default",
85-
"sourceCount": 0,
86-
"typeHintID": "float"
87-
},
88-
{
89-
"name": "i_y_max",
90-
"nickname": "i_y_max",
91-
"description": "The maximum y value to crop the point cloud with.",
92-
"optional": true,
93-
"allowTreeAccess": true,
94-
"showTypeHints": true,
95-
"scriptParamAccess": "item",
96-
"wireDisplay": "default",
97-
"sourceCount": 0,
98-
"typeHintID": "float"
99-
},
100-
{
101-
"name": "i_z_max",
102-
"nickname": "i_z_max",
103-
"description": "The maximum z value to crop the point cloud with.",
104-
"optional": true,
105-
"allowTreeAccess": true,
106-
"showTypeHints": true,
107-
"scriptParamAccess": "item",
108-
"wireDisplay": "default",
109-
"sourceCount": 0,
110-
"typeHintID": "float"
11139
}
11240
],
11341
"outputParameters": [

0 commit comments

Comments
 (0)