×

Notice

The forum is in read only mode.

How to import an airfoil geometry

  • Alessandro Di Placido
  • Topic Author
  • Offline
  • New Member
  • New Member
More
16 years 6 months ago #2049 by Alessandro Di Placido
How to import an airfoil geometry was created by Alessandro Di Placido
Hi!
I have installed salome-meca 3.2.6. I want to import an airfoil geometry but I don't know how. I have a text file with the biaxial coordinates of hundreds of points. Obviously I don't want to insert all the coordinates manually. How can I do it? I don't know if this is a silly question. The fact is that I'm not so good in using both this program and linux.
Thank you for your patience.
  • Luis Fernando Garcia
  • Offline
  • New Member
  • New Member
More
11 years 6 months ago #6966 by Luis Fernando Garcia
Replied by Luis Fernando Garcia on topic Re: How to import an airfoil geometry
Hi!

Currently I'm looking for that answer too, I've seen that you wrote this too many years ago but if you're still using this software it'll be helpful if you could help me with the solution of your problem.

I hope you or anyone see it.
The following user(s) said Thank You: TUYEN
More
11 years 5 months ago - 11 years 5 months ago #6986 by Dirk Schweitzer
Replied by Dirk Schweitzer on topic Re: How to import an airfoil geometry
Hi,

assuming that your airfoil data is saved in two-column (X,Y) format like e.g.

AG24 Bubble Dancer DLG by Mark Drela
1.000000 0.000312
0.994048 0.001043
0.982038 0.002630
0.968488 0.004486
0.954647 0.006421
0.940769 0.008378
...

you could write a small python script to import the data.

Hope that helps,
Dirk
import geompy
f = open('ag24.dat', 'r')
data = f.readlines()[1:]
f.close()
pts = [map(float,line.split()) for line in data]

i = 0
for x in pts:
  geompy.addToStudy(geompy.MakeVertex(x[0], x[1], 0), 'pt' + str(i))
  i+=1
Last edit: 11 years 5 months ago by kwou.
The following user(s) said Thank You: Luis Fernando Garcia, TUYEN
  • Luis Fernando Garcia
  • Offline
  • New Member
  • New Member
More
11 years 5 months ago #6988 by Luis Fernando Garcia
Replied by Luis Fernando Garcia on topic Re: How to import an airfoil geometry
Hi Dirk!

It's great to know that you're interested on helping me, thank you very much. (Y)

My airfoil data is saved in a .txt document in two-column, do I have to save it in a different way?

Even-though I wrote the script you sent me in the python area, but it showed me an error after I wrote the 7th line, so I'm wondering if you could help me with that please: here is the code that I wrote and the error that it showed me:

>>> import geompy
>>> f=open('NACA0012', 'r')
>>> data=f.readlines()[1:]
>>> f.close()
>>> pts=[map(float,line.split()) for line in data]
>>>
>>> i=0
>>> for x in pts:
... geompy.addToStudy(geompy.MakeVertex(x[0], x[1], 0), 'pt'+str(i))
File "<input>", line 2
geompy.addToStudy(geompy.MakeVertex(x[0], x[1], 0), 'pt'+str(i))
^
IndentationError: expected an indented block
>>> i+=1

I wish you the best!
Luis Fernando
Moderators: catux
Time to create page: 0.143 seconds
Powered by Kunena Forum