//---------------------------------------------------------------------------- // EgalTech 2015-2015 //---------------------------------------------------------------------------- // File : EXE_MachMgr.cpp Data : 05.05.15 Versione : 1.6e1 // Contenuto : Funzioni Machining Manager per EXE. // // // // Modifiche : 23.03.15 DS Creazione modulo. // // //---------------------------------------------------------------------------- //--------------------------- Include ---------------------------------------- #include "stdafx.h" #include "EXE.h" #include "EXE_Macro.h" #include "Lua_Base.h" #include "AuxTools.h" #include "DllMachKernel.h" #include "/EgtDev/Include/EXeExecutor.h" #include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EgtStringConverter.h" #include "/EgtDev/Include/EgtPointerOwner.h" using namespace std ; //----------------------------------------------------------------------------- bool ExeInitMachMgr( const string& sMachinesDir) { GseContext* pGseCtx = GetCurrGseContext() ; VERIFY_CTX_GEOMDB( pGseCtx, false) // inizializzazione gestore lavorazioni PtrOwner pMachMgr( MyCreateMachMgr()) ; VERIFY_NULL( Get( pMachMgr), "Error in CreateMachMgr", false) bool bOk = pMachMgr->Init( sMachinesDir, pGseCtx->m_pGeomDB, GetIndCurrGseContext(), LuaGetLuaLibsDir(), LuaGetLastRequire()) ; // assegno il gestore al contesto pGseCtx->m_pMachMgr = ( bOk ? Release( pMachMgr) : nullptr) ; // log avvio Machining Manager string sLog = "MachMgr" ; sLog += ( bOk ? " started" : " error") ; sLog += " (" + sMachinesDir + ")" ; LOG_INFO( GetLogger(), sLog.c_str()) return bOk ; } //----------------------------------------------------------------------------- bool ExeUpdateMachMgr( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // aggiornamento gestore lavorazioni return pMachMgr->Update() ; } //----------------------------------------------------------------------------- bool ExeInsertMachMgr( int nInsGrp) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // sposto le macchinate dal gruppo di inserimento alla base macchinate return pMachMgr->Insert( nInsGrp) ; } //----------------------------------------------------------------------------- // Machines //----------------------------------------------------------------------------- bool ExeSetCurrMachine( const string& sMachineName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto la macchina corrente return pMachMgr->SetCurrMachine( sMachineName) ; } //----------------------------------------------------------------------------- bool ExeGetCurrMachineName( string& sMachineName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il nome della macchina corrente return pMachMgr->GetCurrMachineName( sMachineName) ; } //----------------------------------------------------------------------------- bool ExeGetCurrMachineDir( string& sMachineDir) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il direttorio della macchina corrente return pMachMgr->GetCurrMachineDir( sMachineDir) ; } //----------------------------------------------------------------------------- // Machining Groups //----------------------------------------------------------------------------- int ExeGetMachGroupCount( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, 0) // recupero il numero di macchinate return pMachMgr->GetMachGroupCount() ; } //----------------------------------------------------------------------------- int ExeGetFirstMachGroup( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero la prima macchinata return pMachMgr->GetFirstMachGroup() ; } //----------------------------------------------------------------------------- int ExeGetNextMachGroup( int nId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero la successiva macchinata return pMachMgr->GetNextMachGroup( nId) ; } //----------------------------------------------------------------------------- bool ExeGetMachGroupNewName( string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero un nuovo nome a partire da quello passato return pMachMgr->GetMachGroupNewName( sName) ; } //----------------------------------------------------------------------------- int ExeAddMachGroup( const string& sName, const string& sMachineName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // aggiungo la macchinata (gruppo di lavorazione) int nId = pMachMgr->AddMachGroup( sName, sMachineName) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtAddMachGroup('" + sName + "','" + sMachineName + "')" + " -- Id=" + ToString( nId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return nId ; } //----------------------------------------------------------------------------- bool ExeRemoveMachGroup( int nMGroupId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // rimuovo la macchinata (gruppo di lavorazione) bool bOk = pMachMgr->RemoveMachGroup( nMGroupId) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtRemoveMachGroup(" + ToString( nMGroupId) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeGetMachGroupName( int nId, string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il nome della macchinata sName = pMachMgr->GetMachGroupName( nId) ; return ( ! sName.empty()) ; } //----------------------------------------------------------------------------- int ExeGetMachGroupId( const string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero l'indice della macchinata return pMachMgr->GetMachGroupId( sName) ; } //----------------------------------------------------------------------------- bool ExeSetCurrMachGroup( int nMGroupId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto la macchinata corrente bool bOk = pMachMgr->SetCurrMachGroup( nMGroupId) ; // non cambia lo stato di modificato del progetto // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtSetCurrMachGroup(" + ToString( nMGroupId) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeResetCurrMachGroup( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // reset macchinata corrente bool bOk = pMachMgr->ResetCurrMachGroup() ; // non cambia lo stato di modificato del progetto // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtResetCurrMachGroup()" " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- int ExeGetCurrMachGroup( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // restituisco identificativo macchinata corrente return pMachMgr->GetCurrMachGroup() ; } //----------------------------------------------------------------------------- // Setup //----------------------------------------------------------------------------- int ExeGetCurrSetup( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, 0) // recupero l'identificativo del gruppo di attrezzaggio della macchinata corrente return pMachMgr->GetCurrSetup() ; } //----------------------------------------------------------------------------- // Phases //----------------------------------------------------------------------------- int ExeAddPhase( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, 0) // aggiungo una nuova fase di lavorazione alla macchinata corrente int nId = pMachMgr->AddPhase() ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtAddPhase()" " -- Id=" + ToString( nId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return nId ; } //----------------------------------------------------------------------------- bool ExeSetCurrPhase( int nPhase, bool bForced) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto la fase di lavorazione corrente nella macchinata corrente return pMachMgr->SetCurrPhase( nPhase, bForced) ; } //----------------------------------------------------------------------------- int ExeGetCurrPhase( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, 0) // recupero la fase di lavorazione corrente nella macchinata corrente return pMachMgr->GetCurrPhase() ; } //----------------------------------------------------------------------------- bool ExeRemoveLastPhase( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // elimina l'ultima fase di lavorazione dalla macchinata corrente bool bOk = pMachMgr->RemoveLastPhase() ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtRemoveLastPhase()" " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- int ExeGetPhaseCount( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, 0) // recupero il numero totale di fasi di lavorazione della macchinata corrente return pMachMgr->GetPhaseCount() ; } //----------------------------------------------------------------------------- // Raw Parts & Parts //----------------------------------------------------------------------------- int ExeGetRawPartCount( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, 0) // recupero il numero di grezzi nella macchinata corrente return pMachMgr->GetRawPartCount() ; } //----------------------------------------------------------------------------- int ExeGetFirstRawPart( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero identificativo primo grezzo nella macchinata corrente return pMachMgr->GetFirstRawPart() ; } //----------------------------------------------------------------------------- int ExeGetNextRawPart( int nRawId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero identificativo successivo grezzo nella macchinata corrente return pMachMgr->GetNextRawPart( nRawId) ; } //----------------------------------------------------------------------------- int ExeAddRawPart( Point3d ptOrig, double dLength, double dWidth, double dHeight, Color cCol) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // inserisco grezzo nella macchinata corrente int nId = pMachMgr->AddRawPart( ptOrig, dLength, dWidth, dHeight, cCol) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtAddRawPart({" + ToString( ptOrig) + "}," + ToString( dLength) + "," + ToString( dWidth) + "," + ToString( dHeight) + ",{" + ToString( cCol) + "})" + " -- Id=" + ToString( nId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return nId ; } //----------------------------------------------------------------------------- int ExeAddRawPartWithPart( int nPartId, int nCrvId, double dOverMat, Color cCol) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // inserisco grezzo con pezzo nella macchinata corrente int nId = pMachMgr->AddRawPartWithPart( nPartId, nCrvId, dOverMat, cCol) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtAddRawPartWithPart(" + ToString( nPartId) + "," + ToString( nCrvId) + "," + ToString( dOverMat) + ",{" + ToString( cCol) + "})" + " -- Id=" + ToString( nId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return nId ; } //----------------------------------------------------------------------------- bool ExeModifyRawPart( int nRawId, Point3d ptOrig, double dLength, double dWidth, double dHeight, Color cCol) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // modifico grezzo indicato nella macchinata corrente bool bOk = pMachMgr->ModifyRawPart( nRawId, ptOrig, dLength, dWidth, dHeight, cCol) ; ExeSetModified() ; // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeModifyRawPart( int nRawId, int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // modifico grezzo indicato nella macchinata corrente bool bOk = pMachMgr->ModifyRawPart( nRawId, nCrvId, dOverMat, dZmin, dHeight, cCol) ; ExeSetModified() ; // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeModifyRawPartSize( int nRawId, double dLength, double dWidth, double dHeight) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // modifico la lunghezza del grezzo bool bOk = pMachMgr->ModifyRawPartSize( nRawId, dLength, dWidth, dHeight) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtModifyRawPartSize(" + ToString( nRawId) + "," + ToString( dLength) + "," + ToString( dWidth) + "," + ToString( dHeight) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeModifyRawPartHeight( int nRawId, double dHeight) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // modifico lo spessore del grezzo bool bOk = pMachMgr->ModifyRawPartHeight( nRawId, dHeight) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtModifyRawPartHeight(" + ToString( nRawId) + "," + ToString( dHeight) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeKeepRawPart( int nRawId, int nSouPhase) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // confermo il grezzo nella fase corrente della macchinata corrente bool bOk = pMachMgr->KeepRawPart( nRawId, nSouPhase) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtKeepRawPart(" + ToString( nRawId) + "," + ToString( nSouPhase) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeVerifyRawPartPhase( int nRawId, int nPhase) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // verifico che il grezzo sia valido ed appartenga alla fase di lavorazione indicata bool bOk = pMachMgr->VerifyRawPartPhase( nRawId, nPhase) ; // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeVerifyRawPartCurrPhase( int nRawId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // verifico che il grezzo sia valido ed appartenga alla fase di lavorazione corrente bool bOk = pMachMgr->VerifyRawPartPhase( nRawId, pMachMgr->GetCurrPhase()) ; // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeRemoveRawPartFromCurrPhase( int nRawId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // elimino grezzo dalla fase corrente della macchinata corrente bool bOk = pMachMgr->RemoveRawPartFromCurrPhase( nRawId) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtRemoveRawPartFromCurrPhase(" + ToString( nRawId) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeRemoveRawPart( int nRawId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // elimino grezzo dalla macchinata corrente bool bOk = pMachMgr->RemoveRawPart( nRawId) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtRemoveRawPart(" + ToString( nRawId) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeRotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // ruoto il grezzo bool bOk = pMachMgr->RotateRawPart( nRawId, vtAx, dAngRotDeg) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtRotateRawPart(" + ToString( nRawId) + ",{" + ToString( vtAx) + "}," + ToString( dAngRotDeg) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeMoveToCornerRawPart( int nRawId, const Point3d& ptCorner, int nFlag) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // mando il grezzo nel corner bool bOk = pMachMgr->MoveToCornerRawPart( nRawId, ptCorner, nFlag) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtMoveToCornerRawPart(" + ToString( nRawId) + ",{" + ToString( ptCorner) + "}," + RawPartCornerPosToString( nFlag) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeMoveToCenterRawPart( int nRawId, const Point3d& ptCenter, int nFlag) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // mando il grezzo nel corner bool bOk = pMachMgr->MoveToCenterRawPart( nRawId, ptCenter, nFlag) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtMoveToCenterRawPart(" + ToString( nRawId) + ",{" + ToString( ptCenter) + "}," + RawPartCenterPosToString( nFlag) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeMoveRawPart( int nRawId, const Vector3d& vtMove) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // traslo il grezzo bool bOk = pMachMgr->MoveRawPart( nRawId, vtMove) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtMoveRawPart(" + ToString( nRawId) + ",{" + ToString( vtMove) + "})" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeGetRawPartCenter( int nRawId, Point3d& ptCen) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il centro del grezzo return pMachMgr->GetRawPartCenter( nRawId, ptCen) ; } //----------------------------------------------------------------------------- int ExeSplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // divido il grezzo in nuove parti in base alle lavorazioni int nId = pMachMgr->SplitFlatRawPartWithMachinings( nRawId, vMchId) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtSplitFlatRawPartWithMachinings(" + ToString( nRawId) + ",{" + IdListToString( vMchId) + "})" + " -- FirstId=" + ToString( nId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return nId ; } //----------------------------------------------------------------------------- int ExeGetPartInRawPartCount( int nRawId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, 0) // recupero il numero di pezzi nel grezzo return pMachMgr->GetPartInRawPartCount( nRawId) ; } //----------------------------------------------------------------------------- int ExeGetFirstPartInRawPart( int nRawId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero identificativo primo pezzo nel grezzo return pMachMgr->GetFirstPartInRawPart( nRawId) ; } //----------------------------------------------------------------------------- int ExeGetNextPartInRawPart( int nPartId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero identificativo successivo pezzo nello stesso grezzo return pMachMgr->GetNextPartInRawPart( nPartId) ; } //----------------------------------------------------------------------------- bool ExeAddPartToRawPart( int nPartId, const Point3d& ptPos, int nRawId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // inserisco pezzo in un grezzo della macchinata corrente bool bOk = pMachMgr->AddPartToRawPart( nPartId, ptPos, nRawId) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtAddPartToRawPart(" + ToString( nPartId) + ",{" + ToString( ptPos) + "}," + ToString( nRawId) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- int ExeGetRawPartFromPart( int nPartId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // cerco il grezzo della fase corrente della macchinata corrente cui appartiene il pezzo int nRawId = pMachMgr->GetRawPartFromPart( nPartId) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtGetRawPartFromPart(" + ToString( nPartId) + ")" + " -- Id=" + ToString( nRawId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return nRawId ; } //----------------------------------------------------------------------------- bool ExeRemovePartFromRawPart( int nPartId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // elimino pezzo da grezzo della macchinata corrente bool bOk = pMachMgr->RemovePartFromRawPart( nPartId) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtRemovePartFromRawPart(" + ToString( nPartId) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeTranslatePartInRawPart( int nPartId, const Vector3d& vtMove) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // traslo il pezzo nel grezzo bool bOk = pMachMgr->TranslatePartInRawPart( nPartId, vtMove) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtMovePartInRawPart(" + ToString( nPartId) + ",{" + ToString( vtMove) + "})" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeRotatePartInRawPart( int nPartId, const Vector3d& vtAx, double dAngRotDeg) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // ruoto il pezzo nel grezzo bool bOk = pMachMgr->RotatePartInRawPart( nPartId, vtAx, dAngRotDeg) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtRotatePartInRawPart(" + ToString( nPartId) + ",{" + ToString( vtAx) + "}," + ToString( dAngRotDeg) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- // Table & Fixtures //----------------------------------------------------------------------------- bool ExeSetTable( const string& sTable) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto la tavola corrente della macchinata corrente return pMachMgr->SetTable( sTable) ; } //----------------------------------------------------------------------------- bool ExeGetTable( string& sTable) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il nome della tavola corrente della macchinata corrente return pMachMgr->GetTable( sTable) ; } //----------------------------------------------------------------------------- bool ExeGetTableRef( int nInd, Point3d& ptPos) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il riferimento della tavola corrente della macchinata corrente return pMachMgr->GetTableRef( nInd, ptPos) ; } //----------------------------------------------------------------------------- bool ExeGetTableArea( int nInd, BBox3d& b3Area) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero l'estensione dell'area utile della tavola corrente della macchinata corrente return pMachMgr->GetTableArea( nInd, b3Area) ; } //----------------------------------------------------------------------------- bool ExeShowOnlyTable( bool bVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // visualizzo solo la tavola corrente della macchinata corrente return pMachMgr->ShowOnlyTable( bVal) ; } //----------------------------------------------------------------------------- int ExeAddFixture( const string& sName, const Point3d& ptPos, double dAngRotDeg, double dMov) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // inserisco il dispositivo di presa nella posizione indicata int nId = pMachMgr->AddFixture( sName, ptPos, dAngRotDeg, dMov) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtAddFixture(" + sName + ",{" + ToString( ptPos) + "}," + ToString( dAngRotDeg) + "," + ToString( dMov) + ")" + " -- Id=" + ToString( nId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return nId ; } //----------------------------------------------------------------------------- bool ExeKeepFixture( int nFxtId, int nSouPhase) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // confermo il bloccaggio nella fase corrente della macchinata corrente bool bOk = pMachMgr->KeepFixture( nFxtId, nSouPhase) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtKeepFixture(" + ToString( nFxtId) + "," + ToString( nSouPhase) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeRemoveFixture( int nFxtId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // rimuove il bloccaggio bool bOk = pMachMgr->RemoveFixture( nFxtId) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtRemoveFixture(" + ToString( nFxtId) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //---------------------------------------------------------------------------- bool ExeVerifyFixture( int nFxtId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // eseguo la verifica return pMachMgr->VerifyFixture( nFxtId) ; } //----------------------------------------------------------------------------- int ExeGetFirstFixture( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // cerca il primo bloccaggio return pMachMgr->GetFirstFixture() ; } //----------------------------------------------------------------------------- int ExeGetNextFixture( int nFxtId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // cerca il successivo bloccaggio return pMachMgr->GetNextFixture( nFxtId) ; } //----------------------------------------------------------------------------- bool ExeMoveFixture( int nFxtId, const Vector3d& vtMove) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // muovo il dispositivo di presa del vettore indicato bool bOk = pMachMgr->MoveFixture( nFxtId, vtMove) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtMoveFixture(" + ToString( nFxtId) + ",{" + ToString( vtMove) + "})" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeRotateFixture( int nFxtId, double dDeltaAngDeg) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // ruoto il dispositivo di presa dell'angolo indicato bool bOk = pMachMgr->RotateFixture( nFxtId, dDeltaAngDeg) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtRotateFixture(" + ToString( nFxtId) + ",{" + ToString( dDeltaAngDeg) + "})" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeMoveFixtureMobile( int nFxtId, double dDeltaMove) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // ruoto il dispositivo di presa dell'angolo indicato bool bOk = pMachMgr->MoveFixtureMobile( nFxtId, dDeltaMove) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtMoveFixtureMobile(" + ToString( nFxtId) + ",{" + ToString( dDeltaMove) + "})" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- // DB utensili //----------------------------------------------------------------------------- bool ExeTdbGetToolNewName( string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero un nuovo nome a partire da quello passato return pMachMgr->TdbGetToolNewName( sName) ; } //----------------------------------------------------------------------------- bool ExeTdbAddTool( const string& sName, int nType) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // aggiungo l'utensile return pMachMgr->TdbAddTool( sName, nType) ; } //----------------------------------------------------------------------------- bool ExeTdbCopyTool( const string& sSource, const string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // copio l'utensile return pMachMgr->TdbCopyTool( sSource, sName) ; } //----------------------------------------------------------------------------- bool ExeTdbRemoveTool( const string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // rimuovo l'utensile return pMachMgr->TdbRemoveTool( sName) ; } //---------------------------------------------------------------------------- bool ExeTdbGetFirstTool( int nFamily, string& sName, int& nType) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // restituisce nome e tipo del primo utensile della famiglia return pMachMgr->TdbGetFirstTool( nFamily, sName, nType) ; } //---------------------------------------------------------------------------- bool ExeTdbGetNextTool( int nFamily, string& sName, int& nType) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // restituisce nome e tipo del successivo utensile della famiglia return pMachMgr->TdbGetNextTool( nFamily, sName, nType) ; } //---------------------------------------------------------------------------- bool ExeTdbGetToolFromUUID( const string& sTuuid, string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // restituisce nome dell'utensile di dato UUID return pMachMgr->TdbGetToolFromUUID( sTuuid, sName) ; } //----------------------------------------------------------------------------- bool ExeTdbSetCurrTool( const string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposta l'utensile corrente return pMachMgr->TdbSetCurrTool( sName) ; } //----------------------------------------------------------------------------- bool ExeTdbSaveCurrTool( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // salva l'utensile corrente return pMachMgr->TdbSaveCurrTool() ; } //----------------------------------------------------------------------------- bool ExeTdbIsCurrToolModified( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // verifico se utensile corrente modificato return pMachMgr->TdbIsCurrToolModified() ; } //----------------------------------------------------------------------------- bool ExeTdbSetCurrToolParam( int nType, bool bVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposta il parametro dell'utensile return pMachMgr->TdbSetCurrToolParam( nType, bVal) ; } //----------------------------------------------------------------------------- bool ExeTdbSetCurrToolParam( int nType, int nVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposta il parametro dell'utensile return pMachMgr->TdbSetCurrToolParam( nType, nVal) ; } //----------------------------------------------------------------------------- bool ExeTdbSetCurrToolParam( int nType, double dVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto il parametro dell'utensile return pMachMgr->TdbSetCurrToolParam( nType, dVal) ; } //----------------------------------------------------------------------------- bool ExeTdbSetCurrToolParam( int nType, const string& sVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto il parametro dell'utensile return pMachMgr->TdbSetCurrToolParam( nType, sVal) ; } //----------------------------------------------------------------------------- bool ExeTdbGetCurrToolParam( int nType, bool& bVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il parametro dell'utensile return pMachMgr->TdbGetCurrToolParam( nType, bVal) ; } //----------------------------------------------------------------------------- bool ExeTdbGetCurrToolParam( int nType, int& nVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il parametro dell'utensile return pMachMgr->TdbGetCurrToolParam( nType, nVal) ; } //----------------------------------------------------------------------------- bool ExeTdbGetCurrToolParam( int nType, double& dVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il parametro dell'utensile return pMachMgr->TdbGetCurrToolParam( nType, dVal) ; } //----------------------------------------------------------------------------- bool ExeTdbGetCurrToolParam( int nType, string& sVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il parametro dell'utensile return pMachMgr->TdbGetCurrToolParam( nType, sVal) ; } //----------------------------------------------------------------------------- bool ExeTdbReload( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // ricarico il DB utensili (eventuali modifiche dopo l'ultimo salvataggio vengono perse) return pMachMgr->TdbReload() ; } //----------------------------------------------------------------------------- bool ExeTdbSave( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // eseguo il salvataggio del DB utensili return pMachMgr->TdbSave() ; } //----------------------------------------------------------------------------- bool ExeTdbGetToolDir( string& sToolDir) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il direttorio degli utensili return pMachMgr->TdbGetToolDir( sToolDir) ; } //----------------------------------------------------------------------------- bool ExeTdbGetToolHolderDir( string& sTHolderDir) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il direttorio dei porta utensili return pMachMgr->TdbGetToolHolderDir( sTHolderDir) ; } //----------------------------------------------------------------------------- // DB lavorazioni //----------------------------------------------------------------------------- bool ExeMdbGetMachiningNewName( string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero un nuovo nome a partire da quello passato return pMachMgr->MdbGetMachiningNewName( sName) ; } //----------------------------------------------------------------------------- bool ExeMdbAddMachining( const string& sName, int nType) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // aggiungo la lavorazione return pMachMgr->MdbAddMachining( sName, nType) ; } //----------------------------------------------------------------------------- bool ExeMdbCopyMachining( const string& sSource, const string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // copio la lavorazione return pMachMgr->MdbCopyMachining( sSource, sName) ; } //----------------------------------------------------------------------------- bool ExeMdbRemoveMachining( const string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // rimuovo la lavorazione return pMachMgr->MdbRemoveMachining( sName) ; } //----------------------------------------------------------------------------- bool ExeMdbGetFirstMachining( int nType, string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // rimuovo la lavorazione return pMachMgr->MdbGetFirstMachining( nType, sName) ; } //----------------------------------------------------------------------------- bool ExeMdbGetNextMachining( int nType, string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // rimuovo la lavorazione return pMachMgr->MdbGetNextMachining( nType, sName) ; } //---------------------------------------------------------------------------- bool ExeMdbGetMachiningFromUUID( const string& sMuuid, string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // restituisce nome della lavorazione di dato UUID return pMachMgr->MdbGetMachiningFromUUID( sMuuid, sName) ; } //----------------------------------------------------------------------------- bool ExeMdbSetCurrMachining( const string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto la lavorazione corrente return pMachMgr->MdbSetCurrMachining( sName) ; } //----------------------------------------------------------------------------- bool ExeMdbSaveCurrMachining( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // salvo la lavorazione corrente return pMachMgr->MdbSaveCurrMachining() ; } //----------------------------------------------------------------------------- bool ExeMdbIsCurrMachiningModified( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // verifico se la lavorazione corrente è stata modificata return pMachMgr->MdbIsCurrMachiningModified() ; } //----------------------------------------------------------------------------- bool ExeMdbSetCurrMachiningParam( int nType, bool bVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposta il parametro della lavorazione return pMachMgr->MdbSetCurrMachiningParam( nType, bVal) ; } //----------------------------------------------------------------------------- bool ExeMdbSetCurrMachiningParam( int nType, int nVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposta il parametro della lavorazione return pMachMgr->MdbSetCurrMachiningParam( nType, nVal) ; } //----------------------------------------------------------------------------- bool ExeMdbSetCurrMachiningParam( int nType, double dVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposta il parametro della lavorazione return pMachMgr->MdbSetCurrMachiningParam( nType, dVal) ; } //----------------------------------------------------------------------------- bool ExeMdbSetCurrMachiningParam( int nType, const string& sVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposta il parametro della lavorazione return pMachMgr->MdbSetCurrMachiningParam( nType, sVal) ; } //----------------------------------------------------------------------------- bool ExeMdbGetCurrMachiningParam( int nType, bool& bVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposta il parametro della lavorazione return pMachMgr->MdbGetCurrMachiningParam( nType, bVal) ; } //----------------------------------------------------------------------------- bool ExeMdbGetCurrMachiningParam( int nType, int& nVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposta il parametro della lavorazione return pMachMgr->MdbGetCurrMachiningParam( nType, nVal) ; } //----------------------------------------------------------------------------- bool ExeMdbGetCurrMachiningParam( int nType, double& dVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposta il parametro della lavorazione return pMachMgr->MdbGetCurrMachiningParam( nType, dVal) ; } //----------------------------------------------------------------------------- bool ExeMdbGetCurrMachiningParam( int nType, string& sVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposta il parametro della lavorazione return pMachMgr->MdbGetCurrMachiningParam( nType, sVal) ; } //----------------------------------------------------------------------------- bool ExeMdbSetGeneralParam( int nType, bool bVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto il parametro generale delle lavorazioni return pMachMgr->MdbSetGeneralParam( nType, bVal) ; } //----------------------------------------------------------------------------- bool ExeMdbSetGeneralParam( int nType, int nVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto il parametro generale delle lavorazioni return pMachMgr->MdbSetGeneralParam( nType, nVal) ; } //----------------------------------------------------------------------------- bool ExeMdbSetGeneralParam( int nType, double dVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto il parametro generale delle lavorazioni return pMachMgr->MdbSetGeneralParam( nType, dVal) ; } //----------------------------------------------------------------------------- bool ExeMdbGetGeneralParam( int nType, bool& bVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il parametro generale dele lavorazioni return pMachMgr->MdbGetGeneralParam( nType, bVal) ; } //----------------------------------------------------------------------------- bool ExeMdbGetGeneralParam( int nType, int& nVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il parametro generale dele lavorazioni return pMachMgr->MdbGetGeneralParam( nType, nVal) ; } //----------------------------------------------------------------------------- bool ExeMdbGetGeneralParam( int nType, double& dVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il parametro generale dele lavorazioni return pMachMgr->MdbGetGeneralParam( nType, dVal) ; } //----------------------------------------------------------------------------- bool ExeMdbReload( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // ricarico il DB lavorazioni (eventuali modifiche dopo l'ultimo salvataggio vengono perse) return pMachMgr->MdbReload() ; } //----------------------------------------------------------------------------- bool ExeMdbSave( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // eseguo il salvataggio del DB lavorazioni return pMachMgr->MdbSave() ; } //----------------------------------------------------------------------------- bool ExeMdbGetMachiningDir( string& sMchDir) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il direttorio delle lavorazioni return pMachMgr->MdbGetMachiningDir( sMchDir) ; } //----------------------------------------------------------------------------- // Operazioni //----------------------------------------------------------------------------- int ExeGetFirstOperation( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero la prima operazione della macchinata corrente return pMachMgr->GetFirstOperation() ; } //----------------------------------------------------------------------------- int ExeGetNextOperation( int nId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero la successiva operazione della macchinata corrente return pMachMgr->GetNextOperation( nId) ; } //----------------------------------------------------------------------------- int ExeGetLastOperation( void) { GseContext* pGseCtx = GetCurrGseContext() ; VERIFY_CTX_MACHMGR( pGseCtx, false) // recupero l'ultima operazione della macchinata corrente return pGseCtx->m_pMachMgr->GetLastOperation() ; } //----------------------------------------------------------------------------- int ExeGetPrevOperation( int nId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero la precedente operazione della macchinata corrente return pMachMgr->GetPrevOperation( nId) ; } //----------------------------------------------------------------------------- int ExeGetFirstActiveOperation( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero la prima operazione attiva della macchinata corrente return pMachMgr->GetFirstActiveOperation() ; } //----------------------------------------------------------------------------- int ExeGetNextActiveOperation( int nId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero la successiva operazione attiva della macchinata corrente return pMachMgr->GetNextActiveOperation( nId) ; } //----------------------------------------------------------------------------- int ExeGetLastActiveOperation( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero l'ultima operazione attiva della macchinata corrente return pMachMgr->GetLastActiveOperation() ; } //----------------------------------------------------------------------------- int ExeGetPrevActiveOperation( int nId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero la precedente operazione attiva della macchinata corrente return pMachMgr->GetPrevActiveOperation( nId) ; } //----------------------------------------------------------------------------- int ExeGetOperationType( int nId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero il tipo della operazione della macchinata corrente return pMachMgr->GetOperationType( nId) ; } //----------------------------------------------------------------------------- int ExeGetOperationPhase( int nId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, 0) // recupero la fase di appartenenza della operazione della macchinata corrente return pMachMgr->GetOperationPhase( nId) ; } //----------------------------------------------------------------------------- bool ExeGetOperationName( int nId, string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero la fase di appartenenza della operazione della macchinata corrente sName = pMachMgr->GetOperationName( nId) ; return ( ! sName.empty()) ; } //----------------------------------------------------------------------------- int ExeGetOperationId( const string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero l'identificativo dell'operazione con il nome indicato della macchinata corrente return pMachMgr->GetOperationId( sName) ; } //----------------------------------------------------------------------------- bool ExeIsOperationEmpty( int nId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero lo stato dell'operazione indicata della macchinata corrente return pMachMgr->IsOperationEmpty( nId) ; } //----------------------------------------------------------------------------- bool ExeRemoveOperation( int nId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // elimino l'operazione indicata della macchinata corrente bool bOk = pMachMgr->RemoveOperation( nId) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtRemoveOperation(" + ToString( nId) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeRemoveAllPhaseOperations( int nPhase) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // elimino tutte le operazioni (tranne la disposizione) della fase indicata della macchinata corrente bool bOk = pMachMgr->RemoveAllPhaseOperations( nPhase) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtRemoveAllPhaseOperations(" + ToString( nPhase) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeRemoveAllOperations( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // elimino tutte le operazioni e le fasi della macchinata corrente tranne la prima disposizione bool bOk = pMachMgr->RemoveAllOperations() ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtRemoveAllOperations()" " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeSetOperationMode( int nId, bool bActive) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto lo stato dell'operazione bool bOk = pMachMgr->SetOperationMode( nId, bActive) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtSetOperationMode(" + ToString( nId) + "," + ( bActive ? "true" : "false") + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeGetOperationMode( int nId, bool& bActive) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero lo stato dell'operazione return pMachMgr->GetOperationMode( nId, bActive) ; } //----------------------------------------------------------------------------- bool ExeSetAllOperationsMode( bool bActive) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto lo stato di tutte le operazioni bool bOk = pMachMgr->SetAllOperationsMode( true, bActive) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtSetAllOperationsMode(" + string( bActive ? "true" : "false") + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeSetOperationStatus( int nId, bool bShow) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto lo stato di visualizzazione dell'operazione bool bOk = pMachMgr->SetOperationStatus( nId, bShow) ; // non cambia lo stato di modificato del progetto // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtSetOperationStatus(" + ToString( nId) + "," + ( bShow ? "true" : "false") + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeGetOperationStatus( int nId, bool& bShow) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero lo stato di visualizzazione dell'operazione return pMachMgr->GetOperationStatus( nId, bShow) ; } //----------------------------------------------------------------------------- bool ExeSetAllOperationsStatus( bool bShow) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto lo stato di visualizzazione di tutte le operazioni bool bOk = pMachMgr->SetAllOperationsStatus( true, bShow) ; // non cambia lo stato di modificato del progetto // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtSetAllOperationsStatus(" + string( bShow ? "true" : "false") + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeChangeOperationPhase( int nId, int nNewPhase) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // cambio la fase dell'operazione e la sposto in fondo alle lavorazioni della stessa fase bool bOk = pMachMgr->ChangeOperationPhase( nId, nNewPhase) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtChangeOperationPhase(" + ToString( nId) + "," + ToString( nNewPhase) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- int ExeGetPhaseLastOperation( int nPhase) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero l'ultima operazione della fase indicata return pMachMgr->GetPhaseLastOperation( nPhase) ; } //----------------------------------------------------------------------------- bool ExeRemoveOperationHome( int nId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // rimuovo posizionamento finale in home dalla operazione indicata return pMachMgr->RemoveOperationHome( nId) ; } //----------------------------------------------------------------------------- // Disposizioni //----------------------------------------------------------------------------- int ExeGetPhaseDisposition( int nPhase) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero la disposizione della fase indicata return pMachMgr->GetPhaseDisposition( nPhase) ; } //----------------------------------------------------------------------------- bool ExeSpecialApplyDisposition( int nId, bool bRecalc) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // eseguo azione speciale su disposizione indicata return pMachMgr->DispositionSpecialApply( nId, bRecalc) ; } //----------------------------------------------------------------------------- // Lavorazioni //----------------------------------------------------------------------------- int ExeAddMachining( const string& sName, const string& sMachining) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // aggiunge una lavorazione, prendendo i dati dalla libreria int nId = pMachMgr->AddMachining( sName, sMachining) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtAddMachining(" + sName + "," + sMachining + ")" + " -- Id=" + ToString( nId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return nId ; } //----------------------------------------------------------------------------- int ExeAddMachining( const string& sName, int nMchType, const string& sTool) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // aggiunge una lavorazione dati tipo e nome utensile int nId = pMachMgr->AddMachining( sName, nMchType, sTool) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtCreateMachining(" + sName + "," + ToString( nMchType) + "," + sTool + ")" + " -- Id=" + ToString( nId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return nId ; } //----------------------------------------------------------------------------- bool ExeSetCurrMachining( int nId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto la lavorazione di identificativo Id come corrente bool bOk = pMachMgr->SetCurrMachining( nId) ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtSetCurrMachining(" + ToString( nId) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeResetCurrMachining( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // reset della lavorazione corrente bool bOk = pMachMgr->ResetCurrMachining() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtResetCurrMachining()" " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- int ExeGetCurrMachining( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // restituisco l'identificativo della lavorazione corrente return pMachMgr->GetCurrMachining() ; } //----------------------------------------------------------------------------- bool ExeSetMachiningParam( int nType, bool bVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto un parametro alla lavorazione corrente bool bChanged ; bool bOk = pMachMgr->SetMachiningParam( nType, bVal, &bChanged) ; if ( bChanged) ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtSetMachiningParam(" + ToString( nType) + "," + ( bVal ? "true" : "false") + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeSetMachiningParam( int nType, int nVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto un parametro alla lavorazione corrente bool bChanged ; bool bOk = pMachMgr->SetMachiningParam( nType, nVal, &bChanged) ; if ( bChanged) ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtSetMachiningParam(" + ToString( nType) + "," + ToString( nVal) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeSetMachiningParam( int nType, double dVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto un parametro alla lavorazione corrente bool bChanged ; bool bOk = pMachMgr->SetMachiningParam( nType, dVal, &bChanged) ; if ( bChanged) ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtSetMachiningParam(" + ToString( nType) + "," + ToString( dVal) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeSetMachiningParam( int nType, const string& sVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto un parametro alla lavorazione corrente bool bChanged ; bool bOk = pMachMgr->SetMachiningParam( nType, sVal, &bChanged) ; if ( bChanged) ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtSetMachiningParam(" + ToString( nType) + "," + sVal + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeSetMachiningGeometry( const SELVECTOR& vIds) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto la geometria alla lavorazione corrente bool bOk = pMachMgr->SetMachiningGeometry( vIds) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtSetMachiningGeometry({" + SelListToString( vIds) + "})" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExePreviewMachining( bool bRecalc) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto la geometria alla lavorazione corrente bool bOk = pMachMgr->MachiningPreview( bRecalc) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtPreviewMachining(" + ToString( bRecalc) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeApplyMachining( bool bRecalc) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto la geometria alla lavorazione corrente bool bOk = pMachMgr->MachiningApply( bRecalc) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtApplyMachining(" + ToString( bRecalc) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeGetMachiningParam( int nType, bool& bVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero un parametro alla lavorazione corrente return pMachMgr->GetMachiningParam( nType, bVal) ; } //----------------------------------------------------------------------------- bool ExeGetMachiningParam( int nType, int& nVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero un parametro alla lavorazione corrente return pMachMgr->GetMachiningParam( nType, nVal) ; } //----------------------------------------------------------------------------- bool ExeGetMachiningParam( int nType, double& dVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero un parametro alla lavorazione corrente return pMachMgr->GetMachiningParam( nType, dVal) ; } //----------------------------------------------------------------------------- bool ExeGetMachiningParam( int nType, string& sVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero un parametro alla lavorazione corrente return pMachMgr->GetMachiningParam( nType, sVal) ; } //----------------------------------------------------------------------------- bool ExeGetMachiningGeometry( SELVECTOR& vIds) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero la geometria di origine della lavorazione corrente return pMachMgr->GetMachiningGeometry( vIds) ; } //----------------------------------------------------------------------------- bool ExeIsMachiningEmpty( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // restituisco lo stato della lavorazione corrente return pMachMgr->IsMachiningEmpty() ; } //----------------------------------------------------------------------------- // Simulazione //----------------------------------------------------------------------------- bool ExeSimStart( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // avvio la simulazione della macchinata corrente return pMachMgr->SimStart() ; } //----------------------------------------------------------------------------- bool ExeSimMove( int& nStatus) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // eseguo movimento di simulazione della macchinata corrente return pMachMgr->SimMove( nStatus) ; } //----------------------------------------------------------------------------- bool ExeSimHome( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // eseguo movimento in home return pMachMgr->SimGoHome() ; } //----------------------------------------------------------------------------- bool ExeSimGetAxisInfoPos( int nI, string& sToken, bool& bLinear, double& dVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero stringa con info asse di simulazione return pMachMgr->SimGetAxisInfoPos( nI, sToken, bLinear, dVal) ; } //----------------------------------------------------------------------------- bool ExeSimGetToolInfo( string& sName, double& dSpeed) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero dati dell'utensile return pMachMgr->SimGetToolInfo( sName, dSpeed) ; } //----------------------------------------------------------------------------- bool ExeSimGetMoveInfo( int& nGmove, double& dFeed) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero dati sul movimento corrente return pMachMgr->SimGetMoveInfo( nGmove, dFeed) ; } //----------------------------------------------------------------------------- bool ExeSimSetStep( double dStep) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto lo step di riferimento per la simulazione della macchinata corrente return pMachMgr->SimSetStep( dStep) ; } //----------------------------------------------------------------------------- bool ExeSimStop( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // termino la simulazione della macchinata corrente return pMachMgr->SimStop() ; } //----------------------------------------------------------------------------- // Generazione //----------------------------------------------------------------------------- bool ExeGenerate( const string& sCncFile, const string& sInfo) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // eseguo la generazione del part-program della macchinata corrente return pMachMgr->Generate( sCncFile, sInfo) ; } //----------------------------------------------------------------------------- // Machine Calc //----------------------------------------------------------------------------- bool ExeSetCalcTable( const string& sTable) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto la tavola corrente della macchinata corrente per i calcoli return pMachMgr->SetCalcTable( sTable) ; } //----------------------------------------------------------------------------- bool ExeSetCalcTool( const string& sTool, const string& sHead, int nExit) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto l'utensile corrente per il calcolo sulla macchina della macchinata corrente return pMachMgr->SetCalcTool( sTool, sHead, nExit) ; } //---------------------------------------------------------------------------- bool ExeSetRotAxisBlock( const string& sAxis, double dVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto asse da bloccare con il suo valore return pMachMgr->SetRotAxisBlock( sAxis, dVal) ; } //----------------------------------------------------------------------------- bool ExeGetCalcTool( string& sTool) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // restituisco il nome dell'utensile corrente per il calcolo sulla macchina della macchinata corrente return pMachMgr->GetCalcTool( sTool) ; } //----------------------------------------------------------------------------- bool ExeGetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA, int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // calcolo gli angoli macchina dalle direzioni fresa e ausiliaria passate return pMachMgr->GetCalcAngles( vtDirT, vtDirA, nStat, dAngA1, dAngB1, dAngA2, dAngB2) ; } //----------------------------------------------------------------------------- bool ExeGetCalcPositions( const Point3d& ptP, double dAngA, double dAngB, int& nStat, double& dX, double& dY, double& dZ) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // calcolo gli angoli macchina dalla direzione fresa passata return pMachMgr->GetCalcPositions( ptP, dAngA, dAngB, nStat, dX, dY, dZ) ; } //----------------------------------------------------------------------------- bool ExeGetCalcTipFromPositions( double dX, double dY, double dZ, double dAngA, double dAngB, bool bBottom, Point3d& ptTip) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // calcolo il tip utensile dagli assi macchina return pMachMgr->GetCalcTipFromPositions( dX, dY, dZ, dAngA, dAngB, false, bBottom, ptTip) ; } //----------------------------------------------------------------------------- bool ExeGetCalcToolDirFromAngles( double dAngA, double dAngB, Vector3d& vtDir) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // calcolo il tip utensile dagli assi macchina return pMachMgr->GetCalcToolDirFromAngles( dAngA, dAngB, vtDir) ; } //----------------------------------------------------------------------------- bool ExeVerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // verifica l'extracorsa degli assi return pMachMgr->VerifyOutstroke( dX, dY, dZ, dAngA, dAngB, nStat) ; } //----------------------------------------------------------------------------- bool ExeGetOutstrokeInfo( string& sInfo) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero informazioni su extracorsa degli assi sInfo = pMachMgr->GetOutstrokeInfo() ; return ( ! sInfo.empty()) ; } //----------------------------------------------------------------------------- // Machine //----------------------------------------------------------------------------- int ExeGetBaseId( const string& sBase) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // restituisco identificativo della base indicata nella macchina della macchinata corrente return pMachMgr->GetBaseId( sBase) ; } //----------------------------------------------------------------------------- int ExeGetTableId( const string& sTable) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // restituisco identificativo della tavola indicata nella macchina della macchinata corrente return pMachMgr->GetTableId( sTable) ; } //----------------------------------------------------------------------------- int ExeGetAxisId( const string& sAxis) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // restituisco identificativo dell'asse indicato nella macchina della macchinata corrente return pMachMgr->GetAxisId( sAxis) ; } //----------------------------------------------------------------------------- int ExeGetHeadId( const string& sHead) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // restituisco identificativo della testa indicata nella macchina della macchinata corrente return pMachMgr->GetHeadId( sHead) ; } //----------------------------------------------------------------------------- int ExeGetHeadExitCount( const string& sHead) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // restituisco numero di uscite della testa indicata nella macchina della macchinata corrente return pMachMgr->GetHeadExitCount( sHead) ; } //----------------------------------------------------------------------------- bool ExeGetAxisToken( const string& sAxis, string& sToken) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il token dell'asse return pMachMgr->GetAxisToken( sAxis, sToken) ; } //----------------------------------------------------------------------------- bool ExeSetAxisPos( const string& sAxis, double dVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // metto l'asse nella nuova posizione return pMachMgr->SetAxisPos( sAxis, dVal) ; } //----------------------------------------------------------------------------- bool ExeGetAxisPos( const string& sAxis, double* pdVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // verifico il parametro di ritorno if ( pdVal == nullptr) return false ; // metto l'asse nella nuova posizione return pMachMgr->GetAxisPos( sAxis, *pdVal) ; } //----------------------------------------------------------------------------- bool ExeGetAxisHomePos( const string& sAxis, double* pdHomeVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // verifico il parametro di ritorno if ( pdHomeVal == nullptr) return false ; // metto l'asse nella nuova posizione return pMachMgr->GetAxisHomePos( sAxis, *pdHomeVal) ; } //----------------------------------------------------------------------------- bool ExeResetAxisPos( const string& sAxis) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // metto l'asse nella posizione home return pMachMgr->ResetAxisPos( sAxis) ; } //----------------------------------------------------------------------------- bool ExeLoadTool( const string& sHead, int nExit, const string& sTool) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // carico l'utensile sulla macchina della macchinata corrente in posizione indicata return pMachMgr->LoadTool( sHead, nExit, sTool) ; } //----------------------------------------------------------------------------- bool ExeGetLoadedTool( const string& sHead, int nExit, string& sTool) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupera l'utensile sulla macchina della macchinata corrente in posizione indicata return pMachMgr->GetLoadedTool( sHead, nExit, sTool) ; } //----------------------------------------------------------------------------- bool ExeUnloadTool( const string& sHead, int nExit) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // scaric l'utensile dalla posizione indicata della macchina della macchinata corrente return pMachMgr->UnloadTool( sHead, nExit) ; } //----------------------------------------------------------------------------- bool ExeResetHeadSet( const string& sHead) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // reset dell'insieme di teste corrente sulla macchina della macchinata corrente return pMachMgr->ResetHeadSet( sHead) ; } //----------------------------------------------------------------------------- bool ExeSetMachineLook( int nFlag) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto l'aspetto della macchina della macchinata corrente return pMachMgr->SetMachineLook( nFlag) ; }