79bbc3ec0e
- aggiunta gestione Assi di macchina per lettura e movimento - aggiunta gestione Teste di macchina per lettura e carico/scarico utensili.
148 lines
6.5 KiB
C++
148 lines
6.5 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2015-2015
|
|
//----------------------------------------------------------------------------
|
|
// File : MachMgr.h Data : 23.03.15 Versione : 1.6c6
|
|
// Contenuto : Dichiarazione della classe MachMgr.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 23.03.15 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "MachConst.h"
|
|
#include "Machine.h"
|
|
#include "/EgtDev/Include/EMkMachMgr.h"
|
|
#include "/EgtDev/Include/EgtNumCollection.h"
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
struct MachGrp {
|
|
std::string MGeoName ;
|
|
int SetupGroupId ;
|
|
int RawGroupId ;
|
|
int OperGroupId ;
|
|
MachGrp( void)
|
|
: MGeoName(), SetupGroupId( GDB_ID_NULL),
|
|
RawGroupId( GDB_ID_NULL), OperGroupId( GDB_ID_NULL) {}
|
|
MachGrp( std::string MgName, int SgId, int RgId, int OgId)
|
|
: MGeoName( MgName), SetupGroupId( SgId),
|
|
RawGroupId( RgId), OperGroupId( OgId) {}
|
|
} ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
class MachMgr : public IMachMgr
|
|
{
|
|
friend class Machine ;
|
|
|
|
public :
|
|
// Basic
|
|
virtual ~MachMgr( void) ;
|
|
virtual bool Init( const std::string& sMachinesDir, IGeomDB* pGeomDB,
|
|
int nContextId, const std::string& sLuaLibsDir, const std::string& sLuaLastRequire) ;
|
|
virtual bool Update( void) ;
|
|
virtual bool Insert( int nInsGrp) ;
|
|
// MachGroups
|
|
virtual int GetMachGroupNbr( void) const ;
|
|
virtual int GetFirstMachGroup( void) const ;
|
|
virtual int GetNextMachGroup( int nId) const ;
|
|
virtual bool GetMachGroupNewName( std::string& sName) const ;
|
|
virtual int AddMachGroup( const std::string& sName, const std::string& sMachineName) ;
|
|
virtual bool RemoveMachGroup( int nId) ;
|
|
virtual std::string GetMachGroupName( int nId) const ;
|
|
virtual int GetMachGroupId( const std::string& sName) const ;
|
|
virtual bool SetCurrMachGroup( int nId) ;
|
|
virtual bool ResetCurrMachGroup( void) ;
|
|
virtual int GetCurrMachGroup( void) const ;
|
|
// RawParts
|
|
virtual int GetRawPartNbr( void) const ;
|
|
virtual int GetFirstRawPart( void) const ;
|
|
virtual int GetNextRawPart( int nId) const ;
|
|
virtual int AddRawPart( const Point3d& ptOrig, double dWidth, double dLen, double dHeight, Color cCol) ;
|
|
virtual int AddRawPartWithPart( int nPartId, int nCrvSrfId, double dOverMat, Color cCol) ;
|
|
virtual bool ModifyRawPartHeight( int nRawId, double dHeight) ;
|
|
virtual bool RemoveRawPart( int nRawId) ;
|
|
virtual bool TranslateRawPart( int nRawId, const Vector3d& vtMove) ;
|
|
virtual bool RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg) ;
|
|
virtual bool MoveToCornerRawPart( int nRawId, const Point3d& ptCorner, int nFlag) ;
|
|
virtual bool MoveToCenterRawPart( int nRawId, const Point3d& ptCenter, int nFlag) ;
|
|
// Parts
|
|
virtual int GetPartInRawPartNbr( int nRawId) const ;
|
|
virtual int GetFirstPartInRawPart( int nRawId) const ;
|
|
virtual int GetNextPartInRawPart( int nId) const ;
|
|
virtual bool AddPartToRawPart( int nPartId, const Point3d& ptPos, int nRawId) ;
|
|
virtual bool RemovePartFromRawPart( int nPartId) ;
|
|
virtual bool TranslatePartInRawPart( int nPartId, const Vector3d& vtMove) ;
|
|
virtual bool RotatePartInRawPart( int nPartId, const Vector3d& vtAx, double dAngRotDeg) ;
|
|
// Machine
|
|
virtual bool SetAxisPos( const std::string& sAxis, double dVal) ;
|
|
virtual bool GetAxisPos( const std::string& sAxis, double& dVal) ;
|
|
virtual bool GetAxisHomePos( const std::string& sAxis, double& dHomeVal) ;
|
|
virtual bool ResetAxisPos( const std::string& sAxis) ;
|
|
virtual bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) ;
|
|
virtual bool ResetHeadSet( const std::string& sHead) ;
|
|
|
|
public :
|
|
MachMgr( void) ;
|
|
|
|
private :
|
|
// Basic
|
|
void Clear( void) ;
|
|
bool IsMachBase( int nId) const ;
|
|
int FindMachBase( int nGroupId) const ;
|
|
bool VerifyMachBase( void) const ;
|
|
bool CreateMachBase( void) ;
|
|
bool IsMachAux( int nId) const ;
|
|
bool VerifyMachAux( void) const ;
|
|
bool CreateMachAux( void) ;
|
|
// MachGroups
|
|
bool VerifyMachGroup( int nId, MachGrp& mgData) const ;
|
|
std::string GetCurrMGeoName( void) const
|
|
{ return ( m_pGeomDB == nullptr) ? "" :
|
|
(( m_nCurrMGrpId == GDB_ID_NULL) ? "" : m_cCurrMGrp.MGeoName) ; }
|
|
int GetCurrSetupId( void) const
|
|
{ return ( m_pGeomDB == nullptr) ? GDB_ID_NULL :
|
|
(( m_nCurrMGrpId == GDB_ID_NULL) ? GDB_ID_NULL : m_cCurrMGrp.SetupGroupId) ; }
|
|
int GetCurrRawGroupId( void) const
|
|
{ return ( m_pGeomDB == nullptr) ? GDB_ID_NULL :
|
|
(( m_nCurrMGrpId == GDB_ID_NULL) ? GDB_ID_NULL : m_cCurrMGrp.RawGroupId) ; }
|
|
int GetCurrOperId( void) const
|
|
{ return ( m_pGeomDB == nullptr) ? GDB_ID_NULL :
|
|
(( m_nCurrMGrpId == GDB_ID_NULL) ? GDB_ID_NULL : m_cCurrMGrp.OperGroupId) ; }
|
|
// Machines
|
|
bool LoadMachine( const std::string& sMachineName) ;
|
|
int GetMachine( const std::string& sMachineName) const ;
|
|
int GetCurrMGeoId( void) const ;
|
|
// RawParts
|
|
int AddRawPart( int nCrvId, double dOverMat, double dZmin, double dHeight, Color cCol) ;
|
|
int AddRawPart( int nSurfId, Color cCol) ;
|
|
bool VerifyRawPart( int nRawId) const ;
|
|
bool SetRawPartCenter( int nRawId) ;
|
|
bool ResetRawPartCenter( int nRawId) ;
|
|
bool GetRawPartCenter( int nRawId, Point3d& ptCen) ;
|
|
// Parts
|
|
bool AddPartToRawPart( int nPartId, int nRawId) ;
|
|
bool SwapParts( bool bToRawPart) ;
|
|
bool SwapRawPartParts( int nRawId, bool bToRawPart) ;
|
|
bool ShowRootParts( bool bShow) ;
|
|
|
|
private :
|
|
typedef std::vector<Machine*> MCHPVECTOR ;
|
|
|
|
private :
|
|
int m_nContextId ; // 1-based
|
|
IGeomDB* m_pGeomDB ;
|
|
std::string m_sMachinesDir ;
|
|
std::string m_sLuaLibsDir ;
|
|
std::string m_sLuaLastRequire ;
|
|
int m_nMachBaseId ;
|
|
int m_nMachAuxId ;
|
|
int m_nCurrMGrpId ;
|
|
MachGrp m_cCurrMGrp ;
|
|
int m_nCurrMch ; // 0-based
|
|
MCHPVECTOR m_vMachines ;
|
|
} ;
|