Catalog Modeler |
Instantiating a Catalog ComponentUsing CATICatalogDescription to make an instantiation |
|
Use Case |
AbstractThis use case shows how to instantiate a catalog component. |
One interest of a catalog is to instantiate its components. A component can be
If the use case CAAMmrCatalogIntegration [1] explains how to integrate a new type of component in a catalog document, this use case details how to instantiate it.
The instantiation must be done in using the RunInstantiationCmd
method of the CATICatalogDescription interface. In most cases this method
launches an interactive command to create the new component. It means that an
instantiation can only be done during an interactive session. For some
component, a "direct" instantiation can be done, in using its own
mechanism of instantiation.
Before getting to the use case itself, it is important to already be familiar with the basic notions of Catalog. See the referenced article [2] for a detailed overview.
[Top]
CAAMmrCatalogInstantiation is a use case of the CAAMechanicalModeler.edu framework that illustrates ComponentsCatalogsInterfaces framework capabilities.
[Top]
This use case is an extract of the CAAMmrCatalogBrowser use case [3].
This use case creates a command which launches a dialog box [Fig.1]
to demonstrate the usage of the Catalog Browser. On this dialog box the last
frame "Current Selection
" enables to display the selected
description, and when it is an instantiable component, the "Launch
"
button is available. The aim of this use case is to explain the contents of the
callback method called when the end user clicks on the Launch
button.
[Top]
To launch CAAMmrCatalogInstantiation , you will need to
CAAMmrCatalogPrdAddin CATIWorkbenchAddin libCAAMmrCatalogProductAddin CAAMmrCatalogPrdAddin CATIPrsConfigurationAddin libCAAMmrCatalogProductAddin |
(*) The file is located in the directory CAAMechanicalModeler.edu/InputData
InstallRootDirectory/CAAMechanicalModeler.edu/InputData
InstallRootDirectory\CAAMechanicalModeler.edu\InputData
where InstallRootDirectory
is the directory where the CAA CD-ROM
is installed.
[Top]
The CAAMmrCatalogInstantiation use case is an extract of the CAAMmrBrowserCmdPanel class located in the CAAMmrCatalogUI.m module of the CAAMechanicalModeler.edu framework:
Windows |
InstallRootDirectory\CAAMechanicalModeler .edu\CAAMmrCatalogUI.m\ |
Unix | InstallRootDirectory/CAAMechanicalModeler.edu/CAAMmrCatalogUI.m/ |
where InstallRootDirectory
is the directory where the CAA CD-ROM
is installed.
[Top]
LaunchInstantiation
is a callback method on the CAAMmrBrowserCmdPanel
class [1]. This class contains _pICatalogBrowser
as data member. It is a CATICatalogBrowser interface pointer on
the current opened Catalog browser.
void CAAMmrBrowserCmdPanel::LaunchInstantiation(CATCommand* iFrom, CATNotification* iNotif, CATCommandClientData iData) { if ( NULL != _pICatalogBrowser ) { CATICatalogDescription * piCatalogDesc = NULL ; HRESULT rc = _pICatalogBrowser->GetSelectedDescription (piCatalogDesc); if (SUCCEEDED(rc)) { int RepeatMode = 0 ; int InstantiateMode = 1 ; rc = piCatalogDesc->RunInstantiationCmd( _pICatalogBrowser, InstantiateMode, RepeatMode); ... } |
On this CATICatalogBrowser interface pointer the selected description
is retrieved thanks to the GetSelectedDescription
method. piCatalogDesc
is a CATICatalogDescription interface pointer on the selected description
in the Catalog browser.
Once we have this CATICatalogDescription interface pointer, call
the RunInstantiationCmd
method to launch the instantiation.
In this use case, the arguments of this global function are the following:
About the InstantiateMode value: In most case the instantiation mode is 0. For a Part it is possible to choose between:
Advice: If you are in an interactive session, but that you retrieve a
description outside a Catalog Browser selection, in the CATCci
RunInstantiation
global function set NULL
for the CATICatalogBrowser
interface pointer.
The pseudo-code for the RunInstantiationCmd
method is the
following:
NotDone = 1; HESULT rc = Current Workbench -> QI (CATICatalogInstantiation,pICatalogInstantiationOnCurrentWbench) if ( OK) { pICatalogInstantiationOnCurrentWbench->RunInstantiationCmd(...,NotDone) } if (NotDone) { HESULT rc = Current Workshop -> QI (CATICatalogInstantiation,pICatalogInstantiationOnCurrentWshop) if ( OK) pICatalogInstantiationOnCurrentWshop->RunInstantiationCmd(...,NotDone) } if (NotDone) { HESULT rc = DescriptionComponent -> QI (CATICatalogInstantiation,pICatalogInstantiationOnComponent) if ( OK) pICatalogInstantiationOnComponent->RunInstantiationCmd(...,NotDone) } |
Before to call the RunInstantiationCmd
method of the CATICatalogInstantiation
on the component contained in the description, the CATICatalogDescription
::RunInstantiationCmd
method calls this method on the current workbench and the current workshop if
they implement this interface.
[Top]
This use case illustrates how to instantiate a component catalog in using the
RunInstantiationCmd
method of the CATICatalogDescription
interface.
[Top]
[1] | Integrating a New Type of Component |
[2] | Catalog Overview |
[3] | Using the Catalog Browser |
[Top] |
Version: 1 [Jul 2002] | Document created |
[Top] |
Copyright © 2002, Dassault Systèmes. All rights reserved.