- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to reorder in my design views (DesignViewRepresentations). I've written the code below. It doesn't fail, but nothing seems to happen. Am I missing something or can it be done otherwise?
Private Sub btnTest3_Click(sender As Object, e As EventArgs) Handles btnTest3.Click
Dim oInvApp As Inventor.Application
Dim oInvAssDoc As Inventor.AssemblyDocument
Try
oInvApp = GetObject(, "Inventor.Application")
Catch ex As Exception
MessageBox.Show("No Inventor open.")
Return
End Try
'Set a reference to active Invetor document.
Try
oInvAssDoc = oInvApp.ActiveDocument
Catch ex As Exception
MessageBox.Show("No Inventor assembly document open.")
Return
End Try
Dim oAssCd As AssemblyComponentDefinition
oAssCd = oInvAssDoc.ComponentDefinition
Dim oPane As BrowserPane
' oPane = oDoc.BrowserPanes.Item("AmBrowserArrangement")
oPane = oInvAssDoc.BrowserPanes.Item("AmBrowserArrangement:Representations")
Dim oInvDvr As DesignViewRepresentation
Dim oInvBrNdPo1 As Inventor.BrowserNode = Nothing
Dim oInvBrNdPo2 As Inventor.BrowserNode = Nothing
For Each oInvDvr In oAssCd.RepresentationsManager.DesignViewRepresentations
Dim sViewName As String
sViewName = oInvDvr.Name
If strFunc.InStr(sViewName, "Pos.Nr. 1") > 0 Then
oInvBrNdPo1 = oPane.GetBrowserNodeFromObject(oInvDvr)
ElseIf strFunc.InStr(sViewName, "Pos.Nr. 2") > 0 Then
oInvBrNdPo2 = oPane.GetBrowserNodeFromObject(oInvDvr)
End If
Next
'oPane.Reorder(oInvBrNdPo1, True, oInvBrNdPo2)
oPane.Reorder(oInvBrNdPo2, True, oInvBrNdPo1)
oPane.Refresh()
MessageBox.Show("OK")
End Sub
Solved! Go to Solution.