Loft has troubles

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!
Lookid
Posts: 44
Joined: Wed Sep 12, 2018 7:39 pm
Location: France

Re: Loft has troubles

Post by Lookid »

I don't know what you mean with snails, but thanks for the tip ^^
User avatar
meme2704
Veteran
Posts: 2926
Joined: Sat Apr 01, 2017 2:47 pm
Location: Vosges

Re: Loft has troubles

Post by meme2704 »

what you mean with snails
Ha, sorry, it's French jargon, a spiral shape, we used to call it in the shape of "snail shell"
This is our good food side with frog legs :lol:
Lookid
Posts: 44
Joined: Wed Sep 12, 2018 7:39 pm
Location: France

Re: Loft has troubles

Post by Lookid »

I'm also french :D But I thought you meant it like a technical word or something ^^
PaulG
Posts: 39
Joined: Mon Feb 25, 2019 5:38 pm

Re: Loft has troubles

Post by PaulG »

(Newbee, first post) I am having a similar problem with loft in a script flipping sides so the result collapses in places.
Lookid wrote: Sat Jan 19, 2019 3:09 pm Finally, I did :
- Create an open section (BSpline in this case)
- Create a line with the two end points
- Create a closed Wire with the two edges
- Loft with solid=True
Could you please explain this more. If I understand correctly, the first three items create a D-shaped closed wire that replaces the rectangles in your first post. But then "Loft with solid=True" can still have the flipping sides problem. What did you do differently in that last step? Did you have more sections, or improve the smoothness, or change the maxDegree, or what? (Also, of course, it would be nice to see the details in the script.)
Lookid
Posts: 44
Joined: Wed Sep 12, 2018 7:39 pm
Location: France

Re: Loft has troubles

Post by Lookid »

@PaulG

Basically, since lofting 'Closed Edges' did not work, but lofting 'Open Edges' did work, I created a Wire from the 'Open Edges' + A straight line to close it. The solid loft then worked.

It looks like this:

Code: Select all

	# This is in a loop, where the increasing sections are created
	Open-edge = section.toShape() # This is my C-Shaped open edge

	# Now I close it with a straight line, which is fine for me
	section_inlet = Part.makeLine(section.value(0), section.value(section.LastParameter))

	#  I make it a Wire
	section_full = Part.Wire([section.toShape(), section_inlet])
	# Place my wire in space
	section_full.rotate(FreeCAD.Vector(0,0,0), FreeCAD.Vector(0,0,1), psi)
	# Create the list of Wires to loft
	section_list.append(section_full)

# And there we go, that does the job
loft = Part.makeLoft(section_list,True)
I think of it as HEXA-BLOCK meshing if you ever did this. The more you divide your model, the more you have control on it, but the more it's a pain. Fortunately, here it is not a pain ^^. Hope this helps you
Lookid
Posts: 44
Joined: Wed Sep 12, 2018 7:39 pm
Location: France

Re: Loft has troubles

Post by Lookid »

Okay, I made some experiment, it turns out I was lucky when it worked for my case ^^'.

I'm lost again with this tool.

1st picture : B-Spline that looks like a C
2nd picture : Same + a line
3rd picture : Same + 3 lines
Attachments
loft_is_love.png
loft_is_love.png (454.97 KiB) Viewed 1091 times
PaulG
Posts: 39
Joined: Mon Feb 25, 2019 5:38 pm

Re: Loft has troubles

Post by PaulG »

Lookid, thank you for confirming that you were lucky. That is what I had suspected, I've been luck fairly often too. I speculate that the problem has to do with the sections curving in a way that the smoothest or shortest curve between some section is achieved by a flip, so that is what the loft algorithm does. If that is the case, then the problem can probably be solved by increasing the number of sections so the space between them is not very large, maybe half the width of the section profile.

I'm hoping there is an easier solution, so if anyone can provide insight it would be much appreciated.
Lookid
Posts: 44
Joined: Wed Sep 12, 2018 7:39 pm
Location: France

Re: Loft has troubles

Post by Lookid »

Unfortunately, this also is not a solution. I tried with a ridiculous amount of Wires, and the result is the same.

FYI, I create my sections on the XY-Plane and they are then place with a rotation.
Attachments
loft_i_cri_everitim.png
loft_i_cri_everitim.png (205 KiB) Viewed 1048 times
User avatar
ben_van
Posts: 1
Joined: Sat Mar 23, 2019 2:44 pm
Location: Sydney, Australia

Re: Loft has troubles

Post by ben_van »

Hi guys,

Just thought I'd share my experience with this. I come from a solidworks background and I'm still quite new to freeCAD.
In solidworks we can define the connection points when lofting between two profiles to avoid problems like this:
SWConnectors.PNG
SWConnectors.PNG (201.76 KiB) Viewed 974 times
but i need FreeCAD for scripting purposes and I dont think theres any option for this?
I have noticed a few things when trying to recreate this same geometry in FreeCAD. Despite giving freecad the points list for each loft profile in the exact same anticlockwise order, or even cloning and scaling the same Bspline, I would never get a reliable result. However, when i went into each profile, and manually sketched the BSpline with the start and end points in the order i wanted them to connect, it worked!?
I had previously been defining the bspline in my script like this:

Code: Select all

curve = Part.BSplineCurve()
curve.interpolate(points,True)
This would only work if i removed the last point in the points list like Lookid has done, but would give me this result:
interpolate_points.PNG
interpolate_points.PNG (60.58 KiB) Viewed 974 times
If i dont use interpolate() and define the bspline like what is displayed in the console when using the GUI, I no longer need to remove any points (start point = end point) and get the result i want:

Code: Select all

Part.BSplineCurve(points,None,None,True,1,None,False)
no_interpolate_points.PNG
no_interpolate_points.PNG (51.56 KiB) Viewed 974 times
It still looks like some kind of interpolation is happening? I have no idea what those input arguments are without getting lost in the source code but it looks like the integer (1) in there, defines some kind of precision?
Maybe this will help some people with similar problems until someone with more knowledge of the source code could shed some light on this.

Ben
Post Reply