Sub DrawAirfoil() 'Script to import airfoil shapes directly into Rhino, Written by Rick Loheed 'Tested with DesignFoil, XFoil, XFLR5, and the UIUC database using the Selig format 'Place points at the leading and trailing edge, 'orthogonally in the Front view (X-Z Plane) 'Once the shape is plotted, it may them be manipulated for twist, etc. Dim strObject, arrPoint, arrPoint2, dblChord,arrFoil() Const rhObjectPoint = 1 Set fso = CreateObject("Scripting.FileSystemObject") FileName= Rhino.OpenFileName("Open", "Airfoil Files (*.Dat)|*.Dat|(*.csv)|*.csv|") If Not IsNull(FileName) Then Set F = fso.OpenTextFile(FileName, 1, False) Do While F.AtEndOfStream <> True ReDim Preserve strResult(Count) strResult(Count) = f.ReadLine Count = Count + 1 Loop End If F.Close Set F = Nothing Set fso = Nothing Count=Count-1 'Rhino.print Count strObject = Rhino.GetObject("Select Leading Edge point", rhObjectPoint,,vbTrue) arrPoint = Rhino.PointCoordinates(strObject) strObject = Rhino.GetObject("Select Trailing Edge point", rhObjectPoint,,vbTrue) arrPoint2 = Rhino.PointCoordinates(strObject) dblChord=arrPoint2(0)-arrPoint(0) 'OK, now the strresult() Array contains the foil. j=0 For i = 1 to Count 'strtok should strip out anything between spaces, if this does not work add 'the correct delimiter to the string in quotes; ThisLine=Rhino.strtok(strResult(i)," ") redim preserve arrFoil(j) arrFoil(j)=Array((dblChord*ThisLine(0))+arrPoint(0),arrPoint(1),(dblChord*ThisLine(1))+arrPoint(2)) j=j+1 Next 'Draw it in Rhino! Rhino.AddInterpCurveEx arrFoil End Sub