Skip to content

FIX Assembly input for meshcloud Distance Calculation #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps/eigen
Submodule eigen updated from 0b646f to cc240e
2 changes: 1 addition & 1 deletion deps/pybind11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you get our this from the PR to avoid conflicts please?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okie. i deleted the folder in the last push. Let me know if there was a better way to take it out :)

19 changes: 15 additions & 4 deletions src/gh/components/DF_cloud_mesh_distance/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
import diffCheck
from diffCheck import df_cvt_bindings
from diffCheck import df_error_estimation
from diffCheck.df_geometries import DFBeam
from diffCheck.df_geometries import DFAssembly


class CloudMeshDistance(component):
def RunScript(self,
i_cloud_source: typing.List[rg.PointCloud],
i_beams: typing.List[DFBeam],
i_assembly: DFAssembly,
i_signed_flag: bool,
i_swap: bool,
i_analysis_resolution):
Expand All @@ -28,7 +28,7 @@ def RunScript(self,
The cloud-to-mesh component computes the distance between a point cloud and a mesh

:param i_cloud_source: a list of point clouds
:param i_beams: a list of DF beams
:param i_assembly: an assembly of DF beams
:param i_signed_flag: calculate the sign of the distances
:param i_swap: swap source and target

Expand All @@ -42,9 +42,20 @@ def RunScript(self,
scalef = diffCheck.df_util.get_doc_2_meters_unitf()
i_analysis_resolution = 0.1 / scalef

# Based on cloud source input + beam size, decide whether to calculate joints or entire assembly and output respective message
if len(i_assembly.beams) == len(i_cloud_source):
ghenv.Component.Message = f"Per Beam"
rh_mesh_target_list = [beam.to_mesh(i_analysis_resolution) for beam in i_assembly.beams]
elif len(i_assembly.all_joints) == len(i_cloud_source):
ghenv.Component.Message= f"Per Joint"
rh_mesh_target_list = [joint.to_mesh(i_analysis_resolution) for joint in i_assembly._all_joints]
else:
ghenv.Component.AddRuntimeMessage(RML.Warning, "The input number of obejcts to compare matches neither the number of beams nor the number of joints")
Copy link
Collaborator

@DamienGilliard DamienGilliard Aug 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small typo in the runtime message ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noted ;)

return None, None, None, None, None, None

# conversion
df_cloud_source_list = [df_cvt_bindings.cvt_rhcloud_2_dfcloud(i_cl_s) for i_cl_s in i_cloud_source]
rh_mesh_target_list = [beam.to_mesh(i_analysis_resolution) for beam in i_beams]


# calculate distances
o_result = df_error_estimation.df_cloud_2_rh_mesh_comparison(df_cloud_source_list, rh_mesh_target_list, i_signed_flag, i_swap)
Expand Down
10 changes: 5 additions & 5 deletions src/gh/components/DF_cloud_mesh_distance/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"subcategory": "Analysis",
"description": "Computes the distance between a point cloud and a mesh",
"exposure": 4,
"instanceGuid": "534a24ba-7e32-482f-a3d7-293647185122",
"instanceGuid": "eda01e34-b89b-4e3c-a9b6-0178a05ae81b",
"ghpython": {
"hideOutput": true,
"hideInput": true,
Expand All @@ -26,13 +26,13 @@
"typeHintID": "pointcloud"
},
{
"name": "i_beams",
"nickname": "i_beams",
"description": "The target DFbeams",
"name": "i_assembly",
"nickname": "i_assembly",
"description": "The target DFAssembly",
"optional": false,
"allowTreeAccess": true,
"showTypeHints": true,
"scriptParamAccess": "list",
"scriptParamAccess": "item",
"wireDisplay": "default",
"sourceCount": 0,
"typeHintID": "ghdoc"
Expand Down
Loading
Loading