Mechanical Modeler

Managing Create Datum Mode

Using CATIMmiPartInfrastructurePreferencesAtt
Use Case

Abstract

This article shows to use the CATIMmiPartInfrastructurePreferencesAtt interface to control yourself the datum mode [1] when creating a mechanical feature.


What You Will Learn With This Use Case

This use case, an interactive command, is intended to show you how to use the CATIMmiPartInfrastructurePreferencesAtt to manage the CreateDatum mode

[Top]

The CAAMmrCreateDatumMode Use Case

CAAMmrCreateDatumMode is a use case of the CAAMechanicalModeler.edu framework that illustrates MecModInterfaces framework capabilities.

[Top]

What Does CAAMmrCreateDatumMode Do

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

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]

How to Launch CAAMmrCreateDatumMode

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.

Addin Access

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]

Where to Find the CAAMmrCreateDatumMode Code

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]

Step-by-Step

There are five logical steps in CAAMmrCreateDatumMode:

  1. Retrieving the Component Managing the Datum Mode
  2. Adding Callback to be Informed of Datum Mode Modification
  3. Refreshing the Dialog Box
  4. Modify the Current Datum Mode
  5. Removing Callback

[Top]

Retrieving the Component Managing the Datum Mode

...
   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]

Adding Callback to be Informed of Datum mode Modification

...
    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.

Refreshing the Dialog Box

This method is called by two methods of the dialog box

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.

Modify the Current Datum Mode

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:

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.

Removing Callback 

...
      ::RemoveSubscriberCallbacks(this,_piCATIMmiCreateDatumSettingAtt);
...

In the dialog box destructor method.

[Top]


In Short

The CATIMmiPartInfrastructurePreferencesAtt interface enables you to retrieve the current datum mode and to modify it.

[Top]


References

[1] The Contents of the Specification Container - Geometrical Feature
[2] Creating an Add-in
[3] Building and Launching a CAA V5 Use Case
[Top]

History

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