Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vb api save

Status
Not open for further replies.

TiagoFigueiredo

Industrial
May 22, 2013
494
0
0
PT
Hello,

I've made the conection between vb and creo.

Now I need some help to do the following:

1st I need to save the screen image to a file *.png to a file

2nd If I have an assembly oppened, I need to reed the parameters from the activated part. Not the displayed assembly, but the activated part in the assembly.


Any idea of how to do it?

Tiago Figueiredo
Tooling Engineer

Youtube channel:
 
Replies continue below

Recommended for you

Found it :)

Code:
Dim asynconn As New pfcls.CCpfcAsyncConnection
        Dim conn As pfcls.IpfcAsyncConnection
        Dim session As pfcls.IpfcBaseSession
        conn = asynconn.Connect("", "", ".", 5)
        session = conn.Session

        model = session.GetActiveModel
        window = session.CurrentWindow

        mdlname = session.GetActiveModel.FileName

        Work_dir = session.GetCurrentDirectory

Dim instructions 'As IpfcRasterImageExportInstructions

        Dim rasterHeight As Double = 2
        Dim rasterWidth As Double = 3.85
        Dim dotsPerInch As Integer
        Dim imageDepth As Integer

        Dim bmpInstrs As IpfcBitmapImageExportInstructions

        Try
            dotsPerInch = EpfcDotsPerInch.EpfcRASTERDPI_100
            imageDepth = EpfcRasterDepth.EpfcRASTERDEPTH_24

            bmpInstrs = (New CCpfcBitmapImageExportInstructions).Create(rasterWidth, rasterHeight)
            instructions = bmpInstrs

            window.ExportRasterImage(Work_dir + Nome_imagem + ".bmp", instructions)


        Catch ex As Exception
            MsgBox(ex.Message.ToString + Chr(13) + ex.StackTrace.ToString)
        End Try

Tiago Figueiredo
Tooling Engineer

Youtube channel:
 
Status
Not open for further replies.
Back
Top