<?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: How can I make my rule refer to the part number of a component rather than the component name? in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225253#M157349</link>
    <description>&lt;P&gt;That error suggest it encountered the error when it tried to access the Definition of an assembly component.&amp;nbsp; If the component was suppressed at the time, that would cause it to throw an error when you tried to access its definition.&amp;nbsp; You can not do much with a component that is currently suppressed, so you may need to include some filtering code to help avoid that.&lt;/P&gt;</description>
    <pubDate>Thu, 07 Sep 2023 16:29:46 GMT</pubDate>
    <dc:creator>WCrihfield</dc:creator>
    <dc:date>2023-09-07T16:29:46Z</dc:date>
    <item>
      <title>How can I make my rule refer to the part number of a component rather than the component name?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12220363#M157261</link>
      <description>&lt;P&gt;I have a rule that is a super simple if statement that when one of the components is active, then it suppresses the other. But, when I go to use this assembly in a different project, the project updates all the components name to have the prefix of that project, but the part number always stays the same. This means the ilogic does not work unless I change the component names in the rule manually by adding the prefix. How do I get it to refer to the same component by just the part number since that stays the same in every project this assembly is used. Or possibly automatically update the component name in the rule to match the component name in the model tree for the assembly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;cover_type&lt;/SPAN&gt; = &lt;SPAN&gt;"regular"&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
	&lt;SPAN&gt;Component&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"Flange RV - Vent_Cover:1"&lt;/SPAN&gt;) = &lt;SPAN&gt;True&lt;/SPAN&gt;
	&lt;SPAN&gt;Component&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"Flange RV - Coned_Cover_Flange_1:1"&lt;/SPAN&gt;) = &lt;SPAN&gt;False&lt;/SPAN&gt;
	&lt;SPAN&gt;Component&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"Flange RV - Coned_Vent_Cover_1:1"&lt;/SPAN&gt;) = &lt;SPAN&gt;False&lt;/SPAN&gt;
	&lt;SPAN&gt;Component&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"Flange RV - Coned_Vent_Cover_1:2"&lt;/SPAN&gt;) = &lt;SPAN&gt;False&lt;/SPAN&gt;
&lt;SPAN&gt;Else&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;cover_type&lt;/SPAN&gt; = &lt;SPAN&gt;"coned"&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
	&lt;SPAN&gt;Component&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"Flange RV - Vent_Cover:1"&lt;/SPAN&gt;) = &lt;SPAN&gt;False&lt;/SPAN&gt;
	&lt;SPAN&gt;Component&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"Flange RV - Coned_Cover_Flange_1:1"&lt;/SPAN&gt;) = &lt;SPAN&gt;True&lt;/SPAN&gt;
	&lt;SPAN&gt;Component&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"Flange RV - Coned_Vent_Cover_1:1"&lt;/SPAN&gt;) = &lt;SPAN&gt;True&lt;/SPAN&gt;
	&lt;SPAN&gt;Component&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"Flange RV - Coned_Vent_Cover_1:2"&lt;/SPAN&gt;) = &lt;SPAN&gt;True&lt;/SPAN&gt;
&lt;SPAN&gt;Else&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;cover_type&lt;/SPAN&gt; = &lt;SPAN&gt;"N/A"&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
	&lt;SPAN&gt;Component&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"Flange RV - Vent_Cover:1"&lt;/SPAN&gt;) = &lt;SPAN&gt;True&lt;/SPAN&gt;
	&lt;SPAN&gt;Component&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"Flange RV - Coned_Cover_Flange_1:1"&lt;/SPAN&gt;) = &lt;SPAN&gt;True&lt;/SPAN&gt;
	&lt;SPAN&gt;Component&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"Flange RV - Coned_Vent_Cover_1:1"&lt;/SPAN&gt;) = &lt;SPAN&gt;True&lt;/SPAN&gt;
	&lt;SPAN&gt;Component&lt;/SPAN&gt;.&lt;SPAN&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN&gt;"Flange RV - Coned_Vent_Cover_1:2"&lt;/SPAN&gt;) = &lt;SPAN&gt;True&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;How do I make these component names update when the prefix is added automatically , for example, if the prefix is "29019 -" and is automatically added to all the part names. The part numbers remain the same as well so I was assuming I would be able to use that.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 22:26:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12220363#M157261</guid>
      <dc:creator>OliverXL5YM</dc:creator>
      <dc:date>2023-09-05T22:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make my rule refer to the part number of a component rather than the component name?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12220459#M157263</link>
      <description>&lt;P&gt;The easiest approach here is to stabilize the occurrence name by renaming to a generic name that will become static. If you say your part number doesn't change then you can add a description and the part number. The main thing is that the occurrence name is unique. Now when you the file name changes the occurrence name won't. You have removed the out of the box occurrence renaming tool. Now in your code refer to the static occurrence name and your code will work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See this article &lt;A href="https://clintbrown.co.uk/2020/07/29/ilogic-normalise-browser-nodes-with-code/" target="_blank" rel="noopener"&gt;here &lt;/A&gt;it has a handy renaming code in case you have a lot to rename.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 23:50:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12220459#M157263</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-09-05T23:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make my rule refer to the part number of a component rather than the component name?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12220969#M157265</link>
      <description>&lt;P&gt;You can create your own collection of occurrences to do something with them. You can also separate the selection process to separate method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Dim asm As AssemblyDocument = ThisDoc.Document

Dim lookedPartNumber As String  = "MyPartNumber"
Dim isActive As Boolean = False

'Get occurrences to process by its document PartNumber
Dim occList As New List(Of ComponentOccurrence)

For Each occ As ComponentOccurrence In asm.ComponentDefinition.Occurrences
	Dim doc As Document =occ.Definition.Document
	Dim partNumber As String = doc.PropertySets("{32853F0F-3444-11D1-9E93-0060B03C1CA6}")("Part Number").Value
	If partNumber = lookedPartNumber Then
		occList.Add(occ)
	End If
Next

'Do something with occurrences in list
For Each occ In occList
	Component.IsActive(occ.Name) = isActive
Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 06:20:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12220969#M157265</guid>
      <dc:creator>Michael.Navara</dc:creator>
      <dc:date>2023-09-06T06:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make my rule refer to the part number of a component rather than the component name?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12223127#M157303</link>
      <description>&lt;P&gt;Would I need to do this for every component in the same rule or do I need to do a seperate rule for every component?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 21:34:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12223127#M157303</guid>
      <dc:creator>OliverXL5YM</dc:creator>
      <dc:date>2023-09-06T21:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make my rule refer to the part number of a component rather than the component name?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12223212#M157304</link>
      <description>This is a good article. How can I make it so that it removes the prefix of the file name for the occurrence name then automatically. When I use this assembly in a project and put it in someone wrote iLogic that automatically saves a copy with the prefix of the job name, but how do I remove that for all the possible job names without having to tell the rule manually what the job name is?</description>
      <pubDate>Wed, 06 Sep 2023 22:25:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12223212#M157304</guid>
      <dc:creator>OliverXL5YM</dc:creator>
      <dc:date>2023-09-06T22:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make my rule refer to the part number of a component rather than the component name?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12223232#M157305</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12833405"&gt;@OliverXL5YM&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The rule and assembly will need to have the occurrence name updated. Any future assemblies when copied will work but any previous assembly will have the incorrect rule and occurrence names.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AAcheson_0-1694040171698.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1263153i3754D05817B3859B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AAcheson_0-1694040171698.png" alt="AAcheson_0-1694040171698.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 22:43:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12223232#M157305</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-09-06T22:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make my rule refer to the part number of a component rather than the component name?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12223266#M157306</link>
      <description>It is okay if previous assemblies are different than future assemblies. I have an already made assembly that suppresses and unsuppresses parts based on what I need. So I generate it into a project that I am working on and then the file name and all the parts in the assembly has their names updated to have a prefix of the job name, I just don't understand iLogic the best so I need a way to automaticaly change the occurrence name to something consistent when the assembly is copied into the new job. Kind of like how in the article he removes the ":1" from all the parts, I just need to remove the prefix.</description>
      <pubDate>Wed, 06 Sep 2023 23:07:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12223266#M157306</guid>
      <dc:creator>OliverXL5YM</dc:creator>
      <dc:date>2023-09-06T23:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make my rule refer to the part number of a component rather than the component name?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12223348#M157307</link>
      <description>&lt;P&gt;Can you remove it manually? Edit the occurrence name in the assembly. It will take you longer to prepare a code to replace the occurrence name but if you really need to you can use the String.Replace method to remove the prefix number and "-" Character. Replace it with a blank string ""&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim TestString As String = Occ.Name
   
Dim aString As String = Replace(TestString, "12345-", "") 
 Occ.Name = aString&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 07 Sep 2023 00:13:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12223348#M157307</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-09-07T00:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make my rule refer to the part number of a component rather than the component name?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12223772#M157311</link>
      <description>&lt;P&gt;Here is complete sample for your original code. It assumes your occurrence names is based on PartNumber.&lt;/P&gt;&lt;P&gt;There are three usage samples, how you can use the method&amp;nbsp;IsActiveByPartNumber. You can choose which one best fits your needs. This method accepts multiple part numbers as the last argument(s).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;Sub Main()

    'For syntax only
    'Dim cover_type As String = ""
    Dim asm As AssemblyDocument = ThisDoc.Document


    If cover_type = "regular" Then
        'Usage sample 1 - Call the method separately for each PartNumber
        IsActiveByPartNumber(asm, True, "Flange RV - Vent_Cover")
        IsActiveByPartNumber(asm, False, "Flange RV - Coned_Cover_Flange_1")
        IsActiveByPartNumber(asm, False, "Flange RV - Coned_Vent_Cover_1")

        'Component.IsActive("Flange RV - Vent_Cover:1") = True
        'Component.IsActive("Flange RV - Coned_Cover_Flange_1:1") = False
        'Component.IsActive("Flange RV - Coned_Vent_Cover_1:1") = False
        'Component.IsActive("Flange RV - Coned_Vent_Cover_1:2") = False

    ElseIf cover_type = "coned" Then
        'Usage sample 1 - Combine multiple PartNumbers to single method call
        IsActiveByPartNumber(asm, False, "Flange RV - Vent_Cover")
        IsActiveByPartNumber(asm, True, "Flange RV - Coned_Cover_Flange_1", "Flange RV - Coned_Vent_Cover_1")

        'Component.IsActive("Flange RV - Vent_Cover:1") = False
        'Component.IsActive("Flange RV - Coned_Cover_Flange_1:1") = True
        'Component.IsActive("Flange RV - Coned_Vent_Cover_1:1") = True
        'Component.IsActive("Flange RV - Coned_Vent_Cover_1:2") = True

    ElseIf cover_type = "N/A" Then
        'Usage sample 3 - Prepare list of PartNumbers separately
        Dim partNumbers  = {
            "Flange RV - Vent_Cover",
            "Flange RV - Coned_Cover_Flange_1",
            "Flange RV - Coned_Vent_Cover_1"
        }
        IsActiveByPartNumber(asm, True, partNumbers)

        'Component.IsActive("Flange RV - Vent_Cover:1") = True
        'Component.IsActive("Flange RV - Coned_Cover_Flange_1:1") = True
        'Component.IsActive("Flange RV - Coned_Vent_Cover_1:1") = True
        'Component.IsActive("Flange RV - Coned_Vent_Cover_1:2") = True
    End If
End Sub


Sub IsActiveByPartNumber(asm As AssemblyDocument, isActive As Boolean, ParamArray partNumbers() As String)

    'Get occurrences to process by its document PartNumber
    Dim occList As New List(Of ComponentOccurrence)

    For Each occ As ComponentOccurrence In asm.ComponentDefinition.Occurrences
        Dim doc As Document = occ.Definition.Document
        Dim partNumber As String = doc.PropertySets("{32853F0F-3444-11D1-9E93-0060B03C1CA6}")("Part Number").Value
        If partNumbers.Contains(partNumber) Then
            occList.Add(occ)
        End If
    Next

    'Do something with occurrences in list
    For Each occ In occList
        Component.IsActive(occ.Name) = isActive
    Next
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 06:55:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12223772#M157311</guid>
      <dc:creator>Michael.Navara</dc:creator>
      <dc:date>2023-09-07T06:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make my rule refer to the part number of a component rather than the component name?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225151#M157346</link>
      <description>&lt;P&gt;This ended up working the very first time I ran the rule and changed it to be the coned cover, but afterwords I would get this message but I do not know which error it is talking about.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 15:49:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225151#M157346</guid>
      <dc:creator>OliverXL5YM</dc:creator>
      <dc:date>2023-09-07T15:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make my rule refer to the part number of a component rather than the component name?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225176#M157347</link>
      <description>&lt;P&gt;Post the more info tab as that is where the information of error is, tab 1 just says there is an error.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 16:02:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225176#M157347</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-09-07T16:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make my rule refer to the part number of a component rather than the component name?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225190#M157348</link>
      <description>&lt;P&gt;Here it is, was I supposed to add more to the code?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 16:08:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225190#M157348</guid>
      <dc:creator>OliverXL5YM</dc:creator>
      <dc:date>2023-09-07T16:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make my rule refer to the part number of a component rather than the component name?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225253#M157349</link>
      <description>&lt;P&gt;That error suggest it encountered the error when it tried to access the Definition of an assembly component.&amp;nbsp; If the component was suppressed at the time, that would cause it to throw an error when you tried to access its definition.&amp;nbsp; You can not do much with a component that is currently suppressed, so you may need to include some filtering code to help avoid that.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 16:29:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225253#M157349</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-09-07T16:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make my rule refer to the part number of a component rather than the component name?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225469#M157351</link>
      <description>&lt;P&gt;How would it be best I go about doing that, should I just have an if statement that for the "N/A " parameter that unsuppresses everything. That might be okay if I just make sure to select that to unsuppress everything before I select the coned cover or the regular cover.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 17:59:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225469#M157351</guid>
      <dc:creator>OliverXL5YM</dc:creator>
      <dc:date>2023-09-07T17:59:31Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make my rule refer to the part number of a component rather than the component name?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225505#M157353</link>
      <description>&lt;P&gt;In any other situation, where you are about to access the ComponentOccurrence.Definition property, you usually need to filter out any that are suppressed first using something like:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;If occ.Suppressed Then Continue For&lt;/LI-CODE&gt;
&lt;P&gt;...where 'Continue For' is used to skip to the next item in a loop (if used within a loop), or use 'Exit Sub' if just inside a custom Sub routine just for that component.&amp;nbsp; However, given what the code in this situation is trying to achieve, that may not work as intended.&amp;nbsp; You are trying to access the Part Number iProperty of that component, which is normally not going to be possible while it is suppressed, making this a challenging request to fulfill.&amp;nbsp; I'm guessing that you may be able to avoid using these lines of code, due to the inherent problem mentioned.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim doc As Document = occ.Definition.Document
Dim partNumber As String = doc.PropertySets("{32853F0F-3444-11D1-9E93-0060B03C1CA6}")("Part Number").Value&lt;/LI-CODE&gt;
&lt;P&gt;...and instead try using the iLogic shortcut snippet:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim partNumber As String = iProperties.Value(occ.Name, "Project", "Part Number")&lt;/LI-CODE&gt;
&lt;P&gt;But I still do not recall if that will work if that component is suppressed.&amp;nbsp; It's worth a try though.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 18:17:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225505#M157353</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-09-07T18:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make my rule refer to the part number of a component rather than the component name?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225528#M157354</link>
      <description>&lt;P&gt;Another idea would be to use the built-in tool to rename all of your assembly component browser nodes to reflect their Part Number, instead of Filename.&amp;nbsp; That tool is usually on the Assemble tab, Productivity panel (may not always be showing), then within its drop-down list, named "Rename Browser Nodes".&amp;nbsp; It has 3 options for the name (Filename, Part Number, Default).&amp;nbsp; If all the components were renamed to their Part Numbers, you would no longer need to try to extract the Part Number from each component.&amp;nbsp; If there are more than one of the same part though, you will still have to deal with the "PN:1" &amp;amp; "PN:2" scenario (automatically adds an Index Integer at the end).&amp;nbsp; That is super simple to deal with though.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim sPN As String = occ.Name.Split(":").First&lt;/LI-CODE&gt;
&lt;P&gt;...where Split creates an Array of Strings, divided by that ":" character, then gets the 'First' String in that Array.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 18:26:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225528#M157354</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-09-07T18:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make my rule refer to the part number of a component rather than the component name?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225544#M157355</link>
      <description>&lt;P&gt;This one does not let me set the browser nodes to the part number, it greys out the accept button, but if it didn't that would be exactly what I need&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 18:34:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225544#M157355</guid>
      <dc:creator>OliverXL5YM</dc:creator>
      <dc:date>2023-09-07T18:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make my rule refer to the part number of a component rather than the component name?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225551#M157356</link>
      <description>&lt;P&gt;would I be able to just put "asm" in the "project" part since the project name varies for every project and would not be able to go into the rule and edit that name of the project in the rule.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 18:36:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225551#M157356</guid>
      <dc:creator>OliverXL5YM</dc:creator>
      <dc:date>2023-09-07T18:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make my rule refer to the part number of a component rather than the component name?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225567#M157357</link>
      <description>&lt;P&gt;The word "Project" there is referring to the PropertySet that the Part Number iProperty is found within.&amp;nbsp; That is sort of like its nickname that can be used when using that iProperti.Value() snippet.&amp;nbsp; You should not need to change that.&amp;nbsp; You can see the 'InternalName' of that specific PropertySet being used in the previous example by Michael, it is also known by the English name "Design Tracking Properties", if accessing it through normal Inventor API code, like Michael was doing.&amp;nbsp; That "Project" loosely represents the contents of the tab within the iProperties dialog, but that 'set' includes much more properties than what is shown in that tab.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit:&amp;nbsp; If you are not using an English version of Inventor, then you might be able to use that 'InternalName' shown in Michael's example to refer to that PropertySet in the &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=b564517a-f5cc-805f-0628-7a6e3ea65507" target="_blank" rel="noopener"&gt;iProperties.Value()&lt;/A&gt; snippet, instead of "Project".&amp;nbsp; The &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=PropertySet_InternalName" target="_blank" rel="noopener"&gt;PropertySet.InternalName&lt;/A&gt; property's value is stable across all languages.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 18:54:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12225567#M157357</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-09-07T18:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: How can I make my rule refer to the part number of a component rather than the component name?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12226471#M157373</link>
      <description>&lt;P&gt;Sorry, yesterday must have been some spots on sun or something. Here is updated version of IsActiveByPartNumber. When the component is suppressed, you can't read its definition. Component must be activated before.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Sub IsActiveByPartNumber(asm As AssemblyDocument, isActive As Boolean, ParamArray partNumbers() As String)

    'Get occurrences to process by its document PartNumber
    Dim occList As New List(Of ComponentOccurrence)

    For Each occ As ComponentOccurrence In asm.ComponentDefinition.Occurrences
        Dim isActiveBefore = Component.IsActive(occ.Name)
        If Not isActiveBefore Then
            Component.IsActive(occ.Name) = True
        End If

        Dim doc As Document = occ.Definition.Document
        Dim partNumber As String = doc.PropertySets("{32853F0F-3444-11D1-9E93-0060B03C1CA6}")("Part Number").Value
        If partNumbers.Contains(partNumber) Then
            occList.Add(occ)
        ElseIf Not isActiveBefore Then
            Component.IsActive(occ.Name) = False
        End If
    Next

    'Do something with occurrences in list
    For Each occ In occList
        Component.IsActive(occ.Name) = isActive
    Next
End Sub&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 08 Sep 2023 06:12:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-make-my-rule-refer-to-the-part-number-of-a-component/m-p/12226471#M157373</guid>
      <dc:creator>Michael.Navara</dc:creator>
      <dc:date>2023-09-08T06:12:41Z</dc:date>
    </item>
  </channel>
</rss>

