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

Macro Problem

Messages
137
Country
us-southcarolina
All,

I'm trying to use Nonlinerity tables in a macro and can't get it to work.

1. can you do this with macros?

2. If not could I use <Select><Value> and assign a value to and L:var and then use that in the macro?

I initialy tested this hard coding a value for each macro and the line is being drawn in the "Edge" section but when I added the nonlinearity tables I got nothing.
Help please

Joel

Code:
                 <Macro Name="LX_rear">
                 <Value>(L:NAV1-DME_Distance, nmiles)</Value>
                  <Nonlinearity>
                        <Item Value="0.1" X="-29" />
                        <Item Value="0.3" X="-21" />
                        <Item Value="0.5" X="-16" />
                        <Item Value="0.7" X="-13" />
                        <Item Value="1.0" X="-10" />
                        <Item Value="1.5" X="-7" />
                    </Nonlinearity>
                 </Macro>
                <Macro Name="LX_fwd">
                  <Value>(L:NAV1-DME_Distance, nmiles)</Value>
                    <Nonlinearity>
                        <Item Value="0.1" X="-187" />
                        <Item Value="0.3" X="-51" />
                        <Item Value="0.5" X="-30" />
                        <Item Value="0.7" X="-21" />
                        <Item Value="1.0" X="-14" />
                        <Item Value="1.5" X="-10" />
                    </Nonlinearity>
                </Macro>
                <Macro Name="Y_rear">
                    <Value>(L:NAV1-DME_Distance, nmiles)</Value>
                    <Nonlinearity>
                        <Item Value="0.1" Y="0" />
                        <Item Value="0.3" Y="22" />
                        <Item Value="0.5" Y="33" />
                        <Item Value="0.7" Y="40" />
                        <Item Value="1.0" Y="48" />
                        <Item Value="1.5" Y="54" />
                    </Nonlinearity>
                </Macro>
                <Macro Name="Y_fwd">
                    <Value>(L:NAV1-DME_Distance, nmiles)</Value>
                    <Nonlinearity>
                        <Item Value="0.1" Y="112" />
                        <Item Value="0.3" Y="84" />
                        <Item Value="0.5" Y="79" />
                        <Item Value="0.7" Y="77" />
                        <Item Value="1.0" Y="76" />
                        <Item Value="1.5" Y="76" />
                    </Nonlinearity>
                </Macro>
                
// ---------  Edge --------------
                <Element>
                    <Position X="332" Y="272"/>
                    <Visible>@ILS_LOC_Mode 2 &lt; (L:NAV1-DME_Distance, nmiles) 1.5 &lt;  &amp;&amp; (A:Radio height, feet) 5 &gt; &amp;&amp;</Visible>
                    <Element>
                        <Polyline Color="Lime" Linewidth="2">
                            <Point X="@LX_rear" Y="@Y_rear" />
                            <Point X="@LX_fwd" Y="@Y_fwd" />
                        </Polyline>
                    </Element>
                  </Element>
 
1) No.

I don't understand why you want macros for your example in the first place. It'd just add unneccessary complications.
 
1) No.

I don't understand why you want macros for your example in the first place. It'd just add unneccessary complications.

I'm just trying to figure a way to get values based on a nonlinearity table into the X, Y coordinates of polyline points.

Can I do it with L:vars ? ie

Code:
<Element>
<Select>
<Value>(some A:var script) (&gt;L:varX, number)
<Nonlinearity>
      <Item Value="?" X="?" />
      <Item Value="?" X="?" />
</Nonlinearity>
</Select>
</Element>

then

<Element>
     <Polyline Color="Lime" Linewidth="2" >
          <Point X="(L:varX, number)" Y="10" />
          <Point X="30" Y="20" />
     </Polyline>
</Element>

The above is just for "X" in the first point
I have value tables for ea X and ea Y for 4 points
ideas ?
 
OK I'm starting to panic now. :banghead:

I abandon the macro approach. While I could hard code the macros and get the polyline to draw when i tried to add nonlinearity tables to the macro value Like above, got nothing !

Then I tried using L:vars like this....

Code:
<Element>
                <Select>
                 <Value>(L:NAV1-DME_Distance, nmiles) (&gt;L:LX_Rear, number)</Value>
                  <Nonlinearity>
                        <Item Value="0.1" X="-29" />
                        <Item Value="0.3" X="-21" />
                        <Item Value="0.5" X="-16" />
                        <Item Value="0.7" X="-13" />
                        <Item Value="1.0" X="-10" />
                        <Item Value="1.5" X="-7" />
                    </Nonlinearity>
                </Select>
                </Element>
            // ----------------------
                <Element>
                <Select>
                    <Value>(L:NAV1-DME_Distance, nmiles) (&gt;L:LX_Fwd, number)</Value>
                    <Nonlinearity>
                        <Item Value="0.1" X="-187" />
                        <Item Value="0.3" X="-51" />
                        <Item Value="0.5" X="-30" />
                        <Item Value="0.7" X="-21" />
                        <Item Value="1.0" X="-14" />
                        <Item Value="1.5" X="-10" />
                    </Nonlinearity>
                </Select>
                </Element>
            // -------------------
                <Element>
                <Select>
                    <Value>(L:NAV1-DME_Distance, nmiles) (&gt;L:RX_Rear, number)</Value>
                    <Nonlinearity>
                        <Item Value="0.1" X="29" />
                        <Item Value="0.3" X="21" />
                        <Item Value="0.5" X="16" />
                        <Item Value="0.7" X="13" />
                        <Item Value="1.0" X="10" />
                        <Item Value="1.5" X="7" />
                    </Nonlinearity>
                </Select>
                </Element>
            // --------------------
                <Element>
                <Select>
                    <Value>(L:NAV1-DME_Distance, nmiles) (&gt;L:RX_Fwd, number)</Value>
                    <Nonlinearity>
                        <Item Value="0.1" X="187" />
                        <Item Value="0.3" X="51" />
                        <Item Value="0.5" X="30" />
                        <Item Value="0.7" X="21" />
                        <Item Value="1.0" X="14" />
                        <Item Value="1.5" X="10" />
                    </Nonlinearity>
                </Select>
                </Element>
            // --------------------
                <Element>
                <Select>
                    <Value>(L:NAV1-DME_Distance, nmiles) (&gt;L:Y_Rear, number)</Value>
                    <Nonlinearity>
                        <Item Value="0.1" Y="0" />
                        <Item Value="0.3" Y="22" />
                        <Item Value="0.5" Y="33" />
                        <Item Value="0.7" Y="40" />
                        <Item Value="1.0" Y="48" />
                        <Item Value="1.5" Y="54" />
                    </Nonlinearity>
                </Select>
                </Element>
            // ---------------------
                <Element>
                <Select>
                    <Value>(L:NAV1-DME_Distance, nmiles) (&gt;L:Y_Fwd, number)</Value>
                    <Nonlinearity>
                        <Item Value="0.1" Y="112" />
                        <Item Value="0.3" Y="84" />
                        <Item Value="0.5" Y="79" />
                        <Item Value="0.7" Y="77" />
                        <Item Value="1.0" Y="76" />
                        <Item Value="1.5" Y="76" />
                    </Nonlinearity>
                </Select>
                </Element>
                
// ---------  Edges --------------
                <Element>
                    <Position X="332" Y="272"/>
                    <Visible>@ILS_LOC_Mode 2 &lt; (L:NAV1-DME_Distance, nmiles) 1.5 &lt;  &amp;&amp; (A:Radio height, feet) 5 &gt; &amp;&amp;</Visible>
                    <Element>
                        <Polyline Color="Lime" Linewidth="2">
                            <Point X="(L:LX_Rear, number)" Y="(L:Y_Rear, number)" />
                            <Point X="(L:LX_Fwd, number)" Y="(L:Y_Fwd, number)" />
                        </Polyline>
                    </Element>
                    <Element>
                        <Polyline Color="Lime" Linewidth="2">
                            <Point X="(L:RX_Rear, number)" Y="(L:Y_Rear, number)" />
                            <Point X="(L:RX_Fwd, number)" Y="(L:Y_Fwd, number)" />
                        </Polyline>
                    </Element>
                </Element>

Again if I hard coded the L:vars with a fixed value the polylines would draw, but as soon as i tried to evaluate a value base on a nonlinearity table I got nothing! Starting to sweat...

Then I tried using the nonlinearity table right in the <Point> tag like this....

Code:
<Element>
                    <Position X="332" Y="272"/>
                    <Visible>@ILS_LOC_Mode 2 &lt; (L:NAV1-DME_Distance, nmiles) 1.5 &lt;  &amp;&amp; (A:Radio height, feet) 5 &gt; &amp;&amp;</Visible>
                    <Element>
                        <Polyline Color="Lime" Linewidth="2">
                            <Point>
                               <Value Minimum="0.1" Maximum="1.5">(L:NAV1-DME_Distance, nmiles)</Value>
                                <Nonlinearity>
                                    <Item Value="0.1" X="-29" Y="0" />
                                    <Item Value="0.3" X="-21" Y="22" />
                                    <Item Value="0.5" X="-16" Y="33" />
                                    <Item Value="0.7" X="-13" Y="40" />
                                    <Item Value="1.0" X="-10" Y="48" />
                                    <Item Value="1.5" X="-7" Y="54" />
                                </Nonlinearity>
                            </Point>
                            <Point>
                               <Value Minimum="0.1" Maximum="1.5">(L:NAV1-DME_Distance, nmiles)</Value>
                                <Nonlinearity>
                                    <Item Value="0.1" X="-187" Y="112" />
                                    <Item Value="0.3" X="-51" Y="84" />
                                    <Item Value="0.5" X="-30" Y="79" />
                                    <Item Value="0.7" X="-21" Y="77" />
                                    <Item Value="1.0" X="-14" Y="76" />
                                    <Item Value="1.5" X="-10" Y="76" />
                                </Nonlinearity>
                            </Point>
                        </Polyline>
                    </Element>
                    <Element>
                        <Polyline Color="Lime" Linewidth="2">
                            <Point>
                               <Value Minimum="0.1" Maximum="1.5">(L:NAV1-DME_Distance, nmiles)</Value>
                                <Nonlinearity>
                                    <Item Value="0.1" X="29" Y="0" />
                                    <Item Value="0.3" X="21" Y="22" />
                                    <Item Value="0.5" X="16" Y="33" />
                                    <Item Value="0.7" X="13" Y="40" />
                                    <Item Value="1.0" X="10" Y="48" />
                                    <Item Value="1.5" X="7" Y="54" />
                                </Nonlinearity>
                            </Point>
                            <Point>
                               <Value Minimum="0.1" Maximum="1.5">(L:NAV1-DME_Distance, nmiles)</Value>
                                <Nonlinearity>
                                    <Item Value="0.1" X="187" Y="112" />
                                    <Item Value="0.3" X="51" Y="84" />
                                    <Item Value="0.5" X="30" Y="79" />
                                    <Item Value="0.7" X="21" Y="77" />
                                    <Item Value="1.0" X="14" Y="76" />
                                    <Item Value="1.5" X="10" Y="76" />
                                </Nonlinearity>
                            </Point>
                        </Polyline>
                    </Element>
                </Element>

No go. :banghead:

there has to be some way to use the nonlinearity table values to control the polyline.
I'm obviously doing something the wrong way. I'm running out of ideas

HELP

Joel
 
It seems that there is no way to use anything other than fixed values in polylines, but you can replace them with a thin polygons.

Code:
<Element Name="Start_end_coordinates">
    <Select>
        <Value>
            ? (>L:X1,enum)
            ? (>L:Y1,enum)
 
            ? (>L:X2,enum)
            ? (>L:Y2,enum)
        </Value>
    </Select>
</Element>

<Element Name="Line">
    <Rectangle Width="1000" Height="1000" FillColor="Lime" LineWidth="0" Bright="Yes">
        <HeightCode>1</HeightCode>
        <WidthCode>(L:X2,enum) (L:X1,enum) - sqr (L:Y2,enum) (L:Y1,enum) - sqr + sqrt</WidthCode>
    </Rectangle>
    <Rotate><Value>(L:Y2,enum) (L:Y1,enum) - (L:X2,enum) (L:X1,enum) - atg2</Value></Rotate>
    <Shift><Value>(L:X1,enum)</Value><Scale X="1"/></Shift>
    <Shift><Value>(L:Y1,enum)</Value><Scale Y="1"/></Shift>
</Element>
 
Last edited:
I'm trying to use Nonlinerity tables in a macro and can't get it to work.

1. can you do this with macros?

2. If not could I use <Select><Value> and assign a value to and L:var and then use that in the macro?

1- No
2- No. Macros are script only replacements, other commands like <Element>, etc are not supported.


I'm just trying to figure a way to get values based on a nonlinearity table into the X, Y coordinates of polyline points.

Can I do it with L:vars ? ie

No, you cant. But you can do that only if using macros with single fixed values:

<Macro Name="Macro1">20</Macro>
.....
<Point X="@Macro1" Y="10" />

Which I guess isn't much useful.

To do what you want, simply position your Polyline anywhere on the gauge and the use
<Shift>/<Rotate> commands, to move/rotate it according to script evaluations.

Tom
 
To do what you want, simply position your Polyline anywhere on the gauge and the use
<Shift>/<Rotate> commands, to move/rotate it according to script evaluations.

Tom

These polylines are part of a HUD feature which is suppose to track/display Runway edges as the aircraft is on approach
www.fsdeveloper.com/forum/threads/adding-conformal-runway-edges-to-hud.440329/#post-774391
so...
I was going to do what you suggest originally but for the lines to be truly conformal with the Sim World on the HUD glass not only does the position and rotation of the polylines change, the length of the lines changes also as the aircraft gets closer and perspective gets wider and depth is compressed as aircraft descends. This is why I was trying to manipulate the <point X Y /> location on the fly, but I keep running into a brick wall. While <Nonlinearity> tables are great but apparently you can only use them in certain places. This is only the first part of a bigger picture, ie This part is just the "edge" lines, tracking the shape of the runway, basically it can be thought of as an animation of runway perspective as the aircraft follows the glide path to touchdown, the rest is the shift/rotate math needed to to make it conformal with the sim world which is being discussed in the other thread. I thought this was going to be the easy part and broke it out of the other thread to focus on it. So it seems my original idea is not going to work as expected ( a deepening of my love/hate relationship with MSFS :banghead: )

That said, after 2 days trying this approach without any luck I have re-evaluated what I need this feature to actually do ( show runway edges in zero vis) and adjusted my goal from what i would like (be totaly conformal with width/length of runway) , to what I need (see approx runway edges at touchdown).

Since it won't effect the functionality of the feature to not be conformal with runway length, I'm going to re-evaluate the Nonlinearity tables using fixed length lines and "simply" rotate/shift them, as you suggest, to track runway edges for this Element and then manipulate that via methods being discussed in the other thread to track the runway in the sim world.

So to move forward....

1) When working with polylines, is the "axis" for shift/rotate automatically the center of the line or does it need to be defined like when using a BMP ?

2) If it needs to be defined,for example, if I wanted to use lines 60 px long with rotation in the center of the line, would it be done like this...

Code:
<Element>
<Polyline Linewidth="2" Color="Lime"/>
    <Point X="0" Y="0"/>
    <Point X="0" Y="60"/>
</Polyline>
<axis X="0" Y="30" />
<Shift> where i want </Shift>
<Rotate> amount i want </Rotate>
</Element>

And use my revised <nonliniearity> tables as usual within the <Shift> and <Rotate> tags ?

Any other pointers or undocumented traps to look out for when working with polylines ?

Thanks

Joel
 
2) If it needs to be defined,for example, if I wanted to use lines 60 px long with rotation in the center of the line, would it be done like this...
Search for Pivot examples in fs9gps.cab.
 
Search for Pivot examples in fs9gps.cab.
with
Very interesting...I had never seen <Pivot> used before, so....

1) So looking at this can <Pivot> be used interchangeably with <Axis> in FS9 schema?

2) when defining a "pivot" for a polyline you do it within the <polyline> tags ?

Joel
 
^
1) I don't know, probably not.
2) Yes. You have a lot of Polyline/Pivot examples in fs9gps.
 
1- No
2- No. Macros are script only replacements, other commands like <Element>, etc are not supported.




No, you cant. But you can do that only if using macros with single fixed values:

<Macro Name="Macro1">20</Macro>
.....
<Point X="@Macro1" Y="10" />

Which I guess isn't much useful.

Tom

ANYONE .....

So if I understand everything that has been said in this thread...
In XML it is NOT possible to control the length of Polylines or the position of Points of a polyline individually and continually on the fly? In other words there is no way to "grow" the length of a polyline by script or other method. You draw it once and it might as well be a BMP as far as any movement goes ? Does that size it up fairly ?? XML just won't go there ?

Is there such a thing as graphical scaling of polylines in XML ?

So i guess everything you see using drawn vectors that moves and changes size is done in C++ ?

Joel
 
Did you read my post #5 with "thin rectangle" alternative?
No I missed that, my browser opend to the post after yours from the email link.

At first glance it might work but I have a few questions just to make sure I understand how to use them Like a "line".

Code:
<Element Name="Start_end_coordinates">
    <Select>
        <Value>
            ? (>L:X1,enum)
            ? (>L:Y1,enum)
 
            ? (>L:X2,enum)
            ? (>L:Y2,enum)
        </Value>
    </Select>
</Element>

<Element Name="Line">
    <Rectangle Width="1000" Height="1000" FillColor="Lime" LineWidth="0" Bright="Yes">
        <HeightCode>1</HeightCode>
        <WidthCode>(L:X2,enum) (L:X1,enum) - sqr (L:Y2,enum) (L:Y1,enum) - sqr + sqrt</WidthCode>
    </Rectangle>
    <Rotate><Value>(L:Y2,enum) (L:Y1,enum) - (L:X2,enum) (L:X1,enum) - atg2</Value></Rotate>
    <Shift><Value>(L:X1,enum)</Value><Scale X="1"/></Shift>
    <Shift><Value>(L:Y1,enum)</Value><Scale Y="1"/></Shift>
</Element>

1) In you example the "graphic" equivalent of what we have here is a rectangle in which the "border" or outside edge is NOT stroked (ie "LineWidth="0") ?

2) To control the width of our pseudo "line" use <HeightCode> ?

3)To control the Lenght of our line use <WidthCode> ?

4) in your example you don't have a <pivot> or <axis> for the rotate ? , If one is not needed what is the "default" location of the pivot or axis in the pseudo Line?

5) is the pivot or axis also the point which all <shift> measured from ?

6) Will the above code work in FS9 schema? ie I haven't seen the ability to "name" Elements in FS9 schema ?

Thanks

joel
 
1) You're right, no edges.
2,3) Yes. Maximum dimensions are limited with "Rectangle Width/Height" values. "1000" in this example should be enough.
4,5) No pivot. This code just draws a line between (X1,Y1) and (X2,Y2). . In the first <Element> you must to enter calculated coordinates (the ones you intend for Polyline <Points>).
6) Fs9gps again:D. I think that Name is a pseudo-parameter, some kind of comment.

Sorry for poor english.
 
Luka, thanks for the reply. I'll give it a shot.

So in my case, if I use my code to calc my continually moving X,Y points, this "drawing code" will redraw the line every update cycle there is a change in either X1,Y1 or X2,Y2?

Are the X1,Y1 locations absolute or do they follow "nested" conventions ? ie if your code has a parent with a defined position or boundary, X1, Y1 is in relation to Parent Element origin ie parent 0,0 not necessarily gauge 0,0 ? I hope that made sense.

Joel

Edit UPDATE....

I did a couple of quick test and your script works just as i need it to. I can adjust the (X,Y) points on the fly using L:vars and the "line continually updates positions of the start and end points

In the long run this should work perfectly to draw the lines as needed. Now I just need to get my scripts working as desired. Thanks so much

Joel
 
Last edited:
Back
Top