79bbc3ec0e
- aggiunta gestione Assi di macchina per lettura e movimento - aggiunta gestione Teste di macchina per lettura e carico/scarico utensili.
111 lines
4.7 KiB
C++
111 lines
4.7 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2015-2015
|
|
//----------------------------------------------------------------------------
|
|
// File : Machine.h Data : 06.05.15 Versione : 1.6e3
|
|
// Contenuto : Dichiarazione della classe Machine.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 06.05.15 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "/EgtDev/Include/EGkGeomDB.h"
|
|
#include "/EgtDev/Include/EGnLuaMgr.h"
|
|
#include <unordered_map>
|
|
|
|
class MachMgr ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
union STROKE {
|
|
struct {
|
|
double Min ;
|
|
double Max ;
|
|
} ;
|
|
double v[2] ;
|
|
} ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
struct MuExit {
|
|
Point3d ptPos ;
|
|
Vector3d vtTDir ;
|
|
MuExit( const Point3d& ptP, const Vector3d& vtTD)
|
|
: ptPos( ptP), vtTDir( vtTD) {}
|
|
} ;
|
|
typedef std::vector<MuExit> MUEXITVECTOR ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
class Machine
|
|
{
|
|
public :
|
|
Machine( void) ;
|
|
~Machine( void) ;
|
|
bool Init( const std::string& sMachineName, MachMgr* pMchMgr) ;
|
|
int GetMGeoId( void)
|
|
{ return m_nGroupId ; }
|
|
const std::string& GetMachineName( void)
|
|
{ return m_sName ; }
|
|
bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) ;
|
|
bool ResetHeadSet( const std::string& sHead) ;
|
|
bool SetAxisPos( const std::string& sAxis, double dVal) ;
|
|
bool GetAxisPos( const std::string& sAxis, double& dVal) ;
|
|
bool GetAxisHomePos( const std::string& sAxis, double& dHomeVal) ;
|
|
bool ResetAxisPos( const std::string& sAxis) ;
|
|
|
|
private :
|
|
void Clear( void) ;
|
|
bool LoadMachineGeometry( const std::string& sMGeoName, const Vector3d& vtOffset) ;
|
|
bool LoadMachineBase( const std::string& sName, const std::string& sGeo) ;
|
|
bool LoadMachineTable( const std::string& sName, const std::string& sParent, int nType, const std::string& sGeo) ;
|
|
bool LoadMachineAxis( const std::string& sName, const std::string& sParent, int nType,
|
|
const Point3d& ptPos, const Vector3d& vtDir,
|
|
const STROKE& Stroke, const std::string& sGeo, double dVal) ;
|
|
bool AddAxisVector( int nLay, const Point3d& ptPos, const Vector3d& vtDir, const std::string& sName) ;
|
|
bool LoadMachineStdHead( const std::string& sName, const std::string& sParent, const std::string& sHSet,
|
|
const Point3d& ptPos, const Vector3d& vtTDir,
|
|
const Vector3d& vtADir, const std::string& sGeo) ;
|
|
bool LoadMachineMultiHead( const std::string& sName, const std::string& sParent, const std::string& sHSet,
|
|
MUEXITVECTOR vMuExit,
|
|
const Vector3d& vtADir, const std::string& sGeo) ;
|
|
int GetGroup( const std::string& sGroup) ;
|
|
bool IsAxisGroup( int nGroup) ;
|
|
bool IsTableGroup( int nGroup) ;
|
|
bool IsHeadGroup( int nGroup) ;
|
|
bool AddHeadToSet( const std::string& sHSet, const std::string& sName) ;
|
|
bool GetHSet( const std::string& sHead, STRVECTOR& vsHSet) ;
|
|
bool EnableHeadInSet( const std::string& sHead) ;
|
|
bool CreateExitGroups( int nLay, int nExitNbr) ;
|
|
|
|
bool LuaInit( const std::string& sMachineName) ;
|
|
bool LuaExit( void) ;
|
|
bool LuaExecFile( const std::string& sFile) ;
|
|
|
|
private :
|
|
typedef std::unordered_map< std::string, int> STRINT_UMAP ;
|
|
|
|
private :
|
|
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
|
|
LuaMgr m_LuaMgr ; // interprete lua della macchina
|
|
std::string m_sName ; // nome della macchina
|
|
std::string m_sMachineDir ; // direttorio della macchina
|
|
int m_nGroupId ; // Id del gruppo della macchina
|
|
int m_nTempGroupId ; // Id del gruppo temporaneo macchina per carico
|
|
STRINT_UMAP m_mapGroups ; // dizionario dei gruppi della macchina
|
|
|
|
// Static per interprete Lua di macchina
|
|
private :
|
|
static Machine* m_pMchLua ;
|
|
|
|
private :
|
|
static int LuaEmtGeneral( lua_State* L) ;
|
|
static int LuaEmtBase( lua_State* L) ;
|
|
static int LuaEmtTable( lua_State* L) ;
|
|
static int LuaEmtAxis( lua_State* L) ;
|
|
static int LuaEmtHead( lua_State* L) ;
|
|
static int LuaEmtStdHead( lua_State* L) ;
|
|
static int LuaEmtMultiHead( lua_State* L) ;
|
|
} ;
|