//---------------------------------------------------------------------------- // EgalTech 2015-2019 //---------------------------------------------------------------------------- // File : EXE_MachMgr.cpp Data : 15.10.19 Versione : 2.1j4 // 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/EXeConst.h" #include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EMkToolConst.h" #include "/EgtDev/Include/EMkOperationConst.h" #include "/EgtDev/Include/EMkSimuGenConst.h" #include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EGnEgtUUID.h" #include "/EgtDev/Include/EgtStringConverter.h" #include "/EgtDev/Include/EgtIniFile.h" #include "/EgtDev/Include/EgtPointerOwner.h" using namespace std ; //----------------------------------------------------------------------------- bool ExeInitMachMgr( const string& sMachinesDir, const string& sToolMakersDir) { 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, sToolMakersDir, 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) ; } //----------------------------------------------------------------------------- // Errors & Warnings //----------------------------------------------------------------------------- int ExeGetLastMachMgrErrorId( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, 1) // restituisco l'errore return pMachMgr->GetLastErrorId() ; } //----------------------------------------------------------------------------- string ExeGetLastMachMgrErrorString( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, "MachMgr invalid") // restituisco l'errore return pMachMgr->GetLastErrorString() ; } //----------------------------------------------------------------------------- int ExeGetMachMgrWarningId( int nInd) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, 1) // restituisco l'avviso return pMachMgr->GetWarningId( nInd) ; } //----------------------------------------------------------------------------- string ExeGetMachMgrWarningString( int nInd) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, "MachMgr invalid") // restituisco l'avviso return pMachMgr->GetWarningString( nInd) ; } //----------------------------------------------------------------------------- // Machines //----------------------------------------------------------------------------- bool ExeGetMachines( STRVECTOR& vsMachineNames, STRVECTOR& vsMachineDirs) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero le macchine disponibili return pMachMgr->GetMachines( vsMachineNames, vsMachineDirs) ; } //----------------------------------------------------------------------------- bool ExeSetCurrMachine( const string& sMachineName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto la macchina corrente bool bOk = pMachMgr->SetCurrMachine( sMachineName) ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtSetCurrMachine('" + sMachineName + "')" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- 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) ; } //----------------------------------------------------------------------------- int ExeGetLastMachGroup( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero l'ultima macchinata return pMachMgr->GetLastMachGroup() ; } //----------------------------------------------------------------------------- int ExeGetPrevMachGroup( int nId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero la precedente macchinata return pMachMgr->GetPrevMachGroup( 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 ; } //----------------------------------------------------------------------------- int ExeCopyMachGroup( const string& sSouName, const string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // copio la macchinata (gruppo di lavorazione) int nId = pMachMgr->CopyMachGroup( sSouName, sName) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtCopyMachGroup('" + sSouName + "','" + sName + "')" + " -- 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 ExeChangeMachGroupName( int nId, const string& sNewName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // cambia il nome della macchinata bool bOk = pMachMgr->ChangeMachGroupName( nId, sNewName) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtChangeMachGroupName(" + ToString( nId) + ",'" + sNewName + "')" + " -- 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()) ; } //----------------------------------------------------------------------------- bool ExeGetMachGroupMachineName( int nId, string& sMachineName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il nome della macchina usata nella macchinata sMachineName = pMachMgr->GetMachGroupMachineName( nId) ; return ( ! sMachineName.empty()) ; } //----------------------------------------------------------------------------- int ExeGetMachGroupId( const string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero l'identificativo 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() ; } //----------------------------------------------------------------------------- // Phases //----------------------------------------------------------------------------- int ExeAddPhase( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, 0) // aggiungo una nuova fase di lavorazione alla macchinata corrente int nInd = pMachMgr->AddPhase() ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtAddPhase()" " -- Ind=" + ToString( nInd) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return nInd ; } //----------------------------------------------------------------------------- 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) ; } //----------------------------------------------------------------------------- bool ExeIsRawPart( int nRawId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // verifico se è un grezzo della macchinata corrente return pMachMgr->IsRawPart( 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 dHeight, Color cCol) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // modifico grezzo indicato nella macchinata corrente bool bOk = pMachMgr->ModifyRawPart( nRawId, nCrvId, dOverMat, 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) ; } //----------------------------------------------------------------------------- bool ExeGetRawPartBBox( int nRawId, BBox3d& b3Raw) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il bounding box del grezzo return pMachMgr->GetRawPartBBox( nRawId, b3Raw) ; } //----------------------------------------------------------------------------- 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) ; // 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 ExeSetTableAreaOffset( double dOffsXP, double dOffsYP, double dOffsXM, double dOffsYM) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto l'offset dell'area utile della tavola corrente return pMachMgr->SetTableAreaOffset( dOffsXP, dOffsYP, dOffsXM, dOffsYM) ; } //----------------------------------------------------------------------------- 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 ExeGetTableAreaOffset( int nInd, BBox3d& b3AreaOffs) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero l'estensione dell'area utile con offset della fase corrente della tavola corrente della macchinata corrente return pMachMgr->GetTableAreaOffset( nInd, b3AreaOffs) ; } //----------------------------------------------------------------------------- bool ExeChangeTable( const string& sTable, bool bUpdateDisp) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto la tavola corrente della macchinata corrente return pMachMgr->ChangeTable( sTable, bUpdateDisp) ; } //----------------------------------------------------------------------------- bool ExeShowOnlyTable( bool bVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // visualizzo solo la tavola corrente della macchinata corrente return pMachMgr->ShowOnlyTable( bVal) ; } //----------------------------------------------------------------------------- bool ExeMoveDispAxis( const string& sName, double dPos) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // eseguo e registro il movimento dell'asse bool bOk = pMachMgr->MoveDispAxis( sName, dPos) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtMoveDispAxis('" + StringToLuaString( sName) + "'," + ToString( dPos) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeRemoveDispAxis( const string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // eseguo e registro la rimozione del movimento dell'asse bool bOk = pMachMgr->RemoveDispAxis( sName) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtRemoveDispAxis('" + StringToLuaString( sName) + "')" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- bool ExeKeepAllDispAxes( int nSouPhase) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // confermo i movimenti degli assi di disposizione nella fase corrente della macchinata corrente bool bOk = pMachMgr->KeepAllDispAxes( nSouPhase) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtKeepAllDispAxes(" + ToString( nSouPhase) + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } // restituisco il risultato return bOk ; } //----------------------------------------------------------------------------- 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('" + StringToLuaString( 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) // vario la rotazione del 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 ExeSetFixtureLink( int nFxtId, const string& sTaLink) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto il collegamento all'asse di tavola indicato bool bOk = pMachMgr->SetFixtureLink( nFxtId, sTaLink) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtSetFixtureLink(" + ToString( nFxtId) + ",'" + StringToLuaString( sTaLink) + "')" + " -- 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) // varia il movimento della parte mobile della morsa della quantità indicata 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 ; } //----------------------------------------------------------------------------- bool ExeSetFixtureMobile( int nFxtId, double dMove) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposta il movimento della parte mobile della morsa alla quantità indicata bool bOk = pMachMgr->SetFixtureMobile( nFxtId, dMove) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtSetFixtureMobile(" + ToString( nFxtId) + "," + ToString( dMove) + ")" + " -- 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 ExeTdbSetCurrToolValInNotes( int nType, const string& sKey, bool bVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto il valore con chiave al parametro stringa dell'utensile return pMachMgr->TdbSetCurrToolValInNotes( nType, sKey, bVal) ; } //----------------------------------------------------------------------------- bool ExeTdbSetCurrToolValInNotes( int nType, const string& sKey, int nVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto il valore con chiave al parametro stringa dell'utensile return pMachMgr->TdbSetCurrToolValInNotes( nType, sKey, nVal) ; } //----------------------------------------------------------------------------- bool ExeTdbSetCurrToolValInNotes( int nType, const string& sKey, double dVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto il valore con chiave al parametro stringa dell'utensile return pMachMgr->TdbSetCurrToolValInNotes( nType, sKey, dVal) ; } //----------------------------------------------------------------------------- bool ExeTdbSetCurrToolValInNotes( int nType, const string& sKey, const string& sVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto il valore con chiave al parametro stringa dell'utensile return pMachMgr->TdbSetCurrToolValInNotes( nType, sKey, sVal) ; } //----------------------------------------------------------------------------- bool ExeTdbRemoveCurrToolValInNotes( int nType, const string& sKey) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // rimuovo il valore con chiave dal parametro stringa dell'utensile return pMachMgr->TdbRemoveCurrToolValInNotes( nType, sKey) ; } //----------------------------------------------------------------------------- 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 ExeTdbGetCurrToolValInNotes( int nType, const string& sKey, bool& bVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il valore con chiave al parametro stringa dell'utensile return pMachMgr->TdbGetCurrToolValInNotes( nType, sKey, bVal) ; } //----------------------------------------------------------------------------- bool ExeTdbGetCurrToolValInNotes( int nType, const string& sKey, int& nVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il valore con chiave al parametro stringa dell'utensile return pMachMgr->TdbGetCurrToolValInNotes( nType, sKey, nVal) ; } //----------------------------------------------------------------------------- bool ExeTdbGetCurrToolValInNotes( int nType, const string& sKey, double& dVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il valore con chiave al parametro stringa dell'utensile return pMachMgr->TdbGetCurrToolValInNotes( nType, sKey, dVal) ; } //----------------------------------------------------------------------------- bool ExeTdbGetCurrToolValInNotes( int nType, const string& sKey, string& sVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il valore con chiave al parametro stringa dell'utensile return pMachMgr->TdbGetCurrToolValInNotes( nType, sKey, sVal) ; } //----------------------------------------------------------------------------- bool ExeTdbGetCurrToolMaxDepth( double& dMaxDepth) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il massimo affondamento dell'utensile return pMachMgr->TdbGetCurrToolMaxDepth( dMaxDepth) ; } //----------------------------------------------------------------------------- bool ExeTdbGetCurrToolThDiam( double& dThDiam) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il diametro del portautensili return pMachMgr->TdbGetCurrToolThDiam( dThDiam) ; } //----------------------------------------------------------------------------- bool ExeTdbGetCurrToolThLength( double& dThLen) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero la lunghezza del portautensili return pMachMgr->TdbGetCurrToolThLength( dThLen) ; } //----------------------------------------------------------------------------- bool ExeTdbCurrToolIsStandardDraw( bool& bStandard) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il nome del disegno dell'utensile string sDraw ; if ( ! pMachMgr->TdbGetCurrToolParam( TPA_DRAW, sDraw)) return false ; // verifico il tipo bStandard = IsUUID( GetFileTitleEgt( sDraw)) ; return true ; } //----------------------------------------------------------------------------- int ExeTdbCurrToolDraw( int nGenCtx, int nToolCtx) { ExeSetCurrentContext( nGenCtx) ; IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, 999) // recupero il disegno dell'utensile return pMachMgr->TdbCurrToolDraw( nGenCtx, nToolCtx) ; } //----------------------------------------------------------------------------- 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) ; } //----------------------------------------------------------------------------- bool ExeTdbExport( const STRVECTOR& vsToolsNames, const string& sOutFile) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // eseguo esportazione degli utensili indicati return pMachMgr->TdbExport( vsToolsNames, sOutFile) ; } //----------------------------------------------------------------------------- bool ExeTdbToBeImported( const string& sFile, STRVECTOR& vsToolsNames, INTVECTOR& vToolsTypes) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // restituisco nomi e tipi degli utensili importabili return pMachMgr->TdbToBeImported( sFile, vsToolsNames, vToolsTypes) ; } //----------------------------------------------------------------------------- bool ExeTdbImport( const string& sFile, const STRVECTOR& vsToolsToImport, const STRVECTOR& vsToolsNames, STRVECTOR& vsImported) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // eseguo l'importazione degli utensili indicati return pMachMgr->TdbImport( sFile, vsToolsToImport, vsToolsNames, vsImported) ; } //----------------------------------------------------------------------------- // Setup //----------------------------------------------------------------------------- int ExeGetCurrSetup( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero l'identificativo del gruppo di attrezzaggio della macchinata corrente return pMachMgr->GetCurrSetup() ; } //----------------------------------------------------------------------------- bool ExeGetDefaultSetupName( string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il nome dell'attrezzaggio di default return pMachMgr->GetDefaultSetupName( sName) ; } //----------------------------------------------------------------------------- bool ExeImportSetup( const string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // eseguo importazione return pMachMgr->ImportSetup( sName) ; } //----------------------------------------------------------------------------- bool ExeExistsCurrSetup( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // eseguo la verifica return pMachMgr->ExistsCurrSetup() ; } //----------------------------------------------------------------------------- bool ExeVerifyCurrSetup( STRVECTOR& vsErrors) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // eseguo la verifica return pMachMgr->VerifyCurrSetup( vsErrors) ; } //----------------------------------------------------------------------------- bool ExeFindToolInCurrSetup( const string& sTool) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // eseguo la verifica return pMachMgr->FindToolInCurrSetup( sTool) ; } //----------------------------------------------------------------------------- bool ExeGetToolSetupPosInCurrSetup( const string& sTool, string& sTcPos) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // eseguo la verifica return pMachMgr->GetToolSetupPosInCurrSetup( sTool, sTcPos) ; } //----------------------------------------------------------------------------- bool ExeGetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // eseguo la verifica return pMachMgr->GetToolsInCurrSetupPos( sTcPos, vsTools) ; } //----------------------------------------------------------------------------- bool ExeUpdateCurrSetup( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // eseguo l'aggiornamento return pMachMgr->UpdateCurrSetup() ; } //----------------------------------------------------------------------------- bool ExeEraseCurrSetup( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // eseguo la cancellazione return pMachMgr->EraseCurrSetup() ; } //----------------------------------------------------------------------------- // 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) ; } //----------------------------------------------------------------------------- bool ExeMdbExport( const STRVECTOR& vsMachiningsNames, const string& sOutFile) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // eseguo esportazione delle lavorazioni indicate return pMachMgr->MdbExport( vsMachiningsNames, sOutFile) ; } //----------------------------------------------------------------------------- bool ExeMdbToBeImported( const string& sFile, STRVECTOR& vsMachiningsNames, INTVECTOR& vMachiningsTypes) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // restituisco nomi e tipi delle lavorazioni importabili return pMachMgr->MdbToBeImported( sFile, vsMachiningsNames, vMachiningsTypes) ; } //----------------------------------------------------------------------------- bool ExeMdbImport( const string& sFile, const STRVECTOR& vsMachiningsToImport, const STRVECTOR& vsMachiningsNames, STRVECTOR& vsImported) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // eseguo l'importazione delle lavorazioni indicate return pMachMgr->MdbImport( sFile, vsMachiningsToImport, vsMachiningsNames, vsImported) ; } //----------------------------------------------------------------------------- // 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( bool bNeedMachNotEmpty) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero la prima operazione attiva della macchinata corrente return pMachMgr->GetFirstActiveOperation( bNeedMachNotEmpty) ; } //----------------------------------------------------------------------------- int ExeGetNextActiveOperation( int nId, bool bNeedMachNotEmpty) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero la successiva operazione attiva della macchinata corrente return pMachMgr->GetNextActiveOperation( nId, bNeedMachNotEmpty) ; } //----------------------------------------------------------------------------- int ExeGetLastActiveOperation( bool bNeedMachNotEmpty) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero l'ultima operazione attiva della macchinata corrente return pMachMgr->GetLastActiveOperation( bNeedMachNotEmpty) ; } //----------------------------------------------------------------------------- int ExeGetPrevActiveOperation( int nId, bool bNeedMachNotEmpty) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // recupero la precedente operazione attiva della macchinata corrente return pMachMgr->GetPrevActiveOperation( nId, bNeedMachNotEmpty) ; } //----------------------------------------------------------------------------- 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 ExeSetOperationName( int nId, const string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // assegno il nuovo nome alla operazione della macchinata corrente bool bOk = pMachMgr->SetOperationName( nId, sName) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtSetOperationName(" + ToString( nId) + "," + sName + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeGetOperationName( int nId, string& sName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il nome 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, int nEmptyType) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero lo stato dell'operazione indicata della macchinata corrente return pMachMgr->IsOperationEmpty( nId, nEmptyType) ; } //----------------------------------------------------------------------------- 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 ExeAdjustOperationPhase( int nId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposta la fase della lavorazione in base alla sua posizione nella lista bool bOk = pMachMgr->AdjustOperationPhase( nId) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtAdjustOperationPhase(" + ToString( nId) + ")" + " -- 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 bool bOk = pMachMgr->DispositionSpecialApply( nId, bRecalc) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtSpecialApplyDisposition(" + ToString( nId) + "," + ( bRecalc ? "true" : "false") + ")" + " -- Id=" + ToString( nId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeSpecialUpdateDisposition( int nId) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // aggiorno assi macchina e collegamento con precedente della disposizione indicata bool bOk = pMachMgr->DispositionSpecialUpdate( nId) ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtSpecialUpdateDisposition(" + ToString( nId) + ")" + " -- Id=" + ToString( nId) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeGetDispositionToolData( int nId, string& sName, string& sHead, int& nExit, string& sTcPos) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // aggiorno assi macchina e collegamento con precedente della disposizione indicata return pMachMgr->GetDispositionToolData( nId, sName, sHead, nExit, sTcPos) ; } //----------------------------------------------------------------------------- // 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 ; } //----------------------------------------------------------------------------- int ExeCopyMachining( const string& sName, const string& sSouName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // copia una lavorazione int nId = pMachMgr->CopyMachining( sName, sSouName) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtCopyMachining(" + sName + "," + sSouName + ")" + " -- 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) // eseguo il ricalcolo del preview sulla lavorazione corrente bool bOk = pMachMgr->MachiningPreview( bRecalc) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtPreviewMachining(" + string( bRecalc ? "true" : "false") + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeApplyMachining( bool bRecalc, bool bPostApply) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // ricalcolo la lavorazione corrente bool bOk = pMachMgr->MachiningApply( bRecalc, bPostApply) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtApplyMachining(" + string( bRecalc ? "true" : "false") + "," + string( bPostApply ? "true" : "false") + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeUpdateMachining( bool bPostApply) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // aggiorno assi macchina e collegamento con precedente della lavorazione corrente bool bOk = pMachMgr->MachiningUpdate( bPostApply) ; ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtUpdateMachining(" + string( bPostApply ? "true" : "false") + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeChangePreviewMachiningToolShow( int nLookFlag) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // impostazione tipo visualizzazione anteprima utensile su lavorazione return pMachMgr->ChangePreviewMachiningToolShow( nLookFlag) ; } //----------------------------------------------------------------------------- bool ExePreparePreviewMachiningTool( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // preparazione per visualizzazione anteprima utensile su lavorazione return pMachMgr->PreparePreviewMachiningTool() ; } //----------------------------------------------------------------------------- bool ExeRemovePreviewMachiningTool( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // rimozione per visualizzazione anteprima utensile su lavorazione return pMachMgr->RemovePreviewMachiningTool() ; } //----------------------------------------------------------------------------- int ExeGetPreviewMachiningToolStepCount( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, -1) // restituisce il numero di passi per anteprima utensile presenti nella lavorazione return pMachMgr->GetPreviewMachiningToolStepCount() ; } //----------------------------------------------------------------------------- int ExePreviewMachiningTool( int nEntId, int nStep) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // visualizzazione anteprima utensile su lavorazione return pMachMgr->PreviewMachiningTool( nEntId, nStep) ; } //----------------------------------------------------------------------------- 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 ExeGetMachiningSkippedGeometry( SELVECTOR& vIds) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero la geometria non lavorata della lavorazione corrente return pMachMgr->GetMachiningSkippedGeometry( vIds) ; } //----------------------------------------------------------------------------- bool ExeIsMachiningEmpty( int nEmptyType) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // restituisco lo stato della lavorazione corrente return pMachMgr->IsMachiningEmpty( nEmptyType) ; } //----------------------------------------------------------------------------- bool ExeGetMachiningStartPoint( Point3d& ptStart) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // restituisco quanto cercato return pMachMgr->GetMachiningStartPoint( ptStart) ; } //----------------------------------------------------------------------------- bool ExeGetMachiningEndPoint( Point3d& ptEnd) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // restituisco quanto cercato return pMachMgr->GetMachiningEndPoint( ptEnd) ; } //----------------------------------------------------------------------------- bool ExeGetMachiningStartAxes( bool bSkipClimb, DBLVECTOR& vAxVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // restituisco quanto cercato return pMachMgr->GetMachiningStartAxes( bSkipClimb, vAxVal) ; } //----------------------------------------------------------------------------- bool ExeGetMachiningEndAxes( bool bSkipRise, DBLVECTOR& vAxVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // restituisco quanto cercato return pMachMgr->GetMachiningEndAxes( bSkipRise, vAxVal) ; } //----------------------------------------------------------------------------- bool ExeApplyAllMachinings( bool bRecalc, bool bStopOnFirstErr, string& sErrList) { string sWarnList ; return ExeApplyAllMachiningsEx( bRecalc, bStopOnFirstErr, sErrList, sWarnList) ; } //----------------------------------------------------------------------------- bool ExeApplyAllMachiningsEx( bool bRecalc, bool bStopOnFirstErr, string& sErrList, string& sWarnList) { sErrList.clear() ; sWarnList.clear() ; IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // Recupero stato corrente di visualizzazione della macchina int nCurrLook = pMachMgr->GetMachineLook() ; pMachMgr->SetMachineLook( MCH_LOOK_ALL) ; // Recupero fase corrente e lavorazione corrente della macchinata corrente int nCurrPhase = pMachMgr->GetCurrPhase() ; int nCurrMach = pMachMgr->GetCurrMachining() ; // Eseguo ricalcolo ordinato per tutte le operazioni attive in lista bool bOk = true ; int nOperId = pMachMgr->GetFirstActiveOperation() ; while ( nOperId != GDB_ID_NULL) { if ( pMachMgr->GetOperationType( nOperId) == OPER_DISP) { pMachMgr->SetCurrPhase( pMachMgr->GetOperationPhase( nOperId)) ; if ( ! pMachMgr->DispositionSpecialApply( nOperId, true)) { bOk = false ; if ( pMachMgr->GetLastErrorId() != 0) sErrList += pMachMgr->GetOperationName( nOperId) + " -> " + pMachMgr->GetLastErrorString() + "\r\n" ; if ( bStopOnFirstErr) break ; } int i = 0 ; while ( pMachMgr->GetWarningId( i) != 0) { sWarnList += pMachMgr->GetOperationName( nOperId) + " -> " + pMachMgr->GetWarningString( i) + "\r\n" ; ++ i ; } } else { pMachMgr->SetCurrMachining( nOperId) ; if ( ! pMachMgr->MachiningApply( bRecalc, true)) { bOk = false ; if ( pMachMgr->GetLastErrorId() != 0) { sErrList += pMachMgr->GetOperationName( nOperId) + " -> " + pMachMgr->GetLastErrorString() ; string sInfo = pMachMgr->GetOutstrokeInfo( ExeUiUnitsAreMM()) ; if ( ! sInfo.empty()) sErrList += sInfo ; sErrList += "\r\n" ; } if ( bStopOnFirstErr) break ; } int i = 0 ; while ( pMachMgr->GetWarningId( i) != 0) { sWarnList += pMachMgr->GetOperationName( nOperId) + " -> " + pMachMgr->GetWarningString( i) + "\r\n" ; ++ i ; } } nOperId = pMachMgr->GetNextActiveOperation( nOperId) ; } // Ripristino fase e lavorazione inizialmente correnti pMachMgr->SetCurrPhase( nCurrPhase) ; if ( nCurrMach != GDB_ID_NULL) pMachMgr->SetCurrMachining( nCurrMach) ; else pMachMgr->ResetCurrMachining() ; // Ripristino stato visualizzazione macchina pMachMgr->SetMachineLook( nCurrLook) ; // Se richiesto ricalcolo, progetto modificato if ( bRecalc) ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtApplyAllMachinings(" + string( bRecalc ? "true" : "false") + "," + string( bStopOnFirstErr ? "true" : "false") + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- bool ExeUpdateAllMachinings( bool bStopOnFirstErr, string& sErrList) { string sWarnList ; return ExeUpdateAllMachiningsEx( bStopOnFirstErr, sErrList, sWarnList) ; } //----------------------------------------------------------------------------- bool ExeUpdateAllMachiningsEx( bool bStopOnFirstErr, string& sErrList, string& sWarnList) { sErrList.clear() ; IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // Recupero stato corrente di visualizzazione della macchina int nCurrLook = pMachMgr->GetMachineLook() ; pMachMgr->SetMachineLook( MCH_LOOK_ALL) ; // Recupero fase corrente e lavorazione corrente della macchinata corrente int nCurrPhase = pMachMgr->GetCurrPhase() ; int nCurrMach = pMachMgr->GetCurrMachining() ; // Eseguo ricalcolo ordinato di assi macchina e link per tutte le operazioni attive in lista bool bOk = true ; int nOperId = pMachMgr->GetFirstActiveOperation() ; while ( nOperId != GDB_ID_NULL) { if ( pMachMgr->GetOperationType( nOperId) == OPER_DISP) { pMachMgr->SetCurrPhase( pMachMgr->GetOperationPhase( nOperId)) ; if ( ! pMachMgr->DispositionSpecialUpdate( nOperId)) { bOk = false ; if ( pMachMgr->GetLastErrorId() != 0) sErrList += pMachMgr->GetLastErrorString() + "\r\n" ; if ( bStopOnFirstErr) break ; } int i = 0 ; while ( pMachMgr->GetWarningId( i) != 0) { sWarnList += pMachMgr->GetOperationName( nOperId) + " -> " + pMachMgr->GetWarningString( i) + "\r\n" ; ++ i ; } } else { pMachMgr->SetCurrMachining( nOperId) ; if ( ! pMachMgr->MachiningUpdate()) { bOk = false ; if ( pMachMgr->GetLastErrorId() != 0) sErrList += pMachMgr->GetLastErrorString() + "\r\n" ; if ( bStopOnFirstErr) break ; } int i = 0 ; while ( pMachMgr->GetWarningId( i) != 0) { sWarnList += pMachMgr->GetOperationName( nOperId) + " -> " + pMachMgr->GetWarningString( i) + "\r\n" ; ++ i ; } } nOperId = pMachMgr->GetNextActiveOperation( nOperId) ; } // Ripristino fase e lavorazione inizialmente correnti pMachMgr->SetCurrPhase( nCurrPhase) ; if ( nCurrMach != GDB_ID_NULL) pMachMgr->SetCurrMachining( nCurrMach) ; else pMachMgr->ResetCurrMachining() ; // Ripristino stato visualizzazione macchina pMachMgr->SetMachineLook( nCurrLook) ; // Progetto modificato ExeSetModified() ; // se richiesto, salvo il comando Lua equivalente if ( IsCmdLog()) { string sLua = "EgtUpdateAllMachinings(" + string( bStopOnFirstErr ? "true" : "false") + ")" + " -- Ok=" + ToString( bOk) ; LOG_INFO( GetCmdLogger(), sLua.c_str()) ; } return bOk ; } //----------------------------------------------------------------------------- // CL Entities Interrogations //----------------------------------------------------------------------------- bool ExeGetClEntMove( int nEntId, int& nMove) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il tipo di movimento return pMachMgr->GetClEntMove( nEntId, nMove) ; } //----------------------------------------------------------------------------- bool ExeGetClEntFlag( int nEntId, int& nFlag, int& nFlag2) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero i flag return pMachMgr->GetClEntFlag( nEntId, nFlag, nFlag2) ; } //----------------------------------------------------------------------------- bool ExeGetClEntIndex( int nEntId, int& nIndex) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero l'indice return pMachMgr->GetClEntIndex( nEntId, nIndex) ; } //----------------------------------------------------------------------------- bool ExeGetClEntFeed( int nEntId, double& dFeed) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero la feed return pMachMgr->GetClEntFeed( nEntId, dFeed) ; } //----------------------------------------------------------------------------- bool ExeGetClEntAxesStatus( int nEntId, int& nStatus) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero lo stato del movimento assi return pMachMgr->GetClEntAxesStatus( nEntId, nStatus) ; } //----------------------------------------------------------------------------- bool ExeGetClEntAxesMask( int nEntId, int& nMask) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero la mascheratura del movimento assi (valida solo in rapido) return pMachMgr->GetClEntAxesMask( nEntId, nMask) ; } //----------------------------------------------------------------------------- bool ExeGetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il valore degli assi return pMachMgr->GetClEntAxesVal( nEntId, vAxes) ; } //----------------------------------------------------------------------------- bool ExeGetClEntTDir( int nEntId, Vector3d& vtTDir) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) ; // recupero TDir return pMachMgr->GetClEntTDir( nEntId, vtTDir) ; } //----------------------------------------------------------------------------- bool ExeGetClEntCDir( int nEntId, Vector3d& vtCDir) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) ; // recupero CDir return pMachMgr->GetClEntCDir( nEntId, vtCDir) ; } //----------------------------------------------------------------------------- bool ExeGetClEntADir( int nEntId, Vector3d& vtADir) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) ; // recupero ADir return pMachMgr->GetClEntADir( nEntId, vtADir) ; } //----------------------------------------------------------------------------- // Simulazione //----------------------------------------------------------------------------- bool ExeSimInit( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // preparo la simulazione della macchinata corrente return pMachMgr->SimInit() ; } //----------------------------------------------------------------------------- bool ExeSimStart( bool bFirst) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // avvio la simulazione della macchinata corrente return pMachMgr->SimStart( bFirst) ; } //----------------------------------------------------------------------------- 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 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 ExeSimSetUiStatus( int nUiStatus) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto lo stato utente del simulatore return pMachMgr->SimSetUiStatus( nUiStatus) ; } //----------------------------------------------------------------------------- bool ExeSimEnableToolTipTrace( bool bEnable) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto abilitazione disegno traccia della punta utensile return pMachMgr->SimEnableToolTipTrace( bEnable) ; } //----------------------------------------------------------------------------- bool ExeSimGetAxisInfoPos( int nI, string& sName, string& sToken, bool& bLinear, double& dVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero stringa con info asse di simulazione return pMachMgr->SimGetAxisInfoPos( nI, sName, 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 ExeSimGetOperationInfo( string& sName, int& nType) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero dati della operazione return pMachMgr->SimGetOperationInfo( sName, nType) ; } //----------------------------------------------------------------------------- bool ExeSimGetMoveInfo( int& nGmove, double& dFeed) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero dati sul movimento corrente return pMachMgr->SimGetMoveInfo( nGmove, dFeed) ; } //----------------------------------------------------------------------------- bool ExeSimExit( void) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // termino la simulazione della macchinata corrente return pMachMgr->SimExit() ; } //----------------------------------------------------------------------------- // Generazione, Stima T&L e Simulazione //----------------------------------------------------------------------------- bool ExeGenerate( const string& sCncFile, const string& sInfo) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) string sMyCncFile = sCncFile ; // se nome file vuoto if ( IsEmptyOrSpaces( sMyCncFile)) { // recupero la path del progetto string sProjPath ; if ( ! ExeGetCurrFilePath( sProjPath)) return false ; // ne deduco il direttorio string sDir = GetDirectory( sProjPath) ; ReplaceString( sDir, "/", "\\") ; // recupero il nome string sNcName ; if ( ExeGetInfo( ExeGetCurrMachGroup(), GDL_NC_NAME, sNcName)) sNcName = GetFileName( sNcName) ; else { string sCurrMachDir ; pMachMgr->GetCurrMachineDir( sCurrMachDir) ; string sCurrMachName ; pMachMgr->GetCurrMachineName( sCurrMachName) ; string sCurrMachIni = sCurrMachDir + "\\" + sCurrMachName + ".ini" ; string sExt = GetPrivateProfileStringUtf8( "PartProgram", "Extension", ".cnc", sCurrMachIni.c_str()) ; sNcName = ChangeFileExtension( GetFileName( sProjPath), sExt) ; } // creo la path completa sMyCncFile = sDir + "\\" + sNcName ; } // eseguo la generazione del part-program della macchinata corrente return pMachMgr->Generate( sMyCncFile, sInfo) ; } //----------------------------------------------------------------------------- bool ExeEstimate( const string& sEstFile, const string& sInfo) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) string sMyEstFile = sEstFile ; // se nome file vuoto if ( IsEmptyOrSpaces( sMyEstFile)) { // recupero la path del progetto string sProjPath ; if ( ! ExeGetCurrFilePath( sProjPath)) return false ; // ne deduco il direttorio string sDir = GetDirectory( sProjPath) ; ReplaceString( sDir, "/", "\\") ; // recupero il nome string sEstName ; if ( ExeGetInfo( ExeGetCurrMachGroup(), GDL_NC_NAME, sEstName)) sEstName = GetFileName( sEstName) ; else sEstName = GetFileName( sProjPath) ; sEstName = ChangeFileExtension( sEstName, ".html") ; // creo la path completa sMyEstFile = sDir + "\\" + sEstName ; } // eseguo la stima di tempi e lunghezze di lavoro della macchinata corrente return pMachMgr->Estimate( sMyEstFile, sInfo) ; } //----------------------------------------------------------------------------- bool ExeSimulate( int& nErr, string& sError) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // forzo aggiornamento if ( ! ExeApplyAllMachinings( false, false, sError)) { // assegno il codice di errore nErr = SHE_INIT ; // assegno stringa di errore sError = "Preparing simulation failed" ; ExeOutLog( sError, 1) ; // esco return false ; } // inizializzo lo stato bool bContinue = true ; nErr = SHE_NONE ; sError = "" ; // disabilito UI bool bPrevEnableUI = ExeGetEnableUI() ; if ( bPrevEnableUI) ExeSetEnableUI( false) ; // avvio simulazione if ( ! pMachMgr->SimInit() || ! pMachMgr->SimStart( true) || ! pMachMgr->SimStart( false)) { // inutile continuare con simulazione se avvio non riuscito bContinue = false ; // assegno il codice di errore nErr = SHE_INIT ; // assegno stringa di errore sError = "Starting simulation failed" ; ExeOutLog( sError, 1) ; } pMachMgr->SimSetStep( 50) ; // ciclo di simulazione while ( bContinue) { int nStat ; bContinue = pMachMgr->SimMove( nStat) ; // gestione errori if ( nStat == MCH_SIM_OUTSTROKE) { // assegno il codice di errore nErr = SHE_OUTSTROKE ; // recupero stringa di errore sError = pMachMgr->GetOutstrokeInfo( ExeUiUnitsAreMM()) ; ExeOutLog( sError, 1) ; } else if ( nStat == MCH_SIM_DIR_ERR) { // assegno il codice di errore nErr = SHE_DIR_ERR ; // assegno stringa di errore sError = "Tool direction unreachable" ; ExeOutLog( sError, 1) ; } else if ( nStat == MCH_SIM_COLLISION) { // assegno il codice di errore nErr = SHE_COLLISION ; // recupero stringa di errore if ( pMachMgr->GetLastErrorId() != 0) sError = pMachMgr->GetLastErrorString() ; else sError = "Found collision head-part" ; ExeOutLog( sError, 1) ; } else if ( nStat == MCH_SIM_ERR) { // se esiste codice di errore if ( pMachMgr->GetLastErrorId() != 0) { // assegno il codice di errore nErr = SHE_SPECIAL ; // recupero la stringa di errore sError = pMachMgr->GetLastErrorString() ; } // altrimenti else { // assegno il codice di errore nErr = SHE_GENERAL ; // assegno la stringa di errore sError = "General failure (contact supplier)" ; } ExeOutLog( sError, 1) ; } } // terminazione simulazione pMachMgr->SimExit() ; // riabilito UI if ( bPrevEnableUI) ExeSetEnableUI( true) ; return ( nErr == 0) ; } //----------------------------------------------------------------------------- // 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 ExeSetCalcSolCh( int nScc, bool bExact) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // imposto il criterio di scelta della soluzione e se deve essere rispettato esattamente return pMachMgr->SetCalcSolCh( nScc, bExact) ; } //---------------------------------------------------------------------------- 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 ExeGetCalcTable( string& sTable) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // restituisco la tavola corrente per il calcolo sulla macchina della macchinata corrente return pMachMgr->GetCalcTable( sTable) ; } //----------------------------------------------------------------------------- bool ExeGetCalcTool( string& sTool, string& sHead, int& nExit) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // restituisco l'utensile, la testa e l'uscita correnti per il calcolo sulla macchina della macchinata corrente return ( pMachMgr->GetCalcTool( sTool) && pMachMgr->GetCalcHead( sHead) && pMachMgr->GetCalcExit( nExit)) ; } //---------------------------------------------------------------------------- bool ExeGetCalcSolCh( int& nScc, bool& bExact) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il criterio di scelta della soluzione e se deve essere rispettato esattamente return pMachMgr->GetCalcSolCh( nScc, bExact) ; } //----------------------------------------------------------------------------- bool ExeGetAllCurrAxesNames( STRVECTOR& vAxName) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero gli assi correnti derivanti dalla scelta di tavola e utensile return pMachMgr->GetAllCurrAxesNames( vAxName) ; } //---------------------------------------------------------------------------- bool ExeGetRotAxisBlocked( int nInd, string& sAxis, double& dVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero dati bloccaggio asse in posizione nInd (0-based) return pMachMgr->GetRotAxisBlocked( nInd, sAxis, dVal) ; } //----------------------------------------------------------------------------- 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 ExeGetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA, int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // calcolo gli angoli macchina dalle direzioni fresa e ausiliaria passate return pMachMgr->GetCalcAngles( vtDirT, vtDirA, nStat, vAng1, vAng2) ; } //----------------------------------------------------------------------------- bool ExeGetCalcPositions( const Point3d& ptP, double dAngA, double dAngB, double& dX, double& dY, double& dZ) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // calcolo gli assi lineari macchina dalla posizione e dagli assi rotanti return pMachMgr->GetCalcPositions( ptP, dAngA, dAngB, dX, dY, dZ) ; } //----------------------------------------------------------------------------- bool ExeGetCalcPositions( const Point3d& ptP, const DBLVECTOR& vAng, double& dX, double& dY, double& dZ) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // calcolo gli assi lineari macchina dalla posizione e dagli assi rotanti return pMachMgr->GetCalcPositions( ptP, vAng, dX, dY, dZ) ; } //----------------------------------------------------------------------------- bool ExeGetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA, DBLVECTOR& vAng1, DBLVECTOR& vAng2) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // calcolo gli angoli macchina dalle direzioni fresa e ausiliaria passate return pMachMgr->GetRobotAngles( ptP, vtDirT, vtDirA, vAng1, vAng2) ; } //----------------------------------------------------------------------------- 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 ExeGetCalcTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bBottom, Point3d& ptTip) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // calcolo il tip utensile dagli assi macchina return pMachMgr->GetCalcTipFromPositions( dX, dY, dZ, vAng, false, bBottom, ptTip) ; } //----------------------------------------------------------------------------- bool ExeGetCalcToolDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // calcolo la direzione utensile dagli assi macchina return pMachMgr->GetCalcToolDirFromAngles( vAng, vtDir) ; } //----------------------------------------------------------------------------- bool ExeGetCalcAuxDirFromAngles( const DBLVECTOR& vAng, Vector3d& vtDir) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // calcolo la direzione ausiliaria dagli assi macchina return pMachMgr->GetCalcAuxDirFromAngles( vAng, 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 ExeVerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // verifica l'extracorsa degli assi return pMachMgr->VerifyOutstroke( dX, dY, dZ, vAng, true, nStat) ; } //----------------------------------------------------------------------------- bool ExeGetOutstrokeInfo( string& sInfo) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero informazioni su extracorsa degli assi sInfo = pMachMgr->GetOutstrokeInfo( ExeUiUnitsAreMM()) ; 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) ; } //----------------------------------------------------------------------------- int ExeGetExitId( const string& sHead, int nExit) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // restituisco identificativo dell'uscita della testa indicata nella macchina della macchinata corrente return pMachMgr->GetExitId( sHead, nExit) ; } //----------------------------------------------------------------------------- int ExeGetTcPosId( const string& sTcPos) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, GDB_ID_NULL) // restituisco identificativo della posizione di cambio utensile indicata nella macchina della macchinata corrente return pMachMgr->GetTcPosId( sTcPos) ; } //----------------------------------------------------------------------------- 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 ExeGetAxisType( const string& sAxis, bool& bLinear) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il tipo dell'asse return pMachMgr->GetAxisType( sAxis, bLinear) ; } //----------------------------------------------------------------------------- bool ExeGetAxisDir( const string& sAxis, Vector3d& vtDir) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero la direzione dell'asse return pMachMgr->GetAxisDir( sAxis, vtDir) ; } //----------------------------------------------------------------------------- bool ExeGetAxisInvert( const string& sAxis, bool& bInvert) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il flag di inversione asse in visualizzazione return pMachMgr->GetAxisInvert( sAxis, bInvert) ; } //----------------------------------------------------------------------------- bool ExeGetAxisOffset( const string& sAxis, double& dOffset) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero il valore di offset dell'asse in visualizzazione return pMachMgr->GetAxisOffset( sAxis, dOffset) ; } //----------------------------------------------------------------------------- bool ExeGetAllTablesNames( STRVECTOR& vNames) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero l'elenco delle tavole return pMachMgr->GetAllTablesNames( vNames) ; } //----------------------------------------------------------------------------- bool ExeGetAllAxesNames( STRVECTOR& vNames) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero l'elenco degli assi return pMachMgr->GetAllAxesNames( vNames) ; } //----------------------------------------------------------------------------- bool ExeGetAllHeadsNames( STRVECTOR& vNames) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero l'elenco delle teste return pMachMgr->GetAllHeadsNames( vNames) ; } //----------------------------------------------------------------------------- bool ExeGetAllTcPosNames( STRVECTOR& vNames) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // recupero l'elenco delle posizioni di cambio utensile return pMachMgr->GetAllTcPosNames( vNames) ; } //----------------------------------------------------------------------------- bool ExeSetAxisPos( const string& sAxis, double dVal, double* pdNewVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // metto l'asse nella nuova posizione return pMachMgr->SetAxisPos( sAxis, dVal, pdNewVal) ; } //----------------------------------------------------------------------------- bool ExeGetAxisPos( const string& sAxis, double* pdVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // verifico il parametro di ritorno if ( pdVal == nullptr) return false ; // restituisco la posizione corrente dell'asse return pMachMgr->GetAxisPos( sAxis, *pdVal) ; } //----------------------------------------------------------------------------- bool ExeGetAxisMin( const string& sAxis, double* pdMin) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // verifico il parametro di ritorno if ( pdMin == nullptr) return false ; // restituisco il valore minimo dell'asse return pMachMgr->GetAxisMin( sAxis, *pdMin) ; } //----------------------------------------------------------------------------- bool ExeGetAxisMax( const string& sAxis, double* pdMax) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // verifico il parametro di ritorno if ( pdMax == nullptr) return false ; // restituisco il valore massimo dell'asse return pMachMgr->GetAxisMax( sAxis, *pdMax) ; } //----------------------------------------------------------------------------- bool ExeGetAxisHomePos( const string& sAxis, double* pdHomeVal) { IMachMgr* pMachMgr = GetCurrMachMgr() ; VERIFY_MACHMGR( pMachMgr, false) // verifico il parametro di ritorno if ( pdHomeVal == nullptr) return false ; // restituisco la posizione home 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) ; }