EgtMachKernel :

- migliorata gestione sgrossature
- aggiunta lavorazione di finitura ZConst.
This commit is contained in:
Riccardo Elitropi
2024-12-12 11:49:50 +01:00
parent 9759656f80
commit 87666ea59c
4 changed files with 1182 additions and 194 deletions
+982 -95
View File
File diff suppressed because it is too large Load Diff
+18
View File
@@ -13,15 +13,18 @@
#pragma once
#include "set"
#include "Machining.h"
#include "SurfFinishingData.h"
#include "ToolData.h"
#include "MachiningConst.h"
#include "/EgtDev/Include/EGkCurveComposite.h"
#include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
class ICAvToolSurfTm ;
class ISurfFlatRegion ;
class ICAvParSilhouettesSurfTm ;
//----------------------------------------------------------------------------
class SurfFinishing : public Machining
@@ -74,12 +77,27 @@ class SurfFinishing : public Machining
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool Chain( int nGrpDestId) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool SimplifyCurve( ICurveComposite* pCompo) const ;
bool CalcZConstProjectedLink( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frPocket,
const Frame3d& frSurf, const Vector3d& vtTool, double dDepth,
const Point3d ptStart_forced, const Point3d ptEnd_forced,
ICurveComposite* pCrv) ;
bool AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrPock,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
bool AddOneWay( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrPock,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
bool AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrPock,
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs, bool bInVsOut) ;
bool AddZConst( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfr,
const Vector3d& vtTool, double dDepth, double dElev, bool bSliptArcs) ;
bool GetZConstFacesInsideSfr( const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfr,
const Vector3d& vtTool, std::set<double>& setZAmbiguos) ;
ICAvParSilhouettesSurfTm* GetParSilhouettesForZConst( const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
const ISurfFlatRegion* pSfr) const ;
bool CalcZConstSilCrv( ICAvParSilhouettesSurfTm* pCavParSilh, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ISurfFlatRegion* pSfr,
const Vector3d& vtTool, double dDepth, std::vector<ICRVCOMPOPOVECTOR>& vCrvCompo) ;
bool CreateZConstPaths( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, std::vector<ICRVCOMPOPOVECTOR>& vCrvCompo, const Vector3d& vtTool,
const ISurfFlatRegion* pSfr, double dDepth, ICRVCOMPOPOVECTOR& vCrvPath) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dElev, double dAppr) ;
+180 -97
View File
@@ -89,9 +89,17 @@ using namespace std ;
//----------------------------------------------------------------------------
static string KEY_SURF_POCK = "SurfPock_" ;
static string KEY_SURF_LIMIT = "SurfLimit_" ;
static string KEY_OPEN = "OPEN" ;
static string KEY_THICK = "THICK" ;
#define ENABLE_DEBUG_SFR 0
#define ENABLE_DEBUG_FEEDS 0
#define ENABLE_DEBUG_SFR_BOOLEANS 0
#define ENABLE_DEBUG_ZPLANE 0
#if ENABLE_DEBUG_SFR_BOOLEANS
#include "/EgtDev/Include/EGkGeoObjSave.h"
string sPathSrfBool = "C:\\Temp\\" ;
#endif
const double STEP_TOL = 10. * EPS_SMALL ;
const double SIL_DEPTH_TOL = 100. * EPS_SMALL ;
@@ -590,12 +598,6 @@ SurfRoughing::Apply( bool bRecalc, bool bPostApply)
m_dTHoldDiam = 0 ;
m_pGeomDB->GetInfo( nToolId, TTH_DIAM, m_dTHoldDiam) ;
// se necessario, eseguo concatenamento ed inserisco i percorsi sotto la geometria ausiliaria
if ( bChain && ! Chain( nAuxId)) {
m_pMchMgr->SetLastError( 3003, "Error in SurfRoughing : Chaining failed") ;
return false ;
}
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
// se non c'è, lo aggiungo
@@ -609,28 +611,24 @@ SurfRoughing::Apply( bool bRecalc, bool bPostApply)
else
m_pGeomDB->EmptyGroup( nClId) ;
// recupero gruppo per geometria temporanea
const string GRP_TEMP = "Temp" ;
int nTempId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, GRP_TEMP) ;
// se non c'è, lo aggiungo
if ( nTempId == GDB_ID_NULL) {
nTempId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nTempId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nTempId, GRP_TEMP) ;
// elimino eventuale gruppo geometria simmetrica per lavorazione in doppio
int nDblId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_DBL) ;
if ( nDblId != GDB_ID_NULL) {
m_pGeomDB->Erase( nDblId) ;
nDblId = GDB_ID_NULL ;
}
// altrimenti lo svuoto
else
m_pGeomDB->EmptyGroup( nTempId) ;
// in ogni caso lo dichiaro temporaneo e non visibile
m_pGeomDB->SetLevel( nTempId, GDB_LV_TEMP) ;
m_pGeomDB->SetStatus( nTempId, GDB_ST_OFF) ;
// lavoro ogni singola catena
// se necessario, eseguo concatenamento ed inserisco i percorsi sotto la geometria ausiliaria
if ( bChain && ! Chain( nAuxId)) {
m_pMchMgr->SetLastError( 3003, "Error in SurfRoughing : Chaining failed") ;
return false ;
}
// lavoro ogni singola regione piana
bool bOk = true ;
int nPathId = m_pGeomDB->GetFirstGroupInGroup( nAuxId) ;
while ( nPathId != GDB_ID_NULL) {
if ( ! ProcessPath( nPathId, nTempId, GDB_ID_NULL, nClId))
if ( ! ProcessPath( nPathId, GDB_ID_NULL, nClId))
bOk = false ;
nPathId = m_pGeomDB->GetNextGroup( nPathId) ;
}
@@ -643,15 +641,14 @@ SurfRoughing::Apply( bool bRecalc, bool bPostApply)
// eseguo aggiornamento assi macchina e collegamento con operazione precedente
if ( ! Update( bPostApply))
return false ;
// aggiorno stato della lavorazione
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
// dichiaro successiva da aggiornare
UpdateFollowingOperationsStatus( MCH_ST_OTH_MODIF) ;
LOG_DBG_INFO( GetEMkLogger(), "SurfRoughing apply done") ;
return true ;
}
//----------------------------------------------------------------------------
@@ -1080,8 +1077,8 @@ SurfRoughing::Chain( int nGrpDestId)
bFirst = false ;
}
}
// recupero i percorsi concatenati
int nCount = 0 ;
// recupero i percorsi concatenati e definisco la regione piana di sgrossatura
SurfFlatRegionByContours SfrByC ;
INTVECTOR vnId2 ;
while ( chainC.GetChainFromNear( ptNear, false, vnId2)) {
// creo una curva composita
@@ -1119,56 +1116,143 @@ SurfRoughing::Chain( int nGrpDestId)
// se non sono state inserite curve, vado oltre
if ( pCrvCompo->GetCurveCount() == 0)
continue ;
// se la curva non è chiusa, errore
if ( ! pCrvCompo->IsClosed()) {
m_pMchMgr->SetLastError( 3004, "Error in SurfRoughing : Open Contour") ;
return false ;
}
// imposto estrusione e spessore
pCrvCompo->SetExtrusion( vtExtr) ;
pCrvCompo->SetThickness( dThick) ;
// verifico sia piana e se necessario la appiattisco
PtrOwner<ICurve> pFlatCrv( FlattenCurve( *pCrvCompo, 50 * EPS_SMALL, 50 * EPS_ANG_SMALL, FLTCRV_USE_EXTR)) ;
if ( IsNull( pFlatCrv)) {
Plane3d plPlane ;
if ( ! pCrvCompo->IsFlat( plPlane, true, 50 * EPS_SMALL))
m_pMchMgr->SetLastError( 3005, "Error in SurfRoughing : Contour Not Flat") ;
else
m_pMchMgr->SetLastError( 3006, "Error in SurfRoughing : Tool Dir not perpendicular to Flat Area") ;
return false ;
}
pFlatCrv->GetExtrusion( vtExtr) ;
pCrvCompo->Clear() ;
pCrvCompo->AddCurve( Release( pFlatCrv)) ;
// salvo vettore estrusione
pCrvCompo->SetExtrusion( vtExtr) ;
// salvo la thickness come seconda temp prop ( la Sfr rimuove la thick delle curve)
pCrvCompo->SetTempParam( dThick, 1) ;
// aggiorno il nuovo punto vicino
pCrvCompo->GetEndPoint( ptNear) ;
pCrvCompo->GetEndPoint( ptNear) ;
// se utile, approssimo con archi
if ( ! ApproxWithArcsIfUseful( pCrvCompo))
return false ;
// creo nuovo gruppo
int nPathId = m_pGeomDB->AddGroup( GDB_ID_NULL, nGrpDestId, Frame3d()) ;
if ( nPathId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nPathId, MCH_PATH + ToString( ++ nCount)) ;
m_pGeomDB->SetInfo( nPathId, KEY_IDS, ToString( vId2)) ;
// inserisco la curva composita nel gruppo destinazione
int nNewId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, ::Release( pCrvCompo)) ;
if ( nNewId == GDB_ID_NULL)
return false ;
// inserisco la curva nella regione piana
SfrByC.AddCurve( Release( pCrvCompo)) ;
}
// scorro le regioni piane ricavate dalle curve
int nGroupName = -1 ;
PtrOwner<ISurfFlatRegion> pSfrCurr( SfrByC.GetSurf()) ;
while ( ! IsNull( pSfrCurr) && pSfrCurr->IsValid()) {
// per ogni Chunk
for ( int nC = 0 ; nC < pSfrCurr->GetChunkCount() ; ++ nC) {
// creo nuovo gruppo
int nPathId = m_pGeomDB->AddGroup( GDB_ID_NULL, nGrpDestId, Frame3d()) ;
if ( nPathId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nPathId, MCH_PATH + ToString( ++ nGroupName)) ;
m_pGeomDB->SetInfo( nPathId, KEY_IDS, ToString( nGroupName)) ;
// recupero il Chunk corrente
PtrOwner<ISurfFlatRegion> pSfrChunk( pSfrCurr->CloneChunk( nC)) ;
if ( IsNull( pSfrChunk) || ! pSfrChunk->IsValid())
return false ;
int nNewId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, ::CloneSurfFlatRegion( pSfrChunk)) ;
if ( nNewId == GDB_ID_NULL)
return false ;
// salvo eventuali lati aperti per il Chunk corrente
for ( int nL = 0 ; nL < pSfrChunk->GetLoopCount( 0) ; ++ nL) {
// recupero il Loop
PtrOwner<ICurveComposite> pCrvLoop( ConvertCurveToComposite( pSfrChunk->GetLoop( 0, nL))) ;
if ( IsNull( pCrvLoop) || ! pCrvLoop->IsValid())
return false ;
// memorizzo la Thickness e l'Estrusione nelle Info del gruppo
if ( nL == 0) {
double dThick = pCrvLoop->GetTempParam( 1) ;
m_pGeomDB->SetInfo( nNewId, KEY_THICK, dThick) ;
Vector3d vtExtr ;
pCrvLoop->GetExtrusion( vtExtr) ;
m_pGeomDB->SetInfo( nNewId, KEY_EXTR, vtExtr) ;
}
}
}
// aggiorno la regione piana con la successiva calcolata
pSfrCurr.Set( SfrByC.GetSurf()) ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
SurfRoughing::ProcessPath( int nPathId, int nTempId, int nPvId, int nClId)
SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
{
// aggiorno la ProgressBar del 5% per simulare l'inizio della funzione
ExeProcessEvents( 5, 0) ;
// verifico sia una curva chiusa (deve delimitare l'area da svuotare)
int nCrvId = m_pGeomDB->GetFirstInGroup( nPathId) ;
if ( m_pGeomDB->GetGeoType( nCrvId) != CRV_COMPO)
return false ;
ICurve* pCrv = ::GetCurve( m_pGeomDB->GetGeoObj( nCrvId)) ;
if ( pCrv == nullptr || ! pCrv->IsClosed()) {
m_pMchMgr->SetLastError( 3004, "Error in SurfRoughing : Open Contour") ;
return false ;
// recupero gruppo per geometria temporanea
const string GRP_TEMP = "Temp" ;
int nTempId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, GRP_TEMP) ;
// se non c'è, lo aggiungo
if ( nTempId == GDB_ID_NULL) {
nTempId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nTempId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nTempId, GRP_TEMP) ;
}
// altrimenti lo svuoto
else
m_pGeomDB->EmptyGroup( nTempId) ;
// in ogni caso lo dichiaro temporaneo e non visibile
m_pGeomDB->SetLevel( nTempId, GDB_LV_TEMP) ;
m_pGeomDB->SetStatus( nTempId, GDB_ST_OFF) ;
// copio la curva composita da elaborare
int nCopyId = m_pGeomDB->CopyGlob( nCrvId, GDB_ID_NULL, nTempId) ;
// recupero la regione piana dal database geometrico
int nSfrId = m_pGeomDB->GetFirstInGroup( nPathId) ;
if ( m_pGeomDB->GetGeoType( nSfrId) != SRF_FLATRGN)
return false ;
// copio la regione piana da elaborare
int nCopyId = m_pGeomDB->CopyGlob( nSfrId, GDB_ID_NULL, nTempId) ;
if ( nCopyId == GDB_ID_NULL)
return false ;
ICurveComposite* pCompo = GetCurveComposite( m_pGeomDB->GetGeoObj( nCopyId)) ;
PtrOwner<ISurfFlatRegion> pSfrGDB( CloneSurfFlatRegion( m_pGeomDB->GetGeoObj( nCopyId))) ;
if ( IsNull( pSfrGDB) || ! pSfrGDB->IsValid())
return false ;
// recupero estrusione e spessore
Vector3d vtExtr = Z_AX ;
pCompo->GetExtrusion( vtExtr) ;
double dThick ;
pCompo->GetThickness( dThick) ;
if ( m_pGeomDB->ExistsInfo( nSfrId, KEY_EXTR))
m_pGeomDB->GetInfo( nSfrId, KEY_EXTR, vtExtr) ;
double dThick = 0. ;
if ( m_pGeomDB->ExistsInfo( nSfrId, KEY_THICK))
m_pGeomDB->GetInfo( nSfrId, KEY_THICK, dThick) ;
// valuto l'espressione dell'affondamento
ExeLuaSetGlobNumVar( "TH", abs( dThick)) ;
double dDepth ;
string sMyDepth = m_Params.m_sDepth ;
if ( ! ExeLuaEvalNumExpr( ToUpper( sMyDepth), &dDepth)) {
m_pMchMgr->SetLastError( 3008, "Error in SurfRoughing : Depth not computable") ;
return false ;
}
// se spessore positivo, lo sottraggo dal risultato
if ( dThick > 0)
dDepth -= dThick ;
// recupero il Loop esterno della regione da svuotatare
PtrOwner<ICurveComposite> pCompo( ConvertCurveToComposite( pSfrGDB->GetLoop( 0, 0))) ;
if ( IsNull( pCompo) || ! pCompo->IsValid())
return false ;
// verifico sia piana e sistemo senso antiorario visto dalla direzione di estrusione
Plane3d plPlane ; double dArea ;
@@ -1201,15 +1285,6 @@ SurfRoughing::ProcessPath( int nPathId, int nTempId, int nPvId, int nClId)
return false ;
}
// valuto l'espressione dell'affondamento
ExeLuaSetGlobNumVar( "TH", abs( dThick)) ;
double dDepth ;
string sMyDepth = m_Params.m_sDepth ;
if ( ! ExeLuaEvalNumExpr( ToUpper( sMyDepth), &dDepth)) {
m_pMchMgr->SetLastError( 3008, "Error in SurfRoughing : Depth not computable") ;
return false ;
}
// recupero nome del path
string sPathName ;
m_pGeomDB->GetName( nPathId, sPathName) ;
@@ -1257,7 +1332,7 @@ SurfRoughing::ProcessPath( int nPathId, int nTempId, int nPvId, int nClId)
// costruisco una superficie di estrusione della curva (devo determinare parte della regione limite)
Vector3d vtLimitExtr = - vtTool * 1.5 * max( b3Raw.GetDimX(), max( b3Raw.GetDimY(), b3Raw.GetDimZ())) ;
PtrOwner<ISurfTriMesh> pStmLimit( GetStmOutSideCompo( pCompo, pStmRaw, vtLimitExtr)) ;
PtrOwner<ISurfTriMesh> pStmLimit( GetStmOutSideSfr( pSfrGDB, pStmRaw, vtLimitExtr)) ;
if ( IsNull( pStmLimit))
return false ;
@@ -1306,6 +1381,12 @@ SurfRoughing::ProcessPath( int nPathId, int nTempId, int nPvId, int nClId)
if ( m_bDetectPlaneZ) {
if ( ! DetectPlaneZ( vpStm, fr_pCompo, vtTool, vPlaneZ, - GetOffsL(), dDepth - GetOffsL()))
return false ;
#if ENABLE_DEBUG_ZPLANE
for ( int nP = 0 ; nP < int( vPlaneZ.size()) ; ++ nP) {
int _a = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, vPlaneZ[nP].first->Clone()) ;
m_pGeomDB->SetMaterial( _a, Color( 1., 0., 0., .25)) ;
}
#endif
}
// definisco una struttura per i parametri utili sugli step
@@ -1394,6 +1475,13 @@ SurfRoughing::ProcessPath( int nPathId, int nTempId, int nPvId, int nClId)
m_pMchMgr->SetLastError( 3024, "Error in SurfRoughing : region not computable") ;
return false ;
}
for ( int nL = 1 ; nL < pSfrGDB->GetLoopCount( 0) ; ++ nL) {
// recupero l'isola
PtrOwner<ICurve> pCrvIsl( pSfrGDB->GetLoop( 0, nL)) ;
if ( IsNull( pCrvIsl) || ! pCrvIsl->IsValid() ||
! pSfr->AddIntLoop( *pCrvIsl))
return false ;
}
pSfr->Translate( ( it->dDepth + GetOffsL()) * vtTool) ;
/* ******************** Regione adattata al grezzo ******************** */
@@ -1464,8 +1552,13 @@ SurfRoughing::ProcessPath( int nPathId, int nTempId, int nPvId, int nClId)
PtrOwner<ISurfFlatRegion> pSfrRef( CloneSurfFlatRegion( vStepInfo[nIndRef].pSfrRemoved)) ;
if ( ! IsNull( pSfrRef) && pSfrRef->IsValid()) { // se valida
pSfrRef->Offset( OFFS_CORR_OPEN_EDGES, ICurve::OFF_FILLET) ; // correzione
pSfr->Subtract( *pSfrRef) ; // sottraggo la regione svuotata in precedenza
// aggiorno Regione piana per gestione lati aperti
if ( ! pSfr->Subtract( *pSfrRef)) { // sottraggo la regione svuotata in precedenza
#if ENABLE_DEBUG_SFR_BOOLEANS
SaveSfrBooleans( pSfr, pSfrRef, sPathSrfBool + "Sub_" + to_string( it->dDepth) + ".nge") ;
#endif
// NB. In attesa di una versione più robusta per le booleane tra regioni piane, il substep viene scartato
continue ;
}// aggiorno Regione piana per gestione lati aperti
pSfrOpenClose->Subtract( *pSfrRef) ;
}
}
@@ -1750,42 +1843,32 @@ SurfRoughing::GetRaw( void) const
//----------------------------------------------------------------------------
ISurfTriMesh*
SurfRoughing::GetStmOutSideCompo( ICurveComposite* pCompo, const ISurfTriMesh* pStmRaw, const Vector3d& vtExtr) const
SurfRoughing::GetStmOutSideSfr( const ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmRaw, const Vector3d& vtExtr) const
{
// controllo dei parametri
if ( pCompo == nullptr || ! pCompo->IsValid() ||
if ( pSfr == nullptr || ! pSfr->IsValid() ||
pStmRaw == nullptr || ! pStmRaw->IsValid())
return nullptr ;
// recupero la PolyLine dalla curva
PolyLine PL ;
pCompo->ApproxWithLines( 10 * EPS_SMALL, 15, ICurve::APL_STD, PL) ;
// definisco il vettore delle curve dei i bordi della regione
CICURVEPVECTOR vpCrv ;
// determino la superficie di estrusione
PtrOwner<ISurfTriMesh> pStmExtr( CreateSurfTriMesh()) ;
bool bOk = ( ! IsNull( pStmExtr)) ;
bOk = bOk && pStmExtr->AdjustTopology() ;
bOk = bOk && pStmExtr->CreateByExtrusion( PL, vtExtr) ;
bOk = bOk && ( pStmExtr->IsValid() && pStmExtr->GetTriangleCount() > 0) ;
if ( ! bOk)
return nullptr ;
// aggiungo i caps
PtrOwner<ISurfTriMesh> pStmCap0( CreateSurfTriMesh()) ;
bOk = ( ! IsNull( pStmCap0)) ;
bOk = bOk && pStmCap0->CreateByFlatContour( PL) ;
bOk = bOk && ( pStmCap0->IsValid() && pStmCap0->GetTriangleCount() > 0) ;
if ( ! bOk)
return nullptr ;
Vector3d vtN ; pStmCap0->GetFacetNormal( 0, vtN) ;
Vector3d vtN_ref = vtExtr ; vtN_ref.Normalize() ;
if ( AreOppositeVectorApprox( vtN, vtN_ref))
pStmCap0->Invert() ;
PtrOwner<ISurfTriMesh> pStmCap1( CloneSurfTriMesh( pStmCap0)) ;
bOk = ( ! IsNull( pStmCap1) && pStmCap1->IsValid() && pStmCap1->GetTriangleCount() > 0) ;
bOk = bOk && ( pStmCap1->Translate( vtExtr) && pStmCap1->Invert()) ;
bOk = bOk && pStmExtr->DoSewing( *pStmCap0) ;
bOk = bOk && pStmExtr->DoSewing( *pStmCap1) ;
if ( ! bOk)
// per ogni Chunk
for ( int nC = 0 ; nC < pSfr->GetChunkCount() ; ++ nC) {
// per ogni Loop
for ( int nL = 0 ; nL < pSfr->GetLoopCount( nC) ; ++ nL) {
// recupero il Loop come curva composita
PtrOwner<ICurveComposite> pCompoLoop( ConvertCurveToComposite( pSfr->GetLoop( nC, nL))) ;
if ( IsNull( pCompoLoop) || ! pCompoLoop->IsValid())
return nullptr ;
// recupero la PolyLine associata a tale Loop e la inserisco nel vettore
vpCrv.emplace_back( Release( pCompoLoop)) ;
}
}
// definisco la superficie di estrusione
PtrOwner<ISurfTriMesh> pStmExtr( GetSurfTriMeshByRegionExtrusion( vpCrv, vtExtr)) ;
if ( IsNull( pStmExtr) || ! pStmExtr->IsValid())
return nullptr ;
// la superficie deeve definire un volume
@@ -1795,7 +1878,7 @@ SurfRoughing::GetStmOutSideCompo( ICurveComposite* pCompo, const ISurfTriMesh* p
// sottraggo al grezzo la regione di estrusione
PtrOwner<ISurfTriMesh> pStmLimit( CloneSurfTriMesh( pStmRaw)) ;
bOk = ! IsNull( pStmLimit) ;
bool bOk = ! IsNull( pStmLimit) ;
bOk = bOk && pStmLimit->IsValid() ;
bOk = bOk && pStmLimit->Subtract( *pStmExtr) ;
if ( ! bOk)
+2 -2
View File
@@ -106,7 +106,7 @@ class SurfRoughing : public Machining
bool VerifyGeometry( SelData Id, int& nSubs) ;
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool Chain( int nGrpDestId) ;
bool ProcessPath( int nPathId, int nTempId, int nPvId, int nClId) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool DetectPlaneZ( const CISURFTMPVECTOR& vpStm, const Frame3d& frCompo, const Vector3d& vtTool, PLANEZFACEVECTOR& vPlaneZ,
double dMinDepth, double dMaxDepth) const ;
bool CalcPaths( const INTINTVECTOR& vPocket, STEPINFOSRVECTOR& vStepInfo) const ;
@@ -122,7 +122,7 @@ class SurfRoughing : public Machining
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced, Point3d& ptP1) ;
ISurfTriMesh* GetRaw( void) const ;
ISurfTriMesh* GetStmOutSideCompo( ICurveComposite* pCompo, const ISurfTriMesh* pStmRaw, const Vector3d& vtExtr) const ;
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 ;