Skip to content

Commit

Permalink
Merge branch 'main' into show_topology_GH_component
Browse files Browse the repository at this point in the history
  • Loading branch information
obucklin committed Jan 25, 2024
2 parents aed8e2a + 0b6426e commit c1a12f8
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 82 deletions.
6 changes: 1 addition & 5 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
[bumpversion]
current_version = 0.3.2
current_version = 0.4.0
message = Bump version to {new_version}
commit = True
tag = True

[bumpversion:file:docs/conf.py]
search = release = "{current_version}"
replace = release = "{new_version}"

[bumpversion:file:src/compas_timber/__version__.py]
search = __version__ = "{current_version}"
replace = __version__ = "{new_version}"
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

### Changed

### Removed


## [0.4.0] 2024-01-24

### Added

* Added `fabrication` package
* Added `BTLx` as a wrapper for `TimberAssembly` to generate .btlx files for machining timber beams
* Added `BTLxPart` as wrapper for `Beam`
Expand Down
2 changes: 1 addition & 1 deletion src/compas_timber/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
__title__ = "compas_timber"
__description__ = "COMPAS package for modeling, designing and fabricating timber assemblies."
__url__ = "https://github.com/gramaziokohler/compas_timber"
__version__ = "0.3.2"
__version__ = "0.4.0"
__author__ = "Gramazio Kohler Research"
__author_email__ = "[email protected]"
__license__ = "MIT license"
Expand Down
138 changes: 70 additions & 68 deletions src/compas_timber/fabrication/btlx.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ class BTLx(object):
Parameters
----------
assembly : :class:`~compas_timber.assembly.Assembly`
The assembly object.
assembly : :class:`~compas_timber.assembly.Assembly`
The assembly object.
Attributes
----------
history : dict
The history of the BTLx file.
btlx_string : str
A pretty XML string for visualization.
parts : dict
A dictionary of the BTLxParts in the assembly.
joints : list
A list of the joints in the assembly.
history : dict
The history of the BTLx file.
btlx_string : str
A pretty XML string for visualization.
parts : dict
A dictionary of the BTLxParts in the assembly.
joints : list
A list of the joints in the assembly.
"""

Expand Down Expand Up @@ -95,14 +95,17 @@ def process_assembly(self):
def register_joint(cls, joint_type, joint_factory):
"""Registers a joint type and its corresponding factory.
Args:
joint_type : type
The type of the joint.
joint_factory : : class:`~compas_timber.fabrication.joint_factories.joint_factory.JointFactory`
The factory for creating the joint.
Parameters
----------
joint_type : type
The type of the joint.
joint_factory : : class:`~compas_timber.fabrication.joint_factories.joint_factory.JointFactory`
The factory for creating the joint.
Returns
-------
None
Returns:
None
"""
cls.REGISTERED_JOINTS[str(joint_type)] = joint_factory

Expand All @@ -119,35 +122,35 @@ class BTLxPart(object):
Parameters
----------
beam : :class:`~compas_timber.assembly.Beam`
The beam object.
beam : :class:`~compas_timber.assembly.Beam`
The beam object.
Attributes
----------
attr : dict
The attributes of the BTLx part.
beam : :class:`~compas_timber.assembly.Beam`
The beam object.
key : str
The key of the beam object.
length : float
The length of the beam.
width : float
The width of the beam.
height : float
The height of the beam.
frame : :class:`~compas.geometry.Frame`
The frame of the BTLxPart at the corner of the blank box that puts the blank geometry in positive coordinates.
blank : :class:`~compas.geometry.Box`
The blank of the beam.
blank_frame : :class:`~compas.geometry.Frame`
The frame of the blank.
blank_length : float
The blank length of the beam.
processings : list
A list of the processings applied to the beam.
et_element : :class:`~xml.etree.ElementTree.Element`
The ET element of the BTLx part.
attr : dict
The attributes of the BTLx part.
beam : :class:`~compas_timber.assembly.Beam`
The beam object.
key : str
The key of the beam object.
length : float
The length of the beam.
width : float
The width of the beam.
height : float
The height of the beam.
frame : :class:`~compas.geometry.Frame`
The frame of the BTLxPart at the corner of the blank box that puts the blank geometry in positive coordinates.
blank : :class:`~compas.geometry.Box`
The blank of the beam.
blank_frame : :class:`~compas.geometry.Frame`
The frame of the blank.
blank_length : float
The blank length of the beam.
processings : list
A list of the processings applied to the beam.
et_element : :class:`~xml.etree.ElementTree.Element`
The ET element of the BTLx part.
"""

Expand All @@ -170,15 +173,15 @@ def __init__(self, beam):
def reference_surface_from_beam_face(self, beam_face):
"""Finds the reference surface with normal that matches the normal of the beam face argument
parameters:
Parameters
-----------
beam_face : :class:`~compas.geometry.Frame`
The frame of a beam face from beam.faces.
beam_face : :class:`~compas.geometry.Frame`
The frame of a beam face from beam.faces.
returns:
Returns
--------
key : str
The key(index 1-6) of the reference surface.
key : str
The key(index 1-6) of the reference surface.
"""
for key, face in self.reference_surfaces.items():
Expand All @@ -188,16 +191,15 @@ def reference_surface_from_beam_face(self, beam_face):
def reference_surface_planes(self, index):
"""Returns the reference surface planes for a given index per BTLx docs.
Parameters:
Parameters
----------
index : int
The index of the reference surface.
returns:
--------
dict
The BTLx reference surface frame.
index : int
The index of the reference surface.
Returns
-------
dict
The BTLx reference surface frame.
"""
if len(self._reference_surfaces) != 6:
Expand Down Expand Up @@ -266,14 +268,16 @@ def test(self):
def et_point_vals(self, point):
"""Returns the ET point values for a given point.
Parameters:
Parameters
----------
point : :class:`~compas.geometry.Point`
The point to be converted.
Returns:
----------
dict
The ET point values formatted for the ET element.
point : :class:`~compas.geometry.Point`
The point to be converted.
Returns
-------
dict
The ET point values formatted for the ET element.
"""
return {
"X": "{:.{prec}f}".format(point.x, prec=BTLx.POINT_PRECISION),
Expand Down Expand Up @@ -353,21 +357,19 @@ def shape_strings(self):

class BTLxProcess(object):

"""
Generic class for BTLx processings.
"""Generic class for BTLx processings.
This should be instantiated and appended to BTLxPart.processings in a specific btlx_process class (eg BTLxJackCut)
each specific btlx process class should have:
PROCESS_TYPE a class attribute which matches the btlx process name
self.header_attributes which matches as a dict,
self.process_parameters which describe the geometric parameters of the process
the joint factory calls instantiates a process or processes and appends it or them to the BTLxPart.processes list
each process will have specific inputs which are derived from the Joint instance and related BTLxParts
some joints will require combinations of multiple BTLx processes, and some processes will cover multiple joint types.
the factory module should call the BTLx.register_joint(joint type, joint factory) function so that the BTLx class can call specific factory types.
Expand Down
17 changes: 9 additions & 8 deletions tests/compas_timber/test_joint.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from compas_timber.connections import TButtJoint
from compas_timber.connections import LButtJoint
from compas_timber.connections import LMiterJoint
from compas_timber.connections import XHalfLapJoint
from compas_timber.connections import find_neighboring_beams
from compas_timber.parts import Beam

Expand Down Expand Up @@ -152,16 +153,16 @@ def test_joint_create_kwargs_passthrough_lmiter():
assert joint.cutoff == 42


# def test_joint_create_kwargs_passthrough_xhalflap():
# assembly = TimberAssembly()
# beam_a = Beam.from_endpoints(Point(0.5, 0, 0), Point(0.5, 1, 0), 0.2, 0.2, z_vector=Vector(0, 0, 1))
# beam_b = Beam.from_endpoints(Point(0, 0.5, 0), Point(1, 0.5, 0), 0.2, 0.2, z_vector=Vector(0, 0, 1))
# assembly.add_beam(beam_a)
# assembly.add_beam(beam_b)
def test_joint_create_kwargs_passthrough_xhalflap():
assembly = TimberAssembly()
beam_a = Beam.from_endpoints(Point(0.5, 0, 0), Point(0.5, 1, 0), 0.2, 0.2, z_vector=Vector(0, 0, 1))
beam_b = Beam.from_endpoints(Point(0, 0.5, 0), Point(1, 0.5, 0), 0.2, 0.2, z_vector=Vector(0, 0, 1))
assembly.add_beam(beam_a)
assembly.add_beam(beam_b)

# joint = XHalfLapJoint.create(assembly, beam_a, beam_b)
joint = XHalfLapJoint.create(assembly, beam_a, beam_b, cut_plane_bias=0.4)

# assert joint.cut_plane_bias == 0.4
assert joint.cut_plane_bias == 0.4


if not compas.IPY:
Expand Down

0 comments on commit c1a12f8

Please sign in to comment.