Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello together,
is there any way to sort the names of the PositionalRepresentations and LevelOfDetailRepresentations? Manually I copy all the PositionalRepresentations and LevelOfDetailRepresentations in the right order and delete the old ones.
Private Sub Button28_Click(sender As Object, e As EventArgs) Handles Button28.Click
Dim m_inventorApp As Inventor.Application = Nothing
' Try to get an active instance of Inventor
Try
m_inventorApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")
Catch ex As Exception
MsgBox(ex.Message)
End Try
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = m_inventorApp.ActiveDocument.ComponentDefinition
'define pos rep
Dim oPosRep As PositionalRepresentation
Dim MyArrayList As New ArrayList
'record the active view rep name
Dim sActivePosRep As String
sActivePosRep = oAsmCompDef.RepresentationsManager.ActivePositionalRepresentation.Name
For Each oPosRep In oAsmCompDef.RepresentationsManager.PositionalRepresentations
MyArrayList.Add(oPosRep.Name)
Next
Dim MyArrayList1 As New ArrayList
Dim oRepManager As RepresentationsManager
oRepManager = oAsmCompDef.RepresentationsManager
For Each oLODRep In oRepManager.LevelOfDetailRepresentations
MyArrayList1.Add(oLODRep.Name)
Next
MyArrayList.Remove("Hauptansicht")
MyArrayList1.Remove("Hauptansicht")
MyArrayList1.Remove("Alle Komponenten unterdrückt")
MyArrayList1.Remove("Alle Bauteile unterdrückt")
MyArrayList1.Remove("Gesamtes Inhaltscenter unterdrückt")
' Sorts the values of the ArrayList.
MyArrayList.Sort()
' Displays the values of the ArrayList.
Console.WriteLine("After sorting:")
PrintValues(MyArrayList)
' Sorts the values of the ArrayList.
MyArrayList1.Sort()
' Displays the values of the ArrayList.
Console.WriteLine("After sorting:")
PrintValues(MyArrayList1)
End Sub
Public Shared Sub PrintValues(myList As IEnumerable)
Dim obj As [Object]
For Each obj In myList
Console.WriteLine(" {0}", obj)
Next obj
Console.WriteLine()
End Sub 'PrintValues
Thank you
Georg
Solved! Go to Solution.
