From 2c8bc6a392ff751427a99b0ba1bd7ec425a94815 Mon Sep 17 00:00:00 2001 From: Steve Genoud Date: Mon, 8 Jan 2024 16:31:04 +0100 Subject: [PATCH] Add support for holes in makeFace --- packages/replicad/src/shapeHelpers.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/replicad/src/shapeHelpers.ts b/packages/replicad/src/shapeHelpers.ts index c3e1eb0..cdea2ff 100644 --- a/packages/replicad/src/shapeHelpers.ts +++ b/packages/replicad/src/shapeHelpers.ts @@ -299,9 +299,12 @@ export const assembleWire = (listOfEdges: (Edge | Wire)[]): Wire => { return wire; }; -export const makeFace = (wire: Wire): Face => { +export const makeFace = (wire: Wire, holes?: Wire[]): Face => { const oc = getOC(); const faceBuilder = new oc.BRepBuilderAPI_MakeFace_15(wire.wrapped, false); + holes?.forEach((hole) => { + faceBuilder.Add(hole.wrapped); + }); if (!faceBuilder.IsDone()) { faceBuilder.delete(); throw new Error("Failed to build the face. Your wire might be non planar.");