Skip to content

Commit 3828e8e

Browse files
fix: improvements to code component and metadata following @eleniv3d 's comments in PR
1 parent 961b28b commit 3828e8e

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/gh/components/DF_main_pc_axes/code.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,12 @@
55
from diffCheck import df_poses
66

77
import Rhino
8+
from Grasshopper.Kernel import GH_RuntimeMessageLevel as RML
89

910
from ghpythonlib.componentbase import executingcomponent as component
1011

1112
import System
1213

13-
def compute_dot_product(v1, v2):
14-
"""
15-
Compute the dot product of two vectors.
16-
"""
17-
return (v1.X * v2.X) + (v1.Y * v2.Y) + (v1.Z * v2.Z)
18-
1914
class DFMainPCAxes(component):
2015
def RunScript(self,
2116
i_clouds: System.Collections.Generic.List[Rhino.Geometry.PointCloud],
@@ -33,7 +28,8 @@ def RunScript(self,
3328
df_cloud = df_cvt_bindings.cvt_rhcloud_2_dfcloud(cloud)
3429
if df_cloud is None:
3530
return None, None
36-
df_cloud.estimate_normals(True, 12)
31+
if not df_cloud.has_normals():
32+
ghenv.Component.AddRuntimeMessage(RML.Error, f"Point cloud {i} has no normals. Please compute the normals.") # noqa: F821
3733

3834
df_points = df_cloud.get_axis_aligned_bounding_box()
3935
df_point = (df_points[0] + df_points[1]) / 2

src/gh/components/DF_main_pc_axes/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"name": "i_clouds",
1818
"nickname": "i_clouds",
1919
"description": "clouds whose main axes are to be calculated",
20-
"optional": true,
20+
"optional": false,
2121
"allowTreeAccess": true,
2222
"showTypeHints": true,
2323
"scriptParamAccess": "list",

0 commit comments

Comments
 (0)