<?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: Format Specific Exported Parameters from Assembly Level in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/format-specific-exported-parameters-from-assembly-level/m-p/9301768#M105548</link>
    <description>&lt;P&gt;I believe this is working as you want, not too different from what you posted:&lt;/P&gt;&lt;PRE&gt;Sub Main
If ThisApplication.ActiveDocument.DocumentType = kPartDocumentObject Or ThisApplication.ActiveDocument.DocumentType = kAssemblyDocumentObject Then Else Exit Sub
Dim openDoc As Document = ThisApplication.ActiveDocument
'Look at all of the files referenced in the open document
Dim docFile As Document
If openDoc.DocumentType = kPartDocumentObject
	Call Formatting(openDoc) 
Else
	For Each docFile In openDoc.AllReferencedDocuments
		'look at only part files that are modifiable
    	        If docFile.DocumentType = kPartDocumentObject And docFile.IsModifiable = True
			Call Formatting(docFile)
		End If
	Next 
End If
iLogicVb.UpdateWhenDone = True
End Sub

Sub Formatting(oDoc As PartDocument)
	'[
	'For Thickness Parameter
	Try
		oThickness = oDoc.ComponentDefinition.Parameters.UserParameters.Item("Thickness")
	Catch
		oThickness = oDoc.ComponentDefinition.Parameters.UserParameters.AddByValue("Thickness", 1, "in")
	End Try	
	oThickness.ExposedAsProperty = True
	If oThickness.Units = "mm"
		oFormat=oThickness.CustomPropertyFormat
		oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
		oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision
		oFormat.Units = "mm"
		oFormat.ShowUnitsString = True
		oFormat.ShowLeadingZeros = False
		oFormat.ShowTrailingZeros = True
		
	Else If oThickness.Units = "in"
		oFormat=oThickness.CustomPropertyFormat
		oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
		oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kThreeDecimalPlacesPrecision
		oFormat.Units = "in"
		oFormat.ShowUnitsString = False
		oFormat.ShowLeadingZeros = False
		oFormat.ShowTrailingZeros = True
	
	End If
	'] For Thickness Parameter
	
	'[
	'For Width Parameter
	Try
		oWidth = oDoc.ComponentDefinition.Parameters.UserParameters.Item("Width")
	Catch
		oWidth = oDoc.ComponentDefinition.Parameters.UserParameters.AddByValue("Width", 15, "in")
	End Try	
	oWidth.ExposedAsProperty = True
	If oWidth.Units = "mm"
		oFormat=oWidth.CustomPropertyFormat
		oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
		oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision
		oFormat.Units = "mm"
		oFormat.ShowUnitsString = True
		oFormat.ShowLeadingZeros = False
		oFormat.ShowTrailingZeros = True
		
	Else If oWidth.Units = "in"
		oFormat=oWidth.CustomPropertyFormat
		oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
		oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kThreeDecimalPlacesPrecision
		oFormat.Units = "in"
		oFormat.ShowUnitsString = False
		oFormat.ShowLeadingZeros = False
		oFormat.ShowTrailingZeros = True
	
	End If
	'] For Width Parameter
	
	'[
	'For Length Parameter
	Try
		oLength = oDoc.ComponentDefinition.Parameters.UserParameters.Item("Length")
	Catch
		oLength = oDoc.ComponentDefinition.Parameters.UserParameters.AddByValue("Length", 45, "in")
	End Try	
	oLength.ExposedAsProperty = True
	If oLength.Units = "mm"
		oFormat=oLength.CustomPropertyFormat
		oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
		oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision
		oFormat.Units = "mm"
		oFormat.ShowUnitsString = True
		oFormat.ShowLeadingZeros = False
		oFormat.ShowTrailingZeros = True
		
	Else If oLength.Units = "in"
		oFormat=oLength.CustomPropertyFormat
		oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
		oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kThreeDecimalPlacesPrecision
		oFormat.Units = "in"
		oFormat.ShowUnitsString = False
		oFormat.ShowLeadingZeros = False
		oFormat.ShowTrailingZeros = True
	
	End If
	'] For Length Parameter
	oDoc.Rebuild
End Sub&lt;/PRE&gt;&lt;P&gt;I put the formatting into a subroutine to make handling the different document types easier in the main routine.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Feb 2020 19:47:49 GMT</pubDate>
    <dc:creator>J-Camper</dc:creator>
    <dc:date>2020-02-06T19:47:49Z</dc:date>
    <item>
      <title>Format Specific Exported Parameters from Assembly Level</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/format-specific-exported-parameters-from-assembly-level/m-p/9301638#M105540</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to format the Thickness, Width, and Length parameters on a group of parts from the assembly level.&lt;/P&gt;&lt;P&gt;I know this has been done, and I found what I though were many solutions, none of which worked. At least I was able to screw it up. I'm finally at a point it looks like the rule is running, but nothing is changing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to verify the rule is running only on parts that are modifiable. I'd also like the rule to run if is executed in a part file.&lt;/P&gt;&lt;P&gt;I've attached my latest failure.&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;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 18:40:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/format-specific-exported-parameters-from-assembly-level/m-p/9301638#M105540</guid>
      <dc:creator>DewayneH</dc:creator>
      <dc:date>2020-02-06T18:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Format Specific Exported Parameters from Assembly Level</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/format-specific-exported-parameters-from-assembly-level/m-p/9301744#M105544</link>
      <description>&lt;P&gt;What would you exactly like to do?&lt;/P&gt;
&lt;P&gt;Could you explain it step by step?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 19:39:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/format-specific-exported-parameters-from-assembly-level/m-p/9301744#M105544</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2020-02-06T19:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: Format Specific Exported Parameters from Assembly Level</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/format-specific-exported-parameters-from-assembly-level/m-p/9301768#M105548</link>
      <description>&lt;P&gt;I believe this is working as you want, not too different from what you posted:&lt;/P&gt;&lt;PRE&gt;Sub Main
If ThisApplication.ActiveDocument.DocumentType = kPartDocumentObject Or ThisApplication.ActiveDocument.DocumentType = kAssemblyDocumentObject Then Else Exit Sub
Dim openDoc As Document = ThisApplication.ActiveDocument
'Look at all of the files referenced in the open document
Dim docFile As Document
If openDoc.DocumentType = kPartDocumentObject
	Call Formatting(openDoc) 
Else
	For Each docFile In openDoc.AllReferencedDocuments
		'look at only part files that are modifiable
    	        If docFile.DocumentType = kPartDocumentObject And docFile.IsModifiable = True
			Call Formatting(docFile)
		End If
	Next 
End If
iLogicVb.UpdateWhenDone = True
End Sub

Sub Formatting(oDoc As PartDocument)
	'[
	'For Thickness Parameter
	Try
		oThickness = oDoc.ComponentDefinition.Parameters.UserParameters.Item("Thickness")
	Catch
		oThickness = oDoc.ComponentDefinition.Parameters.UserParameters.AddByValue("Thickness", 1, "in")
	End Try	
	oThickness.ExposedAsProperty = True
	If oThickness.Units = "mm"
		oFormat=oThickness.CustomPropertyFormat
		oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
		oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision
		oFormat.Units = "mm"
		oFormat.ShowUnitsString = True
		oFormat.ShowLeadingZeros = False
		oFormat.ShowTrailingZeros = True
		
	Else If oThickness.Units = "in"
		oFormat=oThickness.CustomPropertyFormat
		oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
		oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kThreeDecimalPlacesPrecision
		oFormat.Units = "in"
		oFormat.ShowUnitsString = False
		oFormat.ShowLeadingZeros = False
		oFormat.ShowTrailingZeros = True
	
	End If
	'] For Thickness Parameter
	
	'[
	'For Width Parameter
	Try
		oWidth = oDoc.ComponentDefinition.Parameters.UserParameters.Item("Width")
	Catch
		oWidth = oDoc.ComponentDefinition.Parameters.UserParameters.AddByValue("Width", 15, "in")
	End Try	
	oWidth.ExposedAsProperty = True
	If oWidth.Units = "mm"
		oFormat=oWidth.CustomPropertyFormat
		oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
		oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision
		oFormat.Units = "mm"
		oFormat.ShowUnitsString = True
		oFormat.ShowLeadingZeros = False
		oFormat.ShowTrailingZeros = True
		
	Else If oWidth.Units = "in"
		oFormat=oWidth.CustomPropertyFormat
		oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
		oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kThreeDecimalPlacesPrecision
		oFormat.Units = "in"
		oFormat.ShowUnitsString = False
		oFormat.ShowLeadingZeros = False
		oFormat.ShowTrailingZeros = True
	
	End If
	'] For Width Parameter
	
	'[
	'For Length Parameter
	Try
		oLength = oDoc.ComponentDefinition.Parameters.UserParameters.Item("Length")
	Catch
		oLength = oDoc.ComponentDefinition.Parameters.UserParameters.AddByValue("Length", 45, "in")
	End Try	
	oLength.ExposedAsProperty = True
	If oLength.Units = "mm"
		oFormat=oLength.CustomPropertyFormat
		oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
		oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision
		oFormat.Units = "mm"
		oFormat.ShowUnitsString = True
		oFormat.ShowLeadingZeros = False
		oFormat.ShowTrailingZeros = True
		
	Else If oLength.Units = "in"
		oFormat=oLength.CustomPropertyFormat
		oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
		oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kThreeDecimalPlacesPrecision
		oFormat.Units = "in"
		oFormat.ShowUnitsString = False
		oFormat.ShowLeadingZeros = False
		oFormat.ShowTrailingZeros = True
	
	End If
	'] For Length Parameter
	oDoc.Rebuild
End Sub&lt;/PRE&gt;&lt;P&gt;I put the formatting into a subroutine to make handling the different document types easier in the main routine.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 19:47:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/format-specific-exported-parameters-from-assembly-level/m-p/9301768#M105548</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2020-02-06T19:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Format Specific Exported Parameters from Assembly Level</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/format-specific-exported-parameters-from-assembly-level/m-p/9301810#M105551</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The rule would format the exported Thickness, Width, and Length parameters based on the parameters units, "in" or "mm".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oThickness&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Units&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;mm&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
                        
                            &lt;SPAN&gt;oFormat&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;oThickness&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;CustomPropertyFormat&lt;/SPAN&gt;
                            &lt;SPAN&gt;oFormat&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;PropertyType&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;Inventor&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;CustomPropertyTypeEnum&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;kTextPropertyType&lt;/SPAN&gt;
                            &lt;SPAN&gt;oFormat&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Precision&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;Inventor&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;CustomPropertyPrecisionEnum&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;kZeroDecimalPlacePrecision&lt;/SPAN&gt;
                            &lt;SPAN&gt;oFormat&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Units&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;mm&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;
                            &lt;SPAN&gt;oFormat&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;ShowUnitsString&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;True&lt;/SPAN&gt;
                            &lt;SPAN&gt;oFormat&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;ShowLeadingZeros&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;False&lt;/SPAN&gt;
                            &lt;SPAN&gt;oFormat&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;ShowTrailingZeros&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;True&lt;/SPAN&gt;
                        
                        &lt;SPAN&gt;Else&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oThickness&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Units&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;in&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;  &lt;SPAN&gt;Then&lt;/SPAN&gt;
                        
                            &lt;SPAN&gt;oFormat&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;oThickness&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;CustomPropertyFormat&lt;/SPAN&gt;
                            &lt;SPAN&gt;oFormat&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;PropertyType&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;Inventor&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;CustomPropertyTypeEnum&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;kTextPropertyType&lt;/SPAN&gt;
                            &lt;SPAN&gt;oFormat&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Precision&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;Inventor&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;CustomPropertyPrecisionEnum&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;kThreeDecimalPlacesPrecision&lt;/SPAN&gt;
                            &lt;SPAN&gt;oFormat&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Units&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;in&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;
                            &lt;SPAN&gt;oFormat&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;ShowUnitsString&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;False&lt;/SPAN&gt;
                            &lt;SPAN&gt;oFormat&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;ShowLeadingZeros&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;False&lt;/SPAN&gt;
                            &lt;SPAN&gt;oFormat&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;ShowTrailingZeros&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;True&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the rule runs in a part file the parameters would be formatted as shown based on the units.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the rule runs in an assembly file, the parameters in all the parts would be formatted.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the part is modifiable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 20:11:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/format-specific-exported-parameters-from-assembly-level/m-p/9301810#M105551</guid>
      <dc:creator>DewayneH</dc:creator>
      <dc:date>2020-02-06T20:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: Format Specific Exported Parameters from Assembly Level</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/format-specific-exported-parameters-from-assembly-level/m-p/9301876#M105553</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is almost exactly what I need.&lt;/P&gt;&lt;P&gt;The thing I didn't account for is, in some files the parameters may not be user parameters. Sometimes they can be model parameters. In those cases the rule recreates the parameter as a user parameter and the intended parameter doesn't get formatted.&lt;/P&gt;&lt;P&gt;For example if "Thickness" is a model parameter it won't be formatted, and "Thickness_1" will be created and formatted as a user parameter.&lt;/P&gt;&lt;P&gt;How can it be written to format the existing model parameter and not recreate it?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 20:40:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/format-specific-exported-parameters-from-assembly-level/m-p/9301876#M105553</guid>
      <dc:creator>DewayneH</dc:creator>
      <dc:date>2020-02-06T20:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: Format Specific Exported Parameters from Assembly Level</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/format-specific-exported-parameters-from-assembly-level/m-p/9301931#M105557</link>
      <description>&lt;P&gt;You should be able to change the Trys to be less specific and look through all Parameters instead of all User Parameters:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Sub Main
If ThisApplication.ActiveDocument.DocumentType = kPartDocumentObject Or ThisApplication.ActiveDocument.DocumentType = kAssemblyDocumentObject Then Else Exit Sub
Dim openDoc As Document = ThisApplication.ActiveDocument
'Look at all of the files referenced in the open document
Dim docFile As Document
If openDoc.DocumentType = kPartDocumentObject
	Call Formatting(openDoc) 
Else
	For Each docFile In openDoc.AllReferencedDocuments
		'look at only part files that are modifiable
    	If docFile.DocumentType = kPartDocumentObject And docFile.IsModifiable = True
			Call Formatting(docFile)
		End If
	Next 
End If
iLogicVb.UpdateWhenDone = True
End Sub

Sub Formatting(oDoc As PartDocument)
	'[
	'For Thickness Parameter
	Try
		oThickness = oDoc.ComponentDefinition.&lt;STRONG&gt;Parameters.Item("Thickness")&lt;/STRONG&gt;
	Catch
		oThickness = oDoc.ComponentDefinition.Parameters.UserParameters.AddByValue("Thickness", 1, "in")
	End Try	
	oThickness.ExposedAsProperty = True
	If oThickness.Units = "mm"
		oFormat=oThickness.CustomPropertyFormat
		oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
		oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision
		oFormat.Units = "mm"
		oFormat.ShowUnitsString = True
		oFormat.ShowLeadingZeros = False
		oFormat.ShowTrailingZeros = True
		
	Else If oThickness.Units = "in"
		oFormat=oThickness.CustomPropertyFormat
		oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
		oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kThreeDecimalPlacesPrecision
		oFormat.Units = "in"
		oFormat.ShowUnitsString = False
		oFormat.ShowLeadingZeros = False
		oFormat.ShowTrailingZeros = True
	
	End If
	'] For Thickness Parameter
	
	'[
	'For Width Parameter
	Try
		oWidth = oDoc.ComponentDefinition.&lt;STRONG&gt;Parameters.Item("Width")&lt;/STRONG&gt;
	Catch
		oWidth = oDoc.ComponentDefinition.Parameters.UserParameters.AddByValue("Width", 15, "in")
	End Try	
	oWidth.ExposedAsProperty = True
	If oWidth.Units = "mm"
		oFormat=oWidth.CustomPropertyFormat
		oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
		oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision
		oFormat.Units = "mm"
		oFormat.ShowUnitsString = True
		oFormat.ShowLeadingZeros = False
		oFormat.ShowTrailingZeros = True
		
	Else If oWidth.Units = "in"
		oFormat=oWidth.CustomPropertyFormat
		oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
		oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kThreeDecimalPlacesPrecision
		oFormat.Units = "in"
		oFormat.ShowUnitsString = False
		oFormat.ShowLeadingZeros = False
		oFormat.ShowTrailingZeros = True
	
	End If
	'] For Width Parameter
	
	'[
	'For Length Parameter
	Try
		oLength = oDoc.ComponentDefinition.&lt;STRONG&gt;Parameters.Item("Length")&lt;/STRONG&gt;
	Catch
		oLength = oDoc.ComponentDefinition.Parameters.UserParameters.AddByValue("Length", 45, "in")
	End Try	
	oLength.ExposedAsProperty = True
	If oLength.Units = "mm"
		oFormat=oLength.CustomPropertyFormat
		oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
		oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision
		oFormat.Units = "mm"
		oFormat.ShowUnitsString = True
		oFormat.ShowLeadingZeros = False
		oFormat.ShowTrailingZeros = True
		
	Else If oLength.Units = "in"
		oFormat=oLength.CustomPropertyFormat
		oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
		oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kThreeDecimalPlacesPrecision
		oFormat.Units = "in"
		oFormat.ShowUnitsString = False
		oFormat.ShowLeadingZeros = False
		oFormat.ShowTrailingZeros = True
	
	End If
	'] For Length Parameter
	oDoc.Rebuild
End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 21:09:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/format-specific-exported-parameters-from-assembly-level/m-p/9301931#M105557</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2020-02-06T21:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: Format Specific Exported Parameters from Assembly Level</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/format-specific-exported-parameters-from-assembly-level/m-p/9302021#M105563</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That did it. Works like a charm.&lt;/P&gt;&lt;P&gt;Thanks for the help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 21:52:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/format-specific-exported-parameters-from-assembly-level/m-p/9302021#M105563</guid>
      <dc:creator>DewayneH</dc:creator>
      <dc:date>2020-02-06T21:52:30Z</dc:date>
    </item>
  </channel>
</rss>

