<?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: create variable and assign sequential values ​​using ilogic inventor in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-variable-and-assign-sequential-values-using-ilogic/m-p/13134268#M4553</link>
    <description>Exactly what I was thinking. thank you very much!</description>
    <pubDate>Wed, 06 Nov 2024 17:10:05 GMT</pubDate>
    <dc:creator>luis_sanderKNSGP</dc:creator>
    <dc:date>2024-11-06T17:10:05Z</dc:date>
    <item>
      <title>create variable and assign sequential values ​​using ilogic inventor</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-variable-and-assign-sequential-values-using-ilogic/m-p/13133824#M4549</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to do this operation below using ilogic inventor, but it doesn't work. Basically create the variables F1, F2, F3 and F4 and then assign the values ​​1, 2, 3 and 4 or 0. Any help is welcome.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;i&lt;/SPAN&gt; = 0
&lt;SPAN&gt;While&lt;/SPAN&gt; &lt;SPAN&gt;i&lt;/SPAN&gt;&amp;lt;4
	&lt;SPAN&gt;i&lt;/SPAN&gt; = &lt;SPAN&gt;i&lt;/SPAN&gt; + 1
	oxyfuel= &lt;SPAN&gt;"oxyfuel_F"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;i&lt;/SPAN&gt;
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;Feature&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(oxyfuel) &lt;SPAN&gt;Then&lt;/SPAN&gt;
		&lt;SPAN&gt;"F"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;i&lt;/SPAN&gt; = &lt;SPAN&gt;i&lt;/SPAN&gt;
	&lt;SPAN&gt;Else&lt;/SPAN&gt;
		&lt;SPAN&gt;"F"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;i&lt;/SPAN&gt; = 0
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;While&lt;/SPAN&gt;

&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"CF"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;F1&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;F2&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;F3&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;F4&lt;/SPAN&gt;, &lt;SPAN&gt;"Part name"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2024 14:39:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-variable-and-assign-sequential-values-using-ilogic/m-p/13133824#M4549</guid>
      <dc:creator>luis_sanderKNSGP</dc:creator>
      <dc:date>2024-11-06T14:39:22Z</dc:date>
    </item>
    <item>
      <title>Re: create variable and assign sequential values ​​using ilogic inventor</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-variable-and-assign-sequential-values-using-ilogic/m-p/13133864#M4550</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/16404514"&gt;@luis_sanderKNSGP&lt;/a&gt;.&amp;nbsp; I am not sure what all you were trying to achieve there, but below is my interpretation of what you wanted to achieve.&amp;nbsp; You can not 'declare' or 'define' a variable by concatenating its name together like a String.&amp;nbsp; The result of that is just a String, not a variable for representing a value.&amp;nbsp; So, I 'declared' those F# variables before the loop, then set their values within the loop, so that the message outside the loop will recognize them.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim i As Integer = 0
Dim F1, F2, F3, F4 As Integer
While i &amp;lt;= 4
	i += 1
	Dim oxyfuel As String = "oxyfuel_F" &amp;amp; i
	If Feature.IsActive(oxyfuel) Then
		If i = 1 Then
			F1 = i
		ElseIf i = 2 Then
			F2 = i
		ElseIf 1 = 3 Then
			F3 = i
		ElseIf i = 4 Then
			F4 = i
		End If
	Else
		If i = 1 Then
			F1 = 0
		ElseIf i = 2 Then
			F2 = 0
		ElseIf 1 = 3 Then
			F3 = 0
		ElseIf i = 4 Then
			F4 = 0
		End If
	End If
End While

MessageBox.Show("CF" &amp;amp; F1 &amp;amp; F2 &amp;amp; F3 &amp;amp; F4, "Part name")&lt;/LI-CODE&gt;
&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN&gt;&lt;STRONG&gt; ACCEPT SOLUTION &lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2024 14:58:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-variable-and-assign-sequential-values-using-ilogic/m-p/13133864#M4550</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-11-06T14:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: create variable and assign sequential values ​​using ilogic inventor</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-variable-and-assign-sequential-values-using-ilogic/m-p/13134087#M4551</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054" target="_self"&gt;&lt;SPAN class=""&gt;WCrihfield&lt;/SPAN&gt;&lt;/A&gt;, thank you so much.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code performs what I need. However, the idea was to "create" the F1, F2... Fn.&amp;nbsp;For example, if it were necessary to use "n" numbers of "F." Depending on the condition, this "F" should store the value of i or 0.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2024 16:05:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-variable-and-assign-sequential-values-using-ilogic/m-p/13134087#M4551</guid>
      <dc:creator>luis_sanderKNSGP</dc:creator>
      <dc:date>2024-11-06T16:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: create variable and assign sequential values ​​using ilogic inventor</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-variable-and-assign-sequential-values-using-ilogic/m-p/13134240#M4552</link>
      <description>&lt;P&gt;OK.&amp;nbsp; Well, since we can't do that with actual variables, we could likely achieve similar functionality with some sort of collection type object, such as an Array of Integer, or List(Of Integer), or similar.&amp;nbsp; Both of those vb.net based collection types start at zero though, not one, like most types of collections based in vb.net.&amp;nbsp; On the flip side, most collection types that are defined within the Inventor API or iLogic API start at one, instead of zero, to make them more 'natural' feeling to work with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is another example you can play around with.&amp;nbsp; It is using a simple Array of Integers, with zero as the starting value.&amp;nbsp; That way, we do not even need the 'Else' side of the If statement.&amp;nbsp; Then, within the loop, and within the If statement, it specified the element within the Array by the current value of 'i' minus one, since the array starts at zero, and changes the value of that element to the current value of 'i'.&amp;nbsp; After the iteration, we can either just use that Array variable directly within your message, or we can extract the individual Array values to static variables first, then use those variables within the message.&amp;nbsp; Just another thought to reduce required code while maintaining similar functionality.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim i As Integer = 0
Dim oResults() As Integer = {0,0,0,0}
While i &amp;lt;= 4
	i += 1
	Dim oxyfuel As String = "oxyfuel_F" &amp;amp; i
	If Feature.IsActive(oxyfuel) Then
		'i-1, because Array's start at zero, not one
		oResults(i - 1) = i
	End If
End While
MessageBox.Show("CF" &amp;amp; oResults(0) &amp;amp; oResults(1) &amp;amp; oResults(2) &amp;amp; oResults(3), "Part name")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2024 16:54:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-variable-and-assign-sequential-values-using-ilogic/m-p/13134240#M4552</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-11-06T16:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: create variable and assign sequential values ​​using ilogic inventor</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-variable-and-assign-sequential-values-using-ilogic/m-p/13134268#M4553</link>
      <description>Exactly what I was thinking. thank you very much!</description>
      <pubDate>Wed, 06 Nov 2024 17:10:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-variable-and-assign-sequential-values-using-ilogic/m-p/13134268#M4553</guid>
      <dc:creator>luis_sanderKNSGP</dc:creator>
      <dc:date>2024-11-06T17:10:05Z</dc:date>
    </item>
  </channel>
</rss>

