Loft BOPAlgo.SelfIntersect error

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
grandcross
Posts: 350
Joined: Sun Oct 11, 2015 3:08 pm
Contact:

Loft BOPAlgo.SelfIntersect error

Post by grandcross »

Simply put, the Loft is generating errors I'm not sure I can fix. Here's what I'm doing:

Generate the shape of a fin root. Generate a shape for the fin tip. Create a solid loft and you have a fin. This works well for many shapes, but when I try it with an airfoil it generates self intersect errors.

I've included a macro which shows the problem. Open an empty project and run the macro. It will show a root chord outline, a fin chord outline, and the lofted fin offset so everything is visible. Switch to the Part workspace, select them all, and select Check Geometry from the Part menu. It will show you the part has errors even though the root and tip chords are fine.

I know a loft is a complex operation, but is this something I just have to live with? Is there anything I can do to fix it?

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.29177 (Git)
Build type: Release
Branch: releases/FreeCAD-0-20
Hash: 68e337670e227889217652ddac593c93b5e8dc94
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.2
Locale: English/United States (en_US)
Installed mods: 
  * 3D_Printing_Tools
  * A2plus 0.4.59c
  * Assembly3 0.11.3
  * Assembly4 0.12.4
  * fasteners 0.4.12
  * fcgear 1.0.0
  * GDML 2.0.0
  * kicadStepUpMod 10.15.1
  * LCInterlocking
  * parts_library
  * Rocket 2.8.2
Attachments
LoftError.FCMacro
(1.89 KiB) Downloaded 13 times
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Loft BOPAlgo.SelfIntersect error

Post by onekk »

Did you see the wiki page about Loft?

There are some technical details to make a correct loft.

As example the two profiles must have same number of segments.

and if they bend the angle must no be too sharp, eventually add an itermediate profile (with same edges count) to guide the bend.

Usually for a non complicated loft it will work on most cases.

Regards.

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
grandcross
Posts: 350
Joined: Sun Oct 11, 2015 3:08 pm
Contact:

Re: Loft BOPAlgo.SelfIntersect error

Post by grandcross »

You sir are a magician!

I was making a single spline for the airfoil. By splitting it into two separate splines of a half airfoil each, the loft had enough reference points to generate a proper shape. Thanks!
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Loft BOPAlgo.SelfIntersect error

Post by onekk »

grandcross wrote: Fri Sep 30, 2022 12:24 pm You sir are a magician!
...
You are welcome!

It not black magic, it is simply the count of error made, renamed experience. :D

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Loft BOPAlgo.SelfIntersect error

Post by chrisb »

onekk wrote: Fri Sep 30, 2022 9:28 am As example the two profiles must have same number of segments.
For completeness sake: this is not a must, but it is recommended for better control, and as seen here: it helps.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
grandcross
Posts: 350
Joined: Sun Oct 11, 2015 3:08 pm
Contact:

Re: Loft BOPAlgo.SelfIntersect error

Post by grandcross »

chrisb wrote: Fri Sep 30, 2022 9:38 pm
onekk wrote: Fri Sep 30, 2022 9:28 am As example the two profiles must have same number of segments.
For completeness sake: this is not a must, but it is recommended for better control, and as seen here: it helps.
That's not entirely true here. Both had the same number of segments already: one. Even adding intermediate chords had no effect. Splitting the chords into two just gave it more reference points to use for lofting.
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Loft BOPAlgo.SelfIntersect error

Post by onekk »

grandcross wrote: Sat Oct 01, 2022 4:40 am That's not entirely true here. Both had the same number of segments already: one. Even adding intermediate chords had no effect. Splitting the chords into two just gave it more reference points to use for lofting.
I have tested first file with my 0.20.1 Linux version:

Code: Select all

OS: Artix Linux (openbox)
Word size of FreeCAD: 64-bit
Version: 0.20.1.29410 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0.20.1)
Hash: f5d13554ecc7a456fb6e970568ae5c74ba727563
Python 3.10.5, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.2
Locale: Italian/Italy (it_IT)
Installed mods: 
  * Assembly4 0.12.4
  * toSketch 1.0.1
  * Curves 0.5.8
And it works, even with the bsplines with a single segment.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Loft BOPAlgo.SelfIntersect error

Post by onekk »

chrisb wrote: Fri Sep 30, 2022 9:38 pm
onekk wrote: Fri Sep 30, 2022 9:28 am As example the two profiles must have same number of segments.
For completeness sake: this is not a must, but it is recommended for better control, and as seen here: it helps.
Thanks for pointing out this fact.

In fact testing the first file as told in my preceding post it works, without errors, but I don't see differences in OCCT version so I have some doubt what is causing the error in the OP installation.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
Post Reply