Thanks for the split. So here is the problem: The UFO object placement works nicely in version 1.0 and 2018 as well, which is good.
I know I am working with 1.0 for the moment, but getting a bit more familiar with the nasal code would be a good thing in either case.
The existing code prints the following data to the console, where I have to right click, select and copy. (something like this)
# w130n30/w123n37/942050.stg
OBJECT_SHARED Models/Airport/radar.xml -122.49545370 37.50848779 7.4856 0.0
OBJECT_SHARED Models/Airport/radar.xml -122.49533997 37.50845175 7.3988 0.0
How do I print this to a file, say
object_exports.txt ?
The following code prints to the console, so modify this to write to file also, that is, write another function e.g. var write_model_data...
- Code: Select all
var print_model_data = func(prop) {
print("\n\n------------------------ Selected Object -----------2--------------\n");
var elev = prop.getNode("elevation-ft").getValue();
printf("Path: %s", prop.getNode("path").getValue());
printf("Latitude: %.8f deg", prop.getNode("latitude-deg").getValue());
printf("Longitude: %.8f deg", prop.getNode("longitude-deg").getValue());
printf("Altitude ASL: %.4f m (%.4f ft)", elev * FT2M, elev);
printf("Heading: %.1f deg", prop.getNode("heading-deg").getValue());
printf("Pitch: %.1f deg", prop.getNode("pitch-deg").getValue());
printf("Roll: %.1f deg", prop.getNode("roll-deg").getValue());
}
# interface functions -----------------------------------------------------------------------------
var print_data = func {
var rule = "\n----------------------------------------------3--------------------\n";
print("\n\n");
print_ufo_data();
var data = modelmgr.get_data();
var selected = data.getChild("model", 0);
if (selected == nil) {
print(rule);
return;
}
print_model_data(selected);
print(rule);