<?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 Do all custom iProperties require a string output? in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/do-all-custom-iproperties-require-a-string-output/m-p/9030349#M101348</link>
    <description>&lt;P&gt;I'm trying to set up a code where I can update an iProperty based on inputs.&amp;nbsp; I modified the example code to update iProperties.&amp;nbsp; The sub would be used with texts, bools, and numbers.&amp;nbsp; I set the input as a variant but get errors if I pass anything other than a variant or string.&amp;nbsp; What's the rules on iProps?&lt;/P&gt;&lt;PRE&gt;Public Sub CalliProp()

Dim docCurr As Document
Set docCurr = ThisApplication.ActiveDocument

Dim dblTest As Double
dblTest = 3.22222

Call UpdateCustomiProp(docCurr, "Woohah", dblTest)

End Sub
Public Sub UpdateCustomiProp(docDoc As Document, strPropTitle As String, varValue As Variant)
       
    ' Get the custom property set.
    Dim psCustom As PropertySet
    Set psCustom = docDoc.PropertySets.Item("Inventor User Defined Properties")
        
    Dim propCurrent As Property
    Set propCurrent = psCustom.Item(strPropTitle)
    
    If Err.Number &amp;lt;&amp;gt; 0 Then
        ' Failed to get the property, which means it doesn't exist
        ' so we'll create it.
        Call psCustom.Add(varValue, strPropTitle)
    Else
        ' Got the property so update the value.
        propCurrent.Value = varValue
    End If

End Sub&lt;/PRE&gt;</description>
    <pubDate>Tue, 17 Sep 2019 15:18:58 GMT</pubDate>
    <dc:creator>JBEDsol</dc:creator>
    <dc:date>2019-09-17T15:18:58Z</dc:date>
    <item>
      <title>Do all custom iProperties require a string output?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/do-all-custom-iproperties-require-a-string-output/m-p/9030349#M101348</link>
      <description>&lt;P&gt;I'm trying to set up a code where I can update an iProperty based on inputs.&amp;nbsp; I modified the example code to update iProperties.&amp;nbsp; The sub would be used with texts, bools, and numbers.&amp;nbsp; I set the input as a variant but get errors if I pass anything other than a variant or string.&amp;nbsp; What's the rules on iProps?&lt;/P&gt;&lt;PRE&gt;Public Sub CalliProp()

Dim docCurr As Document
Set docCurr = ThisApplication.ActiveDocument

Dim dblTest As Double
dblTest = 3.22222

Call UpdateCustomiProp(docCurr, "Woohah", dblTest)

End Sub
Public Sub UpdateCustomiProp(docDoc As Document, strPropTitle As String, varValue As Variant)
       
    ' Get the custom property set.
    Dim psCustom As PropertySet
    Set psCustom = docDoc.PropertySets.Item("Inventor User Defined Properties")
        
    Dim propCurrent As Property
    Set propCurrent = psCustom.Item(strPropTitle)
    
    If Err.Number &amp;lt;&amp;gt; 0 Then
        ' Failed to get the property, which means it doesn't exist
        ' so we'll create it.
        Call psCustom.Add(varValue, strPropTitle)
    Else
        ' Got the property so update the value.
        propCurrent.Value = varValue
    End If

End Sub&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Sep 2019 15:18:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/do-all-custom-iproperties-require-a-string-output/m-p/9030349#M101348</guid>
      <dc:creator>JBEDsol</dc:creator>
      <dc:date>2019-09-17T15:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Do all custom iProperties require a string output?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/do-all-custom-iproperties-require-a-string-output/m-p/9030724#M101351</link>
      <description>&lt;P&gt;Custom iProps can be what ever type that is available when you go and add one manually.&lt;/P&gt;&lt;P&gt;You can use the object type instead of variant to make it generic.&lt;/P&gt;&lt;P&gt;Keep in mind the iproperty type will change depending on what type of value you assign ex: assigning "123" and 123 will change the iproperty type automatically between string and number.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2019 18:19:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/do-all-custom-iproperties-require-a-string-output/m-p/9030724#M101351</guid>
      <dc:creator>omartin</dc:creator>
      <dc:date>2019-09-17T18:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Do all custom iProperties require a string output?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/do-all-custom-iproperties-require-a-string-output/m-p/9033218#M101378</link>
      <description>&lt;P&gt;I found out if I use byval in front of the variant designation for my sub it works&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 17:58:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/do-all-custom-iproperties-require-a-string-output/m-p/9033218#M101378</guid>
      <dc:creator>JBEDsol</dc:creator>
      <dc:date>2019-09-18T17:58:04Z</dc:date>
    </item>
  </channel>
</rss>

