Skip to content

Commit 35cfe5b

Browse files
authored
Merge pull request #35 from diffCheckOrg/patch_color_convertion_bug
FIX for Patch color convertion bug
2 parents 803fee2 + 5aff72f commit 35cfe5b

File tree

3 files changed

+951
-30
lines changed

3 files changed

+951
-30
lines changed

src/gh/components/DF_tester/code.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from Grasshopper.Kernel import GH_RuntimeMessageLevel as RML
1111

1212
import diffCheck
13+
import diffCheck.df_cvt_bindings
1314
from diffCheck import diffcheck_bindings
1415

1516
class DFTester(component):

src/gh/diffCheck/diffCheck/df_cvt_bindings.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import Rhino
88
import Rhino.Geometry as rg
99
import scriptcontext as sc
10+
import numpy as np
1011

1112
from 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 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,7 +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+
df_cloud_colors = [Rhino.Geometry.Vector3d(c[0], c[1], c[2]) for c in df_cloud_colors]
6768

6869
rh_cloud = rg.PointCloud()
6970

@@ -188,6 +189,7 @@ def cvt_dfxform_2_rhxform(df_xform : diffcheck_bindings.dfb_transformation.DFTra
188189
rh_xform = rh_xform * rg.Transform.Rotation(rotation[0], rg.Vector3d(rotation[1], rotation[2], rotation[3]), rg.Point3d(0, 0, 0))
189190

190191
return rh_xform
192+
191193
def cvt_dfOBB_2_rhbrep(df_OBB) -> rg.Box:
192194
""" Convert a diffCheck OBB to a Rhino Brep.
193195

0 commit comments

Comments
 (0)