EgtMachKernel :

- in Sgrossature piccole migliore e semplificazioni.
This commit is contained in:
Riccardo Elitropi
2026-01-14 10:20:10 +01:00
parent 0c9575f754
commit cfb8e0553d
2 changed files with 18 additions and 35 deletions
+12 -27
View File
@@ -1660,12 +1660,12 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
// inserimento degli step ( ed eventuali PlaneZ se SubSteps non presenti)
for ( int i = 0 ; i < nStep ; ++ i) {
vStepInfo.emplace_back( -1, - ( i + 1) * dStep, false, false, 1., nullptr, nullptr, nullptr) ;
vStepInfo.emplace_back( -1, - ( i + 1) * dStep, false, false, 1., nullptr, nullptr) ;
// se non ho SubStep ma PlaneZ, inserisco i PlaneZ
if ( nSubStep == -1) {
for ( int j = 0 ; j < int( vPlaneZ.size()) ; ++ j) {
if ( vPlaneZ[j].second > - ( i + 1) * dStep + STEP_TOL && vPlaneZ[j].second < - i * dStep - STEP_TOL) {
vStepInfo.emplace_back( i, vPlaneZ[j].second, false, true, -1., nullptr, nullptr, nullptr) ;
vStepInfo.emplace_back( i, vPlaneZ[j].second, false, true, -1., nullptr, nullptr) ;
vStepInfo.back().pSfrPlaneZ = Release( vPlaneZ[j].first) ;
}
}
@@ -1692,7 +1692,7 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
int nMyInd = ( j == i - 1 ? nIndRef : int( vStepInfo.size()) - 1) ;
bool bSS = ( vExtraStep[j].first == -1) ;
vStepInfo.emplace_back( nMyInd, vExtraStep[j].second, bSS, ! bSS,
-1. , nullptr, nullptr, nullptr) ;
-1. , nullptr, nullptr) ;
if ( ! bSS)
vStepInfo.back().pSfrPlaneZ = Release( vPlaneZ[vExtraStep[j].first].first) ;
}
@@ -1870,21 +1870,6 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
// aggiorno Regione piana per gestione lati aperti
pSfrOpenClose->Subtract( *pSfrRemovedRef) ;
}
/* ******************** Regione di Corner ******************************** */
// se presente una regione di Corner la aggiungo alla regione attuale da lavorare
// ( estendo quindi la regione )
if ( vStepInfo[nIndRef].pSfrCorn != nullptr && vStepInfo[nIndRef].pSfrCorn->IsValid()) {
pSfr->Add( *vStepInfo[nIndRef].pSfrCorn) ;
// verifico sempre di non rovinare la regione di Silhouette e la regione al di fuori
// della curva di bordo di sgrossatura
if ( ! IsNull( pSfrOutCompo) && pSfrOutCompo->IsValid())
pSfr->Subtract( *pSfrOutCompo) ;
if ( ! IsNull( pSfrSil) && pSfrSil->IsValid())
pSfr->Subtract( *pSfrSil) ;
}
}
else if ( it->bPlaneZStep && ! IsNull( pSfrSil) && pSfrSil->IsValid()) {
PtrOwner<ISurfFlatRegion> pSfrRef( CloneSurfFlatRegion( it->pSfrRemoved)) ;
@@ -2021,8 +2006,11 @@ SurfRoughing::ProcessPath( int nPathId, int nPvId, int nClId)
if ( bSfrCorner) {
PtrOwner<ISurfFlatRegion> pSfrCorner( GetSfrCornerColl( pSfr, pSfrLimit, pSfrColl, pSfrSearchCorners)) ;
if ( ! IsNull( pSfrCorner) && pSfrCorner->IsValid()) {
it->pSfrCorn = CreateSurfFlatRegion() ;
it->pSfrCorn->CopyFrom( pSfrCorner) ;
pSfr->Add( *pSfrCorner) ;
if ( ! ChooseCloseOrOpenEdge( pSfr, pSfrOpenClose)) {
m_pMchMgr->SetLastError( 3026, "Error in SurfRoughing : Detecting open edges failed") ;
return false ;
}
}
}
@@ -2837,8 +2825,8 @@ SurfRoughing::GetSfrCornerColl( ISurfFlatRegion* pSfr, const ISurfFlatRegion* pS
// rimuovo la regione da non rovinare, ho esteso i lati aperti mediante Offset semplice,
// devo controllare di non rovinare altre regioni
// regolarizzo la superficie
pSfrExtra->Offset( - m_TParams.m_dDiam / 8., ICurve::OFF_FILLET) ;
pSfrExtra->Offset( m_TParams.m_dDiam / 8., ICurve::OFF_FILLET) ;
pSfrExtra->Offset( - m_TParams.m_dDiam / 8., ICurve::OFF_FILLET) ;
if ( ! pSfrExtra->Subtract( *pSfrLimit))
return nullptr ;
#if ENABLE_DEBUG_REMOVED_REGION
@@ -2846,9 +2834,6 @@ SurfRoughing::GetSfrCornerColl( ISurfFlatRegion* pSfr, const ISurfFlatRegion* pS
m_pGeomDB->SetMaterial( _nIdExtraSfr, FUCHSIA) ;
#endif
// bisogna ricalcolare i lati aperti/chiusi in base alle nuove modifica della superficie
return ( Release( pSfrExtra)) ;
}
@@ -4825,7 +4810,7 @@ SurfRoughing::GetHomogeneousParts( const ICurveComposite* pCrvCompo, ICRVCOMPOPO
//----------------------------------------------------------------------------
void
SurfRoughing::DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bUniform, Color Col, bool bAlphaCoverage,
string sName)
string sName) const
{
if ( pSfr == nullptr || ! pSfr->IsValid())
return ;
@@ -4856,7 +4841,7 @@ SurfRoughing::DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bUniform, Color C
//----------------------------------------------------------------------------
void
SurfRoughing::DrawFeed( const ICurve* pCrv, double dFeed)
SurfRoughing::DrawFeed( const ICurve* pCrv, double dFeed) const
{
if ( pCrv == nullptr)
return ;
@@ -4871,7 +4856,7 @@ SurfRoughing::DrawFeed( const ICurve* pCrv, double dFeed)
//----------------------------------------------------------------------------
void
SurfRoughing::DrawNormalShaderSurfTm( const ISurfTriMesh* pStm, string sName)
SurfRoughing::DrawNormalShaderSurfTm( const ISurfTriMesh* pStm, string sName) const
{
if ( pStm == nullptr || ! pStm->IsValid())
return ;
+6 -8
View File
@@ -41,14 +41,13 @@ typedef std::vector<PathInfoSR> PATHINFOSRVECTOR ;
struct StepInfoSRTmp {
StepInfoSRTmp( void)
: nIndRef( -1), dDepth( 0), bSubStep( false), bPlaneZStep( false), dPercFeed( 0.),
pSfrRemoved( nullptr), pSfrPlaneZ( nullptr), pSfrCorn( nullptr) {}
StepInfoSRTmp( int nIR, double dD, bool bSS, bool bPZ, double dPF, ISurfFlatRegion* pSR, ISurfFlatRegion* pSPZ, ISurfFlatRegion* pSC)
pSfrRemoved( nullptr), pSfrPlaneZ( nullptr) {}
StepInfoSRTmp( int nIR, double dD, bool bSS, bool bPZ, double dPF, ISurfFlatRegion* pSR, ISurfFlatRegion* pSPZ)
: nIndRef( nIR), dDepth( dD), bSubStep( bSS), bPlaneZStep( bPZ), dPercFeed( dPF),
pSfrRemoved( pSR), pSfrPlaneZ( pSPZ), pSfrCorn( pSC) {}
pSfrRemoved( pSR), pSfrPlaneZ( pSPZ) {}
~StepInfoSRTmp() {
delete( pSfrRemoved) ;
delete( pSfrPlaneZ) ;
delete( pSfrCorn) ;
}
int nIndRef ; // ( usato solo per step intermedi ) posizione step precedente
double dDepth ; // profondità posizione piano di svuotatura ( in negativo)
@@ -57,7 +56,6 @@ struct StepInfoSRTmp {
double dPercFeed ; // percentuale degli extra steps relativa agli step base ( per Feed ZLoc)
ISurfFlatRegion* pSfrRemoved ; // regione PROGRESSIVA rimossa attuale
ISurfFlatRegion* pSfrPlaneZ ; // regione individuata da PlaneZDetection
ISurfFlatRegion* pSfrCorn ; // regione non svutata per presenza di lati chiusi definiti da tavola/ventose
} ;
// vettore associato
typedef std::vector<StepInfoSRTmp> STEPINFOTMPSRVECTOR ;
@@ -271,9 +269,9 @@ class SurfRoughing : public Machining
return m_Params.m_nLeadOutType ; }
/* debug functions */
void DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bWithSurf, Color Col, bool bAlphaCoverage, std::string sName) ;
void DrawFeed( const ICurve* pCrv, double dFeed) ;
void DrawNormalShaderSurfTm( const ISurfTriMesh* pStm, std::string sName) ;
void DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bWithSurf, Color Col, bool bAlphaCoverage, std::string sName) const ;
void DrawFeed( const ICurve* pCrv, double dFeed) const ;
void DrawNormalShaderSurfTm( const ISurfTriMesh* pStm, std::string sName) const ;
/* end debug functions */
private :