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

Method section

cadquery/cq.py:4315–4332  ·  view source on GitHub ↗

Slices current solid at the given height. :param height: height to slice at (default: 0) :raises ValueError: if no solids or compounds are found :return: a CQ object with the resulting face(s).

(self: T, height: float = 0.0)

Source from the content-addressed store, hash-verified

4313 return self._combineWithBase(r, combine, clean)
4314
4315 def section(self: T, height: float = 0.0) -> T:
4316 """
4317 Slices current solid at the given height.
4318
4319 :param height: height to slice at (default: 0)
4320 :raises ValueError: if no solids or compounds are found
4321 :return: a CQ object with the resulting face(s).
4322 """
4323
4324 solidRef = self.findSolid(searchStack=True, searchParents=True)
4325
4326 plane = Face.makePlane(
4327 basePnt=self.plane.origin + self.plane.zDir * height, dir=self.plane.zDir
4328 )
4329
4330 r = solidRef.intersect(plane)
4331
4332 return self.newObject([r])
4333
4334 def toPending(self: T) -> T:
4335 """

Callers 6

test_splineMethod · 0.80
testDXFMethod · 0.80
test_dxf_approxFunction · 0.80
test_dxf_textFunction · 0.80
testExtrudeUntilFaceMethod · 0.80
testSectionMethod · 0.80

Calls 4

findSolidMethod · 0.95
newObjectMethod · 0.95
makePlaneMethod · 0.80
intersectMethod · 0.45

Tested by 6

test_splineMethod · 0.64
testDXFMethod · 0.64
test_dxf_approxFunction · 0.64
test_dxf_textFunction · 0.64
testExtrudeUntilFaceMethod · 0.64
testSectionMethod · 0.64