Skip to content

Commit

Permalink
addressed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
obucklin committed Jul 8, 2024
1 parent 95a8aa2 commit de8a499
Showing 1 changed file with 33 additions and 8 deletions.
41 changes: 33 additions & 8 deletions src/compas_timber/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ def beams(self):

# @property
# def plates(self):
# # type: () -> Generator[Plate]
# for element in self.elements():
# if isinstance(element, Plate):
# yield element
# # type: () -> Generator[Plate]
# for element in self.elements():
# if isinstance(element, Plate):
# yield element

@property
def joints(self):
Expand All @@ -87,7 +87,9 @@ def center_of_mass(self):
total_position = Point(0, 0, 0)

for element in self.elements():
vol = element.obb.volume # TODO: include material density...? this uses volume as proxy for mass, which assumes all parts have equal density
vol = (
element.obb.volume
) # TODO: include material density...? this uses volume as proxy for mass, which assumes all parts have equal density
point = element.obb.frame.point
total_vol += vol
total_position += point * vol
Expand Down Expand Up @@ -116,6 +118,29 @@ def element_by_guid(self, guid):
"""
return self._guid_element[guid]

def add_beam(self, beam):
# type: (Beam) -> None
"""Adds a Beam to this model.
Parameters
----------
beam : :class:`~compas_timber.elements.Beam`
The beam to add to the model.
"""
_ = self.add_element(beam)

def add_wall(self, wall):
# type: (Wall) -> None
"""Adds a Wall to this model.
Parameters
----------
wall : :class:`~compas_timber.elements.Wall`
The wall to add to the model.
"""
_ = self.add_element(wall)

def add_joint(self, joint, elements):
# type: (Joint, tuple[Element]) -> None
Expand All @@ -126,7 +151,7 @@ def add_joint(self, joint, elements):
interaction : :class:`~compas_timber.connections.Interaction`
An instance of Interaction class.
elements : tuple(:class:`~compas_timber.elements.Element`)
elements : tuple(:class:`~compas_model.elements.Element`)
The two elements that should be joined.
"""
Expand All @@ -145,8 +170,8 @@ def remove_joint(self, joint):
The joint to remove.
"""
a, b = joint.beams
super(TimberModel, self).remove_interaction(a, b)
a, b = joint.beams # TODO: make this generic elements not beams
super(TimberModel, self).remove_interaction(a, b) # TODO: Can two elements share more than one interaction?

def set_topologies(self, topologies):
"""TODO: calculate the topologies inside the model using the ConnectionSolver."""
Expand Down

0 comments on commit de8a499

Please sign in to comment.