EgtExecutor :

- aggiunta funzione Exe/Lua AddAnotherOutlineToPart
- in ExeAutomaticPac aggiunta gestione di pezzi con tagli inclinati.
This commit is contained in:
Dario Sassi
2019-12-05 09:34:54 +00:00
parent e217258589
commit d1dc8f87e3
3 changed files with 56 additions and 10 deletions
+16
View File
@@ -137,6 +137,22 @@ ExeAutoNestAddPart( int nPartId, int nOutlineId, bool bCanFlip, bool bCanRotate,
return true ;
}
//-----------------------------------------------------------------------------
bool
ExeAddAnotherOutlineToPart( int nPartId, int nAnotherOutlineId)
{
if ( IsNull( s_pAutoNester))
return false ;
IGeomDB* pGeomDB = GetCurrGeomDB() ;
VERIFY_GEOMDB( pGeomDB, false)
// recupero un contorno aggiuntivo del pezzo
PolyArc AnotherOutline ;
if ( ! MyGetOutline( pGeomDB, nAnotherOutlineId, AnotherOutline))
return false ;
// aggiungo un contorno aggiuntivo al pezzo
return s_pAutoNester->AddAnotherOutlineToPart( nPartId, AnotherOutline) ;
}
//-----------------------------------------------------------------------------
bool
ExeAutoNestAddToolOutlineToPart( int nPartId, int nToolOutlineId)
+23 -10
View File
@@ -2109,12 +2109,18 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
// recupero regione del pezzo
int nRegId = GetFlatPartRegion( pGeomDB, nId) ;
ExeAutoNestAddDefectToSheet( nSheetId, nRegId) ;
// recupero eventuale regione in basso del pezzo
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nId) ;
if ( nDwnRegId != GDB_ID_NULL)
ExeAutoNestAddDefectToSheet( nSheetId, nDwnRegId) ;
// recupero regioni dei tagli del pezzo
INTVECTOR vCutReg ;
if ( GetFlatPartCutRegions( pGeomDB, nId, bReducedCut, vCutReg)) {
for ( int nRegId : vCutReg)
ExeAutoNestAddDefectToSheet( nSheetId, nRegId) ;
}
if ( ! GetFlatPartCutRegions( pGeomDB, nId, bReducedCut, vCutReg))
return false ;
// recupero eventuali regioni in basso dei tagli del pezzo
GetFlatPartDownCutRegions( pGeomDB, nId, bReducedCut, vCutReg) ;
for ( int nRegId : vCutReg)
ExeAutoNestAddDefectToSheet( nSheetId, nRegId) ;
}
}
nId = ( bInRoot ? ExeGetNextPart( nId, true) : ExeGetNextGroup( nId)) ;
@@ -2123,16 +2129,23 @@ ExeAutomaticPackParts( INTVECTOR& vIds, bool bMinimizeOnXvsY, bool bReducedCut,
// Assegno i pezzi da nestare
for ( int nPartId : vIds) {
nPartId = abs( nPartId) ;
// recupero regione del pezzo e flag rotazione abilitata
int nRegId = GetFlatPartRegion( pGeomDB, nPartId) ;
// flag rotazione
bool bEnableRot = ! pGeomDB->ExistsInfo( nPartId, NST_PART_ROT) ;
// recupero regione del pezzo
int nRegId = GetFlatPartRegion( pGeomDB, nPartId) ;
ExeAutoNestAddPart( nPartId, nRegId, false, bEnableRot, 0.0, 0, 1) ;
// recupero eventuale regione in basso del pezzo
int nDwnRegId = GetFlatPartDownRegion( pGeomDB, nPartId) ;
if ( nDwnRegId != GDB_ID_NULL)
ExeAddAnotherOutlineToPart( nPartId, nDwnRegId) ;
// recupero regioni dei tagli del pezzo
INTVECTOR vCutReg ;
if ( GetFlatPartCutRegions( pGeomDB, nPartId, bReducedCut, vCutReg)) {
for ( int nRegId : vCutReg)
ExeAutoNestAddToolOutlineToPart( nPartId, nRegId) ;
}
if ( ! GetFlatPartCutRegions( pGeomDB, nPartId, bReducedCut, vCutReg))
return false ;
// recupero eventuali regioni in basso dei tagli del pezzo
GetFlatPartDownCutRegions( pGeomDB, nPartId, bReducedCut, vCutReg) ;
for ( int nRegId : vCutReg)
ExeAutoNestAddToolOutlineToPart( nPartId, nRegId) ;
}
// Eseguo il nesting
+17
View File
@@ -171,6 +171,22 @@ LuaAutoNestAddPart( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaAutoNestAddAnotherOutlineToPart( lua_State* L)
{
// 2 parametri : nPartId, nAnotherOutlineId
int nPartId ;
LuaCheckParam( L, 1, nPartId)
int nAnotherOutlineId ;
LuaCheckParam( L, 2, nAnotherOutlineId)
// aggiungo un contorno aggiuntivo al pezzo indicato
bool bOk = ExeAddAnotherOutlineToPart( nPartId, nAnotherOutlineId) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaAutoNestAddToolOutlineToPart( lua_State* L)
@@ -325,6 +341,7 @@ LuaInstallNesting( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestAddDefectToSheet", LuaAutoNestAddDefectToSheet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestAddSheet", LuaAutoNestAddSheet) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestAddPart", LuaAutoNestAddPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestAddAnotherOutlineToPart", LuaAutoNestAddAnotherOutlineToPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestAddToolOutlineToPart", LuaAutoNestAddToolOutlineToPart) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestSetInterpartGap", LuaAutoNestSetInterpartGap) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtAutoNestCompute", LuaAutoNestCompute) ;