UNPKG

@bitbybit-dev/occt

Version:

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

72 lines (71 loc) 2.24 kB
import * as Inputs from "../../api/inputs"; export class OCCTShape { constructor(occ, och) { this.occ = occ; this.och = och; } purgeInternalEdges(inputs) { // Note: TopOpeBRepTool_PurgeInternalEdges is not exposed in this build // Return the input shape unchanged as a fallback return inputs.shape; } unifySameDomain(inputs) { return this.occ.ShapeUpgrade_UnifySameDomain_Perform(inputs.shape, inputs.unifyEdges, inputs.unifyFaces, inputs.concatBSplines); } isClosed(inputs) { return inputs.shape.Closed(); } isConvex(inputs) { return inputs.shape.Convex(); } isChecked(inputs) { return inputs.shape.Checked(); } isFree(inputs) { return inputs.shape.Free(); } isInfinite(inputs) { return inputs.shape.Infinite(); } isModified(inputs) { return inputs.shape.Modified(); } isLocked(inputs) { return inputs.shape.Locked(); } 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(); let result; if (orientation === this.occ.TopAbs_Orientation.FORWARD) { result = Inputs.OCCT.topAbsOrientationEnum.forward; } else if (orientation === this.occ.TopAbs_Orientation.REVERSED) { result = Inputs.OCCT.topAbsOrientationEnum.reversed; } else if (orientation === this.occ.TopAbs_Orientation.INTERNAL) { result = Inputs.OCCT.topAbsOrientationEnum.internal; } else if (orientation === this.occ.TopAbs_Orientation.EXTERNAL) { result = Inputs.OCCT.topAbsOrientationEnum.external; } return result; } getShapeType(inputs) { return this.och.enumService.getShapeTypeEnum(inputs.shape); } }