Re: How to import an airfoil geometry

  • Kees Wouters
  • Kees Wouters's Avatar Topic Author
  • Offline
  • Moderator
  • Moderator
More
7 years 8 months ago - 7 years 8 months ago #6989 by Kees Wouters
Re: How to import an airfoil geometry was created by Kees Wouters
Hoi Louis,

it is a Python syntax error.
As the error says, you have to indent (add spaces, or a tab in front of) the next lines that have to be repeated in for loop.

for x in pts
   geompy.addToStudy(...)
   do_some_more
   last_statement_for_loop

new_statement
...

Did you enter the code in the Python console?
It is probably easier to run the script as a file in the geometry (or mesh) module.
File --> Load script --> select python file and double click
or just hit control T and select the python file.

Dirk, I enclosed your script in code../code - hope you donot feel too bad about that.

Interest: structural mechanics, solar energy (picture at 'my location' shows too little pv panels)

--
kind regards - kees
Last edit: 7 years 8 months ago by Kees Wouters.

Please Log in or Create an account to join the conversation.

More
7 years 8 months ago #6990 by Dirk Schweitzer
Replied by Dirk Schweitzer on topic Re: How to import an airfoil geometry

Dirk, I enclosed your script in code../code - hope you donot feel too bad about that.


kees ... of course not. When I copy-pasted my code and the indentations got lost in the process I just knew that this would lead to confusion. So thank you for correcting that.

@Luis: kees is right, you should save the whole code (with the indentations - see any python beginners book) to a file (e.g airfoil.py) and then call the script via CTRL-T. Don't forget to press [F5] after running the script in order to see the changes in the object browser.

BTW, the [1:] in
data = f.readlines()[1:]
means that we skip the first line of your data file, assuming that it contains a header (usually the airfoil name).

I tried to attach the python script, but the attachment field remains empty even after I choose a file with the "Add file" button ... :(

Have fun
Dirk

Please Log in or Create an account to join the conversation.

Moderators: catux
Time to create page: 0.110 seconds
Powered by Kunena Forum