Hi @mgraham,
The EarthAnchorPoint
command does not set this value. So you’ll need to do so programatically.
CRhinoCommand::result CCommandTest::RunCommand(const CRhinoCommandContext& context)
{
const double latitude_degrees = 47.620397;
const double longitude_degrees = -122.349179;
const double ground_elevation_feet = 207.0;
const double observation_deck_height_feet = 520.0;
ON_EarthAnchorPoint eap;
eap.SetEarthLocation(
ON::EarthCoordinateSystem::MeanSeaLevel,
ON::LengthUnitSystem::Feet,
latitude_degrees,
longitude_degrees,
ground_elevation_feet + observation_deck_height_feet
);
eap.m_name = L"Space Needle";
eap.m_description = L"Space Needle, Seattle, Washington USA";
eap.m_url = L"https://www.spaceneedle.com/";
context.m_doc.Properties().SetEarthAnchorPoint(eap);
return CRhinoCommand::success;
}
Use ON_EarthAnchorPoint::EarthLocationIsSet()
.
static bool PrintEarthAnchorPoint(CRhinoDoc& doc)
{
const ON_EarthAnchorPoint& eap = doc.Properties().EarthAnchorPoint();
bool rc = eap.EarthLocationIsSet();
if (rc)
{
const ON_3dmUnitsAndTolerances& doc_units = doc.Properties().ModelUnitsAndTolerances();
ON_3dmUnitsAndTolerances meters_units;
meters_units.m_unit_system.SetUnitSystem(ON::LengthUnitSystem::Meters);
ON_wString sLatitudeDMS, sLatitudeDeg;
ON_wString sLongitudeDMS, sLongitudeDeg;
ON_wString sElevation;
double earth_latitude = eap.Latitude(0.0);
double earth_longitude = eap.Longitude(0.0);
double earth_elevation = eap.ElevationInMeters();
RhinoFormatDegreesLatitude(earth_latitude, sLatitudeDMS, 0);
RhinoFormatDegreesLongitude(earth_longitude, sLongitudeDMS, 0);
RhinoFormatDegreesLatitude(earth_latitude, sLatitudeDeg, 1);
RhinoFormatDegreesLongitude(earth_longitude, sLongitudeDeg, 1);
RhinoFormatNumber(earth_elevation, meters_units, doc_units, sElevation, true);
if (floor(earth_latitude) == earth_latitude)
RhinoApp().Print(L"Latitude: %s\n", sLatitudeDMS.Array());
else
RhinoApp().Print(L"Latitude: %s (%s)\n", sLatitudeDMS.Array(), sLatitudeDeg.Array());
if (floor(earth_longitude) == earth_longitude)
RhinoApp().Print(L"Longitude: %s\n", sLongitudeDMS.Array());
else
RhinoApp().Print(L"Longitude: %s (%s)\n", sLongitudeDMS.Array(), sLongitudeDeg.Array());
RhinoApp().Print(L"Elevation: %s\n", sElevation.Array());
}
return rc;
}
space-needle.zip (1.2 MB)
– Dale