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

Function test_dxf_approx

tests/test_exporters.py:883–904  ·  view source on GitHub ↗
(tmpdir)

Source from the content-addressed store, hash-verified

881
882
883def test_dxf_approx(tmpdir):
884
885 pts = [(0, 0), (0, 0.5), (1, 1)]
886 w1 = Workplane().spline(pts).close().extrude(1).edges("|Z").fillet(0.1).section()
887 exporters.exportDXF(w1, str(tmpdir / "orig.dxf"))
888
889 assert _dxf_spline_max_degree(str(tmpdir / "orig.dxf")) == 6
890
891 exporters.exportDXF(w1, str(tmpdir / "limit1.dxf"), approx="spline")
892 w1_i1 = importers.importDXF(str(tmpdir / "limit1.dxf"))
893
894 assert _dxf_spline_max_degree(str(tmpdir / "limit1.dxf")) == 3
895
896 assert w1.val().Area() == approx(w1_i1.val().Area(), 1e-3)
897 assert w1.edges().size() == w1_i1.edges().size()
898
899 exporters.exportDXF(w1, str(tmpdir / "limit2.dxf"), approx="arc")
900 w1_i2 = importers.importDXF(str(tmpdir / "limit2.dxf"))
901
902 assert _check_dxf_no_spline(str(tmpdir / "limit2.dxf"))
903
904 assert w1.val().Area() == approx(w1_i2.val().Area(), 1e-3)
905
906
907def test_dxf_text(tmpdir, testdatadir):

Callers

nothing calls this directly

Calls 13

WorkplaneClass · 0.90
_dxf_spline_max_degreeFunction · 0.85
_check_dxf_no_splineFunction · 0.85
sectionMethod · 0.80
extrudeMethod · 0.80
importDXFMethod · 0.80
filletMethod · 0.45
edgesMethod · 0.45
closeMethod · 0.45
splineMethod · 0.45
AreaMethod · 0.45
valMethod · 0.45

Tested by

no test coverage detected