diff --git a/EGkTriangle3d.h b/EGkTriangle3d.h index 837c1e4..bbcc6d5 100644 --- a/EGkTriangle3d.h +++ b/EGkTriangle3d.h @@ -112,7 +112,7 @@ class Triangle3d } bool GetLocalBBox( BBox3d& b3Loc) const { b3Loc.Reset() ; - for each ( const auto& ptP in m_ptP) + for ( const auto& ptP : m_ptP) b3Loc.Add( ptP) ; return true ; } diff --git a/EGnStringKeyVal.h b/EGnStringKeyVal.h index 1bdf6ee..612c8a4 100644 --- a/EGnStringKeyVal.h +++ b/EGnStringKeyVal.h @@ -1,13 +1,13 @@ //---------------------------------------------------------------------------- -// EgalTech 2015-2015 +// EgalTech 2015-2018 //---------------------------------------------------------------------------- -// File : EGnStringKeyVal.h Data : 23.05.15 Versione : 1.6e3 +// File : EGnStringKeyVal.h Data : 27.11.18 Versione : 1.9k1 // Contenuto : Funzioni per gestione coppie chiave-valore in stringhe. // // // // Modifiche : 23.05.15 DS Creazione modulo. -// +// 27.11.18 DS Aggiunte Set/Get/RemoveValInNotes. // //---------------------------------------------------------------------------- @@ -20,19 +20,19 @@ static const char EQUAL = '=' ; //---------------------------------------------------------------------------- inline bool -IsValidKey( const std::string& sString) +IsValidKey( const std::string& sKey) { - return ( ! sString.empty() && - sString.find( '\n') == std::string::npos && - sString.find( EQUAL) == std::string::npos && - sString.find_first_not_of( " \t\r\n") != std::string::npos) ; + return ( ! sKey.empty() && + sKey.find( '\n') == std::string::npos && + sKey.find( EQUAL) == std::string::npos && + sKey.find_first_not_of( " \t\r\n") != std::string::npos) ; } //---------------------------------------------------------------------------- inline bool FindKey( const std::string& sString, const std::string& sKey) { - if ( ! IsValidKey( sKey)) + if ( sString.empty() || ! IsValidKey( sKey)) return false ; return ( sString.compare( 0, sKey.length(), sKey) == 0 && sString.length() > sKey.length() && @@ -94,3 +94,89 @@ GetVal( const std::string& sString, const std::string& sKey, T& Val) std::string sVal ; return ( GetVal( sString, sKey, sVal) && FromString( sVal, Val)) ; } + +//---------------------------------------------------------------------------- +inline bool +SetValInNotes( const std::string& sKey, const std::string& sVal, std::string& sNotes) +{ + if ( ! IsValidKey( sKey) || ! IsValidVal( sVal)) + return false ; + STRVECTOR vsTokens ; + Tokenize( sNotes, ";", vsTokens) ; + bool bFound = false ; + for ( auto& sToken : vsTokens) { + if ( FindKey( sToken, sKey)) { + sToken = sKey + EQUAL + sVal ; + bFound = true ; + break ; + } + } + if ( ! bFound) + vsTokens.emplace_back( sKey + EQUAL + sVal) ; + sNotes.clear() ; + for ( const auto& sToken : vsTokens) { + if ( ! IsEmptyOrSpaces( sToken)) + sNotes += sToken + ";" ; + } + return true ; +} + +//---------------------------------------------------------------------------- +template +inline bool +SetValInNotes( const std::string& sKey, T& Val, std::string& sNotes) +{ + return SetValInNotes( sKey, ToString( Val), sNotes) ; +} + +//---------------------------------------------------------------------------- +inline bool +GetValInNotes( const std::string& sNotes, const std::string& sKey, std::string& sVal) +{ + if ( sNotes.empty() || ! IsValidKey( sKey)) + return false ; + STRVECTOR vsTokens ; + Tokenize( sNotes, ";", vsTokens) ; + for ( const auto& sToken : vsTokens) { + if ( FindKey( sToken, sKey)) { + sVal = sToken.substr( sKey.length() + 1) ; + return true ; + } + } + return false ; +} + +//---------------------------------------------------------------------------- +template +inline bool +GetValInNotes( const std::string& sNotes, const std::string& sKey, T& Val) +{ + std::string sVal ; + return ( GetValInNotes( sNotes, sKey, sVal) && FromString( sVal, Val)) ; +} + +//---------------------------------------------------------------------------- +inline bool +RemoveValInNotes( const std::string& sKey, std::string& sNotes) +{ + if ( sNotes.empty() || ! IsValidKey( sKey)) + return false ; + STRVECTOR vsTokens ; + Tokenize( sNotes, ";", vsTokens) ; + bool bFound = false ; + for ( size_t i = 0; i < vsTokens.size() ; ++ i) { + if ( FindKey( vsTokens[i], sKey)) { + vsTokens.erase( vsTokens.begin() + i) ; + bFound ; + break ; + } + } + if ( bFound) { + sNotes.clear() ; + for ( const auto& sToken : vsTokens) { + if ( ! IsEmptyOrSpaces( sToken)) + sNotes += sToken + ";" ; + } + } + return true ; +} diff --git a/EInAPI.h b/EInAPI.h index b4f076e..b8760c1 100644 --- a/EInAPI.h +++ b/EInAPI.h @@ -641,6 +641,7 @@ EIN_EXPORT BOOL __stdcall EgtTdbGetCurrToolParamBool( int nType, BOOL* pbVal) ; EIN_EXPORT BOOL __stdcall EgtTdbGetCurrToolParamInt( int nType, int* pnVal) ; EIN_EXPORT BOOL __stdcall EgtTdbGetCurrToolParamDouble( int nType, double* pdVal) ; EIN_EXPORT BOOL __stdcall EgtTdbGetCurrToolParamString( int nType, wchar_t*& wsVal) ; +EIN_EXPORT BOOL __stdcall EgtTdbGetCurrToolMaxDepth( double* pdVal) ; EIN_EXPORT BOOL __stdcall EgtTdbReload( void) ; EIN_EXPORT BOOL __stdcall EgtTdbSave( void) ; EIN_EXPORT BOOL __stdcall EgtTdbGetToolDir( wchar_t*& wsToolDir) ; diff --git a/EMkMachMgr.h b/EMkMachMgr.h index e0ba11b..1f91176 100644 --- a/EMkMachMgr.h +++ b/EMkMachMgr.h @@ -1,7 +1,7 @@ //---------------------------------------------------------------------------- -// EgalTech 2015-2015 +// EgalTech 2015-2018 //---------------------------------------------------------------------------- -// File : EMkMachMgr.h Data : 23.03.15 Versione : 1.6c6 +// File : EMkMachMgr.h Data : 27.11.18 Versione : 1.9k2 // Contenuto : Dichiarazione della interfaccia IMachMgr. // // @@ -128,6 +128,7 @@ class __declspec( novtable) IMachMgr virtual bool TdbGetCurrToolParam( int nType, int& nVal) const = 0 ; virtual bool TdbGetCurrToolParam( int nType, double& dVal) const = 0 ; virtual bool TdbGetCurrToolParam( int nType, std::string& sVal) const = 0 ; + virtual bool TdbGetCurrToolMaxDepth( double& dMaxDepth) const = 0 ; virtual bool TdbReload( void) = 0 ; virtual bool TdbSave( void) const = 0 ; virtual bool TdbGetToolDir( std::string& sToolDir) const = 0 ; diff --git a/EMkToolConst.h b/EMkToolConst.h index 73f2ae6..b2e185e 100644 --- a/EMkToolConst.h +++ b/EMkToolConst.h @@ -86,6 +86,11 @@ enum TpaType { TPA_NONE = 0, TPA_TCPOS = ( TPA_STR + 5), TPA_UUID = ( TPA_STR + 6)} ; +//---------------------------------------------------------------------------- +// Costanti per info in note di sistema +const std::string TSI_THLEN = "THH" ; // lunghezza portautensile da naso mandrino +const std::string TSI_THDIAM = "THD" ; // diametro massimo portautensile + //---------------------------------------------------------------------------- // Costanti per info in portautensili const std::string TTH_LEN = "H" ; // lunghezza portautensile da naso mandrino diff --git a/EXeExecutor.h b/EXeExecutor.h index 77eddf6..dd5d483 100644 --- a/EXeExecutor.h +++ b/EXeExecutor.h @@ -735,6 +735,7 @@ EXE_EXPORT bool ExeTdbGetCurrToolParam( int nType, bool& nVal) ; EXE_EXPORT bool ExeTdbGetCurrToolParam( int nType, int& nVal) ; EXE_EXPORT bool ExeTdbGetCurrToolParam( int nType, double& dVal) ; EXE_EXPORT bool ExeTdbGetCurrToolParam( int nType, std::string& sVal) ; +EXE_EXPORT bool ExeTdbGetCurrToolMaxDepth( double& dMaxDepth) ; EXE_EXPORT bool ExeTdbReload( void) ; EXE_EXPORT bool ExeTdbSave( void) ; EXE_EXPORT bool ExeTdbGetToolDir( std::string& sToolDir) ;