Draw things like 2D lines and arcs, should be expanded later to include all 2D constructs
(self)
| 1966 | self.saveModel(r2) |
| 1967 | |
| 1968 | def test2DDrawing(self): |
| 1969 | """ |
| 1970 | Draw things like 2D lines and arcs, should be expanded later to include all 2D constructs |
| 1971 | """ |
| 1972 | s = Workplane(Plane.XY()) |
| 1973 | r = ( |
| 1974 | s.lineTo(1.0, 0.0) |
| 1975 | .lineTo(1.0, 1.0) |
| 1976 | .threePointArc((1.0, 1.5), (0.0, 1.0)) |
| 1977 | .lineTo(0.0, 0.0) |
| 1978 | .moveTo(1.0, 0.0) |
| 1979 | .lineTo(2.0, 0.0) |
| 1980 | .lineTo(2.0, 2.0) |
| 1981 | .threePointArc((2.0, 2.5), (0.0, 2.0)) |
| 1982 | .lineTo(-2.0, 2.0) |
| 1983 | .lineTo(-2.0, 0.0) |
| 1984 | .close() |
| 1985 | ) |
| 1986 | |
| 1987 | self.assertEqual(1, r.wires().size()) |
| 1988 | |
| 1989 | # Test the *LineTo functions |
| 1990 | s = Workplane(Plane.XY()) |
| 1991 | r = s.hLineTo(1.0).vLineTo(1.0).hLineTo(0.0).close() |
| 1992 | |
| 1993 | self.assertEqual(1, r.wire().size()) |
| 1994 | self.assertEqual(4, r.edges().size()) |
| 1995 | |
| 1996 | # Test the *Line functions |
| 1997 | s = Workplane(Plane.XY()) |
| 1998 | r = s.hLine(1.0).vLine(1.0).hLine(-1.0).close() |
| 1999 | |
| 2000 | self.assertEqual(1, r.wire().size()) |
| 2001 | self.assertEqual(4, r.edges().size()) |
| 2002 | |
| 2003 | # Test the move function |
| 2004 | s = Workplane(Plane.XY()) |
| 2005 | r = s.move(1.0, 1.0).hLine(1.0).vLine(1.0).hLine(-1.0).close() |
| 2006 | |
| 2007 | self.assertEqual(1, r.wire().size()) |
| 2008 | self.assertEqual(4, r.edges().size()) |
| 2009 | self.assertEqual( |
| 2010 | (1.0, 1.0), |
| 2011 | ( |
| 2012 | r.vertices(selectors.NearestToPointSelector((0.0, 0.0, 0.0))) |
| 2013 | .first() |
| 2014 | .val() |
| 2015 | .X, |
| 2016 | r.vertices(selectors.NearestToPointSelector((0.0, 0.0, 0.0))) |
| 2017 | .first() |
| 2018 | .val() |
| 2019 | .Y, |
| 2020 | ), |
| 2021 | ) |
| 2022 | |
| 2023 | # Test the sagittaArc and radiusArc functions |
| 2024 | a1 = Workplane(Plane.YZ()).threePointArc((5, 1), (10, 0)) |
| 2025 | a2 = Workplane(Plane.YZ()).sagittaArc((10, 0), -1) |
nothing calls this directly
no test coverage detected