EgtExecutor 2.1l1 :

- migliorie a nesting automatico.
This commit is contained in:
Dario Sassi
2019-12-02 18:36:42 +00:00
parent d4f903c336
commit a5bdacf601
3 changed files with 52 additions and 23 deletions
+31 -10
View File
@@ -18,6 +18,8 @@
#include "EXE_Const.h"
#include "DllNesting.h"
#include "/EgtDev/Include/EGkCurve.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EGkOffsetCurve.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/ENsAutoNester.h"
#include "/EgtDev/Include/EGnStringUtils.h"
@@ -48,7 +50,7 @@ ExeAutoNestStart( void)
//-----------------------------------------------------------------------------
bool
ExeAutoNestAddSheet( int nSheetId, int nOutlineId, int nPriority, int nCount)
ExeAutoNestAddSheet( int nSheetId, int nOutlineId, double dKerf, int nPriority, int nCount)
{
if ( IsNull( s_pAutoNester))
return false ;
@@ -85,13 +87,32 @@ ExeAutoNestAddSheet( int nSheetId, int nOutlineId, int nPriority, int nCount)
Outline.Mirror( ORIG, Z_AX) ;
else
return false ;
// aggiungo il pezzo
// se richiesto kerf ( sempre nullo o positivo)
if ( dKerf > 10 * EPS_SMALL) {
// curva di contorno
PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
if ( IsNull( pCompo) || ! pCompo->FromPolyArc( Outline))
return false ;
// verifico sia CCW
double dArea ; pCompo->GetAreaXY( dArea) ;
if ( dArea < 0)
pCompo->Invert() ;
// eseguo offset
OffsetCurve OffsCrv ;
if ( ! OffsCrv.Make( pCompo, - dKerf, ICurve::OFF_FILLET))
return false ;
PtrOwner<ICurve> pOffs( OffsCrv.GetLongerCurve()) ;
// riassegno a PolyArc
if ( IsNull( pOffs) || ! pOffs->ApproxWithArcs( LIN_TOL_FINE, ANG_TOL_STD_DEG, Outline))
return false ;
}
// aggiungo il pannello
return s_pAutoNester->AddSheet( nSheetId, Outline, nPriority, nCount) ;
}
//-----------------------------------------------------------------------------
bool
ExeAutoNestAddPart( int nPartId, int nOutlineId, int nCount)
ExeAutoNestAddPart( int nPartId, int nOutlineId, bool bCanFlip, bool bCanRotate, int nPriority, int nCount)
{
if ( IsNull( s_pAutoNester))
return false ;
@@ -129,7 +150,7 @@ ExeAutoNestAddPart( int nPartId, int nOutlineId, int nCount)
else
return false ;
// aggiungo il pezzo
if ( ! s_pAutoNester->AddPart( nPartId, Outline, nCount))
if ( ! s_pAutoNester->AddPart( nPartId, Outline, bCanFlip, bCanRotate, nPriority, nCount))
return false ;
// incremento contatore pezzi
s_nTotParts += nCount ;
@@ -183,20 +204,20 @@ ExeAutoNestPrintResults( const string& sHtmlFile)
//-----------------------------------------------------------------------------
bool
ExeAutoNestGetResults( int& nNestedParts, int& nTotParts, int& nTotSheets, int& nDiffSheets, double& dTotFillRatio)
ExeAutoNestGetResults( int& nNestedParts, int& nParts, int& nSheets, int& nNestings, double& dTotFillRatio)
{
if ( IsNull( s_pAutoNester) || ! s_pAutoNester->GetResults( s_dTotFillRatio, s_vANestInfo))
return false ;
nNestedParts = 0 ;
nTotParts = s_nTotParts ;
nTotSheets = 0 ;
nDiffSheets = 0 ;
nParts = s_nTotParts ;
nSheets = 0 ;
nNestings = 0 ;
dTotFillRatio = s_dTotFillRatio ;
for ( int i = 0 ; i < int( s_vANestInfo.size()) ; ++ i) {
// se sheet
if ( s_vANestInfo[i].nType > 0) {
++ nDiffSheets ;
nTotSheets += s_vANestInfo[i].nType ;
++ nNestings ;
nSheets += s_vANestInfo[i].nType ;
nNestedParts += s_vANestInfo[i].nFlag * s_vANestInfo[i].nType ;
}
}