APSF // Import a NexTour file into the current plan // Paul Rodman, Apr 2007 // (with thanks to Michael Swanson for supplying the format) // V1.0 - Initial release // Note: You must (currently) rename the NexTour files to have a ".txt" extension in order to be able // to open them. dim f as APTextFile dim fields(-1),s as string dim ob as APPlanObject f=ReadTextFile if f=nil then return StartProgress("Importing objects from NexTour file",true) while not f.EOF if UpdateProgress then exit fields=Split(f.ReadLine,"#") if ubound(fields)>=2 then ob=NewObject s=fields(0) ob.RA=val(NthField(s,":",1))+val(NthField(s,":",2))/60.0+val(NthField(s,":",3))/3600.0 s=fields(1) ob.Dec=abs(val(NthField(s,":",1)))+val(NthField(s,":",2))/60.0+val(NthField(s,":",3))/3600.0 if left(s,1)="-" then ob.Dec=-ob.Dec ob.ID=fields(2) if ubound(fields)>=3 then ob.Notes=trim(fields(3)) if ubound(fields)>=4 and fields(4)<>"" then ob.Size=Cstr(val(fields(4))*0.1) if ubound(fields)>=5 and fields(5)<>"" then ob.Separation=val(fields(5))*0.1 if ubound(fields)>=6 and fields(6)<>"" then ob.PosAngle=val(fields(6)) if ubound(fields)>=7 and fields(7)<>"" then ob.Magnitude=val(fields(7))*0.1 if ubound(fields)>=8 and fields(8)<>"" then ob.Magnitude2=val(fields(8))*0.1 if ubound(fields)>=9 and fields(9)<>"" then ob.Magnitude=val(fields(9))*0.1 if ubound(fields)>=11 and fields(11)<>"" then select case val(fields(11)) case 0 ob.Type="Asterism" case 1 ob.Type="Globular" case 2 ob.Type="Double" case 3 ob.Type="E Neb" case 4 ob.Type="Galaxy" case 5 ob.Type="Neb" case 6 ob.Type="Open" case 7 ob.Type="P Neb" case 8 ob.Type="Star" case 9 ob.Type="Triple" else ob.Type="Unknown" end select else ob.Type="Unknown" end if if ubound(fields)>=14 and fields(14)<>"" then ob.User1=fields(14) if ubound(fields)>=15 and fields(15)<>"" then ob.User2=fields(15) if ubound(fields)>=16 and fields(16)<>"" then ob.User3=fields(16) if ubound(fields)>=17 and fields(17)<>"" then ob.User4=fields(17) end if wend StopProgress