66
77from Grasshopper .Kernel import GH_RuntimeMessageLevel as RML
88
9- import diffCheck
109from diffCheck import diffcheck_bindings
1110from diffCheck import df_cvt_bindings
12- import diffCheck . df_util
11+
1312
1413class DFRANSACGlobalRegistration (component ):
1514 def RunScript (self ,
@@ -25,9 +24,12 @@ def RunScript(self,
2524 i_max_iterations : int ,
2625 i_confidence_threshold : float
2726 ) -> rg .Transform :
27+ # preliminary checks
2828 if i_cloud_source is None or i_cloud_target is None :
2929 ghenv .Component .AddRuntimeMessage (RML .Warning , "Please provide both objects of type point clouds to align" ) # noqa: F821
3030 return None
31+ if not i_cloud_source .ContainsNormals or not i_cloud_target .ContainsNormals :
32+ ghenv .Component .AddRuntimeMessage (RML .Error , "Please compute cloud's normals with a component before" ) # noqa: F821
3133
3234 # set default values
3335 if i_radius_kd_search is None :
@@ -49,12 +51,6 @@ def RunScript(self,
4951 if i_confidence_threshold is None :
5052 i_confidence_threshold = 0.999
5153
52- # get the working unit of the Rhino document, if other than meters, set a multiplier factor
53- scalef = diffCheck .df_util .get_doc_2_meters_unitf ()
54- i_radius_kd_search *= scalef
55- i_max_corrspondence_dist *= scalef
56- i_checker_dist *= scalef
57-
5854 # conversion
5955 df_cloud_source = df_cvt_bindings .cvt_rhcloud_2_dfcloud (i_cloud_source )
6056 df_cloud_target = df_cvt_bindings .cvt_rhcloud_2_dfcloud (i_cloud_target )
0 commit comments