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

Method testMultisectionSweep

tests/test_cadquery.py:1215–1328  ·  view source on GitHub ↗

Tests the operation of sweeping along a list of wire(s) along a path

(self)

Source from the content-addressed store, hash-verified

1213 self.assertGreater(add.val().Volume(), box.val().Volume())
1214
1215 def testMultisectionSweep(self):
1216 """
1217 Tests the operation of sweeping along a list of wire(s) along a path
1218 """
1219
1220 # X axis line length 20.0
1221 path = Workplane("XZ").moveTo(-10, 0).lineTo(10, 0)
1222
1223 # Sweep a circle from diameter 2.0 to diameter 1.0 to diameter 2.0 along X axis length 10.0 + 10.0
1224 defaultSweep = (
1225 Workplane("YZ")
1226 .workplane(offset=-10.0)
1227 .circle(2.0)
1228 .workplane(offset=10.0)
1229 .circle(1.0)
1230 .workplane(offset=10.0)
1231 .circle(2.0)
1232 .sweep(path, multisection=True)
1233 )
1234
1235 # We can sweep through different shapes
1236 recttocircleSweep = (
1237 Workplane("YZ")
1238 .workplane(offset=-10.0)
1239 .rect(2.0, 2.0)
1240 .workplane(offset=8.0)
1241 .circle(1.0)
1242 .workplane(offset=4.0)
1243 .circle(1.0)
1244 .workplane(offset=8.0)
1245 .rect(2.0, 2.0)
1246 .sweep(path, multisection=True)
1247 )
1248
1249 circletorectSweep = (
1250 Workplane("YZ")
1251 .workplane(offset=-10.0)
1252 .circle(1.0)
1253 .workplane(offset=7.0)
1254 .rect(2.0, 2.0)
1255 .workplane(offset=6.0)
1256 .rect(2.0, 2.0)
1257 .workplane(offset=7.0)
1258 .circle(1.0)
1259 .sweep(path, multisection=True)
1260 )
1261
1262 # Placement of the Shape is important otherwise could produce unexpected shape
1263 specialSweep = (
1264 Workplane("YZ")
1265 .circle(1.0)
1266 .workplane(offset=10.0)
1267 .rect(2.0, 2.0)
1268 .sweep(path, multisection=True)
1269 )
1270
1271 # Switch to an arc for the path : line l=5.0 then half circle r=4.0 then line l=5.0
1272 path = (

Callers

nothing calls this directly

Calls 15

saveModelMethod · 0.95
WorkplaneClass · 0.85
VectorClass · 0.85
lineToMethod · 0.80
moveToMethod · 0.80
workplaneMethod · 0.80
threePointArcMethod · 0.80
normalizedMethod · 0.80
sweepMethod · 0.45
circleMethod · 0.45
rectMethod · 0.45

Tested by

no test coverage detected