Skip to content

Commit

Permalink
Merge pull request #278 from gramaziokohler/beam_key
Browse files Browse the repository at this point in the history
key is back, back again
  • Loading branch information
chenkasirer authored Sep 11, 2024
2 parents 67b8149 + 709f646 commit f426c7d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Added attribute `plates` to `TimberModel`.
* Added `SurfaceModelJointOverride` GH Component
* Added `ShowSurfaceModelBeamType` GH Component
* Re-introduced attribute `key` in `Beam`.
* Added attribute `key` to `Plate`.

### Changed

Expand Down
9 changes: 8 additions & 1 deletion src/compas_timber/elements/beam.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ class Beam(Element):
A list containing the 4 lines along the long axis of this beam.
midpoint : :class:`~compas.geometry.Point`
The point at the middle of the centerline of this beam.
key : int, optional
Once beam is added to a model, it will have this model-wide-unique integer key.
"""

Expand Down Expand Up @@ -236,9 +238,14 @@ def midpoint(self):

@property
def has_features(self):
# TODO: move to compas_future... Part
# TODO: consider removing, this is not used anywhere
return len(self.features) > 0

@property
def key(self):
# type: () -> int | None
return self.graph_node

def __str__(self):
return "Beam {:.3f} x {:.3f} x {:.3f} at {}".format(
self.width,
Expand Down
10 changes: 8 additions & 2 deletions src/compas_timber/elements/plate.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class Plate(Element):
Thickness of the plate material.
aabb : tuple(float, float, float, float, float, float)
An axis-aligned bounding box of this plate as a 6 valued tuple of (xmin, ymin, zmin, xmax, ymax, zmax).
key : int, optional
Once plate is added to a model, it will have this model-wide-unique integer key.
"""

Expand Down Expand Up @@ -91,9 +92,14 @@ def shape(self):

@property
def has_features(self):
# TODO: move to compas_future... Part
# TODO: consider removing, this is not used anywhere
return len(self.features) > 0

@property
def key(self):
# type: () -> int | None
return self.graph_node

# ==========================================================================
# Implementations of abstract methods
# ==========================================================================
Expand Down

0 comments on commit f426c7d

Please sign in to comment.