a127db39f0
- modifiche per poter costruire DB utensili e lavorazioni partendo da zero.
140 lines
6.2 KiB
C++
140 lines
6.2 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2015-2024
|
|
//----------------------------------------------------------------------------
|
|
// File : MachiningsMgr.h Data : 29.03.24 Versione : 2.6d1
|
|
// Contenuto : Dichiarazione della classe MachiningsMgr.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 02.06.15 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "MachiningData.h"
|
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
|
#include <unordered_map>
|
|
#include <map>
|
|
|
|
class Scanner ;
|
|
class Writer ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
class MachiningsMgr
|
|
{
|
|
public :
|
|
MachiningsMgr( void) ;
|
|
~MachiningsMgr( void) ;
|
|
bool Load( const std::string& sMachsDir, const std::string& sMachsFile, const ToolsMgr* pTsMgr) ;
|
|
bool Reload( void) ;
|
|
bool Save( bool bCompressed = true) const ;
|
|
bool GetMachiningNewName( std::string& sName) const ;
|
|
bool AddMachining( const std::string& sName, int nType) ;
|
|
bool CopyMachining( const std::string& sSource, const std::string& sName) ;
|
|
bool RemoveMachining( const std::string& sName) ;
|
|
const MachiningData* GetMachining( const EgtUUID& Uuid) const ;
|
|
const MachiningData* GetMachining( const std::string& sName) const ;
|
|
bool GetFirstMachining( int nType, std::string& sName) const ;
|
|
bool GetNextMachining( int nType, std::string& sName) const ;
|
|
bool SetCurrMachining( const std::string& sName) ;
|
|
bool SaveCurrMachining( void) ;
|
|
bool IsCurrMachiningModified( void) const ;
|
|
bool SetCurrMachiningParam( int nType, bool bVal) ;
|
|
bool SetCurrMachiningParam( int nType, int nVal) ;
|
|
bool SetCurrMachiningParam( int nType, double dVal) ;
|
|
bool SetCurrMachiningParam( int nType, const std::string& sVal) ;
|
|
bool GetCurrMachiningParam( int nType, bool& bVal) const ;
|
|
bool GetCurrMachiningParam( int nType, int& nVal) const ;
|
|
bool GetCurrMachiningParam( int nType, double& dVal) const ;
|
|
bool GetCurrMachiningParam( int nType, std::string& sVal) const ;
|
|
bool Set3AxComp( bool b3AxComp) ;
|
|
bool Get3AxComp( void) const
|
|
{ return m_b3AxComp ; }
|
|
bool Set5AxComp( bool b5AxComp) ;
|
|
bool Get5AxComp( void) const
|
|
{ return m_b5AxComp ; }
|
|
bool SetSafeZ( double dSafeZ) ;
|
|
double GetSafeZ( void) const
|
|
{ return m_dSafeZ ; }
|
|
bool SetSafeAggrBottZ( double dSafeAggrBottZ) ;
|
|
double GetSafeAggrBottZ( void) const
|
|
{ return m_dSafeAggrBottZ ; }
|
|
bool SetExtraLOnCutRegion( double dExtraL) ;
|
|
double GetExtraLOnCutRegion( void) const
|
|
{ return m_dExtraLOnCutRegion ; }
|
|
bool SetExtraROnDrillRegion( double dExtraR) ;
|
|
double GetExtraROnDrillRegion( void) const
|
|
{ return m_dExtraROnDrillRegion ; }
|
|
bool SetHoleDiamToler( double dToler) ;
|
|
double GetHoleDiamToler( void) const
|
|
{ return m_dHoleDiamToler ; }
|
|
bool SetExtSawArcMinRad( double dRad) ;
|
|
double GetExtSawArcMinRad( void) const
|
|
{ return m_dExtSawArcMinRad ; }
|
|
bool SetIntSawArcMaxSideAng( double dSideAng) ;
|
|
double GetIntSawArcMaxSideAng( void) const
|
|
{ return m_dIntSawArcMaxSideAng ; }
|
|
bool SetSplitArcs( int nFlag) ;
|
|
int GetSplitArcs( void) const
|
|
{ return m_nSplitArcs ; }
|
|
bool SetApproxLinTol( double dLinTol) ;
|
|
double GetApproxLinTol( void) const
|
|
{ return m_dApproxLinTol ; }
|
|
bool SetMaxDepthSafe( double dSafe) ;
|
|
double GetMaxDepthSafe( void) const
|
|
{ return m_dMaxDepthSafe ; }
|
|
bool Export( const STRVECTOR& vsMachiningsNames, const std::string& sOutFile, bool bCompressed = true) const ;
|
|
bool ToBeImported( const std::string& sFile, STRVECTOR& vsMachiningsNames, INTVECTOR& vMachiningsTypes) const ;
|
|
bool Import( const std::string& sFile, const STRVECTOR& vsMachiningsToImport, const STRVECTOR& vsMachiningsNames, STRVECTOR& vsImported) ;
|
|
|
|
private :
|
|
bool Clear( bool bReset) ;
|
|
bool LoadHeader( Scanner& TheScanner, int& nVersion, int& nTotal, bool& bEnd) const ;
|
|
bool LoadGeneral( Scanner& TheScanner, bool& bEnd) ;
|
|
bool SkipGeneral( Scanner& TheScanner, bool& bEnd) const ;
|
|
bool LoadOneMachining( Scanner& TheScanner, PtrOwner<MachiningData>& pMch, bool& bEnd) const ;
|
|
bool SaveHeader( Writer& TheWriter, int nTotal = -1) const ;
|
|
bool SaveGeneral( Writer& TheWriter) const ;
|
|
bool SaveOneMachining( const EgtUUID& Uuid, int& nCounter, Writer& TheWriter) const ;
|
|
bool VerifyCurrMachining( int nType, std::string& sName) const ;
|
|
bool DecodeSpecialParams( MachiningData* pMach) const ;
|
|
bool EncodeSpecialParams( MachiningData* pMach) const ;
|
|
|
|
private :
|
|
typedef std::unordered_map< EgtUUID, MachiningData*> UUIDPMDATA_UMAP ;
|
|
typedef std::map< std::string, EgtUUID> STRUUID_MAP ;
|
|
typedef STRUUID_MAP::const_iterator STRUUID_CITER ;
|
|
|
|
private :
|
|
// dir e path file lavorazioni
|
|
std::string m_sMachsDir ;
|
|
std::string m_sMachsPath ;
|
|
// flag di dati modificati
|
|
mutable bool m_bModified ;
|
|
// versione DB caricato
|
|
int m_nDbVer ;
|
|
// database lavorazioni
|
|
UUIDPMDATA_UMAP m_umData ;
|
|
STRUUID_MAP m_suData ;
|
|
// iteratore corrente per First/Next
|
|
mutable STRUUID_CITER m_suCIter ;
|
|
// lavorazione corrente
|
|
MachiningData* m_pCurrMach ;
|
|
// gestore utensili
|
|
const ToolsMgr* m_pTsMgr ;
|
|
// dati generali
|
|
bool m_b3AxComp ;
|
|
bool m_b5AxComp ;
|
|
double m_dSafeZ ;
|
|
double m_dSafeAggrBottZ ;
|
|
double m_dExtraLOnCutRegion ;
|
|
double m_dExtraROnDrillRegion ;
|
|
double m_dHoleDiamToler ;
|
|
double m_dExtSawArcMinRad ;
|
|
double m_dIntSawArcMaxSideAng ;
|
|
int m_nSplitArcs ;
|
|
double m_dApproxLinTol ;
|
|
double m_dMaxDepthSafe ;
|
|
} ; |