From a5bdacf601aa0827a08fd5e78e0beadbc174d821 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Mon, 2 Dec 2019 18:36:42 +0000 Subject: [PATCH] EgtExecutor 2.1l1 : - migliorie a nesting automatico. --- EXE_NstAutoNesting.cpp | 41 +++++++++++++++++++++++++++++++---------- EgtExecutor.rc | Bin 16184 -> 16184 bytes LUA_Nesting.cpp | 34 +++++++++++++++++++++------------- 3 files changed, 52 insertions(+), 23 deletions(-) diff --git a/EXE_NstAutoNesting.cpp b/EXE_NstAutoNesting.cpp index 41ba106..3a9ab4c 100644 --- a/EXE_NstAutoNesting.cpp +++ b/EXE_NstAutoNesting.cpp @@ -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 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 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 ; } } diff --git a/EgtExecutor.rc b/EgtExecutor.rc index d264ac85ae03d3d0bc2ccef310977b46b9c6ccda..2133dba47548d7edcbb19d3f9ff203ee2a60494e 100644 GIT binary patch delta 129 zcmdl{x1(;u4>ndK1|0^&%@@V4Gflq2nZuYfIZ;G%asj8<<^rw?7O3n&xywwG4+tX5 k8YsCjZeAp;#SAyVnHfd1ALHgp(s1d6a`wp521*>V0FYxQA^-pY delta 121 zcmdl{x1(;u4>ndq1|0^o%@@V4Gflq2nZumTU^Y3BTX%B-R|N}H?x5UdrpX5c5po7f iZj75332QOKH9IpSY4l^