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

Beam_faces_match_btlx #242

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Changed `CategoryJointRule` and `DirectJointRule` to a dynamic interface where joint type is selected with right click menu
* Changed `Assembly` GH component to apply category joints if the detected topology is in `CategoryRule.topos`
* Changed `TopologyJoints` GH component to `DefaultJoints` Component, which applies default joints based on topology.
* Changed `Beam.faces` to match position and orientation of BTLx `ReferenceSide`

### Removed

Expand Down
2 changes: 1 addition & 1 deletion src/compas_timber/connections/butt_joint.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def subtraction_volume(self):
dir_pts = []
vertices = []
sides = self.side_surfaces_cross()
for i, side in enumerate(sides):
for side in sides:
points = []
top_frame, bottom_frame = self.get_main_cutting_plane()
for frame in [top_frame, bottom_frame]:
Expand Down
71 changes: 4 additions & 67 deletions src/compas_timber/fabrication/btlx.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,76 +158,13 @@ def __init__(self, beam):
self.beam = beam
self.key = beam.key
self.length = beam.length
self.width = beam.height
self.height = beam.width
self.frame = Frame(
self.beam.long_edges[2].closest_point(self.beam.blank_frame.point),
beam.frame.xaxis,
beam.frame.yaxis,
) # I used long_edge[2] because it is in Y and Z negative. Using that as reference puts the beam entirely in positive coordinates.
self.width = beam.width
self.height = beam.height
self.frame = beam.part_ref
self.blank_length = beam.blank_length
self._reference_surfaces = []
self.processings = []
self._et_element = None

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
-----------
beam_face : :class:`~compas.geometry.Frame`
The frame of a beam face from beam.faces.

Returns
--------
key : str
The key(index 1-6) of the reference surface.

"""
for key, face in self.reference_surfaces.items():
if face.normal == beam_face.normal:
return key

def reference_surface_planes(self, index):
"""Returns the reference surface planes for a given index per BTLx docs.

Parameters
----------
index : int
The index of the reference surface.

Returns
-------
dict
The BTLx reference surface frame.

"""
if len(self._reference_surfaces) != 6:
self._reference_surfaces = {
"1": Frame(self.frame.point, self.frame.xaxis, self.frame.zaxis),
"2": Frame(
self.frame.point + self.frame.yaxis * self.width,
self.frame.xaxis,
-self.frame.yaxis,
),
"3": Frame(
self.frame.point + self.frame.yaxis * self.width + self.frame.zaxis * self.height,
self.frame.xaxis,
-self.frame.zaxis,
),
"4": Frame(
self.frame.point + self.frame.zaxis * self.height,
self.frame.xaxis,
self.frame.yaxis,
),
"5": Frame(self.frame.point, self.frame.zaxis, self.frame.yaxis),
"6": Frame(
self.frame.point + self.frame.xaxis * self.blank_length + self.frame.yaxis * self.width,
self.frame.zaxis,
-self.frame.yaxis,
),
}
return self._reference_surfaces[str(index)]
self.faces = beam.faces

@property
def attr(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(self, part, joint, is_top):
self.drill_hole_diameter = 10.0

self.ref_face_index = self.joint.reference_face_indices[str(self.beam.key)]
self.ref_face = self.part.reference_surfaces[str(self.ref_face_index)]
self.ref_face = self.part.faces[self.ref_face_index]

"""
the following attributes are required for all processes, but the keys and values of header_attributes are process specific.
Expand Down
12 changes: 5 additions & 7 deletions src/compas_timber/fabrication/btlx_processes/btlx_jack_cut.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, part, frame, joint_name=None):
self.cut_plane = frame
self.part = part
self.apply_process = True
self.reference_surface = self.part.reference_surface_planes(1)
self.reference_side = self.part.faces[0]
self.generate_process()
if joint_name:
self.name = joint_name
Expand Down Expand Up @@ -75,25 +75,23 @@ def generate_process(self):
self.startY = 0.0
self.start_depth = 0.0

self.x_edge = Line.from_point_and_vector(self.reference_surface.point, self.reference_surface.xaxis)
self.x_edge = Line.from_point_and_vector(self.reference_side.point, self.reference_side.xaxis)

self.startX = intersection_line_plane(self.x_edge, Plane.from_frame(self.cut_plane))[1] * self.x_edge.length
if self.startX < self.part.blank_length / 2:
self.orientation = "start"
else:
self.orientation = "end"
angle_direction = cross_vectors(self.reference_surface.normal, self.cut_plane.normal)
angle_direction = cross_vectors(self.reference_side.normal, self.cut_plane.normal)
self.angle = (
angle_vectors_signed(self.reference_surface.xaxis, angle_direction, self.reference_surface.zaxis)
* 180
/ math.pi
angle_vectors_signed(self.reference_side.xaxis, angle_direction, self.reference_side.zaxis) * 180 / math.pi
)

self.angle = abs(self.angle)
self.angle = 90 - (self.angle - 90)

self.inclination = (
angle_vectors_signed(self.reference_surface.zaxis, self.cut_plane.normal, angle_direction) * 180 / math.pi
angle_vectors_signed(self.reference_side.zaxis, self.cut_plane.normal, angle_direction) * 180 / math.pi
)
self.inclination = abs(self.inclination)
self.inclination = 90 - (self.inclination - 90)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,10 @@ def apply_processings(cls, joint, parts):

top_key = joint.beams[0].key
top_part = parts[str(top_key)]
top_part._test.append(top_part.reference_surface_planes(joint.reference_face_indices[str(top_part.beam.key)]))
top_part.processings.append(BTLxFrenchRidgeLap.create_process(top_part, joint, True))

bottom_key = joint.beams[1].key
bottom_part = parts[str(bottom_key)]
bottom_part._test.append(
bottom_part.reference_surface_planes(joint.reference_face_indices[str(bottom_part.beam.key)])
)
bottom_part.processings.append(BTLxFrenchRidgeLap.create_process(bottom_part, joint, False))


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ def apply_processings(cls, joint, parts):

main_part = parts[str(joint.main_beam.key)]
cross_part = parts[str(joint.cross_beam.key)]
main_part.processings.append(BTLxJackCut.create_process(main_part, joint.cutting_plane_main, "L-Butt Joint"))
cross_part.processings.append(BTLxJackCut.create_process(cross_part, joint.cutting_plane_cross, "L-Butt Joint"))
main_part.processings.append(
BTLxJackCut.create_process(main_part, joint.get_main_cutting_plane()[0], "L-Butt Joint")
)
cross_part.processings.append(
BTLxJackCut.create_process(cross_part, joint.get_cross_cutting_plane(), "L-Butt Joint")
)


BTLx.register_joint(LButtJoint, LButtFactory)
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ def apply_processings(cls, joint, parts):
"""

parts[str(joint.beams[0].key)].processings.append(
BTLxJackCut.create_process(parts[str(joint.beams[0].key)], joint.cutting_planes[0], "L-Miter Joint")
BTLxJackCut.create_process(parts[str(joint.beams[0].key)], joint.get_cutting_planes()[0], "L-Miter Joint")
)
parts[str(joint.beams[1].key)].processings.append(
BTLxJackCut.create_process(parts[str(joint.beams[1].key)], joint.cutting_planes[1], "L-Miter Joint")
BTLxJackCut.create_process(parts[str(joint.beams[1].key)], joint.get_cutting_planes()[1], "L-Miter Joint")
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def apply_processings(cls, joint, parts):
"""

part = parts[str(joint.main_beam.key)]
cut_plane = joint.cutting_plane
cut_plane = joint.get_main_cutting_plane()[0]
part.processings.append(BTLxJackCut.create_process(part, cut_plane, "T-Butt Joint"))


Expand Down
34 changes: 22 additions & 12 deletions src/compas_timber/parts/beam.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,34 +127,44 @@ def blank_frame(self):
frame.point += -frame.xaxis * start # "extension" to the start edge
return frame

@property
def part_ref(self):
frame = self.blank_frame
return Frame(
Point(*(frame.point + (frame.yaxis * self.width * 0.5) - (frame.zaxis * self.height * 0.5))),
frame.xaxis,
frame.zaxis,
)

@property
def faces(self):
frame = self.part_ref
return [
Frame(
Point(*add_vectors(self.midpoint, self.frame.yaxis * self.width * 0.5)),
self.frame.xaxis,
-self.frame.zaxis,
),
Frame(
Point(*add_vectors(self.midpoint, -self.frame.zaxis * self.height * 0.5)),
frame.point,
self.frame.xaxis,
-self.frame.yaxis,
),
Frame(
Point(*add_vectors(self.midpoint, -self.frame.yaxis * self.width * 0.5)),
Point(*add_vectors(frame.point, self.frame.zaxis * self.height)),
self.frame.xaxis,
self.frame.zaxis,
-self.frame.zaxis,
),
Frame(
Point(*add_vectors(self.midpoint, self.frame.zaxis * self.height * 0.5)),
Point(*(frame.point - self.frame.yaxis * self.width + self.frame.zaxis * self.height)),
self.frame.xaxis,
self.frame.yaxis,
),
Frame(self.frame.point, -self.frame.yaxis, self.frame.zaxis), # small face at start point
Frame(
Point(*add_vectors(self.frame.point, self.frame.xaxis * self.length)),
self.frame.yaxis,
Point(*add_vectors(frame.point, -self.frame.yaxis * self.width)),
self.frame.xaxis,
self.frame.zaxis,
),
Frame(frame.point, -self.frame.yaxis, self.frame.zaxis), # small face at start point
Frame(
Point(*(frame.point + self.frame.xaxis * self.blank_length + self.frame.zaxis * self.height)),
-self.frame.yaxis,
-self.frame.zaxis,
), # small face at end point
]

Expand Down
Loading