• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Error sending waypoints array

Messages
6
Country
us-newmexico
I am attempting to send an array of waypoints to FSX via SimConnect.

fsxSimConnect.SetDataOnSimObject(Microsoft.FlightSiimulator.SimConnect,SIMCONNECT_DATATYPE.WAYPOINT,MooneyID,SIMCONNECT_DATA_SET_FLAG.DEFAULT, objv)

I have checked (and researched) all the parameters several times and can't find any problems with the args, but I am getting an FSX Exception 3 every time. There is some forum traffic which suggests that this may be a known issue.

I have done the forum search suggested by FlapsOut, but didn't find any relevant code samples. Anyone got any C# or VB code samples that would help?

ADthanksVANCE

Tom
 
Last edited:
Hi Tom

Thanks for going through the posts!

Did you see the application that I kept adding too?

I'll be more than happy to give you the complete Source code for all of that...HOWEVER! It seems your doing something different, and in that regard?

I'll be happy to help develop the C#/.Net code to enable that too?

I sent you a private note too :)

Thanks,
FlapsOut
 
Problem solved

All:

I have resolved the problem and now am successfully sending waypoints to FSX via SimConnect using managed code (VB.NET). I believe in sharing, so anyone struggling with this and needing help, just ask.

Regards

Tom
 
Yes please :)

I have created a simulated object succesfully, but can't figure out how to set an array of waypoints on it. I'm using C#.

I have this:

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
struct MyWayPoints
{
public SIMCONNECT_DATA_WAYPOINT [] waypoint;​
};

This:

simconnect.AddToDataDefinition(DataDefinition.WAYPOINT,
"AI Waypoint List",
"number",
SIMCONNECT_DATATYPE.WAYPOINT,
0.0f, SimConnect.SIMCONNECT_UNUSED);
simconnect.RegisterDataDefineStruct<MyWayPoints>(DataDefinition.WAYPOINT);

And try to do this:

MyWayPoints wps = new MyWayPoints();
wps.waypoint = new SIMCONNECT_DATA_WAYPOINT[fsx.NumberOfPoints];

for ( int i=0; i<NumberOfPoints; i++ )
{
SIMCONNECT_DATA_WAYPOINT wp = new SIMCONNECT_DATA_WAYPOINT();
wp = mywaypointstuff
wps.waypoint= wp;
}
simconnect.SetDataOnSimObject(DataDefinition.WAYPOINT, targetid, SIMCONNECT_DATA_SET_FLAG.DEFAULT, wps);


My app just crashes, even within VS2005, so I guess something goes wrong in the de/marshaling phase.

Daniel
 
Ok, I just found it in the general notes about managed Simconnect clients:

// Step 4: The managed wrapper marshaling code expects a polymorphic array

Now I can set the WP's. My object just doesn't move yet, it does when I set a single WP...

Edit: Ok, also solved, my own plane was blocking it :)

Daniel
 
Last edited:
C# waypoints

Do you have the code for C# to sending waypoints to FSX via SimConnect

All:

I have resolved the problem and now am successfully sending waypoints to FSX via SimConnect using managed code (VB.NET). I believe in sharing, so anyone struggling with this and needing help, just ask.

Regards

Tom
 
From the SDK:

Code:
simconnect.AddToDataDefinition(DEFINITIONS.1,"AI WAYPOINT LIST",
       "number", SIMCONNECT_DATATYPE.WAYPOINT, 0.0f,
       SimConnect.SIMCONNECT_UNUSED);

SIMCONNECT_DATA_WAYPOINT[] waypoints = 
                new SIMCONNECT_DATA_WAYPOINT[2];

waypoints[0].Flags = (uint)SIMCONNECT_WAYPOINT_FLAGS.SPEED_REQUESTED;
waypoints[0].ktsSpeed = 100;
waypoints[0].Latitude = 10;
waypoints[0].Longitude = 20;
waypoints[0].Altitude = 1000;

waypoints[1].Flags = (uint)SIMCONNECT_WAYPOINT_FLAGS.SPEED_REQUESTED;
waypoints[1].ktsSpeed = 150;
waypoints[1].Latitude = 11;
waypoints[1].Longitude = 21;
waypoints[1].Altitude = 2000;

Object[] objv = new Object[ waypoints.Length ];
waypoints.CopyTo(objv, 0);

simconnect.SetDataOnSimObject(DEFINITIONS.1, AIAircraftID,
                       SIMCONNECT_DATA_SET_FLAG.DEFAULT, objv);
 
How to get AI aircraft to show on the radar screen

Thanks for the code Denial. I was able to compile and run the waypoint code, however I want the AI aircraft to show up on the radar screen. Any ideas on how to do that?
 
I don't know what the criteria are FSX uses to display a plane on the screen or not.

It could be planes added through SimConnect won't show up, maybe only planes with a Flightplan will show up.

What call do you use to create the plane? I suppose all the 'Create....AtcAircraft' versions should work, but maybe they will only show in case they have a Flightplan assigned using SimConnect_AISetAircraftFlightPlan.

Daniel
 
Hi,

Sorry for bringing this topic up but I thought it will be pointless creating a new post..

I have created an object and after that applied him 2 waypoints with the above code but doesn't seems to be moving for some reason...

Anyone have an idea what am I doing wrong?
Thanks in advance,
 
Last edited:
Back
Top