1313import diffCheck
1414from diffCheck import df_cvt_bindings
1515from diffCheck import df_error_estimation
16- from diffCheck .df_geometries import DFBeam
16+ from diffCheck .df_geometries import DFAssembly
1717
1818
1919class CloudMeshDistance (component ):
2020 def RunScript (self ,
2121 i_cloud_source : typing .List [rg .PointCloud ],
22- i_beams : typing . List [ DFBeam ] ,
22+ i_assembly : DFAssembly ,
2323 i_signed_flag : bool ,
2424 i_swap : bool ,
2525 i_analysis_resolution ):
@@ -28,7 +28,7 @@ def RunScript(self,
2828 The cloud-to-mesh component computes the distance between a point cloud and a mesh
2929
3030 :param i_cloud_source: a list of point clouds
31- :param i_beams: a list of DF beams
31+ :param i_assembly: an assembly of DF beams
3232 :param i_signed_flag: calculate the sign of the distances
3333 :param i_swap: swap source and target
3434
@@ -42,9 +42,20 @@ def RunScript(self,
4242 scalef = diffCheck .df_util .get_doc_2_meters_unitf ()
4343 i_analysis_resolution = 0.1 / scalef
4444
45+ # Based on cloud source input + beam size, decide whether to calculate joints or entire assembly and output respective message
46+ if len (i_assembly .beams ) == len (i_cloud_source ):
47+ ghenv .Component .Message = f"Per Beam"
48+ rh_mesh_target_list = [beam .to_mesh (i_analysis_resolution ) for beam in i_assembly .beams ]
49+ elif len (i_assembly .all_joints ) == len (i_cloud_source ):
50+ ghenv .Component .Message = f"Per Joint"
51+ rh_mesh_target_list = [joint .to_mesh (i_analysis_resolution ) for joint in i_assembly ._all_joints ]
52+ else :
53+ ghenv .Component .AddRuntimeMessage (RML .Warning , "The input number of obejcts to compare matches neither the number of beams nor the number of joints" )
54+ return None , None , None , None , None , None
55+
4556 # conversion
4657 df_cloud_source_list = [df_cvt_bindings .cvt_rhcloud_2_dfcloud (i_cl_s ) for i_cl_s in i_cloud_source ]
47- rh_mesh_target_list = [ beam . to_mesh ( i_analysis_resolution ) for beam in i_beams ]
58+
4859
4960 # calculate distances
5061 o_result = df_error_estimation .df_cloud_2_rh_mesh_comparison (df_cloud_source_list , rh_mesh_target_list , i_signed_flag , i_swap )
0 commit comments