Files
EgtMachKernel/Machine.h
T
Dario Sassi 3076dccb4b EgtMachKernel 1.6e7 :
- introdotto uso ObjUser per gruppi di macchina
- prima versione prototipo delle forature
- migliorie al calolo angoli e posizioni macchina.
2015-05-26 06:49:55 +00:00

123 lines
6.2 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 "MachineStruConst.h"
#include "/EgtDev/Include/EGkGeomDB.h"
#include "/EgtDev/Include/EGnLuaMgr.h"
#include <unordered_map>
class MachMgr ;
class Axis ;
class Table ;
class Head ;
class Exit ;
//----------------------------------------------------------------------------
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) ;
bool SetCurrTable( const std::string& sTable) ;
bool SetCurrTool( const std::string& sTool, const std::string& sHead, int nExit) ;
bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) ;
bool GetPositions( const Point3d& ptP, double dA, double dB,
int& nStat, double& dX, double& dY, double& dZ) ;
bool VerifyOutOfStroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) ;
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,
const MUEXITVECTOR& vMuExit,
const Vector3d& vtADir, const std::string& sGeo) ;
int GetGroup( const std::string& sGroup) ;
Axis* GetAxis( int nGroup) ;
bool IsAxisGroup( int nGroup) { return ( GetAxis( nGroup) != nullptr) ; }
Table* GetTable( int nGroup) ;
bool IsTableGroup( int nGroup) { return ( GetTable( nGroup) != nullptr) ; }
Head* GetHead( int nGroup) ;
bool IsHeadGroup( int nGroup) { return ( GetHead( nGroup) != nullptr) ; }
Exit* GetExit( int nGroup) ;
bool IsExitGroup( int nGroup) { return ( GetExit( nGroup) != nullptr) ; }
bool AddHeadToSet( const std::string& sHSet, const std::string& sName) ;
const STRVECTOR& GetHSet( const std::string& sHead) ;
bool EnableHeadInSet( const std::string& sHead) ;
bool CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit) ;
bool CalculateKinematicChain( void) ;
bool AddKinematicAxis( bool bOnHead, int nId) ;
bool AdjustAngleInStroke( int nId, double& dAng) ;
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
int m_nCalcTabId ; // tavola corrente per calcoli
int m_nCalcHeadId ; // testa corrente per calcoli
int m_nCalcExitId ; // uscita corrente per calcoli
int m_nCalcToolId ; // utensile corrente per calcoli
Point3d m_ptCalcPos ; // posizione utensile a riposo per calcoli
Vector3d m_vtCalcDir ; // direzione utensile a riposo per calcoli
Vector3d m_vtCalcADir ; // direzione ausiliaria a riposo per calcoli
double m_dCalcTLen ; // lunghezza utensile corrente per calcoli
KINAXISVECTOR m_vCalcLinAx ; // vettore assi lineari attivi per calcoli
KINAXISVECTOR m_vCalcRotAx ; // vettore assi rotanti attivi per calcoli
// 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) ;
} ;