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

Function test_dxf_text

tests/test_exporters.py:907–925  ·  view source on GitHub ↗
(tmpdir, testdatadir)

Source from the content-addressed store, hash-verified

905
906
907def test_dxf_text(tmpdir, testdatadir):
908
909 w1 = (
910 Workplane("XZ")
911 .box(8, 8, 1)
912 .faces("<Y")
913 .workplane()
914 .text(",,", 10, -1, fontPath=str(Path(testdatadir) / "OpenSans-Regular.ttf"),)
915 )
916
917 fname = tmpdir.joinpath(f"dxf_text.dxf").resolve()
918 exporters.exportDXF(w1.section(), fname)
919
920 s2 = Sketch().importDXF(fname)
921 w2 = Workplane("XZ", origin=(0, -0.5, 0)).placeSketch(s2).extrude(-1)
922
923 assert w1.val().Volume() == approx(61.669465, 1e-2)
924 assert w2.val().Volume() == approx(w1.val().Volume(), 1e-2)
925 assert w2.intersect(w1).val().Volume() == approx(w1.val().Volume(), 1e-2)
926
927
928def test_dxf_ellipse_arc(tmpdir):

Callers

nothing calls this directly

Calls 13

WorkplaneClass · 0.90
SketchClass · 0.90
textMethod · 0.80
workplaneMethod · 0.80
boxMethod · 0.80
sectionMethod · 0.80
importDXFMethod · 0.80
extrudeMethod · 0.80
placeSketchMethod · 0.80
VolumeMethod · 0.80
facesMethod · 0.45
valMethod · 0.45

Tested by

no test coverage detected