Add close option to Wire.makePolygon

Close wire when creating polygonal face in Sketch
This commit is contained in:
Lorenz Neureuter
2023-02-02 20:30:24 -05:00
parent 58447f8f56
commit 24ae7bc61c
5 changed files with 34 additions and 4 deletions

View File

@ -1,5 +1,6 @@
# system modules
import math
import pytest
import unittest
from tests import BaseTest
from OCP.gp import gp_Vec, gp_Pnt, gp_Ax2, gp_Circ, gp_Elips, gp, gp_XYZ, gp_Trsf
@ -721,5 +722,18 @@ class TestCadObjects(BaseTest):
self.assertAlmostEqual(many_rad.radius(), 1.0)
@pytest.mark.parametrize(
"points, close, expected_edges",
[
(((0, 0, 0), (0, 1, 0), (1, 0, 0)), False, 2),
(((0, 0, 0), (0, 1, 0), (1, 0, 0)), True, 3),
(((0, 0, 0), (0, 1, 0), (1, 0, 0), (0, 0, 0)), False, 3),
(((0, 0, 0), (0, 1, 0), (1, 0, 0), (0, 0, 0)), True, 3),
],
)
def test_wire_makepolygon(points, close, expected_edges):
assert len(Wire.makePolygon(points, False, close).Edges()) == expected_edges
if __name__ == "__main__":
unittest.main()