×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Macro to Create capture

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

Hi,

Old macro...with some improvements smile

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 Sub 

Regards
Fernando

https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU

RE: Macro to Create capture

lardman wants to create a capture. this macro just saves existing capture.

RE: Macro to Create capture

If I understood correctly part of the question was:

Quote (lardman363)


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

https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU

RE: Macro to Create capture

i completely understand you. lardman da you want to create a capture or export existing captures in catia to ppt or image?

RE: Macro to Create capture

(OP)
  • I want to create a capture (which I can do)
  • Assign the current view as the camera inside the capture (I have an annotation view that I can get a normal view of)
  • Then assign annotations and geosets to turn on when that capture is activated

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources