Lifecycle Applications

Engineering Change Management

The Attachments Interface

Adding and Removing Attachments
Use Case

Abstract

This article shows how to use the ENOVICWAttachments interface of the ENOVInterfaces framework to add and remove existing object as an attachment for a Change Management object such as an Engineering Change Order, Action or Engineering Change Request.


What You Will Learn With This Use Case

This use case is intended to show you how to add and remove an existing object, in this case a part version, to an existing Engineering Change Order as an attachment. The technique is the same for Actions and Engineering Change Request.Attachments are usually connected to objects as a reference or for information purposes. An attachment can be almost anything including documents, links, parts, or other Engineering Change Orders and Actions. The ENOVInterfaces framework contains the interface ENOVICWAttachments which allows you to directly add an attachment to and remove from a Change Management object.

[Top]

The CAAEviAttachments Use Case

CAAEviAttachments is a use case of the CAAENOVInterfaces.edu framework that illustrates how you use the ENOVICWAttachments interface to add an attachment to and remove from an existing Engineering Change Order.

[Top]

What Does CAAEviAttachments Do?

CAAEviAttachments begins by opening a VPM session and creating a login a session. Then the Eco Manager is retrieved. To set up the demonstration, an ECO is created with the necessary parameters as well as a part version. For more information on how to create an ECO, refer to use case CAAEviEcoManager. After the necessary objects are created, the subject interface is used to add the part version to the ECO as an attachment. Then the attachment is subsequently removed from the ECO.

The ENOVInterfaces interface/methods shown here is:

[Top]

How to Launch CAAEviAttachments

To launch CAAEviAttachments, you will need to set up the build time environment, then compile CAAEviAttachments.cpp along with its prerequisites, set up the run time environment, and then execute the use case. The required interfaces can be found in the ENOVInterfaces, VPMInterfaces, VPMPersistency, System, and VPMTpManager frameworks. From the directory where the executable file is stored, enter"CAAEviAttachments" to execute the program. [1].

[Top]

Where to Find the CAAEviAttachments Code

The CAAEviAttachments use case is made of a single file located in the CAAEviAttachments.m module of the CAAENOVInterfaces.edu framework:

Windows InstallRootDirectory\CAAENOVInterfaces.edu\CAAEviAttachments.m\
Unix InstallRootDirectory/CAAENOVInterfaces.edu/CAAEviAttachments.m/

where InstallRootDirectory is the directory where the CAA CD-ROM is installed.

[Top]

Step-by-Step

For demonstration purposes, the code from the CAAEviAttachments use case is shown here. After the preliminary set up of creating the ECO and part version, there are two logical steps:

[Top]

Add attachment to an ECO

    #include "ENOVICWAttachments.h"
    #include "CATIVpmAFLAttachment.h"
    #include "CATUnicodeString.h"
    

These include statements give access to the interfaces demonstrated here.

  //--- Add a Part Version as an Attachment to ECO
  
    CATUnicodeString AttName("MyAttachment");
    CATUnicodeString Description("This is a CAA Attachment");
    CATIVpmAFLAttachement_var AttObj = NULL_var;
    ENOVICWAttachments_var spAtt(Eco);
        
    rc = spAtt->AddNewAttachment(AttName, 
        			 Description,
    				 partVersion,  
    				 AttObj);
    
    if (AttObj==NULL_var||!SUCCEEDED(rc))
    {
    	cout << "ERROR in Adding Attachment." << endl << flush;    
    	VPMSession::CloseSession();
    	return 7;
    }

    cout << "Added Attachment succesfully." << endl << flush;     
      

 

  1. After the VPM session is opened, and the ECO and part version created, you can use the ENOVICWAttachments interface to add the attachment to the ECO.
  2. Then, the ECO object, Eco, is cast as a ENOVICWAttachment type - spAtt.
  3. With the description and attachment name set, spAtt calls method AddNewAttachment.
  4. The method returns S_OK if successful and the attachment object AttObj is created.

[Top]

Remove attachment from an ECO

    #include "ENOVICWAttachments.h"
    #include "CATIVpmAFLAttachment.h"
    

These include statements give access to the interfaces demonstrated here.

  //--- Remove Attachment from ECO
  
    rc = spAtt->RemoveAttachment(AttObj);
    if (!SUCCEEDED(rc))
    {
    	cout << "ERROR in Removing Attachment." << endl << flush;    
    	VPMSession::CloseSession();
    	return 8;
    }

    cout << "Removed Attachment succesfully." << endl << flush;  
      

 

  1. With the ECO cast as a ENOVICWAttachment smart pointer - spAtt, method RemoveAttachment is called.
  2. The method returns S_OK if successful and the attachment object AttObj is removed from the ECO.

[Top]


In Short

Use the ENOVICWAttachments interface available in the ENOVInterfaces framework to add or remove an existing object as an attachment for Change Management objects (ECOs, Actions, ECRs).

[Top]


References

[1] Building and Launching a CAA V5 Use Case
[Top]

History

Version: 1 [Feb 2002] Document created
[Top]

Copyright © 1994-2002, Dassault Systèmes. All rights reserved.