bitbybit-dev/bitbybit

Check why occt.fillets.fillet2d does not work for a case provided

Closed this issue · 2 comments

`const s = async () => {
const wire = bitbybit.occt.shapes.wire;
const fillets = bitbybit.occt.fillets;

const curveBPoints: Bit.Inputs.Base.Point3[] = [[-23.4, 0, -15.4], [-30.4, 0, -23.4], [-36.9, 0, -27.8]]

const curveTPoints: Bit.Inputs.Base.Point3[] = [[23.4, 0, -15.4], [30.4, 0, -23.4], [36.9, 0, -27.8]]

const curve1Points: Bit.Inputs.Base.Point3[] = [curveBPoints[2], [-27.53, 0, -89.76], [-32.5, 0, -152.31]];
const curve1 = await wire.interpolatePoints({ points: curve1Points, periodic: false, tolerance: 1e-7 })

const curve2Points: Bit.Inputs.Base.Point3[] = [curve1Points[2], [-3.83, 0, -131.54], [22.18, 0, -131.7]];
const curve2 = await wire.interpolatePoints({ points: curve2Points, periodic: false, tolerance: 1e-7 })

const curve3Points: Bit.Inputs.Base.Point3[] = [curve2Points[2], [21.86, 0, -76.2], curveTPoints[2]];
const curve3 = await wire.interpolatePoints({ points: curve3Points, periodic: false, tolerance: 1e-7 })

const combined = await wire.combineEdgesAndWiresIntoAWire({ shapes: [curve1, curve2] });

const options = new Bit.Inputs.Draw.DrawOcctShapeOptions();
options.precision = 0.001;

const filleted = await fillets.fillet2d({ shape: combined, radius: 2 });
bitbybit.draw.drawAnyAsync({ entity: filleted, options });

}

s()`

This simple case with open wire works fine

`
const s = async () => {
const wire = bitbybit.occt.shapes.wire;
const fillets = bitbybit.occt.fillets;

const polyline = await wire.createPolylineWire({
    points: [[0, 0, 0], [1, 0, 0], [1, 0, 1]]
    })


const options = new Bit.Inputs.Draw.DrawOcctShapeOptions();
options.precision = 0.001;

const filleted = await fillets.fillet2d({ shape: polyline, radius: 0.1 });
bitbybit.draw.drawAnyAsync({ entity: filleted, options });

}

s()
`

The problem is that previous algorithm worked only on wires made up of circular and linear edge. It was based on this Ch_Fi2d class

https://dev.opencascade.org/doc/refman/html/class_ch_fi2d.html

Now after this algorithm fails we fall back to 3D wire fillet of bitbybit and use plane normal of the input wire, this works better for non-standard wires.