EgtMachKernel :
- inserimento in sgrossatura superfici di nuovo metodo per calcolo silhouettte.
This commit is contained in:
+42
-32
@@ -29,6 +29,8 @@
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkSfrCreate.h"
|
||||
#include "/EgtDev/Include/EGkCalcPocketing.h"
|
||||
#include "/EgtDev/Include/EGkSurfLocal.h"
|
||||
#include "/EgtDev/Include/EGkCAvSilhouetteSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkIntervals.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EGkUserObjFactory.h"
|
||||
@@ -1221,13 +1223,25 @@ SurfRoughing::ProcessPath( int nPathId, int nTempId, int nPvId, int nClId)
|
||||
return false ;
|
||||
}
|
||||
|
||||
// inizializzo la classe di intersezione tra il piano e il grezzo ( serve per limitare le
|
||||
// FlatRegions per il calcolo delle svuotature )
|
||||
// inizializzo la classe di intersezione tra grezzo e piani paralleli ( quelli di lavoro)
|
||||
IntersParPlanesSurfTm IPPStm( fr_pCompo, *pStmRaw) ;
|
||||
|
||||
// inizializzo la classe di calcolo delle silhouette nei piani come sopra
|
||||
SURFLOCALVECTOR vSurfL ; vSurfL.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)
|
||||
return GDB_ID_NULL ;
|
||||
vpStm.emplace_back( GetSurfTriMesh( vSurfL[i].Get())) ;
|
||||
}
|
||||
Frame3d frPlanes ;
|
||||
frPlanes.Set( plPlane.GetPoint(), vtTool) ;
|
||||
const double SILH_TOL = 1 ;
|
||||
CAvParSilhouettesSurfTm cavParSilh( vpStm, frPlanes, SILH_TOL) ;
|
||||
|
||||
// calcolo le regioni di svuotatura alle varie quote come differenza tra regioni da lavorare e regioni di silhouette
|
||||
INTVECTOR vPocket ;
|
||||
const double SILH_TOL = max( GetOffsR(), 1.) ;
|
||||
int nStep = max( 1, static_cast<int>( ceil( dDepth / dOkStep))) ;
|
||||
double dStep = dDepth / nStep ;
|
||||
for ( int i = 1 ; i <= nStep ; ++ i) {
|
||||
@@ -1248,42 +1262,34 @@ SurfRoughing::ProcessPath( int nPathId, int nTempId, int nPvId, int nClId)
|
||||
// parti in eccesso ; taglio il grezzo sul piano corrente
|
||||
PtrOwner<ISurfFlatRegion> pSfrInt( CreateSurfFlatRegion()) ;
|
||||
if ( IsNull( pSfrInt) ||
|
||||
! GetSfrByRawIntersection( pSfrInt, IPPStm, -i * dStep)) {
|
||||
! GetSfrByRawIntersection( IPPStm, -i * dStep, pSfrInt)) {
|
||||
m_pMchMgr->SetLastError( 3027, "Error in SurfRoughing : Slicing Raw failed") ;
|
||||
return false ;
|
||||
}
|
||||
if ( ! pSfrInt->IsValid())
|
||||
continue ;
|
||||
pSfr->Intersect( *pSfrInt) ;
|
||||
|
||||
// per ogni superficie
|
||||
for ( int nSurfId : vSurfId) {
|
||||
|
||||
const ISurfTriMesh* pSurf = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nSurfId)) ;
|
||||
Frame3d frSurf ; m_pGeomDB->GetGlobFrame( nSurfId, frSurf) ;
|
||||
Plane3d plCutL = plCut ; plCutL.ToLoc( frSurf) ;
|
||||
|
||||
// determino le regioni da non lavorare e le sottraggo
|
||||
POLYLINEVECTOR vPL ;
|
||||
if ( pSurf == nullptr || ! pSurf->GetSilhouette( plCutL, SILH_TOL, vPL)) {
|
||||
// determino la regione da non lavorare e la sottraggo
|
||||
POLYLINEVECTOR vPL ;
|
||||
if ( ! cavParSilh.GetSilhouette( - ( i * dStep + GetOffsL()), vPL)) {
|
||||
m_pMchMgr->SetLastError( 3024, "Error in SurfRoughing : region not computable") ;
|
||||
return false ;
|
||||
}
|
||||
SurfFlatRegionByContours SfrMaker ;
|
||||
for ( auto& PL : vPL) {
|
||||
PtrOwner<ICurveComposite> pSilCrv( CreateCurveComposite()) ;
|
||||
if ( IsNull( pSilCrv) || ! pSilCrv->FromPolyLine( PL) || ! SfrMaker.AddCurve( Release( pSilCrv))) {
|
||||
m_pMchMgr->SetLastError( 3024, "Error in SurfRoughing : region not computable") ;
|
||||
return false ;
|
||||
}
|
||||
SurfFlatRegionByContours SfrMaker ;
|
||||
for ( auto& PL : vPL) {
|
||||
PtrOwner<ICurveComposite> pSilCrv( CreateCurveComposite()) ;
|
||||
if ( IsNull( pSilCrv) || ! pSilCrv->FromPolyLine( PL) || ! SfrMaker.AddCurve( Release( pSilCrv))) {
|
||||
m_pMchMgr->SetLastError( 3024, "Error in SurfRoughing : region not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
PtrOwner<ISurfFlatRegion> pSfrSil( SfrMaker.GetSurf()) ;
|
||||
if ( ! IsNull( pSfrSil)) {
|
||||
// riporto in globale
|
||||
pSfrSil->ToGlob( frSurf) ;
|
||||
// sottraggo le parti da non lavorare
|
||||
pSfr->Subtract( *pSfrSil) ;
|
||||
}
|
||||
|
||||
}
|
||||
PtrOwner<ISurfFlatRegion> pSfrSil( SfrMaker.GetSurf()) ;
|
||||
if ( ! IsNull( pSfrSil)) {
|
||||
// sottraggo le parti da non lavorare
|
||||
pSfr->Subtract( *pSfrSil) ;
|
||||
}
|
||||
|
||||
// se regione risultante non vuota
|
||||
if ( pSfr->IsValid()) {
|
||||
|
||||
@@ -1367,7 +1373,7 @@ SurfRoughing::GetRaw( ISurfTriMesh* pStmRaw) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
SurfRoughing::GetSfrByRawIntersection( ISurfFlatRegion* pSfrInt, const IntersParPlanesSurfTm& IPPStm, double dDist) const
|
||||
SurfRoughing::GetSfrByRawIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, ISurfFlatRegion* pSfrInt) const
|
||||
{
|
||||
// controllo dei parametri
|
||||
if ( pSfrInt == nullptr)
|
||||
@@ -1381,6 +1387,10 @@ SurfRoughing::GetSfrByRawIntersection( ISurfFlatRegion* pSfrInt, const IntersPar
|
||||
if ( ! IPPStm.GetInters( dDist, vPnt, vBpt, vTria))
|
||||
return false ;
|
||||
|
||||
// se non c'è intersezione
|
||||
if ( vBpt.empty())
|
||||
return true ;
|
||||
|
||||
// definisco la tolleranza per i concatenamenti
|
||||
double dToler = EPS_SMALL ;
|
||||
|
||||
@@ -2090,7 +2100,7 @@ SurfRoughing::ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfTriMesh*
|
||||
! pSfr->CopyFrom( pSfrWithTmpProps))
|
||||
return false ;
|
||||
|
||||
return pSfr->IsValid() && pSfr->GetChunkCount() != 0 ;
|
||||
return ( pSfr->IsValid() && pSfr->GetChunkCount() != 0) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ class SurfRoughing : public Machining
|
||||
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced,
|
||||
Point3d& ptP1, double& dElev) ;
|
||||
bool GetRaw( ISurfTriMesh* pStmRaw) const ;
|
||||
bool GetSfrByRawIntersection( ISurfFlatRegion* pSfrInt, const IntersParPlanesSurfTm& IPPStm, double dDist) const ;
|
||||
bool GetSfrByRawIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, ISurfFlatRegion* pSfrInt) 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