• 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.

P3D v4 64 bit terrain following

ddawson

Resource contributor
Messages
862
Country
canada
Here is my first attempt. It does not use a sim object. The PDK allows the retrieval of elevation information at a point specified by the programmer.
All you'll have to do here is populate the L:Vars for each point to retrieve and then read the results.
www.douglassdawson.ca/files/tf_link_x64.zip
Let me know if it still needs work!

Doug

Version 1.2 - the gauge now respects units for the incoming L:Vars. You will need to use units of degrees or radians for the lat and lon values. Simlarly, you will be able to request the elevation value in feet or meters (or, presumably, any other distance unit.)
 
Last edited:
Messages
1,564
Country
thailand
Excellent Doug,

I have some uses for this!

As the array of points gets large, it would eventually be useful to define the L:Var names dynamically, for example, by concatenating 'TFPointLat_' with "X" in a loop, and writing a latitude number to it. Possible?

I'm anxious to figure out why Altitude is required.

Thanks again,

Bob
 
Messages
205
Country
netherlandsantilles
Awesome, thank you so much Doug!
From the name I asume this only works with P3Dv4, right?
 
Messages
205
Country
netherlandsantilles
Ok, Doug,
First I have put the DLL in the gauge section of P3Dv4/FSX.
Then I quickly put this piece of code in an update section of my MFD:

Code:
    <!-- Calculate random Terrain elevation
    (L:TFPointElevation_1,feet)
    (L:TF_Active, bool)    
    (L:FSSimIsPaused, bool)  
    (L:TF_SimConnect, number) -->

    (A:PLANE LATITUDE, degrees) (>L:TFPointLat_1, degrees)
    (A:PLANE LONGITUDE, degrees) (>L:TFPointLon_1, degrees)
    (A:PLANE ALTITUDE, feet) (>L:TFPointAlt_1, feet)
    55 (>L:TF_UpdateInterval, number)

The Variables in the commented section are there just for sake of probing their values in BB3. The LVar (L:TF_Active, bool) has been set in my TAWS activation button so when TAWS is activated it should toggle the retrieve mechanism like you said. For sake of testing I have NOT put any conditions for the elevation retrieval proces just as yet. I only want to read the planes coordinate elevation for now so I put X=1.

This is my panel.cfg relevant section:

1545640374917.png


I then loaded up the sims. In FSX it doesnt load so that already answered my compatibility question.
However in P3D I dont see anything happening either:(.

Capture.JPG

I'm pretty sure I'm doing something wrong, hope you can shed some light.
Adino
 

ddawson

Resource contributor
Messages
862
Country
canada
Ok, Doug,
First I have put the DLL in the gauge section of P3Dv4/FSX.
Then I quickly put this piece of code in an update section of my MFD:

Code:
    <!-- Calculate random Terrain elevation
    (L:TFPointElevation_1,feet)
    (L:TF_Active, bool)   
    (L:FSSimIsPaused, bool) 
    (L:TF_SimConnect, number) -->

    (A:PLANE LATITUDE, degrees) (>L:TFPointLat_1, degrees)
    (A:PLANE LONGITUDE, degrees) (>L:TFPointLon_1, degrees)
    (A:PLANE ALTITUDE, feet) (>L:TFPointAlt_1, feet)
    55 (>L:TF_UpdateInterval, number)

The Variables in the commented section are there just for sake of probing their values in BB3. The LVar (L:TF_Active, bool) has been set in my TAWS activation button so when TAWS is activated it should toggle the retrieve mechanism like you said. For sake of testing I have NOT put any conditions for the elevation retrieval proces just as yet. I only want to read the planes coordinate elevation for now so I put X=1.

This is my panel.cfg relevant section:

View attachment 46583

I then loaded up the sims. In FSX it doesnt load so that already answered my compatibility question.
However in P3D I dont see anything happening either:(.


I'm pretty sure I'm doing something wrong, hope you can shed some light.
Adino

Which version of P3D are you using? I'm talking about the number after the decimal point here. The specific release number.
 

ddawson

Resource contributor
Messages
862
Country
canada
...
As the array of points gets large, it would eventually be useful to define the L:Var names dynamically, for example, by concatenating 'TFPointLat_' with "X" in a loop, and writing a latitude number to it. Possible?
,,,
That's certainly how I build the names within the gauge. You would have to check with someone who works with xml macros to see if it can be done with an xml gauge.
 
Messages
205
Country
netherlandsantilles
Which version of P3D are you using? I'm talking about the number after the decimal point here. The specific release number.
P3D4.1 :eek::p...you got me LOL . Honestly I'm not a P3D heavy user I only use it to validate code compatibility between projects, do I need to upgrade?:eek:
 

ddawson

Resource contributor
Messages
862
Country
canada
P3D4.1 :eek::p...you got me LOL . Honestly I'm not a P3D heavy user I only use it to validate code compatibility between projects, do I need to upgrade?:eek:
Well... The ISurfaceQueryManager class is included in the v4.1 SDK, so in theory, I don't think you should need to.
I'll make a couple of updates and see if it helps.

Doug
 
Messages
205
Country
netherlandsantilles
OK, thank you. Maybe Bob had more luck? Because again I'm not using P3D so frequent it might as well be something funky with my install or config everytime I start P3D it tells me there is something funky with my .pnl file that needs to be corrected but I don't put much attention to it maybe it is time I do;).
 

ddawson

Resource contributor
Messages
862
Country
canada
OK, so that was an embarrassing bug. Had the wrong test for the pause variable. :oops:
Just uploaded a revised version. The SimConnect LVar is now a bool, so it should display a little better.
Also added a couple of other LVars - L:TF_pSurface, and L:TF_PDK. They're both bools and should be true if the related pointers are valid.
If either of them are returning 0, then the gauge won't work, but at least we'll have an idea why.

Doug
 
Messages
205
Country
netherlandsantilles
Excellent, I'm eager to test it out but I'm afraid it won't be today they made sure today for me to be far away any sim, LOL.
thanks.
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Excellent, I'm eager to test it out but I'm afraid it won't be today they made sure today for me to be far away any sim, LOL.
thanks.
Gee, I wonder why... is it a holiday or something? :rotfl:
 
Messages
205
Country
netherlandsantilles
Gee, I wonder why... is it a holiday or something? :rotfl:
Sure it was! :laughing:

Ok this is the situation after the update:

1545823986470.png


Dough Thank you for your update efforts! I noticed (L:FSSimIsPaused, bool) passing the correct sim state now.
However so far that is all I noticed that changed. Actually that is not correctly true, because whenever I start the panel or refresh the gauges, I noticed the Elevation in the display window comes with the value: -3.280840, previously it remains 0! But it doesn't matter if I change the plane altitude or not it remains fixed at this value. Furthermore I still don't see any coordinate or altitude value being passed to the variables needed to calculate elevation. Could that be most probably the reason (?)

Here is the code in my update section:

Code:
    <!-- Calculate random Terrain elevation
    (L:TFPointElevation_1, feet)
    (L:TF_Active, bool)     
    (L:FSSimIsPaused, bool)   
    (L:TF_SimConnect, bool)
    (L:TF_pSurface, bool)   
    (L:TF_PDK, bool)-->

    (A:PLANE LATITUDE, degrees) (&gt;L:TFPointLat_1, degrees)
    (A:PLANE LONGITUDE, degrees) (&gt;L:TFPointLon_1, degrees)
    (A:PLANE ALTITUDE, feet) (&gt;L:TFPointAlt_1, feet)
    55 (&gt;L:TF_UpdateInterval, number)

Also I noticed the new Lvars added, (L:TF_pSurface, bool) (L:TF_PDK, bool) both are "on". Based on what you said this means pointers are valid, right? By now all the Lvars are receiving values as you can see in the screenshot with exception of the coordinates and altitude Lvars. They are expecting degrees in floating point values, right? because Im not rounding anything.
I'm still wondering what I might be doing wrong:scratchch...

1545824864938.png

Adino
 

ddawson

Resource contributor
Messages
862
Country
canada
The gauge only reads the L:TFPointLat_, L:TFPointLon_, and L:TFPointAlt_ variables, it doesn't write to them. I sorry to say, I think you have an XML problem.
This is the code I used to test the gauge:
Code:
<Update>
(A:Plane Latitude, degrees) (>L:TFPointLat_0)
(A:Plane Latitude, degrees) 1 + (>L:TFPointLat_1, number)
(A:Plane Latitude, degrees) 2 + (>L:TFPointLat_2, number)
(A:Plane Latitude, degrees) 3 + (>L:TFPointLat_3, number)
(A:Plane Latitude, degrees) 4 + (>L:TFPointLat_4, number)

(A:Plane Longitude, degrees) (>L:TFPointLon_0)
(A:Plane Longitude, degrees) 1 + (>L:TFPointLon_1, number)
(A:Plane Longitude, degrees) 2 + (>L:TFPointLon_2, number)
(A:Plane Longitude, degrees) 3 + (>L:TFPointLon_3, number)
(A:Plane Longitude, degrees) 4 + (>L:TFPointLon_4, number)

(A:Plane Altitude, feet) (>L:TFPointAlt_0, number)
(A:Plane Altitude, feet) (>L:TFPointAlt_1, number)
(A:Plane Altitude, feet) (>L:TFPointAlt_2, number)
(A:Plane Altitude, feet) (>L:TFPointAlt_3, number)
(A:Plane Altitude, feet) (>L:TFPointAlt_4, number)
</Update>
The only difference I see is that I used 'number' rather than 'degrees' for the units. Maybe that actually matters, although I wouldn't have thought so.

Doug
 
Messages
205
Country
netherlandsantilles
Solved, I made a seperate gauge for this and Viola! it works!
This is awesome waiting so long for this, wish there was a way to do the same for our old good FSX/P3d versions but Im more than happy with this implementation:)
Thanks soo much Doug!
 
Messages
1,564
Country
thailand
Doug and Adino,

Good Job Adino! I'm trying to duplicate your success, but I'm still having difficulties setting this up. I'm using the latest version (the 124KB one) of tf_link_x64.dll, but so far, no success:

Untitled-4.png


XML:
Panel.cfg:
[Window06]
size_mm=400,200
window_size_ratio=1.000
position=4
gauge00=TEST!TFTest1,  0,0,400,200
gauge01=tf_link_x64!link, 0,0,2,2, 1
gauge02=tf_link_x64!display, 40,630,450,100     

XML Gauge:
<Gauge Name="TF TEST" Version="1.00">
<Size X="200" Y="100" />

    <Update Frequency="18">
        1 (>L:TF_Active, bool)
        18.92346781 (>L:TFPointLat_0, degrees)
        -155.4984503 (>L:TFPointLon_0, degrees)
        12000 (>L:TFPointAlt_0, feet)
    </Update>
   
    <Element Name="BACKGROUND RECTANGLE"><Position X="0" Y="0"/><Rectangle Width="200" Height="100" FillColor="gainsboro" Bright="Yes" /></Element>       
   
    <Element Name="TFPointLAT"><Position X="10" Y="25"/><FormattedText X="130" Y="8" Font="consolas" FontSize="8" LineSpacing="8" Color="#101010" BackgroundColor="gainsboro" Bright="Yes"><String>%((L:TFPointLat_0, degrees))%!9.4f!% TFPointLat_0</String></FormattedText></Element>
    <Element Name="TFPointLON"><Position X="10" Y="35"/><FormattedText X="130" Y="8" Font="consolas" FontSize="8" LineSpacing="8" Color="#101010" BackgroundColor="gainsboro" Bright="Yes"><String>%((L:TFPointLon_0, degrees))%!9.4f!% TFPointLon_0</String></FormattedText></Element>
    <Element Name="TFPointALT"><Position X="10" Y="45"/><FormattedText X="130" Y="8" Font="consolas" FontSize="8" LineSpacing="8" Color="#101010" BackgroundColor="gainsboro" Bright="Yes"><String>%((L:TFPointAlt_0, feet))%!9d!% TFPointAlt_0</String></FormattedText></Element>
    <Element Name="TFActive"><Position X="10" Y="55"/><FormattedText X="130" Y="8" Font="consolas" FontSize="8" LineSpacing="8" Color="#101010" BackgroundColor="gainsboro" Bright="Yes"><String>%((L:TF_Active, bool))%!9d!% TF_Active</String></FormattedText></Element>
    <Element Name="FSSimIsPAUSED"><Position X="10" Y="65"/><FormattedText X="130" Y="8" Font="consolas" FontSize="8" LineSpacing="8" Color="#101010" BackgroundColor="gainsboro" Bright="Yes"><String>%((L:FSSimIsPaused, bool))%!9d!% FSSimIsPaused</String></FormattedText></Element>
    <Element Name="SimConnect NUMBER"><Position X="10" Y="75"/><FormattedText X="130" Y="8" Font="consolas" FontSize="8" LineSpacing="8" Color="#101010" BackgroundColor="gainsboro" Bright="Yes"><String>%((L:TF_SimConnect, number))%!9d!% TF_SimConnect</String></FormattedText></Element>
    <Element Name="ELEVATION"><Position X="10" Y="85"/><FormattedText X="130" Y="8" Font="consolas" FontSize="8" LineSpacing="8" Color="#101010" BackgroundColor="gainsboro" Bright="Yes"><String>%((L:TFPointElevation_0,feet))%!9.1f!% TFPointElevation_0</String></FormattedText></Element>

</Gauge>

I'm interested to know more details about how you solved your issue.

Regards,

Bob

TF_pSurface and TF_PDK also return 0
 
Last edited:
Messages
205
Country
netherlandsantilles
Bob,
I just followed Doug advise and change the Lvars units from degrees to number and moved my update section in a separate hidden gauge on the panel. This is the piece of code I use for testing:
<Update>
<!-- Calculate random Terrain elevation
(L:TFPointElevation_1, feet)
(L:TF_Active, bool)
(L:FSSimIsPaused, bool)
(L:TF_SimConnect, bool)
(L:TF_pSurface, bool)
(L:TF_PDK, bool)-->

(A:pLANE LATITUDE, degrees) (&gt;L:TFPointLat_1, number)
(A:pLANE LONGITUDE, degrees) (&gt;L:TFPointLon_1, number)
(A:pLANE ALTITUDE, feet) (&gt;L:TFPointAlt_1, number)
55 (&gt;L:TF_UpdateInterval, number)

</Update>

In fact looking at your code it should work but it looks like the Lvars doesnt like degrees as a unit, just change degree to number and test it again and see what happens.
Adino
 
Messages
1,564
Country
thailand
Changing L:Var units to number doesn't solve my issue. Note that TF_SimConnect, FSSimIsPaused, TF_pSurface and TF_PDK always return zero regardless of Pause state. This seems like my sim is not finding tf_link_x64.dll or is not recognizing it for some reason that escapes me. I've 'installed' this incorrectly I believe, but I can't put my finger on it so far.

Question for you ... what's the explanation for the -3.28 TFPointElevation in your BB3 readout?

Bob
 
Top