3D PLM Enterprise Architecture |
User Interface - Frame |
Center Specification Tree NodesHow to center specification tree nodes ? |
Use Case |
AbstractThis article shows how to center nodes of the specification tree. |
This use case is intended to show you how to use the CATCafCenterGraph class that is used to center the node of a specification tree.
Top]
CAACafCenterGraph is a use case of the CAACATIAApplicationFrame.edu framework that illustrates CATIAApplicationFrame and ObjectModelerBase framework capabilities.
[Top]
CAACafCenterGraph contains a command that illustrates usage of the CATCafCenterGraph class. Once launched the command waits for a selection in the geometry, then makes use of the CATCafCenterGraph class to find and center the node associated to the selection in the geometry. The process can be repeated as long as the command is active.
![]() |
[Top]
To launch CAACafCenterGraph, you will need to set up the build time environment, then compile CAACafCenterGraph along with its prerequisites, set up the run time environment, and then execute the use case [4].
But just before launching the execution, edit the
CAAApplicationFrame.edu.dico interface dictionary file located in the dictionary
directory of the CAAApplicationFrame.edu framework:
Windows | InstallRootDirectory\CAADoc\CAAApplicationFrame.edu\CNext\code\dictionary\ |
UNIX | InstallRootDirectory/CAADoc/CAAApplicationFrame.edu/CNext/code/dictionary/ |
where InstallRootDirectory
is the directory where the CAA CD-ROM
is installed.
In this file, remove the "#" character before the two following lines, and then run mkCreateRuntimeView.
... #CAAAfrGeneralWksAddin CATIWorkbenchAddin libCAAAfrGeneralWksAddin #CAAAfrGeneralWksAddin CATIAfrGeneralWksAddin libCAAAfrGeneralWksAddin ... |
The two lines deal with the General workshop add-in described in the CAAAfrGeneralWksAddin use case [3] located in the CAAAfrGeneralWksAddin.m module (CAAApplicationFrame.edu framework)
Then, in the window where you run the mkrun command, do not type the module name on the command line, but type CNEXT instead. When the application is ready, do the following:
[Top]
The CAACafCenterGraph use case is made of two classes:
This CATStateCommand class enables the end user to expand and center nodes of the specification tree. The header file (.h) and the source file (.cpp) are located in the LocalInterfaces and src directories respectively. The source file is amply commented in this article.
Windows | InstallRootDirectory\CAADoc\CAACATIAApplicationFrm.edu\CAACafCenterGraph.m\ |
Unix | InstallRootDirectory/CAADoc/CAACATIAApplicationFrm.edu/CAACafCenterGraph.m/ |
where InstallRootDirectory
is the directory where the CAA
CD-ROM is installed.
This class, not detailed there, defines add-in of the General workshop. This add-in contains the Center Graph Demonstrator command.Refer to the Where to Find the CAAAfrGeneralWksAddin Code section of the CAAAfrGeneralWksAddin [3] use case for details.
[Top]
There are two logical steps in CAACafCenterGraph :
[Top]
As usual the BuildGraph
method is divided in three parts:
... _daObjectToCenterNode = new CATPathElementAgent("SelObjectToCenterNodeId"); _daObjectToCenterNode->AddElementType(IID_CATINavigateObject); _daObjectToCenterNode->SetBehavior(CATDlgEngRepeat | CATDlgEngNewHSOManager | CATDlgEngWithPSOHSO ); CATDialogState *stGetObjState = GetInitialState("stGetObjStateId"); stGetObjState->AddDialogAgent(_daObjectToCenterNode); CATDialogTransition *pTransition = AddTransition ( stGetObjState, stGetObjState, IsLastModifiedAgentCondition(_daObjectToCenterNode) , Action((ActionMethod) & CAACafCenterGraphCmd::CenterGraphOnObject) ); ... |
_daObjectToCenterNode
is an acquisition agent to select an
object in the specification tree or in 3D. After the selection, the object is highlighted (specify by the CATDlgEngWithPSOHSO
behavior). The CATDlgEngRepeat
behavior enables you to re-use the
agent without reinitializing it. The CATDlgEngNewHSOManager
empties the HSO
before each selection.
This state command has only one state, stGetObjState
,
whose name is stGetObjStateId
.
When the end user selects a valid element, the unique transition is triggered
and the CenterGraphOnObject
method is called.
[Top]
The first part of the CenterGraphOnObject
method consists
in retrieving the CATNavigBox
instance corresponding to the tree
you want to center. In the case of this sample it is the specification tree of
the window.
... // Retrieves the current window CATFrmLayout * pLayout = CATFrmLayout::GetCurrentLayout(); if ( NULL == pLayout ) return TRUE; CATFrmWindow * pCurrentWindow = pLayout->GetCurrentWindow(); if ( NULL == pCurrentWindow ) return TRUE; // If it is a CATFrmNavigGraphicWindow, it is possible to // retrieve a CATNavigBox pointer // if ( 1 != pCurrentWindow->IsAKindOf("CATFrmNavigGraphicWindow") ) return TRUE; CATFrmNavigGraphicWindow * pFrmNavigGraphicWindow = (CATFrmNavigGraphicWindow*) pCurrentWindow ; CATNavigBox * pNavigBox = NULL ; pNavigBox = pFrmNavigGraphicWindow->GetNavigBox(); ... |
Then the actual job is done by instanciating a CATCafCenterGraph
class and calling the CenterGraph method on it.
... CATCafCenterGraph CenterGraphObj; CenterGraphObj.CenterGraph("OnHSO",pNavigBox); ... |
The first argument is "OnHSO" because we want to center
the tree on the
highlighted object. The second argument is the pointer to the CATNavigBox
instance
that was retrieved in the first part of the method.
For information, please note that actual code run by the "CenterGraph" method is the same as the one run by the interactive command "Center Graph" that can be found in V5 in object contextual menu.
[Top]
This use case explains how to find and center an element of the specification tree in the window.
[Top]
[1] | The Object Navigator |
[2] | Getting Started with State Dialog Commands |
[3] | Making Your Document Independent Command Available in All Workbenches |
[4] | Building and Launching a CAA V5 Use Case |
[Top] |
Version: 1 [March 2006] | Document created |
[Top] |
Copyright © 2006, Dassault Systèmes. All rights reserved.