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

Function draft

cadquery/occ_impl/shapes.py:7794–7822  ·  view source on GitHub ↗

Add a draft angle to the specified faces.

(
    ctx: Shape,
    base: Shape,
    faces: Shape,
    angle: Real,
    history: History | None = None,
    name: str | None = None,
)

Source from the content-addressed store, hash-verified

7792
7793@multidispatch
7794def draft(
7795 ctx: Shape,
7796 base: Shape,
7797 faces: Shape,
7798 angle: Real,
7799 history: History | None = None,
7800 name: str | None = None,
7801) -> Shape:
7802 """
7803 Add a draft angle to the specified faces.
7804 """
7805
7806 base_face = base.face()
7807 n_dir = base_face.normalAt().toDir()
7808 base_pln = base_face.toPln()
7809
7810 bldr = BRepOffsetAPI_DraftAngle(ctx.wrapped)
7811
7812 for f in _get_faces(faces):
7813 bldr.Add(f.wrapped, n_dir, radians(angle), base_pln)
7814
7815 if not bldr.AddDone():
7816 raise ValueError(f"Face {f} cannot be used in a draft operation.")
7817
7818 bldr.Build()
7819
7820 _update_history(history, name, [ctx], bldr)
7821
7822 return _compound_or_shape(bldr.Shape())
7823
7824
7825@multidispatch

Callers 1

test_draftFunction · 0.85

Calls 8

_get_facesFunction · 0.85
_update_historyFunction · 0.85
_compound_or_shapeFunction · 0.85
VectorClass · 0.85
toDirMethod · 0.80
faceMethod · 0.45
normalAtMethod · 0.45
toPlnMethod · 0.45

Tested by 1

test_draftFunction · 0.68