Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Macro to Create capture

Status
Not open for further replies.

lardman363

Automotive
Feb 8, 2013
173
US
Does any one have a macro that creates a capture? I can get the capture to create (using info from the .chm) but I think I need to create a camera to set the view and I couldn't figure out how you assign the view or geosets and annotations to the capture. Any help is appreciated.
 
Replies continue below

Recommended for you

Hi,

Old macro...with some improvements [smile]

Code:
' ======================================================
' Purpose: Macro will  take a screen capture in an active CATIA document window
' Usage:   1 - A CATIA document window must be active  
'          2 - Run macro 
'By ferdo, 6th June 2008
'Comments & small bug fix by JeNdArK
'Adapted for three types of photo by Pertu10 ,21/04/2010
' ======================================================
Language = "VBSCRIPT"

Sub CATMain()

Dim MyWindow As Window
Dim MyViewer As Viewer

Set MyWindow = CATIA.ActiveWindow
Set MyViewer = MyWindow.ActiveViewer

'**** SET ISOMETRIC VIEW (SITUAR EN VISTA ISOMETRICA)

'~ Dim specsAndGeomWindow1 As Window
'~ Set specsAndGeomWindow1 = CATIA.ActiveWindow
'~ Dim viewer3D1 As Viewer
'~ Set viewer3D1 = specsAndGeomWindow1.ActiveViewer
'~ Dim viewpoint3D1 As Viewpoint3D
'~ Set viewpoint3D1 = viewer3D1.Viewpoint3D
'~ viewer3D1.Reframe
'~ Set viewpoint3D1 = viewer3D1.Viewpoint3D

Dim ActDoc As Document
Set ActDoc = CATIA.ActiveDocument
Dim camIsoView As Camera3D
Set camIsoView = ActDoc.Cameras.Item("* iso")
Dim objIsoViewPoint As Viewpoint3D
Set objIsoViewPoint = camIsoView.Viewpoint3D
Dim ActWin As Window
Set ActWin = CATIA.ActiveWindow
Dim ActViewer As Viewer3D
Set ActViewer = ActWin.ActiveViewer
ActViewer.Viewpoint3D = objIsoViewPoint
CATIA.StartCommand"Fit All In"

Dim BGcolor(2) ' Create Array for vector type (x,y,z) // Creamos un array de dimension 1x3
MyViewer.GetBackgroundColor BGcolor   ' Keep Background color in the array // Guardamos el color de fondo actual
MyViewer.PutBackgroundColor Array(1, 1, 1) ' Change background color to WHITE // Cambiamos el color del fondo a blanco

' ****** SELECCIONAMOS EL TIPO DE FICHERO *****    
Dim extension As String    
' ****** PARA ESCOGER LA EXTENSION VALIDA *****

Dim Control As Integer
    Control = 0
    While Control = 0
        If extension = "BMP" Or extension = "JPG" Or extension = "TIFF" Then
        Control = 1
        Else
        extension = UCase(InputBox("Tipo Fichero SIN PUNTO" & Chr(13) & "BMP , JPG o TIFF"))
        End If
    Wend

'***** ESCOGEMOS LA EXTENSION DEL FICHERO A GRABAR *****

    If extension = "BMP" Then
        Tipo = catCaptureFormatBMP
    End If
    If extension = "JPG" Then
        Tipo = catCaptureFormatJPEG
    End If
    If extension = "TIFF" Then
        Tipo = catCaptureFormatTIFF
    End If
        
    Dim Ruta As String
    CapturePath = CATIA.FileSelectionBox("NOMBRE DEL FICHERO", extension, CatFileSelectionModeSave)
    Ruta = CapturePath & "." & extension

MyViewer.CaptureToFile Tipo, Ruta ' MAIN SENTENCE!! STORE THE PICTURE IN ANY FORMAT // SENTENCIA PRINCIPAL, GUARDAMOS LA IMAGEN COMO BMP
MyViewer.PutBackgroundColor BGcolor ' Change background color to the original color // Cambiamos el color del fondo al color original

MsgBox (" Capture was saved ") ' Show what we have done / Mostramos lo que hemos hecho

End Sub

Regards
Fernando

- Romania
- EU
 
lardman wants to create a capture. this macro just saves existing capture.
 
If I understood correctly part of the question was:

lardman363 said:
I couldn't figure out how you assign the view or geosets and annotations to the capture

And example was in this part of the macro (or maybe I just misunderstood the meaning of the view, or capture ?). Or question should be how to create a screen capture of the Annotations Views ? Because this is completely something else...see why I prefer to go to my designers to see exactly what they want?

'**** SET ISOMETRIC VIEW (SITUAR EN VISTA ISOMETRICA)

Regards
Fernando

- Romania
- EU
 
i completely understand you. lardman da you want to create a capture or export existing captures in catia to ppt or image?
 
[ul]
[li]I want to create a capture (which I can do)[/li]
[li]Assign the current view as the camera inside the capture (I have an annotation view that I can get a normal view of)[/li]
[li]Then assign annotations and geosets to turn on when that capture is activated[/li]
[/ul]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top