Fixed flipped width/height Issue #565

This commit is contained in:
gumyr 2024-03-01 09:44:19 -05:00
parent 7fc8199aa4
commit d1877e0deb
4 changed files with 5 additions and 5 deletions

View file

@ -223,7 +223,7 @@ class Rectangle(BaseSketchObject):
self.rectangle_height = height
self.align = tuplify(align, 2)
face = Face.make_rect(height, width)
face = Face.make_rect(width, height)
super().__init__(face, rotation, self.align, mode)
@ -263,7 +263,7 @@ class RectangleRounded(BaseSketchObject):
self.radius = radius
self.align = tuplify(align, 2)
face = Face.make_rect(height, width)
face = Face.make_rect(width, height)
face = face.fillet_2d(radius, face.vertices())
super().__init__(face, rotation, align, mode)

View file

@ -5431,7 +5431,7 @@ class Face(Shape):
Face: The centered rectangle
"""
pln_shape = BRepBuilderAPI_MakeFace(
plane.wrapped, -height * 0.5, height * 0.5, -width * 0.5, width * 0.5
plane.wrapped, -width * 0.5, width * 0.5, -height * 0.5, height * 0.5
).Face()
return cls(pln_shape)

View file

@ -213,7 +213,7 @@ class ObjectTests(unittest.TestCase):
# Face
def test_rect(self):
r = Face.make_rect(1, 2)
r = Face.make_rect(2, 1)
self.assertTrue(isinstance(r, Shape))

View file

@ -1097,7 +1097,7 @@ class TestFace(DirectApiTestCase):
self.assertVectorAlmostEquals(test_face.normal_at(), (0, 0, 1), 5)
def test_length_width(self):
test_face = Face.make_rect(10, 8, Plane.XZ)
test_face = Face.make_rect(8, 10, Plane.XZ)
self.assertAlmostEqual(test_face.length, 8, 5)
self.assertAlmostEqual(test_face.width, 10, 5)