EgtExecutor :

- aggiunta funzione lua EgtGetCalcAnglesEx per calcolo assi rotanti in centri di lavoro con più di due assi
- funzione lua EgtVerifyOutstroke estesa per accettare fino a 4 assi rotanti.
This commit is contained in:
Dario Sassi
2026-03-25 16:48:10 +01:00
parent 4a34b2e45d
commit 1141af30d7
2 changed files with 51 additions and 8 deletions
+10
View File
@@ -3647,6 +3647,16 @@ ExeVerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB,
return pMachMgr->VerifyOutstroke( dX, dY, dZ, dAngA, dAngB, nStat) ;
}
//-----------------------------------------------------------------------------
bool
ExeVerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat)
{
IMachMgr* pMachMgr = GetCurrMachMgr() ;
VERIFY_MACHMGR( pMachMgr, false)
// verifica l'extracorsa degli assi
return pMachMgr->VerifyOutstroke( dX, dY, dZ, vAng, true, nStat) ;
}
//-----------------------------------------------------------------------------
bool
ExeGetOutstrokeInfo( string& sInfo)
+41 -8
View File
@@ -3832,11 +3832,38 @@ LuaGetCalcAngles( lua_State* L)
}
}
//-------------------------------------------------------------------------------
static int
LuaGetCalcAnglesEx( lua_State* L)
{
// 1 o 2 parametri : vtDirT, vtDirA
Vector3d vtDirT ;
LuaCheckParam( L, 1, vtDirT)
Vector3d vtDirA ;
LuaGetParam( L, 2, vtDirA) ;
LuaClearStack( L) ;
// calcolo gli angoli macchina dalle direzioni fresa e ausiliaria
int nStat ; DBLVECTOR vAng1, vAng2 ;
bool bOk = ExeGetCalcAngles( vtDirT, vtDirA, nStat, vAng1, vAng2) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, bOk) ;
LuaSetParam( L, nStat) ;
LuaSetParam( L, vAng1) ;
LuaSetParam( L, vAng2) ;
return 4 ;
}
else {
LuaSetParam( L, bOk) ;
return 1 ;
}
}
//-------------------------------------------------------------------------------
static int
LuaGetCalcPositions( lua_State* L)
{
// da 2 a 5 parametri : ptP, dAngA [, dAngB] [, dAngC] [, dAngD]
// da 1 a 5 parametri : ptP [, dAngR1] [, dAngR2] [, dAngR3] [, dAngR4]
Point3d ptP ;
LuaCheckParam( L, 1, ptP)
DBLVECTOR vAng ;
@@ -3854,7 +3881,7 @@ LuaGetCalcPositions( lua_State* L)
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, bOk) ;
LuaSetParam( L, 0) ; // assegnato per compatibilit
LuaSetParam( L, 0) ; // assegnato per compatibilità
LuaSetParam( L, dX) ;
LuaSetParam( L, dY) ;
LuaSetParam( L, dZ) ;
@@ -3982,21 +4009,26 @@ LuaGetCalcAuxDirFromAngles( lua_State* L)
static int
LuaVerifyOutstroke( lua_State* L)
{
// 5 parametri : dX, dY, dZ, dAngA, dAngB
// 3 o 4 o 5 o 6 o 7 parametri : dX, dY, dZ [, dAngR1] [, dAngR2] [, dAngR3] [, dAngR4]
double dX ;
LuaCheckParam( L, 1, dX)
double dY ;
LuaCheckParam( L, 2, dY)
double dZ ;
LuaCheckParam( L, 3, dZ)
double dAngA ;
LuaCheckParam( L, 4, dAngA)
double dAngB ;
LuaCheckParam( L, 5, dAngB)
DBLVECTOR vAng ;
int i ;
for ( i = 4 ; i <= 7 ; ++ i) {
double dAng ;
if ( LuaGetParam( L, i, dAng))
vAng.emplace_back( dAng) ;
else
break ;
}
LuaClearStack( L) ;
// imposto la tavola corrente per il calcolo
int nStat ;
bool bOk = ExeVerifyOutstroke( dX, dY, dZ, dAngA, dAngB, nStat) ;
bool bOk = ExeVerifyOutstroke( dX, dY, dZ, vAng, nStat) ;
// restituisco il risultato
if ( bOk) {
LuaSetParam( L, ( nStat == 0)) ;
@@ -4754,6 +4786,7 @@ LuaInstallMachMgr( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtGetAllCurrAxesNames", LuaGetAllCurrAxesNames) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRotAxisBlocked", LuaGetRotAxisBlocked) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcAngles", LuaGetCalcAngles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcAnglesEx", LuaGetCalcAnglesEx) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcPositions", LuaGetCalcPositions) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetRobotAngles", LuaGetRobotAngles) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetCalcTipFromPositions", LuaGetCalcTipFromPositions) ;