<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Setting default values for user command parameters in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/setting-default-values-for-user-command-parameters/m-p/13580641#M78745</link>
    <description>&lt;DIV class="fr-view clearfix"&gt;
 Perfect, thank you Mischa!
&lt;/DIV&gt;</description>
    <pubDate>Wed, 04 Oct 2023 14:17:34 GMT</pubDate>
    <dc:creator>lucas_z</dc:creator>
    <dc:date>2023-10-04T14:17:34Z</dc:date>
    <item>
      <title>Setting default values for user command parameters</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/setting-default-values-for-user-command-parameters/m-p/13580639#M78743</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 23.2.1 ]&lt;/I&gt;&lt;/P&gt;&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;Hello,&lt;/P&gt;
 &lt;P&gt;Is there a way to set default values for the parameters passed into a user command?&lt;/P&gt;
 &lt;P&gt;The C++ syntaxis doesn't seem to work. I would expect to be able to define it similarly. Am I just missing something trivial?&lt;/P&gt;
 &lt;P&gt;Thanks in advance!!&lt;/P&gt;
 &lt;P&gt;For example: I would like to define a function as below. But if I call this with one parameter only, I get the error that I am not passing enough parameters.&lt;/P&gt;
 &lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1696428428833.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1520350i0271C8BC86C9A254/image-size/large?v=v2&amp;amp;px=999" role="button" title="1696428428833.png" alt="1696428428833.png" /&gt;&lt;/span&gt;&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 04 Oct 2023 14:08:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/setting-default-values-for-user-command-parameters/m-p/13580639#M78743</guid>
      <dc:creator>lucas_z</dc:creator>
      <dc:date>2023-10-04T14:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: Setting default values for user command parameters</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/setting-default-values-for-user-command-parameters/m-p/13580640#M78744</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;Hi Lucas,&lt;/P&gt;&lt;P&gt;In the parameters field, you can indicate that the parameter is optional as follows:&lt;/P&gt;&lt;PRE&gt;(double inputOne[, int inputTwo])&lt;/PRE&gt;&lt;P&gt;Then in the code, you can check the number of parameters using the &lt;A href="https://docs.flexsim.com/en/23.0/Reference/CodingInFlexSim/CommandReference/CommandGroups.html#parqty"&gt;&lt;EM&gt;parqty&lt;/EM&gt; &lt;/A&gt;function and set the default if necessary:&lt;/P&gt;&lt;PRE&gt;int inputTwo = (parqty() &amp;gt;= 2) ? param(2) : 42;&lt;/PRE&gt;&lt;P&gt;where I have used 42 as the default value to distinguish it from the parameter index (2) in this example.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 04 Oct 2023 14:14:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/setting-default-values-for-user-command-parameters/m-p/13580640#M78744</guid>
      <dc:creator>mischa_spelt</dc:creator>
      <dc:date>2023-10-04T14:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: Setting default values for user command parameters</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/setting-default-values-for-user-command-parameters/m-p/13580641#M78745</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 Perfect, thank you Mischa!
&lt;/DIV&gt;</description>
      <pubDate>Wed, 04 Oct 2023 14:17:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/setting-default-values-for-user-command-parameters/m-p/13580641#M78745</guid>
      <dc:creator>lucas_z</dc:creator>
      <dc:date>2023-10-04T14:17:34Z</dc:date>
    </item>
  </channel>
</rss>

