<?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: ilogic to count features in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579782#M135009</link>
    <description>&lt;P&gt;Yes you can subtract a value from the hole count to give you the count you need (if this is workable for you) otherwise you can do some checks against the hole name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, if you named the holes that need counting "CountMe Hole 1" / "CountMe Hole 2" etc. you could do :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;NoOfHoles = 0

For Each HFeature As HoleFeature In ThisDoc.Document.ComponentDefinition.Features.HoleFeatures		

	If HFeature.Suppressed = False Then
		If Left(HFeature.Name,7) = "CountMe" Then
			NoOfHoles = NoOfHoles + 1
		End If
	End If
	
Next HFeature

iProperties.Value("Custom", "HoleCount") = NoOfHoles&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which will only add the hole to the count if the first 7 chars are "CountMe"&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Aug 2012 15:36:49 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-08-15T15:36:49Z</dc:date>
    <item>
      <title>ilogic to count features</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3578618#M135002</link>
      <description>&lt;P&gt;I have 8 holes each a single feature is there a way for ilogic to count the active ones even if they change to&amp;nbsp;inactive without a ten mile long code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hole 1&amp;nbsp; true&lt;/P&gt;&lt;P&gt;Hole 2 true&lt;/P&gt;&lt;P&gt;Hole 3 true&lt;/P&gt;&lt;P&gt;Hole 4 False&lt;/P&gt;&lt;P&gt;Hole 5 False&lt;/P&gt;&lt;P&gt;Hole 6 False&lt;/P&gt;&lt;P&gt;Hole 7 true&lt;/P&gt;&lt;P&gt;Hole 8 true&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Count should be 5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I change to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hole 1&amp;nbsp; true&lt;/P&gt;&lt;P&gt;Hole 2 true&lt;/P&gt;&lt;P&gt;Hole 3 true&lt;/P&gt;&lt;P&gt;Hole 4 False&lt;/P&gt;&lt;P&gt;Hole 5 true&lt;/P&gt;&lt;P&gt;Hole 6 False&lt;/P&gt;&lt;P&gt;Hole 7 true&lt;/P&gt;&lt;P&gt;Hole 8 true&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Count should be 6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hole 1&amp;nbsp; False&lt;/P&gt;&lt;P&gt;Hole 2 False&lt;/P&gt;&lt;P&gt;Hole 3 False&lt;/P&gt;&lt;P&gt;Hole 4 False&lt;/P&gt;&lt;P&gt;Hole 5 true&lt;/P&gt;&lt;P&gt;Hole 6 False&lt;/P&gt;&lt;P&gt;Hole 7 true&lt;/P&gt;&lt;P&gt;Hole 8 true&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Count should be 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can this be done with short code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Aug 2012 20:10:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3578618#M135002</guid>
      <dc:creator>jletcher</dc:creator>
      <dc:date>2012-08-14T20:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic to count features</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579034#M135003</link>
      <description>&lt;P&gt;You can use a For Each Loop to iterate through all the hole features. Something like this should do it :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;NoOfHoles = 0

For Each HFeature As HoleFeature In ThisDoc.Document.ComponentDefinition.Features.HoleFeatures		

	If HFeature.Suppressed = False Then NoOfHoles = NoOfHoles + 1
	
Next HFeature

MsgBox(NoOfHoles)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 08:07:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579034#M135003</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-15T08:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic to count features</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579164#M135004</link>
      <description>&lt;P&gt;This gives me an error "end of statement expected"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For Each HFeature As HoleFeature In ThisDoc.Document.ComponentDefinition.Features.HoleFeatures&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 11:13:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579164#M135004</guid>
      <dc:creator>jletcher</dc:creator>
      <dc:date>2012-08-15T11:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic to count features</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579168#M135005</link>
      <description>&lt;P&gt;Also this will count all holes right? I only need 8 of the holes to be count if they are active or not if it counts all holes it will give me the wrong count.. Unless I minus the others correct?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 11:15:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579168#M135005</guid>
      <dc:creator>jletcher</dc:creator>
      <dc:date>2012-08-15T11:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic to count features</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579174#M135006</link>
      <description>&lt;P&gt;One more thinfg I want this to go to a ipro in my custom so do I just take out the MsgBox (NoOfHoles)&lt;/P&gt;&lt;P&gt;and put in the code to fill in my custom iproperty?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 11:32:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579174#M135006</guid>
      <dc:creator>jletcher</dc:creator>
      <dc:date>2012-08-15T11:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic to count features</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579448#M135007</link>
      <description>&lt;P&gt;Autodesk if your not going to step in and help then make samples and help files for ilogic PLEASE.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 13:43:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579448#M135007</guid>
      <dc:creator>jletcher</dc:creator>
      <dc:date>2012-08-15T13:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic to count features</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579766#M135008</link>
      <description>&lt;P&gt;Yes, that code will count all active hole features.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, change Msgbox(NoOfHoles) to iProperties.Value("Custom", "HoleCount") = NoOfHoles.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure why your're getting an error, did the code paste correctly into your rule?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ps. There is lots of help and sample code in the 'Programming Help' in Inventor. This is the API help area, which is where you should be looking for this sort of thing.&lt;/P&gt;&lt;P&gt;Note that the examples are given in VBA but it's easy to convert them for use in iLogic.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 15:28:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579766#M135008</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-15T15:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic to count features</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579782#M135009</link>
      <description>&lt;P&gt;Yes you can subtract a value from the hole count to give you the count you need (if this is workable for you) otherwise you can do some checks against the hole name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, if you named the holes that need counting "CountMe Hole 1" / "CountMe Hole 2" etc. you could do :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;NoOfHoles = 0

For Each HFeature As HoleFeature In ThisDoc.Document.ComponentDefinition.Features.HoleFeatures		

	If HFeature.Suppressed = False Then
		If Left(HFeature.Name,7) = "CountMe" Then
			NoOfHoles = NoOfHoles + 1
		End If
	End If
	
Next HFeature

iProperties.Value("Custom", "HoleCount") = NoOfHoles&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which will only add the hole to the count if the first 7 chars are "CountMe"&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 15:36:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579782#M135009</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-15T15:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic to count features</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579786#M135010</link>
      <description>&lt;P&gt;I attest to that code working in 2011, 2012, and 2013 iLogic &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 15:37:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579786#M135010</guid>
      <dc:creator>jdkriek</dc:creator>
      <dc:date>2012-08-15T15:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic to count features</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579790#M135011</link>
      <description>&lt;P&gt;Well hard to say if it pasted right seeing I don't know what it looks like it copied just like you posted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And API is where I try to get help but I am not having much luck converting it to ilogic.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 15:38:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579790#M135011</guid>
      <dc:creator>jletcher</dc:creator>
      <dc:date>2012-08-15T15:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic to count features</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579796#M135012</link>
      <description>&lt;P&gt;now I did rename the hole feature could this be the reason it's not working.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 15:39:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579796#M135012</guid>
      <dc:creator>jletcher</dc:creator>
      <dc:date>2012-08-15T15:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic to count features</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579818#M135013</link>
      <description>&lt;P&gt;Here is a screen shot to show error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG align="center" border="0" title="Error.JPG" src="https://forums.autodesk.com/t5/image/serverpage/image-id/35414i8D80FB1E5CEDABA3/image-size/original?v=mpbl-1&amp;amp;px=-1" alt="Error.JPG" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 15:46:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579818#M135013</guid>
      <dc:creator>jletcher</dc:creator>
      <dc:date>2012-08-15T15:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic to count features</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579824#M135014</link>
      <description>&lt;P&gt;Holes I would like to have count if active and remove from count if inactive&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG align="center" border="0" title="holes.JPG" src="https://forums.autodesk.com/t5/image/serverpage/image-id/35416i40D0E4B847229FE5/image-size/original?v=mpbl-1&amp;amp;px=-1" alt="holes.JPG" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 15:47:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579824#M135014</guid>
      <dc:creator>jletcher</dc:creator>
      <dc:date>2012-08-15T15:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic to count features</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579830#M135015</link>
      <description>&lt;P&gt;Hmmm..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which line is Line 64 in your rule?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 15:48:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579830#M135015</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-15T15:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic to count features</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579852#M135016</link>
      <description>&lt;P&gt;its the for each statement that you supplied..&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 15:56:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579852#M135016</guid>
      <dc:creator>jletcher</dc:creator>
      <dc:date>2012-08-15T15:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic to count features</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579858#M135017</link>
      <description>&lt;P&gt;Could you post your entire rule ? I can't see why it wouldn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or even better you could post your model...&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 16:00:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579858#M135017</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-15T16:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic to count features</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579894#M135018</link>
      <description>&lt;P&gt;Here is the model&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 16:26:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3579894#M135018</guid>
      <dc:creator>jletcher</dc:creator>
      <dc:date>2012-08-15T16:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic to count features</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3580024#M135019</link>
      <description>&lt;P&gt;Im not sure why it didnt work first time, I re copied the code back in and now its working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also added a line that checks if the last char of the hole name is a number - if it is a number then it doesnt get added to the count.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this works OK for you.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 17:07:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3580024#M135019</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-15T17:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic to count features</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3580032#M135020</link>
      <description>&lt;P&gt;Thats it great thanks...&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 17:11:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3580032#M135020</guid>
      <dc:creator>jletcher</dc:creator>
      <dc:date>2012-08-15T17:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: ilogic to count features</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3583524#M135021</link>
      <description>&lt;P&gt;Just guessing but you where probably just missing the "End If" statement right above the Line that says "Next HFeature".&amp;nbsp; If you where wondering why it wasn't working the first time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS - Thanks for the link to this on my post.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2012 12:30:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-to-count-features/m-p/3583524#M135021</guid>
      <dc:creator>kmiller</dc:creator>
      <dc:date>2012-08-16T12:30:14Z</dc:date>
    </item>
  </channel>
</rss>

