mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-06 16:33:15 +01:00
non working start of new utility function to make face with holes in it
This commit is contained in:
parent
dfa5280524
commit
063b8d23d5
1 changed files with 36 additions and 4 deletions
|
|
@ -15,6 +15,8 @@ export interface OCCUtils {
|
|||
|
||||
sketchToFaces(sketch: SketchGeom, csys: CSys): FaceRef[];
|
||||
|
||||
sketchToFace(sketch: SketchGeom, csys: CSys): FaceRef[];
|
||||
|
||||
applyBooleanModifier(tools: MObject[],
|
||||
booleanDef: BooleanDefinition,
|
||||
sketchSource?: MObject,
|
||||
|
|
@ -36,6 +38,14 @@ export function createOCCUtils(ctx: ApplicationContext): OCCUtils {
|
|||
return wiresToFaces(wires);
|
||||
}
|
||||
|
||||
|
||||
function sketchToFace(sketch: SketchGeom, csys: CSys): FaceRef[] {
|
||||
const occ = ctx.occService;
|
||||
|
||||
const wires = occ.io.sketchLoader.pushSketchAsWires(sketch.contours, csys);
|
||||
return wiresToFace(wires);
|
||||
}
|
||||
|
||||
function wiresToFaces(wires: WireRef[]): FaceRef[] {
|
||||
const oci = ctx.occService.commandInterface;
|
||||
return wires.map((wire, i) => {
|
||||
|
|
@ -52,6 +62,28 @@ export function createOCCUtils(ctx: ApplicationContext): OCCUtils {
|
|||
}
|
||||
|
||||
|
||||
|
||||
function wiresToFace(wires: WireRef[]): FaceRef[] {
|
||||
const oci = ctx.occService.commandInterface;
|
||||
const faceName = "Face";
|
||||
oci.mkplane(faceName, wires[0].wire);
|
||||
const brepShell = ctx.occService.io.getLightShell(faceName);
|
||||
|
||||
wires.forEach((wire, index) => {
|
||||
if (index == 0) return;
|
||||
oci.add(faceName, wire.wire);
|
||||
})
|
||||
|
||||
|
||||
return [{
|
||||
face: faceName,
|
||||
topoShape: brepShell,
|
||||
|
||||
}]
|
||||
|
||||
}
|
||||
|
||||
|
||||
function applyBooleanModifier(tools: MObject[],
|
||||
booleanDef: BooleanDefinition,
|
||||
sketchSource: MObject,
|
||||
|
|
@ -131,7 +163,7 @@ export function createOCCUtils(ctx: ApplicationContext): OCCUtils {
|
|||
|
||||
|
||||
return {
|
||||
wiresToFaces, sketchToFaces, applyBooleanModifier
|
||||
wiresToFaces, sketchToFaces, applyBooleanModifier, wiresToFace, sketchToFace,
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue