compas_timber.model
¤
Classes¤
TimberModel
¤
Represents a timber model containing different elements such as panels, beams and joints.
The timber model allows expressing the hierarchy and interactions between the different elements it contains.
Attributes:
-
beams(Generator[:class:`~compas_timber.elements.Beam`]) –A Generator object of all beams assigned to this model.
-
plates(Generator[:class:`~compas_timber.elements.Plate`]) –A Generator object of all plates assigned to this model.
-
joints(set[:class:`~compas_timber.connections.Joint`]) –A set of all actual joints assigned to this model.
-
joint_candidates(set[:class:`~compas_timber.connections.JointCandidate`]) –A set of all joint candidates in the model.
-
panels(Generator[:class:`~compas_timber.elements.Panel`]) –A Generator object of all panels assigned to this model.
-
center_of_mass(:class:`~compas.geometry.Point`) –The calculated center of mass of the model.
-
topologies(list(dict)) –A list of JointTopology for model. dict is: {"detected_topo": detected_topo, "beam_a_key": beam_a_key, "beam_b_key":beam_b_key} See :class:
~compas_timber.connections.JointTopology. -
tolerance(:class:`~compas.tolerance.Tolerance`) –The tolerance configuration used for this model. TOL if none provided.
-
volume(float) –The calculated total volume of the model.
Functions¤
__getitem__
¤
Get an element by its unique identifier.
Parameters:
-
guid(str) –The GUID of the element to retrieve.
Returns:
-
class:`~compas_model.elements.Element`–The element with the specified GUID.
add_beam_structural_segments
¤
Adds a structural segment to the model node corresponding to the given beam.
Notes
Normally, this method shouldn't be called directy. Use :meth:create_beam_structural_segments when possible to add structural segments.
Parameters:
-
beam(:class:`~compas_timber.elements.Beam`) –The beam to which the structural segments belong.
-
segments(list[:class:`~compas_timber.structural.StructuralSegment`]) –The structural segments to add.
add_joint
¤
Add a joint object to the model.
Parameters:
-
joint(:class:`~compas_timber.connections.joint`) –An instance of a Joint class.
add_joint_candidate
¤
Add a joint candidate to the model.
Joint candidates are stored on the graph edges under the "candidate" attribute, separate from actual joints which are stored under the "interaction" attribute.
Parameters:
-
candidate(:class:`~compas_timber.connections.JointCandidate`) –An instance of a JointCandidate class.
add_structural_connector_segments
¤
add_structural_connector_segments(
element_a: Element, element_b: Element, segments: list[StructuralSegment]
) -> None
Adds structural segments to the interaction (edge) between two elements.
Notes
Normally, this method shouldn't be called directy. Use :meth:create_beam_structural_segments when possible to add structural segments.
Parameters:
-
element_a(:class:`~compas_timber.elements.TimberElement`) –The first element.
-
element_b(:class:`~compas_timber.elements.TimberElement`) –The second element.
-
segments(list[:class:`~compas_timber.structural.StructuralSegment`]) –The structural segments to add.
connect_adjacent_panels
¤
Connects adjacent plates in the model.
Parameters:
-
max_distance(float, default:None) –The maximum distance between plates to consider them adjacent. Default is 0.0.
connect_adjacent_plates
¤
Connects adjacent plates in the model.
Parameters:
-
max_distance(float, default:None) –The maximum distance between plates to consider them adjacent. Default is 0.0.
create_beam_structural_segments
¤
Creates structural segments for all beams in the model based on their joints.
Parameters:
-
solver(:class:`~compas_timber.structural.BeamStructuralElementSolver`, default:None) –The solver to use for creating structural segments. If not provided, a default solver is created.
element_by_guid
¤
DEPRECATED Get an element by its unique identifier.
Parameters:
-
guid(str) –The GUID of the element to retrieve.
Returns:
-
class:`~compas_model.elements.Element`–The element with the specified GUID.
get_beam_structural_segments
¤
Gets the structural segments assigned to the given beam.
Parameters:
-
beam(:class:`~compas_timber.elements.Beam`) –The beam whose structural segments to retrieve.
Returns:
-
list[:class:`~compas_timber.structural.StructuralSegment`]–The structural segments assigned to the beam.
get_candidates_for_element
¤
get_candidates_for_element(element) -> list[JointCandidate]
Get all joint candidates for a given element.
Parameters:
-
element(:class:`~compas_model.elements.Element`) –The element to query.
Returns:
-
list[:class:`~compas_timber.connections.JointCandidate`]–A list of joint candidates for the given element.
get_element
¤
Get an element by its unique identifier.
Parameters:
-
guid(str) –The GUID of the element to retrieve.
Returns:
-
class:`~compas_model.elements.Element` or None–The element with the specified GUID. None if an element with this GUID is not in the Model.
get_elements_in_group
¤
Get all elements in a group element.
Todo
upstream this to compas_model
Parameters:
-
group_element(:class:`~compas_timber.elements.TimberElement`) –The group element to query.
-
filter_(callable, default:None) –A filter function to apply to the elements.
Returns:
-
Generator[:class:`~compas_timber.elements.TimberElement`]–A generator of elements in the group.
get_interactions_for_element
¤
Get all interactions (joints and candidates) for a given element.
Parameters:
-
element(:class:`~compas_model.elements.Element`) –The element to query.
Returns:
-
list[:class:`~compas_model.interactions.Interaction`]–A list of interactions for the given element.
get_joints_for_element
¤
Get all joints for a given element.
Parameters:
-
element(:class:`~compas_model.elements.Element`) –The element to query.
Returns:
-
list[:class:`~compas_timber.connections.Joint`]–A list of joints for the given element.
get_structural_connector_segments
¤
get_structural_connector_segments(
element_a: Element, element_b: Element
) -> list[StructuralSegment]
Gets the structural segments assigned to the interaction between two elements.
Parameters:
-
element_a(:class:`~compas_timber.elements.TimberElement`) –The first element.
-
element_b(:class:`~compas_timber.elements.TimberElement`) –The second element.
Returns:
-
list[:class:`~compas_timber.structural.StructuralSegment`]–The structural segments assigned to the interaction.
has_group
¤
Check if a group with group_element exists in the model.
Parameters:
-
group_element(class:`~compas_timber.elements.TimberElement`) –The group element to check for existence.
Returns:
-
bool–True if the group element exists in the model.
process_joinery
¤
Process the joinery of the model. This methods checks the feasibility of the joints and instructs all joints to add their extensions and features.
The sequence is important here since the feature parameters must be calculated based on the extended blanks. For this reason, the first iteration will only extend the beams, and the second iteration will add the features.
Parameters:
-
stop_on_first_error(bool, default:False) –If True, the method will raise an exception on the first error it encounters. Default is False.
Returns:
-
list[:class:`~compas_timber.errors.BeamJoiningError`]–A list of errors that occurred during the joinery process.
remove_beam_structural_segments
¤
remove_beam_structural_segments(beam: Beam) -> None
Removes all structural segments assigned to the given beam.
Parameters:
-
beam(:class:`~compas_timber.elements.Beam`) –The beam whose structural segments to remove.
remove_interaction
¤
Remove the interaction between two elements.
Extends :meth:Model.remove_interaction to not remove the edge if there are still other timber related attribute on the same edge.
Parameters:
-
a(:class:`TimberElement`) – -
b(:class:`TimberElement`) –
Returns:
-
None–
remove_joint
¤
Removes this joint object from the model.
Parameters:
-
joint(:class:`~compas_timber.connections.Joint`) –The joint to remove.
remove_joint_candidate
¤
Removes this joint candidate from the model.
Parameters:
-
candidate(:class:`~compas_timber.connections.JointCandidate`) –The joint candidate to remove.
remove_structural_connector_segments
¤
Removes all structural segments assigned to the interaction between two elements.
Parameters:
-
element_a(:class:`~compas_timber.elements.TimberElement`) –The first element.
-
element_b(:class:`~compas_timber.elements.TimberElement`) –The second element.
set_topologies
¤
Todo
calculate the topologies inside the model using the ConnectionSolver.
transform
¤
Transform the model and reset all computed properties of all elements.