Machining |
All Machining Workbenches |
Managing (User Defined) Features for Macro MotionsImplementing the CATIMfgMacroMotionsGeomMapping interface |
Use Case |
AbstractThis article discusses the CAAMaiUdfForGeomMacroMotions use case and explains how to implement the CATIMfgMacroMotionsGeomMapping manufacturing interface. |
This use case is intended to help you apply an axial operation from a User Defined Feature, by implementing the CATIMfgMacroMotionsGeomMapping manufacturing interface. This involves the following:
[Top]
CAAMaiUdfForGeomMacroMotions is a use case of the CAAManufacturingItf.edu framework in the CAAMaiUserDefFeatureMapping.m module that illustrates ManufacturingInterfaces framework capabilities.
[Top]
CAAMaiUdfForGeomMacroMotions illustrates an implementation of CATIMfgMacroMotionsGeomMapping interface for the User Defined Features identified by the UdfFeature type. This implementation enables to assign geometry like planes or points to macro motions 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 CAAMaiUdfForGeomMacroMotions, 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 CATIMfgMacroMotionsGeomMapping libCAAMaiUserDefFeatureMapping
Windows | InstallRootDirectory\CAADoc\CAAManufacturingItf.edu\CNext\resources\graphic\ |
Unix | InstallRootDirectory/CAADoc/CAAManufacturingItf.edu/CNext/resources/graphic/ |
[Top]
The CAAMaiUdfForGeomMacroMotions use case is made of a class named CAAMaiUdfForGeomMacroMotion 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 CAAMaiUdfForGeomMacroMotions:
We now comment each of those sections by looking at the code.
[Top]
The CAAMaiUdfForGeomMacroMotions.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 "AxialUdfWithMacroMap"
corresponding to the Machining Process definition (see the
CAAMaiMachiningProcessForUdfWithNCMacroData.CATProcess file in the above
directory):
According to this variable, the implementation is looking for the right User Feature geometry:
... //-------------------------------------------------------------------------- // Number of macro motions to be solved //-------------------------------------------------------------------------- int NbOfMotions = iElementaryMotionTypeList.Size(); for (int numMotion = 1; numMotion <= NbOfMotions && SUCCEEDED(RetCode); numMotion++) { // "Go to a plane" motion case if (6 == iElementaryMotionTypeList[numMotion]) { CATUnicodeString GeometryName; if (1 == iMacroMotionType || 2 == iMacroMotionType) { if (MappingRuleName == "AxialUdfWithMacroMap") { if (iActivityType == "ProfileContouring") { if (1 == numMotion) GeometryName = "Lower_Plane"; else GeometryName = "Security_Plane"; } else GeometryName = "Security_Plane"; } else GeometryName = "SecurityPlane"; } else { if (MappingRuleName == "AxialUdfWithMacroMap") GeometryName = "Lower_Plane"; else { GeometryName = "Drive"; if (MappingRuleName == "Upper_Drive_Rule") GeometryName = "Upper_Drive"; else if (MappingRuleName == "Lower_Drive_Rule") GeometryName = "Lower_Drive"; } } } 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; } } if (SUCCEEDED(RetCode)) { CATISketch_var Sketch(Geometry); if (NULL_var != Sketch) { CATISpecObject_var oPlane; RetCode = Sketch->GetPlanarSupport(oPlane); if (SUCCEEDED(RetCode)) { CATBaseUnknown_var MacroPlane(oPlane); oGeometryList.Append(MacroPlane); } else RetCode = E_FAIL; } else oGeometryList.Append(Geometry); } } // "Go to a point" motion case else if (7 == iElementaryMotionTypeList[numMotion]) { CATUnicodeString GeometryName; if (iActivityType == "Drilling") GeometryName = "Drilling_Point"; else GeometryName = "HomePoint"; CATBaseUnknown_var Geometry; RetCode = GetUdfGeometry (GeometryName, Geometry); if (SUCCEEDED(RetCode)) oGeometryList.Append(Geometry); } // non supported case else RetCode = E_FAIL; } ... // 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 CATIMfgMacroMotionsGeomMapping interface, and whose code is located in the libCAAMaiUserDefFeatureMapping shared library or DLL. Pay attention to remove the comment (#) in the supplied dictionary.
UdfFeature CATIMfgMacroMotionsGeomMapping 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 CATIMfgMacroMotionsGeomMapping interface. You can access to the User Defined Feature commands under the Shape or Part Design Workbenches, then edit the UserHoleWithNCMacroData User feature under the UserFeatures tree, and display the different tab-pages, specially Inputs, Parameters and Outputs ones:
[Top]
Note that two operations are created in the Machining Program
In the following picture, the geometrical macro motions (go to a plane + go to a point + go to a plane) are solved from the CAA implementation:
.
The following picture shows the toolpath.
[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 CATIMfgMacroMotionsGeomMapping 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.