<?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: Change User Parameter Custom Property with VBA in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-user-parameter-custom-property-with-vba/m-p/6810818#M69371</link>
    <description>&lt;P&gt;I recognize this is an old post, but did you use this code in iLogic? In what file (weldment assembly, top level assembly, etc) did you run this code?&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jan 2017 15:37:18 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-01-17T15:37:18Z</dc:date>
    <item>
      <title>Change User Parameter Custom Property with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-user-parameter-custom-property-with-vba/m-p/6537867#M66546</link>
      <description>&lt;P&gt;Inventor 2017&lt;/P&gt;&lt;P&gt;All updates and hot fixes installed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I create an assembly that has a frame (constructed with Frame Gen) in it i have to go in to each individual part file and change the G_L user parameter "Custom property format" from "Decimal" to "Fractional" and change the "Precision" to "1/16th". I would like to do this through VBA (or iLogic if possible). &amp;nbsp;The code i wrote shows the error in the attached pic when i try to run it. &amp;nbsp;Can anyone help?? &amp;nbsp;I have attached a pic of my code as well because when i paste it on here its hard to read.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Sub ChangeParameterFormat()&lt;BR /&gt;' Get the active assembly document.&lt;BR /&gt;Dim oAsmDoc As AssemblyDocument&lt;BR /&gt;Set oAsmDoc = ThisApplication.ActiveDocument&lt;/P&gt;&lt;P&gt;' Iterate through all of the documents referenced by the assembly.&lt;BR /&gt;Dim oDoc As Document&lt;BR /&gt;&lt;BR /&gt;For Each oDoc In oAsmDoc.AllReferencedDocuments&lt;BR /&gt;&lt;BR /&gt;' Check to see if this is a part.&lt;BR /&gt;If oDoc.DocumentType = kPartDocumentObject Then&lt;BR /&gt;&lt;BR /&gt;Dim oPartDoc As PartDocument&lt;BR /&gt;Set oPartDoc = oDoc&lt;BR /&gt;&lt;BR /&gt;Dim oUserParams As UserParameters&lt;BR /&gt;Set oUserParams = oPartDoc.ComponentDefinition.Parameters.UserParameters&lt;/P&gt;&lt;P&gt;Dim i As Integer&lt;BR /&gt;&lt;BR /&gt;For i = 0 To oUserParams.Count&lt;BR /&gt;&lt;BR /&gt;oUserParams.Item(i).CustomPropertyFormat.Precision = Inventor.CustomPropertyPrecisionEnum.kSixteenthsFractionalLengthPrecision&lt;/P&gt;&lt;P&gt;Next i&lt;BR /&gt;&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;Next&lt;BR /&gt;&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 21:57:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-user-parameter-custom-property-with-vba/m-p/6537867#M66546</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-01T21:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: Change User Parameter Custom Property with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-user-parameter-custom-property-with-vba/m-p/6537880#M66547</link>
      <description>&lt;P&gt;The code below should get you pointed in the right direction. It just adds multi-value &lt;SPAN&gt;Parameters&lt;/SPAN&gt;&amp;nbsp;and changing &lt;SPAN&gt;User Parameter. I hope this helps in some way.&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;Imports&lt;/SPAN&gt;  &lt;SPAN&gt;Inventor&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;UnitsTypeEnum&lt;/SPAN&gt;


&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAssemblyDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt;
&lt;SPAN&gt;oAssemblyDoc&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Document&lt;/SPAN&gt;

&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oAssemblyDoc&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;DocumentType&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;kAssemblyDocumentObject&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;

    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAssemblyCompDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyComponentDefinition&lt;/SPAN&gt;
        &lt;SPAN&gt;oAssemblyCompDef&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;oAssemblyDoc&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
        
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oParams&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Parameters&lt;/SPAN&gt;
        &lt;SPAN&gt;oParams&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;oAssemblyCompDef&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Parameters&lt;/SPAN&gt;
                
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oUserParams&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;UserParameters&lt;/SPAN&gt;
        &lt;SPAN&gt;oUserParams&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;oParams&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;UserParameters&lt;/SPAN&gt;       
        
        &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAwesomeParameter&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Parameter&lt;/SPAN&gt;                     
                    &lt;SPAN&gt;Try&lt;/SPAN&gt;
            &lt;SPAN&gt;otester&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;oUserParams&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;PK_Extended_Item_Description&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;
            &lt;SPAN&gt;Catch&lt;/SPAN&gt;
&lt;SPAN&gt;oInsulationType&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;oUserParams&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;AddByValue&lt;/SPAN&gt;&lt;SPAN&gt;(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t;&lt;SPAN&gt;)&lt;/SPAN&gt;
            &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;
            &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

&lt;SPAN&gt;Parameter&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Param&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;PK_Extended_Item_Description&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;ExposedAsProperty&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;False&lt;/SPAN&gt;
&lt;SPAN&gt;Parameter&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Param&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;PK_Extended_Item_Description&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;IsKey&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;False&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 22:07:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-user-parameter-custom-property-with-vba/m-p/6537880#M66547</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-01T22:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: Change User Parameter Custom Property with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-user-parameter-custom-property-with-vba/m-p/6539539#M66570</link>
      <description>&lt;P&gt;That helped? Thanks! &amp;nbsp;Here is the final code in case others have a similar issue.&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;PRE&gt;Public Sub SetParameterFormatToSixteenthsFractional()

    'Get the active assembly document.
    Dim oAsmDoc As AssemblyDocument
    Set oAsmDoc = ThisApplication.ActiveDocument

    'Iterate through all of the documents referenced by the assembly.
    Dim oDoc As Document
    For Each oDoc In oAsmDoc.AllReferencedDocuments
    
        'Check to see if this is a part.
        If oDoc.DocumentType = kPartDocumentObject Then
        
            Debug.Print oDoc.FullFileName
        
            Dim oPartDoc As PartDocument
            Set oPartDoc = oDoc
            
            Dim oUserParams As UserParameters
            Set oUserParams = oPartDoc.ComponentDefinition.Parameters.UserParameters
            
            'Check to see if the part document contains user parameters.
            If oUserParams.Count &amp;gt; 0 Then
            
                Dim oUserParam As UserParameter
                
                'Loop through each user paramter.
                For Each oUserParam In oUserParams
                
                    'look for user parameter G_L.
                    If oUserParam.Name = "G_L" Then
                    
                        Debug.Print oUserParam.Name
                        Set oUserParam = oUserParams.Item("G_L")
                        oUserParam.CustomPropertyFormat.Precision = kSixteenthsFractionalLengthPrecision
                       
                    End If
    
                Next oUserParam
                
            End If
            
        End If
        
    Next oDoc
    
End Sub

&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2016 15:40:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-user-parameter-custom-property-with-vba/m-p/6539539#M66570</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-09-02T15:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: Change User Parameter Custom Property with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-user-parameter-custom-property-with-vba/m-p/6810818#M69371</link>
      <description>&lt;P&gt;I recognize this is an old post, but did you use this code in iLogic? In what file (weldment assembly, top level assembly, etc) did you run this code?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 15:37:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-user-parameter-custom-property-with-vba/m-p/6810818#M69371</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-01-17T15:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: Change User Parameter Custom Property with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-user-parameter-custom-property-with-vba/m-p/6811036#M69373</link>
      <description>&lt;P&gt;I actually use it as a VBA macro, not iLogic. &amp;nbsp;You should be able to just copy and paste it in a module then run it. &amp;nbsp;I use it in assemblies that were created before i modified the content center parts (now when I use frame generator the structural parts have the G_L parameter set to fractional when it placed in the assembly) that i use in frame generator or in assemblies that were created by someone else who did not have content center updated.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 16:48:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-user-parameter-custom-property-with-vba/m-p/6811036#M69373</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-01-17T16:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Change User Parameter Custom Property with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-user-parameter-custom-property-with-vba/m-p/6811492#M69380</link>
      <description>&lt;P&gt;In case you want to use it in iLogic instead, here below is the translation.&lt;/P&gt;
&lt;P&gt;I've removed the debugs and simplified the user parameter search. Also there's no need to cast it to PartDocument type.&lt;/P&gt;
&lt;P&gt;You can apply these changes to your VBA makro as well. It would be a bit faster in parts with a lot of custom parameters as it doesn't iterate through all of them. Or let me know if you want me to do so for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Public Sub Main()
    &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;' Get the active assembly document.&lt;/STRONG&gt;&lt;/FONT&gt;
    Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument
    &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;' Iterate through all of the documents referenced by the assembly.&lt;/STRONG&gt;&lt;/FONT&gt;
    For Each oDoc As Document In oAsmDoc.AllReferencedDocuments
        &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;' Check to see if this is a part.&lt;/FONT&gt;&lt;/STRONG&gt;
        If oDoc.DocumentType &amp;lt;&amp;gt; kPartDocumentObject Then Continue For
        Dim oUserParams As UserParameters = oDoc.ComponentDefinition.Parameters.UserParameters
        &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;' Check to see if the part document contains user parameters.&lt;/STRONG&gt;&lt;/FONT&gt;
        If oUserParams.Count = 0 Then Continue For
        &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;' Look for user parameter named "G_L".&lt;/STRONG&gt;&lt;/FONT&gt;
        Dim oUserParam As UserParameter =  oUserParams.Item("G_L")
        If oUserParam Is Nothing Then Continue For
        oUserParam.CustomPropertyFormat.Precision = kSixteenthsFractionalLengthPrecision
    Next oDoc
End Sub&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 19:28:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-user-parameter-custom-property-with-vba/m-p/6811492#M69380</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2017-01-17T19:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: Change User Parameter Custom Property with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-user-parameter-custom-property-with-vba/m-p/6811610#M69385</link>
      <description>&lt;P&gt;excellent, thank you. I'll try it.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 20:12:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-user-parameter-custom-property-with-vba/m-p/6811610#M69385</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-01-17T20:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: Change User Parameter Custom Property with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-user-parameter-custom-property-with-vba/m-p/6811662#M69389</link>
      <description>&lt;P&gt;You're welcomed.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 20:33:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-user-parameter-custom-property-with-vba/m-p/6811662#M69389</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2017-01-17T20:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: Change User Parameter Custom Property with VBA</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-user-parameter-custom-property-with-vba/m-p/10609012#M128667</link>
      <description>&lt;P&gt;I know this is an old post, but I get this error when running the rule. Any thoughts on it? I'm running it from an Assembly level. Many thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/962814iA09DBA0D394B0C6C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Sep 2021 19:04:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/change-user-parameter-custom-property-with-vba/m-p/10609012#M128667</guid>
      <dc:creator>emanuel.c</dc:creator>
      <dc:date>2021-09-08T19:04:12Z</dc:date>
    </item>
  </channel>
</rss>

