plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.


Please take a moment to read the platform’s guidelines before you get started!


question

Paavo avatar image
Paavo asked B21 answered

How to load flight plans from a WASM module?

SimConnect functions like SimConnect_AICreateEnrouteATCAircraft() require path to flight plan file. My WASM module creates flight plans at runtime and saves them to \work folder.

How should I express paths to flight plan files to use them with SimConnect functions?

I have not found a way to use relative paths, nor a way to detect absolute path to \work folder from inside the WASM module.

wasm
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

gregl83 avatar image
gregl83 answered Paavo commented

Did you ever figure out how to do this?

I'm interested in doing something similar if you'd like to share the details :)

1 comment
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Paavo avatar image Paavo commented ·

No, nor have I tried since posting to check if there has been any change (I assume not).

I used SimConnect_AICreateEnrouteATCAircraft in FSX and P3D to spawn training aircraft at a small airport mostly used by a flight school, and custom flightplans let me make them fly training routes that started and ended at the same airport. This is not possible using the built-in AI traffic scheduling.

1 Like 1 ·
Boris_ avatar image
Boris_ answered

Hello @Paavo @gregl83 ,


We are investigating this,
I will let you know when I have more information on this.


Regards,
Boris

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Boris_ avatar image
Boris_ answered Arzop edited

Hello @Paavo @gregl83 ,

There was an issue that prevented wasm modules from accessing the work/ and packages/ folder.
This has been fixed for the next SU11.
Quick reminder about folder accessibility in wasm:
- work\ -> Write and Read
- package\ -> Read only


Regards,
Boris

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

B21 avatar image
B21 answered

FWIW the html/js support has a Coherent.call("GET_FLIGHTPLAN") which is pretty neat in that you get get a full-on Javascript object with all the flightplan details in it, BUT you get a version of the flightplan after it has been mangled by some kind of internal MSFS processing, probably for an assumed Autopilot, so additional waypoints are injected and existing waypoints are reset to assumed altitudes and the elevations within the .PLN file are discarded. That would make sense for "GET_AUTOPILOT_PLAN" but is unfortunate if you're trying to get the details of the original .PLN file.

So as WASM API support improves, you might want to keep an eye on this issue if you simply want the contents of the 'original' flightplan.

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 19.1 MiB each and 23.8 MiB total.