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

Method testEllipseCenterAndMoveTo

tests/test_cadquery.py:1025–1053  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1023 self.assertTupleAlmostEquals((sp.x, sp.y), (ep.x, ep.y), 3)
1024
1025 def testEllipseCenterAndMoveTo(self):
1026 # Whether we start from a center() call or a moveTo call, it should be the same ellipse Arc
1027 p0 = (10, 20)
1028 a1, a2 = 30, -60
1029 r1, r2 = 20, 10
1030 ra = 25
1031
1032 ellipseArc1 = (
1033 Workplane("XY")
1034 .moveTo(*p0)
1035 .ellipseArc(
1036 r1, r2, startAtCurrent=False, angle1=a1, angle2=a2, rotation_angle=ra
1037 )
1038 )
1039 sp1 = ellipseArc1.val().startPoint()
1040 ep1 = ellipseArc1.val().endPoint()
1041
1042 ellipseArc2 = (
1043 Workplane("XY")
1044 .moveTo(*p0)
1045 .ellipseArc(
1046 r1, r2, startAtCurrent=False, angle1=a1, angle2=a2, rotation_angle=ra
1047 )
1048 )
1049 sp2 = ellipseArc2.val().startPoint()
1050 ep2 = ellipseArc2.val().endPoint()
1051
1052 self.assertTupleAlmostEquals(sp1.toTuple(), sp2.toTuple(), 3)
1053 self.assertTupleAlmostEquals(ep1.toTuple(), ep2.toTuple(), 3)
1054
1055 def testMakeEllipse(self):
1056 el = Wire.makeEllipse(

Callers

nothing calls this directly

Calls 8

WorkplaneClass · 0.85
ellipseArcMethod · 0.80
moveToMethod · 0.80
startPointMethod · 0.80
endPointMethod · 0.80
valMethod · 0.45
toTupleMethod · 0.45

Tested by

no test coverage detected