Sign in to follow this  
Rocky

XML: Pie Drawing - FS9/FSX

Recommended Posts

The following XML script will draw a lovely "pie element" from 210 degrees to 0 degrees (0 is the "points east" ending point.The SDK insists that adding StartAngleScript= to the command string will allow one to use a "script" to control the dynamics of the drawing, such as evaluating/scaling N1% for example.However, nothing I've tried seems to work. Has anyone ever gotten this working?

<Element><Position X="506" Y="83"/><Pie Radius="41" StartAngle="210" EndAngle="0" LineWidth="2" LineColor="White" FillColor="#545454" Bright="Yes"/></Element>

210 degrees full scale / 100 percent = 2.1 scalar needed.

<Pie Radius="41" StartAngle="210" StartAngleScript="%((A:TURB ENG CORRECTED N1:1,percent) 2.1 *)%!2d!%" EndAngle="0" LineWidth="2" LineColor="White" FillColor="#545454" Bright="Yes"/>

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Hey Bill,Try this:StartAngleScript="(A:TURB ENG CORRECTED N1:1,percent) 2.1 *"orStartAngleScript="((A:TURB ENG CORRECTED N1:1,percent) 2.1 *)"I don't think you need the percent signs and the fixed length formatting (which is probably turning your numeric value into a string).

Share this post


Link to post
Share on other sites

StartAngleScript="(A:TURB ENG CORRECTED N1:1,percent) 2.1 *"

or

StartAngleScript="((A:TURB ENG CORRECTED N1:1,percent) 2.1>*)"

 

I don't think you need the percent signs and the fixed length>formatting (which is probably turning your numeric value into>a string).

 

I'll give it a try. At least it's a suggestion... ;)

 

I've discovered that Pie and Arc actually DO work in FS9's XML syntax (which is a surprise to me!), but I hadn't gotten this part working yet.

 

I know I could script in pure FSX XML schema, but I need to have something that will work in both sim versions.

 

I did discover (the hard way of course) that LineColor doesn't work in FS9's schema. Color works fine though!

<Polyline LineWidth="3" LineColor="#05BE1A" FillColor="Black" Bright="Yes">
will have a WHITE Line...

<Polyline LineWidth="3" Color="#05BE1A" FillColor="Black" Bright="Yes">
will have a GREEN Line... :)

Share this post


Link to post
Share on other sites

Well... This is a pity... The following will draw the initial StartAngle correctly, but it will never update... :(This is the final thing I need to accomplish somehow...

<Pie Radius="41" StartAngle="(A:TURB ENG CORRECTED N1:1,percent)" EndAngle="0" LineWidth="2" Color="White" FillColor="#545454" Bright="Yes">

b787mfd000006ts6.jpg

Share this post


Link to post
Share on other sites

>Well... This is a pity... The following will draw the initial>StartAngle correctly, but it will never update... :(>>This is the final thing I need to accomplish somehow...>>FillColor="#545454" Bright="Yes">I could never make work in FS9...How did you do that? Unfortunately, the use of scripts in drawing vectors (line, pie,rectangle,etc both in FS9 and FSX) is limited to the starting point only, so it's not very useful IMHO. BTW, you should use TURB ENG N1 instead of the corrected value in engine gauges :-)Tom

Share this post


Link to post
Share on other sites

Hi,This works, just a test, a workaround?:(A:general eng1 throttle lever position,part) 0.33 <(A:general eng1 throttle lever position,part)(A:general eng1 throttle lever position,part) 0.33 > (A:general eng1 throttle lever position,part) 0.66 < and(A:general eng1 throttle lever position,part)(A:general eng1 throttle lever position,part) 0.66 >(A:general eng1 throttle lever position,part)By testing you will see what i mean.Change Lines and Colours etc.Hope it helps,Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

Brilliant, Jan. If you can't rotate your pie, pie your rotates! :)

Share this post


Link to post
Share on other sites

Congratulations for doing a so nice display in XML, really amazing !!I am especially surprised by the curve drawn for the flight route.Eric

Share this post


Link to post
Share on other sites
Congratulations for doing a so nice display in XML, really amazing !!I am especially surprised by the curve drawn for the flight route.Eric
I know I'm really late on this topic, but is Eric right? In that did you indeed construct that display using XML? :( I've been trying for ages to figure out how to code just one of the features of your display, to no avail and you've constructed everything I've ever wanted to get out of a XML display.How'd you go about creating the climb/descend prediction bar (The green one, don't know the right term for it). How is it possible to change the display of Intersections, NDB's, VOR's, Airports, and runways the way you've done so in your display? :( :( Achieveing something anywhere near what you've achieved in your display has become my insparation, I've put it up on my desktop to be inspired to build it! B) B)

Share this post


Link to post
Share on other sites

NOTE: Since the forum software was updated last year, previously posted XML Script examples are being "hidden from view" unless they are wrapped in {CODE} tags. I've taken the liberty to respond to Jan's old post simply so I could resurrect his XML Script for everyone to see. There's nothing more annoying when searching for answers to find that because of age they've been "hidden from view!" :(

 

Hi,This works, just a test, a workaround?:
<Element>
  <Position X="100" Y="100"/>
  <Element>
    <Visible>
      (A:general eng1 throttle lever position,part) 0.33 <
    </Visible>
    <Pie Radius="50" StartAngle="360" EndAngle="270" LineWidth="2" Color="dkgray" FillColor="red" Bright="yes">
      <Pivot X="51" Y="51"/>
    </Pie>
    <Rotate>
      <Value>(A:general eng1 throttle lever position,part)</Value>
      <Nonlinearity>
        <Item Value="0" X="50" Y="0"/>
        <Item Value="0.4" X="0" Y="50"/>
      </Nonlinearity>
    </Rotate>
  </Element>
  <Element>
    <Visible>
      (A:general eng1 throttle lever position,part) 0.33 > (A:general eng1 throttle lever position,part) 0.66 < and
    </Visible>
    <Pie Radius="50" StartAngle="360" EndAngle="180" LineWidth="2" Color="dkgray" FillColor="red" Bright="yes">
      <Pivot X="51" Y="51"/>
    </Pie>
    <Rotate>
      <Value>(A:general eng1 throttle lever position,part)</Value>
      <Nonlinearity>
        <Item Value="0" X="50" Y="0"/>
        <Item Value="0.4" X="0" Y="50"/>
      </Nonlinearity>
    </Rotate>
  </Element>
  <Element>
    <Visible>(A:general eng1 throttle lever position,part) 0.66 ></Visible>
    <Pie Radius="50" StartAngle="360" EndAngle="90" LineWidth="2" Color="dkgray" FillColor="red" Bright="yes">
      <Pivot X="51" Y="51"/>
    </Pie>
    <Rotate>
      <Value>(A:general eng1 throttle lever position,part)</Value>
      <Nonlinearity>
        <Item Value="0" X="50" Y="0"/>
        <Item Value="0.4" X="0" Y="50"/>
      </Nonlinearity>
    </Rotate>
  </Element>
  <Element>
    <Position X="0" Y="-50"/>
    <Polygon LineWidth="2" Color="dkgray" FillColor="green" Bright="yes">
      <Point X="-30" Y="-1"/>
      <Point X="-1" Y="50"/>
      <Point X="50" Y="50"/>
      <Point X="50" Y="-1"/>
      <Point X="-30" Y="-1"/>
    </Polygon>
  </Element>
</Element>

By testing you will see what i mean.Change Lines and Colours etc.Hope it helps,Jan"Beatus ille qui procul negotiis..."

Edited by n4gix
Resurrect Jan's XML Script again!

Share this post


Link to post
Share on other sites
I know I'm really late on this topic, but is Eric right? In that did you indeed construct that display using XML? :( I've been trying for ages to figure out how to code just one of the features of your display, to no avail and you've constructed everything I've ever wanted to get out of a XML display.How'd you go about creating the climb/descend prediction bar (The green one, don't know the right term for it). How is it possible to change the display of Intersections, NDB's, VOR's, Airports, and runways the way you've done so in your display? :( :( Achieveing something anywhere near what you've achieved in your display has become my insparation, I've put it up on my desktop to be inspired to build it! B) B)
Yes, the entire display is XML script. It was one of the "gauges" I programmed under contract with ABACUS for their newest version of the B787.As for the "custom display" of VORs, NDBs, Intersections, et cetera one simply takes the returned Lat/Lon for each one and draws one's own graphic in lieu of having the default drawn.As for the VNav display, I never did manage to get it working properly. What's shown in the screenshot is a static view of the real display. I wound up simplifying it considerably for the final release version:b787000002.th.jpg

Share this post


Link to post
Share on other sites

Bill would you be able to show me some example code on how to achieve this? I'm un-able to conceive how to do so. :( The main things I want to accomplish are to produce the following things:Coustom drawings/txt for the Intersections, VOR's, NDB's, and RWY's - I'm assuming you've tied this to an FMC as to select the departure/arrival runway and then show it on the ND.And another really usefull bit of code would be the vertical speed trend bar.I appreciate any/all the help you can provide me with!

Share this post


Link to post
Share on other sites

Anyone here know how this can be done?By this I mean using your own drawings for the symbols of waypoints and what not.

Share this post


Link to post
Share on other sites
The main things I want to accomplish are to produce the following things:Coustom drawings/txt for the Intersections, VOR's, NDB's, and RWY's - I'm assuming you've tied this to an FMC as to select the departure/arrival runway and then show it on the ND.
Oh dear! I completely missed your question the first time around...In any event, what you see in the full panel for the nav data is default from the fs9gps.dll...There's an amazing variety of things you can do with the default symbols however.Yes, there's an FMC providing signals to drive the autopilot and the displays.

Share this post


Link to post
Share on other sites
Oh dear! I completely missed your question the first time around...In any event, what you see in the full panel for the nav data is default from the fs9gps.dll...There's an amazing variety of things you can do with the default symbols however.Yes, there's an FMC providing signals to drive the autopilot and the displays.
How would I go about achieving what ever I want - what you did with the intersection symbols & runway & VOR - I know I can't edit the FS9GPS.dll, so I wonder what you did to achieve such a result in your display? I would assume you collected information from the module and then drew up the symbols - how would one do that, collect the information, then display the appropriate symbol in respect to the information...?I've been going crazy trying to figure something out from the default GPS's or somewhere online but I can't find anything that would even lead me in the right direction, everything I've come across so far seems to be limited to the default ugly runway blocks not like yours at all!I assume it would be troublesome for you to teach me exactly how to do it, but if you would just point me in the right direction?You had originally said: "As for the "custom display" of VORs, NDBs, Intersections, et cetera one simply takes the returned Lat/Lon for each one and draws one's own graphic in lieu of having the default drawn."This seems quite troublesome to me, I can not fathom how to take the LAT/LON for every intersection that is to be displayed within the range of the window a (In my case a min of 5NM and Max of 320NM) and neglect displaying the one that's there and display my own image... :(

Share this post


Link to post
Share on other sites

Okay it seems I've come across something that might get me somewhere, would I use something likeWaypointVorLatitude & WaypointVorLongitudeFirst to get the correct position of - I guess all VOR's - then to place a image or what not on those positions? And I guess I would do the same for other things like NDB's, Airports and runways? :( On a different matter than the one above, but having to do with the GPS system I would like to ask this question:I've built an FMC, and within it I've built a system that can understand numbers and letters, anyway long story short on my Route page I can set the DEST Airport ICAO and what not but it essentially doesn't mean anything so what I've been wanting to do is if there isn't a flight plan active then the DEST airport I enter I want it to be the direct to airport I go to. Now when I show the DEST ICAO it's loaded into four different L:Vars one for each letter, what I want to do is make each one of those letters be understood by the fs9gps.dll Anyway here's the code:

 (@c:FlightPlanIsActiveFlightPlan) 0 ==  if{ (L:FMC-RTE-DEST-1,number) 64 > (L:FMC-RTE-DEST-4,number) 64 > (L:FMC-RTE-DEST,bool) 0 == and and if{  1 (>C:fs9gps:IcaoSearchStartCursor) (L:FMC-RTE-DEST-1,number) (>C:fs9gps:IcaoSearchEnterChar) (C:fs9gps:IcaoSearchCursorPosition) 1 + (>C:fs9gps:IcaoSearchCursorPosition) (L:FMC-RTE-DEST-2,number) (>C:fs9gps:IcaoSearchEnterChar) (C:fs9gps:IcaoSearchCursorPosition) 1 + (>C:fs9gps:IcaoSearchCursorPosition) (L:FMC-RTE-DEST-3,number) (>C:fs9gps:IcaoSearchEnterChar) (C:fs9gps:IcaoSearchCursorPosition) 1 + (>C:fs9gps:IcaoSearchCursorPosition) (L:FMC-RTE-DEST-4,number) (>C:fs9gps:IcaoSearchEnterChar)  1 (>C:fs9gps:IcaoSearchStopCursor)  1 (>@c:FlightPlanDirectToDestination)  1 (>L:FMC-RTE-DEST,bool) } } 

I don't have much experience with the fs9gps.dll so I don't know how newbish that looks? :( Thanks for the help!Engjell BerishaGood Day!

Share this post


Link to post
Share on other sites

I thought it would be appropriate to post this here as it's where I learned it.The thing wont budge, why?

  <Element>    <Pie Radius="50" StartAngle="360" EndAngle="270" LineWidth="2" Color="#DDDDDD" FillColor="#525252" Bright="Yes">      <Pivot X="51" Y="51"/>    </Pie>    <Rotate>      <Value>(A:TURB ENG1 N1,perecent)</Value>      <Nonlinearity>        <Item Value="0.0"  X="50" Y="0"/>        <Item Value="40.0" X="0" Y="50"/>      </Nonlinearity>    </Rotate>  </Element>

If I manually put something else in the value like 40 it moves perfectly but other then that it will not move when N1 increases/decreases at all.

Share this post


Link to post
Share on other sites

 

 

If I manually put something else in the value like 40 it moves perfectly but other then that it will not move when N1 increases/decreases at all.
It's been far too long since I last worked on this. However, <Pivot> is the correct tag to use.Here's the script I used for the N1% display in the gauge above. Note that instead of a non-linearity table, I've used a scalar value to calibrate the rotation. Also, this uses three "pie" segments. The first "pie" segment is hidden with an overlay mask. The other two segments are hidden behind the first:
<Element Name="Eng1 N1 Gray Circle">
  <Position X="548" Y="123"/>
  <Element>
    <Visible>(A:TURB ENG CORRECTED N1:1,percent) 33.0 <</Visible>
    <Pie Radius="41" StartAngle="360" EndAngle="270" FillColor="#545454" Bright="yes">
      <Pivot X="42" Y="42"/>
    </Pie>
    <Rotate>
      <Value>3.6 (A:TURB ENG CORRECTED N1:1,percent) 100 / *</Value>
    </Rotate>
  </Element>
  <Element>
    <Visible>(A:TURB ENG CORRECTED N1:1,percent) 33.0 > (A:TURB ENG CORRECTED N1:1,percent) 66.0 < and</Visible>
    <Pie Radius="41" StartAngle="360" EndAngle="180" FillColor="#545454" Bright="yes">
      <Pivot X="42" Y="42"/>
    </Pie>
    <Rotate>
      <Value>3.6 (A:TURB ENG CORRECTED N1:1,percent) 100 / *</Value>
    </Rotate>
  </Element>
  <Element>
    <Visible>(A:TURB ENG CORRECTED N1:1,percent) 66.0 ></Visible>
    <Pie Radius="41" StartAngle="360" EndAngle="90" FillColor="#545454" Bright="yes">
      <Pivot X="42" Y="42"/>
    </Pie>
    <Rotate>
      <Value>3.6 (A:TURB ENG CORRECTED N1:1,percent) 100 / *</Value>
    </Rotate>
  </Element>
</Element>

Share this post


Link to post
Share on other sites

Jan I tried that but it didn't work.Bill, you're the man - again - thank you. The only difference I can tell from my code and yours is that there's no nonlinarity table and you've changed the value it seems to be an angel of 360 from what I can tell.What's the difference between the corrected N1 and the TURB ENG1 N1?EDIT: Bill you said that you hid the other two with the first one and the first one with a mask? How did you hid the other two with the first one?FYI, for whatever odd reason (A:TURB ENG1 N1,perecent) percent will not work, only the corrected [(A:TURB ENG CORRECTED N1:1,percent)] works. I replaced the corrected in bills code with turb eng1 n1 and it didn't work and then I put in the corrected into the initial code I used and it moved just as bills does now. I still don't know the difference between the too but corrected works with pie and turb eng1 n1 won't.

Share this post


Link to post
Share on other sites

Hi,See my pie code upstairs.Here i use pivot.In the SDK, see http://msdn.microsoft.com/en-us/library/cc526953.aspx#mozTocId69607 ,axis is adviced.I use axis extensively for my custom made flightplan lines and symbols.Btw. tested:

<Element>
  <Visible>(A:TURB ENG N1:1,percent) 33.0 <</Visible>
  <Pie Radius="41" StartAngle="360" EndAngle="270" FillColor="#545454" Bright="yes">
    <Pivot X="42" Y="42"/>
  </Pie>
  <Rotate>
    <Value>3.6 (A:TURB ENG N1:1,percent) 100 / *</Value>
  </Rotate>
</Element>and<Element>
  <Visible>(A:TURB ENG N1:1,percent) 33.0 <</Visible>
  <Pie Radius="41" StartAngle="360" EndAngle="270" FillColor="#545454" Bright="yes">
    <Axis X="42" Y="42"/>
  </Pie>
  <Rotate>
    <Value>3.6 (A:TURB ENG N1:1,percent) 100 / *</Value>
  </Rotate>
</Element>

and they work ok.Jan

Share this post


Link to post
Share on other sites

Just tested, they work now on mine too. Thank You Jan.You're saying Axis is more advisable than pivot correct?Would you be able to teach me/point me in the right directions for creating custom flightplan lines & symbols?

Share this post


Link to post
Share on other sites

Hi,Custom symbols etc.Still somewhat experimental; lots of inefficient(?) code.Sended it to Spokes and Edetroit to edit and to make it a useful freeware gauge someday if they want so.But you are commercial....Some hints:Most is already here at avsim in the different threads.Use the gps flightplanline and custom symbols.For a transparant background like a hud, make your own lines. For flightplan no problem, but almost impossible for the different approachsegments.The waypoints have there lat/lon, so does your plane.Calculate bearing and distance and use some gonio-mathematics to shift the symbols in regard to the plane's heading.Use some "loop" code from the gps to get the next waypoints.The same applies for fplines, waypoints, nav symbols, runways etc.No bitmaps.Hope it helps,Jan

Share this post


Link to post
Share on other sites
Bill, you're the man - again - thank you. The only difference I can tell from my code and yours is that there's no nonlinarity table and you've changed the value it seems to be an angel of 360 from what I can tell.What's the difference between the corrected N1 and the TURB ENG1 N1?EDIT: Bill you said that you hid the other two with the first one and the first one with a mask? How did you hid the other two with the first one?
It's been far too long (over 2 years!) since I scripted this, but to the best of my recollection I used the <Pivot> tag so that the same script would work in both FS9 and FSX. It is odd that <Pivot> is not even mentioned in the FSX/ESP SDK, and of course ACES never explained anything in the FS9 SDK, not even that <Pie> or <Arc> existed at all! :( Honestly, I haven't a clue to the (probably very minor) difference between the two (corrected vice non-corrected).If you note, all three of the pie "segments" begin their rotation from the same angle. The <Visibility> code keeps them "hidden" until needed, but even without the <Visibility> condition they'd simply be in the same position as the first "segment..."Were you to make each of the three pie segments a different color, you'd see them "unfolding" like the petals on a lady's "hand fan."BTW, the "scalar" is calculated to calibrate the "percentage" around a 360º rotation. If your display is only a partial rotation such as 270º, then the scalar would be 2.7 of course!

Share this post


Link to post
Share on other sites
Hi,Custom symbols etc.Still somewhat experimental; lots of inefficient(?) code.Sended it to Spokes and Edetroit to edit and to make it a useful freeware gauge someday if they want so.But you are commercial....Some hints:Most is already here at avsim in the different threads.Use the gps flightplanline and custom symbols.For a transparant background like a hud, make your own lines. For flightplan no problem, but almost impossible for the different approachsegments.The waypoints have there lat/lon, so does your plane.Calculate bearing and distance and use some gonio-mathematics to shift the symbols in regard to the plane's heading.Use some "loop" code from the gps to get the next waypoints.The same applies for fplines, waypoints, nav symbols, runways etc.No bitmaps.Hope it helps,Jan
I'm actually more freeware than it seems you think or than I seem to have been labeled, but I suppose I'm not labeled that way....I'll see what I can figure out from your advice, thank you Jan.
It's been far too long (over 2 years!) since I scripted this, but to the best of my recollection I used the <Pivot> tag so that the same script would work in both FS9 and FSX. It is odd that <Pivot> is not even mentioned in the FSX/ESP SDK, and of course ACES never explained anything in the FS9 SDK, not even that <Pie> or <Arc> existed at all! :( Honestly, I haven't a clue to the (probably very minor) difference between the two (corrected vice non-corrected).If you note, all three of the pie "segments" begin their rotation from the same angle. The <Visibility> code keeps them "hidden" until needed, but even without the <Visibility> condition they'd simply be in the same position as the first "segment..."Were you to make each of the three pie segments a different color, you'd see them "unfolding" like the petals on a lady's "hand fan."BTW, the "scalar" is calculated to calibrate the "percentage" around a 360º rotation. If your display is only a partial rotation such as 270º, then the scalar would be 2.7 of course!
Thank You Bill, makes great sense now. Currently I'm just using a clip to make it look decent I may potentially add a mask if needed, this is great fun though - pie & arc rule!Thank You guys!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this