Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Collect UserParameters from Part

1 REPLY 1
Reply
Message 1 of 2
Anonymous
239 Views, 1 Reply

Collect UserParameters from Part

Hi, I'm new to inventor customization , Help in finding the solution for this!! 

 

I have an assembly, i need to get the details(Name, value, type) of user parameters from the individual parts in assembly and export it to csv file.

which all functions do i need to use and how get the parts from assembly?UserParamter.JPG

1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

Hello @Anonymous

 

You could start with a VBA macro like this:

Public Sub GetUserParameters()
    If ThisApplication.ActiveDocumentType <> kAssemblyDocumentObject Then Exit Sub
    
    Dim myAssy As Inventor.AssemblyDocument
    Set myAssy = ThisApplication.ActiveDocument
    
    Dim myDoc As Inventor.Document
    For Each myDoc In myAssy.AllReferencedDocuments
        If myDoc.DocumentType = kPartDocumentObject Then
            Dim myPart As Inventor.PartDocument
            Set myPart = myDoc
            
            Dim myUP As Inventor.UserParameter
            For Each myUP In myPart.ComponentDefinition.Parameters.UserParameters
                Debug.Print "User Parameter " & myUP.Name & " is type " & TypeName(myUP.Value) & " with value " & CStr(myUP.Value)
            Next myUP
        End If
    Next myDoc
End Sub

It just dumps to the VBA immediate view all userparameters in all parts in the active assembly.

 

Regards,

Jens Bejer Pedersen

Developer, Symetri A/S

www.symetri.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report