<?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: Input the number of circular patterns as a parameter in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/input-the-number-of-circular-patterns-as-a-parameter/m-p/12388388#M160499</link>
    <description>&lt;P&gt;The part where pAts is defined is omitted..&lt;BR /&gt;pAts = Parameter("HOLA_C"),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ysbaodnj_0-1700479094154.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1294973i57673F5FB103E52E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ysbaodnj_0-1700479094154.png" alt="ysbaodnj_0-1700479094154.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;aOcc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Inventor&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;CommandManager&lt;/SPAN&gt;.&lt;SPAN&gt;Pick&lt;/SPAN&gt;(&lt;SPAN&gt;kAssemblyOccurrenceFilter&lt;/SPAN&gt;, &lt;SPAN&gt;"Pick contente part to be patterned"&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oCompName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;aOcc&lt;/SPAN&gt;.&lt;SPAN&gt;Name&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Waiting for your reply...&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Nov 2023 11:19:28 GMT</pubDate>
    <dc:creator>ysbaodnj</dc:creator>
    <dc:date>2023-11-20T11:19:28Z</dc:date>
    <item>
      <title>Input the number of circular patterns as a parameter</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/input-the-number-of-circular-patterns-as-a-parameter/m-p/12334625#M159549</link>
      <description>&lt;P&gt;hello&lt;BR /&gt;I completed the code to create a pattern using iLogic code.&lt;BR /&gt;I would like to input the number of patterns as a parameter so that the number of patterns changes depending on the parameter value.&lt;BR /&gt;However, since it is entered as a value rather than a parameter, the model does not change even if the parameter changes.&lt;BR /&gt;In the code, only integer values can be entered.&lt;BR /&gt;What should I do?&lt;BR /&gt;Please refer to the code below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;If&lt;/SPAN&gt; (&lt;SPAN&gt;oCompName&lt;/SPAN&gt; = &lt;SPAN&gt;"HOLDER-A:"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;i&lt;/SPAN&gt;) &lt;SPAN&gt;Or&lt;/SPAN&gt; (&lt;SPAN&gt;oCompName&lt;/SPAN&gt; = &lt;SPAN&gt;"HOLDER-B:"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;i&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt; 
&lt;SPAN&gt;  Dim&lt;/SPAN&gt; &lt;SPAN&gt;patName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;oCompName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;":PATTERN"&lt;/SPAN&gt;
&lt;SPAN&gt;  Dim&lt;/SPAN&gt; &lt;SPAN&gt;patAngl&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Integer&lt;/SPAN&gt; = 360 / &lt;SPAN&gt;pAts&lt;/SPAN&gt;
&lt;SPAN&gt;  Dim&lt;/SPAN&gt; &lt;SPAN&gt;circPattern&lt;/SPAN&gt; = &lt;SPAN&gt;Patterns&lt;/SPAN&gt;.&lt;SPAN&gt;AddCircular&lt;/SPAN&gt;(&lt;SPAN&gt;patName&lt;/SPAN&gt;, &lt;SPAN&gt;oCompName&lt;/SPAN&gt;, &lt;SPAN&gt;Parameter&lt;/SPAN&gt;(&lt;SPAN&gt;"HOLA_C"&lt;/SPAN&gt;), &lt;SPAN&gt;patAngl&lt;/SPAN&gt;, &lt;SPAN&gt;oCompName&lt;/SPAN&gt;, &lt;SPAN&gt;"Z축"&lt;/SPAN&gt;, &lt;SPAN&gt;axisNaturalDirection&lt;/SPAN&gt; := &lt;SPAN&gt;True&lt;/SPAN&gt;, &lt;SPAN&gt;lockRotation&lt;/SPAN&gt; := &lt;SPAN&gt;False&lt;/SPAN&gt;)&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Oct 2023 04:04:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/input-the-number-of-circular-patterns-as-a-parameter/m-p/12334625#M159549</guid>
      <dc:creator>ysbaodnj</dc:creator>
      <dc:date>2023-10-27T04:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: Input the number of circular patterns as a parameter</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/input-the-number-of-circular-patterns-as-a-parameter/m-p/12335045#M159554</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assuming that the code block iterates through all components and the oCompName is correctly reading the occurence.Name the following should be checked:&lt;/P&gt;&lt;P&gt;First, make sure that your parameter type for the number of patterns is unitless:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="alexanderboogaard_0-1698397675365.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1284668iDB0756788A979CE7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="alexanderboogaard_0-1698397675365.png" alt="alexanderboogaard_0-1698397675365.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;If (oCompName = "HOLDER-A:" &amp;amp; i) Or (oCompName = "HOLDER-B:" &amp;amp; i) Then 
  Dim patName As String = oCompName &amp;amp; ":PATTERN"
  Dim patAngl As Integer = 360 / pAts
  Dim circPattern = Patterns.AddCircular(patName, oCompName, pAts, patAngl, oCompName , "Z축", axisNaturalDirection := True, lockRotation := False)
End If&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is changed is the reference to 'pAts' in the function for the pattern.&lt;BR /&gt;&lt;BR /&gt;Please let me know if it worked. If not, please share the code where oCompName is declared to get a better understanding.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 09:20:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/input-the-number-of-circular-patterns-as-a-parameter/m-p/12335045#M159554</guid>
      <dc:creator>alexanderboogaard</dc:creator>
      <dc:date>2023-10-27T09:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: Input the number of circular patterns as a parameter</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/input-the-number-of-circular-patterns-as-a-parameter/m-p/12335129#M159556</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need an Integer number to use as the pattern repetition number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, If your pattern value comes from an function, sometimes you will not get an integer number:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CCarreiras_1-1698400722207.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1284681i20F61E91E7244C82/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CCarreiras_1-1698400722207.png" alt="CCarreiras_1-1698400722207.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway, you can use some operators (similar to excel)to achieve the Integer number:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CCarreiras_2-1698400948423.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1284684i80A2F97D792175A7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CCarreiras_2-1698400948423.png" alt="CCarreiras_2-1698400948423.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;In this case i selected the lower Integer value, but you can set other options:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CCarreiras_0-1698400393309.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1284679i7E09EEB7374B0078/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CCarreiras_0-1698400393309.png" alt="CCarreiras_0-1698400393309.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Tip: the units must be UL (unitless).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 10:04:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/input-the-number-of-circular-patterns-as-a-parameter/m-p/12335129#M159556</guid>
      <dc:creator>CCarreiras</dc:creator>
      <dc:date>2023-10-27T10:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: Input the number of circular patterns as a parameter</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/input-the-number-of-circular-patterns-as-a-parameter/m-p/12388388#M160499</link>
      <description>&lt;P&gt;The part where pAts is defined is omitted..&lt;BR /&gt;pAts = Parameter("HOLA_C"),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ysbaodnj_0-1700479094154.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1294973i57673F5FB103E52E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ysbaodnj_0-1700479094154.png" alt="ysbaodnj_0-1700479094154.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;aOcc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Inventor&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;CommandManager&lt;/SPAN&gt;.&lt;SPAN&gt;Pick&lt;/SPAN&gt;(&lt;SPAN&gt;kAssemblyOccurrenceFilter&lt;/SPAN&gt;, &lt;SPAN&gt;"Pick contente part to be patterned"&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oCompName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;aOcc&lt;/SPAN&gt;.&lt;SPAN&gt;Name&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Waiting for your reply...&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2023 11:19:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/input-the-number-of-circular-patterns-as-a-parameter/m-p/12388388#M160499</guid>
      <dc:creator>ysbaodnj</dc:creator>
      <dc:date>2023-11-20T11:19:28Z</dc:date>
    </item>
  </channel>
</rss>

