Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
i have no idea why it's only partielly works. Following code i use in my assembly but 1 component gives out "operation aborted". When i uncomment the
MsgBox("ok " & Parameter(arg, myArray(A, 0)))
in the function it works for all components in the assembly.
Class SharedValues Dim NumberOfParameter As Integer Dim myArray(0,0) As String Sub Main() doc = ThisDoc.Document NumberOfParameter = 0 For Each oParam In userParams If InStr(oParam.Name, "IEH_") <> 0 Then NumberOfParameter = NumberOfParameter + 1 Else End If Next NumberOfParameter= NumberOfParameter-1 ReDim myArray(NumberOfParameter,1) Dim i As Integer i = 0 For Each oParam In userParams If InStr(oParam.Name, "IEH_") <> 0 And i <= NumberOfParameter Then myArray(i,0)= oParam.Name Select Case oParam.units Case "mm" myArray(i, 1) = oParam.Value*10 Case "ul" myArray(i, 1) = oParam.Value End Select i = i + 1 Else End If Next SelectPart End Sub Sub SelectPart() comps = ThisApplication.TransientObjects.CreateObjectCollection While True comp = ThisApplication.CommandManager.Pick( SelectionFilterEnum.kAssemblyOccurrenceFilter, "Select a component") If IsNothing(comp) Then Exit While comps.Add(comp) End While For Each comp In comps PushParameterToParts(comp.Name) Next End Sub Function PushParameterToParts (arg) Dim A As Integer For A = 0 To NumberOfParameter Try Parameter(arg, myArray(A, 0)) = myArray(A, 1) '---------------- actived the code works: MsgBox("ok " & Parameter(arg, myArray(A, 0))) Catch End Try Next InventorVb.DocumentUpdate() End Function End Class
MR
Autodesk Inventor Professional 2025
Autodesk Vault Professional 2025
Autodesk Inventor Professional 2025
Autodesk Vault Professional 2025
Solved! Go to Solution.