Isometric View No Works VBA

LECLERC Sebastien

Isometric View No Works VBA

Hiii :)

I would do a very simple MACRO : "Fit All In" on Part, and Put view in Isometric.

Fit All In works, but VBA has a problem with Viewpoint3D Objet as PutSightDirection, VBA tell me "Objet not in Automation..."
I am on CATIA R2018, maybe there is a error now? Or I do a mistake....

I have Found a Method with Command Line, but sometime no works if I put 2 Command Lines in same Code... So I would like understand and make a good Code :)

Thx.

 

My Code:

 

Public Sub center_view_main()

If TypeName(CATIA.ActiveDocument) <> "PartDocument" Then
MsgBox "This program only works on a CATPart."
Exit Sub
End If

Dim oViewer As Viewer3D
Set oViewer = CATIA.ActiveWindow.ActiveViewer

oViewer.Reframe


Dim myViewpoint As Viewpoint3D
Set myViewpoint = oViewer.Viewpoint3D
myViewpoint.PutSightDirection Array(-0.577350258827209, -0.577350258827209, -0.577350258827209) ' No Works

CATIA.StartCommand "* iso"

End Sub

Little Cthulhu

RE: Isometric View No Works VBA
(in response to LECLERC Sebastien)

Well, it's a well-known problem. I have no doubt you would have found solution yourself if you used search.

 

Dim myViewpoint as Variant

LECLERC Sebastien

RE: Isometric View No Works VBA
(in response to Little Cthulhu)



En réponse à Little Cthulhu :

Eh bien, c'est un problème bien connu. Je ne doute pas que vous auriez trouvé une solution vous-même si vous aviez utilisé la recherche.

 

Dim myViewpoint en tant que variante

I use the search and find nothing about that... OnlyTOPIC of 2006.....

 

I use words :
- Isometric View
- Isometric
- VBA Error view
....

Find nothing.

 

What did you mean by "Error knows" pls?

Little Cthulhu

RE: Isometric View No Works VBA
(in response to LECLERC Sebastien)
VBA tell me "Objet not in Automation..."

 

No, it's not. It says "Function or interface marked as restricted" and this is exactly what you should have searched for.

LECLERC Sebastien

RE: Isometric View No Works VBA
(in response to Little Cthulhu)

Hummm oui tu es vrai xD

 https://v5vb.wordpress.com/2010/07/29/restricted-interfaces/

THX.

Edited By:
LECLERC Sebastien[Subscriber Members] @ Nov 02, 2021 - 08:15 AM (IDLW)