Creating an Enhanced Scene Macro


If you perform a task repeatedly, you can take advantage of the macro mechanism to automate it. A macro is a series of functions, written in a scripting language, that you group in a single command in order to perform the requested task automatically.

This task will show you how to create an Enhanced Scene macro.

You stored your recorded macros in a text format file. For more detailed information about macros, see Recording, Running and editing Macros in the Infrastructure User's Guide.

Here is an example of an Enhanced Scene macro in which you create a Enhanced Scene:

Option Explicit

' **************************************** **************
' Purpose: Create two new scenes.
' Assumptions: A CATProduct document should be active.
' Languages: VBScript
' Locales: English
' CATIA Level: V5R12
' *******************************************************

Sub CATMain()

' Get the root of the CATProduct
Dim RootProduct As Product
Set RootProduct = CATIA.ActiveDocument.Product

' Retrieve the ProductScenes collection
Dim TheScenes As ProductScenes
Set TheScenes = RootProduct.GetTechnologicalObject("ScenesCollection")

' Create a FULL product-scene on Root-Product
Dim xProducts1(0)
Set xProducts1(0) = RootProduct
Dim oScene1 As ProductScene
Set oScene1 = TheScenes.AddProductSceneFull ("", xProducts1)

' Create a PARTIAL product-scene on Root-Product with "PartialScene" persistent name
Dim xProducts2(0)
Dim oScene2 As ProductScene
Set oScene2 = TheScenes.AddProductScenePartial ("PartialScene", xProducts2)

End Sub


ainfo.gif (980 bytes)
  • Create the scene launches the scene creation.
  • Scene1 corresponds to the to-be-created scene.
  • RootProduct corresponds to Product1.