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

Function faceOn

cadquery/occ_impl/shapes.py:6011–6041  ·  view source on GitHub ↗

Build face(s) on base by mapping planar face(s) onto the (u,v) space of base.

(base: Shape, *fcs: Shape, tol: float = 1e-6, N: int = 20)

Source from the content-addressed store, hash-verified

6009
6010
6011def faceOn(base: Shape, *fcs: Shape, tol: float = 1e-6, N: int = 20) -> Face | Compound:
6012 """
6013 Build face(s) on base by mapping planar face(s) onto the (u,v) space of base.
6014 """
6015
6016 rv: Shape
6017 rvs = []
6018
6019 # get a face
6020 fbase = _get_one(base, "Face")
6021
6022 # iterate over all faces
6023 for el in fcs:
6024 for fc in el.Faces():
6025 # construct pcurves and trim in one go
6026 rvs.append(
6027 fbase.trim(
6028 tcast(Wire, wireOn(fbase, fc.outerWire(), tol=tol, N=N)),
6029 *(
6030 tcast(Wire, wireOn(fbase, w, tol=tol, N=N))
6031 for w in fc.innerWires()
6032 ),
6033 )
6034 )
6035
6036 if len(rvs) == 1:
6037 rv = rvs[0]
6038 else:
6039 rv = compound(rvs)
6040
6041 return rv
6042
6043
6044def _process_sewing_history(

Callers 1

test_faceOnFunction · 0.85

Calls 8

_get_oneFunction · 0.85
wireOnFunction · 0.85
compoundFunction · 0.85
appendMethod · 0.80
outerWireMethod · 0.80
innerWiresMethod · 0.80
FacesMethod · 0.45
trimMethod · 0.45

Tested by 1

test_faceOnFunction · 0.68