Skip to content

Commit 9c35628

Browse files
committed
FIX: solved the preview for beams by adding vertices prop to beam
1 parent abd6208 commit 9c35628

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

deps/eigen

Submodule eigen updated from c5189ac to 84282c4

src/gh/components/DF_preview_assembly/code.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import System
44

5+
import typing
6+
57
import Rhino.Geometry as rg
68

79
from ghpythonlib.componentbase import executingcomponent as component
@@ -28,10 +30,15 @@ def RunScript(self, i_assembly: DFAssembly=None):
2830
# Preview overrides
2931
def DrawViewportWires(self, args):
3032
for beam in self._dfassembly.beams:
33+
#######################################
34+
## DFBeams
35+
#######################################
3136
# beams' obb
3237
df_cloud = diffCheck.diffcheck_bindings.dfb_geometry.DFPointCloud()
33-
df_cloud.points = [np.array([vertex.Location.X, vertex.Location.Y, vertex.Location.Z]).reshape(3, 1) for vertex in beam.to_brep().Vertices]
38+
vertices_pt3d_rh : typing.List[rg.Point3d] = [vertex.to_rg_point3d() for vertex in beam.vertices]
39+
df_cloud.points = [np.array([vertex.X, vertex.Y, vertex.Z]).reshape(3, 1) for vertex in vertices_pt3d_rh]
3440
obb: rg.Brep = diffCheck.df_cvt_bindings.cvt_dfOBB_2_rhbrep(df_cloud.get_tight_bounding_box())
41+
args.Display.DrawBrepWires(obb, System.Drawing.Color.Red)
3542

3643
# axis arrow
3744
obb_faces = obb.Faces
@@ -49,3 +56,7 @@ def DrawViewportWires(self, args):
4956
System.Drawing.Color.Violet,
5057
anchor_pt,
5158
True, 18)
59+
60+
#######################################
61+
## DFJoints
62+
#######################################

src/gh/diffCheck/diffCheck/df_geometries.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ def __post_init__(self):
287287
self.faces = self.faces or []
288288
self._joint_faces = []
289289
self._side_faces = []
290+
self._vertices = []
290291

291292
self._joints = []
292293

@@ -388,6 +389,15 @@ def index_assembly(self):
388389
raise ValueError("The beam is not added to an assembly")
389390
return self._index_assembly
390391

392+
@property
393+
def vertices(self):
394+
self._vertices = []
395+
for face in self.faces:
396+
all_loops_cpy = face.all_loops.copy()
397+
for loop in all_loops_cpy:
398+
self._vertices.extend(loop)
399+
return self._vertices
400+
391401

392402
@dataclass
393403
class DFAssembly:

0 commit comments

Comments
 (0)