Pocket operation distorts solid made from b-spline profiles

Report observations made with the new Toponaming branch.
Post Reply
MediumCrab
Posts: 4
Joined: Thu Feb 24, 2022 9:47 pm

Pocket operation distorts solid made from b-spline profiles

Post by MediumCrab »

I'm relatively new to Freecad but have fairly good Solidworks experience. Enjoying the learning process and really grateful to the folks contributing to this software and all the support on the forums.

I'm currently trying to model a simple wing-like structure. It is a loft between two airfoil profiles, mirrored about the center and then a cut-out made with a pocket. I have also tried a simple Pad of a single airfoil profile with the same results as below.

The problem I am running into is that after I make the pocket, my nice smooth airfoil body turns crinkly. See the before/after screenshots: in the 'after', the leading edge has an irregular appearance. This is reflected in exported STLs from before/after; the 'after' STLs are very complicated and irregular on a micro scale, disrupting the slicing and resulting in a poor 3D printed part vs the 'before'.

I feel like the somehow boils down to the fact the loft profiles include b-splines. If I replace my profiles with simple polygons, I don't get this issue. But I want to use the b-spline profiles.

In the attached freecad file, make the 'Pocket' operation visible to see the effect.

Before:
before_pocket.png
before_pocket.png (78.54 KiB) Viewed 789 times
After:
after_pocket.png
after_pocket.png (59.14 KiB) Viewed 789 times
showing Stl in cura:
cura_stl.png
cura_stl.png (85.04 KiB) Viewed 789 times
I've been using Freecad Link Branch as well as regular Freecad with the same results in both:
OS: Ubuntu 20.04.4 LTS (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 2022.430.26244 +4758 (Git) AppImage
Build type: Release
Branch: LinkDaily
Hash: b024b876480a533018fdc702145e9e38f8c54ba6
Python version: 3.9.12
Qt version: 5.12.9
Coin version: 4.0.1
OCC version: 7.5.3
Locale: English/United Kingdom (en_GB)

Any guidance gratefully received!
Attachments
frontwing_foil_v2.FCStd
(463.71 KiB) Downloaded 10 times
chrisb
Veteran
Posts: 43701
Joined: Tue Mar 17, 2015 9:14 am

Re: Pocket operation distorts solid made from b-spline profiles

Post by chrisb »

Moved from Help forum. Opened in master the last sketch shows an error.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
adrianinsaval
Veteran
Posts: 3190
Joined: Thu Apr 05, 2018 5:15 pm

Re: Pocket operation distorts solid made from b-spline profiles

Post by adrianinsaval »

You need to reduce the tolerance for the mesh, on the property tab go to the view tab and reduce the deviation and angular deflection, note that this will increase the recomputation time. For the specific case of wing profiles I found that splitting the airfoil spline at the leading edge gave much better results. Have a look at the airplane design workbench, it's not very polished but the tool to make airfoils is pretty good
MediumCrab
Posts: 4
Joined: Thu Feb 24, 2022 9:47 pm

Re: Pocket operation distorts solid made from b-spline profiles

Post by MediumCrab »

Thank you for your suggestion. Reducing the 'deviation' property as you suggested did improve the appearance (although not perfect), and probably would be sufficient for what I want to do.

But I'm curious why this happens? Before the pocket, the leading edge was perfect, and afterwards it is distorted, even though the pocket didn't touch that area?
User avatar
hammax
Veteran
Posts: 1599
Joined: Thu Jan 19, 2017 5:03 pm
Location: Ammersee DE

Re: Pocket operation distorts solid made from b-spline profiles

Post by hammax »

... here is a variable "real smooth" BSpline approach to your NACA profile.
The External Link makes trouble.
And you get a "mesh free" leading edge.

Frontwing.PNG
Frontwing.PNG (35.3 KiB) Viewed 603 times
Attachments
frontwing_foil_3.FCStd
FC.20
(413.6 KiB) Downloaded 7 times
MediumCrab
Posts: 4
Joined: Thu Feb 24, 2022 9:47 pm

Re: Pocket operation distorts solid made from b-spline profiles

Post by MediumCrab »

Thanks for this example. Looks like it completely solves the issue! I can see your profile is split at the leading edge and has a very thin thickness at the trailing edge. Are these details important? Did you create it from my "naca2412_" bspine or from something else?

This seems like a common issue: the wing profiles I create using the AirplaneDesign workbench (which is fantastic - thanks for the suggestion) all exhibit the problem. Would we have to manually tweak the generated profiles to have splits at leading edge and finite thickness trailing edges?
airfoildesign_crinkle.png
airfoildesign_crinkle.png (124.21 KiB) Viewed 583 times
adrianinsaval
Veteran
Posts: 3190
Joined: Thu Apr 05, 2018 5:15 pm

Re: Pocket operation distorts solid made from b-spline profiles

Post by adrianinsaval »

I think airplane design should have an option to split the edge and have a small gap at the trailing edge, at least the utility to make just wingribs does. My best guess is that OCC struggles to properly mesh that kind of bsplines.
User avatar
hammax
Veteran
Posts: 1599
Joined: Thu Jan 19, 2017 5:03 pm
Location: Ammersee DE

Re: Pocket operation distorts solid made from b-spline profiles

Post by hammax »

... I used your NACA profile to redraw a "flexible" airfoil.
The leading edge gets a (vertical) tangent, 2 coincident knots and 2 control points on Y-axis (movable and weight controlled).
The trailing edge is a vertical mirrored line with fixed length for the 2 end knots of the splines.
Convert the upper profile to spline, insert at least 2 control points - same procedure with lower profile.
Now you can pull the control points to adapt the profile form to the master profile.
And you are able to de-/increase the weight circles at your will.
( I think the profile authors did it in a similar, but mathematical way - BSpline does it also)
You get a smooth BSpline with no inner knots => they always generate a kink in the curvature comb, if you have more than 2 control points.

Frontwing_2.PNG
Frontwing_2.PNG (27.47 KiB) Viewed 466 times
Attachments
frontwing_foil_4.FCStd
FC.20
(12.15 KiB) Downloaded 8 times
MediumCrab
Posts: 4
Joined: Thu Feb 24, 2022 9:47 pm

Re: Pocket operation distorts solid made from b-spline profiles

Post by MediumCrab »

Thanks hammax. That is a neat trick! There is so much depth to Freecad.

I have noticed that even with the 'mesh' appearing perfect in Freecad, it still has minor crinkles when exported as STL. However, the magnitude is dramatically reduced with the approaches shown in this thread, and I'm happy now that I can do what I want to do. Thanks for the assistance!
Post Reply