MCPcopy Index your code
hub / github.com/CadQuery/cadquery / testClean

Method testClean

tests/test_cadquery.py:2882–2989  ·  view source on GitHub ↗

Tests the `clean()` method which is called automatically.

(self)

Source from the content-addressed store, hash-verified

2880 self.saveModel(s)
2881
2882 def testClean(self):
2883 """
2884 Tests the `clean()` method which is called automatically.
2885 """
2886
2887 # make a cube with a splitter edge on one of the faces
2888 # autosimplify should remove the splitter
2889 s = (
2890 Workplane("XY")
2891 .moveTo(0, 0)
2892 .line(5, 0)
2893 .line(5, 0)
2894 .line(0, 10)
2895 .line(-10, 0)
2896 .close()
2897 .extrude(10)
2898 )
2899
2900 self.assertEqual(6, s.faces().size())
2901
2902 # test removal of splitter caused by union operation
2903 s = Workplane("XY").box(10, 10, 10).union(Workplane("XY").box(20, 10, 10))
2904
2905 self.assertEqual(6, s.faces().size())
2906
2907 # test removal of splitter caused by extrude+combine operation
2908 s = (
2909 Workplane("XY")
2910 .box(10, 10, 10)
2911 .faces(">Y")
2912 .workplane()
2913 .rect(5, 10, True)
2914 .extrude(20)
2915 )
2916
2917 self.assertEqual(10, s.faces().size())
2918
2919 # test removal of splitter caused by double hole operation
2920 s = (
2921 Workplane("XY")
2922 .box(10, 10, 10)
2923 .faces(">Z")
2924 .workplane()
2925 .hole(3, 5)
2926 .faces(">Z")
2927 .workplane()
2928 .hole(3, 10)
2929 )
2930
2931 self.assertEqual(7, s.faces().size())
2932
2933 # test removal of splitter caused by cutThruAll
2934 s = (
2935 Workplane("XY")
2936 .box(10, 10, 10)
2937 .faces(">Y")
2938 .workplane()
2939 .rect(10, 5)

Callers

nothing calls this directly

Calls 15

WorkplaneClass · 0.85
VectorClass · 0.85
extrudeMethod · 0.80
lineMethod · 0.80
moveToMethod · 0.80
unionMethod · 0.80
boxMethod · 0.80
workplaneMethod · 0.80
holeMethod · 0.80
cutThruAllMethod · 0.80
centerMethod · 0.80
cutBlindMethod · 0.80

Tested by

no test coverage detected