diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 76957eba..fbe4b614 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -113,7 +113,7 @@ If you want to use the GHEditor it's ok but everytime you modify the pakcage or ### B.3) Componentize the code Prepare your component as explained here. You can componentize it locally and test it in Grasshopper. Here's how to componentize: ```terminal -python f:\diffCheck\src\gh\util\componentizer_cpy.py --ghio "C:\Users\andre\.nuget\packages\grasshopper\8.2.23346.13001\lib\net48\" .\src\gh\components\ .\build\gh +python .\invokes\ghcomponentize\ghcomponentizer.py --ghio "C:\Users\andre\.nuget\packages\grasshopper\8.2.23346.13001\lib\net48\" .\src\gh\components\ .\build\gh ``` > Note that you need to find the path to your GHIO folder. This is the folder where the `Grasshopper.dll` is located. E.g. You can find it in the `nuget` folder in the Rhino installation directory. diff --git a/src/gh/components/DF_load_cloud_from_file/code.py b/src/gh/components/DF_load_cloud_from_file/code.py index fc50b7b0..73b45c0f 100644 --- a/src/gh/components/DF_load_cloud_from_file/code.py +++ b/src/gh/components/DF_load_cloud_from_file/code.py @@ -9,30 +9,33 @@ import Grasshopper as gh from Grasshopper.Kernel import GH_RuntimeMessageLevel as RML -import diffCheck from diffCheck import diffcheck_bindings -import diffCheck.df_cvt_bindings +from diffCheck import df_cvt_bindings class DFLoadCloudFromFile(component): def RunScript(self, i_path: str, i_scalef: float) -> rg.PointCloud: """ - Import a cloud from a file and scale it if needed. + This component loads a point cloud from a .ply file. - :param i_path: path to the file + :param i_path: path to the .ply file :param i_scalef: scale factor - :return o_out: rhino cloud + :return o_rh_cloud: Rhino PointCloud """ - # import and convert to rhino cloud + # import and convert to Rhino Cloud df_cloud = diffcheck_bindings.dfb_geometry.DFPointCloud() df_cloud.load_from_PLY(i_path) - rh_cloud = diffCheck.df_cvt_bindings.cvt_dfcloud_2_rhcloud(df_cloud) + rh_cloud = df_cvt_bindings.cvt_dfcloud_2_rhcloud(df_cloud) # scale if needed centroid = rh_cloud.GetBoundingBox(True).Center x_form_scale = rg.Transform.Scale(centroid, i_scalef) rh_cloud.Transform(x_form_scale) - - return [rh_cloud] # do this to output 'Rhino.Geometry.PointCloud' instead of 'Rhino.Geometry.PointCloudItem' \ No newline at end of file + + return [rh_cloud] + +# if __name__ == "__main__": +# com = DFLoadCloudFromFile() +# o_rh_cloud = com.RunScript(i_path, i_scalef) \ No newline at end of file diff --git a/src/gh/components/DF_load_cloud_from_file/icon.png b/src/gh/components/DF_load_cloud_from_file/icon.png index 33ecc1b4..37b7125a 100644 Binary files a/src/gh/components/DF_load_cloud_from_file/icon.png and b/src/gh/components/DF_load_cloud_from_file/icon.png differ diff --git a/src/gh/components/DF_load_cloud_from_file/icon_old.png b/src/gh/components/DF_load_cloud_from_file/icon_old.png new file mode 100644 index 00000000..33ecc1b4 Binary files /dev/null and b/src/gh/components/DF_load_cloud_from_file/icon_old.png differ diff --git a/src/gh/components/DF_load_cloud_from_file/metadata.json b/src/gh/components/DF_load_cloud_from_file/metadata.json index afc81220..3e5b9d9e 100644 --- a/src/gh/components/DF_load_cloud_from_file/metadata.json +++ b/src/gh/components/DF_load_cloud_from_file/metadata.json @@ -16,7 +16,7 @@ { "name": "i_path", "nickname": "i_path", - "description": "Path of the file (e.g. .ply) to import", + "description": "Path to the .ply file to import", "optional": true, "allowTreeAccess": true, "showTypeHints": true, @@ -42,7 +42,7 @@ { "name": "o_rh_cloud", "nickname": "o_rh_cloud", - "description": "The imported cloud in rhino format.", + "description": "The imported point cloud as a Rhino object.", "optional": false, "sourceCount": 0, "graft": false diff --git a/src/gh/components/DF_load_mesh_from_file/code.py b/src/gh/components/DF_load_mesh_from_file/code.py index baa1fac8..0eba78f6 100644 --- a/src/gh/components/DF_load_mesh_from_file/code.py +++ b/src/gh/components/DF_load_mesh_from_file/code.py @@ -9,46 +9,33 @@ import Grasshopper as gh from Grasshopper.Kernel import GH_RuntimeMessageLevel as RML -import diffCheck from diffCheck import diffcheck_bindings -import diffCheck.df_geometries -import diffCheck.df_cvt_bindings - +from diffCheck import df_cvt_bindings class DFLoadMeshFromFile(component): def RunScript(self, - i_path : str, - i_scalef : float - ) -> rg.PointCloud: + i_path: str, + i_scalef: float) -> rg.Mesh: """ - This compoonent load a mesh rhino from a ply file. + This compoonent loads a Rhino mesh from a .ply file. - :param i_path: path to the ply file + :param i_path: path to the .ply file :param i_scalef: scale factor - :return o_mesh: rhino mesh + :return o_mesh: Rhino Mesh """ - print(f"diffCheck version: {diffCheck.__version__}") - - df_cloud = diffcheck_bindings.dfb_geometry.DFPointCloud() - df_cloud.load_from_PLY(i_path) - rgpoints = [rg.Point3d(pt[0], pt[1], pt[2]) for pt in df_cloud.points] - rh_cloud = rg.PointCloud(rgpoints) + # import and convert to Rhino Mesh + df_mesh = diffcheck_bindings.dfb_geometry.DFMesh() + df_mesh.load_from_PLY(i_path) + rh_mesh = df_cvt_bindings.cvt_dfmesh_2_rhmesh(df_mesh) # scale if needed - centroid = rh_cloud.GetBoundingBox(True).Center + centroid = rh_mesh.GetBoundingBox(True).Center x_form_scale = rg.Transform.Scale(centroid, i_scalef) - rh_cloud.Transform(x_form_scale) - - - rh_mesh = rh_cloud - - return rh_mesh + rh_mesh.Transform(x_form_scale) + return [rh_mesh] # if __name__ == "__main__": # com = DFLoadMeshFromFile() -# o_rh_mesh = com.RunScript( -# i_path,n -# i_scalef -# ) \ No newline at end of file +# o_rh_mesh = com.RunScript(i_path, i_scalef) \ No newline at end of file diff --git a/src/gh/components/DF_load_mesh_from_file/icon.png b/src/gh/components/DF_load_mesh_from_file/icon.png index 489bc69f..2c8f88a9 100644 Binary files a/src/gh/components/DF_load_mesh_from_file/icon.png and b/src/gh/components/DF_load_mesh_from_file/icon.png differ diff --git a/src/gh/components/DF_load_mesh_from_file/icon_old.png b/src/gh/components/DF_load_mesh_from_file/icon_old.png new file mode 100644 index 00000000..489bc69f Binary files /dev/null and b/src/gh/components/DF_load_mesh_from_file/icon_old.png differ diff --git a/src/gh/components/DF_load_mesh_from_file/metadata.json b/src/gh/components/DF_load_mesh_from_file/metadata.json index 4adc86ce..8a57bc99 100644 --- a/src/gh/components/DF_load_mesh_from_file/metadata.json +++ b/src/gh/components/DF_load_mesh_from_file/metadata.json @@ -16,7 +16,7 @@ { "name": "i_path", "nickname": "i_path", - "description": "Path of the file (e.g. .ply) to import", + "description": "Path to the .ply file to import", "optional": true, "allowTreeAccess": true, "showTypeHints": true, @@ -42,7 +42,7 @@ { "name": "o_rh_mesh", "nickname": "o_rh_mesh", - "description": "The imported mesh.", + "description": "The imported mesh as a Rhino object.", "optional": false, "sourceCount": 0, "graft": false diff --git a/src/gh/diffCheck/diffCheck.egg-info/PKG-INFO b/src/gh/diffCheck/diffCheck.egg-info/PKG-INFO index 0e75ec4d..da8c1896 100644 --- a/src/gh/diffCheck/diffCheck.egg-info/PKG-INFO +++ b/src/gh/diffCheck/diffCheck.egg-info/PKG-INFO @@ -5,16 +5,15 @@ Summary: DiffCheck is a package to check the differences between two timber stru Home-page: https://github.com/diffCheckOrg/diffCheck Author: Andrea Settimi, Damien Gilliard, Eleni Skevaki, Marirena Kladeftira, Julien Gamerro, Stefana Parascho, and Yves Weinand Author-email: andrea.settimi@epfl.ch -License: UNKNOWN -Platform: UNKNOWN Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.9 Description-Content-Type: text/markdown +Requires-Dist: numpy +Requires-Dist: pybind11>=2.5.0 # DiffCheck Grasshopper Plugin DiffCheck is a plugin for Rhino/Grasshopper that allows the user to compare a 3D model with its scan. More information to come - diff --git a/src/gh/diffCheck/diffCheck/__pycache__/__init__.cpython-39.pyc b/src/gh/diffCheck/diffCheck/__pycache__/__init__.cpython-39.pyc index 7a72282f..ae1f77c9 100644 Binary files a/src/gh/diffCheck/diffCheck/__pycache__/__init__.cpython-39.pyc and b/src/gh/diffCheck/diffCheck/__pycache__/__init__.cpython-39.pyc differ diff --git a/src/gh/diffCheck/diffCheck/__pycache__/df_geometries.cpython-39.pyc b/src/gh/diffCheck/diffCheck/__pycache__/df_geometries.cpython-39.pyc index caac3f46..fb80666a 100644 Binary files a/src/gh/diffCheck/diffCheck/__pycache__/df_geometries.cpython-39.pyc and b/src/gh/diffCheck/diffCheck/__pycache__/df_geometries.cpython-39.pyc differ diff --git a/src/gh/diffCheck/diffCheck/__pycache__/df_joint_detector.cpython-39.pyc b/src/gh/diffCheck/diffCheck/__pycache__/df_joint_detector.cpython-39.pyc index 82c696b9..883f202c 100644 Binary files a/src/gh/diffCheck/diffCheck/__pycache__/df_joint_detector.cpython-39.pyc and b/src/gh/diffCheck/diffCheck/__pycache__/df_joint_detector.cpython-39.pyc differ diff --git a/src/gh/diffCheck/diffCheck/__pycache__/df_transformations.cpython-39.pyc b/src/gh/diffCheck/diffCheck/__pycache__/df_transformations.cpython-39.pyc index 5c882e72..b2fd1333 100644 Binary files a/src/gh/diffCheck/diffCheck/__pycache__/df_transformations.cpython-39.pyc and b/src/gh/diffCheck/diffCheck/__pycache__/df_transformations.cpython-39.pyc differ diff --git a/src/gh/diffCheck/diffCheck/__pycache__/df_util.cpython-39.pyc b/src/gh/diffCheck/diffCheck/__pycache__/df_util.cpython-39.pyc index c27d9906..b4345ca0 100644 Binary files a/src/gh/diffCheck/diffCheck/__pycache__/df_util.cpython-39.pyc and b/src/gh/diffCheck/diffCheck/__pycache__/df_util.cpython-39.pyc differ