diff --git a/Drilling.cpp b/Drilling.cpp index 862a2da..c8f85fc 100644 --- a/Drilling.cpp +++ b/Drilling.cpp @@ -45,6 +45,7 @@ using namespace std ; // 2112 = "Error in Drilling : link outstroke xx" // 2113 = "Error in Drilling : post apply not calculable" // 2114 = "Error in Drilling : blind hole not reversible" +// 2115 = "Error in Drilling : Mirror for Double calculation failed" // 2151 = "Warning in Drilling : Skipped entity (xx)" // 2152 = "Warning in Drilling : No machinable path" // 2153 = "Warning in Drilling : Tool name changed (xx)" @@ -570,6 +571,13 @@ Drilling::Apply( bool bRecalc, bool bPostApply) else m_pGeomDB->EmptyGroup( nClId) ; + // elimino eventuale gruppo geometria simmetrica per lavorazione in doppio + int nDblId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_DBL) ; + if ( nDblId != GDB_ID_NULL) { + m_pGeomDB->Erase( nDblId) ; + nDblId = GDB_ID_NULL ; + } + // se lavorazione standard if ( m_Params.m_nSubType == DRI_SUB_STD) { if ( ! StdandardProcess( bRecalc, GDB_ID_NULL, nClId)) @@ -590,7 +598,13 @@ Drilling::Apply( bool bRecalc, bool bPostApply) // eseguo aggiornamento assi macchina e collegamento con operazione precedente if ( ! Update( bPostApply)) return false ; - + + // se lavorazione in doppio, aggiungo geometria della parte simmetrica + if ( ! CalcMirrorByDouble( nClId, m_Params.m_sUserNotes)) { + m_pMchMgr->SetLastError( 2115, "Error in Drilling : Mirror for Double calculation failed") ; + return false ; + } + // aggiorno stato della lavorazione m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ; // dichiaro successiva da aggiornare diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 0d7108e..6c704ec 100644 Binary files a/EgtMachKernel.rc and b/EgtMachKernel.rc differ diff --git a/MachineCalc.cpp b/MachineCalc.cpp index ad760b7..56eed2a 100644 --- a/MachineCalc.cpp +++ b/MachineCalc.cpp @@ -39,6 +39,7 @@ static const string EVAR_TOTDIAM = ".TOTDIAM" ; // (num) diametro di in static const string EVAR_TOTLEN = ".TOTLEN" ; // (num) lunghezza di ingombro dell'utensile static const string EVAR_DIST = ".DIST" ; // (num) distanza dell'utensile (per seghe a catena) static const string EVAR_EXITPOS = ".EXITPOS" ; // (point) posizione attuale dell'uscita +static const string EVAR_USERNOTES = ".USERNOTES" ; // (string) note utente dell'utensile static const string EVAR_TCPOS = ".TCPOS" ; // (string) posizione nell'attrezzaggio static const string EVAR_L1 = ".L1" ; // (num) valore del primo asse lineare static const string EVAR_L2 = ".L2" ; // (num) valore del secondo asse lineare @@ -248,6 +249,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit) double dTOvLen = 0 ; double dTOvDiam = 0 ; double dTDist = 0 ; + string sTUserNotes = "" ; string sTcPos = "" ; // se definito if ( ! sTool.empty()) { @@ -266,7 +268,8 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit) ! m_pMchMgr->TdbGetCurrToolParam( TPA_LEN, dTLen) || ! m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, dTDiam) || ! m_pMchMgr->TdbGetCurrToolParam( TPA_TOTLEN, dTOvLen) || - ! m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, dTOvDiam)) + ! m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, dTOvDiam) || + ! m_pMchMgr->TdbGetCurrToolParam( TPA_USERNOTES, sTUserNotes)) return false ; m_pMchMgr->TdbGetCurrToolParam( TPA_DIST, dTDist) ; // opzionale if ( ! m_pMchMgr->GetCurrSetupMgr().GetToolSetupPos( sTool, sTcPos)) @@ -314,6 +317,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit) bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TOTDIAM, dTOvDiam) ; bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TOTLEN, dTOvLen) ; bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_DIST, dTDist) ; + bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, sTUserNotes) ; bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TCPOS, sTcPos) ; // chiamo funzione bOk = bOk && LuaCallFunction( ON_SET_HEAD) ; diff --git a/MachiningConst.h b/MachiningConst.h index 71f7bcf..a665d69 100644 --- a/MachiningConst.h +++ b/MachiningConst.h @@ -103,7 +103,11 @@ GetMachiningTitle( int nMchType) "SawRoughing", "SawFinishing", "GenMachining", - "Chiseling"} ; + "Chiseling", + "SurfRoughing", + "SurfFinishing", + "Waterjetting", + "5axMachining"} ; switch ( nMchType) { case MT_DRILLING : return MchTitle[1] ; case MT_SAWING : return MchTitle[2] ; @@ -114,6 +118,11 @@ GetMachiningTitle( int nMchType) case MT_SAWFINISHING : return MchTitle[7] ; case MT_GENMACHINING : return MchTitle[8] ; case MT_CHISELING : return MchTitle[9] ; + case MT_SURFROUGHING : return MchTitle[10] ; + case MT_SURFFINISHING : return MchTitle[11] ; + case MT_WATERJETTING : return MchTitle[12] ; + case MT_5AXMACHINING : return MchTitle[13] ; + } return MchTitle[0] ; } diff --git a/Milling.cpp b/Milling.cpp index 3e8ede0..25f69c6 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -71,7 +71,8 @@ const double LIM_DOWN_APPRZ = - 0.5 ; // 2321 = "Error in Milling : post apply not calculable" // 2322 = "Error in Milling : Tool loading failed" // 2323 = "Error in Milling : machining depth (xxx) bigger than MaxDepth (yyy)" -// 2324 = "Error in Milling : LeadOut must be out of rawpart" +// 2324 = "Error in Milling : LeadOut must be out of rawpart" +// 2325 = "Error in Milling : Mirror for Double calculation failed" // 2351 = "Warning in Milling : Skipped entity (xx)" // 2352 = "Warning in Milling : No machinable path" // 2353 = "Warning in Milling : Tool name changed (xx)" @@ -794,6 +795,13 @@ Milling::Apply( bool bRecalc, bool bPostApply) else m_pGeomDB->EmptyGroup( nClId) ; + // elimino eventuale gruppo geometria simmetrica per lavorazione in doppio + int nDblId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_DBL) ; + if ( nDblId != GDB_ID_NULL) { + m_pGeomDB->Erase( nDblId) ; + nDblId = GDB_ID_NULL ; + } + // se necessario, eseguo concatenamento ed inserisco i percorsi sotto la geometria ausiliaria if ( bChain) { if ( ! Chain( nAuxId)) { @@ -820,7 +828,13 @@ Milling::Apply( bool bRecalc, bool bPostApply) // eseguo aggiornamento assi macchina e collegamento con operazione precedente if ( ! Update( bPostApply)) return false ; - + + // se lavorazione in doppio, aggiungo geometria della parte simmetrica + if ( ! CalcMirrorByDouble( nClId, m_Params.m_sUserNotes)) { + m_pMchMgr->SetLastError( 2325, "Error in Milling : Mirror for Double calculation failed") ; + return false ; + } + // aggiorno stato della lavorazione m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ; // dichiaro successiva da aggiornare diff --git a/Operation.cpp b/Operation.cpp index 5d362a5..3a4e10e 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -1373,6 +1373,50 @@ Operation::CalcAndSetAxesBBox( void) return true ; } +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +bool +Operation::CalcMirrorByDouble( int nClId, const std::string& sUserNotes) +{ + // verifico se prevista lavorazione in doppio + int nDouble ; + if ( ! GetValInNotes( sUserNotes, "DOUBLE", nDouble) || + ( nDouble != 1 && nDouble != 2 && nDouble != 3)) + return true ; + + // copio gruppo di lavorazione e cambio nome + int nDblId = m_pGeomDB->Copy( nClId, GDB_ID_NULL, nClId, GDB_AFTER) ; + if ( nDblId == GDB_ID_NULL) + return false ; + m_pGeomDB->SetName( nDblId, MCH_DBL) ; + // assegno colore di copia + int nClPathId = m_pGeomDB->GetFirstGroupInGroup( nDblId) ; + while ( nClPathId != GDB_ID_NULL) { + m_pGeomDB->SetMaterial( nClPathId, GRAY) ; + nClPathId = m_pGeomDB->GetNextGroup( nClPathId) ; + } + + // determino posizione del piano di mirroring + BBox3d b3Raw ; + Point3d ptOn ; + if ( ! GetCurrRawsGlobBox( b3Raw) || ! b3Raw.GetCenter( ptOn)) + return false ; + Vector3d vtNorm ; + switch ( nDouble) { + case 1 : vtNorm = X_AX ; break ; + case 2 : vtNorm = Y_AX ; break ; + case 3 : vtNorm = Z_AX ; break ; + } + double dPlanePos ; + if ( GetValInNotes( sUserNotes, "MirrorAx", dPlanePos)) + ptOn = b3Raw.GetMin() + dPlanePos * vtNorm ; + + // eseguo mirroring rispetto a piano opportuno + m_pGeomDB->MirrorGroup( nDblId, ptOn, vtNorm) ; + + return true ; +} + //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- bool diff --git a/Operation.h b/Operation.h index 7a02b3f..f37a8d6 100644 --- a/Operation.h +++ b/Operation.h @@ -109,6 +109,8 @@ class Operation : public IUserObj bool CalcAndSetBBox( int nClId) ; bool CalcAndSetAxesBBox( void) ; + bool CalcMirrorByDouble( int nClId, const std::string& sUserNotes) ; + bool GetInitialAxesValues( bool bSkipClimb, DBLVECTOR& vAxVal) const ; bool GetClPathInitialAxesValues( int nClPathId, bool bSkipClimb, DBLVECTOR& vAxVal) const ; bool GetFinalAxesValues( bool bSkipRise, DBLVECTOR& vAxVal) const ; diff --git a/Pocketing.cpp b/Pocketing.cpp index 3c3ad71..2e07d49 100644 --- a/Pocketing.cpp +++ b/Pocketing.cpp @@ -73,6 +73,7 @@ using namespace std ; // 2429 = "Error in Pocketing : machining depth (xxx) bigger than MaxDepth (yyy)" // 2430 = "Error in Pocketing : adjust open edges failed" // 2431 = "Error in Pocketing : LeadIn with Mill NoTip in material" +// 2432 = "Error in Pocketing : Mirror for Double calculation failed" // 2451 = "Warning in Pocketing : Skipped entity (xx)" // 2452 = "Warning in Pocketing : No machinable pocket" // 2453 = "Warning in Pocketing : Tool name changed (xx)" @@ -665,12 +666,6 @@ Pocketing::Apply( bool bRecalc, bool bPostApply) m_dTHoldDiam = 0 ; m_pGeomDB->GetInfo( nToolId, TTH_DIAM, m_dTHoldDiam) ; - // se necessario, eseguo concatenamento ed inserisco i percorsi sotto la geometria ausiliaria - if ( bChain && ! Chain( nAuxId)) { - m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Chaining failed") ; - return false ; - } - // recupero gruppo per geometria di lavorazione (Cutter Location) int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ; // se non c'è, lo aggiungo @@ -684,6 +679,19 @@ Pocketing::Apply( bool bRecalc, bool bPostApply) else m_pGeomDB->EmptyGroup( nClId) ; + // elimino eventuale gruppo geometria simmetrica per lavorazione in doppio + int nDblId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_DBL) ; + if ( nDblId != GDB_ID_NULL) { + m_pGeomDB->Erase( nDblId) ; + nDblId = GDB_ID_NULL ; + } + + // se necessario, eseguo concatenamento ed inserisco i percorsi sotto la geometria ausiliaria + if ( bChain && ! Chain( nAuxId)) { + m_pMchMgr->SetLastError( 2421, "Error in Pocketing : Chaining failed") ; + return false ; + } + // lavoro ogni singola catena bool bOk = true ; int nPathId = m_pGeomDB->GetFirstGroupInGroup( nAuxId) ; @@ -701,6 +709,12 @@ Pocketing::Apply( bool bRecalc, bool bPostApply) // eseguo aggiornamento assi macchina e collegamento con operazione precedente if ( ! Update( bPostApply)) return false ; + + // se lavorazione in doppio, aggiungo geometria della parte simmetrica + if ( ! CalcMirrorByDouble( nClId, m_Params.m_sUserNotes)) { + m_pMchMgr->SetLastError( 2432, "Error in Pocketing : Mirror for Double calculation failed") ; + return false ; + } // aggiorno stato della lavorazione m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ; diff --git a/Simulator.cpp b/Simulator.cpp index 63ced76..742334d 100644 --- a/Simulator.cpp +++ b/Simulator.cpp @@ -2049,10 +2049,7 @@ Simulator::SetToolForVmill( const string& sTool, const string& sHead, int nExit, else if ( nType == TT_WATERJET) ExeVolZmapSetStdTool( vVmill, sTool, dLen + 50, dDiam, dCornR, dMaxMat, nFlag, bFirst) ; else if ( abs( dSideAng) < EPS_ANG_SMALL || abs( dThick) < EPS_SMALL) { - if ( dDiam <= dMaxStemDiam) - ExeVolZmapSetStdTool( vVmill, sTool, dLen, dDiam, dCornR, dMaxMat, nFlag, bFirst) ; - else - ExeVolZmapSetSawTool( vVmill, sTool, dLen, dDiam, dMaxMat, 0, dCornR, nFlag, bFirst) ; + ExeVolZmapSetStdTool( vVmill, sTool, dLen, dDiam, dCornR, dMaxMat, nFlag, bFirst) ; } else { bool bExtra = ( dThick > 0) ;