Macro to Create capture
Macro to Create capture
(OP)
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.





RE: Macro to Create capture
Old macro...with some improvements
CODE --> CATScript
' ====================================================== ' 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 SubRegards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: Macro to Create capture
RE: Macro to Create 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
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: Macro to Create capture
RE: Macro to Create capture