gramaziokohler / compas_timber

https://gramaziokohler.github.io/compas_timber/
MIT License
20 stars 26 forks source link

XHalfLap doesnt run outside Rhino? #179

Open chenkasirer opened 10 months ago

chenkasirer commented 10 months ago

Tried writing unittests for the half lap joint and couldn't get it to run just with code (CPython) Inside Rhino it seems to be running fine.

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)

from compas_timber.connections import XHalfLapJoint
joint = XHalfLapJoint.create(assembly, beam_a, beam_b)
tests\compas_timber\test_joint.py:163: in test_joint_create_kwargs_passthrough_xhalflap
    joint = XHalfLapJoint.create(assembly, beam_a, beam_b)
src\compas_timber\connections\joint.py:130: in create
    joint.add_features()
src\compas_timber\connections\x_halflap.py:172: in add_features
    negative_brep_beam_a, negative_brep_beam_b = self._create_negative_volumes()
src\compas_timber\connections\x_halflap.py:144: in _create_negative_volumes
    planes_a = self._sort_beam_planes(self.beam_a, plane_cut_vector_a)
src\compas_timber\connections\x_halflap.py:101: in _sort_beam_planes
    planes_angles, planes = zip(*sorted(zip(planes_angles, planes)))
E   TypeError: '<' not supported between instances of 'Plane' and 'Plane'
chenkasirer commented 10 months ago

could be sorted with the zip there is behaving differently in CPython vs. IronPython (or just 2.7 vs. 3)

obucklin commented 10 months ago

this function only returns the planes anyways, so we can just sort planes with planes_angles as key. I think that's how I did it in the other laps. I'll change it real quick

obucklin commented 10 months ago

How do I test with CPython?

obucklin commented 10 months ago

@chenkasirer maybe you can test it real quick. I just changed it

chenkasirer commented 10 months ago

yup seems to have worked. I wrote a few unittests you can find them in tests/compas_timber/ you run them using invoke test and they should all pass.

When opening a PR or when pushing new commits to it, it'll run them automatically as Github Actions. You can click on Details next to an action that failed to checkout why it failed. All checks should be green before we can merge.

Image