<?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 fun - Changing an iProperty in each part of an assembly in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-fun-changing-an-iproperty-in-each-part-of-an-assembly/m-p/7742502#M93303</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1146156"&gt;@JamesNordgren&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try the following iLogic code to check, enter a new string and replace the same string with first 5 letters. Before running code, make sure that a valid assembly document opened in Inventor.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Sub Main()

    Dim oDoc As AssemblyDocument
    oDoc = ThisApplication.ActiveDocument
    
    Dim oDef As AssemblyComponentDefinition
    oDef = oDoc.ComponentDefinition
    
    Dim inputStr As String
    inputStr = InputBox("Enter a text")
    
    
    Dim referDoc As Document
    Dim referDisp As DocumentDescriptor
    For Each referDisp In oDoc.ReferencedDocumentDescriptors
        referDoc = referDisp.ReferencedDocument
        
        Dim customProp As PropertySet
        customProp = referDoc.PropertySets.Item("User Defined Properties")
        
        Dim oProp As Inventor.Property
        For Each oProp In customProp
            If oProp.Name = "Drawing No" Then
                If oProp.Value &amp;lt;&amp;gt; "" Then
                    Dim temp As String
                    temp = Right(oProp.Value, Len(oProp.Value) - 5)
                    
                    result = inputStr + temp
					
					MessageBox.Show(result)
					
                End If
            End If
        Next
        
        
    Next
End Sub&lt;/PRE&gt;
&lt;P&gt;Please feel free to contact if there is any queries.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If solves problem, click on "Accept as solution" / give a "Kudo".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
    <pubDate>Thu, 01 Feb 2018 10:54:14 GMT</pubDate>
    <dc:creator>chandra.shekar.g</dc:creator>
    <dc:date>2018-02-01T10:54:14Z</dc:date>
    <item>
      <title>iLogic fun - Changing an iProperty in each part of an assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-fun-changing-an-iproperty-in-each-part-of-an-assembly/m-p/7736824#M93302</link>
      <description>&lt;P&gt;Hi, I know similar problems have been covered elsewhere here, but I cannot find an example of exactly what I want to do, and I am obviously missing something.&lt;/P&gt;&lt;P&gt;I need to create an iLogic rule to: (assume it will be run from an assembly document)&lt;/P&gt;&lt;P&gt;1)&amp;nbsp; Iterate through all documents referenced by the assembly&lt;/P&gt;&lt;P&gt;2)&amp;nbsp; Check that a custom iProperty "&lt;EM&gt;DrawingNo&lt;/EM&gt;" both exists AND is not empty string For Each document&lt;/P&gt;&lt;P&gt;3)&amp;nbsp; If 2) is true, then replace first 5 characters of DrawingNo with a new string that user has entered and is stored in a variable (i know how to do that part)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will anyone help me with the basic code to iterate the assembly and check the existence and content of the custom iPorperty?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much!&lt;/P&gt;&lt;P&gt;James&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 16:22:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-fun-changing-an-iproperty-in-each-part-of-an-assembly/m-p/7736824#M93302</guid>
      <dc:creator>JamesNordgren</dc:creator>
      <dc:date>2018-01-30T16:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic fun - Changing an iProperty in each part of an assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-fun-changing-an-iproperty-in-each-part-of-an-assembly/m-p/7742502#M93303</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1146156"&gt;@JamesNordgren&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try the following iLogic code to check, enter a new string and replace the same string with first 5 letters. Before running code, make sure that a valid assembly document opened in Inventor.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Sub Main()

    Dim oDoc As AssemblyDocument
    oDoc = ThisApplication.ActiveDocument
    
    Dim oDef As AssemblyComponentDefinition
    oDef = oDoc.ComponentDefinition
    
    Dim inputStr As String
    inputStr = InputBox("Enter a text")
    
    
    Dim referDoc As Document
    Dim referDisp As DocumentDescriptor
    For Each referDisp In oDoc.ReferencedDocumentDescriptors
        referDoc = referDisp.ReferencedDocument
        
        Dim customProp As PropertySet
        customProp = referDoc.PropertySets.Item("User Defined Properties")
        
        Dim oProp As Inventor.Property
        For Each oProp In customProp
            If oProp.Name = "Drawing No" Then
                If oProp.Value &amp;lt;&amp;gt; "" Then
                    Dim temp As String
                    temp = Right(oProp.Value, Len(oProp.Value) - 5)
                    
                    result = inputStr + temp
					
					MessageBox.Show(result)
					
                End If
            End If
        Next
        
        
    Next
End Sub&lt;/PRE&gt;
&lt;P&gt;Please feel free to contact if there is any queries.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If solves problem, click on "Accept as solution" / give a "Kudo".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 10:54:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-fun-changing-an-iproperty-in-each-part-of-an-assembly/m-p/7742502#M93303</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2018-02-01T10:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic fun - Changing an iProperty in each part of an assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-fun-changing-an-iproperty-in-each-part-of-an-assembly/m-p/7751967#M93304</link>
      <description>&lt;P&gt;Thank you, that helps alot.&amp;nbsp; I eventually figured out it was the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;"customProp = referDoc.PropertySets.Item("User Defined Properties")"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;statement to access iproperties throught the API that I was missing.&amp;nbsp; I had been trying to use the iLogic iProperties.Value statement, which only ever gets the properties from the document from which the rule is run.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2018 15:14:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-fun-changing-an-iproperty-in-each-part-of-an-assembly/m-p/7751967#M93304</guid>
      <dc:creator>JamesNordgren</dc:creator>
      <dc:date>2018-02-05T15:14:30Z</dc:date>
    </item>
  </channel>
</rss>

