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

FS2004 Makemdl.Parts XML - Stacked (nested) <Parts>?

Milton_Shupe

Resource contributor
Messages
331
Country
us-newmexico
Sorry for the continued XML questions :)

I have the need to control multiple model parts Hiding/Showing based on one condition. Can <Parts> sections be embedded (nested) in the conditional statement? In gauges, one can have multiple embedded <elements>. Is this true for <parts> in the makemdl.parts xml?

In my ship project, if Parking_Brake is set (and anchors displayed), then I want to Hide all the sails and Unhide the Stowed Sails (sailsecured).

Simply stated, if parking brake is set, hide all sails and unhide sailsecured (stowed sails).

How can this be done most efficiently?

This is my existing code:


<!-- Show/hide Anchors/Stowed Sails Based on Parking Brake -->

<part>
<name>anchors</name>
<visible_in_range>
<parameter>
<code>
(A:parking_Brake, percent) 1 &gt;
</code>
</parameter>
<minvalue>1</minvalue>
</visible_in_range>
</part>

****Can this next section be embedded in the above condition?****

<part>
<name>sailsecured</name>
<visible_in_range>
<parameter>
<code>
(A:parking_Brake, percent) 1 &gt;
</code>
</parameter>
<minvalue>1</minvalue>
</visible_in_range>
</part>

****Can these next two sections be embedded in the first conditional test?****

<!-- Jibs Visibility Based on Flaps Settings -->

<part>
<name>jibs_port</name>
<visible_in_range>
<parameter>
<code>
(A:Trailing edge flaps0 left angle, degrees) 60 &lt;
</code>
</parameter>
<minvalue>1</minvalue>
</visible_in_range>
</part>

<part>
<name>jibs_starboard</name>
<visible_in_range>
<parameter>
<code>
(A:Trailing edge flaps0 left angle, degrees) 59 &gt;
</code>
</parameter>
<minvalue>1</minvalue>
</visible_in_range>
</part>
 
Messages
211
Country
germany
Code:
<part>
<name>anchors</name>
<visible_in_range>
<parameter>
<code>
(A:BRAKE PARKING POSITION, position) 1 &gt;
if{ 1 } els{ 0 }
</code>
</parameter>
<minvalue>1</minvalue>
</visible_in_range>
</part>

<part>
<name>sailsecured</name>
<visible_in_range>
<parameter>
<code>
(A:BRAKE PARKING POSITION, position) 1 &gt;
if{ 1 } els{ 0 }
</code>
</parameter>
<minvalue>1</minvalue>
</visible_in_range>
</part>
 

Milton_Shupe

Resource contributor
Messages
331
Country
us-newmexico
Code:
<part>
<name>anchors</name>
<visible_in_range>
   <parameter>
     <code>
        (A:BRAKE PARKING POSITION, position) 1 &gt;
           if{ 1 } els{ 0 }
     </code>
   </parameter>
   <minvalue>1</minvalue>
</visible_in_range>
</part>

Hmmm, this code is not working as expected. Nothing happens on parking brake set.

What value should be expected in "position"? Are we testing this variable correctly?

EDIT: Per my test gauge, the value of A:BRAKE PARKING POSITION is changing from 0 to 1 for parking brake set. The hide/unhide is just not working from the makemdl.parts code. Is the test for "1" correct, or should that be "0"? The anchor chain should show with the Parking Brake set. Nevermind ... duh :) Test should be > 0.
 
Last edited:

Milton_Shupe

Resource contributor
Messages
331
Country
us-newmexico
How do I change the code below to add a second condition?

I need this part to show if both these conditions are met:

(A:Trailing edge flaps0 left angle, degrees) 50 &lt; and (A:BRAKE PARKING POSITION, position) 0 ==;

Code:
<part> 
<name>staysails_port</name> 
<visible_in_range> 
   <parameter> 
     <code>
      (A:Trailing edge flaps0 left angle, degrees) 50 &lt;
     </code>
   </parameter>
     <minvalue>1</minvalue> 
</visible_in_range>
</part>

And so that I do not continue to bug you, is there a good reference somewhere showing how to construct these conditional statements?
 
Messages
10,088
Country
us-arizona
Hey Milton,

<part>
<name>staysails_port</name>
<visible_in_range>
<parameter>
<code>
(A:Trailing edge flaps0 left angle, degrees) 50 &lt;
(A:BRAKE PARKING POSITION, position) 0 ==;
and
</code>
</parameter>
<minvalue>1</minvalue>
</visible_in_range>
</part>

(A:Trailing edge flaps0 left angle, degrees) 50 &lt;
(A:BRAKE PARKING POSITION, position) 0 ==;
and

You add a 'and' to the 'bottom' of the stack for each added line. So if you have 4 lines of conditions, then you have three 'and's at the bottom of that stack. (You can also add or to one, like and or and). These would go in one line, like this;

(A:Trailing edge flaps0 left angle, degrees) 50 &lt;
(A:BRAKE PARKING POSITION, position) 0 ==;
(A:Trailing edge flaps0 left angle, degrees) 50 &lt;
(A:BRAKE PARKING POSITION, position) 0 ==;
and and and <--- three of them

You are right on the verge of a logic statement as well. Easier then you think. Below a stack like this, you would then add your if{ and els{ sections below the stack (if needed).

For instance,

(A:Trailing edge flaps0 left angle, degrees) 50 &lt;
(A:BRAKE PARKING POSITION, position) 0 ==;
and
if{ 1 (>L:Drop Anchor,bool) }
els{ 0 (>L:Drop Anchor,bool) }

Make sure you have a space between the insides of the brackets.
 

Milton_Shupe

Resource contributor
Messages
331
Country
us-newmexico
Wow! Thank you Bill; that's very instructional. :)
I will try all of them as I have a bunch more things waiting to be implemented.
 

Milton_Shupe

Resource contributor
Messages
331
Country
us-newmexico
Okay, I changed the code as follows and have tried some variations but no cigar ... yet :)

The part should be visible if the variable is less than 50 and the parking brake is NOT on (i.e. 0)

Code:
<part> 
<name>jibs_port</name> 
<visible_in_range> 
   <parameter> 
     <code>
       (A:Trailing edge flaps0 left angle, degrees) 50 &lt;
    (A:BRAKE PARKING POSITION, position) 1 &lt;   
    and
           if{ 1 } els{ 0 }
     </code>
   </parameter>
     <minvalue>1</minvalue> 
</visible_in_range>
</part>
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Um, the units of this variable is "percent" not "position" and the value range from
(A:BRAKE PARKING POSITION,percent)
is 0 to 100 (percent)
Code:
<!-- PARKING BREAK OFF -->
(A:BRAKE PARKING POSITION,percent) 0 ==
<!-- PARKING BREAK ON -->
(A:BRAKE PARKING POSITION,percent) 0 &gt;
Try this:
Code:
<part>
  <name>jibs_port</name>
    <visible_in_range>
    <parameter>
      <code>
        (A:Trailing edge flaps0 left angle, degrees) 50 &lt;
        (A:BRAKE PARKING POSITION, percent) 0 ==
        and
        if{ 1 } els{ 0 }
      </code>
    </parameter>
    <minvalue>1</minvalue>
  </visible_in_range>
</part>
 
Last edited:

Milton_Shupe

Resource contributor
Messages
331
Country
us-newmexico
Thanks for that observation Bill. Interestingly enough, the anchor and stowed sails worked with "position". :-/

Here is what I have changed to and all code following this xml does not work so there is something wrong here with my constructs. It worked before I added the compound condition statement. It must be an issue with either the semi-colon or if/else statement. ??? Do I need the if/else statement here?

Code:
<part>
<name>jibs_port</name>
<visible_in_range>
   <parameter>
     <code>
       (A:Trailing edge flaps0 left angle, degrees) 50 &lt;
    (A:BRAKE PARKING POSITION, percent) 1 &lt;
    and
           if{ 1 } els{ 0 }
     </code>
   </parameter>
     <minvalue>1</minvalue>
</visible_in_range>
</part>
 

Milton_Shupe

Resource contributor
Messages
331
Country
us-newmexico
Tried your suggestion Bill; no cigar ...

The code in front of this works, this code and all that follows do not work so still appears to be a construct issue.

EDIT: Hang on; I am on to something. .... Okay, Resolved; found I cannot use this as a comment :-/

<-- -------------------------------------- -->
Sorry for the confusion.


Code:
<part>
  <name>jibs_port</name>
    <visible_in_range>
    <parameter>
      <code>
        (A:Trailing edge flaps0 left angle, degrees) 50 &lt;
        (A:BRAKE PARKING POSITION, percent) 0 ==
        and
        if{ 1 } els{ 0 }
      </code>
    </parameter>
    <minvalue>1</minvalue>
  </visible_in_range>
</part>
 
Last edited:

Milton_Shupe

Resource contributor
Messages
331
Country
us-newmexico
I have 3 different flags, animated for different wind speeds; flagslow for <15 knots, flagmed for 15-35 knots, and flagfast for over 35 knots. This Visibility Code is in the makemdl.parts file compiled with the model.

The animations work great with all flags. The issue is that I almost always have 2 flags showing and in some gusty situations, 3 flags have shown. Still winds < 10 knots usually shows the correct flag.

I have tried variations on the code and this is what I now have. Would you look at this to ensure I am chasing the right issue here? Thanks in advance.

Code:
<!-- Show/Hide Flags Depending on Wind Speed  -->

<part>
  <name>flagslow</name>
    <visible_in_range>
    <parameter>
      <code>
        (A:AMBIENT WIND VELOCITY, knots) 15 &lt;
           if{ 1 } els{ 0 }
      </code>
    </parameter>
    <minvalue>1</minvalue>
  </visible_in_range>
</part>

<part>
  <name>flagfast</name>
    <visible_in_range>
    <parameter>
      <code>
        (A:AMBIENT WIND VELOCITY, knots) 35 &gt;
           if{ 1 } els{ 0 }
      </code>
    </parameter>
    <minvalue>1</minvalue>
  </visible_in_range>
</part>

<part>
  <name>flagmed</name>
    <visible_in_range>
    <parameter>
      <code>
        15 35 (A:AMBIENT WIND VELOCITY, knots) rng;
           if{ 1 } els{ 0 }
      </code>
    </parameter>
    <minvalue>1</minvalue>
  </visible_in_range>
</part>
 

Attachments

  • 2flags.jpg
    2flags.jpg
    51.6 KB · Views: 312

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Remove the semi-colon. It is killing the range evaluation.
rng;
This symbol is used only in conjunction with the &gt; and &lt; constructs.

Comments can be written two ways:
<!-- Comment Here -->
or
(* Comment Here *)
 

Milton_Shupe

Resource contributor
Messages
331
Country
us-newmexico
Thanks Bill; that's exactly what I needed to know. I appreciate your insight. :)

EDIT: Followup: That corrected my issue Bill. Thank you :)
 
Last edited:
Top