EgtMachKernel :

- conservazione temp prop in Operation per curve.
- migliorie intersezioni trimesh con piano.
This commit is contained in:
Riccardo Elitropi
2023-06-26 13:36:36 +02:00
parent 2c501206b2
commit ccac200e41
3 changed files with 29 additions and 8 deletions
+7
View File
@@ -1345,6 +1345,9 @@ Operation::ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp)
pCompo->GetExtrusion( vtExtr) ;
double dThick = 0 ;
pCompo->GetThickness( dThick) ;
// recupero le proprietà temporanee
int nProp0 = pCompo->GetTempProp( 0) ;
int nProp1 = pCompo->GetTempProp( 1) ;
// verifico se ci sono tante linee corte
int nSmallLineCnt = 0 ;
const ICurve* pCrv = pCompo->GetFirstCurve() ;
@@ -1440,6 +1443,10 @@ Operation::ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp)
pCompo->SetExtrusion( vtExtr) ;
pCompo->SetThickness( dThick) ;
// riassegno le proprietà temporanee
pCompo->SetTempProp( nProp0, 0) ;
pCompo->SetTempProp( nProp1, 1) ;
return true ;
}
+20 -6
View File
@@ -9370,6 +9370,8 @@ Pocketing::AdaptSfrWithRaw( ISurfFlatRegion* pSrf, Vector3d vtTrasl, ICRVCOMPOPO
if ( m_bIntersRaw) {
if ( ! IntersSurfWithRaw( pSrf, pStmRaw, vtTrasl, bChanged, 500 * EPS_SMALL, true, m_dDiam_Prec < EPS_SMALL))
return false ;
if ( pSrf->GetChunkCount() == 0 || ! pSrf->IsValid())
return true ;
int b = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pSrf->Clone()) ;
m_pGeomDB->SetMaterial( b, BROWN) ;
}
@@ -9377,6 +9379,8 @@ Pocketing::AdaptSfrWithRaw( ISurfFlatRegion* pSrf, Vector3d vtTrasl, ICRVCOMPOPO
if ( m_bProjectRaw) {
if ( ! ProjectRaw( pSrf, vtTrasl, pStmRaw))
return false ;
if ( pSrf->GetChunkCount() == 0 || ! pSrf->IsValid())
return true ;
int o = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pSrf->Clone()) ;
m_pGeomDB->SetMaterial( o, ORANGE) ;
}
@@ -9565,8 +9569,8 @@ Pocketing::IntersSurfWithRaw( ISurfFlatRegion* pSfrPock, const ISurfTriMesh* pSt
return true ;
}
//int o = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pStm->Clone()) ;
//m_pGeomDB->SetMaterial( o, ORANGE) ;
int A = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pStm->Clone()) ;
m_pGeomDB->SetMaterial( A, AQUA) ;
// calcolo la nuova area e la confronto con la precedente ( capisco se la superificie è cambiata o meno)
double dAreaAfter = 0 ;
@@ -10282,11 +10286,15 @@ Pocketing::GetProjStmBoxOnSfr( const ISurfFlatRegion* pSfr, const ISurfTriMesh*
// creo la trimesh del box globale del grezzo e la taglio con il piano
PtrOwner<ISurfTriMesh> pStmRawBox( GetSurfTriMeshBox( b3Raw.GetDimX(), b3Raw.GetDimY(), b3Raw.GetDimZ())) ;
if( IsNull( pStmRawBox) || ! pStmRawBox->IsValid())
if ( IsNull( pStmRawBox) || ! pStmRawBox->IsValid())
return false ;
pStmRawBox->Translate( b3Raw.GetMin() - ORIG) ; // è creata con ptMin nell'origine ( alla funzione passo le dimensioni )
if( ! pStmRawBox->Cut( plProj, true))
pStmRawBox->Translate( b3Raw.GetMin() - ORIG) ; // è creata con ptMin nell'origine ( alla funzione passo le dimensioni)
if ( ! pStmRawBox->Cut( plProj, true))
return false ;
if ( ! pStmRawBox->IsValid() || pStmRawBox->GetTriangleCount() == 0) {
pSfrRawBoxProj->Clear() ;
return true ;
}
// creo una Regione piana a partire da tutte le curve
PtrOwner<ISurfFlatRegion> pSfrProj( CreateSurfFlatRegion()) ;
@@ -10315,7 +10323,7 @@ Pocketing::GetProjStmBoxOnSfr( const ISurfFlatRegion* pSfr, const ISurfTriMesh*
}
}
pSfrRawBoxProj->Clear() ;
pSfrRawBoxProj->Clear() ;
pSfrRawBoxProj->CopyFrom( pSfrProj) ;
return pSfrRawBoxProj->Invert() && pSfrRawBoxProj->IsValid() && pSfrRawBoxProj->GetChunkCount() > 0 ;
@@ -10355,6 +10363,10 @@ Pocketing::ProjectRaw( ISurfFlatRegion* pSrf, const Vector3d& vtTrasl,
PtrOwner<ISurfFlatRegion> pSrfOnPlPlus( CreateSurfFlatRegion()) ;
if ( IsNull( pSrfOnPlPlus) || ! GetProjStmBoxOnSfr( pSrf, pStmRaw, pSrfOnPlPlus))
return false ;
if ( IsNull( pSrfOnPlPlus) || ! pSrfOnPlPlus->IsValid()) {
pSrf->Clear() ;
return true ;
}
// recupero estrusione e spessore
PtrOwner<ICurve> pCrvEL( pSrf->GetLoop( 0, 0)) ;
@@ -11815,6 +11827,8 @@ Pocketing::AssignFeedSpiral( ICurveComposite* pCrv, const ISurfFlatRegion* pSrfR
for ( int i = 0 ; i < ( int)ccClass.size() ; ++ i) {
double dCurrFeed = GetMinFeed() ;
PtrOwner<ICurveComposite> PCrv_sez( GetCurveComposite( pCrv->CopyParamRange( ccClass[i].dParS, ccClass[i].dParE))) ;
if ( IsNull( PCrv_sez))
continue ;
if ( ccClass[i].nClass == CRVC_IN)
dCurrFeed = GetMaxFeed() ;
+2 -2
View File
@@ -317,8 +317,8 @@ class Pocketing : public Machining
bool m_bOptOffset = true ; // flag per ottimizzazione numero di Offset necessari
bool m_bOptOffsetCM = false ; // flag per ottimizzazione numero di Offset necessari con centroidi e medial Axis
bool m_bAssignFeed = true ; // flag per controllo della Feed
double m_dDiam_Prec = 70.0 ; // diametro utensile per precedente svuotatura
double m_dDiam_Prec = 0.0 ; // diametro utensile per precedente svuotatura
double m_dOffsetR_Prec = 0.0 ; // offset radiale della svuotatura precedente
double m_dSideStep_Prec = 50.0 ; // side Step della svuotatura precedente
double m_dSideStep_Prec = 0.0 ; // side Step della svuotatura precedente
} ;