Mechanical Modeler |
Managing Create Datum ModeUsing CATIMmiPartInfrastructurePreferencesAtt |
|
Use Case |
AbstractThis article shows to use the CATIMmiPartInfrastructurePreferencesAtt interface to control yourself the datum mode [1] when creating a mechanical feature. |
This use case, an interactive command, is intended to show you how to use the CATIMmiPartInfrastructurePreferencesAtt to manage the CreateDatum mode
[Top]
CAAMmrCreateDatumMode is a use case of the CAAMechanicalModeler.edu framework that illustrates MecModInterfaces framework capabilities.
[Top]
The use case is functionaly similar to the CreateDatum Setting command, that
you can retrieve in Generative Shape Design application
.
The scenario to reach the command is the following:
Fig.2 CAAMmrCreateDatumMode Dialog Box
- First line: On the right top, you have the current value of the datum mode
- Second line: a combo to select the new mode, and a push button (Apply) to modify the current mode. Push Apply button modify the editor just above.
Now some scenarios to understand the meaning of each type of datum mode.
This scenario shows that the datum mode is kept by a setting (data model), and whatever can get or set the value kept by the data model. In case of modification, the model sends an event, and whatever has set callback can be informed of the model's modification.
[Top]
To launch CAAMmrCreateDatumMode, you will need to set up the build time environment, then compile CAAMmrCreateDatumMode along with its prerequisites, set up the run time environment, and then execute the use case .
See the What Does CAAMmrCreateDatumMode Do Section for the scenario.
Before launching CATIA, Remove the # character in the CAAMechanicalModeler.edu.dico in front of the following line:
... #CAA# CAAMmrSettingsAddIn CATIWorkbenchAddin libCAAMmrSettingsAddIn #CAA# CAAMmrSettingsAddIn CATIShapeDesignWorkshopAddin libCAAMmrSettingsAddIn ... |
[Top]
The CAAMmrCreateDatumMode use case is made of several classes located in two modules:
It contains the CAAMmrCreateDatumMode Dialog box [Fig.2] definition CAAMmrDatumWindowCmd.cpp/CAAMmrDatumWindowCmd.h
It contains the addin of the Generative Shape Design Workbench - This addin contains the definition of the "Use Create Datum Mode" [Fig.1] toolbar
This part is not described in the article. Refer to the reference article Creating an Add-in [2]
These two modules are located inside
InstallRootDirectory\ CAAMechanicalModeler.edu\ |
where InstallRootDirectory
[3] is the directory where the CAA CD-ROM
is installed.
[Top]
There are five logical steps in CAAMmrCreateDatumMode:
[Top]
... HRESULT rc = S_OK; rc = ::CATInstantiateComponent ("CATMmuPartInfrastructurePreferencesCtrl", IID_CATIMmiPartInfrastructurePreferencesAtt, (void**) &_piCATIMmiCreateDatumSettingAtt); ... |
_piCATIMmiCreateDatumSettingAtt
is a data member of the CAAMmrCreateDatumMode
dialog box. It is a CATIMmiPartInfrastructurePreferencesAtt interface
pointer on the CATMmuPartInfrastructurePreferencesCtrl
component.
[Top]
... CATCallbackEvent eventName=""; _piCATIMmiCreateDatumSettingAtt->GetDatumModeEvent(eventName); ::AddCallback(this, _piCATIMmiCreateDatumSettingAtt,eventName, (CATSubscriberMethod)&CAAMmrDatumWindowCmd::ReceiveDatumModify, NULL); ... |
Thanks the GetDatumModeEvent
method you retrieve the name of the
event which will be sent by the CATMmuPartInfrastructurePreferencesCtrl
component when someone will modify the datum mode. The ReceiveDatumModify
is a method of the dialog box refreshing the dialog box.
This method is called by two methods of the dialog box
The ReceiveDatumModify
method ( due to a callback)This method (InitWindow) retrieves the current datum mode, and modify the right top editor [Fig.2]
... CATIMmiPartInfrastructurePreferencesAtt::PreferenceMode TheMode ; rc = _piCATIMmiCreateDatumSettingAtt->GetDatumMode(TheMode); ... |
The editor is modified according to the value of the GetDatumMode
method results.
In the constructor, not detailed here, we have set a callback to be informed
when the end user push the Apply button. This callback is a method (Apply
method) whose the
principle is the following:
... int LineSelected = _pDatumChoice->GetSelect() ; _pDatumChoice->GetLine(usParam[1],LineSelected); ... |
... CATIMmiPartInfrastructurePreferencesAtt::PreferenceMode TheMode ; ... rc = _piCATIMmiCreateDatumSettingAtt->SetDatumMode(TheMode); ... |
TheMode
is valuated according to the value returned by the combo (LineSelected
)
Note that the internal method (InitWindow
) is not directly
called by the Apply
method. Since the SetDatumMode
method is called, the CATMmuPartInfrastructurePreferencesCtrl
component sends a Modify event, and the
ReceiveDatumModify
method is called.
... ::RemoveSubscriberCallbacks(this,_piCATIMmiCreateDatumSettingAtt); ... |
In the dialog box destructor method.
[Top]
The CATIMmiPartInfrastructurePreferencesAtt interface enables you to retrieve the current datum mode and to modify it.
[Top]
[1] | The Contents of the Specification Container - Geometrical Feature |
[2] | Creating an Add-in |
[3] | Building and Launching a CAA V5 Use Case |
[Top] |
Version: 1 [Mar 2007] | Document created |
[Top] |
Copyright © 1999-2006, Dassault Systèmes. All rights reserved.
Special Notices
CAA V5 CATIA |
CAA V5 DELMIA |
CAA V5 ENOVIA