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

Max distance to joint rules #385

Merged
merged 13 commits into from
Feb 10, 2025
Merged

Max distance to joint rules #385

merged 13 commits into from
Feb 10, 2025

Conversation

obucklin
Copy link
Contributor

@obucklin obucklin commented Feb 5, 2025

closes #182
This adds the max_distance argument to JointRule subclasses and GH components, allowing the max distance to be set for each JointRule.

What type of change is this?

  • 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)

Copy link
Contributor

@chenkasirer chenkasirer left a comment

Choose a reason for hiding this comment

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

Left a few comments but look good all in all.
One thing though, of all the changes, this one has the most potential of breaking something that used to work. so the correctness here will have to be validated by @jonashaldemann and the teaching team

src/compas_timber/design/workflow.py Outdated Show resolved Hide resolved
src/compas_timber/design/workflow.py Outdated Show resolved Hide resolved
Comment on lines 156 to 164
def comply(self, elements, model_max_distance=1e-6):
"""Returns True if the given elements comply with this DirectRule.
only checks if the distance between the centerlines of the elements is less than the max_distance.
allows joint topology overrides.
"""
if self.max_distance:
max_distance = self.max_distance
else:
max_distance = model_max_distance
Copy link
Contributor

Choose a reason for hiding this comment

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

use compas.tolerance.TOL here instead:

    def comply(self, elements, model_max_distance=None):       
        model_max_distance = model_max_distance or TOL.absolute
        if self.max_distance is not None:
            max_distance = self.max_distance
        else:
            max_distance = model_max_distance

Copy link
Contributor

Choose a reason for hiding this comment

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

To control the max_distance through Joint rules definitely makes sense to me, because until now we had to set it globally, and this was a bit too inflexible. Did you do some tests with a few Structures in Grasshopper?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To control the max_distance through Joint rules definitely makes sense to me, because until now we had to set it globally, and this was a bit too inflexible. Did you do some tests with a few Structures in Grasshopper?

I did some testing in GH, but the structures were not very complex. I added a bunch of unit tests, however.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chenkasirer @jonashaldemann I sent an invite for testing on Monday. I hope you guys are available. Maybe we can have a look at this then and then hopefully merge it for the big release.

Copy link
Contributor

@chenkasirer chenkasirer left a comment

Choose a reason for hiding this comment

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

LGTM

@obucklin obucklin merged commit e3844dd into main Feb 10, 2025
14 checks passed
@obucklin obucklin deleted the MAX_DISTANCE_to_joint_rules branch February 10, 2025 09:59
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.

Move max distance to the joint rule components
3 participants