0

Can someone help me with a code for capturing a 250X250 pixcel screen and copying it into clipboard. I would like to paste the image into an excel i can code that part. I have no clue where to start. I have made a code till reframing on the a point where i need the macro to capture.

Dim objviewer3d as viewer3d
Selection1.search("Name="+Textbox1.value+"*,all")

Caita.startcommand("reframe On")
Catia.refreshDisplay=true

Set objviewer3d=catia.activewindow.activeviewer
Objviewer3d.viewpoint3d.zoom=0.017
objviewer3d.update

This is the code i have written. I need the capture code. I Have no clue how to do that. And Last thing I know code to capture full screen and capture to file code. I don't want that. Thank you

1 Answers1

0

The CATIA method which captures the current window to a file is Window.CaptureToFile:

CATIA.ActiveWindow.ActiveViewer.CaptureToFile catCaptureFormatJPEG,"C:\Temp\Capture.jpg"

This captures the entire window, so to make it 250x250, set the ActiveWindow.Height and .Width to 250 before capturing the image. Then set it back afterwords to it's original size only. Alternatively you can resize the image after you insert it into Excel as a shape.

If you want the tree off you can also call ActiveWindow.Layout = catWindowGeomOnly

C R Johnson
  • 964
  • 1
  • 5
  • 12