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

Update hash_value #171

Closed
billingsley-john opened this issue Aug 6, 2020 · 2 comments
Closed

Update hash_value #171

billingsley-john opened this issue Aug 6, 2020 · 2 comments
Assignees

Comments

@billingsley-john
Copy link

hash_value is currently calculated individually for each parametric_shape by specifying each parameter individually. This needs to be changed so that the get_hash method calculates the hash_value by automatically detecting the class parameters

@billingsley-john
Copy link
Author

billingsley-john commented Aug 6, 2020

UPDATE: hash_value can be calculated using self._dict_.values(). Note - _solid and _hash_value must not be calculated as part of the hash to prevent constant reconstruction.
This works well for parametric_shapes but there is a BUG when this propagates to parametric_components.

EXPECTED:

  • On first call of shape.solid, create_solid() should be called.
  • On second call of shape.solid, create_solid() should NOT be called IF no parameters have changed.

ACTUAL:

  • On first call of shape.solid, create_solid() is called. (EXPECTED)
  • On second call of shape.solid, create_solid() called again, despite no parameters being changed. (UNEXPECTED)
  • On third call of shape.solid, create_solid() is not called. (EXPECTED)

REASON:

  • shape.points = None upon class initialization/construction
  • First call of shape.solid doesn't seem to update shape.points correctly for the hash calculation
  • Therefore, second call of shape.solid compares new calculated points to None.
  • I.e. the point at which points is calculated in the solid construction chain and the point where the hash is calculated causes this issue.

@billingsley-john billingsley-john self-assigned this Aug 6, 2020
@billingsley-john
Copy link
Author

FIX: Move hash_value calculation to AFTER solid construction. This allows shape.points to be populated correctly before the hash_value for the new solid is calculated.

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

No branches or pull requests

1 participant