Skip to content

Commit 90d1586

Browse files
authored
Merge pull request #17 from diffCheckOrg/PLY_loaders_ghcomponents
Ply loaders ghcomponents
2 parents 2f8e2b3 + 18df90b commit 90d1586

File tree

15 files changed

+33
-44
lines changed

15 files changed

+33
-44
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ If you want to use the GHEditor it's ok but everytime you modify the pakcage or
113113
### B.3) Componentize the code
114114
Prepare your component as explained here. You can componentize it locally and test it in Grasshopper. Here's how to componentize:
115115
```terminal
116-
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
116+
python .\invokes\ghcomponentize\ghcomponentizer.py --ghio "C:\Users\andre\.nuget\packages\grasshopper\8.2.23346.13001\lib\net48\" .\src\gh\components\ .\build\gh
117117
```
118118
> 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.
119119

src/gh/components/DF_load_cloud_from_file/code.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,33 @@
99
import Grasshopper as gh
1010
from Grasshopper.Kernel import GH_RuntimeMessageLevel as RML
1111

12-
import diffCheck
1312
from diffCheck import diffcheck_bindings
14-
import diffCheck.df_cvt_bindings
13+
from diffCheck import df_cvt_bindings
1514

1615
class DFLoadCloudFromFile(component):
1716
def RunScript(self,
1817
i_path: str,
1918
i_scalef: float) -> rg.PointCloud:
2019
"""
21-
Import a cloud from a file and scale it if needed.
20+
This component loads a point cloud from a .ply file.
2221
23-
:param i_path: path to the file
22+
:param i_path: path to the .ply file
2423
:param i_scalef: scale factor
2524
26-
:return o_out: rhino cloud
25+
:return o_rh_cloud: Rhino PointCloud
2726
"""
28-
# import and convert to rhino cloud
27+
# import and convert to Rhino Cloud
2928
df_cloud = diffcheck_bindings.dfb_geometry.DFPointCloud()
3029
df_cloud.load_from_PLY(i_path)
31-
rh_cloud = diffCheck.df_cvt_bindings.cvt_dfcloud_2_rhcloud(df_cloud)
30+
rh_cloud = df_cvt_bindings.cvt_dfcloud_2_rhcloud(df_cloud)
3231

3332
# scale if needed
3433
centroid = rh_cloud.GetBoundingBox(True).Center
3534
x_form_scale = rg.Transform.Scale(centroid, i_scalef)
3635
rh_cloud.Transform(x_form_scale)
37-
38-
return [rh_cloud] # do this to output 'Rhino.Geometry.PointCloud' instead of 'Rhino.Geometry.PointCloudItem'
36+
37+
return [rh_cloud]
38+
39+
# if __name__ == "__main__":
40+
# com = DFLoadCloudFromFile()
41+
# o_rh_cloud = com.RunScript(i_path, i_scalef)
-11.3 KB
Loading
12 KB
Loading

src/gh/components/DF_load_cloud_from_file/metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
{
1717
"name": "i_path",
1818
"nickname": "i_path",
19-
"description": "Path of the file (e.g. .ply) to import",
19+
"description": "Path to the .ply file to import",
2020
"optional": true,
2121
"allowTreeAccess": true,
2222
"showTypeHints": true,
@@ -42,7 +42,7 @@
4242
{
4343
"name": "o_rh_cloud",
4444
"nickname": "o_rh_cloud",
45-
"description": "The imported cloud in rhino format.",
45+
"description": "The imported point cloud as a Rhino object.",
4646
"optional": false,
4747
"sourceCount": 0,
4848
"graft": false

src/gh/components/DF_load_mesh_from_file/code.py

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,46 +9,33 @@
99
import Grasshopper as gh
1010
from Grasshopper.Kernel import GH_RuntimeMessageLevel as RML
1111

12-
import diffCheck
1312
from diffCheck import diffcheck_bindings
14-
import diffCheck.df_geometries
15-
import diffCheck.df_cvt_bindings
16-
13+
from diffCheck import df_cvt_bindings
1714

1815
class DFLoadMeshFromFile(component):
1916
def RunScript(self,
20-
i_path : str,
21-
i_scalef : float
22-
) -> rg.PointCloud:
17+
i_path: str,
18+
i_scalef: float) -> rg.Mesh:
2319
"""
24-
This compoonent load a mesh rhino from a ply file.
20+
This compoonent loads a Rhino mesh from a .ply file.
2521
26-
:param i_path: path to the ply file
22+
:param i_path: path to the .ply file
2723
:param i_scalef: scale factor
2824
29-
:return o_mesh: rhino mesh
25+
:return o_mesh: Rhino Mesh
3026
"""
31-
print(f"diffCheck version: {diffCheck.__version__}")
32-
33-
df_cloud = diffcheck_bindings.dfb_geometry.DFPointCloud()
34-
df_cloud.load_from_PLY(i_path)
35-
rgpoints = [rg.Point3d(pt[0], pt[1], pt[2]) for pt in df_cloud.points]
36-
rh_cloud = rg.PointCloud(rgpoints)
27+
# import and convert to Rhino Mesh
28+
df_mesh = diffcheck_bindings.dfb_geometry.DFMesh()
29+
df_mesh.load_from_PLY(i_path)
30+
rh_mesh = df_cvt_bindings.cvt_dfmesh_2_rhmesh(df_mesh)
3731

3832
# scale if needed
39-
centroid = rh_cloud.GetBoundingBox(True).Center
33+
centroid = rh_mesh.GetBoundingBox(True).Center
4034
x_form_scale = rg.Transform.Scale(centroid, i_scalef)
41-
rh_cloud.Transform(x_form_scale)
42-
43-
44-
rh_mesh = rh_cloud
45-
46-
return rh_mesh
35+
rh_mesh.Transform(x_form_scale)
4736

37+
return [rh_mesh]
4838

4939
# if __name__ == "__main__":
5040
# com = DFLoadMeshFromFile()
51-
# o_rh_mesh = com.RunScript(
52-
# i_path,n
53-
# i_scalef
54-
# )
41+
# o_rh_mesh = com.RunScript(i_path, i_scalef)
-11.2 KB
Loading
15.4 KB
Loading

src/gh/components/DF_load_mesh_from_file/metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
{
1717
"name": "i_path",
1818
"nickname": "i_path",
19-
"description": "Path of the file (e.g. .ply) to import",
19+
"description": "Path to the .ply file to import",
2020
"optional": true,
2121
"allowTreeAccess": true,
2222
"showTypeHints": true,
@@ -42,7 +42,7 @@
4242
{
4343
"name": "o_rh_mesh",
4444
"nickname": "o_rh_mesh",
45-
"description": "The imported mesh.",
45+
"description": "The imported mesh as a Rhino object.",
4646
"optional": false,
4747
"sourceCount": 0,
4848
"graft": false

src/gh/diffCheck/diffCheck.egg-info/PKG-INFO

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@ Summary: DiffCheck is a package to check the differences between two timber stru
55
Home-page: https://github.com/diffCheckOrg/diffCheck
66
Author: Andrea Settimi, Damien Gilliard, Eleni Skevaki, Marirena Kladeftira, Julien Gamerro, Stefana Parascho, and Yves Weinand
77
Author-email: andrea.settimi@epfl.ch
8-
License: UNKNOWN
9-
Platform: UNKNOWN
108
Classifier: License :: OSI Approved :: MIT License
119
Classifier: Programming Language :: Python :: 3
1210
Classifier: Programming Language :: Python :: 3.9
1311
Description-Content-Type: text/markdown
12+
Requires-Dist: numpy
13+
Requires-Dist: pybind11>=2.5.0
1414

1515
# DiffCheck Grasshopper Plugin
1616

1717
DiffCheck is a plugin for Rhino/Grasshopper that allows the user to compare a 3D model with its scan.
1818

1919
More information to come
20-

0 commit comments

Comments
 (0)