EgtMachKernel :

- a fresatura aggiunta gestione lista di curve per FaceUse tramite "EdgesFaceUse" con valori a vettore di interi in UserNotes
- in tutte le lavorazioni sistemato ricalcolo con stato con bit MCH_ST_GEO_MODIF impostato
- in tutte le lavorazioni SetGeometry imposta bit MCH_ST_GEO_MODIF solo se gli Id e i SubId delle geometrie sono effettivamente variati.
This commit is contained in:
Dario Sassi
2025-04-07 11:54:28 +02:00
parent c944dd9893
commit ef28db40e1
16 changed files with 210 additions and 80 deletions
+28 -20
View File
@@ -48,6 +48,17 @@
using namespace std ;
//------------------------------ Constants ------------------------------------
static string KEY_OPEN = "OPEN" ;
static string KEY_THICK = "THICK" ;
static int LINK_CURVE_PROP = -3 ;
// Parametri avanzati da UserNotes
const string UN_MAXELEV = "MaxElev" ;
const string UN_OPEN = "Open" ;
const string UN_OPENOUTRAW = "OpenOutRaw" ;
const string UN_OPENMINSAFE = "OpenMinSafe" ;
const string UN_OPENEXTENSION = "OpenExtension" ;
//------------------------------ Errors --------------------------------------
// 2401 = "Error in PocketingNT : UpdateToolData failed"
// 2402 = "Error in PocketingNT : Open Contour"
@@ -91,11 +102,6 @@ using namespace std ;
// 2458 = "Warning in PocketingNT : machining depth (xxx) bigger than MaxMaterial (yyy)"
// 2459 = "Warning in PocketingNT : Steps too far away from Raw"
//----------------------------------------------------------------------------
static string KEY_OPEN = "OPEN" ;
static string KEY_THICK = "THICK" ;
static int LINK_CURVE_PROP = -3 ;
//----------------------------------------------------------------------------
// _debug
#define DEBUG_OPEN_EDGE_EXTENSION 0
@@ -523,7 +529,8 @@ PocketingNT::SetGeometry( const SELVECTOR& vIds)
// verifico validità gestore DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
// reset della geometria corrente
// copia temporanea e reset della geometria corrente
SELVECTOR vOldId = m_vId ;
m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
int nType = GEO_NONE ;
@@ -539,7 +546,8 @@ PocketingNT::SetGeometry( const SELVECTOR& vIds)
m_vId.emplace_back( Id) ;
}
// aggiorno lo stato
m_nStatus |= MCH_ST_GEO_MODIF ;
if ( m_vId != vOldId)
m_nStatus |= MCH_ST_GEO_MODIF ;
// restituisco presenza geometria da lavorare
return ( ! m_vId.empty() || vIds.empty()) ;
}
@@ -645,6 +653,10 @@ PocketingNT::Apply( bool bRecalc, bool bPostApply)
return false ;
}
// se modificata geometria, necessario ricalcolo
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
bRecalc = true ;
// verifico se necessario continuare nell'aggiornamento
if ( ! bRecalc && ! bToolChanged &&
( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
@@ -1256,7 +1268,7 @@ PocketingNT::GetCurves( SelData Id, ICURVEPLIST& lstPC)
// la porto in globale
pCrvCompo->ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, 0) ;
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, {}, 0) ;
// la restituisco
if ( m_bAllClose)
ResetCurveAllTempProp( pCrvCompo) ;
@@ -1297,7 +1309,7 @@ PocketingNT::GetCurves( SelData Id, ICURVEPLIST& lstPC)
// la porto in globale
pCrvCompo->ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, 0) ;
AdjustCurveFromSurf( pCrvCompo, TOOL_ORTHO, FACE_CONT, V_NULL, {}, 0) ;
// la restituisco
lstPC.emplace_back( Release( pCrvCompo)) ;
}
@@ -1402,8 +1414,7 @@ PocketingNT::Chain( int nGrpDestId)
// vettore selettori delle curve originali
SELVECTOR vInds ;
// flag per imposizione lati chiusi
m_bAllClose = false ;
GetValInNotes( m_Params.m_sUserNotes, "bAllClose", m_bAllClose) ;
m_bAllClose = GetForcedClosed() ;
// recupero tutte le curve e le porto in globale
for ( const auto& Id : m_vId) {
// prendo le curve
@@ -1895,9 +1906,9 @@ PocketingNT::ExtendOpenEdgesToRaw( ICurveComposite* pCompo, const Vector3d& vtEx
#endif
// definisco offset di estensione per tratti aperti
double dOffs = 0 ;
m_dOpenExtension = 0 ;
GetValInNotes( m_Params.m_sUserNotes, "OpenExtension", m_dOpenExtension) ;
GetValInNotes( m_Params.m_sUserNotes, UN_OPENEXTENSION, m_dOpenExtension) ;
double dOffs = 0 ;
if ( m_dOpenExtension < EPS_SMALL)
dOffs = max( BBoxRawCut.GetDimX(), BBoxRawCut.GetDimY()) + m_TParams.m_dDiam ;
else
@@ -2285,7 +2296,7 @@ PocketingNT::ProcessPath( int nPathId, int nPvId, int nClId)
}
// eventuale imposizione massima elevazione da note utente
double dMaxElev ;
if ( GetValInNotes( m_Params.m_sUserNotes, "MaxElev", dMaxElev) && dElev > dMaxElev)
if ( GetValInNotes( m_Params.m_sUserNotes, UN_MAXELEV, dMaxElev) && dElev > dMaxElev)
dElev = dMaxElev ;
// verifico che lo step dell'utensile sia sensato
@@ -2376,11 +2387,11 @@ PocketingNT::ProcessPath( int nPathId, int nPvId, int nClId)
// recupero eventuale flag di lato aperto forzato fuori dal grezzo
int nOpenOutRaw ;
m_bOpenOutRaw = ( GetValInNotes( m_Params.m_sUserNotes, "OpenOutRaw", nOpenOutRaw) && nOpenOutRaw != 0) ;
m_bOpenOutRaw = ( GetValInNotes( m_Params.m_sUserNotes, UN_OPENOUTRAW, nOpenOutRaw) && nOpenOutRaw != 0) ;
// recupero eventuale minima lunghezza di attacco su lato aperto
m_dOpenMinSafe = 5. ;
GetValInNotes( m_Params.m_sUserNotes, "OpenMinSafe", m_dOpenMinSafe) ;
GetValInNotes( m_Params.m_sUserNotes, UN_OPENMINSAFE, m_dOpenMinSafe) ;
// se richiesta anteprima
if ( nPvId != GDB_ID_NULL) {
@@ -3747,10 +3758,7 @@ bool
PocketingNT::GetForcedClosed( void)
{
int nOpen ;
if ( GetValInNotes( m_Params.m_sUserNotes, "Open", nOpen) && nOpen == 0)
return true ;
else
return false ;
return ( GetValInNotes( m_Params.m_sUserNotes, UN_OPEN, nOpen) && nOpen == 0) ;
}
//----------------------------------------------------------------------------