EgtMachKernel :
- in Sgrossature, aggiunta gestione per superfici di controllo.
This commit is contained in:
+65
-10
@@ -95,6 +95,7 @@ static string KEY_SURF_POCK = "SurfPock_" ;
|
||||
static string KEY_SURF_LIMIT = "SurfLimit_" ;
|
||||
static string KEY_OPEN = "OPEN" ;
|
||||
static string KEY_THICK = "THICK" ;
|
||||
static string SRF_SUPP_LAYER_NAME = "SUPP" ;
|
||||
|
||||
#define ENABLE_DEBUG_SFR 0
|
||||
#define ENABLE_DEBUG_STM_NORMAL_SHADER 0
|
||||
@@ -109,6 +110,7 @@ static string KEY_THICK = "THICK" ;
|
||||
const double STEP_TOL = 10. * EPS_SMALL ;
|
||||
const double SIL_DEPTH_TOL = 100. * EPS_SMALL ;
|
||||
const double OFFS_CORR_OPEN_EDGES = 25. * EPS_SMALL ;
|
||||
const double SUPP_SURF_RADIAL_OFFS = 5. ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
USEROBJ_REGISTER( GetOperationClass( OPER_SURFROUGHING), SurfRoughing) ;
|
||||
@@ -1460,9 +1462,10 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
// verifico se archi vanno approssimati con segmenti di retta
|
||||
bool bSplitArcs = GetSplitArcs( vtTool) ;
|
||||
|
||||
// recupero le superfici attive
|
||||
// recupero le superfici attive e le superfici di supporto
|
||||
INTVECTOR vSurfId ;
|
||||
GetActiveSurfaces( vSurfId) ;
|
||||
INTVECTOR vSurfSuppId ;
|
||||
GetActiveSurfaces( vSurfId, vSurfSuppId) ;
|
||||
if ( vSurfId.empty()) {
|
||||
m_pMchMgr->SetLastError( 3023, "Error in SurfRoughing : missing surfaces") ;
|
||||
return false ;
|
||||
@@ -1489,9 +1492,9 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
// inizializzo la classe di intersezione tra la superficie trimesh limite e piani paralleli ( quelli di lavoro)
|
||||
IntersParPlanesSurfTm IPPStm1( frSfr, *pStmLimit) ;
|
||||
|
||||
// inizializzo la classe di calcolo delle silhouette nei piani come sopra
|
||||
// inizializzo la classe di calcolo delle silhouette per le superfici attive nei piani come sopra
|
||||
SURFLOCALVECTOR vSurfL ; vSurfL.reserve( vSurfId.size()) ;
|
||||
CISURFTMPVECTOR vpStm ; vpStm.reserve( vSurfId.size()) ;
|
||||
CISURFTMPVECTOR vpStm ; vpStm.reserve( vSurfId.size()) ;
|
||||
for ( int i = 0 ; i < int( vSurfId.size()) ; ++ i) {
|
||||
vSurfL.emplace_back( m_pGeomDB, vSurfId[i], GLOB_FRM) ;
|
||||
if ( vSurfL[i].Get() == nullptr)
|
||||
@@ -1509,6 +1512,27 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
if ( IsNull( pCavParSilh) || ! pCavParSilh->SetData( vpStm, frSfr, SILH_TOL))
|
||||
return false ;
|
||||
|
||||
// inizializzo la classe di calcolo delle silhouette per le superfici di supporto nei piani come sopra
|
||||
SURFLOCALVECTOR vSurfL_supp ;
|
||||
CISURFTMPVECTOR vpStm_supp ;
|
||||
PtrOwner<ICAvParSilhouettesSurfTm> pCavParSilh_supp( CreateCAvParSilhouettesSurfTm()) ;
|
||||
if ( IsNull( pCavParSilh_supp))
|
||||
return false ;
|
||||
if ( ! vSurfSuppId.empty()) {
|
||||
vSurfL_supp.reserve( vSurfSuppId.size()) ;
|
||||
vpStm.reserve( vSurfSuppId.size()) ;
|
||||
for ( int i = 0 ; i < int( vSurfSuppId.size()) ; ++ i) {
|
||||
vSurfL_supp.emplace_back( m_pGeomDB, vSurfSuppId[i], GLOB_FRM) ;
|
||||
if ( vSurfL_supp[i].Get() == nullptr)
|
||||
return false ;
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( vSurfL_supp[i].Get()) ;
|
||||
if ( pStm != nullptr && pStm->IsValid() && pStm->GetTriangleCount() > 0)
|
||||
vpStm_supp.emplace_back( pStm) ;
|
||||
}
|
||||
if ( ! pCavParSilh_supp->SetData( vpStm_supp, frSfr, SILH_TOL))
|
||||
return false ;
|
||||
}
|
||||
|
||||
// vettore Id salvati nel gruppo Temp
|
||||
INTINTVECTOR vPocket ;
|
||||
// vettore delle curve composite con proprietà Aperto/Chiuso riferite ai vari step della curva originale
|
||||
@@ -1687,6 +1711,23 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
if ( ! pSfr->IsValid() || pSfr->GetChunkCount() == 0) // se superficie non valida
|
||||
continue ; // passo allo step successivo ( la silhouette coincide con il grezzo )
|
||||
|
||||
/* ************************** superfici di supporto ************************ */
|
||||
if ( ! vSurfL_supp.empty()) {
|
||||
bool bOkSil_supp = false ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrSil_supp( GetSfrSilhouette( pCavParSilh_supp, dSilDepth, SILH_TOL, bOkSil_supp)) ;
|
||||
if ( ! bOkSil_supp) {
|
||||
m_pMchMgr->SetLastError( 3024, "Error in SurfRoughing : region not computable") ;
|
||||
return false ;
|
||||
}
|
||||
if ( ! IsNull( pSfrSil_supp)) {
|
||||
pSfrSil_supp->Offset( SUPP_SURF_RADIAL_OFFS, ICurve::OFF_CHAMFER) ; // offset radiale sulla Silhouette
|
||||
pSfr->Subtract( *pSfrSil_supp) ; // sottraggo le parti da non lavorare
|
||||
pSfrSil->Add( *pSfrSil_supp) ; // aggiungo la regione alla Silhouette
|
||||
}
|
||||
if ( ! pSfr->IsValid() || pSfr->GetChunkCount() == 0) // se superficie non valida
|
||||
continue ; // passo allo step successivo
|
||||
}
|
||||
|
||||
// salvo la superficie rimossa
|
||||
delete( it->pSfrRemoved) ;
|
||||
it->pSfrRemoved = CloneSurfFlatRegion( pSfrRemoved_tmp) ;
|
||||
@@ -2213,10 +2254,17 @@ SurfRoughing::GetSfrSilhouette( ICAvParSilhouettesSurfTm* pCavParSilh, double dD
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SurfRoughing::GetActiveSurfaces( INTVECTOR& vSurfId) const
|
||||
SurfRoughing::GetActiveSurfaces( INTVECTOR& vSurfId, INTVECTOR& vSurfSuppId) const
|
||||
{
|
||||
// NB.
|
||||
// - vSrufInd contiene gli Id delle superfici selezionate ( nel caso non ci siano superfici
|
||||
// seleionate, allora vengono considerate tutte le superfici presenti nei grezzi attivi della fase
|
||||
// - vSurfSupp contiene gli Id delle superfici di supporto, quindi quelle superici da cui si vuole
|
||||
// mantenere una certa distanza con l'utensile ( senza che siano selezionate)
|
||||
|
||||
// pulisco vettore superfici
|
||||
vSurfId.clear() ;
|
||||
vSurfSuppId.clear() ;
|
||||
// verifiche
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
@@ -2227,12 +2275,11 @@ SurfRoughing::GetActiveSurfaces( INTVECTOR& vSurfId) const
|
||||
vSurfId.emplace_back( nEntId) ;
|
||||
}
|
||||
// se trovate superfici, considero solo queste ed esco
|
||||
if ( ! vSurfId.empty())
|
||||
return true ;
|
||||
bool bNoSurfId = ( vSurfId.empty()) ;
|
||||
// altrimenti considero tutte le superfici dei pezzi nei grezzi attivi della fase
|
||||
int nRawId = m_pMchMgr->GetFirstRawPart() ;
|
||||
while ( nRawId != GDB_ID_NULL) {
|
||||
if ( m_pMchMgr->VerifyRawPartPhase(nRawId, m_nPhase)) {
|
||||
if ( m_pMchMgr->VerifyRawPartPhase( nRawId, m_nPhase)) {
|
||||
// ciclo sui pezzi del grezzo
|
||||
int nPartId = m_pMchMgr->GetFirstPartInRawPart( nRawId) ;
|
||||
while ( nPartId != GDB_ID_NULL) {
|
||||
@@ -2245,8 +2292,15 @@ SurfRoughing::GetActiveSurfaces( INTVECTOR& vSurfId) const
|
||||
// se entità superficie e visibile, la aggiungo
|
||||
int nStat ;
|
||||
if ( m_pGeomDB->GetGeoType( nEntId) == SRF_TRIMESH &&
|
||||
m_pGeomDB->GetCalcStatus( nEntId, nStat) && nStat != GDB_ST_OFF)
|
||||
vSurfId.emplace_back( nEntId) ;
|
||||
m_pGeomDB->GetCalcStatus( nEntId, nStat) && nStat != GDB_ST_OFF) {
|
||||
// se non sono state selezionate superfici precedentemente, memorizzo tale id
|
||||
if ( bNoSurfId)
|
||||
vSurfId.emplace_back( nEntId) ;
|
||||
// verifico se è presente una superficie di controllo
|
||||
string sLayIdName ;
|
||||
if ( m_pGeomDB->GetName( nLayId, sLayIdName) && EqualNoCase( sLayIdName, SRF_SUPP_LAYER_NAME))
|
||||
vSurfSuppId.emplace_back( nEntId) ;
|
||||
}
|
||||
// passo alla entità successiva
|
||||
nEntId = m_pGeomDB->GetNext( nEntId) ;
|
||||
}
|
||||
@@ -2257,6 +2311,7 @@ SurfRoughing::GetActiveSurfaces( INTVECTOR& vSurfId) const
|
||||
}
|
||||
nRawId = m_pMchMgr->GetNextRawPart( nRawId) ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ class SurfRoughing : public Machining
|
||||
ISurfTriMesh* GetStmOutSideSfr( const ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmRaw, const Vector3d& vtExtr) const ;
|
||||
ISurfFlatRegion* GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, double dSmallOffs = 0) const ;
|
||||
ISurfFlatRegion* GetSfrSilhouette( ICAvParSilhouettesSurfTm* pCavParSilh, double dDepth, double Sil_tol, bool& bOk) const ;
|
||||
bool GetActiveSurfaces( INTVECTOR& vSurfId) const ;
|
||||
bool GetActiveSurfaces( INTVECTOR& vSurfId, INTVECTOR& vSurfSuppId) const ;
|
||||
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
bool ResetCurveAllTempProp( ICurve* pCurve) const ;
|
||||
|
||||
Reference in New Issue
Block a user