Skip to content

Commit c902c33

Browse files
committed
FIX assembly input for meshcloud distance calculation
1 parent 8ba24c1 commit c902c33

File tree

5 files changed

+5487
-5136
lines changed

5 files changed

+5487
-5136
lines changed

deps/eigen

Submodule eigen updated from 0b646f3 to cc240ee

src/gh/components/DF_cloud_mesh_distance/code.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
import diffCheck
1414
from diffCheck import df_cvt_bindings
1515
from diffCheck import df_error_estimation
16-
from diffCheck.df_geometries import DFBeam
16+
from diffCheck.df_geometries import DFAssembly
1717

1818

1919
class 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)

src/gh/components/DF_cloud_mesh_distance/metadata.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"subcategory": "Analysis",
66
"description": "Computes the distance between a point cloud and a mesh",
77
"exposure": 4,
8-
"instanceGuid": "534a24ba-7e32-482f-a3d7-293647185122",
8+
"instanceGuid": "eda01e34-b89b-4e3c-a9b6-0178a05ae81b",
99
"ghpython": {
1010
"hideOutput": true,
1111
"hideInput": true,
@@ -26,13 +26,13 @@
2626
"typeHintID": "pointcloud"
2727
},
2828
{
29-
"name": "i_beams",
30-
"nickname": "i_beams",
31-
"description": "The target DFbeams",
29+
"name": "i_assembly",
30+
"nickname": "i_assembly",
31+
"description": "The target DFAssembly",
3232
"optional": false,
3333
"allowTreeAccess": true,
3434
"showTypeHints": true,
35-
"scriptParamAccess": "list",
35+
"scriptParamAccess": "item",
3636
"wireDisplay": "default",
3737
"sourceCount": 0,
3838
"typeHintID": "ghdoc"

0 commit comments

Comments
 (0)