EgtMachKernel :

- in PocketingNT piccolo miglioramento per i punti iniziali della svuotature.
This commit is contained in:
Riccardo Elitropi
2025-10-08 09:15:34 +02:00
parent 043a2043aa
commit d83ea12f1f
2 changed files with 67 additions and 2 deletions
+65 -1
View File
@@ -2203,7 +2203,66 @@ PocketingNT::GetSfrRawProjection( const ISurfTriMesh* pStmRaw, const ISurfFlatRe
//----------------------------------------------------------------------------
Point3d
PocketingNT::GetStartPointsFromSteps( const STEPINFOPOVECTOR& vStepInfo, int nCrvType)
PocketingNT::GetStartPointsByHead( const STEPINFOPOVECTOR& vStepInfo) const
{
// se non ho step, allora non ho un punto di riferimento
if ( vStepInfo.empty())
return P_INVALID ;
// sull'ultimo Step ( quindi sulla geometria più simile a quella originaria) cerco il tratto aperto più lungo
// ( inteso come media tra gli aperti sui Chunks)
// recupero la prima regione valida a partire dalla più profonda
auto it = vStepInfo.rbegin() ;
for ( ; it != vStepInfo.rend() ; ++ it) {
if ( ( *it).pSfrPock != nullptr && ( *it).pSfrPock->IsValid() &&
( *it).pSfrPock->GetChunkCount() > 0)
break ;
}
// recupero la regione
const ISurfFlatRegion* pSfr = ( *it).pSfrPock ;
if ( pSfr == nullptr || ! pSfr->IsValid() || pSfr->GetChunkCount() == 0)
return P_INVALID ;
// dichiaro il nuovo punto per la possibile entrata
double dZGlob = ( m_bAboveHead ? - INFINITO : INFINITO) ;
Point3d ptRef = P_INVALID ;
// controllo se sono presenti dei lati aperti
for ( int nC = 0 ; nC < pSfr->GetChunkCount() ; ++ nC) {
for ( int nL = 0 ; nL < pSfr->GetLoopCount( nC) ; ++ nL) {
// recupero il Loop
PtrOwner<ICurveComposite> pCompoLoop( ConvertCurveToComposite( pSfr->GetLoop( nC, nL))) ;
if ( IsNull( pCompoLoop) || ! pCompoLoop->IsValid())
return P_INVALID ;
// scorro le sue curve
for ( int nU = 0 ; nU < pCompoLoop->GetCurveCount() ; ++ nU) {
const ICurve* pCrv = pCompoLoop->GetCurve( nU) ;
if ( pCrv == nullptr || ! pCrv->IsValid())
return P_INVALID ;
if ( pCrv->GetTempProp( 0) == TEMP_PROP_OPEN_EDGE) {
// calcolo il Box globale della curva e memorizzo la componente Z ( media)
BBox3d BBoxGlob ;
if ( pCrv->GetLocalBBox( BBoxGlob)) {
if ( m_bAboveHead && BBoxGlob.GetMax().z > dZGlob) {
ptRef = ( BBoxGlob.GetMin() + BBoxGlob.GetDimZ() * Z_AX + BBoxGlob.GetMax()) / 2. ;
dZGlob = ptRef.z ;
}
else if ( ! m_bAboveHead && BBoxGlob.GetMin().z < dZGlob) {
ptRef = ( BBoxGlob.GetMin() + BBoxGlob.GetMax() - BBoxGlob.GetDimZ() * Z_AX) / 2. ;
dZGlob = ptRef.z ;
}
}
}
}
}
}
return ptRef ;
}
//----------------------------------------------------------------------------
Point3d
PocketingNT::GetStartPointsFromSteps( const STEPINFOPOVECTOR& vStepInfo, int nCrvType) const
{
// se non ho step, allora non ho un punto di riferimento
if ( vStepInfo.empty())
@@ -3944,10 +4003,15 @@ PocketingNT::CalcPaths( STEPINFOPOVECTOR& vStepInfo)
// del percorso successivo)
Point3d ptStartRef = P_INVALID ;
if ( m_TParams.m_dDiam / 2. > TOOL_RAD_PTSTART - EPS_ZERO) {
// per utensili grandi
ptStartRef = GetStartPointsFromSteps( vStepInfo, TEMP_PROP_OPEN_EDGE) ;
if ( ! ptStartRef.IsValid())
ptStartRef = GetStartPointsFromSteps( vStepInfo, TEMP_PROP_CLOSE_EDGE) ;
}
else {
// per teste da sopra/ da sotto
ptStartRef = GetStartPointsByHead( vStepInfo) ;
}
// recupero flag per casi ottimizzati
double dMaxOptSize = m_Params.m_dSideStep ;
GetValInNotes( m_Params.m_sUserNotes, UN_MAXOPTSIZE, dMaxOptSize) ;
+2 -1
View File
@@ -114,7 +114,8 @@ class PocketingNT : public Machining
ISurfTriMesh* GetExtrusionStm( const ISurfFlatRegion* pSfr, const Vector3d& vtExtr) ;
ISurfFlatRegion* GetSfrByStmIntersection( const IntersParPlanesSurfTm& IPPStm, double dDist, double dSmallOffs = 0) ;
ISurfFlatRegion* GetSfrRawProjection( const ISurfTriMesh* pStmRaw, const ISurfFlatRegion* pSfr, const Vector3d& vtTool) ;
Point3d GetStartPointsFromSteps( const STEPINFOPOVECTOR& vStepInfo, int nCrvType) ;
Point3d GetStartPointsByHead( const STEPINFOPOVECTOR& vStepInfo) const ;
Point3d GetStartPointsFromSteps( const STEPINFOPOVECTOR& vStepInfo, int nCrvType) const ;
bool ManageOpenEdges( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStmPart) ;
bool GetHomogeneousParts( const ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vpCrvs) const ;
bool ExtendOpenEdges( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStm) ;