Getting rid of units and adjust decimal in properties for all items in frame gen at once Inventor

Getting rid of units and adjust decimal in properties for all items in frame gen at once Inventor

abdul_alrashedZ7SBK
Explorer Explorer
170 Views
3 Replies
Message 1 of 4

Getting rid of units and adjust decimal in properties for all items in frame gen at once Inventor

abdul_alrashedZ7SBK
Explorer
Explorer

Removing units and adjustment of decimals have already been addressed before using a custom priority format. However, I would like to know if there is a way to remove all units and adjust decimal at once from a Frame Gen, rather than doing it individually for each one,

171 Views
3 Replies
Replies (3)
Message 2 of 4

BM_Ashraf
Advocate
Advocate

Hi,

Try This

Sub main

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then Return
Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oCDEF As AssemblyComponentDefinition = oDoc.ComponentDefinition

 For Each oRefDoc As Document In oDoc.AllReferencedDocuments
    If oRefDoc.DocumentType <> DocumentTypeEnum.kPartDocumentObject Then Continue For
		'Created by Frame Generator
		If oRefDoc.DocumentInterests.HasInterest("{AC211AE0-A7A5-4589-916D-81C529DA6D17}") = False Then Continue For
        Dim oPartCompDef As PartComponentDefinition = oRefDoc.ComponentDefinition
		Dim userParams As UserParameters = oPartCompDef.Parameters.UserParameters
		For Each oUP As UserParameter In userParams
		  If oUP.ExposedAsProperty = False Then Continue For
		  If oUP.Units = "Text" Or oUP.Units = "Boolean" Then Continue For 
          oUP.CustomPropertyFormat.ShowLeadingZeros = False
          oUP.CustomPropertyFormat.ShowTrailingZeros = False
          oUP.CustomPropertyFormat.ShowUnitsString = False
		  'MsgBox(oRefDoc.DisplayName & "" & oUP.Name)
		Next 
 Next 
  
End Sub
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.

Blue Mech

Add-ins for Inventor!

Message 3 of 4

CGBenner
Community Manager
Community Manager

@abdul_alrash 

 

Did the information provided answer your question? If so, please use Accept Solution so that others may find this in the future. Thank you very much!

Did you find a post helpful? Then feel free to give likes to these posts!
Did your question get successfully answered? Then just click on the 'Accept solution' button.  Thanks and Enjoy!


Chris Benner
Community Manager

0 Likes
Message 4 of 4

abdul_alrashedZ7SBK
Explorer
Explorer

Thank you Team,
The code works perfectly; however, it only considers the member length,

Could you please add the member's thickness, width, and height to the code,

Your help and support are much appreciated

 

0 Likes