Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot fillet bezier curve? #33

Open
lf94 opened this issue Jun 17, 2022 · 6 comments
Open

Cannot fillet bezier curve? #33

lf94 opened this issue Jun 17, 2022 · 6 comments

Comments

@lf94
Copy link

lf94 commented Jun 17, 2022

Try this:

const main = ({ draw, Plane }, {}) => {

  const svg = draw()
    .movePointerTo([-179.49317, 229.08022]) // MoveRelative
    .cubicBezierCurveTo([-134.57393, 223.51058], [-164.41155, 229.50992], [-153.52899, 220.8208]) // CubicBezierRelative
    .cubicBezierCurveTo([-97.78017299999999, 236.07604], [-121.74239999999999, 225.33141], [-110.70716999999999, 235.15067]) // CubicBezierRelative
    .cubicBezierCurveTo([-56.19808599999999, 221.49432000000002], [-73.17078899999998, 237.8377], [-70.662489, 224.04875]) // CubicBezierRelative
    .cubicBezierCurveTo([-28.07106799999999, 221.87134], [-46.44357099999999, 219.77167000000003], [-37.54805499999999, 224.75315]) // CubicBezierRelative
    .cubicBezierCurveTo([0.8247687900000109, 203.31125], [-17.672257999999992, 218.70922000000002], [-6.269769299999989, 208.28335]) // CubicBezierRelative
    .cubicBezierCurveTo([23.788634000000012, 202.07363], [7.102314400000011, 198.91173], [16.31533800000001, 203.78046]) // CubicBezierRelative
    .cubicBezierCurveTo([51.22988700000001, 190.62543], [33.45101300000001, 199.86683000000002], [41.609496000000014, 193.00862]) // CubicBezierRelative
    .cubicBezierCurveTo([70.26589700000001, 188.89925], [57.414324000000015, 189.0934], [64.34909900000001, 191.2627]) // CubicBezierRelative
    .cubicBezierCurveTo([82.85932400000002, 178.92971], [75.23789300000001, 186.9132], [78.37061700000001, 181.84804]) // CubicBezierRelative
    .cubicBezierCurveTo([97.09665800000002, 171.45717], [87.35285100000002, 176.00825], [92.87883400000001, 174.76424]) // CubicBezierRelative
    .cubicBezierCurveTo([108.93390000000002, 158.07532999999998], [101.78319000000002, 167.78260999999998], [105.43517000000001, 162.89454999999998]) // CubicBezierRelative
    .cubicBezierCurveTo([128.25199000000003, 125.23221999999998], [116.39573000000003, 147.79726], [121.14360000000002, 135.75781999999998]) // CubicBezierRelative
    .cubicBezierCurveTo([179.11347000000004, 59.19189199999998], [143.80255000000002, 102.20605999999998], [164.58317000000005, 82.87509699999998]) // CubicBezierRelative
    .cubicBezierCurveTo([218.00120000000004, -22.48978700000002], [194.88322000000002, 33.48848599999998], [202.89865000000003, 3.6112338999999807]) // CubicBezierRelative
    .cubicBezierCurveTo([257.88845000000003, -80.20100400000001], [229.71278000000004, -42.730361000000016], [246.64462000000003, -59.69690100000002]) // CubicBezierRelative
    .cubicBezierCurveTo([285.85872000000006, -146.64979], [269.44347000000005, -101.27260000000001], [274.36004, -125.54739000000001]) // CubicBezierRelative
    .cubicBezierCurveTo([343.9925600000001, -231.72992], [302.2934900000001, -176.81095], [325.30259000000007, -202.91183999999998]) // CubicBezierRelative
    .cubicBezierCurveTo([387.84852000000006, -303.0538], [359.1790200000001, -255.14593], [387.84852000000006, -303.0538]) // CubicBezierRelative
    .cubicBezierCurveTo([392.2010200000001, -440.01369], [421.50979000000007, -357.79784], [412.96081000000004, -413.28978]) // CubicBezierRelative
    .cubicBezierCurveTo([273.8188800000001, -466.22706], [370.8666700000001, -467.47723], [321.77868000000007, -475.70766]) // CubicBezierRelative
    .cubicBezierCurveTo([213.27782000000008, -427.05046], [249.6697200000001, -461.4533], [218.4492400000001, -433.61814]) // CubicBezierRelative
    .cubicBezierCurveTo([174.68746000000007, -381.45858999999996], [205.49015000000009, -417.16015999999996], [188.66695000000007, -392.50471]) // CubicBezierRelative
    .cubicBezierCurveTo([122.99144, -333.90123], [159.50738, -369.46381], [131.7499, -343.83309]) // CubicBezierAbsolute
    .cubicBezierCurveTo([23.493637, -223.27303], [117.98028, -328.2187], [55.033721, -261.54896]) // CubicBezierAbsolute
    .cubicBezierCurveTo([-131.41307, -17.782939], [-31.055971, -157.07356], [-84.540748, -89.623142]) // CubicBezierAbsolute
    .cubicBezierCurveTo([-164.43605, 55.392448], [-145.07156, 3.1511358000000023], [-152.08484, 33.596646]) // CubicBezierRelative
    .cubicBezierCurveTo([-198.55822, 102.18889], [-174.72982, 73.557539], [-190.75036, 82.875399]) // CubicBezierRelative
    .cubicBezierCurveTo([-219.37006, 181.01762], [-208.74403, 127.38445], [-219.39909, 163.39419]) // CubicBezierRelative
    .cubicBezierCurveTo([-179.49317, 229.08022], [-219.33406, 202.87072], [-202.43656, 228.42652999999999]) // CubicBezierRelative
  .done()
  .sketchOnPlane(new Plane('XY'));

  const footBase = svg
    .extrude(40)
    .fillet(1, e => e.inDirection('Z'));

  const foot = footBase;
  return [foot];
}

It'll fail no matter what you try it seems...

@sgenoud
Copy link
Owner

sgenoud commented Jun 17, 2022

I have played a bit, and failed to fillet it - it feels like the OC kernel does not like your shape here...

@lf94
Copy link
Author

lf94 commented Jun 17, 2022

What gets me is it's essentially just one big curve 😅 I don't see why it wouldn't like it...! Thanks for trying

@lf94
Copy link
Author

lf94 commented Jun 17, 2022

So just to confirm, using RepliCAD (or any OC based tool) for this then is a dead end right?

@sgenoud
Copy link
Owner

sgenoud commented Jun 22, 2022

It depends also on your model - this is not because it is a bezier spline, but because the angles your shape do are kinda incompatible with the fillet you request (with the algorithm OC uses).

For instance

const main = ({ draw, drawRoundedRectangle }) => {
  return draw()
    .halfEllipse(0, 20, 5)
    .smoothSpline(25, -3)
    .smoothSpline(20, 8)
    .smoothSpline(-20, -30, -90)
    .close()
    .sketchOnPlane("XY")
    .extrude(5)
    .fillet(0.5, (e) => e.inPlane("XY"));
};

will return a filleted shape. But if you change the fillet to 1, it will kernel error.

I would be interested to see if you can achieve filleting the same shape with cadquery (it might be fairly easy to port your code).

@raydeleu
Copy link

I tried to fillet your shape in Moi3D, but this program also has difficulty creating a fillet. I selected the complete top edge, but the marked part failed to fillet. On the other parts, the fillet is not complete either, as the straight part of the surface has not been removed.

image

@raydeleu
Copy link

After importing the shape into FreeCad it was indeed not possible to create a fillet. Yet, OnShape has no problem creating a fillet, 1 mm or 5 mm, it all works. Note that the STEP file used in OnShape was created in Replicad. This confirms that Parasolid is one of the more robust 3D kernels available (which is reflected in its price) but also that Replicad can produce a STEP file that can be used for further processing in other CAD tools.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants