[Solved] Unexpected Klein bottle during PDN loft

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
Sam
Posts: 171
Joined: Sun Mar 20, 2016 6:19 pm

[Solved] Unexpected Klein bottle during PDN loft

Postby Sam » Tue Aug 08, 2017 2:08 am

Code: Select all

OS: Ubuntu 16.04.3 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.11740 (Git)/Daily-PPA
Build type: None
Branch: master
Hash: 6b05302c2e70f191a2a5787f55c5b549155b9824
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: English/UnitedKingdom (en_GB)
In the attached file there is a stack of sketches that I'd like to loft through. In fooling around it seems that pretty much any combination works as expected, except all of them in order from base to top. When they are all selected in order (base, 10, 15, 20, 30, 40, top) Freecad seems to try and make some kind of Klein bottle.

My guess is that one of the sketches is upside down, but I can't see or find it.

There is another issue apparent in this file. The loft dialog uses the internal names of the sketches, not their label. This might not be a bug, but it does look like a blatant absence of an expected feature.
Attachments
loft experiment 13.fcstd
(16.35 KiB) Downloaded 30 times
Last edited by Sam on Fri Aug 11, 2017 8:59 pm, edited 1 time in total.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Unexpected Klein bottle during PDN loft

Postby NormandC » Tue Aug 08, 2017 8:46 pm

Sam wrote:
Tue Aug 08, 2017 2:08 am
Klein bottle
That's a new one to me, my mathematics background is pretty basic.

Just looking at the sketches in the 3D view, you can see that there's a vertex along each ellipse. I think this is required by OCC, like for seam edges on cylinders. Anyway, the vertices are not all aligned. Maybe that's what's causing the issue? I would try to rotate the sketches so that all the vertices are aligned on one side.
FC017_Sam_loft_experiment_01.png
FC017_Sam_loft_experiment_01.png (11.74 KiB) Viewed 907 times

Have you considered creating a sweep instead? With a sweep path, you could create datum planes for each sketch on its normal, which would allow you to rotate the sketches easily using the Extra Placement properties.
User avatar
Sam
Posts: 171
Joined: Sun Mar 20, 2016 6:19 pm

Re: Unexpected Klein bottle during PDN loft

Postby Sam » Wed Aug 09, 2017 5:15 am

I don't have time to explore this in detail right now, but I did as you suggested and it appears to have solved my problem.

Is this a bug? Or a feature?

Fooling around raised a couple of other questions, but I'll come back to those tomorrow.

Thanks for taking the time to look at this for me, my friend.
Attachments
loft experiment 14.fcstd
(28.84 KiB) Downloaded 17 times
chrisb
Posts: 18863
Joined: Tue Mar 17, 2015 9:14 am

Re: Unexpected Klein bottle during PDN loft

Postby chrisb » Wed Aug 09, 2017 10:22 am

If you loft from top to bottom it works with the file in the OP.
OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.11740 (Git)
Build type: Release
Branch: (detached from 6b05302)
Hash: 6b05302c2e70f191a2a5787f55c5b549155b9824
Python version: 2.7.13
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: German/Germany (de_DE)
User avatar
Sam
Posts: 171
Joined: Sun Mar 20, 2016 6:19 pm

Re: Unexpected Klein bottle during PDN loft

Postby Sam » Wed Aug 09, 2017 10:59 am

chrisb wrote:
Wed Aug 09, 2017 10:22 am
If you loft from top to bottom it works with the file in the OP.
Ha! That's reassuring. Thanks for taking a look mate.

Edit: I just tried that. You're correct. For certain categories of "works".
Screenshot from 2017-08-10 00-09-35.png
Screenshot from 2017-08-10 00-09-35.png (119.43 KiB) Viewed 855 times
User avatar
Chris_G
Posts: 1141
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Unexpected Klein bottle during PDN loft

Postby Chris_G » Wed Aug 09, 2017 3:20 pm

Hi,
Sam wrote:
Wed Aug 09, 2017 10:59 am
For certain categories of "works".
:lol:

Indeed, the resulting shape is not what we would be expecting.
I inspected the resulting shape.
It is a BSpline surface of high degree (14) with an anarchical pattern of the control points.
Loft-1.jpg
Loft-1.jpg (71.1 KiB) Viewed 837 times
I discretized the initial sketches, in order to create a custom approximating BSpline surface on which I have more control parameters.
At first, I got the same kind of bad result :
Loft-2.jpg
Loft-2.jpg (74.3 KiB) Viewed 837 times
But when using the smoothing algorithm and limiting the maxdegree to 11, I got something much better :
Loft-3.jpg
Loft-3.jpg (15.55 KiB) Viewed 837 times
Loft-4.jpg
Loft-4.jpg (46.03 KiB) Viewed 837 times
The result looks more natural, and the underlying BSpline surface also has better shape.
FreeCAD file attached below.


I looked at the source code.
The makeLoft function uses OCC BRepOffsetAPI_ThruSections that offers these control functions ( smoothing algorithm, setting the max degree, setting the parametrization type).
So it may be good to have them implemented in the loft tool ?
Attachments
Loft-2.fcstd
(49.15 KiB) Downloaded 12 times
User avatar
Sam
Posts: 171
Joined: Sun Mar 20, 2016 6:19 pm

Re: Unexpected Klein bottle during PDN loft

Postby Sam » Wed Aug 09, 2017 10:16 pm

Thanks for taking a look Chris_G
Chris_G wrote:
Wed Aug 09, 2017 3:20 pm
I inspected the resulting shape.
I've had a look around for the tools you used to do this, but came up empty.

Would you mind giving me a clue what to google for please?

I had a play with the surface WB a while ago, but also failed to get it to do anything useful. The curves WB is also somewhat of a mystery to me, but looks like it has a lot of relevant tools...

Edit: Forgot to add: What you were doing there looks very cool!
Edit again: Searching the forum I see your thread Flatten a face. I fear your grasp of things FreeCAD will be forever beyond me!
Still another edit: I just saw that the Curves workbench belongs to you. This explains a few things! :D :ugeek:
User avatar
Chris_G
Posts: 1141
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Unexpected Klein bottle during PDN loft

Postby Chris_G » Thu Aug 10, 2017 1:21 pm

Sam wrote:
Wed Aug 09, 2017 10:16 pm
I've had a look around for the tools you used to do this, but came up empty.

Would you mind giving me a clue what to google for please?

I had a play with the surface WB a while ago, but also failed to get it to do anything useful. The curves WB is also somewhat of a mystery to me, but looks like it has a lot of relevant tools...
I first thought you were only interested in the loft result of your FC file.
But if you are curious about Bezier and BSpline surfaces, I used the GeomInfo tool of my workbench.
This the highlighted icon in the screenshot below :

Image
User avatar
Sam
Posts: 171
Joined: Sun Mar 20, 2016 6:19 pm

Re: Unexpected Klein bottle during PDN loft

Postby Sam » Thu Aug 10, 2017 9:53 pm

Chris_G wrote:
Thu Aug 10, 2017 1:21 pm
I first thought you were only interested in the loft result of your FC file.
But if you are curious about Bezier and BSpline surfaces, I used the GeomInfo tool of my workbench.
Thanks.

Don't think you wasted your time, I am interested in getting that loft to work.

I'd also like to learn how to create and manipulate more complex curves and surfaces. Your post intrigued me. :geek: I have been given some good tips for learning generic background in this thread; there's little value in ignorance.
User avatar
Sam
Posts: 171
Joined: Sun Mar 20, 2016 6:19 pm

Re: Unexpected Klein bottle during PDN loft

Postby Sam » Thu Aug 10, 2017 10:45 pm

As far as I'm concerned, I have been helped to achieve what I was after. Thanks for that.

My question now:
Is the issue seen in the OP expected behaviour? It seems unlikely.
If it isn't, should I raise an issue in the tracker?