Loft twisting between sections

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!
Post Reply
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Loft twisting between sections

Post by Joel_graff »

So I'm playing with building rules lofts along splines by auto-generating the loft sections from a master sketch, then aligning them normal to the spline at a fixed interval.

It works really well! However, there's one small issue. Every once in a while, the loft "twists" between sections - the edges cross over to opposite points between two sections.

In the image below, I'm using a sketch of a rectangle, so each section consists of four points. All sections are the same dimenstions, they only differ in their position and orientation.

If I set the section interval to 5 feet or less, it looks fine (top picture), but once I set it to 6 feet or higher, the "twist" appears (bottom picture). The sections, incidentally, are about 12 feet wide and 1 foot thick.

Is this a bug or just something I don't understand about lofting?
Capture1.JPG
Capture1.JPG (18.68 KiB) Viewed 898 times
Capture.JPG
Capture.JPG (18.17 KiB) Viewed 898 times
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
Bance
Veteran
Posts: 4250
Joined: Wed Feb 11, 2015 3:00 pm
Location: London

Re: Loft twisting between sections

Post by Bance »

I don't know if it's pertinent, or even entirely correct, but I seem to remember reading somewhere that the order of creation of lofts can cause this....

meaning the sections should be created in the order that they are lofted through?

Hope someone more enlightened can help more.
Steve.
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Loft twisting between sections

Post by Joel_graff »

Bance wrote: Wed Jan 23, 2019 11:37 pm I don't know if it's pertinent, or even entirely correct, but I seem to remember reading somewhere that the order of creation of lofts can cause this....

meaning the sections should be created in the order that they are lofted through?

Hope someone more enlightened can help more.
I didn't know that, but I assumed it was likely the case. That said, they're generated programmatically, stepping incrementally along the path, so, yes, they're in order. ;)
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Loft twisting between sections

Post by microelly2 »

If the curvature changes into the other direction the binormal vector flips too.
To avoid this these vectors (tangent, normal) must be monitored along the path and when a flip is detected there must be a flag in the calculation which switches back.
This can be done in a extra script. Loft does not handle this.
I have this method soemwhere in my scripts to compute ways on terrains. I must look where it is exactly
this was the use case
https://youtu.be/ZwJ26sdSN_E
Post Reply