×

Notice

The forum is in read only mode.

Re: How to import an airfoil geometry

More
11 years 5 months ago - 11 years 5 months ago #6989 by kwou
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: 11 years 5 months ago by kwou.
More
11 years 5 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
Moderators: catux
Time to create page: 0.120 seconds
Powered by Kunena Forum