Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
I'm new to iLogic API / .NET and trying to write a function which will create an ArrayList of the all parts that match a User Parameter Name/Value. I'm trying to get the component name as shown in the browser pane, however what I get is the file name. Secondly, the list only contains components which are not suppressed... I actually need to build a list containing all components irrespective of their suppression state, so long as they meet the requirement of containing a specified User Parameter Name and Value
Any help is greatly appreciated.
I'm running Inventor Pro 2021.
Thank you.
Public Function ListByUserParam(ParameterName,ParameterValue)
Dim AssyDoc As AssemblyDocument
AssyDoc = ThisApplication.ActiveDocument
Dim ArrayListObject As New ArrayList
Dim Doc As Document
For Each Doc In AssyDoc.AllReferencedDocuments
Dim CompDef As ComponentDefinition
CompDef = Doc.ComponentDefinition
Dim UserParams As UserParameters
UserParams = CompDef.Parameters.UserParameters
Try
UserParamItem = UserParams.Item(ParameterName)
UserParamValue = UserParamItem.Value
If CStr(UserParamValue) = ParameterValue
Dim DisplayName As String
DisplayName = CStr(Doc.DisplayName)
DisplayName = Left(DisplayName,Len(DisplayName)-4)
ArrayListObject.Add(DisplayName)
End If
Catch
End Try
Next
Return ArrayListObject
End Function
Solved! Go to Solution.