77import Rhino
88import Rhino .Geometry as rg
99import scriptcontext as sc
10+ import numpy as np
1011
1112from diffCheck import diffcheck_bindings
1213
@@ -36,7 +37,7 @@ def cvt_rhcloud_2_dfcloud(rh_cloud) -> diffcheck_bindings.dfb_geometry.DFPointCl
3637
3738 # colors
3839 if rh_cloud .ContainsColors :
39- df_cloud .colors = [[c . R / 255.0 , c . G / 255.0 , c . B / 255.0 ] for c in rh_cloud .GetColors ()]
40+ df_cloud .colors = [[rh_c . R , rh_c . G , rh_c . B ] for rh_c in rh_cloud .GetColors ()]
4041
4142 return df_cloud
4243
@@ -63,13 +64,7 @@ def cvt_dfcloud_2_rhcloud(df_cloud):
6364
6465 df_cloud_points = [rg .Point3d (pt [0 ], pt [1 ], pt [2 ]) for pt in df_cloud_points ]
6566 df_cloud_normals = [rg .Vector3d (n [0 ], n [1 ], n [2 ]) for n in df_cloud_normals ]
66- df_cloud_colors = [Rhino .Display .Color4f (c [0 ], c [1 ], c [2 ], 1.0 ) for c in df_cloud_colors ]
67-
68-
69- # df_cloud_colors = []
70- # # convert the colors from 0-1 to 0-255
71- # for c in df_cloud_colors:
72- # df_cloud_colors.append(Rhino.Display.Color4f(c[0] * 255, c[1] * 255, c[2] * 255, 255))
67+ df_cloud_colors = [Rhino .Geometry .Vector3d (c [0 ], c [1 ], c [2 ]) for c in df_cloud_colors ]
7368
7469 rh_cloud = rg .PointCloud ()
7570
@@ -194,6 +189,7 @@ def cvt_dfxform_2_rhxform(df_xform : diffcheck_bindings.dfb_transformation.DFTra
194189 rh_xform = rh_xform * rg .Transform .Rotation (rotation [0 ], rg .Vector3d (rotation [1 ], rotation [2 ], rotation [3 ]), rg .Point3d (0 , 0 , 0 ))
195190
196191 return rh_xform
192+
197193def cvt_dfOBB_2_rhbrep (df_OBB ) -> rg .Box :
198194 """ Convert a diffCheck OBB to a Rhino Brep.
199195
@@ -222,4 +218,4 @@ def cvt_dfOBB_2_rhbrep(df_OBB) -> rg.Box:
222218 if not rh_obb_brep .IsSolid :
223219 raise ValueError ("The OBB Rhino Brep is not solid" )
224220
225- return rh_obb_brep
221+ return rh_obb_brep
0 commit comments