Machining |
All Machining workbenches |
Managing (User Defined) Features Referencing Axis SystemsImplementing the CATIMfgMappingForMachiningAxis interface |
Use Case |
AbstractThis article discusses the CAAMaiUdfForMachiningAxis use case and explains how to implement the CATIMfgMappingForMachiningAxis manufacturing interface. |
This use case is intended to help you to use Machining Axis Systems from User Defined Feature data, by implementing the CATIMfgMappingForMachiningAxis manufacturing interface. This involves the following:
[Top]
CAAMaiUdfForMachiningAxis is a use case of the CAAManufacturingItf.edu framework in the CAAMaiUserDefFeatureMapping.m module that illustrates ManufacturingInterfaces framework capabilities.
[Top]
CAAMaiUdfForMachiningAxis illustrates an implementation of CATIMfgMappingForMachiningAxis interface for the User Defined Features identified by the UdfFeature type. This implementation enables to set the Axis System of a Machining Axis System Change defined in the Machining Process. A such implementation can be done to any feature that is used as input of the Machining Process instantiation window.
[Top]
To use CAAMaiUdfForMachiningAxis, you will need to:
Windows | InstallRootDirectory\CAADoc\CAAManufacturingItf.edu\CNext\code\dictionary\ |
Unix | InstallRootDirectory/CAADoc/CAAManufacturingItf.edu/CNext/code/dictionary/ |
where InstallRootDirectory
is the directory where the CAA
CD-ROM is installed, and decomment the following line by removing the '#'
character:
UdfFeature CATIMfgMappingForMachiningAxis libCAAMaiUserDefFeatureMapping
Windows | InstallRootDirectory\CAADoc\CAAManufacturingItf.edu\CNext\resources\graphic\ |
Unix | InstallRootDirectory/CAADoc/CAAManufacturingItf.edu/CNext/resources/graphic/ |
[Top]
The CAAMaiUdfForMachiningAxis use case is made of a class named CAAMaiUdfForMachiningAxis located in the CAAMaiUserDefFeatureMapping.m module of the CAAManufacturingItf.edu framework:
Windows | InstallRootDirectory\CAADoc\CAAManufacturingItf.edu\ CAAMaiUserDefFeatureMapping.m |
Unix | InstallRootDirectory/CAADoc/CAAManufacturingItf.edu/ CAAMaiUserDefFeatureMapping.m |
where InstallRootDirectory
is the directory where the CAA CD-ROM
is installed.
[Top]
There are three logical steps in CAAMaiUdfForMachiningAxis:
We now comment each of those sections by looking at the code.
[Top]
The CAAMaiUdfForMachiningAxis.cpp file uses the "CATIUdfFeatureInstance" interface to access to the User Defined Feature information - then, the right data is accessed by its right role name - and the "CATIMfgMappingRuleName" interface to access to "mapping rule name" tag which defines the using context of the feature . See below a part of the implementation:
This part of code enables to access to the "mapping rule name" defined in the operation of machining process
... //---------------------------------------------------------------------- // Read the mapping rule name associated to the operation //---------------------------------------------------------------------- CATUnicodeString MappingRuleName = ""; CATIMfgMappingRuleName *piMappRuleName = NULL; RetCode = this->QueryInterface(IID_CATIMfgMappingRuleName,(void **)&piMappRuleName); if (SUCCEEDED(RetCode) && NULL != piMappRuleName) { MappingRuleName = piMappRuleName->GetMappingRuleName(); piMappRuleName->Release(); piMappRuleName = NULL; } ... |
Then, when executing Catia, the value of the MappingRuleName variable can be "AxialUdfWithAxisMap" corresponding to the Machining Process definition
According to this variable, the implementation is looking for the right User Feature geometry:
... CATUnicodeString GeometryName; if (MappingRuleName == "AxialUdfWithAxisMap") { GeometryName = "..."; } else GeometryName = "..."; } CATBaseUnknown_var Geometry; if (SUCCEEDED(RetCode)) { CATBaseUnknown *piUdf = NULL; RetCode = this->QueryInterface(IID_CATBaseUnknown,(void **)&piUdf); if (SUCCEEDED(RetCode) && NULL != piUdf) { RetCode = CAAMaiUdfUtilities::GetUdfGeometry (piUdf, GeometryName, Geometry); piUdf->Release(); piUdf = NULL; } } ... // Generic method to get a User Feature geometry from its role name HRESULT CAAMaiUdfUtilities::GetUdfGeometry (CATBaseUnknown * iUdf, CATUnicodeString iGeometryName, CATBaseUnknown_var &oGeometry) { oGeometry = NULL_var; HRESULT RC = E_FAIL; if (NULL == iUdf) return RC; //-------------------------------------------------------------------------- // Get your object as a CATIUdfFeatureInstance //-------------------------------------------------------------------------- CATIUdfFeatureInstance *piUdfFeatureInstance = NULL; RC = iUdf->QueryInterface(IID_CATIUdfFeatureInstance,(void **)&piUdfFeatureInstance); //-------------------------------------------------------------------------- // Your object is a CATIUdfFeatureInstance: we can use the associated methods //-------------------------------------------------------------------------- if (SUCCEEDED(RC) && NULL != piUdfFeatureInstance) { CATUnicodeString role = ""; CATBaseUnknown_var spGeom; //---------------------------------------------------------------------- // Read the Inputs number: this is the geometrical inputs of your Udf // defined when creating the Udf template //---------------------------------------------------------------------- int InputNb = 0; RC = piUdfFeatureInstance->GetInputsNumber(InputNb); int i = 1; while (SUCCEEDED(RC) && i <= InputNb && role != iGeometryName) { RC = piUdfFeatureInstance->GetInputRole(i, role); //---------------------------------------------------------------------- // The right Input is found //---------------------------------------------------------------------- if (role == iGeometryName) { RC = piUdfFeatureInstance->GetInput(i,spGeom); } i++; } //---------------------------------------------------------------------- // The right Input was not found //---------------------------------------------------------------------- if (FAILED(RC) || role != iGeometryName) { //---------------------------------------------------------------------- // Analyse the Outputs : this is the geometrical outputs of your Udf // added in the Outputs List when creating the Udf template //---------------------------------------------------------------------- CATListValCATBaseUnknown_var * oOutputs = NULL; CATIUdfFeatureUser *piUdfFeatureUser = NULL; RC = iUdf->QueryInterface(IID_CATIUdfFeatureUser,(void **)&piUdfFeatureUser); if (SUCCEEDED(RC) && NULL != piUdfFeatureUser) { //---------------------------------------------------------------------- // Read the Outputs list //---------------------------------------------------------------------- piUdfFeatureUser->GetOutputs (oOutputs); int OutputNb = 0; if (NULL != oOutputs) OutputNb = oOutputs->Size(); //---------------------------------------------------------------------- // At least, one output is available //---------------------------------------------------------------------- if (0 < OutputNb) { for (int i = 1; i <= OutputNb && role != iGeometryName; i++) { RC = piUdfFeatureUser->GetOutputRole (i, role); //---------------------------------------------------------------------- // The right Output is found //---------------------------------------------------------------------- if (role == iGeometryName) { spGeom = (*oOutputs)[i]; } } } if (NULL != oOutputs) delete oOutputs; } if (NULL != piUdfFeatureUser) piUdfFeatureUser->Release(); piUdfFeatureUser = NULL; } oGeometry = spGeom; } if (NULL_var != oGeometry) RC = S_OK; else RC = E_FAIL; if (NULL != piUdfFeatureInstance) piUdfFeatureInstance->Release(); piUdfFeatureInstance = NULL; return (RC); } |
Update the interface dictionary, that is a file named, for example in this case, CAAManufacturingItf.edu.dico, whose directory's pathname is concatenated at run time in the CATDictionaryPath environment variable, and containing the following declaration to state that the UdfFeature feature implements the CATIMfgMappingForMachiningAxis interface, and whose code is located in the libCAAMaiUserDefFeatureMapping shared library or DLL. Pay attention to remove the comment (#) in the supplied dictionary.
UdfFeature CATIMfgMappingForMachiningAxis libCAAMaiUserDefFeatureMapping
The CAAManufacturingItf.edu.dico file is located in:
Windows | InstallRootDirectory\CAADoc\CAAManufacturingItf.edu\CNext\code\dictionary\ |
Unix | InstallRootDirectory/CAADoc/CAAManufacturingItf.edu/Cnext/code/dictionary/ |
[Top]
Here, you will find specific informations according to the implementation of the CATIMfgMappingForMachiningAxis interface. You can access to the User Defined Feature commands under the Shape or Part Design Workbenches, then edit the UserHoleWithAxisSystem User feature under the UserFeatures tree, and display the different tab-pages, specially Inputs and Outputs ones.
[Top]
[Top]
This article provides an example on how to use the manufacturing interface classes, to machine User Defined Features. It shows how to implement the CATIMfgMappingForMachiningAxis interface to be authorized to assign geometry to the geometrical macro motions when instantiating a machining process. This is an elementary step to do this.
[Top]
[1] | Building and Launching a CAA V5 Use Case |
[Top] |
Version: 1 [January 2003] | Document created |
[Top] |
Copyright © 2003, Dassault Systèmes. All rights reserved.