Merge commit '1badb47d71f9451753f128e12492750ceed3203a' into Sgrossature
This commit is contained in:
+2
-2
@@ -4261,7 +4261,7 @@ Milling::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
|
||||
if ( m_bAggrBottom) {
|
||||
// distanza dal bordo del pezzo (se negativa il punto è fuori dal grezzo)
|
||||
double dDistBottom ;
|
||||
if ( ! GetDistanceFromRawSide( m_nPhase, ptP, m_vtAggrBottom, dDistBottom))
|
||||
if ( ! GetAggrBottDistanceFromRawSide( m_nPhase, ptP, m_vtAggrBottom, ( m_AggrBottom.dEncH + dSafeZ), dDistBottom))
|
||||
dDistBottom = 0 ;
|
||||
bBottomStart = ( dDistBottom < - 10 * EPS_SMALL) ;
|
||||
// aggiuntivo in Z
|
||||
@@ -4477,7 +4477,7 @@ Milling::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
|
||||
double dDistBottom ;
|
||||
if ( m_bAggrBottom) {
|
||||
// distanza dal bordo del pezzo (se negativa il punto è fuori dal grezzo)
|
||||
if ( ! GetDistanceFromRawSide( m_nPhase, ptP, m_vtAggrBottom, dDistBottom))
|
||||
if ( ! GetAggrBottDistanceFromRawSide( m_nPhase, ptP, m_vtAggrBottom, ( m_AggrBottom.dEncH + dSafeZ), dDistBottom))
|
||||
dDistBottom = 0 ;
|
||||
bBottomOutStart = ( dDistBottom < - 10 * EPS_SMALL) ;
|
||||
}
|
||||
|
||||
+21
-5
@@ -671,16 +671,16 @@ Operation::GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3
|
||||
const ICurve* pCurve = GetCurve( m_pGeomDB->GetGeoObj( nOutCrvId)) ;
|
||||
if ( pCurve != nullptr) {
|
||||
int nSide ;
|
||||
double dDist ;
|
||||
double dCurrDist ;
|
||||
DistPointCurve distPC( ptPL, *pCurve) ;
|
||||
if ( distPC.GetDist( dDist)) {
|
||||
if ( dDist < 100 * EPS_SMALL ||
|
||||
if ( distPC.GetDist( dCurrDist)) {
|
||||
if ( dCurrDist < 100 * EPS_SMALL ||
|
||||
(distPC.GetSideAtMinDistPoint( 0, Z_AX, nSide) && nSide != MDS_RIGHT)) {
|
||||
nRawId = nCurrRawId ;
|
||||
break ;
|
||||
}
|
||||
else if ( dDist < dMinDist) {
|
||||
dMinDist = dDist ;
|
||||
else if ( dCurrDist < dMinDist) {
|
||||
dMinDist = dCurrDist ;
|
||||
nRawId = nCurrRawId ;
|
||||
}
|
||||
}
|
||||
@@ -726,6 +726,22 @@ Operation::GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetAggrBottDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double dEncSafeH, double& dDist) const
|
||||
{
|
||||
double dDistB1, dDistB2, dDistB3 ;
|
||||
Vector3d vtOffs = dEncSafeH * GetRotate( vtDir, Z_AX, 90) ;
|
||||
if ( ! GetDistanceFromRawSide( m_nPhase, ptP, vtDir, dDistB1))
|
||||
dDistB1 = 0 ;
|
||||
if ( ! GetDistanceFromRawSide( m_nPhase, ptP + vtOffs, vtDir, dDistB2))
|
||||
dDistB2 = 0 ;
|
||||
if ( ! GetDistanceFromRawSide( m_nPhase, ptP - vtOffs, vtDir, dDistB3))
|
||||
dDistB3 = 0 ;
|
||||
dDist = max( { dDistB1, dDistB2, dDistB3}) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand,
|
||||
|
||||
@@ -140,6 +140,7 @@ class Operation : public IUserObj
|
||||
bool GetUhPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
|
||||
double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist) const ;
|
||||
bool GetAggrBottDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double dEncSafeH, double& dDist) const ;
|
||||
bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand,
|
||||
double& dDist, Vector3d& vtDir) const ;
|
||||
bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand,
|
||||
|
||||
+2
-2
@@ -5054,7 +5054,7 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe
|
||||
if ( m_bAggrBottom) {
|
||||
// distanza dal bordo del pezzo (se negativa il punto è fuori dal grezzo)
|
||||
double dDistBottom ;
|
||||
if ( ! GetDistanceFromRawSide( m_nPhase, ptP, m_vtAggrBottom, dDistBottom))
|
||||
if ( ! GetAggrBottDistanceFromRawSide( m_nPhase, ptP, m_vtAggrBottom, ( m_AggrBottom.dEncH + dSafeZ), dDistBottom))
|
||||
dDistBottom = 0 ;
|
||||
bBottomOutStart = ( dDistBottom < - 10 * EPS_SMALL) ;
|
||||
// aggiuntivo in Z
|
||||
@@ -5177,7 +5177,7 @@ Pocketing::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ
|
||||
double dDistBottom ;
|
||||
if ( m_bAggrBottom) {
|
||||
// distanza dal bordo del pezzo
|
||||
if ( ! GetDistanceFromRawSide( m_nPhase, ptP, m_vtAggrBottom, dDistBottom))
|
||||
if ( ! GetAggrBottDistanceFromRawSide( m_nPhase, ptP, m_vtAggrBottom, ( m_AggrBottom.dEncH + dSafeZ), dDistBottom))
|
||||
dDistBottom = 0 ;
|
||||
bBottomOutStart = ( dDistBottom < - 10 * EPS_SMALL) ;
|
||||
}
|
||||
|
||||
+59
-75
@@ -1345,9 +1345,8 @@ SurfRoughing::ProcessPath( int nPathId, int nTempId, int nPvId, int nClId)
|
||||
}
|
||||
|
||||
// recupero il grezzo
|
||||
PtrOwner<ISurfTriMesh> pStmRaw( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pStmRaw) ||
|
||||
! GetRaw( pStmRaw)) {
|
||||
PtrOwner<ISurfTriMesh> pStmRaw( GetRaw()) ;
|
||||
if ( IsNull( pStmRaw)) {
|
||||
m_pMchMgr->SetLastError( 3025, "Error in SurfRoughing : RawPart not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1390,42 +1389,43 @@ SurfRoughing::ProcessPath( int nPathId, int nTempId, int nPvId, int nClId)
|
||||
|
||||
// definisco una struttura per i parametri utili sugli step
|
||||
struct myStepInfo {
|
||||
myStepInfo( void)
|
||||
: nInd( -1), nIndRef( -1), dDepth( 0), bSubStep( false), pSfrRemoved( nullptr) {}
|
||||
myStepInfo( int nI, int nIR, double dD, bool bSS, ISurfFlatRegion* pSR)
|
||||
: nInd( nI), nIndRef( nIR), dDepth( dD), bSubStep( bSS), pSfrRemoved( pSR) {}
|
||||
~myStepInfo() {
|
||||
if ( pSfrRemoved != nullptr)
|
||||
delete( pSfrRemoved) ;
|
||||
delete( pSfrRemoved) ;
|
||||
}
|
||||
double dDepth = 0. ; // profondità posizione piano di svuotatura ( in negativo)
|
||||
bool bSubStep = false ; // flag per indicare se lo Step è base o intermedio
|
||||
ISurfFlatRegion* pSfrRemoved = nullptr ; // regione PROGRESSIVA rimossa attuale
|
||||
int nIdRef = -1 ; // ( usato solo per step intermedi ) indice step precedente
|
||||
int nInd ; // indice step (0-based)
|
||||
int nIndRef ; // ( usato solo per step intermedi ) indice step precedente
|
||||
double dDepth ; // profondità posizione piano di svuotatura ( in negativo)
|
||||
bool bSubStep ; // flag per indicare se lo Step è base o intermedio
|
||||
ISurfFlatRegion* pSfrRemoved ; // regione PROGRESSIVA rimossa attuale
|
||||
} ;
|
||||
vector<pair<int, myStepInfo>> vStepInfo ; // ( indice step, myStepInfo )
|
||||
vector< myStepInfo> vStepInfo ;
|
||||
|
||||
// inserisco prima gli step...
|
||||
for ( int i = 0 ; i < nStep ; ++ i) {
|
||||
myStepInfo currInfo ;
|
||||
currInfo.dDepth = - ( i + 1) * dStep ;
|
||||
currInfo.bSubStep = false ;
|
||||
vStepInfo.emplace_back( make_pair( i, currInfo)) ;
|
||||
vStepInfo.emplace_back( i, -1, - ( i + 1) * dStep, false, nullptr) ;
|
||||
}
|
||||
// ... e poi gli step intermedi ( se presenti e non coincidenti con gli Step base)
|
||||
int nIndRef = 0 ; // ( step base sottostante allo step intermedio corrente )
|
||||
// creo un vettore di step intermedi presenti tra lo step base ( nIndRef-1)-esimo e nIndRef-esimo
|
||||
// ( NB. Il primo intervallo sta tra -1 e 0, in quanto lo Step base a filo del grezzo non è presente)
|
||||
vector<pair<int, myStepInfo>> vStepInfo_tmp ; // temporaneo ( vanno ordinati )
|
||||
vector< myStepInfo> vStepInfo_tmp ; // temporaneo ( vanno ordinati )
|
||||
for ( int i = 0 ; i <= nSubStep ; ++ i) {
|
||||
// se SubStep coincidente con lo step, passo al successivo
|
||||
if ( abs( ( - ( i + 1) * dSubStep) - vStepInfo[nIndRef].second.dDepth) < 10 * EPS_SMALL)
|
||||
if ( abs( ( - ( i + 1) * dSubStep) - vStepInfo[nIndRef].dDepth) < 10 * EPS_SMALL)
|
||||
continue ;
|
||||
// se SubStep più profondo dello Step base di riferimento...
|
||||
if ( ( - ( i + 1) * dSubStep) - vStepInfo[nIndRef].second.dDepth < EPS_SMALL) {
|
||||
if ( ( - ( i + 1) * dSubStep) - vStepInfo[nIndRef].dDepth < EPS_SMALL) {
|
||||
++ nIndRef ; // il riferimento è lo step base successivo
|
||||
// scorro gli step intermedi temporanei trovati al contrario
|
||||
for ( auto it = vStepInfo_tmp.rbegin() ; it != vStepInfo_tmp.rend() ; ++ it) {
|
||||
// se lo step intermedio non è il precedente allo step base di riferimento
|
||||
if ( it != vStepInfo_tmp.rbegin()) {
|
||||
auto it_prec = it ;
|
||||
( it->second).nIdRef = ( -- it_prec)->first ; // il riferimento è lo step intermedio precedente
|
||||
it->nIndRef = ( -- it_prec)->nInd ; // il riferimento è lo step intermedio precedente
|
||||
// ( NB. tutti gli step intermedi hanno in origine associato lo step base sottostante come step di
|
||||
// riferimento... ad eccezione del primo, i successivi in salita avranno lo step intermedio
|
||||
// precedente come riferimento
|
||||
@@ -1435,11 +1435,7 @@ SurfRoughing::ProcessPath( int nPathId, int nTempId, int nPvId, int nClId)
|
||||
vStepInfo_tmp.clear() ; // pulisco
|
||||
}
|
||||
// aggiunta dello step intermedio al vettore temporaneo
|
||||
myStepInfo currInfo ;
|
||||
currInfo.dDepth = - ( i + 1) * dSubStep ;
|
||||
currInfo.bSubStep = true ;
|
||||
currInfo.nIdRef = nIndRef ;
|
||||
vStepInfo_tmp.emplace_back( make_pair( nStep + i, currInfo)) ;
|
||||
vStepInfo_tmp.emplace_back( nStep + i, nIndRef, - ( i + 1) * dSubStep, true, nullptr) ;
|
||||
}
|
||||
|
||||
// creo la regione piana di confronto
|
||||
@@ -1455,14 +1451,13 @@ SurfRoughing::ProcessPath( int nPathId, int nTempId, int nPvId, int nClId)
|
||||
m_pMchMgr->SetLastError( 3024, "Error in SurfRoughing : region not computable") ;
|
||||
return false ;
|
||||
}
|
||||
pSfr->Translate( ( it->second).dDepth * vtTool) ;
|
||||
pSfr->Translate( it->dDepth * vtTool) ;
|
||||
|
||||
/* ******************** Regione adattata al grezzo ******************** */
|
||||
// questa regione bisogna ridurla basandosi sulla geometria del grezzo, in modo da non lavorare
|
||||
// parti in eccesso ; taglio il grezzo sul piano corrente e interseco con questa regione
|
||||
PtrOwner<ISurfFlatRegion> pSfrRaw( CreateSurfFlatRegion()) ;
|
||||
if ( IsNull( pSfrRaw) ||
|
||||
! GetSfrByStmIntersection( IPPStm, ( it->second).dDepth, pSfrRaw)) {
|
||||
PtrOwner<ISurfFlatRegion> pSfrRaw( GetSfrByStmIntersection( IPPStm, it->dDepth, 0)) ;
|
||||
if ( IsNull( pSfrRaw)) {
|
||||
m_pMchMgr->SetLastError( 3027, "Error in SurfRoughing : Slicing Raw failed") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1475,7 +1470,7 @@ SurfRoughing::ProcessPath( int nPathId, int nTempId, int nPvId, int nClId)
|
||||
/* *************************** Silhouette **************************** */
|
||||
// determino la regione da non lavorare e la sottraggo
|
||||
POLYLINEVECTOR vPL ;
|
||||
if ( ! pCavParSilh->GetSilhouette( ( it->second).dDepth - GetOffsL(), vPL)) {
|
||||
if ( ! pCavParSilh->GetSilhouette( it->dDepth - GetOffsL(), vPL)) {
|
||||
m_pMchMgr->SetLastError( 3024, "Error in SurfRoughing : region not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1484,12 +1479,11 @@ SurfRoughing::ProcessPath( int nPathId, int nTempId, int nPvId, int nClId)
|
||||
SurfFlatRegionByContours SfrMaker ;
|
||||
for ( auto& PL : vPL) {
|
||||
// recupero la curva dalla silhouette
|
||||
PolyArc PA ;
|
||||
PtrOwner<ICurveComposite> pSilCrv( CreateCurveComposite()) ;
|
||||
if ( IsNull( pSilCrv))
|
||||
return false ;
|
||||
pSilCrv->FromPolyLine( PL) ;
|
||||
if ( ! SfrMaker.AddCurve( pSilCrv->Clone())) {
|
||||
if ( ! SfrMaker.AddCurve( Release( pSilCrv))) {
|
||||
m_pMchMgr->SetLastError( 3024, "Error in SurfRoughing : region not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -1503,7 +1497,8 @@ SurfRoughing::ProcessPath( int nPathId, int nTempId, int nPvId, int nClId)
|
||||
continue ; // passo allo step successivo ( la silhouette coincide con il grezzo )
|
||||
|
||||
// salvo la superficie rimossa
|
||||
( it->second).pSfrRemoved = pSfr->Clone() ;
|
||||
delete ( it->pSfrRemoved) ;
|
||||
it->pSfrRemoved = pSfr->Clone() ;
|
||||
|
||||
// inizializzo Regione piana per gestione lati aperti
|
||||
PtrOwner<ISurfFlatRegion> pSfrOpenClose( CloneSurfFlatRegion( pSfrRaw)) ;
|
||||
@@ -1511,18 +1506,18 @@ SurfRoughing::ProcessPath( int nPathId, int nTempId, int nPvId, int nClId)
|
||||
return false ;
|
||||
|
||||
/* *************************** Gestione SubSteps **************************** */
|
||||
if ( ( it->second).bSubStep) {
|
||||
if ( it->bSubStep) {
|
||||
// recupero l'indice nel vettore dello step di riferimento
|
||||
int nIndRef = 0 ;
|
||||
for ( auto j = vStepInfo.begin() ; j != vStepInfo.end() ; ++ j) {
|
||||
if ( j->first == ( it->second).nIdRef)
|
||||
if ( j->nInd == it->nIndRef)
|
||||
break ;
|
||||
++ nIndRef ;
|
||||
}
|
||||
// piccolo Offset di correzione per booleane SurfFlatRegion
|
||||
double dOffsCor = 25. * EPS_SMALL ;
|
||||
// recupero la superficie progressiva dello step di riferimento
|
||||
auto& pSfrRef = vStepInfo[nIndRef].second.pSfrRemoved ;
|
||||
const auto& pSfrRef = vStepInfo[nIndRef].pSfrRemoved ;
|
||||
if ( pSfrRef != nullptr && pSfrRef->IsValid()) { // se valida
|
||||
pSfrRef->Offset( dOffsCor, ICurve::OFF_FILLET) ; // correzione
|
||||
pSfr->Subtract( *pSfrRef) ; // sottraggo la regione svuotata in precedenza
|
||||
@@ -1535,7 +1530,7 @@ SurfRoughing::ProcessPath( int nPathId, int nTempId, int nPvId, int nClId)
|
||||
if ( pSfr->IsValid() && pSfr->GetChunkCount() > 0) {
|
||||
|
||||
// se si tratta di un SottoStep, rimuovo tutti i chunk troppo snelli
|
||||
if ( ( it->second).bSubStep) {
|
||||
if ( it->bSubStep) {
|
||||
if ( ! RemoveChunksUnderTolerance( pSfr)) {
|
||||
m_pMchMgr->SetLastError( 3029, "Error in SurfRoughing : Simplify Chunks for SubSteps failed") ;
|
||||
return false ;
|
||||
@@ -1552,7 +1547,7 @@ SurfRoughing::ProcessPath( int nPathId, int nTempId, int nPvId, int nClId)
|
||||
}
|
||||
|
||||
// se si tratta di un SottoStep, chiudo tutti i lati aperti troppo corti
|
||||
if ( ( it->second).bSubStep) {
|
||||
if ( it->bSubStep) {
|
||||
if ( ! CloseOpenEdgesUnderTolerance( pSfr, m_TParams.m_dDiam - 200 * EPS_SMALL)) {
|
||||
m_pMchMgr->SetLastError( 3029, "Error in SurfRoughing : Simplify Chunks for SubSteps failed") ;
|
||||
return false ;
|
||||
@@ -1561,10 +1556,10 @@ SurfRoughing::ProcessPath( int nPathId, int nTempId, int nPvId, int nClId)
|
||||
|
||||
// salvo nella temp Prop della FlatRegion se si tratta di uno step base o intermedio
|
||||
// Step Base -> 0 | Step intermedio -> 1
|
||||
pSfr->SetTempProp( ( it->second).bSubStep ? 1 : 0, 0) ;
|
||||
pSfr->SetTempProp( it->bSubStep ? 1 : 0, 0) ;
|
||||
|
||||
// salvo nel temp Param della FlatRegion la sua Depth di traslazione
|
||||
pSfr->SetTempParam( ( it->second).dDepth, 0) ;
|
||||
pSfr->SetTempParam( it->dDepth, 0) ;
|
||||
|
||||
// la salvo nel gruppo temporaneo
|
||||
int nNew_SfrPock_Id = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nTempId, Release( pSfr)) ;
|
||||
@@ -1613,13 +1608,17 @@ SurfRoughing::ProcessPath( int nPathId, int nTempId, int nPvId, int nClId)
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SurfRoughing::GetRaw( ISurfTriMesh* pStmRaw) const
|
||||
ISurfTriMesh*
|
||||
SurfRoughing::GetRaw( void) const
|
||||
{
|
||||
// controllo MachManager e database geometrico
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return nullptr ;
|
||||
|
||||
// controllo parametri, MachManager e database geometrico
|
||||
if ( pStmRaw == nullptr || m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// creo Stm del grezzo
|
||||
PtrOwner<ISurfTriMesh> pStmRaw( CreateSurfTriMesh()) ;
|
||||
if ( IsNull( pStmRaw))
|
||||
return nullptr ;
|
||||
pStmRaw->AdjustTopology() ;
|
||||
|
||||
// Id prima RawPart
|
||||
@@ -1631,50 +1630,39 @@ SurfRoughing::GetRaw( ISurfTriMesh* pStmRaw) const
|
||||
// recupero l'oggetto dal database con tale Id
|
||||
int nRawSolidId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
|
||||
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( nRawSolidId) ;
|
||||
if ( pGObj == nullptr)
|
||||
return nullptr ;
|
||||
// recupero il frame in cui si trova
|
||||
Frame3d frRaw ;
|
||||
m_pGeomDB->GetGlobFrame( nRawSolidId, frRaw) ;
|
||||
if ( pGObj == nullptr)
|
||||
return false ;
|
||||
// controllo che sia una Trimesh
|
||||
if ( pGObj->GetType() == SRF_TRIMESH) {
|
||||
// Trimesh della parte p-esima
|
||||
PtrOwner<ISurfTriMesh> pStmRawPart( CloneSurfTriMesh( pGObj)) ;
|
||||
if ( IsNull( pStmRawPart))
|
||||
return false ;
|
||||
// porto la trimesh in globale
|
||||
pStmRawPart->LocToLoc( frRaw, GLOB_FRM) ;
|
||||
SurfLocal StmRawPart( GetSurfTriMesh( pGObj), frRaw, GLOB_FRM) ;
|
||||
// lo aggiungo alla Trimesh complessiva
|
||||
pStmRaw->Add( *pStmRawPart) ;
|
||||
pStmRaw->Add( *GetSurfTriMesh( StmRawPart)) ;
|
||||
}
|
||||
}
|
||||
// passo al grezzo successivo
|
||||
nRawId = m_pMchMgr->GetNextRawPart( nRawId) ;
|
||||
}
|
||||
|
||||
return ( pStmRaw->IsValid() && pStmRaw->GetTriangleCount() > 0) ;
|
||||
return ( ( pStmRaw->IsValid() && pStmRaw->GetTriangleCount() > 0) ? Release( pStmRaw) : nullptr) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SurfRoughing::GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, ISurfFlatRegion* pSfrInt,
|
||||
double dSmallOffs) const
|
||||
ISurfFlatRegion*
|
||||
SurfRoughing::GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, double dSmallOffs) const
|
||||
{
|
||||
// controllo dei parametri
|
||||
if ( pSfrInt == nullptr)
|
||||
return false ;
|
||||
pSfrInt->Clear() ;
|
||||
|
||||
// interseco la superficie alla quota corrente
|
||||
PNTVECTOR vPnt ;
|
||||
BIPNTVECTOR vBpt ;
|
||||
TRIA3DVECTOR vTria ;
|
||||
if ( ! IPPStm.GetInters( dDist, vPnt, vBpt, vTria))
|
||||
return false ;
|
||||
return nullptr ;
|
||||
|
||||
// se non c'è intersezione
|
||||
if ( vBpt.empty())
|
||||
return true ;
|
||||
return CreateSurfFlatRegion() ;
|
||||
|
||||
// definisco la tolleranza per i concatenamenti
|
||||
double dToler = EPS_SMALL ;
|
||||
@@ -1689,7 +1677,7 @@ SurfRoughing::GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, doub
|
||||
Vector3d vtDir = vBpt[i].second - vBpt[i].first ;
|
||||
vtDir.Normalize() ;
|
||||
if ( ! chainC.AddCurve( i + 1, vBpt[i].first, vtDir, vBpt[i].second, vtDir))
|
||||
return false ;
|
||||
return nullptr ;
|
||||
}
|
||||
// recupero i percorsi concatenati
|
||||
Point3d ptNear = ( vBpt.empty() ? ORIG : vBpt[0].first) ;
|
||||
@@ -1698,14 +1686,14 @@ SurfRoughing::GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, doub
|
||||
// creo una curva composita
|
||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||
if ( IsNull( pCrvCompo))
|
||||
return false ;
|
||||
return nullptr ;
|
||||
// recupero gli estremi dei segmenti, creo le linee e le inserisco nella composita
|
||||
bool bAdded = true ;
|
||||
for ( int i = 0 ; i < int( vId.size()) ; ++ i) {
|
||||
// creo un segmento di retta
|
||||
PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
|
||||
if ( IsNull( pLine))
|
||||
return false ;
|
||||
return nullptr ;
|
||||
// recupero gli estremi ( non vanno mai invertiti per opzione di concatenamento)
|
||||
int nInd = abs( vId[i]) - 1 ;
|
||||
Point3d ptStart = ( bAdded ? vBpt[nInd].first : ptNear) ;
|
||||
@@ -1738,10 +1726,7 @@ SurfRoughing::GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, doub
|
||||
|
||||
// recupero la regione da restituire
|
||||
PtrOwner<ISurfFlatRegion> pSfrFromCrvs( SfrByC.GetSurf()) ;
|
||||
if ( IsNull( pSfrFromCrvs) || ! pSfrFromCrvs->IsValid())
|
||||
return false ;
|
||||
|
||||
return ( pSfrInt->CopyFrom( pSfrFromCrvs)) ;
|
||||
return ( ( ! IsNull( pSfrFromCrvs) && pSfrFromCrvs->IsValid()) ? Release( pSfrFromCrvs) : nullptr) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -2371,15 +2356,15 @@ SurfRoughing::SimplifyCurve( ICurveComposite* pCompo) const
|
||||
PolyArc PA ;
|
||||
Point3d ptNewStart, ptNewEnd ;
|
||||
|
||||
// merge per uniformità
|
||||
// merge per uniformità
|
||||
if ( pCompoCL->MergeCurves( 200 * EPS_SMALL, 200 * EPS_ANG_SMALL) &&
|
||||
// rimozione Spikes o Curve Z
|
||||
// rimozione Spikes o Curve Z
|
||||
pCompoCL->RemoveSmallDefects( 150 * EPS_SMALL, 2 * ANG_TOL_STD_DEG, true) &&
|
||||
// interpolazione mediante linee ed archi
|
||||
// interpolazione mediante linee ed archi
|
||||
pCompoCL->ApproxWithArcsEx( 150 * EPS_SMALL, ANG_TOL_STD_DEG, LIN_FEA_STD, PA) &&
|
||||
pCompoCL->Clear() &&
|
||||
pCompoCL->FromPolyArc( PA) &&
|
||||
// controllo aggiuntivo sui punti iniziali e finali che siano gli stessi
|
||||
// controllo aggiuntivo sui punti iniziali e finali che siano gli stessi
|
||||
pCompoCL->GetStartPoint( ptNewStart) &&
|
||||
pCompoCL->GetEndPoint( ptNewEnd) &&
|
||||
AreSamePointApprox( ptNewStart, ptStart) &&
|
||||
@@ -2389,7 +2374,6 @@ SurfRoughing::SimplifyCurve( ICurveComposite* pCompo) const
|
||||
}
|
||||
|
||||
return true ;
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
+2
-3
@@ -89,9 +89,8 @@ class SurfRoughing : public Machining
|
||||
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
|
||||
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced,
|
||||
Point3d& ptP1, double& dElev) ;
|
||||
bool GetRaw( ISurfTriMesh* pStmRaw) const ;
|
||||
bool GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, ISurfFlatRegion* pSfrInt,
|
||||
double dSmallOffs = 0.) const ;
|
||||
ISurfTriMesh* GetRaw( void) const ;
|
||||
ISurfFlatRegion* GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, double dSmallOffs = 0) const ;
|
||||
bool GetActiveSurfaces( INTVECTOR& vSurfId) const ;
|
||||
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
|
||||
Reference in New Issue
Block a user