APSF //- Look up an object's position in a suitable catalogue and, if found //- replace the object's ID with the found Bayer or Flamsteed ID, where applicable. //- //- Paul Rodman, July 2008 //- //- V1.0 24 July 2008 //- Initial release //- V1.1 25 July 2008 //- Add accuracy parameter. //- Add ability to choose catalogue to search from list containing searchable Bayer IDs. //- Save/restore parameter values between runs for convenience. dim which,i,j,cat as integer dim s,cats(-1) as string dim ok as boolean dim srch as APSearch, ob as APCatalogObject dim acc as double // Load persistent values SaveRestoreGlobal(true) which=RestoreIntegerValue("which",0) acc=RestoreDoubleValue("acc",60.0) cat=RestoreIntegerValue("cat",1) // Determine which catalogues have Bayer/Flamsteed IDs cats.Append "All Catalogues (slow)" srch=new APSearch if srch.Search("alp CMa",false) then for j=1 to srch.nObjects ob=srch.GetObject(j) if cats.IndexOf(ob.Catalog)<0 then cats.Append ob.Catalog end if next end if SetChoiceParameter("Objects to process",which,"All objects","Highlighted objects only","UnHighlighted objects only") SetDoubleParameter("Accuracy (arcsec)",acc,1.0,300.0) SetListChoiceParameter("Catalogue to search",cat,cats) if not EditParameters("Bayer/Flamsteed ID") then return which=GetChoiceParameter("Objects to process") acc=GetDoubleParameter("Accuracy (arcsec)") cat=GetListChoiceParameter("Catalogue to search") // Save persistent values SaveIntegerValue("which",which) SaveDoubleValue("acc",acc) SaveIntegerValue("cat",cat) acc=acc/3600.0 srch=new APSearch if cat<0 or cat>ubound(cats) then srch.SetCatalog("Bright Star") else if cat>0 then srch.SetCatalog(cats(cat)) end if for i=1 to nObjects ok=true select case which case 1 // Highlighted ok=Obj(i).IsHighlighted case 2 ok=not Obj(i).IsHighlighted end select if ok then srch.WithinDistance(acc,Obj(i).RA,Obj(i).Dec) srch.FindAll if srch.Search("",false) then for j=1 to srch.nObjects ob=srch.GetObject(j) s=ob.Bayer(false) if instr(s," ")>1 then if Obj(i).ID<>s then Obj(i).ID=s exit end if next end if end if next