@@ -375,6 +375,7 @@ def __post_init__(self):
375375
376376 self ._center : rg .Point3d = None
377377 self ._axis : rg .Line = self .compute_axis ()
378+ self ._plane = self .compute_plane ()
378379 self ._length : float = self ._axis .Length
379380
380381 self .__uuid = uuid .uuid4 ().int
@@ -506,6 +507,20 @@ def compute_axis(self, is_unitized: bool = True) -> rg.Line:
506507
507508 return axis_ln
508509
510+ def compute_plane (self ) -> rg .Plane :
511+ """
512+ This is an utility function that computes the plane of the beam.
513+ The plane is calculated using the beam's axis and the world Z axis.
514+
515+ :return plane: The plane of the beam
516+ """
517+ beam_direction = self .axis .Direction
518+ df_faces = [face for face in self .faces ]
519+ sorted_df_faces = sorted (df_faces , key = lambda face : Rhino .Geometry .AreaMassProperties .Compute (face ._rh_brepface ).Area if face ._rh_brepface else 0 , reverse = True )
520+ largest_side_face_normal = sorted_df_faces [0 ].normal
521+
522+ return rg .Plane (self .center , beam_direction , rg .Vector3d (largest_side_face_normal [0 ], largest_side_face_normal [1 ], largest_side_face_normal [2 ]))
523+
509524 def compute_joint_distances_to_midpoint (self ) -> typing .List [float ]:
510525 """
511526 This function computes the distances from the center of the beam to each joint.
@@ -666,6 +681,11 @@ def axis(self):
666681 self ._axis = self .compute_axis ()
667682 return self ._axis
668683
684+ @property
685+ def plane (self ):
686+ self ._plane = self .compute_plane ()
687+ return self ._plane
688+
669689 @property
670690 def length (self ):
671691 self ._length = self ._axis .Length
0 commit comments