EgtExecutor 2.1k6 :
- aggiunta gestione libreria di Nesting Automatico e relativa protezione - aggiunta funzione ExeSetLineAttribs per impostare spessore linee in grafica.
This commit is contained in:
+173
@@ -91,6 +91,170 @@ LuaVerifyMachining( lua_State* L)
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAutoNestStart( lua_State* L)
|
||||
{
|
||||
// nessu parametro
|
||||
LuaClearStack( L) ;
|
||||
// imposto inizio nuovo nesting
|
||||
bool bOk = ExeAutoNestStart() ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAutoNestAddSheet( lua_State* L)
|
||||
{
|
||||
// 4 parametri : nSheetId, nOutlineId, nPriority, nCount
|
||||
int nSheetId ;
|
||||
LuaCheckParam( L, 1, nSheetId)
|
||||
int nOutlineId ;
|
||||
LuaCheckParam( L, 2, nOutlineId)
|
||||
int nPriority ;
|
||||
LuaCheckParam( L, 3, nPriority)
|
||||
int nCount ;
|
||||
LuaCheckParam( L, 4, nCount)
|
||||
LuaClearStack( L) ;
|
||||
// aggiungo un pannello al nesting corrente
|
||||
bool bOk = ExeAutoNestAddSheet( nSheetId, nOutlineId, nPriority, nCount) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAutoNestAddPart( lua_State* L)
|
||||
{
|
||||
// 3 parametri : nPartId, nOutlineId, nCount
|
||||
int nPartId ;
|
||||
LuaCheckParam( L, 1, nPartId)
|
||||
int nOutlineId ;
|
||||
LuaCheckParam( L, 2, nOutlineId)
|
||||
int nCount ;
|
||||
LuaCheckParam( L, 3, nCount)
|
||||
LuaClearStack( L) ;
|
||||
// aggiungo un pezzo al nesting corrente
|
||||
bool bOk = ExeAutoNestAddPart( nPartId, nOutlineId, nCount) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAutoNestSetInterpartGap( lua_State* L)
|
||||
{
|
||||
// 1 parametro : dGap
|
||||
double dGap ;
|
||||
LuaCheckParam( L, 1, dGap)
|
||||
LuaClearStack( L) ;
|
||||
// imposto la distanza minima tra i pezzi al nesting corrente
|
||||
bool bOk = ExeAutoNestSetInterpartGap( dGap) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAutoNestCompute( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nMaxTime (ms)
|
||||
int nMaxTime ;
|
||||
LuaCheckParam( L, 1, nMaxTime)
|
||||
LuaClearStack( L) ;
|
||||
// lancio calcolo del nesting
|
||||
bool bOk = ExeAutoNestCompute( nMaxTime) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAutoNestGetComputationStatus( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// lancio calcolo del nesting
|
||||
int nStatus ;
|
||||
bool bOk = ExeAutoNestGetComputationStatus( nStatus) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
LuaSetParam( L, nStatus) ;
|
||||
return 2 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAutoNestPrintResults( lua_State* L)
|
||||
{
|
||||
// 1 parametro : sHtmlFile
|
||||
string sHtmlFile ;
|
||||
LuaCheckParam( L, 1, sHtmlFile)
|
||||
LuaClearStack( L) ;
|
||||
// lancio stampa soluzione corrente
|
||||
bool bOk = ExeAutoNestPrintResults( sHtmlFile) ;
|
||||
// restituisco il risultato
|
||||
LuaSetParam( L, bOk) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAutoNestGetResults( lua_State* L)
|
||||
{
|
||||
// nessun parametro
|
||||
LuaClearStack( L) ;
|
||||
// recupero il risultato della soluzione
|
||||
int nNestedParts, nTotParts, nTotSheets, nDiffSheets ; double dTotFillRatio ;
|
||||
bool bOk = ExeAutoNestGetResults( nNestedParts, nTotParts, nTotSheets, nDiffSheets, dTotFillRatio) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk) {
|
||||
LuaSetParam( L, nNestedParts) ;
|
||||
LuaSetParam( L, nTotParts) ;
|
||||
LuaSetParam( L, nTotSheets) ;
|
||||
LuaSetParam( L, nDiffSheets) ;
|
||||
LuaSetParam( L, dTotFillRatio) ;
|
||||
return 5 ;
|
||||
}
|
||||
else {
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
static int
|
||||
LuaAutoNestGetOneResult( lua_State* L)
|
||||
{
|
||||
// 1 parametro : nInd
|
||||
int nInd ;
|
||||
LuaCheckParam( L, 1, nInd)
|
||||
LuaClearStack( L) ;
|
||||
// recupero i risultati del nesting
|
||||
int nType, nId, nFlag ; double dX, dY, dAngRot ;
|
||||
bool bOk = ExeAutoNestGetOneResult( nInd, nType, nId, nFlag, dX, dY, dAngRot) ;
|
||||
// restituisco il risultato
|
||||
if ( bOk) {
|
||||
LuaSetParam( L, nType) ;
|
||||
LuaSetParam( L, nId) ;
|
||||
LuaSetParam( L, nFlag) ;
|
||||
LuaSetParam( L, dX) ;
|
||||
LuaSetParam( L, dY) ;
|
||||
LuaSetParam( L, dAngRot) ;
|
||||
return 6 ;
|
||||
}
|
||||
else {
|
||||
LuaSetParam( L) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool
|
||||
LuaInstallNesting( LuaMgr& luaMgr)
|
||||
@@ -99,6 +263,15 @@ LuaInstallNesting( LuaMgr& luaMgr)
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPackBox", LuaPackBox) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtPackBoxCluster", LuaPackBoxCluster) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtVerifyMachining", LuaVerifyMachining) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestStart", LuaAutoNestStart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestAddSheet", LuaAutoNestAddSheet) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestAddPart", LuaAutoNestAddPart) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetInterpartGap", LuaAutoNestSetInterpartGap) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestCompute", LuaAutoNestCompute) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestGetComputationStatus", LuaAutoNestGetComputationStatus) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestPrintResults", LuaAutoNestPrintResults) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestGetResults", LuaAutoNestGetResults) ;
|
||||
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestGetOneResult", LuaAutoNestGetOneResult) ;
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user