Skip to content

Commit

Permalink
added unittest for new reference sides
Browse files Browse the repository at this point in the history
  • Loading branch information
chenkasirer committed Jul 8, 2024
1 parent 9d1ca0d commit 9289c6e
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/compas_timber/test_btlx.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from compas.geometry import Line
from compas.geometry import Point
from compas.geometry import Frame
from compas.geometry import Vector

from compas_timber.elements import Beam
from compas_timber.fabrication import BTLxPart
Expand All @@ -23,3 +25,43 @@ def test_beam_ref_faces(mock_beam):
assert btlx_part.ref_side_from_face(mock_beam.faces[3]) == 4
assert btlx_part.ref_side_from_face(mock_beam.faces[4]) == 5
assert btlx_part.ref_side_from_face(mock_beam.faces[5]) == 6


def test_beam_ref_faces_attribute(mock_beam):
ref_side_frames_expected = (
Frame(
point=Point(x=-48.67193560518159, y=20.35704602012424, z=0.0005429194857271558),
xaxis=Vector(x=0.9374000278319115, y=0.3451241645032913, z=0.04658861337963174),
yaxis=Vector(x=0.3454993211307862, y=-0.9384189997533969, z=-1.734723475976807e-18),
),
Frame(
point=Point(x=-48.7156552451492, y=20.340949685829152, z=0.9994570805142728),
xaxis=Vector(x=0.9374000278319115, y=0.3451241645032913, z=0.04658861337963174),
yaxis=Vector(x=0.04371963996761174, y=0.016096334295087427, z=-0.9989141610285457),
),
Frame(
point=Point(x=-48.37015592401841, y=19.402530686075757, z=0.9994570805142728),
xaxis=Vector(x=0.9374000278319115, y=0.3451241645032913, z=0.04658861337963174),
yaxis=Vector(x=-0.3454993211307862, y=0.9384189997533969, z=1.734723475976807e-18),
),
Frame(
point=Point(x=-48.3264362840508, y=19.41862702037084, z=0.000542919485727154),
xaxis=Vector(x=0.9374000278319115, y=0.3451241645032913, z=0.04658861337963174),
yaxis=Vector(x=-0.04371963996761174, y=-0.016096334295087427, z=0.9989141610285457),
),
Frame(
point=Point(x=-48.67193560518159, y=20.35704602012424, z=0.0005429194857271558),
xaxis=Vector(x=0.3454993211307862, y=-0.9384189997533969, z=-1.734723475976807e-18),
yaxis=Vector(x=-0.04371963996761173, y=-0.016096334295087424, z=0.9989141610285456),
),
Frame(
point=Point(x=-38.6552567933492, y=24.04490371522915, z=1.499457080514273),
xaxis=Vector(x=0.3454993211307862, y=-0.9384189997533969, z=-1.734723475976807e-18),
yaxis=Vector(x=0.04371963996761173, y=0.016096334295087424, z=-0.9989141610285456),
),
)

for index in range(6):
ref_side = mock_beam.ref_sides[index]
assert ref_side_frames_expected[index] == ref_side
assert ref_side.name == "RS_{}".format(index + 1)

0 comments on commit 9289c6e

Please sign in to comment.