Active Document to Revision Manager

Experimenter
Experimenter

I want to know
How to move the currently active document to the revision manager

Is there a vb code?

6 REPLIES

Re: Active Document to Revision Manager

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

To my knowledge, there is no direct way to do that. They are two separate applications and APIs. When a document is open in Solid Edge, the file is locked. Same with Revision Manager. To do what you're wanting, you would need to close the document in Solid Edge and open it in Revision Manager.

 

Your question made me realize that I don't have any Revision Manager samples on the SolidEdgeCommunity GitHub site. I'll add it to my todo.

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Active Document to Revision Manager

Experimenter
Experimenter

Thank you Jason ...
Please attach the following sample code.

Re: Active Document to Revision Manager

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Here is some quick code.

 

Module Module1
    <STAThread>
    Sub Main()
        Dim objApplication As RevisionManager.Application
        Dim objDocument As RevisionManager.Document

        objApplication = New RevisionManager.Application
        objApplication.Visible = 1
        objDocument = objApplication.OpenFileInRevisionManager("C:\Program Files\Solid Edge ST7\Training\bar.par")

        ' Note that Revision Manager will close when this application terminates.
    End Sub
End Module

 

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Active Document to Revision Manager

Experimenter
Experimenter

Hi Jason
I've done some tests on it.

Finally came the following code:

------------------------------------------------------------------------------

Sub Main()
        Dim objApplication As SolidEdgeFramework.Application = Nothing
        Dim objDocument As SolidEdgeFramework.SolidEdgeDocument = Nothing
        Dim sname As String
        Dim spath As String
        Dim spn As String

        Dim revApplication As RevisionManager.Application = Nothing
        Dim revDocument As RevisionManager.Document = Nothing

        Try
            'OleMessageFilter.Register()

            ' Connect to a running instance of Solid Edge.
            objApplication = Marshal.GetActiveObject("SolidEdge.Application")
            objDocument = objApplication.ActiveDocument
            sname = objDocument.Name
            spath = objDocument.Path
            spn = spath + "\" + sname
            objDocument.Close()
            revApplication = New RevisionManager.Application
            revApplication.Visible = True

            revDocument = objApplication.OpenfileInRevesionManager(spn)
            objDocument.Close()

        Catch ex As Exception
            ' Write any errors to console.
            Console.WriteLine(ex.Message)
        Finally
            'OleMessageFilter.Revoke()
        End Try
    End Sub

--------------------------------------------------------------------------

Nothing debug syntax shown in bold...

Can you confirm?

Re: Active Document to Revision Manager

Experimenter
Experimenter
bold Syntax --> "RevApplication" Modify ->The run good
but
When the last revision "end sub" Run windows disappear

Re: Active Document to Revision Manager

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

In my code sample that I provided, I noted at the end that the revision manager application would terminate when your program terminates. I'm not sure why it works differently than Solid Edge automation. Perhaps someone knows a trick to keep it running.

Jason Newell
Applications Architect
www.jasonnewell.net