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

Method cutEach

cadquery/cq.py:2784–2810  ·  view source on GitHub ↗

Evaluates the provided function at each point on the stack (ie, eachpoint) and then cuts the result from the context solid. :param fcn: a function suitable for use in the eachpoint method: ie, that accepts a vector :param useLocalCoords: same as for :meth:`eachpoint

(
        self: T,
        fcn: Callable[[Location], Shape],
        useLocalCoords: bool = False,
        clean: bool = True,
    )

Source from the content-addressed store, hash-verified

2782 return compound.BoundingBox().DiagonalLength
2783
2784 def cutEach(
2785 self: T,
2786 fcn: Callable[[Location], Shape],
2787 useLocalCoords: bool = False,
2788 clean: bool = True,
2789 ) -> T:
2790 """
2791 Evaluates the provided function at each point on the stack (ie, eachpoint)
2792 and then cuts the result from the context solid.
2793
2794 :param fcn: a function suitable for use in the eachpoint method: ie, that accepts a vector
2795 :param useLocalCoords: same as for :meth:`eachpoint`
2796 :param clean: call :meth:`clean` afterwards to have a clean shape
2797 :raises ValueError: if no solids or compounds are found in the stack or parent chain
2798 :return: a CQ object that contains the resulting solid
2799 """
2800 ctxSolid = self.findSolid()
2801
2802 # will contain all of the counterbores as a single compound
2803 results = cast(List[Shape], self.eachpoint(fcn, useLocalCoords).vals())
2804
2805 s = ctxSolid.cut(*results)
2806
2807 if clean:
2808 s = s.clean()
2809
2810 return self.newObject([s])
2811
2812 # TODO: almost all code duplicated!
2813 # but parameter list is different so a simple function pointer won't work

Callers 4

cboreHoleMethod · 0.95
cskHoleMethod · 0.95
holeMethod · 0.95
testCutEachMethod · 0.80

Calls 6

findSolidMethod · 0.95
eachpointMethod · 0.95
newObjectMethod · 0.95
valsMethod · 0.45
cutMethod · 0.45
cleanMethod · 0.45

Tested by 1

testCutEachMethod · 0.64