I added a RP with:
Code: Select all
local u = ScenEdit_GetUnit ({name='CVN 78 Gerald R. Ford', guid='KO61QJ-0HMTE5ENVLTKH'})
ScenEdit_AddReferencePoint({side = 'Nessik', name = 'Z5', relativeto = u.guid, bearingtype=0, bearing=180, distance=10})
To Set with:
Code: Select all
local u = ScenEdit_GetUnit ({name='CVN 78 Gerald R. Ford', guid='KO61QJ-0HMTE5ENVLTKH'})
ScenEdit_SetReferencePoint({side = 'Nessik', name = 'Z1', relativeto = u.guid, bearingtype=0, bearing=180, distance=10})
I now used the B/D to Lat/Long I found on the forum (with input box)
Code: Select all
local function GetNumberFromUser(displaytext, minnum, maxnum, errornum)
local retval = ScenEdit_InputBox(displaytext)
if retval ~= nil and retval ~= "" then
retval = tonumber(retval)
if retval == nil then
return errornum
end
else
return errornum
end
if retval >= minnum and retval <= maxnum then
return retval
end
return errornum
end
-- Create Reference Points Function
local function SetRpsScreen()
local zz = ScenEdit_GetUnit({name='A 834 Den Helder', guid='KO61QJ-0HMTE5ENVLTR9'})
local leftBearing = GetNumberFromUser('Enter left bearing (1-360):', 1, 360, 0)
local rightBearing = GetNumberFromUser('Enter right bearing (1-360):', 1, 360, 0)
local minDistance = GetNumberFromUser('Enter minimum distance:', 0, 100, 0)
local maxDistance = GetNumberFromUser('Enter maximum distance:', minDistance, 100, 0)
Code: Select all
local pt1 = World_GetPointFromBearing({ LATITUDE = zz.latitude, LONGITUDE = zz.longitude, BEARING = leftBearing, DISTANCE = minDistance })
local pt2 = World_GetPointFromBearing({ LATITUDE = zz.latitude, LONGITUDE = zz.longitude, BEARING = leftBearing, DISTANCE = maxDistance })
local pt3 = World_GetPointFromBearing({ LATITUDE = zz.latitude, LONGITUDE = zz.longitude, BEARING = rightBearing, DISTANCE = maxDistance })
local pt4 = World_GetPointFromBearing({ LATITUDE = zz.latitude, LONGITUDE = zz.longitude, BEARING = rightBearing, DISTANCE = minDistance })
ScenEdit_SetReferencePoint({ side = "Nessik", name = "Z1", lat = pt1.latitude, long = pt1.longitude, relativeto=zz.guid, bearingtype=0 })
ScenEdit_SetReferencePoint({ side = "Nessik", name = "Z2", lat = pt2.latitude, long = pt2.longitude, relativeto=zz.guid, bearingtype=0 })
ScenEdit_SetReferencePoint({ side = "Nessik", name = "Z3", lat = pt3.latitude, long = pt3.longitude, relativeto=zz.guid, bearingtype=0 })
ScenEdit_SetReferencePoint({ side = "Nessik", name = "Z4", lat = pt4.latitude, long = pt4.longitude, relativeto=zz.guid, bearingtype=0 })
end
SetRpsScreen()