vbacatia

How to use translate function in CATIA V5


I am studying CATIA VBA. The version is V5. I wrote the following code based on the book and help, but it gives me an error.

Sub CATMain()
Dim oViewer3D As Viewer3D
Dim translationVector(2) As Variant

translationVector(0)=0
translationVector(1)=0
translationVector(2)=0

Set oViewer3D = CATIA.ActiveWindow.ActiveViewer
Dim oCamera As Camera3D
Set oCamera3D = CATIA.ActiveDocument.Cameras.Item(1)

oViewer3D.Viewpoint3D = oCamera3D.Viewpoint3D
oViewer3D.Translate translationVector '<-Error 

Compile error: Function or interface marked as restricted or the function uses an Automation type not supported Visual Basic.

How can I resolve this error?

oViewer3D.Translate translationVector '<-Error 

I would like to resolve an error that occurs on this line. However, I have no information and am having trouble.


Solution

  • Thank you for comment. It's worked. the correct code is the below.

    Dim oViewer3D As Object 'Viewer3D