Looking for a CATIA macro programming guide? I’ve created a new how-to catia video tutorial to go along with a script found in my VB Scripting for CATIA V5 ebook. The new video highlights how to use a capture photo CATIA macro. The code also includes how to toggle the specification tree allowing you to unhide or hide specification tree.
I wanted to clarify one thing from the video. You can easily modify the CATScript macro to either automatically zoom in or zoom out when taking the screen shot capture. I like to include these lines of code then simply use an apostrophe to turn them on or off. This is the lines of code I am referring to:
(where objViewer3D.Viewpoint3D = objCamera3D.Viewpoint3D)
Also, I save the catia capture file as .png but you can save it as TIFF, BMP, or JPEG if you want to by changing the number in this line of code or by adding your own file extension to the name (.png, .bmp).
Dim fileloc, Exten, Strname As String
Exten = “.png”
Strname = fileloc & partName & exten
Objviewer3D.Capturetofile 4, strname
Here’s the process flow of the screen capture CATIA macro followed by the YouTube video tutorial:
1. Run the macro (hit alt+F8 to set your macro libraries)
2. Switches CATIA background color to white, hide the compass, hide specification tree.
3. Input box 1: Enter the name you want to name the output file
4. Input box 2:
a. If user clicks Yes, automatically reframe and set to iso view, then take screen capture.
b. If user clicks No, take picture as is (no reframe, use current view).
5. Catia Screenshot is taken and saved as a .png file in a folder specified in the macro code.
6. Resets properties including background color, unhide compass, and unhide spec tree.
Like I said earlier, the code in its entirety is found within my eBook, or you can try to figure it out yourself with the tips given in my CATIA macro articles and newsletters. This script is useful in car design in Catia to take catia images.
Other useful CATScripts you will find in VB Scripting for CATA V5: Expanded Edition include:
· Copy and paste axis system
· Count number of parts catia macro
· Catia tree reorder catscript
· Capture picture vba catia