diff --git a/Pocketing.cpp b/Pocketing.cpp index 6933901..28fa843 100644 --- a/Pocketing.cpp +++ b/Pocketing.cpp @@ -2330,10 +2330,9 @@ Pocketing::SliceVolume( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Pa // W.I.P // aggirno le dimensioni dei vettori da restituire in base agli step calcolati - vCrvOEWithFlags.clear() ; - vCrvOEWithFlags.resize( int( vVtTrasl.size())) ; - vbChangedPrec.clear() ; - vbChangedPrec.resize( int( vVtTrasl.size())) ; + vSrfSliced.clear() ; vSrfSliced.resize( int( vVtTrasl.size())) ; + vCrvOEWithFlags.clear() ; vCrvOEWithFlags.resize( int( vVtTrasl.size())) ; + vbChangedPrec.clear() ; vbChangedPrec.resize( int( vVtTrasl.size())) ; // per ogni step ricavato... for ( int j = 1 ; j <= int( vVtTrasl.size()) ; ++ j) { @@ -2374,7 +2373,6 @@ Pocketing::SliceVolume( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Pa if ( pSfrLimit->IsValid()) pSfrLimit->Translate( -vVtTrasl[j-1]) ; - } return true ; } @@ -2392,10 +2390,6 @@ Pocketing::GetNewSfrByAnotherPocketing( ISurfFlatRegion* pSfrPock, const ISurfFl if ( 0.5 * m_TParams.m_dDiam + GetOffsR() > 0.5 * m_dDiam_Prec + m_dOffsetR_Prec) return true ; - int o = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pStmVol->Clone()) ; - o = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pSfrPock->Clone()) ; - m_pGeomDB->SetMaterial( o, GREEN) ; - // effettuo un Offset verso l'interno ( curve esterne che percorre il centro del Tool) double dInsideOffs = - 0.5 * m_dDiam_Prec - 0.5 * m_dOffsetR_Prec - 5 * EPS_SMALL ; PtrOwner pSfrToolPath( pSfrPock->CreateOffsetSurf( dInsideOffs, ICurve::OFF_FILLET)) ; @@ -2407,33 +2401,27 @@ Pocketing::GetNewSfrByAnotherPocketing( ISurfFlatRegion* pSfrPock, const ISurfFl return true ; // effettuo un Offset del raggio del tool precedente per ricavare la regione svuotata in precedenza - double dOutSideOffset = 0.5 * m_dDiam_Prec / 2 + 20 * EPS_SMALL ; + double dOutSideOffset = 0.5 * m_dDiam_Prec + 20 * EPS_SMALL ; PtrOwner pSfrRemoved( pSfrToolPath->CreateOffsetSurf( dOutSideOffset, ICurve::OFF_FILLET)) ; if ( IsNull( pSfrRemoved)) { m_pMchMgr->SetLastError( 2412, "Error in Pocketing : Offset not computable") ; return false ; } - o = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pSfrRemoved->Clone()) ; - m_pGeomDB->SetMaterial( o, PURPLE) ; - // definisco la regione vera a propria da svuotare con il tool attuale PtrOwner pSfrAct( CloneSurfFlatRegion( pSfrNoExtendedByOpenEdges)) ; if ( IsNull( pSfrAct) || ! pSfrAct->Subtract( *pSfrRemoved)) return false ; - o = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pSfrAct->Clone()) ; - m_pGeomDB->SetMaterial( o, BLACK) ; - // Questa superficie presenterà diversi Chunks... per ognuno di essi ricavo le properità di lato aperto o chiuso // NB. Questa supericie non dovrebbe avere isole... - // Posso richiamare la funzione ChooseCloseOrOpenEdge() + // Posso richiamare la funzione ChooseCloseOrOpenEdge() tra la pSfrAct e il Volume di svuotatura // alzo leggermente la supericie per l'ultimi step pSfrAct->Translate( Z_AX * 50 * EPS_SMALL) ; if ( ! ChooseCloseOrOpenEdge( pSfrAct, pStmVol)) return false ; - pSfrAct->Translate( - Z_AX * 50 * EPS_SMALL) ; + pSfrAct->Translate( -Z_AX * 50 * EPS_SMALL) ; // Questa funzione ha modificato le TmpProp dei Loops della pSfrAct e le temp prop sono invertite ; // I lati con tmp prop = 1 sono chiusi, mentre quelli con tmpProp = 0 sono aperti @@ -2456,11 +2444,12 @@ Pocketing::GetNewSfrByAnotherPocketing( ISurfFlatRegion* pSfrPock, const ISurfFl for ( int i = 0 ; i < int( vCrvIsl.size()) ; ++ i) for ( int u = 0 ; u < vCrvIsl[i]->GetCurveCount() ; ++ u) vCrvIsl[i]->SetCurveTempProp( u, vCrvIsl[i]->GetCurve( u)->GetTempProp( 0) == 0 ? 1 : 0, 0) ; - // estendo il loop esterno presso i lati nuovi lati aperti + // estendo il loop esterno presso i nuovi lati aperti if ( ! AdjustContourWithOpenEdges( pCrvEL, vCrvIsl, m_TParams.m_dDiam, GetOffsR(), GetSideStep(), pSfrLimit)) { m_pMchMgr->SetLastError( 2430, "Error in Pocketing : adjust open edges failed") ; return false ; } + // estendo eventuali isole presso i nuovi lati aperti ICRVCOMPOPOVECTOR vCrvNULL ; for ( int i = 0 ; i < int( vCrvIsl.size()) ; ++ i) { if ( ! AdjustContourWithOpenEdges( vCrvIsl[i], vCrvNULL, m_TParams.m_dDiam, GetOffsR(), GetSideStep(), pSfrLimit)) { @@ -2468,26 +2457,6 @@ Pocketing::GetNewSfrByAnotherPocketing( ISurfFlatRegion* pSfrPock, const ISurfFl return false ; } } - - - - for ( int u = 0 ; u < pCrvEL->GetCurveCount() ; ++ u) { - int nProp0 ; pCrvEL->GetCurveTempProp( u, nProp0, 0) ; - int nProp1 ; pCrvEL->GetCurveTempProp( u, nProp1, 1) ; - int aaa = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pCrvEL->GetCurve( u)->Clone()) ; - m_pGeomDB->SetMaterial( aaa, nProp0 == 0 ? BLUE : RED) ; - } - for ( int i = 0 ; i < int( vCrvIsl.size()) ; ++ i) { - for ( int u = 0 ; u < vCrvIsl[i]->GetCurveCount() ; ++ u) { - int nProp0 ; vCrvIsl[i]->GetCurveTempProp( u, nProp0, 0) ; - int nProp1 ; vCrvIsl[i]->GetCurveTempProp( u, nProp1, 1) ; - int aaa = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, vCrvIsl[i]->GetCurve( u)->Clone()) ; - m_pGeomDB->SetMaterial( aaa, nProp0 == 0 ? BLUE : RED) ; - } - } - - - // avendo i lati aperti, devo stare attento alle entrate... per sicurezza li imposto tutti come chiusi ( per ora..) for ( int u = 0 ; u < pCrvEL->GetCurveCount() ; ++ u) pCrvEL->SetCurveTempProp( u, 0, 0) ; @@ -3530,8 +3499,8 @@ Pocketing::AddZigZag( ISURFFRPOVECTOR& vSfr, const std::vectorSubtract( *pSfrLimit)) + return false ; + // controllo se la curva è un'isola bool bIsIsland = false ; double dArea ; Plane3d plCheck ; @@ -9368,13 +9345,6 @@ Pocketing::CreateSurfFrIncidence( const ICurveComposite* pCrv, const double dRad ! pSfrInc->Subtract( *pSfrRectEnd)) return false ; - // ATTENZIONE ! - // L'algoritmo di allargamento presso i lati aperti è Euristico; io mi estendo a seconda della geometria del - // lato aperto al di fuori del volume di svuotatura... Devo controllare di non rovinare delle zone al di fuori di - // esso ! - if ( ! pSfrInc->Subtract( *pSfrLimit)) - return false ; - return pSfrInc->IsValid() && pSfrInc->GetChunkCount() > 0 ; } diff --git a/Pocketing.h b/Pocketing.h index b9f2780..51e3cf3 100644 --- a/Pocketing.h +++ b/Pocketing.h @@ -308,7 +308,7 @@ class Pocketing : public Machining bool m_bOptOffset = true ; // flag per ottimizzazione numero di Offset necessari bool m_bOptOffsetCM = false ; // flag per ottimizzazione numero di Offset necessari con centroidi e medial Axis bool m_bAssignFeed = false ; // flag per controllo della Feed - double m_dDiam_Prec = 50.0 ; // diametro utensile per precedente svuotatura + double m_dDiam_Prec = 100.0 ; // diametro utensile per precedente svuotatura double m_dOffsetR_Prec = 0.0 ; // offset radiale della svuotatura precedente double m_dSideStep_Prec = 0.0 ; // side Step della svuotatura precedente