Showing results for 
Search instead for 
Did you mean: 

Renaming Sub occurrence?

Solution Partner Experimenter Solution Partner Experimenter
Solution Partner Experimenter



How can we rename the suboccurence using VB.NET? 


In the image bellow, I want rename Shoe CH 1.par:1.      I'm not finding any option to rename it by manually also.



Asm tree.png


Re: Renaming Sub occurrence?

Solution Partner Legend Solution Partner Legend
Solution Partner Legend



interactively you may use the Revision Manager, programmatically the Revision Manager API.


Here an example of using the API. Its written in VBA syntax, but may be easily adaptet to VB.NET. The example performs a replace action, but there is also a rename action available:


Sub Traverse()

    Dim revMgrApp As RevisionManager.Application
    Dim revMgrDoc As RevisionManager.Document
    Set revMgrApp = CreateObject("RevisionManager.Application")
    Set revMgrDoc = revMgrApp.OpenFileInRevisionManager("D:\Benutzer\W​ku\Etc\Solid Edge\Test02\Asm00.dft")
    TraverseLinkedDocuments revMgrDoc

End Sub

Private Sub TraverseLinkedDocuments(revMgrDoc As RevisionManager.Document)

    Dim linkedDoc As RevisionManager.Document

    Debug.Print revMgrDoc.FullName
    Select Case revMgrDoc.FullName
        Case "D:\Benutzer\Wku\Etc\Solid Edge\Test02\Part01.xlsx"
            revMgrDoc.Replace "D:\Benutzer\Wku\Etc\Solid Edge\Test02\PartXX.xlsx"
            Debug.Print " replaced by D:\Benutzer\Wku\Etc\Solid Edge\Test02\PartXX.xlsx"
    End Select
    If IsSolidEdgeDocument(revMgrDoc.FullName) Then
        For Each linkedDoc In revMgrDoc.LinkedDocuments
            TraverseLinkedDocuments linkedDoc
    End If

End Sub

Private Function IsSolidEdgeDocument(pathName As String) As Boolean

    Select Case LCase(Right(pathName, 4))
        Case ".asm", ".dft", ".par", ".psm"
            IsSolidEdgeDocument = True
        Case Else
            IsSolidEdgeDocument = False
    End Select
End Function
Kind regards,
Wolfgang Kunert -