Machining |
NC Review |
Macro Data Access for Machining OperationsUsing the CATIMfgActivityMacroParameters, CATIMfgActivityMacroMotion and CATIMfgActivityElementaryMotion interfaces |
Use Case |
AbstractThis article discusses the CAAMaiMacroAccess use case and explains how to use the CATIMfgActivityMacroParameters, CATIMfgActivityMacroMotion and CATIMfgActivityElementaryMotion manufacturing interfaces. |
This use case is intended to help you customize the tool path computation of macros on an operation by using the CATIMfgActivityMacroParameters CATIMfgActivityMacroMotion CATIMfgActivityElementaryMotion manufacturing interface. This involves the following:
[Top]
CAAMaiMacroAccess is a use case of the CAAManufacturingItf.edu framework that illustrates ManufacturingInterfaces framework capabilities.
[Top]
CAAMaiMacroAccess runs a sequence of method calls, showing a "basic" computation of macros.
To launch CAAMaiMacroAccess, you will need to:
The CAAMaiMacroAccess use case is made of a class named CAAEMaiMacroAccess located in the CAAMaiMacroAccess.m module of the CAAManufacturingItf.edu framework:
Windows | InstallRootDirectory\CAADoc\CAAManufacturingItf.edu\CAAMaiMacroAccess.m |
Unix | InstallRootDirectory/CAADoc/CAAManufacturingItf.edu/CAAMaiMacroAccess.m |
where InstallRootDirectory
is the directory where the CAA CD-ROM
is installed.
[Top]
There are three logical steps in CAAMaiMacroAccess:
[Top]
#include "CAAEMaiMacroAccess.h" #include "CATBaseUnknown.h" #include "CATListOfCATUnicodeString.h" // Manufacturing Interfaces #include "CATIMfgActivity.h" #include "CATIMfgActivityMacroParameters.h" #include "CATIMfgActivityMacroMotion.h" #include "CATIMfgActivityElementaryMotion.h" // Mathematics #include "CATMathPlane.h" #include "CATMathPoint.h" #include "CATMathVector.h" //----------------------------------------------------------------------------- // Constructor //----------------------------------------------------------------------------- CAAEMaiMacroAccess::CAAEMaiMacroAccess(const CATIMfgActivity_var &iActivity) { _iActivity=iActivity; } //----------------------------------------------------------------------------- // Destructor //----------------------------------------------------------------------------- CAAEMaiMacroAccess::~CAAEMaiMacroAccess() { } //----------------------------------------------------------------------------- // GetMacroDatas //----------------------------------------------------------------------------- HRESULT CAAEMaiMacroAccess::GetMacroDatas() { HRESULT RC = E_FAIL; CATListOfCATUnicodeString ListeCAAMacroTypes; ListeCAAMacroTypes.Append("MfgApproachMacro"); ListeCAAMacroTypes.Append("MfgRetractMacro"); ListeCAAMacroTypes.Append("MfgReturnOneLevelMacro"); ListeCAAMacroTypes.Append("MfgReturnTwoLevelMacro"); ListeCAAMacroTypes.Append("MfgLinkingMacro"); ListeCAAMacroTypes.Append("MfgReturnFinishPathMacro"); ListeCAAMacroTypes.Append("MfgClearanceMacro"); CATIMfgActivityMacroParameters_var ParamMacro(_iActivity); if (NULL_var != ParamMacro) { for ( int K = 1; K <= ListeCAAMacroTypes.Size(); K++) { // Reading Macro on Activity with Type : ListeCAAMacroTypes[K].ConvertToChar() // int oActive=0; RC=ParamMacro->IsActive (K,oActive); // if (SUCCEEDED(RC) && oActive==1) { if (K != ListeCAAMacroTypes.Size()) { // for all types of macros except clearance // access to macro motions for ( int MotionNature= 1; MotionNature<=2 ;MotionNature++) { CATBaseUnknown_var BU1; if (MotionNature==1) { // Reading Retract Part of Macro RC = ParamMacro->GetRetractMacroMotions(K,BU1); } else if (MotionNature==2) { // Reading Approach Part of Macro RC = ParamMacro->GetApproachMacroMotions(K,BU1); } if (SUCCEEDED(RC)) { CATIMfgActivityMacroMotion_var MacroMotion(BU1); if (NULL_var != MacroMotion) { // Access to elementary motions of MacroMotion int MacroType=K; RC=this->ReadElementaryMotionDatas(MacroType,MacroMotion); } } } } else { CATBaseUnknown_var BU1; HRESULT RC; // Access to Clearance RC = ParamMacro->GetClearanceMacroMotions(BU1); if (SUCCEEDED(RC)) { CATIMfgActivityMacroMotion_var MacroMotion(BU1); if (NULL_var != MacroMotion) { int oMode=0; // Access to clerance mode RC= MacroMotion->GetClearanceMode (oMode); if (SUCCEEDED(RC)) { if (oMode==1) { // clearance mode = distance double oDist=0.0; RC= MacroMotion->GetClearanceDistance (oDist); } } int MacroType=K; RC=this->ReadElementaryMotionDatas(MacroType,MacroMotion); } } } } } } return RC; } //----------------------------------------------------------------------------- // ReadElementaryMotionData - read datas on elementary macro motions //----------------------------------------------------------------------------- HRESULT CAAEMaiMacroAccess::ReadElementaryMotionDatas(const int & iTypeMacro, CATIMfgActivityMacroMotion_var& MacroMotion) { HRESULT RC = E_FAIL; int oNumber; RC=MacroMotion->GetNumberOfElementaryMotions(oNumber); if (SUCCEEDED(RC)) { // for all macro types except clearance if (iTypeMacro != 7) { // loop on each elementary macro motion of MacroMotion for (int iPos = 1; iPos <= oNumber; iPos++) { CATBaseUnknown_var BU2; RC= MacroMotion->GetElementaryMotion (iPos,BU2); if (SUCCEEDED(RC)) { CATIMfgActivityElementaryMotion_var ElementaryMotion(BU2); if (NULL_var != ElementaryMotion) { int oActive=0; int oType=0; RC=ElementaryMotion->IsActive(oActive); if (SUCCEEDED(RC) ) { RC = ElementaryMotion->GetElementaryMotionType(oType); } // the motion must be active to be taken into account if (SUCCEEDED(RC) && oActive==1) { if (oType==1 || oType==2 || oType==8) { // horizontal - axial double oDist=0.0; RC = ElementaryMotion->GetDistanceValue(oDist); } if (oType==6) { // goto plane CATMathPlane oPlane; RC = ElementaryMotion->GetMotionPlane(oPlane); } if (oType==4) { // PP CATListOfCATUnicodeString oPPWordList; RC = ElementaryMotion->GetPPWordList(oPPWordList); if (SUCCEEDED(RC)) { int NbOfPPWords=oPPWordList.Size(); } } if (oType==2) { // horizontal motion (equivalent to tangent - normal motion icons in macro tabpage in // activity Panel editor double oHAngle=0.0; RC = ElementaryMotion->GetHorizontalAngleValue(oHAngle); if (SUCCEEDED(RC)) { double oVAngle=0.0; RC = ElementaryMotion->GetVerticalAngleValue(oVAngle); } } if (oType==3) { // circle motion double oSector=0.0; double oOrientAngle=0.0; double oRadius=0.0; RC = ElementaryMotion->GetAngularSectorValue(oSector); if (SUCCEEDED(RC)) { RC = ElementaryMotion->GetAngularOrientationValue(oOrientAngle); if (SUCCEEDED(RC)) { RC = ElementaryMotion->GetCircleRadiusValue(oRadius); } } } if (oType==5) { // ramping motion double oRampAngle=0.0; double oHDist=0.0; double oVDist=0.0; RC = ElementaryMotion->GetRampingAngleValue(oRampAngle); if (SUCCEEDED(RC)) { RC = ElementaryMotion->GetHorizontalSafetyDistanceValue(oHDist); if (SUCCEEDED(RC)) { RC = ElementaryMotion->GetVerticalSafetyDistanceValue(oVDist); } } } } } int oFeedType=-1; RC = ElementaryMotion->GetFeedrateType(oFeedType); if (SUCCEEDED(RC)) { if (oFeedType==5) { // local feedrate : access to feedrate value double oFeedValue; RC=ElementaryMotion->GetFeedrateValue(oFeedValue); } } int oSpeedType=-1; RC = ElementaryMotion->GetSpindleSpeedType(oSpeedType); if (SUCCEEDED(RC)) { if (oSpeedType==5) { // access to local value double oSpeedValue; RC=ElementaryMotion->GetSpindleSpeedValue(oSpeedValue); } } } } } } return RC; } |
[Top]
This article provides an example on how to use the manufacturing interface classes on macro access.
[Top]
[1] | Building and Launching a CAA V5 Use Case |
[2] | Process Modeler Home Page |
[Top] |
Version: 1 [December 2001] | Document created |
[Top] |
Copyright © 2001, Dassault Systèmes. All rights reserved.