ENOVIA V6 Integration

Saving Documents into ENOVIA V6


The following Use Cases show how to use CD5 Automation Objects to perform Save operations from CATIA V5 to ENOVIA V6.

The basic object for Save Operation is CD5SaveOperation, which is created from the CD5EngineV6R2014x object and can target the active document as well as the whole session.

It will be possible to customize the CD5SaveOperation to globally modify its behavior: manage not saved documents, save into ENOVIA folders, retain Lock / create a new Version for all the items in the scope of the operation.

It will also be possible to customize it at item level: rename an embedded component, target a specific/next revision, include/exclude from the operation.

Finally, it will be possible to run the operation silently or to open the advanced save panel as per the customization done so far and let the user validate it manually.

Prerequisites:

Some documents are loaded in CATIA session.

 

This use case will first describe the preliminary steps:

It will then go through following capabilities:

  1. Perform a Quick Save (provided the documents are saved on disk)
  2. Manage non saved documents
  3. Configure Retain Lock
  4. Configure Create/Override Version
  5. Define target revisions
  6. Rename embedded components
  7. Include/Exclude an item from the operation
  8. Generate Custom Derived Outputs
  9. Present a pre-filled Advanced Save dialog

Retrieve CD5EngineV6R2014x object

  ...
    ' Get CD5Engine
    Dim CD5Engine As CD5EngineV6R2014x
    Set CD5Engine = CATIA.GetItem("CD5EngineV6R2014x")
  ...

The entry point of the ENOVIA V6 Integration is the "ENOVIA V6 Integration Engine".
This object is retrieved using the GetItem method of CATIA object.

Connect to ENOVIA V6

  ...
    ' Connect to ENOVIA V6 (if not already connected)
    Dim IsAlreadyConnected As Boolean
    IsAlreadyConnected = CD5Engine.IsConnected
    If ( Not IsAlreadyConnected ) Then
        ' Connect with login, password, security context
        CD5Engine.Connect "MyUser","MyPassword","VPLMLeader.Company Name.Standard"
    End If
  ...

ENOVIA V6 Integration supports the connection without specifying a security context. In this case the default one is used.
Here we first check if CATIA is already connected to ENOVIA V6. If this is not the case then we perform the connection.

Create basic object for Save Operation

  ...
    ' Create a Save Operation object on the whole CATIA session
    Dim oCD5SaveOperation As CD5SaveOperation
    Set oCD5SaveOperation = CD5Engine.CreateSaveOperation(CD5SaveOperation_Session)
  ...

It is also possible to target the active document only (CD5SaveOperation_ActiveDocument) or its window (CD5SaveOperation_CurrentEditor).

Perform a Quick Save (provided the documents are saved on disk)

  ...
    ' Run the Save Operation with default options (Quick Save)
    oCD5SaveOperation.Run()
  ...

This is equivalent to menu item ENOVIA V6 -> Save.

Manage non saved documents

  ...
    ' Authorize the Save Operation object to Save documents on Disk
    oCD5SaveOperation.AllowDiskSave = True
	
    ' Run the Save Operation
    oCD5SaveOperation.Run()
  ...

This way it is not a prerequisite to save documents on disk before performing the Save.

Configure Retain Lock

  ...
    ' Retain Lock on all the items
    oCD5SaveOperation.RetainLock = True
	
    ' Run the Save Operation
    oCD5SaveOperation.Run()
  ...

Configure Create/Override Version

  ...
    ' Create new version on all items in the scope of the Save Operation
    oCD5SaveOperation.CreateVersion = True
	
    ' Run the Save Operation
    oCD5SaveOperation.Run()
  ...

NB: To override versions, this property should be set to False.

Define target revisions

  ...
    ' Get the list of items targeted by the Save Operation
    Dim oCD5SaveItems As CD5SaveItems
    Set oCD5SaveItems = oCD5SaveOperation.Items
	
    ' Get the first item
    Dim oFirstItem As CD5SaveItem
    Set oFirstItem = oCD5SaveItems.Item(1)
	
    ' case 1: target a custom revision
    oFirstItem.Revision = "H"
	
    ' case 2: target next revision
    oFirstItem.Revision = oFirstItem.NextRevision

    ' Run the Save Operation
    oCD5SaveOperation.Run()	
  ...

The target revision can be customized or set to the next revision.

Rename embedded components

  ...
    ' Get the available Autoname Series from the Engine
    Dim myANSeries As CATBSTR
    myANSeries = CD5Engine.GetAutonameSeries("CATIA Embedded Component")(0)

    ' Get the list of items targeted by the Save Operation
    Dim oCD5SaveItems As CD5SaveItems
    Set oCD5SaveItems = oCD5SaveOperation.Items

    ' Loop on all items
    For i=1 To oCD5SaveItems.Count

        ' Get the item at position i
        Dim oCurrentItem As CD5SaveItem
        Set oCurrentItem = oCD5SaveItems.Item(i)

        ' Rename it if it is an embedded component
        If ( (oCurrentItem.Type = "CATIA Embedded Component") And (oCurrentItem.Status = CD5SaveItem_ECNameNotUnique) ) Then
            oCurrentItem.ObjectName = oCD5Engine.GenerateAutoname(myANSeries,1)(0)
        End If

    Next

    ' Run the Save Operation
    oCD5SaveOperation.Run()	
  ...

It is also possible to enter a custom string for oCurrentItem.ObjectName.

Include/Exclude an item from the operation

  ...
    ' Get the list of items targeted by the Save Operation
    Dim oCD5SaveItems As CD5SaveItems
    Set oCD5SaveItems = oCD5SaveOperation.Items
	
    ' Get the second item
    Dim oSecondItem As CD5SaveItem
    Set oSecondItem = oCD5SaveItems.Item(2)
	
    ' Exclude item from the Save Operation
    oSecondItem.Included = False
	
    ' Run the Save Operation
    oCD5SaveOperation.Run()	
  ...

To include an item into the Save operation, this property should be set to True.

Generate Custom Derived Outputs

  ...
    ' Get the list of items targeted by the Save Operation
    Dim oCD5SaveItems As CD5SaveItems
    Set oCD5SaveItems = oCD5SaveOperation.Items
	
    ' Get the first item
    Dim oFirstItem As CD5SaveItem
    Set oFirstItem = oCD5SaveItems.Item(1)
		
    ' Get the list of all possible derived outputs for this item
    Dim oPossibleDerivedOutputs As CATSafeArrayVariant
    oPossibleDerivedOutputs = oFirstItem.PossibleDerivedOutputs

    ' Generate all possible derived outputs for this item
    oFirstItem.DerivedOutputs = oPossibleDerivedOutputs
	
    ' Run the Save Operation
    oCD5SaveOperation.Run()	
  ...

It is also possible to enter a custom string for oCurrentItem.ObjectName.

Present a pre-filled Advanced Save dialog

  ...
    ' Open Advanced Save Panel as per all the customizations performed so far on the Save Operation
    oCD5SaveOperation.ShowPanel()
  ...

This will replace the oCD5SaveOperation.Run() call as the Save Operation itself will be performed once the user has validated the Save panel with OK button.

[Top]


In Short

This use case has shown how to use ENOVIA V6 Integration Save functionality.

[Top]


References

[Top]

Copyright © 2013, Dassault Systèmes. All rights reserved.