<?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: modify custom iproperty of selected(.Pick) component in assembly in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/modify-custom-iproperty-of-selected-pick-component-in-assembly/m-p/6255107#M62943</link>
    <description>&lt;P&gt;You can also perfrom the selection of the parts BEFORE you run the rule by using the method:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Dim oDoc As Document = ThisApplication.ActiveDOcument
Dim oSelectSet As SelectSet = oDoc.SelectSet

If oSelectSet.Count = 0
&amp;nbsp; &amp;nbsp; &amp;nbsp;MsgBox("Nothing selected!")
Else
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;For Each oItem in oSelectSet
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If oItem.Type = ObjectTypeEnum.kComponentOccurrenceObject 'Change sheet/object OR Perform test as necessary.
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Do Stuff here if it is a component occurrence
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End if ' Item Type
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Next
End if 'Selection&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Apr 2016 16:45:16 GMT</pubDate>
    <dc:creator>MechMachineMan</dc:creator>
    <dc:date>2016-04-06T16:45:16Z</dc:date>
    <item>
      <title>modify custom iproperty of selected(.Pick) component in assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/modify-custom-iproperty-of-selected-pick-component-in-assembly/m-p/6252742#M62914</link>
      <description>&lt;P&gt;&lt;SPAN&gt;The following code fails with "Error in rule: Change By Selection, in document: test.iam&amp;nbsp;Public member 'Document' on type 'ComponentOccurrenceProxy' not found." Any help wold be appreciated. It appears i need to get the document object from the ComponentOccuranceProxy but I'm Not sure how... I am using kAllEntitiesFilter because it allows me to "reach into" subassemblies in th browser while making the selection.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SyntaxEditor Code Snippet&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;select end1&lt;/SPAN&gt;
 &lt;SPAN&gt;sel_flag&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;
 &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;end1&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;CommandManager&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Pick&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SelectionFilterEnum&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;kAllEntitiesFilter&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;Select End 1:&lt;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t;docEnd1&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;end1&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Document&lt;/SPAN&gt;
  &lt;SPAN&gt;customPropertySet&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;docEnd1&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;PropertySets&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Item&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;Inventor User Defined Properties&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;
  &lt;SPAN&gt;customPropertySet&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;item&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;Connected To&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Value&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;end1&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Name&lt;/SPAN&gt;
 &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Apr 2016 17:13:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/modify-custom-iproperty-of-selected-pick-component-in-assembly/m-p/6252742#M62914</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-05T17:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: modify custom iproperty of selected(.Pick) component in assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/modify-custom-iproperty-of-selected-pick-component-in-assembly/m-p/6253814#M62928</link>
      <description>&lt;P&gt;Hi, here you go:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;For more than one seleced parts:&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;' Select parts, use Esc key when you have selected all wished parts&lt;/STRONG&gt;&lt;/FONT&gt;
Dim Comps As ObjectCollection&lt;BR /&gt;Dim Comp As ComponentOccurrence&lt;BR /&gt;While True&lt;BR /&gt;    Comp = ThisApplication.CommandManager.Pick(SelectionFilterEnum.&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;kAssemblyLeafOccurrenceFilter&lt;/STRONG&gt;&lt;/FONT&gt;,"Select End 1:")&lt;BR /&gt;    &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;' If nothing gets selected then we're done&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;    If IsNothing(comp) Then Exit While&lt;BR /&gt;    comps.Add(comp) &lt;BR /&gt;End While&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;' If none parts are selected, end the rule&lt;/STRONG&gt;&lt;/FONT&gt;
If Comps.Count = 0 Then Exit Sub&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;' Go throught all selected parts&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;For Each Comp In Comps
    MessageBox.Show(Comp.Name, "End1")
    Dim oDoc as document = Comp.&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Definition&lt;/STRONG&gt;&lt;/FONT&gt;.Document
    oProSet = oDoc.PropertySets.Item("Inventor User Defined Properties")
    oProSet.Item("Connected To").Value = Comp.Name
Next&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For single part:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;' Select part&lt;/STRONG&gt;&lt;/FONT&gt;
Dim Comp As ComponentOccurrence
Comp = ThisApplication.CommandManager.Pick(SelectionFilterEnum.&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;kAssemblyLeafOccurrenceFilter&lt;/STRONG&gt;&lt;/FONT&gt;,"Select End 1:")

&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;' If no part is selected, end the rule&lt;/STRONG&gt;&lt;/FONT&gt;
If Comp Is Nothing Then Exit Sub

MessageBox.Show(Comp.Name, "End1")
Dim oDoc as document = Comp.&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Definition&lt;/STRONG&gt;&lt;/FONT&gt;.Document
oProSet = oDoc.PropertySets.Item("Inventor User Defined Properties")
oProSet.Item("Connected To").Value = Comp.Name&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Apr 2016 07:16:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/modify-custom-iproperty-of-selected-pick-component-in-assembly/m-p/6253814#M62928</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2016-04-06T07:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: modify custom iproperty of selected(.Pick) component in assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/modify-custom-iproperty-of-selected-pick-component-in-assembly/m-p/6254211#M62935</link>
      <description>&lt;P&gt;Awsome! Kudos for the multple pick version. I don't happen to need it right now, but I'm sure I will!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2016 12:51:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/modify-custom-iproperty-of-selected-pick-component-in-assembly/m-p/6254211#M62935</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-04-06T12:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: modify custom iproperty of selected(.Pick) component in assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/modify-custom-iproperty-of-selected-pick-component-in-assembly/m-p/6255107#M62943</link>
      <description>&lt;P&gt;You can also perfrom the selection of the parts BEFORE you run the rule by using the method:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Dim oDoc As Document = ThisApplication.ActiveDOcument
Dim oSelectSet As SelectSet = oDoc.SelectSet

If oSelectSet.Count = 0
&amp;nbsp; &amp;nbsp; &amp;nbsp;MsgBox("Nothing selected!")
Else
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;For Each oItem in oSelectSet
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If oItem.Type = ObjectTypeEnum.kComponentOccurrenceObject 'Change sheet/object OR Perform test as necessary.
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Do Stuff here if it is a component occurrence
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End if ' Item Type
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Next
End if 'Selection&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2016 16:45:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/modify-custom-iproperty-of-selected-pick-component-in-assembly/m-p/6255107#M62943</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2016-04-06T16:45:16Z</dc:date>
    </item>
  </channel>
</rss>

