-
Notifications
You must be signed in to change notification settings - Fork 4
Feature/point cloud utils #155
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
Changes from 11 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
3c90378
feat: add a component to crop point clouds
DamienGilliard a514125
feat: add cropping capability to DFPointCloud
DamienGilliard f07431f
feat: add binding for cropping capability of point cloud
DamienGilliard a0289fc
fix: simplify cropping component
DamienGilliard a98b80f
feat: add point cloud subtraction method and implement it in component
DamienGilliard fcc1936
feat: add point cloud duplication for python binding
DamienGilliard d65fb17
feat: add capacity to crop with any brep, and keep trace of in and ou…
DamienGilliard 10d1943
feat: add point cloud intersection calculation
DamienGilliard 02b4756
feat: add point cloud intersection calculation component
DamienGilliard bbbee07
feat: add point cloud merge component
DamienGilliard 718a3a6
feat: add point cloud intersection calculation to DFPointCloud
DamienGilliard e7dad06
fix: rename SubstractCloud to CloudDifference and fix mistakes in met…
DamienGilliard 5308e44
fix: rename MergeCloud to CloudUnion and fix mistakes in metadata
DamienGilliard 164ef82
fix: metadata in CropCloud and IntersectCloud
DamienGilliard 1baf875
fix: small typos again in the metadata
DamienGilliard 8cdd175
feat: add possibility to crop pc with any box
DamienGilliard 3eebaa5
feat: improve cropping component following @eleniv3d 's comments
DamienGilliard bc42fe2
fix: rename CloudCrop to CloudSplit
DamienGilliard a1d5266
FIX minor cosmetic changes
eleniv3d File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| from diffCheck import df_cvt_bindings as df_cvt | ||
|
|
||
| import Rhino | ||
| from Grasshopper.Kernel import GH_RuntimeMessageLevel as RML | ||
|
|
||
| from ghpythonlib.componentbase import executingcomponent as component | ||
|
|
||
| class DFCloudIntersect(component): | ||
| def __init__(self): | ||
| super(DFCloudIntersect, self).__init__() | ||
| def RunScript(self, | ||
| i_cloud_intersect_from: Rhino.Geometry.PointCloud, | ||
| i_cloud_intersect_with: Rhino.Geometry.PointCloud, | ||
| i_distance_threshold: float): | ||
| df_cloud = df_cvt.cvt_rhcloud_2_dfcloud(i_cloud_intersect_from) | ||
| df_cloud_intersect = df_cvt.cvt_rhcloud_2_dfcloud(i_cloud_intersect_with) | ||
| if i_distance_threshold is None: | ||
| ghenv.Component.AddRuntimeMessage(RML.Warning, "Distance threshold not defined. 0.01 used as default value.")# noqa: F821 | ||
| i_distance_threshold = 0.01 | ||
| if i_distance_threshold <= 0: | ||
| ghenv.Component.AddRuntimeMessage(RML.Warning, "Distance threshold must be greater than 0. Please provide a valid distance threshold.")# noqa: F821 | ||
| return None | ||
| df_intersection = df_cloud.intersect(df_cloud_intersect, i_distance_threshold) | ||
| rh_cloud = df_cvt.cvt_dfcloud_2_rhcloud(df_intersection) | ||
| return [rh_cloud] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| { | ||
| "name": "DFSubtractCloud", | ||
| "nickname": "Subtract", | ||
| "category": "diffCheck", | ||
| "subcategory": "Cloud", | ||
| "description": "Subtracts points from a point cloud based on a distance threshold.", | ||
| "exposure": 4, | ||
| "instanceGuid": "b1a87021-dc4d-4844-86e0-8dcf55965ac6", | ||
| "ghpython": { | ||
| "hideOutput": true, | ||
| "hideInput": true, | ||
| "isAdvancedMode": true, | ||
| "marshalOutGuids": true, | ||
| "iconDisplay": 2, | ||
| "inputParameters": [ | ||
| { | ||
| "name": "i_cloud_intersect_from", | ||
| "nickname": "i_cloud_intersect_from", | ||
| "description": "The point cloud to intersect from.", | ||
| "optional": false, | ||
| "allowTreeAccess": true, | ||
| "showTypeHints": true, | ||
| "scriptParamAccess": "item", | ||
| "wireDisplay": "default", | ||
| "sourceCount": 0, | ||
| "typeHintID": "pointcloud" | ||
| }, | ||
| { | ||
| "name": "i_cloud_intersect_with", | ||
| "nickname": "i_cloud_intersect_with", | ||
| "description": "The point cloud to intersect with.", | ||
| "optional": false, | ||
| "allowTreeAccess": true, | ||
| "showTypeHints": true, | ||
| "scriptParamAccess": "item", | ||
| "wireDisplay": "default", | ||
| "sourceCount": 0, | ||
| "typeHintID": "pointcloud" | ||
| }, | ||
| { | ||
| "name": "i_distance_threshold", | ||
| "nickname": "i_distance_threshold", | ||
| "description": "The distance threshold to consider a point as too close.", | ||
| "optional": true, | ||
| "allowTreeAccess": true, | ||
| "showTypeHints": true, | ||
| "scriptParamAccess": "item", | ||
| "wireDisplay": "default", | ||
| "sourceCount": 0, | ||
| "typeHintID": "float" | ||
| } | ||
| ], | ||
| "outputParameters": [ | ||
| { | ||
| "name": "o_cloud", | ||
| "nickname": "o_cloud", | ||
| "description": "The resulting cloud after intersection.", | ||
| "optional": false, | ||
| "sourceCount": 0, | ||
| "graft": false | ||
| } | ||
| ] | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| """Merges point clouds together.""" | ||
| import diffCheck | ||
| from diffCheck.diffcheck_bindings import dfb_geometry as df_geometry | ||
| import Rhino | ||
|
|
||
| import System | ||
|
|
||
| from Grasshopper.Kernel import GH_RuntimeMessageLevel as RML | ||
|
|
||
| from ghpythonlib.componentbase import executingcomponent as component | ||
|
|
||
| TOL = Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance | ||
|
|
||
| class DFMergeAssemblies(component): | ||
DamienGilliard marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| def RunScript(self, | ||
| i_clouds: System.Collections.Generic.List[Rhino.Geometry.PointCloud]): | ||
| if i_clouds is None or len(i_clouds) == 0: | ||
| ghenv.Component.AddRuntimeMessage(RML.Warning, "No point clouds provided. Please connect point clouds to the input.") # noqa: F821 | ||
| return None | ||
|
|
||
| merged_cloud = df_geometry.DFPointCloud() | ||
| for cloud in i_clouds: | ||
| df_cloud = diffCheck.df_cvt_bindings.cvt_rhcloud_2_dfcloud(cloud) | ||
| merged_cloud.add_points(df_cloud) | ||
|
|
||
| o_cloud = diffCheck.df_cvt_bindings.cvt_dfcloud_2_rhcloud(merged_cloud) | ||
| return [o_cloud] | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| { | ||
| "name": "DFMergeClouds", | ||
| "nickname": "DFMergeClouds", | ||
| "category": "diffCheck", | ||
| "subcategory": "Cloud", | ||
| "description": "This component merges a series of point clouds into a unique point cloud.", | ||
| "exposure": 4, | ||
| "instanceGuid": "1e5e3ce8-1eb8-4227-9456-016f3cedd235", | ||
| "ghpython": { | ||
| "hideOutput": true, | ||
| "hideInput": true, | ||
| "isAdvancedMode": true, | ||
| "marshalOutGuids": true, | ||
| "iconDisplay": 2, | ||
| "inputParameters": [ | ||
| { | ||
| "name": "i_clouds", | ||
| "nickname": "i_clouds", | ||
| "description": "The point clouds to merge.", | ||
| "optional": false, | ||
| "allowTreeAccess": true, | ||
| "showTypeHints": true, | ||
| "scriptParamAccess": "list", | ||
| "wireDisplay": "default", | ||
| "sourceCount": 0, | ||
| "typeHintID": "pointcloud", | ||
| "flatten": true | ||
| } | ||
| ], | ||
| "outputParameters": [ | ||
| { | ||
| "name": "o_cloud", | ||
| "nickname": "o_cloud", | ||
| "description": "The merged point cloud.", | ||
| "optional": false, | ||
| "sourceCount": 0, | ||
| "graft": false | ||
| } | ||
| ] | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| from diffCheck import df_cvt_bindings as df_cvt | ||
|
|
||
| import Rhino | ||
| from Grasshopper.Kernel import GH_RuntimeMessageLevel as RML | ||
|
|
||
| from ghpythonlib.componentbase import executingcomponent as component | ||
|
|
||
| class DFCloudSubtract(component): | ||
| def __init__(self): | ||
| super(DFCloudSubtract, self).__init__() | ||
| def RunScript(self, | ||
| i_cloud_subtract_from: Rhino.Geometry.PointCloud, | ||
| i_cloud_subtract_with: Rhino.Geometry.PointCloud, | ||
| i_distance_threshold: float): | ||
| df_cloud = df_cvt.cvt_rhcloud_2_dfcloud(i_cloud_subtract_from) | ||
| df_cloud_substract = df_cvt.cvt_rhcloud_2_dfcloud(i_cloud_subtract_with) | ||
| if i_distance_threshold is None: | ||
| ghenv.Component.AddRuntimeMessage(RML.Warning, "Distance threshold not defined. 0.01 used as default value.")# noqa: F821 | ||
| i_distance_threshold = 0.01 | ||
| if i_distance_threshold <= 0: | ||
| ghenv.Component.AddRuntimeMessage(RML.Warning, "Distance threshold must be greater than 0. Please provide a valid distance threshold.")# noqa: F821 | ||
| return None | ||
| df_cloud.subtract_points(df_cloud_substract, i_distance_threshold) | ||
| rh_cloud = df_cvt.cvt_dfcloud_2_rhcloud(df_cloud) | ||
| return [rh_cloud] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.