<?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: catch the instance property and add that to the instance name in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/catch-the-instance-property-and-add-that-to-the-instance-name/m-p/11207564#M138793</link>
    <description>&lt;P&gt;What is the name of the 'instance' iProperty which is holding this serial number?&amp;nbsp; Once that serial number is found, how do you want it to effect the name of the component within the active assembly?&amp;nbsp; Do you want it to become the new full name of the component, or just part of its name?&amp;nbsp; If just part of its name, then which part, and how do you want the new name to be formatted?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit:&amp;nbsp; I think I found the name "Serial Number". (If that is correct.)&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jun 2022 12:46:26 GMT</pubDate>
    <dc:creator>WCrihfield</dc:creator>
    <dc:date>2022-06-01T12:46:26Z</dc:date>
    <item>
      <title>catch the instance property and add that to the instance name</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/catch-the-instance-property-and-add-that-to-the-instance-name/m-p/11207171#M138787</link>
      <description>&lt;P&gt;Hi!&amp;nbsp;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B4D44A73814D7FC0D950DEDFACB97081/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was recommended by&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/576681"&gt;@CCarreiras&lt;/a&gt;&amp;nbsp;to ask help here with an issue i published in another part of the forum:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-forum/read-quot-instance-properties-quot-from-inventor/m-p/11207113#M865178" target="_blank"&gt;Re: Read "instance Properties" from Inventor - Autodesk Community - Inventor&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-forum/read-quot-instance-properties-quot-from-inventor/m-p/11207113#M865178" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-forum/read-quot-instance-properties-quot-from-inventor/m-p/11207113#M865178&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 09:29:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/catch-the-instance-property-and-add-that-to-the-instance-name/m-p/11207171#M138787</guid>
      <dc:creator>carlos.manteigas</dc:creator>
      <dc:date>2022-06-01T09:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: catch the instance property and add that to the instance name</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/catch-the-instance-property-and-add-that-to-the-instance-name/m-p/11207564#M138793</link>
      <description>&lt;P&gt;What is the name of the 'instance' iProperty which is holding this serial number?&amp;nbsp; Once that serial number is found, how do you want it to effect the name of the component within the active assembly?&amp;nbsp; Do you want it to become the new full name of the component, or just part of its name?&amp;nbsp; If just part of its name, then which part, and how do you want the new name to be formatted?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit:&amp;nbsp; I think I found the name "Serial Number". (If that is correct.)&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 12:46:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/catch-the-instance-property-and-add-that-to-the-instance-name/m-p/11207564#M138793</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-06-01T12:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: catch the instance property and add that to the instance name</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/catch-the-instance-property-and-add-that-to-the-instance-name/m-p/11207686#M138797</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11324380"&gt;@carlos.manteigas&lt;/a&gt;.&amp;nbsp; I just wrote an iLogic rule for you that may do what you are asking, but since I still don't have the answers to the questions from my last post, I'm not sure if it is doing it the way you want it done yet.&amp;nbsp; Basically, when you have that main assembly open/active, then run this rule, it should start recursively iterating through all of the components looking for an 'instance' iProperty named "Serial Number", then use its value to rename the component it was within.&amp;nbsp; I put the main task into its own Sub routine, so that it would be easily transferable, if needed.&amp;nbsp; I also encapsulated the whole process within a single transaction, so that it could simply click 'UNDO' once to undo it all, if needed.&lt;/P&gt;
&lt;P&gt;Here is the iLogic rule's code:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub Main
	oADoc = ThisAssembly.Document
	oADef = oADoc.ComponentDefinition
	oOccs = oADef.Occurrences
	oTrans = ThisApplication.TransactionManager.StartTransaction(oADoc, "Rename Components W/ SN")
	RecusivelyIterateComponents(oOccs)
	oTrans.End
End Sub

Sub RecusivelyIterateComponents(oComps As ComponentOccurrences)
	If IsNothing(oComps) OrElse oComps.Count = 0 Then Exit Sub
	For Each oComp As ComponentOccurrence In oComps
		Try
			If oComp.OccurrencePropertySetsEnabled Then
				Dim oInstPSet As PropertySet = oComp.OccurrencePropertySets.Item(1)
				Dim oInstP As Inventor.Property = oInstPSet.Item("Serial Number")
				Dim oSN As String = oInstP.Value.ToString
				If oSN &amp;lt;&amp;gt; "" Then oComp.Name = oSN
			End If
		Catch
		End Try
		If oComp.SubOccurrences.Count &amp;gt; 0 Then
			RecusivelyIterateComponents(oComp.SubOccurrences)
		End If
	Next
End Sub&lt;/LI-CODE&gt;
&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN&gt;&lt;STRONG&gt;ACCEPT SOLUTION&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7401B55A0A518861312A0F851CD29320/emoticons/1f44d.png" alt=":thumbs_up:" title=":thumbs_up:" /&gt;.&lt;/P&gt;
&lt;P&gt;If you want and have time, I would appreciate your Vote(s) for &lt;A href="https://forums.autodesk.com/t5/forums/recentpostspage/post-type/message/interaction-style/idea/user-id/7812054/" target="_blank"&gt;My IDEAS &lt;/A&gt; :bulb: or you can Explore &lt;A href="https://knowledge.autodesk.com/profile/LTSUSR7HXMSAE/articles" target="_blank"&gt;My CONTRIBUTIONS &lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 13:22:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/catch-the-instance-property-and-add-that-to-the-instance-name/m-p/11207686#M138797</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-06-01T13:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: catch the instance property and add that to the instance name</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/catch-the-instance-property-and-add-that-to-the-instance-name/m-p/11208313#M138827</link>
      <description>WOW!!!!&lt;BR /&gt;&lt;BR /&gt;Thank you &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;!!!&lt;BR /&gt;Worked like charm! &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B4D44A73814D7FC0D950DEDFACB97081/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;</description>
      <pubDate>Wed, 01 Jun 2022 16:51:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/catch-the-instance-property-and-add-that-to-the-instance-name/m-p/11208313#M138827</guid>
      <dc:creator>carlos.manteigas</dc:creator>
      <dc:date>2022-06-01T16:51:26Z</dc:date>
    </item>
  </channel>
</rss>

