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

Function test_offset2D

tests/test_free_functions.py:1013–1038  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1011
1012
1013def test_offset2D():
1014
1015 c = circle(1)
1016 seg = segment((0, 0), (1, 1))
1017 ctx = plane()
1018
1019 # simple offset
1020 r1 = offset2D(c, 0.1)
1021
1022 # offset with a context
1023 r2 = offset2D(seg, 0.2, ctx)
1024
1025 # offset that is not closed
1026 r3 = offset2D(seg, -0.3, ctx, closed=False)
1027
1028 assert r1.isValid()
1029 assert len(clean(r1).Edges()) == 1
1030 assert face(r1).isValid()
1031
1032 assert r2.isValid()
1033 assert len(clean(r2).Edges()) == 4
1034 assert face(r2).isValid()
1035
1036 assert r3.isValid()
1037 assert len(clean(r3).Edges()) == 1
1038 assert r3.edge().Length() == approx(seg.Length())
1039
1040
1041def test_fillet2D():

Callers

nothing calls this directly

Calls 10

circleFunction · 0.85
segmentFunction · 0.85
planeFunction · 0.85
offset2DFunction · 0.85
cleanFunction · 0.85
faceFunction · 0.85
isValidMethod · 0.80
EdgesMethod · 0.80
LengthMethod · 0.45
edgeMethod · 0.45

Tested by

no test coverage detected