From ca74fa67941f7bd4219ca3567526eba2930f5c34 Mon Sep 17 00:00:00 2001 From: Riccardo Elitropi Date: Wed, 21 Jun 2023 13:23:32 +0200 Subject: [PATCH] EgtMachKernel : - migliorie. --- Pocketing.cpp | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/Pocketing.cpp b/Pocketing.cpp index cc2795d..11d9bd7 100644 --- a/Pocketing.cpp +++ b/Pocketing.cpp @@ -3881,6 +3881,8 @@ Pocketing::AddOneWay( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, c vector vCrvOEWithFlags( nStep) ; BOOLVECTOR vbChangedPrec( nStep, false) ; + m_pGeomDB->AddGeoObj(GDB_ID_NULL, GDB_ID_ROOT, pSrfIdeal->Clone()) ; + for ( int j = 1 ; j <= nStep ; ++ j) { // controllo l'intersezione/proiezione tra la superificie e il grezzo PtrOwner pCrvOPF( CreateCurveComposite()) ; @@ -9285,11 +9287,15 @@ Pocketing::AdaptSfrWithRaw( ISurfFlatRegion* pSrf, Vector3d vtTrasl, ICRVCOMPOPO if ( m_bIntersRaw) { if ( ! IntersSurfWithRaw( pSrf, pStmRaw, vtTrasl, bChanged, 500 * EPS_SMALL, true, true)) return false ; + int g = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pSrf->Clone()) ; + m_pGeomDB->SetMaterial( g, GREEN) ; } // 2) PROIEZIONE CON GREZZO if ( m_bProjectRaw) { if ( ! ProjectRaw( pSrf, vtTrasl, pStmRaw)) return false ; + int o = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pSrf->Clone()) ; + m_pGeomDB->SetMaterial( o, ORANGE) ; } } @@ -9556,7 +9562,7 @@ Pocketing::IntersSurfWithRaw( ISurfFlatRegion* pSfrPock, const ISurfTriMesh* pSt return false ; pSrf_Pock_orig->Translate( vtTrasl) ; if ( pSrf_Pock_orig->Subtract( *pSrf_RawPartsRemoved)) { - for ( int cc_ = 0 ; cc_ < pSrf_Pock_orig->GetChunkCount(); ++ cc_) { + for ( int cc_ = 0 ; cc_ < pSrf_Pock_orig->GetChunkCount() ; ++ cc_) { // clono dil Chunk cc_ esimo PtrOwner pSrfCcc_( pSrf_Pock_orig->CloneChunk( cc_)) ; if ( IsNull( pSrfCcc_) || ! pSrfCcc_->IsValid()) @@ -9884,6 +9890,10 @@ Pocketing::OptimizeChunkOneWay( ISurfFlatRegion* pSrfOrig, ISURFFRPOVECTOR& vSrf vIndChunk.clear() ; vPtCheck.clear() ; + // Temp prop della superificie + int nProp0 ; + int nProp1 ; + // clono la superificie passata alla funzione PtrOwner pSrfToPock( CloneSurfFlatRegion( pSrfOrig)) ; if ( IsNull( pSrfToPock) || pSrfToPock->GetChunkCount() == 0) @@ -9909,6 +9919,8 @@ Pocketing::OptimizeChunkOneWay( ISurfFlatRegion* pSrfOrig, ISURFFRPOVECTOR& vSrf PtrOwner pCrvExt( GetCurveComposite( pSrfToPock->GetLoop( c, 0))) ; if ( IsNull( pCrvExt)) return false ; + nProp0 = pCrvExt->GetTempProp( 0) ; + nProp1 = pCrvExt->GetTempProp( 1) ; pSrfIdeal.Set( pSrfToPock->CloneChunk( c)) ; // inserisco curva esterna vChunksAvailable[c] = -1 ; PtSPtC newPtSPtC ; newPtSPtC.nInd = c ; pCrvExt->GetStartPoint( newPtSPtC.ptC) ; @@ -9940,11 +9952,33 @@ Pocketing::OptimizeChunkOneWay( ISurfFlatRegion* pSrfOrig, ISURFFRPOVECTOR& vSrf } } + // imposto vettore dei punti iniziali e vettore degli indici dei chunks for ( int i = 0 ; i < ( int)vNewPtStart.size() ; ++ i){ vIndChunk.emplace_back( vNewPtStart[i].nInd) ; vPtCheck.emplace_back( vNewPtStart[i].ptC) ; } + // reimposto tutte le temp prop alle curve delle nuove superifici + for ( int i = 0 ; i < ( int)vSrfIdeal.size() ; ++ i) { + PtrOwner pSrfIdeal_TmpProp( CreateSurfFlatRegion()) ; + if ( IsNull( pSrfIdeal_TmpProp)) + return false ; + for ( int c = 0 ; c < vSrfIdeal[i]->GetChunkCount() ; ++ c) { + for ( int l = 0 ; l < vSrfIdeal[i]->GetLoopCount( c) ; ++ l) { + PtrOwner pCrvCurr( vSrfIdeal[i]->GetLoop( c, l)) ; + if ( IsNull( pCrvCurr) || ! pCrvCurr->IsValid()) + return false ; + pCrvCurr->SetTempProp( nProp0, 0) ; + pCrvCurr->SetTempProp( nProp1, 1) ; + if ( l == 0) + pSrfIdeal_TmpProp->AddExtLoop( Release( pCrvCurr)) ; + else + pSrfIdeal_TmpProp->AddIntLoop( Release( pCrvCurr)) ; + } + } + vSrfIdeal[i].Set( Release( pSrfIdeal_TmpProp)) ; + } + return ( vSrfIdeal.size() != 0) ; }