Skip to content

Commit

Permalink
coplanarity condition for t-stepjoint
Browse files Browse the repository at this point in the history
  • Loading branch information
papachap committed Sep 5, 2024
1 parent fcb4f60 commit c24476d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/compas_timber/connections/joint.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ def _beam_ref_side_incidence_with_vector(beam_b, vector, ignore_ends=True):

return ref_side_angles

@staticmethod
def _are_beams_coplanar(beam_a, beam_b, tolerance=1e-3):
"""
Checks if two beams are coplanar based on the cross product of their centerline directions.
Expand All @@ -356,7 +357,6 @@ def _are_beams_coplanar(beam_a, beam_b, tolerance=1e-3):
True if the beams are coplanar, False otherwise.
"""
# Compute the cross product of the centerline directions of the two beams
print(beam_a, beam_b)
cross_product = beam_a.centerline.direction.cross(beam_b.centerline.direction)

# Check dot products of the cross product with the normals of both beams' frames
Expand Down
14 changes: 12 additions & 2 deletions src/compas_timber/connections/t_step_joint.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,11 @@ def cross_beam_ref_side_index(self):

@property
def main_beam_ref_side_index(self):
ref_side_dict = self._beam_ref_side_incidence(self.cross_beam, self.main_beam, ignore_ends=True)
ref_side_index = min(ref_side_dict, key=ref_side_dict.get)
cross_beam_ref_side = self.cross_beam.ref_sides[self.cross_beam_ref_side_index]
ref_side_dict = self._beam_ref_side_incidence_with_vector(
self.main_beam, cross_beam_ref_side.normal, ignore_ends=True
)
ref_side_index = max(ref_side_dict, key=ref_side_dict.get)
return ref_side_index

def add_features(self):
Expand All @@ -110,14 +113,21 @@ def add_features(self):
This method is automatically called when joint is created by the call to `Joint.create()`.
"""
# TODO: In the future the step, heel and tenon mortise depths should be proportional to the cross beam section wheareas the proportions are defined by the national norms.
# TODO: As well the step shape should maybe be defined automatically by the shear reqirements of the joint.

assert self.main_beam and self.cross_beam # should never happen
assert self._are_beams_coplanar(
self.main_beam, self.cross_beam
), "The beams are not coplanar, the joint cannot be created."

if self.features:
self.main_beam.remove_features(self.features)
self.cross_beam.remove_features(self.features)

main_beam_ref_side = self.main_beam.ref_sides[self.main_beam_ref_side_index]
cross_beam_ref_side = self.cross_beam.ref_sides[self.cross_beam_ref_side_index]

# generate step joint notch features
cross_feature = StepJointNotch.from_plane_and_beam(
main_beam_ref_side,
Expand Down

0 comments on commit c24476d

Please sign in to comment.