diff --git a/Chiseling.cpp b/Chiseling.cpp index c0141a5..a52f8b1 100644 --- a/Chiseling.cpp +++ b/Chiseling.cpp @@ -79,6 +79,8 @@ Chiseling::Clone( void) const // eseguo copia dei dati if ( pChisel != nullptr) { try { + pChisel->m_pMchMgr = m_pMchMgr ; + pChisel->m_nPhase = m_nPhase ; pChisel->m_Params = m_Params ; pChisel->m_TParams = m_TParams ; } diff --git a/Drilling.cpp b/Drilling.cpp index 5e6e2a1..3f4c215 100644 --- a/Drilling.cpp +++ b/Drilling.cpp @@ -79,6 +79,8 @@ Drilling::Clone( void) const // eseguo copia dei dati if ( pDri != nullptr) { try { + pDri->m_pMchMgr = m_pMchMgr ; + pDri->m_nPhase = m_nPhase ; pDri->m_Params = m_Params ; pDri->m_TParams = m_TParams ; } diff --git a/MachMgr.h b/MachMgr.h index 9ee9ac9..f76eb5b 100644 --- a/MachMgr.h +++ b/MachMgr.h @@ -238,6 +238,7 @@ class MachMgr : public IMachMgr // Operations : machinings int AddMachining( const std::string& sName, const std::string& sMachining) override ; int AddMachining( const std::string& sName, int nMchType, const std::string& sTool) override ; + int CopyMachining( const std::string& sName, const std::string& sSouName) override ; bool SetCurrMachining( int nId) override ; bool ResetCurrMachining( void) override ; int GetCurrMachining( void) const override ; @@ -255,7 +256,7 @@ class MachMgr : public IMachMgr bool RemovePreviewMachiningTool( void) const override ; int PreviewMachiningTool( int nEntId, int nFlag) const override ; bool GetMachiningParam( int nType, bool& bVal) const override ; - bool GetMachiningParam( int nType, int& dVal) const override ; + bool GetMachiningParam( int nType, int& nVal) const override ; bool GetMachiningParam( int nType, double& dVal) const override ; bool GetMachiningParam( int nType, std::string& sVal) const override ; bool GetMachiningGeometry( SELVECTOR& vIds) const override ; diff --git a/MachMgrOperations.cpp b/MachMgrOperations.cpp index 656c674..d59eacc 100644 --- a/MachMgrOperations.cpp +++ b/MachMgrOperations.cpp @@ -589,6 +589,8 @@ MachMgr::SetCurrMachining( int nId) return false ; // gli imposto il manager generale delle lavorazioni pMch->Init( this) ; + // imposto la fase della lavorazione come corrente + SetCurrPhase( pMch->GetPhase()) ; // imposto la lavorazione corrente m_nCurrMachiningId = nId ; return true ; @@ -722,6 +724,43 @@ MachMgr::AddMachining( const string& sName, int nMchType, const string& sTool) return nId ; } +//---------------------------------------------------------------------------- +int +MachMgr::CopyMachining( const string& sName, const string& sSouName) +{ + // recupero la lavorazione sorgente e la imposto come corrente + int nSouId = GetOperationId( sSouName) ; + if ( ! SetCurrMachining( nSouId)) + return GDB_ID_NULL ; + // nessuna lavorazione corrente + ResetCurrMachining() ; + // recupero il gruppo delle operazioni nella macchinata corrente + int nOperGrpId = GetCurrOperId() ; + if ( nOperGrpId == GDB_ID_NULL) + return GDB_ID_NULL ; + // recupero nome originale, partendo da quello proposto + string sNewName = sName ; + if ( ! GetOperationNewName( sNewName)) + return GDB_ID_NULL ; + // inserisco il gruppo della lavorazione alla fine della fase corrente + int nRefId = GetPhaseLastOperation( m_nCurrPhase) ; + if ( nRefId == GDB_ID_NULL) + return GDB_ID_NULL ; + int nId = m_pGeomDB->Copy( nSouId, GDB_ID_NULL, nRefId, GDB_AFTER) ; + if ( nId == GDB_ID_NULL) + return GDB_ID_NULL ; + // assegno il nome + if ( ! m_pGeomDB->SetName( nId, sNewName)) { + string sOut = "CopyMachining error : " + sNewName + " invalid name " ; + LOG_INFO( GetEMkLogger(), sOut.c_str()) + m_pGeomDB->Erase( nId) ; + return GDB_ID_NULL ; + } + // la dichiaro lavorazione corrente + m_nCurrMachiningId = nId ; + return nId ; +} + //---------------------------------------------------------------------------- bool MachMgr::SetMachiningParam( int nType, bool bVal, bool* pbChanged) diff --git a/Milling.cpp b/Milling.cpp index cc1bd25..94089fa 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -77,6 +77,8 @@ Milling::Clone( void) const // eseguo copia dei dati if ( pMill != nullptr) { try { + pMill->m_pMchMgr = m_pMchMgr ; + pMill->m_nPhase = m_nPhase ; pMill->m_Params = m_Params ; pMill->m_TParams = m_TParams ; } diff --git a/Mortising.cpp b/Mortising.cpp index caa7712..0dffb44 100644 --- a/Mortising.cpp +++ b/Mortising.cpp @@ -66,6 +66,8 @@ Mortising::Clone( void) const // eseguo copia dei dati if ( pMort != nullptr) { try { + pMort->m_pMchMgr = m_pMchMgr ; + pMort->m_nPhase = m_nPhase ; pMort->m_Params = m_Params ; pMort->m_TParams = m_TParams ; } diff --git a/Pocketing.cpp b/Pocketing.cpp index 0f37784..3f83d30 100644 --- a/Pocketing.cpp +++ b/Pocketing.cpp @@ -86,6 +86,8 @@ Pocketing::Clone( void) const // eseguo copia dei dati if ( pPock != nullptr) { try { + pPock->m_pMchMgr = m_pMchMgr ; + pPock->m_nPhase = m_nPhase ; pPock->m_Params = m_Params ; pPock->m_TParams = m_TParams ; } diff --git a/SawFinishing.cpp b/SawFinishing.cpp index 678c0df..1ef9bc4 100644 --- a/SawFinishing.cpp +++ b/SawFinishing.cpp @@ -80,6 +80,8 @@ SawFinishing::Clone( void) const // eseguo copia dei dati if ( pSaw != nullptr) { try { + pSaw->m_pMchMgr = m_pMchMgr ; + pSaw->m_nPhase = m_nPhase ; pSaw->m_Params = m_Params ; pSaw->m_TParams = m_TParams ; } diff --git a/SawRoughing.cpp b/SawRoughing.cpp index f2d58b6..d3c4104 100644 --- a/SawRoughing.cpp +++ b/SawRoughing.cpp @@ -73,6 +73,8 @@ SawRoughing::Clone( void) const // eseguo copia dei dati if ( pSaw != nullptr) { try { + pSaw->m_pMchMgr = m_pMchMgr ; + pSaw->m_nPhase = m_nPhase ; pSaw->m_Params = m_Params ; pSaw->m_TParams = m_TParams ; } diff --git a/Sawing.cpp b/Sawing.cpp index 7a7f8ff..6673cc3 100644 --- a/Sawing.cpp +++ b/Sawing.cpp @@ -84,6 +84,8 @@ Sawing::Clone( void) const // eseguo copia dei dati if ( pSaw != nullptr) { try { + pSaw->m_pMchMgr = m_pMchMgr ; + pSaw->m_nPhase = m_nPhase ; pSaw->m_Params = m_Params ; pSaw->m_TParams = m_TParams ; }