Converting curves -to- .dat format

Hello all, and I hope all is well.

I have a great script that will import a .dat formatted file, but now I need to go the other way. Does a script exist that will convert/export a selected curve to the .dat format? At a stretch, a script that asks for the number of coordinate points desired? Please let me know.

Many thanks.

What would you want to export? Coordinates of points along the curve? Degree, knot vector, control point coordinates, etc?

How would the export be used?

Coordinate points only David, and thanks for responding quickly.

I am looking for a tool/utility that will export a selected curve into the classic .dat format, which is straight lines between coordinate points. Ideally, such a utility should ask how many points are desired. (Within aerospace, 60-100 points are common, but not exclusive)

The application is aero/hydro engineering. CFD oriented applications such as xFOIL, xFLR5, OpenFOAM and more still work with this form factor. With these applications I import .dat formatted curves and run analysis of multiple types.

The problem I and many of us have is that we can import .dat formatted curves, convert them to native geometry for modification/optimization/surfacing and more, but if I/we want to see what the results look like, we need to go back to .dat. If I want to make an aero/hydro point to my peers, superiors and advisors, I need to convert my native work back into .dat.

This trouble is not unique to me. Such a utility would be appreciated by many. I for one would promote it.

I’ll post an example and close up.

Many thanks for considering.

Hi @Steven_J_Seim,

The .dat file extension is a pretty generic one, and it doesn’t really describe what data is expected in the file.

Do you have a link to this particular .dat file format?

A sample .dat file the script you use to create them might be helpful too.

Thanks,

– Dale

Partial response:
Use Divide to create desired number of points on the curve.
Export as Points (.txt) will export the point coordinates as a list of ASCII triplets.
The .txt file can be converted to a .dat file if needed.

Example; the extreme leading edge of an airfoil typically used in soaring flight.

Again, your consideration is appreciated.

Absolutely correct Dale. .dat dates back to the DOS days and is very, very generic and crude. That modern CFD still uses this form factor is a story of its own.

Presented is an example. It’s just a text file of 2 column data. (rename to .dat)

AG40d -0_Smoothed.txt (5.3 KB)

I get this. .dat is .txt.

I’ll try this now. I may only need the coordinate points, not the straight line segments.

Thank you.

@Steven_J_Seim - what version of Rhino do you use?

Thanks,

– Dale

8 of course. Been a user since 1.1. (honest)

Hi @Steven_J_Seim,

Something work trying, assumes your curve is coplanar with the world-xy plane.

ExportDat.py (2.4 KB)

– Dale

Thank you Dale. I’m on this.

Dr. Michael Selig is on this as well, but I’m not clear as to how to ‘Export Selected’ to a text file I can rename. Presented is a video of the steps, but he stops at the export step. We are close.

I may owe apologies on what may be an ‘I could have had a V8’ moment.

I’ve been chatting with Micheal Selig, and he points out there is a ‘Selig .dat’ export option I need to download. I’m betting that is my answer.

I am most grateful for your attention, help and support. Always a true fan.

Many thanks…