EgtMachKernel 1.6p4 :
- ampliata Disposizione con gestione movimenti di pezzi con la testa tramite SpecialApply (che richiama script) - modifiche a Simulatore per gestire queste disposizioni e aggiunti richiami script su diversi eventi - modifiche a Generatore per gestire queste disposizioni - varie altre modifiche e migliorie.
This commit is contained in:
+229
-51
@@ -23,6 +23,30 @@
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static const string FLD_FILE = "File" ;
|
||||
static const string FLD_OFFSET = "Offset" ;
|
||||
static const string FLD_SPECIAL = "Special" ;
|
||||
static const string FLD_PROCESSOR = "Processor" ;
|
||||
static const string FLD_AXISMAXADJUST = "AxisMaxAdjust" ;
|
||||
static const string FLD_EXITMAXADJUST = "ExitMaxAdjust" ;
|
||||
static const string FLD_NAME = "Name" ;
|
||||
static const string FLD_PARENT = "Parent" ;
|
||||
static const string FLD_GEO = "Geo" ;
|
||||
static const string FLD_AUX = "Aux" ;
|
||||
static const string FLD_TYPE = "Type" ;
|
||||
static const string FLD_REF1 = "Ref1" ;
|
||||
static const string FLD_POS = "Pos" ;
|
||||
static const string FLD_DIR = "Dir" ;
|
||||
static const string FLD_STROKE = "Stroke" ;
|
||||
static const string FLD_HOME = "Home" ;
|
||||
static const string FLD_HSET = "HSet" ;
|
||||
static const string FLD_TDIR = "TDir" ;
|
||||
static const string FLD_ADIR = "ADir" ;
|
||||
static const string FLD_ROT1W = "Rot1W" ;
|
||||
static const string FLD_ROT2STROKE = "Rot2Stroke" ;
|
||||
static const string FLD_SOLCH = "SolCh" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Machine* Machine::m_pMchLua = nullptr ;
|
||||
|
||||
@@ -57,6 +81,13 @@ Machine::LuaInit( const string& sMachineName)
|
||||
// registro le funzioni di modifica macchina per lua
|
||||
m_LuaMgr.RegisterFunction( "EmtModifyAxisStroke", Machine::LuaEmtModifyAxisStroke) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtModifyAxisHome", Machine::LuaEmtModifyAxisHome) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtLinkRawPartToGroup", Machine::LuaEmtLinkRawPartToGroup) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtUnlinkRawPartFromGroup", Machine::LuaEmtUnlinkRawPartFromGroup) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtUnlinkAllRawPartsFromGroups", Machine::LuaEmtUnlinkAllRawPartsFromGroups) ;
|
||||
// registro le funzioni di definizione entità CL per lua
|
||||
m_LuaMgr.RegisterFunction( "EmtAddRapidStart", Machine::LuaEmtAddRapidStart) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtAddRapidMove", Machine::LuaEmtAddRapidMove) ;
|
||||
m_LuaMgr.RegisterFunction( "EmtAddLinearMove", Machine::LuaEmtAddLinearMove) ;
|
||||
// registro le funzioni di scrittura part program per lua
|
||||
m_LuaMgr.RegisterFunction( "EmtWrite", Machine::LuaEmtWrite) ;
|
||||
|
||||
@@ -187,23 +218,28 @@ Machine::LuaEmtGeneral( lua_State* L)
|
||||
return luaL_error( L, " Invalid Parameter, required a table") ;
|
||||
// lettura campo 'File' dalla tabella
|
||||
string sFile ;
|
||||
LuaCheckTabFieldParam( L, 1, "File", sFile)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_FILE, sFile)
|
||||
// lettura eventuale campo 'Offset' dalla tabella (default 0,0,0)
|
||||
Vector3d vtOffset ;
|
||||
LuaGetTabFieldParam( L, 1, "Offset", vtOffset) ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_OFFSET, vtOffset) ;
|
||||
// lettura eventuale campo 'Special' dalla tabella
|
||||
string sSpecial ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_SPECIAL, sSpecial) ;
|
||||
// lettura eventuale campo 'Processor' dalla tabella
|
||||
string sProcessor ;
|
||||
LuaGetTabFieldParam( L, 1, "Processor", sProcessor) ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_PROCESSOR, sProcessor) ;
|
||||
// lettura eventuale campo 'AxisMaxAdjust' dalla tabella (default EPS_SMALL)
|
||||
double dAxisMaxAdjust = EPS_SMALL ;
|
||||
LuaGetTabFieldParam( L, 1, "AxisMaxAdjust", dAxisMaxAdjust) ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_AXISMAXADJUST, dAxisMaxAdjust) ;
|
||||
// lettura eventuale campo 'ExitMaxAdjust' dalla tabella (default EPS_SMALL)
|
||||
double dExitMaxAdjust = EPS_SMALL ;
|
||||
LuaGetTabFieldParam( L, 1, "ExitMaxAdjust", dExitMaxAdjust) ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_EXITMAXADJUST, dExitMaxAdjust) ;
|
||||
LuaClearStack( L) ;
|
||||
|
||||
// info
|
||||
string sOut = "LuaEmtGeneral : " + sFile ;
|
||||
if ( ! sSpecial.empty())
|
||||
sOut += ", " + sSpecial ;
|
||||
if ( ! sProcessor.empty())
|
||||
sOut += ", " + sProcessor ;
|
||||
LOG_INFO( GetEMkLogger(), sOut.c_str())
|
||||
@@ -216,6 +252,17 @@ Machine::LuaEmtGeneral( lua_State* L)
|
||||
if ( ! m_pMchLua->LoadMachineGeometry( sFile, vtOffset))
|
||||
return luaL_error( L, " Load Machine failed") ;
|
||||
|
||||
// carico il gestore delle azioni speciali della macchina
|
||||
if ( ! sSpecial.empty()) {
|
||||
// carico il file lua dello special
|
||||
string sSpecPath = m_pMchLua->m_sMachineDir + "\\" + sSpecial ;
|
||||
if ( ! m_pMchLua->m_LuaMgr.ExecFile( sSpecPath))
|
||||
return luaL_error( L, " Load Special failed") ;
|
||||
}
|
||||
else {
|
||||
LOG_INFO( GetEMkLogger(), " Special file not specified")
|
||||
}
|
||||
|
||||
// carico il processore della macchina
|
||||
if ( ! sProcessor.empty()) {
|
||||
// carico il file lua del processore
|
||||
@@ -243,10 +290,13 @@ Machine::LuaEmtBase( lua_State* L)
|
||||
return luaL_error( L, " Invalid Parameter, required a table") ;
|
||||
// lettura campo 'Name' dalla tabella
|
||||
string sName ;
|
||||
LuaCheckTabFieldParam( L, 1, "Name", sName)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_NAME, sName)
|
||||
// lettura campo 'Geo' dalla tabella
|
||||
string sGeo ;
|
||||
LuaCheckTabFieldParam( L, 1, "Geo", sGeo)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_GEO, sGeo)
|
||||
// lettura eventuale campo 'Aux' dalla tabella
|
||||
STRVECTOR vsAux ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_AUX, vsAux) ;
|
||||
LuaClearStack( L) ;
|
||||
|
||||
// info
|
||||
@@ -258,7 +308,7 @@ Machine::LuaEmtBase( lua_State* L)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
|
||||
// carico i dati della base
|
||||
if ( ! m_pMchLua->LoadMachineBase( sName, sGeo))
|
||||
if ( ! m_pMchLua->LoadMachineBase( sName, sGeo, vsAux))
|
||||
return luaL_error( L, " Load Machine Base failed") ;
|
||||
|
||||
return 0 ;
|
||||
@@ -273,19 +323,22 @@ Machine::LuaEmtTable( lua_State* L)
|
||||
return luaL_error( L, " Invalid Parameter, required a table") ;
|
||||
// lettura campo 'Name' dalla tabella
|
||||
string sName ;
|
||||
LuaCheckTabFieldParam( L, 1, "Name", sName)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_NAME, sName)
|
||||
// lettura campo 'Parent' dalla tabella
|
||||
string sParent ;
|
||||
LuaCheckTabFieldParam( L, 1, "Parent", sParent)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_PARENT, sParent)
|
||||
// lettura campo 'Type' dalla tabella
|
||||
int nType ;
|
||||
LuaCheckTabFieldParam( L, 1, "Type", nType)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_TYPE, nType)
|
||||
// lettura campo 'Ref1' dalla tabella
|
||||
Point3d Ref1 ;
|
||||
LuaCheckTabFieldParam( L, 1, "Ref1", Ref1)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_REF1, Ref1)
|
||||
// lettura campo 'Geo' dalla tabella
|
||||
string sGeo ;
|
||||
LuaCheckTabFieldParam( L, 1, "Geo", sGeo)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_GEO, sGeo)
|
||||
// lettura eventuale campo 'Aux' dalla tabella
|
||||
STRVECTOR vsAux ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_AUX, vsAux) ;
|
||||
LuaClearStack( L) ;
|
||||
|
||||
// info
|
||||
@@ -297,7 +350,7 @@ Machine::LuaEmtTable( lua_State* L)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
|
||||
// carico i dati della tavola
|
||||
if ( ! m_pMchLua->LoadMachineTable( sName, sParent, nType, Ref1, sGeo))
|
||||
if ( ! m_pMchLua->LoadMachineTable( sName, sParent, nType, Ref1, sGeo, vsAux))
|
||||
return luaL_error( L, " Load Machine Table failed") ;
|
||||
|
||||
return 0 ;
|
||||
@@ -312,28 +365,31 @@ Machine::LuaEmtAxis( lua_State* L)
|
||||
return luaL_error( L, " Invalid Parameter, required a table") ;
|
||||
// lettura campo 'Name' dalla tabella
|
||||
string sName ;
|
||||
LuaCheckTabFieldParam( L, 1, "Name", sName)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_NAME, sName)
|
||||
// lettura campo 'Parent' dalla tabella
|
||||
string sParent ;
|
||||
LuaCheckTabFieldParam( L, 1, "Parent", sParent)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_PARENT, sParent)
|
||||
// lettura campo 'Type' dalla tabella
|
||||
int nType ;
|
||||
LuaCheckTabFieldParam( L, 1, "Type", nType)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_TYPE, nType)
|
||||
// lettura campo 'Pos' dalla tabella
|
||||
Point3d ptPos ;
|
||||
LuaCheckTabFieldParam( L, 1, "Pos", ptPos)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_POS, ptPos)
|
||||
// lettura campo 'Dir' dalla tabella
|
||||
Vector3d vtDir ;
|
||||
LuaCheckTabFieldParam( L, 1, "Dir", vtDir)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_DIR, vtDir)
|
||||
// lettura campo 'Stroke' dalla tabella
|
||||
STROKE Stroke ;
|
||||
LuaCheckTabFieldParam( L, 1, "Stroke", Stroke.v)
|
||||
// lettura campo 'Geo' dalla tabella
|
||||
string sGeo ;
|
||||
LuaCheckTabFieldParam( L, 1, "Geo", sGeo)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_STROKE, Stroke.v)
|
||||
// lettura eventuale campo 'Home' dalla tabella (default 0)
|
||||
double dHome = 0 ;
|
||||
LuaGetTabFieldParam( L, 1, "Home", dHome) ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_HOME, dHome) ;
|
||||
// lettura campo 'Geo' dalla tabella
|
||||
string sGeo ;
|
||||
LuaCheckTabFieldParam( L, 1, FLD_GEO, sGeo)
|
||||
// lettura eventuale campo 'Aux' dalla tabella
|
||||
STRVECTOR vsAux ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_AUX, vsAux) ;
|
||||
LuaClearStack( L) ;
|
||||
|
||||
// info
|
||||
@@ -345,7 +401,7 @@ Machine::LuaEmtAxis( lua_State* L)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
|
||||
// carico i dati dell'asse
|
||||
if ( ! m_pMchLua->LoadMachineAxis( sName, sParent, nType, ptPos, vtDir, Stroke, sGeo, dHome))
|
||||
if ( ! m_pMchLua->LoadMachineAxis( sName, sParent, nType, ptPos, vtDir, Stroke, dHome, sGeo, vsAux))
|
||||
return luaL_error( L, " Load Machine Axis failed") ;
|
||||
|
||||
return 0 ;
|
||||
@@ -360,15 +416,19 @@ Machine::LuaEmtHead( lua_State* L)
|
||||
return luaL_error( L, " Invalid Parameter, required a table") ;
|
||||
// lettura campo 'Type' dalla tabella
|
||||
int nType ;
|
||||
LuaCheckTabFieldParam( L, 1, "Type", nType)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_TYPE, nType)
|
||||
|
||||
// Procedo alla lettura a seconda del tipo
|
||||
if ( nType == MCH_HT_STD)
|
||||
switch ( nType) {
|
||||
case MCH_HT_STD :
|
||||
return LuaEmtStdHead( L) ;
|
||||
else if ( nType == MCH_HT_MULTI)
|
||||
case MCH_HT_MULTI :
|
||||
return LuaEmtMultiHead( L) ;
|
||||
else
|
||||
case MCH_HT_SPECIAL :
|
||||
return LuaEmtSpecialHead( L) ;
|
||||
default :
|
||||
return luaL_error( L, " Head type unknown") ;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -380,34 +440,37 @@ Machine::LuaEmtStdHead( lua_State* L)
|
||||
return luaL_error( L, " Invalid Parameter, required a table") ;
|
||||
// lettura campo 'Name' dalla tabella
|
||||
string sName ;
|
||||
LuaCheckTabFieldParam( L, 1, "Name", sName)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_NAME, sName)
|
||||
// lettura campo 'Parent' dalla tabella
|
||||
string sParent ;
|
||||
LuaCheckTabFieldParam( L, 1, "Parent", sParent)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_PARENT, sParent)
|
||||
// lettura campo 'HSet' dalla tabella
|
||||
string sHSet ;
|
||||
LuaCheckTabFieldParam( L, 1, "HSet", sHSet)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_HSET, sHSet)
|
||||
// lettura campo 'Pos' dalla tabella
|
||||
Point3d ptPos ;
|
||||
LuaCheckTabFieldParam( L, 1, "Pos", ptPos)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_POS, ptPos)
|
||||
// lettura campo 'TDir' dalla tabella
|
||||
Vector3d vtTDir ;
|
||||
LuaCheckTabFieldParam( L, 1, "TDir", vtTDir)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_TDIR, vtTDir)
|
||||
// lettura eventuale campo 'ADir' dalla tabella
|
||||
Vector3d vtADir ;
|
||||
LuaGetTabFieldParam( L, 1, "ADir", vtADir) ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_ADIR, vtADir) ;
|
||||
// lettura eventuale campo 'Rot1W' dalla tabella (default 1)
|
||||
double dRot1W = 1 ;
|
||||
LuaGetTabFieldParam( L, 1, "Rot1W", dRot1W) ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_ROT1W, dRot1W) ;
|
||||
// lettura eventuale campo 'Rot2Stroke' dalla tabella
|
||||
STROKE Rot2Stroke = { - INFINITO, INFINITO} ;
|
||||
LuaGetTabFieldParam( L, 1, "Rot2Stroke", Rot2Stroke.v) ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_ROT2STROKE, Rot2Stroke.v) ;
|
||||
// lettura eventuale campo 'SolCh' dalla tabella
|
||||
int nSolCh = MCH_SCC_NONE ;
|
||||
LuaGetTabFieldParam( L, 1, "SolCh", nSolCh) ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_SOLCH, nSolCh) ;
|
||||
// lettura campo 'Geo' dalla tabella
|
||||
string sGeo ;
|
||||
LuaCheckTabFieldParam( L, 1, "Geo", sGeo)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_GEO, sGeo)
|
||||
// lettura eventuale campo 'Aux' dalla tabella
|
||||
STRVECTOR vsAux ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_AUX, vsAux) ;
|
||||
LuaClearStack( L) ;
|
||||
|
||||
// info
|
||||
@@ -420,7 +483,7 @@ Machine::LuaEmtStdHead( lua_State* L)
|
||||
|
||||
// carico i dati della testa standard
|
||||
if ( ! m_pMchLua->LoadMachineStdHead( sName, sParent, sHSet, ptPos, vtTDir, vtADir,
|
||||
dRot1W, Rot2Stroke, nSolCh, sGeo))
|
||||
dRot1W, Rot2Stroke, nSolCh, sGeo, vsAux))
|
||||
return luaL_error( L, " Load Machine Standard Head failed") ;
|
||||
|
||||
return 0 ;
|
||||
@@ -435,13 +498,13 @@ Machine::LuaEmtMultiHead( lua_State* L)
|
||||
return luaL_error( L, " Invalid Parameter, required a table") ;
|
||||
// lettura campo 'Name' dalla tabella
|
||||
string sName ;
|
||||
LuaCheckTabFieldParam( L, 1, "Name", sName)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_NAME, sName)
|
||||
// lettura campo 'Parent' dalla tabella
|
||||
string sParent ;
|
||||
LuaCheckTabFieldParam( L, 1, "Parent", sParent)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_PARENT, sParent)
|
||||
// lettura campo 'HSet' dalla tabella
|
||||
string sHSet ;
|
||||
LuaCheckTabFieldParam( L, 1, "HSet", sHSet)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_HSET, sHSet)
|
||||
// lettura campo 'ExitNbr' dalla tabella
|
||||
int nExitNbr ;
|
||||
LuaCheckTabFieldParam( L, 1, "ExitNbr", nExitNbr)
|
||||
@@ -450,10 +513,10 @@ Machine::LuaEmtMultiHead( lua_State* L)
|
||||
vMuExit.reserve( nExitNbr) ;
|
||||
for ( int i = 0 ; i < nExitNbr ; ++ i) {
|
||||
// lettura
|
||||
string sPos = "Pos" + ToString( i + 1) ;
|
||||
string sPos = FLD_POS + ToString( i + 1) ;
|
||||
Point3d ptPos ;
|
||||
LuaCheckTabFieldParam( L, 1, sPos.c_str(), ptPos)
|
||||
string sTDir = "TDir" + ToString( i + 1) ;
|
||||
string sTDir = FLD_TDIR + ToString( i + 1) ;
|
||||
Vector3d vtTDir ;
|
||||
LuaCheckTabFieldParam( L, 1, sTDir.c_str(), vtTDir)
|
||||
// inserimento nell'array
|
||||
@@ -461,19 +524,22 @@ Machine::LuaEmtMultiHead( lua_State* L)
|
||||
}
|
||||
// lettura campo 'ADir' dalla tabella
|
||||
Vector3d vtADir ;
|
||||
LuaGetTabFieldParam( L, 1, "ADir", vtADir) ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_ADIR, vtADir) ;
|
||||
// lettura eventuale campo 'Rot1W' dalla tabella (default 1)
|
||||
double dRot1W = 1 ;
|
||||
LuaGetTabFieldParam( L, 1, "Rot1W", dRot1W) ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_ROT1W, dRot1W) ;
|
||||
// lettura eventuale campo 'Rot2Stroke' dalla tabella
|
||||
STROKE Rot2Stroke = { - INFINITO, INFINITO} ;
|
||||
LuaGetTabFieldParam( L, 1, "Rot2Stroke", Rot2Stroke.v) ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_ROT2STROKE, Rot2Stroke.v) ;
|
||||
// lettura eventuale campo 'SolCh' dalla tabella
|
||||
int nSolCh = MCH_SCC_NONE ;
|
||||
LuaGetTabFieldParam( L, 1, "SolCh", nSolCh) ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_SOLCH, nSolCh) ;
|
||||
// lettura campo 'Geo' dalla tabella
|
||||
string sGeo ;
|
||||
LuaCheckTabFieldParam( L, 1, "Geo", sGeo)
|
||||
LuaCheckTabFieldParam( L, 1, FLD_GEO, sGeo)
|
||||
// lettura eventuale campo 'Aux' dalla tabella
|
||||
STRVECTOR vsAux ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_AUX, vsAux) ;
|
||||
LuaClearStack( L) ;
|
||||
|
||||
// info
|
||||
@@ -486,12 +552,70 @@ Machine::LuaEmtMultiHead( lua_State* L)
|
||||
|
||||
// carico i dati della testa multipla
|
||||
if ( ! m_pMchLua->LoadMachineMultiHead( sName, sParent, sHSet, vMuExit, vtADir,
|
||||
dRot1W, Rot2Stroke, nSolCh, sGeo))
|
||||
dRot1W, Rot2Stroke, nSolCh, sGeo, vsAux))
|
||||
return luaL_error( L, " Load Machine Standard Head failed") ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtSpecialHead( lua_State* L)
|
||||
{
|
||||
// Il parametro 1 deve essere una tabella
|
||||
if ( ! lua_istable( L, 1))
|
||||
return luaL_error( L, " Invalid Parameter, required a table") ;
|
||||
// lettura campo 'Name' dalla tabella
|
||||
string sName ;
|
||||
LuaCheckTabFieldParam( L, 1, FLD_NAME, sName)
|
||||
// lettura campo 'Parent' dalla tabella
|
||||
string sParent ;
|
||||
LuaCheckTabFieldParam( L, 1, FLD_PARENT, sParent)
|
||||
// lettura campo 'HSet' dalla tabella
|
||||
string sHSet ;
|
||||
LuaCheckTabFieldParam( L, 1, FLD_HSET, sHSet)
|
||||
// lettura campo 'Pos' dalla tabella
|
||||
Point3d ptPos ;
|
||||
LuaCheckTabFieldParam( L, 1, FLD_POS, ptPos)
|
||||
// lettura campo 'TDir' dalla tabella
|
||||
Vector3d vtTDir ;
|
||||
LuaCheckTabFieldParam( L, 1, FLD_TDIR, vtTDir)
|
||||
// lettura eventuale campo 'ADir' dalla tabella
|
||||
Vector3d vtADir ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_ADIR, vtADir) ;
|
||||
// lettura eventuale campo 'Rot1W' dalla tabella (default 1)
|
||||
double dRot1W = 1 ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_ROT1W, dRot1W) ;
|
||||
// lettura eventuale campo 'Rot2Stroke' dalla tabella
|
||||
STROKE Rot2Stroke = { - INFINITO, INFINITO} ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_ROT2STROKE, Rot2Stroke.v) ;
|
||||
// lettura eventuale campo 'SolCh' dalla tabella
|
||||
int nSolCh = MCH_SCC_NONE ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_SOLCH, nSolCh) ;
|
||||
// lettura campo 'Geo' dalla tabella
|
||||
string sGeo ;
|
||||
LuaCheckTabFieldParam( L, 1, FLD_GEO, sGeo)
|
||||
// lettura eventuale campo 'Aux' dalla tabella
|
||||
STRVECTOR vsAux ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_AUX, vsAux) ;
|
||||
LuaClearStack( L) ;
|
||||
|
||||
// info
|
||||
string sOut = "LuaEmtSpecialHead : " + sName ;
|
||||
LOG_INFO( GetEMkLogger(), sOut.c_str())
|
||||
|
||||
// verifico ci sia una macchina attiva
|
||||
if ( m_pMchLua == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
|
||||
// carico i dati della testa standard
|
||||
if ( ! m_pMchLua->LoadMachineSpecialHead( sName, sParent, sHSet, ptPos, vtTDir, vtADir,
|
||||
dRot1W, Rot2Stroke, nSolCh, sGeo, vsAux))
|
||||
return luaL_error( L, " Load Machine Special Head failed") ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtModifyAxisStroke( lua_State* L)
|
||||
@@ -532,6 +656,60 @@ Machine::LuaEmtModifyAxisHome( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtLinkRawPartToGroup( lua_State* L)
|
||||
{
|
||||
// 2 parametri : nRawId, sGroupName
|
||||
int nRawId ;
|
||||
LuaCheckParam( L, 1, nRawId)
|
||||
string sGroupName ;
|
||||
LuaCheckParam( L, 2, sGroupName)
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva
|
||||
if ( m_pMchLua == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// aggancio il grezzo al gruppo
|
||||
bool bOk = m_pMchLua->LinkRawPartToGroup( nRawId, sGroupName) ;
|
||||
// assegno risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtUnlinkRawPartFromGroup( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nRawId
|
||||
int nRawId ;
|
||||
LuaCheckParam( L, 1, nRawId)
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva
|
||||
if ( m_pMchLua == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// riporto il grezzo nel gruppo dei grezzi
|
||||
bool bOk = m_pMchLua->UnlinkRawPartFromGroup( nRawId) ;
|
||||
// assegno risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtUnlinkAllRawPartsFromGroups( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva
|
||||
if ( m_pMchLua == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// riporto tutti i grezzi linkati nel gruppo dei grezzi
|
||||
bool bOk = m_pMchLua->UnlinkAllRawPartsFromGroups() ;
|
||||
// assegno risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtWrite( lua_State* L)
|
||||
|
||||
Reference in New Issue
Block a user