MCPcopy
hub / github.com/CadQuery/cadquery / testUnorderedMirror

Method testUnorderedMirror

tests/test_cadquery.py:2142–2172  ·  view source on GitHub ↗

Tests whether or not a wire can be mirrored if its mirror won't connect to it

(self)

Source from the content-addressed store, hash-verified

2140 self.saveModel(s)
2141
2142 def testUnorderedMirror(self):
2143 """
2144 Tests whether or not a wire can be mirrored if its mirror won't connect to it
2145 """
2146 r = 20
2147 s = 7
2148 t = 1.5
2149
2150 points = [
2151 (0, 0),
2152 (0, t / 2),
2153 (r / 2 - 1.5 * t, r / 2 - t),
2154 (s / 2, r / 2 - t),
2155 (s / 2, r / 2),
2156 (r / 2, r / 2),
2157 (r / 2, s / 2),
2158 (r / 2 - t, s / 2),
2159 (r / 2 - t, r / 2 - 1.5 * t),
2160 (t / 2, 0),
2161 ]
2162
2163 r = Workplane("XY").polyline(points).mirrorX()
2164
2165 self.assertEqual(1, r.wires().size())
2166 self.assertEqual(18, r.edges().size())
2167
2168 # try the same with includeCurrent=True
2169 r = Workplane("XY").polyline(points[1:], includeCurrent=True).mirrorX()
2170
2171 self.assertEqual(1, r.wires().size())
2172 self.assertEqual(18, r.edges().size())
2173
2174 def testChainedMirror(self):
2175 """

Callers

nothing calls this directly

Calls 6

WorkplaneClass · 0.85
mirrorXMethod · 0.80
polylineMethod · 0.80
sizeMethod · 0.45
wiresMethod · 0.45
edgesMethod · 0.45

Tested by

no test coverage detected