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

XML vector drawing

Messages
36
Country
yugoslavia
Hello guys.
I want to draw a vectors of forces acting on aircraft during flight on 2D gauge using xml which will be updated dynamically as intensity of vectors change.
Question... how to draw horizontal line or rectangle which will go left or right from defined starting point ?
For instance if I use <WidthCode> tag for rectangle, it will take a value into the consideration but rectangle will grove to the right side only... how about to the left ?
Same question for VerticalLine or Rectangle... how to make it grow from bottom to the top ?
 
Last edited:
Take a look at this thread which has the basics of moving objects in XML. Beyond that, search this Gauges forum for shift or rotate or widthcode and you'll get lots of hits.

Bob
 
A nice little project when insomnia kicks in.. :stirthepo 🌚
This example uses the joystick/yoke elevator & aileron values for testing.
Made in FSX syntax using <Visibility>, <FloatPosition>, <WidthScript>, <HeightScript> & <Rotation> to get the job done.
XML:
<SimBase.Document Type="AceXML" version="1,0" id="vector_example">
    <Descr>AceXML Document</Descr>
    <Filename>vector_example.xml</Filename>
    <SimGauge.Gauge id="Gauge" ArtDirectory="">
        <FloatPosition>0.000,0.000</FloatPosition>
        <Size>450,450</Size>
      
      <Element id="Background">
        <FloatPosition>0.000,0.000</FloatPosition>
        <Visibility>1</Visibility>
        <Rectangle id="Rectangle">
          <LineWidth>2</LineWidth>
          <Bright>True</Bright>
          <Width>450</Width>
          <Height>450</Height>
          <LineColor>#010101</LineColor>
          <FillColor>#FFC0C0</FillColor>
        </Rectangle>
      </Element>
    
         <Element id="Numerical Display">
            <FloatPosition>10.000,10.000</FloatPosition>
            <GaugeText>
              <Bright>True</Bright>
              <FontColor>Blue</FontColor>
              <FontFace>Arial</FontFace>
              <FontHeight>10</FontHeight>
              <FontWeight>400</FontWeight>
              <Size>180,125</Size>
              <Transparent>True</Transparent>
              <GaugeString>
                  %\{ul}%RAW VALUES OUT\{nr}\n
                  %\{tabs=0L,10L}\t%A:YOKE X POSITION, number = %((A:YOKE X POSITION, number))%!3.6f!%\n
                  %\{tabs=0L,10L}\t%A:YOKE Y POSITION, number = %((A:YOKE Y POSITION, number))%!3.6f!%\{nr}\n\n
                  %\{ul}%CALCd VALUES OUT, MAX 200px DEFLECTION%\{nr}\n
                  %\{tabs=0L,10L}\t%AILERON = %((A:YOKE X POSITION, number) abs 200 *)%!d!%\n
                  %\{tabs=0L,10L}\t%ELEVATOR = %((A:YOKE Y POSITION, number) abs 200 *)%!d!%       
              </GaugeString>
            </GaugeText>
         </Element>
    
        <!-- The output is greater than zero, the display bar goes to the right -->
      <Element id="Right Aileron">
        <FloatPosition>241.000,222.000</FloatPosition>
        <Visibility>(A:YOKE X POSITION, number) 0 &gt;</Visibility>
        <Rectangle id="Rectangle">
          <LineWidth>1</LineWidth>
          <Bright>True</Bright>
          <Width>200</Width>
          <Height>10</Height>
          <LineColor>#C00000</LineColor>
          <FillColor>#C00000</FillColor>
          <WidthScript>(A:YOKE X POSITION, number) abs 200 *</WidthScript>
        </Rectangle>
      </Element>   
    
        <!-- The output is less than zero, the display bar NEEDS to go to the left -->
        <!-- therefore we rotate it 180 degrees -->
        <!-- Due to the funkiness of the XML vector drawing, the rectangle height needed to be changed -->
      <Element id="Left Aileron">   
        <FloatPosition>211.000,230.000</FloatPosition>     
        <Visibility>(A:YOKE X POSITION, number) 0 &lt;</Visibility>
        <Rectangle id="Rectangle">
          <LineWidth>1</LineWidth>
          <Bright>True</Bright>
          <Width>200</Width>
          <Height>8</Height>
          <LineColor>#C00000</LineColor>
          <FillColor>#C00000</FillColor>         
          <WidthScript>(A:YOKE X POSITION, number) abs 200 *</WidthScript>
        </Rectangle>
          <Rotation id="Rotation">
                <Expression>
                    <Script>180 dgrd</Script>           
                </Expression>
                <DegreesPointsTo>90</DegreesPointsTo>     
          </Rotation>     
      </Element>
    
        <!-- The output is less than zero, the display bar NEEDS to go to up -->
        <!-- therefore we rotate it 180 degrees -->
        <!-- Due to the funkiness of the XML vector drawing, the rectangle width needed to be changed -->
      <Element id="Down Elevator">
        <FloatPosition>229.000,211.000</FloatPosition>
        <Visibility>(A:YOKE Y POSITION, number) 0 &lt;</Visibility>
        <Rectangle id="Rectangle">
          <LineWidth>1</LineWidth>
          <Bright>True</Bright>
          <Width>6</Width>
          <Height>200</Height>
          <LineColor>#C00000</LineColor>
          <FillColor>#C00000</FillColor>
          <HeightScript>(A:YOKE Y POSITION, number) abs 200 *</HeightScript>
        </Rectangle>
          <Rotation id="Rotation">
                <Expression>
                    <Script>180 dgrd</Script>           
                </Expression>
                <DegreesPointsTo>90</DegreesPointsTo>     
          </Rotation>
      </Element>

      <Element id="Up Elevator">
        <FloatPosition>223.000,243.000</FloatPosition>
        <Visibility>(A:YOKE Y POSITION, number) 0 &gt;</Visibility>
        <Rectangle id="Rectangle">
          <LineWidth>1</LineWidth>
          <Bright>True</Bright>
          <Width>6</Width>
          <Height>200</Height>
          <LineColor>#C00000</LineColor>
          <FillColor>#C00000</FillColor>
          <HeightScript>(A:YOKE Y POSITION, number) abs 200 *</HeightScript>
        </Rectangle>
      </Element>   

        <Element id="Center Circle">
        <FloatPosition>210.000,210.000</FloatPosition>
        <Visibility>1</Visibility>
        <Circle id="Circle">
          <LineWidth>4</LineWidth>
          <Bright>True</Bright>
          <Radius>15</Radius>
          <LineColor>#010101</LineColor>
          <FillColor>#008000</FillColor>
        </Circle>
      </Element>     
      
    </SimGauge.Gauge>
</SimBase.Document>

0.jpg1.jpg2.jpg
 
Last edited:
Back
Top