From 7667345e08dde04f4f94b28cf4d97abca1bad2a0 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 10 Oct 2016 06:57:04 +0000 Subject: [PATCH] =?UTF-8?q?EgtMachKernel=201.6v3=20:=20-=20corretto=20erro?= =?UTF-8?q?re=20calcolo=20nomi=20nuovi=20per=20utensili,=20lavorazioni,=20?= =?UTF-8?q?gruppi=20di=20lavoro=20e=20operazioni=20quando=20pi=C3=B9=20cor?= =?UTF-8?q?ti=20di=202=20caratteri=20-=20aggiunti=20controlli=20su=20valid?= =?UTF-8?q?it=C3=A0=20nomi=20a=20utensili=20in=20carico=20e=20lavorazioni?= =?UTF-8?q?=20-=20separato=20overlap=20di=20fresature=20da=20overlap=20di?= =?UTF-8?q?=20forature=20-=20sulle=20GetParam=20si=20assegna=20sempre=20va?= =?UTF-8?q?lore=20di=20default=20al=20parametro=20di=20ritorno.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Drilling.cpp | 4 ++++ DrillingData.cpp | 4 ++++ EgtMachKernel.rc | Bin 11782 -> 11782 bytes MachMgrMachGroups.cpp | 4 +++- MachMgrOperations.cpp | 18 +++++++++++++++--- MachineHeads.cpp | 6 +++++- MachiningsMgr.cpp | 2 +- Milling.cpp | 8 ++++++-- MillingData.cpp | 8 ++++++-- SawFinishing.cpp | 5 ++++- SawFinishingData.cpp | 4 ++++ SawRoughing.cpp | 5 ++++- SawRoughingData.cpp | 4 ++++ Sawing.cpp | 5 ++++- SawingData.cpp | 4 ++++ ToolData.cpp | 4 ++++ ToolsMgr.cpp | 2 +- 17 files changed, 73 insertions(+), 14 deletions(-) diff --git a/Drilling.cpp b/Drilling.cpp index 745fee0..64df866 100644 --- a/Drilling.cpp +++ b/Drilling.cpp @@ -948,6 +948,7 @@ Drilling::GetParam( int nType, bool& bVal) const bVal = m_Params.m_bInvert ; return true ; } + bVal = false ; return false ; } @@ -966,6 +967,7 @@ Drilling::GetParam( int nType, int& nVal) const nVal = m_Params.m_nSolCh ; return true ; } + nVal = 0 ; return false ; } @@ -1014,6 +1016,7 @@ Drilling::GetParam( int nType, double& dVal) const dVal = m_Params.m_dEndAddLen ; return true ; } + dVal = 0 ; return false ; } @@ -1050,6 +1053,7 @@ Drilling::GetParam( int nType, string& sVal) const sVal = m_Params.m_sOffset ; return true ; } + sVal = "" ; return false ; } diff --git a/DrillingData.cpp b/DrillingData.cpp index 8f52ad4..3cf1ada 100644 --- a/DrillingData.cpp +++ b/DrillingData.cpp @@ -516,6 +516,7 @@ DrillingData::GetParam( int nType, bool& bVal) const bVal = m_bInvert ; return true ; } + bVal = false ; return false ; } @@ -534,6 +535,7 @@ DrillingData::GetParam( int nType, int& nVal) const nVal = m_nSolCh ; return true ; } + nVal = 0 ; return false ; } @@ -582,6 +584,7 @@ DrillingData::GetParam( int nType, double& dVal) const dVal = m_dEndAddLen ; return true ; } + dVal = 0 ; return false ; } @@ -618,5 +621,6 @@ DrillingData::GetParam( int nType, string& sVal) const sVal = m_sOffset ; return true ; } + sVal = "" ; return false ; } diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index 38bb963287fcb6329be2e14366cf9561f6a74365..b0c051c0d046b2f46d79dc305cd5c5c8f56721d9 100644 GIT binary patch delta 97 zcmZpRX^YwLhmFyA^ItYwW=7-5j>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHPhB8F delta 97 zcmZpRX^YwLhmFx_^ItYwW=5mQj>5W|vxM9jH?QON0rG*u7nvrX5iEd9O=7{OSQ@Kh Hr8(RHP01iS diff --git a/MachMgrMachGroups.cpp b/MachMgrMachGroups.cpp index 95d5b49..9875dce 100644 --- a/MachMgrMachGroups.cpp +++ b/MachMgrMachGroups.cpp @@ -77,10 +77,12 @@ MachMgr::GetMachGroupNewName( string& sName) const // se nome vuoto, assegno radice standard if ( sName.empty()) sName = "Mach" ; + // se presenti caratteri vietati, li sostituisco + ValidateName( sName) ; // verifico che il nome sia unico int nCount = 0 ; string sOrigName = sName ; - if ( sOrigName.rfind( "_1") == sOrigName.length() - 2) + if ( sOrigName.length() > 2 && sOrigName.rfind( "_1") == sOrigName.length() - 2) sOrigName.erase( sOrigName.length() - 2) ; while ( GetMachGroupId( sName) != GDB_ID_NULL) { ++ nCount ; diff --git a/MachMgrOperations.cpp b/MachMgrOperations.cpp index 930b599..c101924 100644 --- a/MachMgrOperations.cpp +++ b/MachMgrOperations.cpp @@ -222,10 +222,12 @@ MachMgr::GetOperationNewName( string& sName) const // se nome vuoto, assegno radice standard if ( sName.empty()) sName = "Oper" ; + // se presenti caratteri vietati, li sostituisco + ValidateName( sName) ; // verifico che il nome sia unico int nCount = 0 ; string sOrigName = sName ; - if ( sOrigName.rfind( "_1") == sOrigName.length() - 2) + if ( sOrigName.length() > 2 && sOrigName.rfind( "_1") == sOrigName.length() - 2) sOrigName.erase( sOrigName.length() - 2) ; while ( GetOperationId( sName) != GDB_ID_NULL) { ++ nCount ; @@ -654,7 +656,12 @@ MachMgr::AddMachining( const string& sName, const string& sMachining) if ( nId == GDB_ID_NULL) return GDB_ID_NULL ; // assegno il nome - m_pGeomDB->SetName( nId, sNewName) ; + if ( ! m_pGeomDB->SetName( nId, sNewName)) { + string sOut = "AddMachining error : " + sNewName + " invalid name " ; + LOG_INFO( GetEMkLogger(), sOut.c_str()) + m_pGeomDB->Erase( nId) ; + return GDB_ID_NULL ; + } // installo il gestore della lavorazione Machining* pMch = CreateMachining( nMchType) ; m_pGeomDB->SetUserObj( nId, pMch) ; @@ -693,7 +700,12 @@ MachMgr::AddMachining( const string& sName, int nMchType, const string& sTool) if ( nId == GDB_ID_NULL) return GDB_ID_NULL ; // assegno il nome - m_pGeomDB->SetName( nId, sNewName) ; + if ( ! m_pGeomDB->SetName( nId, sNewName)) { + string sOut = "AddMachining error : " + sNewName + " invalid name " ; + LOG_INFO( GetEMkLogger(), sOut.c_str()) + m_pGeomDB->Erase( nId) ; + return GDB_ID_NULL ; + } // installo il gestore della lavorazione Machining* pMch = CreateMachining( nMchType) ; m_pGeomDB->SetUserObj( nId, pMch) ; diff --git a/MachineHeads.cpp b/MachineHeads.cpp index 089fa39..c2f5dba 100644 --- a/MachineHeads.cpp +++ b/MachineHeads.cpp @@ -63,7 +63,11 @@ Machine::LoadTool( const string& sHead, int nExit, const string& sTool) return false ; m_pGeomDB->RelocateGlob( nSolidId, nExGrp, GDB_FIRST_SON) ; m_pGeomDB->Erase( nTGrpId) ; - m_pGeomDB->SetName( nSolidId, sTool) ; + if ( ! m_pGeomDB->SetName( nSolidId, sTool)) { + string sOut = "LoadTool error : " + sTool + " invalid name" ; + LOG_INFO( GetEMkLogger(), sOut.c_str()) + return false ; + } // lo ruoto 90 deg attorno alla X locale int nT = m_pGeomDB->GetFirstGroupInGroup( nExGrp) ; if ( nT == GDB_ID_NULL) diff --git a/MachiningsMgr.cpp b/MachiningsMgr.cpp index 8795644..2b5cc52 100644 --- a/MachiningsMgr.cpp +++ b/MachiningsMgr.cpp @@ -467,7 +467,7 @@ MachiningsMgr::GetMachiningNewName( string& sName) const // verifico che il nome sia unico int nCount = 0 ; string sOrigName = sName ; - if ( sOrigName.rfind( "_1") == sOrigName.length() - 2) + if ( sOrigName.length() > 2 && sOrigName.rfind( "_1") == sOrigName.length() - 2) sOrigName.erase( sOrigName.length() - 2) ; while ( GetMachining( sName) != nullptr) { ++ nCount ; diff --git a/Milling.cpp b/Milling.cpp index 9cc3d6d..7608030 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -290,7 +290,7 @@ Milling::SetParam( int nType, double dVal) case MPA_STARTPOS : m_Params.m_dStartPos = dVal ; return true ; - case MPA_OVERLAP : + case MPA_OVERL : m_Params.m_dOverlap = dVal ; return true ; case MPA_STEP : @@ -538,6 +538,7 @@ Milling::GetParam( int nType, bool& bVal) const bVal = m_Params.m_bLeaveTab ; return true ; } + bVal = false ; return false ; } @@ -565,6 +566,7 @@ Milling::GetParam( int nType, int& nVal) const nVal = m_Params.m_nSolCh ; return true ; } + nVal = 0 ; return false ; } @@ -597,7 +599,7 @@ Milling::GetParam( int nType, double& dVal) const case MPA_STARTPOS : dVal = m_Params.m_dStartPos ; return true ; - case MPA_OVERLAP : + case MPA_OVERL : dVal = m_Params.m_dOverlap ; return true ; case MPA_STEP : @@ -634,6 +636,7 @@ Milling::GetParam( int nType, double& dVal) const dVal = m_Params.m_dLoCompLen ; return true ; } + dVal = 0 ; return false ; } @@ -664,6 +667,7 @@ Milling::GetParam( int nType, string& sVal) const sVal = m_Params.m_sUserNotes ; return true ; } + sVal = "" ; return false ; } diff --git a/MillingData.cpp b/MillingData.cpp index def30df..7b0981c 100644 --- a/MillingData.cpp +++ b/MillingData.cpp @@ -602,7 +602,7 @@ MillingData::SetParam( int nType, double dVal) case MPA_DEPTH : m_sDepth = ::ToString( dVal) ; return true ; - case MPA_OVERLAP : + case MPA_OVERL : m_dOverlap = dVal ; return true ; case MPA_STARTPOS : @@ -711,6 +711,7 @@ MillingData::GetParam( int nType, bool& bVal) const bVal = m_bLeaveTab ; return true ; } + bVal = false ; return false ; } @@ -738,6 +739,7 @@ MillingData::GetParam( int nType, int& nVal) const nVal = m_nSolCh ; return true ; } + nVal = 0 ; return false ; } @@ -767,7 +769,7 @@ MillingData::GetParam( int nType, double& dVal) const case MPA_OFFSR : dVal = m_dOffsR ; return true ; - case MPA_OVERLAP : + case MPA_OVERL : dVal = m_dOverlap ; return true ; case MPA_STARTPOS : @@ -822,6 +824,7 @@ MillingData::GetParam( int nType, double& dVal) const dVal = m_dLoCompLen ; return true ; } + dVal = 0 ; return false ; } @@ -852,5 +855,6 @@ MillingData::GetParam( int nType, string& sVal) const sVal = m_sUserNotes ; return true ; } + sVal = "" ; return false ; } diff --git a/SawFinishing.cpp b/SawFinishing.cpp index cde123c..b7b9317 100644 --- a/SawFinishing.cpp +++ b/SawFinishing.cpp @@ -463,6 +463,7 @@ SawFinishing::GetParam( int nType, bool& bVal) const bVal = m_Params.m_bInvert ; return true ; } + bVal = false ; return false ; } @@ -490,6 +491,7 @@ SawFinishing::GetParam( int nType, int& nVal) const nVal = m_Params.m_nSolCh ; return true ; } + nVal = 0 ; return false ; } @@ -532,10 +534,10 @@ SawFinishing::GetParam( int nType, double& dVal) const dVal = m_Params.m_dApprox ; return true ; } + dVal = 0 ; return false ; } - //---------------------------------------------------------------------------- bool SawFinishing::GetParam( int nType, string& sVal) const @@ -563,6 +565,7 @@ SawFinishing::GetParam( int nType, string& sVal) const sVal = m_Params.m_sUserNotes ; return true ; } + sVal = "" ; return false ; } diff --git a/SawFinishingData.cpp b/SawFinishingData.cpp index fb886af..e6aa4bc 100644 --- a/SawFinishingData.cpp +++ b/SawFinishingData.cpp @@ -529,6 +529,7 @@ SawFinishingData::GetParam( int nType, bool& bVal) const bVal = m_bInvert ; return true ; } + bVal = false ; return false ; } @@ -556,6 +557,7 @@ SawFinishingData::GetParam( int nType, int& nVal) const nVal = m_nSolCh ; return true ; } + nVal = 0 ; return false ; } @@ -598,6 +600,7 @@ SawFinishingData::GetParam( int nType, double& dVal) const dVal = m_dApprox ; return true ; } + dVal = 0 ; return false ; } @@ -628,5 +631,6 @@ SawFinishingData::GetParam( int nType, string& sVal) const sVal = m_sUserNotes ; return true ; } + sVal = "" ; return false ; } diff --git a/SawRoughing.cpp b/SawRoughing.cpp index e14bb62..32962c9 100644 --- a/SawRoughing.cpp +++ b/SawRoughing.cpp @@ -439,6 +439,7 @@ SawRoughing::GetParam( int nType, bool& bVal) const { //switch ( nType) { //} + bVal = false ; return false ; } @@ -463,6 +464,7 @@ SawRoughing::GetParam( int nType, int& nVal) const nVal = m_Params.m_nSolCh ; return true ; } + nVal = 0 ; return false ; } @@ -505,10 +507,10 @@ SawRoughing::GetParam( int nType, double& dVal) const dVal = m_Params.m_dApprox ; return true ; } + dVal = 0 ; return false ; } - //---------------------------------------------------------------------------- bool SawRoughing::GetParam( int nType, string& sVal) const @@ -536,6 +538,7 @@ SawRoughing::GetParam( int nType, string& sVal) const sVal = m_Params.m_sUserNotes ; return true ; } + sVal = "" ; return false ; } diff --git a/SawRoughingData.cpp b/SawRoughingData.cpp index 316992c..c5cf554 100644 --- a/SawRoughingData.cpp +++ b/SawRoughingData.cpp @@ -494,6 +494,7 @@ SawRoughingData::GetParam( int nType, bool& bVal) const { //switch ( nType) { //} + bVal = false ; return false ; } @@ -518,6 +519,7 @@ SawRoughingData::GetParam( int nType, int& nVal) const nVal = m_nSolCh ; return true ; } + nVal = 0 ; return false ; } @@ -560,6 +562,7 @@ SawRoughingData::GetParam( int nType, double& dVal) const dVal = m_dApprox ; return true ; } + dVal = 0 ; return false ; } @@ -590,5 +593,6 @@ SawRoughingData::GetParam( int nType, string& sVal) const sVal = m_sUserNotes ; return true ; } + sVal = "" ; return false ; } diff --git a/Sawing.cpp b/Sawing.cpp index 18ee4e4..d3e571b 100644 --- a/Sawing.cpp +++ b/Sawing.cpp @@ -549,6 +549,7 @@ Sawing::GetParam( int nType, bool& bVal) const bVal = m_Params.m_bInvert ; return true ; } + bVal = false ; return false ; } @@ -585,6 +586,7 @@ Sawing::GetParam( int nType, int& nVal) const nVal = m_Params.m_nSolCh ; return true ; } + nVal = 0 ; return false ; } @@ -642,10 +644,10 @@ Sawing::GetParam( int nType, double& dVal) const dVal = m_Params.m_dApprox ; return true ; } + dVal = 0 ; return false ; } - //---------------------------------------------------------------------------- bool Sawing::GetParam( int nType, string& sVal) const @@ -673,6 +675,7 @@ Sawing::GetParam( int nType, string& sVal) const sVal = m_Params.m_sUserNotes ; return true ; } + sVal = "" ; return false ; } diff --git a/SawingData.cpp b/SawingData.cpp index 844c348..40d297f 100644 --- a/SawingData.cpp +++ b/SawingData.cpp @@ -659,6 +659,7 @@ SawingData::GetParam( int nType, bool& bVal) const bVal = m_bInvert ; return true ; } + bVal = false ; return false ; } @@ -695,6 +696,7 @@ SawingData::GetParam( int nType, int& nVal) const nVal = m_nSolCh ; return true ; } + nVal = 0 ; return false ; } @@ -752,6 +754,7 @@ SawingData::GetParam( int nType, double& dVal) const dVal = m_dApprox ; return true ; } + dVal = 0 ; return false ; } @@ -782,5 +785,6 @@ SawingData::GetParam( int nType, string& sVal) const sVal = m_sUserNotes ; return true ; } + sVal = "" ; return false ; } diff --git a/ToolData.cpp b/ToolData.cpp index 70a6fcf..443cd4d 100644 --- a/ToolData.cpp +++ b/ToolData.cpp @@ -385,6 +385,7 @@ ToolData::SetParam( int nType, const string& sVal) bool ToolData::GetParam( int nType, bool& bVal) const { + bVal = false ; return false ; } @@ -406,6 +407,7 @@ ToolData::GetParam( int nType, int& nVal) const nVal = m_nCoolant ; return true ; } + nVal = 0 ; return false ; } @@ -469,6 +471,7 @@ ToolData::GetParam( int nType, double& dVal) const dVal = m_dMinFeed ; return true ; } + dVal = 0 ; return false ; } @@ -499,5 +502,6 @@ ToolData::GetParam( int nType, string& sVal) const sVal = ::ToString( m_Uuid) ; return true ; } + sVal = "" ; return false ; } diff --git a/ToolsMgr.cpp b/ToolsMgr.cpp index 41e45a1..eb2441a 100644 --- a/ToolsMgr.cpp +++ b/ToolsMgr.cpp @@ -312,7 +312,7 @@ ToolsMgr::GetToolNewName( string& sName) const // verifico che il nome sia unico int nCount = 0 ; string sOrigName = sName ; - if ( sOrigName.rfind( "_1") == sOrigName.length() - 2) + if ( sOrigName.length() > 2 && sOrigName.rfind( "_1") == sOrigName.length() - 2) sOrigName.erase( sOrigName.length() - 2) ; while ( GetTool( sName) != nullptr) { ++ nCount ;