--Script to save time creating RP's from one point to another evenly spaced. --v1.0 -- 5/29/2020 : CMO Build 1142.2 ,LUA 5.3 local function CreateRefPoints(theside, startLat, startLon, dist, endLat, endLon, name, startcounter) local DistanceToTarget = 0; DistanceToTarget = Tool_Range({latitude=startLat,longitude=startLon},{latitude=endLat,longitude=endLon}) local rpnextname=''; local theBearing= Tool_Bearing({Latitude=startLat,Longitude=startLon},{Latitude=endLat,Longitude=endLon}) if((theBearing ==nil) or DistanceToTarget < dist) then print('problem with bearing or distance');return false; end local nextLL = World_GetPointFromBearing({Latitude=startLat,Longitude=startLon,BEARING=theBearing,DISTANCE=dist}) local retval1,retval2 if((nextLL ~=nil) and nextLL.latitude~=nil and nextLL.longitude~=nil) then for i = 1,100 do rpnextname= name .. '-' ..tostring(startcounter) retval1,retval2 = pcall(ScenEdit_AddReferencePoint,{side=theside,name=rpnextname,latitude=nextLL.latitude,longitude=nextLL.longitude}) if (retval1 == true) then DistanceToTarget = (DistanceToTarget - dist); startcounter = (startcounter + 1); theBearing = Tool_Bearing({latitude=nextLL.latitude,longitude=nextLL.longitude},{latitude=endLat,longitude=endLon}); nextLL = World_GetPointFromBearing({LATITUDE=nextLL.latitude,LONGITUDE=nextLL.longitude,BEARING=theBearing,DISTANCE=dist}); else print('A call to AddReferencePoint failed exiting: ' .. tostring(retval2)); break; end if DistanceToTarget < dist+1 then break; end; end end end local function DoRefPoints(theside,startRefName,endRefName,newRefName,startcounter,spacing) spacing = spacing or 50; startcounter = startcounter or 1; if(theside==nil or startRefName == nil or endRefName==nil or newRefName==nil) then print('Please supply all the needed parameters theside,startrefname,endrefname,newrefbasename,startcounter,spacing distance.'); end local ts= ScenEdit_GetReferencePoints({side=theside,area={startRefName}}); local te= ScenEdit_GetReferencePoints({side=theside,area={endRefName}}); if( ( (ts ~=nil) and #ts > 0) and ((te ~=nil) and #te > 0) ) then CreateRefPoints(theside,ts[1].latitude,ts[1].longitude, spacing, te[1].latitude,te[1].longitude,newRefName,startcounter) else print('Could not get starting or ending reference point'); end end -- params are, sidename,RP of point to start, RP of a point to end, the base name you want ('-counter#') will be added -- the counter number you want to start with, and finally the segment distance between points. DoRefPoints('NATO','RP-MyStartMarker','RP-MyEndMarker','PhaseLineDELTA',5,50)