<?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: Controlling Number of Features in a Circular Pattern - iLogic in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/controlling-number-of-features-in-a-circular-pattern-ilogic/m-p/5581187#M55239</link>
    <description>&lt;P&gt;I understand you just want to modify the existing pattern but I do not think it's that easy.&lt;/P&gt;&lt;P&gt;I think you will need to redefine the pattern with all of the original inputs plus add to the number of features in the pattern with the count parameter in the add method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is a link to a macro for creating a circular pattern from VBA. Maybe it will help push you in the right direction. It uses the .Add method and changes the count parameter.&lt;/P&gt;&lt;P&gt;&lt;A target="_self" href="https://forums.autodesk.com/t5/inventor-customization/help-with-creating-circularpattern-vba/td-p/3638708"&gt;http://forums.autodesk.com/t5/inventor-customization/help-with-creating-circularpattern-vba/td-p/3638708&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Apr 2015 19:39:00 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-04-10T19:39:00Z</dc:date>
    <item>
      <title>Controlling Number of Features in a Circular Pattern - iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/controlling-number-of-features-in-a-circular-pattern-ilogic/m-p/5579643#M55224</link>
      <description>&lt;P&gt;How do you control the number of features in a circular pattern(of a single part) with iLogic? &amp;nbsp;I can count them but don't know how to change them. &amp;nbsp;I can change the parameter directly but is there something like oCircularPatternFeature.NumberOfElements?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SyntaxEditor Code Snippet&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oCompDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartComponentDefinition&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oCircularPatternFeature&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;CircularPatternFeature&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oCircularPatternFeatures&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;CircularPatternFeatures&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;dNumberOfBolts&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Parameter&lt;/SPAN&gt;


&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;Set the document&lt;/SPAN&gt;
&lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Document&lt;/SPAN&gt;

&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;Set the component definition&lt;/SPAN&gt;
&lt;SPAN&gt;oCompDef&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;

&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;Set the circular pattern features collection&lt;/SPAN&gt;
&lt;SPAN&gt;oCircularPatternFeatures&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;oCompDef&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Features&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;CircularPatternFeatures&lt;/SPAN&gt;

&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;Show the number of bolts&lt;/SPAN&gt;
&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oCircularPatternFeature&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oCircularPatternFeatures&lt;/SPAN&gt;

    &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oCircularPatternFeature&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Name&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;BoltPattern&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
    
        &lt;SPAN&gt;dNumberOfBolts&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;oCircularPatternFeature&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Count&lt;/SPAN&gt;
    
        &lt;SPAN&gt;MessageBox&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Show&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;There are now &lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt; &lt;SPAN&gt;&amp;amp;&lt;/SPAN&gt; &lt;SPAN&gt;dNumberOfBolts&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Value&lt;/SPAN&gt; &lt;SPAN&gt;&amp;amp;&lt;/SPAN&gt; &lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt; bolts.&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;Test&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;
        
    
    &lt;SPAN&gt;Else&lt;/SPAN&gt;
    &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

&lt;SPAN&gt;Next&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Apr 2015 12:19:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/controlling-number-of-features-in-a-circular-pattern-ilogic/m-p/5579643#M55224</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-10T12:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Number of Features in a Circular Pattern - iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/controlling-number-of-features-in-a-circular-pattern-ilogic/m-p/5581032#M55234</link>
      <description>&lt;P&gt;In the documentation is looks like you can redefine your pattern with the "CircularPatternFeatures.Add" Method. Use the Count variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CircularPatternFeatures.&lt;STRONG&gt;Add&lt;/STRONG&gt;( &lt;STRONG&gt;&lt;EM&gt;ParentFeatures&lt;/EM&gt;&lt;/STRONG&gt; As &lt;A target="_blank" href="https://forums.autodesk.com/HTML/ObjectCollection.htm"&gt;ObjectCollection&lt;/A&gt;, &lt;STRONG&gt;&lt;EM&gt;AxisEntity&lt;/EM&gt;&lt;/STRONG&gt; As Object, &lt;STRONG&gt;&lt;EM&gt;NaturalAxisDirection&lt;/EM&gt;&lt;/STRONG&gt; As Boolean, &lt;STRONG&gt;&lt;EM&gt;Count&lt;/EM&gt;&lt;/STRONG&gt; As Variant, &lt;STRONG&gt;&lt;EM&gt;Angle&lt;/EM&gt;&lt;/STRONG&gt; As Variant, &lt;STRONG&gt;&lt;EM&gt;FitWithinAngle&lt;/EM&gt;&lt;/STRONG&gt; As Boolean, [&lt;STRONG&gt;&lt;EM&gt;ComputeType&lt;/EM&gt;&lt;/STRONG&gt;] As &lt;A target="_blank" href="https://forums.autodesk.com/HTML/PatternComputeTypeEnum.htm"&gt;PatternComputeTypeEnum&lt;/A&gt; ) As &lt;A target="_blank" href="https://forums.autodesk.com/HTML/CircularPatternFeature.htm"&gt;CircularPatternFeature&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2015 17:58:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/controlling-number-of-features-in-a-circular-pattern-ilogic/m-p/5581032#M55234</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-10T17:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Number of Features in a Circular Pattern - iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/controlling-number-of-features-in-a-circular-pattern-ilogic/m-p/5581038#M55235</link>
      <description>&lt;P&gt;Thanks for the reply. &amp;nbsp;I did previously try that and got an error message that Count is read-only.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, I am not trying to add a new pattern, just modify an existing.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2015 18:02:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/controlling-number-of-features-in-a-circular-pattern-ilogic/m-p/5581038#M55235</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-10T18:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Number of Features in a Circular Pattern - iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/controlling-number-of-features-in-a-circular-pattern-ilogic/m-p/5581187#M55239</link>
      <description>&lt;P&gt;I understand you just want to modify the existing pattern but I do not think it's that easy.&lt;/P&gt;&lt;P&gt;I think you will need to redefine the pattern with all of the original inputs plus add to the number of features in the pattern with the count parameter in the add method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is a link to a macro for creating a circular pattern from VBA. Maybe it will help push you in the right direction. It uses the .Add method and changes the count parameter.&lt;/P&gt;&lt;P&gt;&lt;A target="_self" href="https://forums.autodesk.com/t5/inventor-customization/help-with-creating-circularpattern-vba/td-p/3638708"&gt;http://forums.autodesk.com/t5/inventor-customization/help-with-creating-circularpattern-vba/td-p/3638708&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2015 19:39:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/controlling-number-of-features-in-a-circular-pattern-ilogic/m-p/5581187#M55239</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-04-10T19:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Number of Features in a Circular Pattern - iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/controlling-number-of-features-in-a-circular-pattern-ilogic/m-p/5602807#M55470</link>
      <description>&lt;P&gt;Here is the sample to proof the concept.&lt;/P&gt;
&lt;P&gt;It adds the second extrude feature (disk) to the existing circular pattern feature.&lt;/P&gt;
&lt;P&gt;Open the attached part file and run the iLogic rule.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;'this rule adds one more feature 
'to the existing circular pattern Feature

Dim oDoc As PartDocument = ThisDoc.Document
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition

'Feature to be added to the existing pattern
'Should be above the pattern node in the browser!
Dim oPartFeature As PartFeature = oDoc.ComponentDefinition _
		.Features.ExtrudeFeatures.Item("Disk")

'reference to the circular pattern feature
Dim oCPF As CircularPatternFeature = oDef.Features.CircularPatternFeatures.Item(1)

'get the feature collection
Dim objCol As ObjectCollection = oCPF.ParentFeatures
'modify the object collection - add one more extrude feature
Call objCol.Add(oPartFeature)

'apply changes to the pattern
oCPF.ParentFeatures = objCol

oDoc.Update
Beep&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Initial state:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/165123i331611486DB80096/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Before.PNG" title="Before.PNG" width="400" height="253" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/165124i6DBAC32D57DD186F/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="After.PNG" title="After.PNG" width="400" height="273" /&gt;&lt;/P&gt;
&lt;P&gt;cheers,&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2015 12:11:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/controlling-number-of-features-in-a-circular-pattern-ilogic/m-p/5602807#M55470</guid>
      <dc:creator>Vladimir.Ananyev</dc:creator>
      <dc:date>2015-04-22T12:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Number of Features in a Circular Pattern - iLogic</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/controlling-number-of-features-in-a-circular-pattern-ilogic/m-p/9070526#M101934</link>
      <description>&lt;P&gt;Thanks this helped me a lot also works for&amp;nbsp;RectangularPatternFeature to swap around ParentFeature&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Public Sub ChangeElem(oPartDef As PartComponentDefinition, oDoc As Document)

    Dim oPartFeature As PartFeature
    Set oPartFeature = oPartDef.features.HoleFeatures.Item("TRP3_HOLE")

    Dim oRPF As RectangularPatternFeature
    Set oRPF = oPartDef.features.RectangularPatternFeatures.Item("TopPattern")
    
    Dim objCol As ObjectCollection
    Set objCol = oRPF.Definition.ParentFeatures


'I added the clear so I can swap the old ParentFeature with a new one
    Call objCol.Clear
    Call objCol.Add(oPartFeature)
    
    oRPF.Definition.ParentFeatures = objCol
    oRPF.Definition.NaturalXDirection = False
    oDoc.Update

End Sub&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Oct 2019 09:58:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/controlling-number-of-features-in-a-circular-pattern-ilogic/m-p/9070526#M101934</guid>
      <dc:creator>Dean.kichenbrand</dc:creator>
      <dc:date>2019-10-07T09:58:09Z</dc:date>
    </item>
  </channel>
</rss>

