3D PLM Enterprise Architecture

3D Visualization

Visualizing Temporary Components

How to use the Interactive Set of Objects
Use Case

Abstract

A temporary component is a component which is not integrated into the data model of a V5 document. In most cases it is a simple component to help the understanding of an interactive command. The CAAVisTemporaryObjects use case [1] has explained how to create temporary components, the current one details how to use the interactive Set of Objects to visualize them. 

To take full advantage of this article, you can first read the technical article about the Interactive Set of Objects and the temporary components [2]. 


What You Will Learn With This Use Case

The main goal of this article is to show how to use the Interactive Set of Objects. The ISO enables you to visualize the temporary components, those not included in a V5 document. These components must implement either CATI2DGeoVisu or CATI3DGeoVisu. 

The ISO is a CATISO class instance which is associated with the editor (CATFrmEditor) of each V5 document. There are three kinds of ISO: normal, furtive (XOR drawing) and background. The first two are used in this use case.

Naturally, you will learn how to use the methods of the CATISO class to display or erase a component, but this article goes beyond to explain the life cycle of the graphic representation associated with the components.  

[Top]

The CAADegClippingByBoxCmd Use Case

CAADegClippingByBoxCmd is a use case of the CAADialogEngine.edu and CAAVisualization.edu frameworks that illustrates DialogEngine, ApplicationFrame, and Visualization frameworks capabilities.

[Top]

What Does CAADegClippingByBoxCmd Do

The CAADegClippingByBoxCmd use case is a state command [3] which displays temporary components to enhance the user interface. This command is a state command to remove all the points of the document outside a given box. This clipping box is defined by the end user: first, he/she defines its location by selecting an existing point. Then, from the selected point a first wire box is displayed, and he/she can drag the mouse to increase or decrease the size of the box.  

The state command creates three kinds of components: a text (right picture on Fig.1), a trihedral (middle picture on Fig.1) and a wire box (left picture on Fig.1) [1] and uses the ISO to visualize them. The first two are visualized in the normal ISO, and the last one in the furtive ISO. 

 
Fig.1 Temporary Components

The text is displayed when the command is activated. It is useless for the result of the command itself, it has been added to show how select a temporary component. 

Here it is the UML diagram [4] of the CAADegClippingByBoxCmd command.

[Top]

How to Launch CAADegClippingByBoxCmd

See the section entitled "How to Launch the CAAGeometry Use Case" in the "The CAAGeometry Sample" use case for a detailed description of how this use case should be launched. For the specific scenario:

Launch CATIA. When the application is ready:

After the selection, the text disappears

After the selection, the trihedral is displayed. 

[Top]

Where to Find the CAADegClippingByBoxCmd Code

The CAADegClippingByBoxCmd use case is made of the single class named CAADegClippingByBoxCmd located in the CAADegGeoCommands.m module of the CAADialogEngine.edu framework:

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

[Top]

Step-by-Step

There are seven main logical steps in CAADegClippingByBoxCmd:

  1. Retrieving the Normal and Furtive ISO
  2. Creating the Three Temporary Components
  3. Defining the State Chart Diagram
  4. Managing the Text Component 
  5. Managing the Trihedral Component
  6. Managing the Wire Box Component
  7. Erasing and Deleting the Three Temporary Components

[Top]

Retrieving the Normal and Furtive ISO

The interactive set of objects are managed by the CATFrmEditor class [5]. In the CAADegClippingByBoxCmd class constructor they are retrieved. 

...
  CATFrmEditor * pEditor   = GetEditor();
  ...
  _pFurtiveISO = pEditor->GetFurtiveISO() ;

  _pISO = pEditor->GetISO() ;
...

The GetEditor method of the CATStateCommand class, retrieves the current CATFrmEditor class instance. The GetISO method retrieves the "normal" ISO, and the GetFurtiveISO method the furtive ISO. _pISO and _pFurtiveISO are data members of the state command.

[Top]

Creating the Three Temporary Components

In the CAADegClippingByBoxCmd class constructor you will find the three creations.

...
  _pCenterBoxModel     = new CATModelForRep3D(); 

  ::CATInstantiateComponent("CAAVisWireBox",IID_CAAIVisWireBox,(void**)&_pIWireBox);

  ::CATInstantiateComponent("CAAVisTextModel",IID_CAAIVisTextModel,(void**)&_pITextToSelectModel);
...

_pCenterBoxModel, _pIWireBox, and _pITextToSelectModel are data members of the CAADegClippingByBoxCmd class. The first one is an instance of the trihedral component, the second one is an instance of the wire box component, and the last one is an instance of the text component. The referenced article [1] gives you the UML diagram of each one.

[Top]

Defining the State Chart Diagram

The CAADegClippingByBoxCmd class is a state command class. It implies that the state chart is defined in the BuildGraph method of the CATStateCommand class. Here it is an extract which shows the more interesting steps.

...
_daIndication = new CATIndicationAgent("Indication");
  
_daIndication->SetBehavior(CATDlgEngWithPrevaluation | CATDlgEngAcceptOnPrevaluate |
	                         CATDlgEngWithUndo);
	     

_daIndication is a CATIndicationAgent class instance kept as data member by the CAADegClippingByBoxCmd class. The CATDlgEngWithOnPrevaluation behavior enables us to be informed at each mouse movement, and consequently to increase or decrease the size of the clipping box. See the Managing Wire Box Component step. 

...
  _daTextSel = new CATPathElementAgent("SelText");
  _daTextSel->SetBehavior(CATDlgEngWithPSO | CATDlgEngWithPrevaluation);
  _daTextSel->AddElementType(IID_CAAIVisTextModel);
...

_daTextSel, a CATPathElementAgent pointer, is a data member of the CAADegClippingByBoxCmd class. The association of the CATDlgEngWithPSO and CATDlgEngWithPrevaluation behaviors enables us to have a visual feedback when an object is pre-selected (pre-highlight color). The AddElementType is the method to filter the selection. Using CAAIVisTextModel, only the components implementing this interface could be selected. This interface is only implemented on text component [1].

[Top]

Managing the Text Component

The text component ("ISO Selection") is managed as follows:

Here it is the detail of the parts own to the text component. 

A state command can be deactivated by a shared command, and once this command is completed, our command is reactivated [6]. The management of the text component, in this case, follows the same principle as into the undo/redo methods. When the command is deactivated the text is erased without its graphic representation destruction. So in case of re-activation of the state command, the text can be re-displayed without graphic representation reconstruction.

However, there is a little difference with the undo/redo step. In the Deactivation method, a check of the presence into the ISO of the text is done, it enables us in the re-activation method to avoid to re-display the text if it useless. 

Extract of the Desactivate method of the CAADegClippingByBoxCmd command:

...
if ( _pISO->IsMember(_pITextToSelectModel) )
{
   _pISO->RemoveElement(_pITextToSelectModel,1);  
   _TextModelToRestore = TRUE ;
}
...

The IsMember method enables us to keep the state of the text. _TextModelToRestore, a boolean value, will be then used in the Activate method. 

Extract of the Activate method of the CAADegClippingByBoxCmd command:

...
if ( TRUE == TextModelToRestore  )
{
   _pISO->AddElement(_pITextToSelectModel);
} 
...

The text is added in the ISO only if before the de-activation the text was displayed. You can note that there is no need to re-build the graphic representation of the _pITextToSelectModel component since in the deactivation method the last argument of the RemoveElement method is 1.

[Top]

Managing the Trihedral Component

The trihedral component is managed as follows:

Here it is the detail of the parts own to the trihedral component. 

When the state command is deactivated, the trihedral component must be erased. Here it is an extract of the  Desactivate method of the CAADegClippingByBoxCmd command:

[Top]

Managing the Wire Box Component

The wire box component is managed as follows:

Here it is the detail of the parts own to the wire box component. 

[Top]

Erasing and Deleting the Three Temporary Components

At the end of the command, in the CAADegClippingByBoxCmd destructor class, the three temporary components must be removed from the ISO and then deleted. 

In the Cancel method, the component are removed from the ISO. You do not have to test if the component already exists in the ISO, the RemoveElement method does it. 

...           
     _pISO->RemoveElement(_pITextToSelectModel);         
     _pISO->RemoveElement(_pCenterBoxModel);  

     _pFurtiveISO->RemoveElement(_pIWireBox);
      
...

_pISO and _pFurtiveISO are data members initialized in the Retrieving the Normal and Furtive ISO step.

In the destructor class, the component are deleted by releasing the handles:

...
     _pITextToSelectModel->Release();
 
     _pCenterBoxModel->Release();
    
     _pIWireBox->Release();    
...

_pITextToSelectModel, _pCenterBoxModel, and _pIWireBox are data members initialized in the Creating the Three Temporary Components step.

[Top]


In Short

This use case has explained how to use the main methods of the CATISO class:

[Top]


References

[1] Creating Temporary Components
[2] Interactive Set of Objects
[3] Getting Started with State Dialog Command
[4] Describing State Dialog Commands Using UML
[5] Understanding the Application Frame Layout 
[6] The CAA Command Model
[7] Using the Visualization Manager
[Top]

History

Version: 1 [Fev 2004] Document created
[Top]

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