UNPKG

@bitbybit-dev/occt

Version:

Bit By Bit Developers CAD algorithms using OpenCascade Technology kernel. Run in Node and in Browser.

79 lines (78 loc) 2.47 kB
import * as Inputs from "../../api/inputs/inputs"; export class OCCTShape { constructor(occ, och) { this.occ = occ; this.och = och; } purgeInternalEdges(inputs) { const purge = new this.occ.TopOpeBRepTool_PurgeInternalEdges(inputs.shape, true); purge.Perform(); if (purge.IsDone()) { return purge.Shape(); } else { throw new Error("Could not purge internal edges for the shape"); } } unifySameDomain(inputs) { const unify = new this.occ.ShapeUpgrade_UnifySameDomain_2(inputs.shape, inputs.unifyEdges, inputs.unifyFaces, inputs.concatBSplines); unify.Build(); return unify.Shape(); } isClosed(inputs) { return inputs.shape.Closed_1(); } isConvex(inputs) { return inputs.shape.Convex_1(); } isChecked(inputs) { return inputs.shape.Checked_1(); } isFree(inputs) { return inputs.shape.Free_1(); } isInfinite(inputs) { return inputs.shape.Infinite_1(); } isModified(inputs) { return inputs.shape.Modified_1(); } isLocked(inputs) { return inputs.shape.Locked_1(); } isNull(inputs) { return inputs.shape.IsNull(); } isEqual(inputs) { return inputs.shape.IsEqual(inputs.otherShape); } isNotEqual(inputs) { return inputs.shape.IsNotEqual(inputs.otherShape); } isPartner(inputs) { return inputs.shape.IsPartner(inputs.otherShape); } isSame(inputs) { return inputs.shape.IsSame(inputs.otherShape); } getOrientation(inputs) { const orientation = inputs.shape.Orientation_1(); let result; if (orientation === this.occ.TopAbs_Orientation.TopAbs_FORWARD) { result = Inputs.OCCT.topAbsOrientationEnum.forward; } else if (orientation === this.occ.TopAbs_Orientation.TopAbs_REVERSED) { result = Inputs.OCCT.topAbsOrientationEnum.reversed; } else if (orientation === this.occ.TopAbs_Orientation.TopAbs_INTERNAL) { result = Inputs.OCCT.topAbsOrientationEnum.internal; } else if (orientation === this.occ.TopAbs_Orientation.TopAbs_EXTERNAL) { result = Inputs.OCCT.topAbsOrientationEnum.external; } return result; } getShapeType(inputs) { return this.och.enumService.getShapeTypeEnum(inputs.shape); } }