Inkscape.org
Beginners' Questions Import/Export Airfoil DAT Files
  1. #1
    MaxHugen MaxHugen @MaxHugen

    I'm experimenting with ways to transition a "regular" foil profile to a super-cavitating [hydro]foil.

    I then need to test the foil profile using XFLR5 - a GUI for XFoil. To do this I need to export the foil as a "DAT" file, which is just a text list of X and Y coordinates of the foil.

    Is there a method I could use to export (and also import) a foil profile in such a file format?

  2. #2
    Martin Owens Martin Owens @doctormo🌹🧀

    Hi Max,

    Importing and exporting in Inkscape is done using Inkscape extensions. These are written in the python programming language and your requirements are fairly easy to achieve. I'm not aware of any existing XFoil format extensions, but from what you've said there are other extensions which output to similar formats if you want to use those as a base. I'm not sure how far you want to go to make an extension though.

    Good luck!

  3. #3
    MaxHugen MaxHugen @MaxHugen

    Hi Martin, thanks for your response.

    Unfortunately I'm not conversant with Python (though I wish I was), so writing an extension is beyond me.

    After a lot of searching I did find a small tool written nearly 2 decades ago, for converting foil coordinates from/to various other formats, including DXF files. So I tried saving the SVG as DXF (both R12 and R14 versions), but the tool couldn't interpret the DXF output.

    I'll try searching the Inkscape extensions for something I might be able to use. 

    Must say I think Inkscape is an awesome program, really enjoy using it.  😊

    Cheers
    Max

  4. #4
    Martin Owens Martin Owens @doctormo🌹🧀

    Ah yes, skills is a hard one.

    I'd be remiss if I also didn't suggest asking or contracting the authors of the extensions you find. In the files there's often email addresses where you can contact people and if the problem is important to your company say, you could pay them to develop the changes you need and hopefully support the format you want directly. This is something I do for a number of clients for example, who need extensions and can't write them themselves. OR if you get lucky, you can ask someone and they might just do it for nothing. (although do be super respectful of people's time if you do).

    The luck previously wished, continues to be wished!

  5. #5
    MaxHugen MaxHugen @MaxHugen

    Martin, I'd certainly ask some of the developers for help - and pay - but these days I'm just a retired enthusiastic amateur trying to analyse performance of the sails and foils of the America's Cup yachts, and the catamarans in SailGP.

    I've searched through the extensions, but I haven't found anything that would seem to export a "simple" SVG object to a text file, as x-y coordinates.

    Thanks again
    Max

  6. #6
    Tyler Durden Tyler Durden @TylerDurden

    There was some tinkering on an exportXY extension, back in the before-times:

    https://alpha.inkscape.org/vectors/www.inkscapeforum.com/viewtopicdb3f.html?t=8826

  7. #7
    MaxHugen MaxHugen @MaxHugen

    Thanks Tyson.  I added the extension "ExportXY" to try it, and then the fun began.

    Python was unhappy.

    • "Inconsistent use of tabs and spaces in indentation."
      OK, so I tried converting all tabs to spaces.
    • "IndentationError: unexpected indent."
      No problem, I'll remove all indentation.
    • "IndentationError: expected an indented block."
      Then I discovered that Python must be indented... redid all indentation.

    Python now ran... but Inkscape was not happy instead.

    ExportXY.py:55: Deprecation Warning: Effect.affect is now `Effect.run()`. The `output` argument has changed.
      effect.affect()
     ExportXY.py:17: DeprecationWarning: Effect.selected is now a dict in the svg. Use `self.svg.selected`.
      for node in self.selected.iteritems():
    Traceback (most recent call last):
      File "ExportXY.py", line 55, in <module>
        effect.affect()
      File "C:\Program Files\Inkscape\share\inkscape\extensions\inkex\deprecated.py", line 181, in affect
        return self.run(args=args)
      File "C:\Program Files\Inkscape\share\inkscape\extensions\inkex\base.py", line 140, in run
        self.save_raw(self.effect())
      File "ExportXY.py", line 17, in effect
        for node in self.selected.iteritems():
    AttributeError: 'dict' object has no attribute 'iteritems'

    I changed the first issue in the Python code, from "Effect.affect()" to "Effect.run()".  That error "went away", but the rest of the error(s) remained... and that was beyond me. 😒

    If anyone can suggest how to fix the Python calls to Inkscape, it would be awesome. It's only a tiny file. 😊

    The attached zip file includes:

    • ExportXY.inx                      untouched
    • ExportXY.py                       my "fixed" python file
             plus
    • ExportXY.py.Original          the original python file before I butchered it
    • F50 Wing - export.svg       a very simple test svg

    Cheers, Max

  8. #8
    drakebohan drakebohan @drakebohan
    *

    Putting in an extra space or leaving one out where it is needed will surely generate an error message .  I'd suggest using only tabs or only spaces for indentation. Using only spaces is generally the easier choice. Most editors have an option for automatically converting tabs to spaces. If your editor has this option, turn it on. Some common causes of this error include:

    • Forgetting to indent the statements within a compound statement
    • Forgetting to indent the statements of a user-defined function.

    The error message IndentationError: expected an indented block would seem to indicate that you have an indentation error. It is probably caused by a mix of tabs and spaces . The indentation can be any consistent white space . It is recommended to use 4 spaces for indentation in Python, tabulation or a different number of spaces may work, but it is also known to cause trouble at times. Tabs are a bad idea because they may create different amount if spacing in different editors .

     

    Link removed by moderators. The link may have been legit, but a link to a 3rd party site in a first-time post will be regarded as spam.

  9. #9
    Tyler Durden Tyler Durden @TylerDurden

    This issue was resolved for new versions of Inkscape (1.0+) in an update to the Export XY extension. https://github.com/jwcliff/Inkscape_Exportxy

Inkscape Inkscape.org Inkscape Forum Beginners' Questions Import/Export Airfoil DAT Files