Loft creating more lines and faces than expected

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
esmith1441
Posts: 2
Joined: Tue Jan 18, 2022 10:54 pm

Loft creating more lines and faces than expected

Post by esmith1441 »

Hello, Thank you for reading my post. I am having issues lofting with two wire objects generated from a .dat file. The issue is that I am ending up with more faces and lines than expected on the lofted feature. I looked at different tutorials and I cannot find another instance of this happening. Any help is appreciated. Thank you.

Attached is the FreeCAD model file with the issue and an image of what is on my machine. I cannot upload the . dat file but it is 600 rows of 2 columns of the format:
1.000000 0.001260
0.995000 0.001959
0.990000 0.002654
...
0.995000 -0.001959
1.000000 -0.001260


my current version information:

OS: Windows 10 Version 2009
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24267 +99 (Git)
Build type: Release
Branch: Branch_0.19.3
Hash: 6530e364184ce05ccff39501e175cf2237e6ee4b
Python version: 3.8.6+
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.5.3
Locale: English/United States (en_US)
Attachments
loft.PNG
loft.PNG (7.76 KiB) Viewed 774 times
airfoil.FCStd
(166.24 KiB) Downloaded 11 times
close up of the loft I am generating
close up of the loft I am generating
freecad_loft_issue.PNG (91.7 KiB) Viewed 774 times
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Loft creating more lines and faces than expected

Post by GeneFC »

I am guessing that you made the wire from the 600 points. That will create a polygon with 600 sides. The lines you are seeing are the breaks between each of those 600 segments.

If you simply want a nice view you can select View >> Draw Style >> Shaded in the top menu.

If you really want the actual segments to smoothly blend then you will need to do a bit more work. One method is to redraw with splines in the Sketcher WB. Significantly more effort.

Gene
heda
Veteran
Posts: 1348
Joined: Sat Dec 12, 2015 5:49 pm

Re: Loft creating more lines and faces than expected

Post by heda »

does not have to be much work to get it to a spline.

a polyline can be made into a spline with a click in draft... Draft_WireToBSpline

or Macro_AeroFoil

or a handful lines of python does the job.

Code: Select all

import Draft
from pathlib import Path

text = """
1.000000 0.001260
0.995000 0.001959
0.990000 0.002654
0.995000 -0.001959
1.000000 -0.001260
"""
floatify = lambda row: [float(c) for c in row.split()] + [0]
pts = [App.Vector(*floatify(row)) for row in text.splitlines()]
spl = Draft.makeBSpline(pts) # makeBSpline(pts, closed=True)

# if you do not want to paste the 600 lines here...
#file = Path(r'c:\to where ever the file is')
#text = file.read_text()

# small comment
# not very meaningful to have 600 points in a spline
# if you do pts[::6] it will take every 6th point,
# you probably have to adjust your input a bit to get the ones
# you need to make the ending nice, or just do pts[::6] + pts[-1:]
# or something along those lines
# suppose one needs to watch out both at leading/trailing edge with the points
TheMarkster
Veteran
Posts: 5513
Joined: Thu Apr 05, 2018 1:53 am

Re: Loft creating more lines and faces than expected

Post by TheMarkster »

heda wrote: Wed Jan 19, 2022 5:02 pm

Code: Select all


# small comment
# not very meaningful to have 600 points in a spline
# if you do pts[::6] it will take every 6th point,
# you probably have to adjust your input a bit to get the ones
# you need to make the ending nice, or just do pts[::6] + pts[-1:]
# or something along those lines
# suppose one needs to watch out both at leading/trailing edge with the points
Thanks for that little tip. I did not know about this [::6] to get only every 6th point.

I also agree that fewer points can produce a better surface. I have seen this in ThreadProfile. The problem with such reduction is you can get a less accurate representation if some significant points are skipped. If you know where the important points are then you can use some form of variable density. For example if points 300-400 are more significant:

Code: Select all

pts = pts[:299:6] + pts[300:400:2] + pts[401::6]
This way we would get every 6th point for the less important ones and every other point for the more important ones.
drmacro
Veteran
Posts: 8982
Joined: Sun Mar 02, 2014 4:35 pm

Re: Loft creating more lines and faces than expected

Post by drmacro »

I might have missed it in the discussion and is an FYI FWIW comment.

If the profile was imported via the File>Import Common airfoil data, then the wire that is created ends up being a spline with what ever number of vertexes were defined in the file...and thus when extruded, there is an edge for each.

I realized this while looking at the recent updates in importAirfoilDAT.py

:geek:
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
esmith1441
Posts: 2
Joined: Tue Jan 18, 2022 10:54 pm

Re: Loft creating more lines and faces than expected

Post by esmith1441 »

thanks all for all of the help! THE Advice and the python code worked!
Post Reply