Search code examples
vbacatia

Catia Start command reframe on and align plane


I am trying to create a program for automated screen capture in catia. For that I have to create a plane align camera to that plane and then reframe the camera to that plane. So i used the following code.

Dim selection1 as selection

Set Selection1=partdocument1.selection

selection1.add hybridshapeplanetangent1

Catia.startcommand("Normal View")

catia.refreshdisplay=true

selection1.clear

selection1.add hybridshapeplanetangetn1

Catia.startcomand("Reframe On")

Catia.RefreshDisplay= true

In this code normal to the plane is not working and it is only reframing I tried using Do events Catia.RefreshDisplay= true wait


Solution

  • If you have the setting for "Tools->Options->General->Display->Navigation->Animation during viewpoint modification" turned on (the default) CATIA will probably execute the "Reframe On" command before it is done with the "Normal View" command. This will appear like the "Normal View" command was not executed.

    You can turn off this setting manually, or let your code do it before you do view manipulations like this:

    Dim controllers
    Set controllers = CATIA.SettingsControllers
    Dim attr
    Set attr = controllers.Item("CATVizVisualizationSettingCtrl")
    attr.ViewpointAnimationMode = false
    
    ... your code here ...
    
    attr.ViewpointAnimationMode = true