Croping the view

Croping the view

Anonymous
Not applicable
380 Views
1 Reply
Message 1 of 2

Croping the view

Anonymous
Not applicable

Hi

     I need to crop the each view separately from the sheets and to save it as png file through Inventor API

     Can any one please provide me the solution for the same.

     Thanks in Advance.

0 Likes
381 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

Atlast find solution by myself

 

Dim invapp As Inventor.Application

       invapp = GetObject(, "Inventor.Application")

        Dim invdwg As Inventor.DrawingDocument

        invdwg = invapp.ActiveDocument

        Dim kDrViews As DrawingViews

        Dim OTG As TransientGeometry = invapp.TransientGeometry

 

        Dim oDoc As DrawingDocument

        oDoc = invdwg

        For j As Integer = 1 To oDoc.Sheets.Count - 6

            invdwg.Sheets(j).Activate()

            kDrViews = invdwg.Sheets(j).DrawingViews

            For i As Integer = 1 To kDrViews.Count

 

                Dim oDrawingView As DrawingView

                oDrawingView = kDrViews.Item(i)

 

                Dim oView As View

                oView = invapp.ActiveView

 

                Dim oCamera As Camera

                oCamera = oView.Camera

 

                Dim oEyePt As Point

                oEyePt = OTG.CreatePoint(oDrawingView.Center.X + 0.25, oDrawingView.Center.Y, oCamera.Eye.Z)

                oCamera.Eye = oEyePt

 

                Dim oTargetPt As Point

                oTargetPt = OTG.CreatePoint(oDrawingView.Center.X + 0.25, oDrawingView.Center.Y, oCamera.Target.Z)

                oCamera.Target = oTargetPt

 

                Call oCamera.SetExtents(oDrawingView.Width + 1, oDrawingView.Height + 1.5)

 

                oCamera.Apply()

                oCamera.SaveAsBitmap("C:\Temp\Part" & j & "-" & i & ".jpg", 800, 600)

            Next

        Next

    End Sub

0 Likes