Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X/T/L HalfLap rework & Lap Volume viz adjustment #340

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open

Conversation

papachap
Copy link
Contributor

@papachap papachap commented Dec 5, 2024

image

What type of change is this?

This PR concerns the rework of the HalfLap joints (X,T,L) so that they use the Lap process instead. For the time being, they can allow half laps for beams that are aligned (meaning that their z_vectors are either perpendicular or parallel). In the future, the Lap process should support non-aligned configurations. However, this requires first defining a clear logic for extracting the BTLx parameters of the Lap process from the given geometry.

In this PR, the generation of the lap volume was adjusted to fully utilize all relevant BTLx parameters, ensuring more accurate visualization of the Lap process.

  • Bug fix in a backwards-compatible manner.
  • New feature in a backwards-compatible manner.
  • Breaking change: bug fix or new feature that involve incompatible API changes.
  • Other (e.g. doc update, configuration, etc)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I added a line to the CHANGELOG.md file in the Unreleased section under the most fitting heading (e.g. Added, Changed, Removed).
  • I ran all tests on my computer and it's all green (i.e. invoke test).
  • I ran lint on my computer and there are no errors (i.e. invoke lint).
  • I added new functions/classes and made them available on a second-level import, e.g. compas_timber.datastructures.Beam.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate)

@papachap papachap changed the title X/T/L HalfLaps rework & Lap Volume viz adjustment X/T/L HalfLap rework & Lap Volume viz adjustment Dec 5, 2024
@papachap papachap linked an issue Dec 5, 2024 that may be closed by this pull request
@papachap
Copy link
Contributor Author

papachap commented Dec 6, 2024

There’s quite a bit of repeated code across the X, T, and L joint modules. This might be a good chance to decide what we can generalize and make accessible at a higher level to avoid duplication and keep things cleaner. @chenkasirer @obucklin

@papachap
Copy link
Contributor Author

@chenkasirer @obucklin I pulled the latest changes from main and merged them. Ready for review

src/compas_timber/_fabrication/lap.py Outdated Show resolved Hide resolved
src/compas_timber/connections/l_halflap.py Outdated Show resolved Hide resolved
from .solver import JointTopology


class LHalfLapJoint(LapJoint):
class LHalfLapJoint(Joint):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so are we sure we want to get rid of the LapJoint class? discussed with @obucklin as well?

Copy link
Contributor Author

@papachap papachap Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think we can drop the current LapJoint class since it’s no longer relevant or needed. To keep things cleaner and avoid redundancy, we should combine the XHalfLapJoint, LHalfLapJoint, and THalfLapJoint into one class—maybe call it HalfLapJoint or just LapJoint (same thing that we are doing for the TenonMortiseJoint). Since SUPPORTED_TOPOLOGY is already a list, with some adjustments we can handle all the topologies (X, L, T) in the same class and avoid repeating the same logic in three places.

@obucklin @chenkasirer what do you guys think?

Comment on lines +72 to +100
@property
def beam_a_ref_side_index(self):
cross_vector = self.beam_a.centerline.direction.cross(self.beam_b.centerline.direction)
ref_side_dict = beam_ref_side_incidence_with_vector(self.beam_a, cross_vector, ignore_ends=True)
if self.flip_lap_side:
return max(ref_side_dict, key=ref_side_dict.get)
return min(ref_side_dict, key=ref_side_dict.get)

@property
def beam_b_ref_side_index(self):
cross_vector = self.beam_a.centerline.direction.cross(self.beam_b.centerline.direction)
ref_side_dict = beam_ref_side_incidence_with_vector(self.beam_b, cross_vector, ignore_ends=True)
if self.flip_lap_side:
return min(ref_side_dict, key=ref_side_dict.get)
return max(ref_side_dict, key=ref_side_dict.get)

@property
def cutting_plane_a(self):
# the plane that cuts beam_a as a planar surface
ref_side_dict = beam_ref_side_incidence(self.beam_a, self.beam_b, ignore_ends=True)
ref_side_index = max(ref_side_dict, key=ref_side_dict.get)
return self.beam_b.side_as_surface(ref_side_index)

@property
def cutting_plane_b(self):
# the plane that cuts beam_b as a planar surface
ref_side_dict = beam_ref_side_incidence(self.beam_b, self.beam_a, ignore_ends=True)
ref_side_index = max(ref_side_dict, key=ref_side_dict.get)
return self.beam_a.side_as_surface(ref_side_index)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these look very similar to the ones above, are they the same.
if we don't want these in a parent class, maybe they could be moved into a new higher level function(s) in our joinery toolkit modules where they return what's needed (index of surface) instead of the dictionary.

Then they can be called once in add_features this will be more readable, will have less duplication code and will potentially be more performant as some of these properties end up being called multiple times.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, there’s definitely some redundancy here. The first pair of properties is for getting the ref_side for the Lap Processing of each beam, and the second pair is for calculating the planes needed for the alternative constructor of the Lap class. Even though each pair uses a different function to figure out the incidence, the two properties in each pair use the same function, so there’s some code repetition.

I’m not really a fan of generalizing this into something like get_ref_side_index() or get_cutting_plane() since each joint has its own way of calculating these values. It could make things less flexible and harder to adapt for different joint types.

What I’d suggest is converting these properties into lists and iterating through the beams to calculate the planes for each one. That would clean up the code, cut down on duplication, and make it easier to read.

what do you think?

src/compas_timber/connections/l_halflap.py Outdated Show resolved Hide resolved
src/compas_timber/connections/x_halflap.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Re-work Half-lap joints to use the Lap process
2 participants