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
+47 -13
View File
@@ -49,6 +49,13 @@ const double OSC_MIN_LEN = 0.1 ;
const double LIM_DOWN_APPRZ = -0.5 ;
const double DELTA_ELEV_RAD = 4.0 ;
const double LIM_SIN_DIFF_DIR = 0.175 ;
// Parametri avanzati da UserNotes
const string UN_MAXELEV = "MaxElev" ;
const string UN_OUTRAW = "OutRaw" ;
const string UN_SIDEELEV = "SideElev" ;
const string UN_TRIMEXT = "TrimExt" ;
const string UN_VTFACEUSE = "VtFaceUse" ;
const string UN_EDGESFACEUSE = "EdgesFaceUse" ;
//------------------------------ Errors --------------------------------------
// 2301 = "Error in Milling : UpdateToolData failed"
@@ -377,7 +384,7 @@ Milling::SetParam( int nType, int nVal)
if ( ! m_Params.VerifyFaceUse( nVal))
return false ;
if ( nVal != m_Params.m_nFaceUse)
m_nStatus |= MCH_ST_PARAM_MODIF ;
m_nStatus |= ( MCH_ST_PARAM_MODIF | MCH_ST_GEO_MODIF) ;
m_Params.m_nFaceUse = nVal ;
return true ;
}
@@ -576,8 +583,17 @@ Milling::SetParam( int nType, const string& sVal)
m_Params.m_sSysNotes = sVal ;
return true ;
case MPA_USERNOTES :
if ( sVal != m_Params.m_sUserNotes)
if ( sVal != m_Params.m_sUserNotes) {
m_nStatus |= MCH_ST_PARAM_MODIF ;
Vector3d vtNew ; GetValInNotes( sVal, UN_VTFACEUSE, vtNew) ;
Vector3d vtOri ; GetValInNotes( m_Params.m_sUserNotes, UN_VTFACEUSE, vtOri) ;
if ( ! AreSameVectorApprox( vtNew, vtOri))
m_nStatus |= MCH_ST_GEO_MODIF ;
INTVECTOR vnNew ; GetValInNotes( sVal, UN_EDGESFACEUSE, vnNew) ;
INTVECTOR vnOri ; GetValInNotes( m_Params.m_sUserNotes, UN_EDGESFACEUSE, vnOri) ;
if ( vnNew != vnOri)
m_nStatus |= MCH_ST_GEO_MODIF ;
}
m_Params.m_sUserNotes = sVal ;
return true ;
case MPA_INITANGS :
@@ -601,7 +617,8 @@ Milling::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, tutti testi o tutte facce)
int nType = GEO_NONE ;
@@ -617,7 +634,8 @@ Milling::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()) ;
}
@@ -725,6 +743,10 @@ Milling::Apply( bool bRecalc, bool bPostApply)
}
m_nHeadSolCh = m_pMchMgr->GetCurrMachine()->GetHeadSolCh( m_TParams.m_sHead) ;
// 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)) {
@@ -1376,10 +1398,14 @@ Milling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
nToolDir = TOOL_PARAL ;
int nFaceUse = ( m_Params.m_nFaceUse & 31) ;
Vector3d vtFaceUse ;
if ( GetValInNotes( m_Params.m_sUserNotes, "VtFaceUse", vtFaceUse) && ! vtFaceUse.IsSmall())
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTFACEUSE, vtFaceUse) && ! vtFaceUse.IsSmall())
nFaceUse = FACE_VERSOR ;
INTVECTOR vnEdgesFaceUse ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_EDGESFACEUSE, vnEdgesFaceUse) && ! vnEdgesFaceUse.empty())
nFaceUse = FACE_EDGES ;
double dSawThick = ( ( m_TParams.m_nType & TF_SAWBLADE) != 0 ? m_TParams.m_dThick : 0) ;
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, vtFaceUse, dSawThick) ;
if ( ! AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, vtFaceUse, vnEdgesFaceUse, dSawThick))
return false ;
// la restituisco
lstPC.emplace_back( Release( pCrvCompo)) ;
return true ;
@@ -1404,8 +1430,11 @@ Milling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
nToolDir = TOOL_PARAL ;
int nFaceUse = ( m_Params.m_nFaceUse & 31) ;
Vector3d vtFaceUse ;
if ( GetValInNotes( m_Params.m_sUserNotes, "VtFaceUse", vtFaceUse) && ! vtFaceUse.IsSmall())
if ( GetValInNotes( m_Params.m_sUserNotes, UN_VTFACEUSE, vtFaceUse) && ! vtFaceUse.IsSmall())
nFaceUse = FACE_VERSOR ;
INTVECTOR vnEdgesFaceUse ;
if ( GetValInNotes( m_Params.m_sUserNotes, UN_EDGESFACEUSE, vnEdgesFaceUse) && ! vnEdgesFaceUse.empty())
nFaceUse = FACE_EDGES ;
double dSawThick = ( ( m_TParams.m_nType & TF_SAWBLADE) != 0 ? m_TParams.m_dThick : 0) ;
// determino intervallo di chunk
int nCstart = 0 ;
@@ -1414,6 +1443,10 @@ Milling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
nCstart = Id.nSub ;
nCend = nCstart + 1 ;
}
else if ( nFaceUse == FACE_EDGES) {
nCstart = 0 ;
nCend = nCstart + 1 ;
}
// ciclo sui chunk
for ( int nC = nCstart ; nC < nCend ; ++ nC) {
// recupero i contorni del chunk
@@ -1428,7 +1461,8 @@ Milling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
// la porto in globale
pCrvCompo->ToGlob( frGlob) ;
// sistemazioni varie
AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, vtFaceUse, dSawThick) ;
if ( ! AdjustCurveFromSurf( pCrvCompo, nToolDir, nFaceUse, vtFaceUse, vnEdgesFaceUse, dSawThick))
return false ;
// la restituisco
lstPC.emplace_back( Release( pCrvCompo)) ;
}
@@ -1834,13 +1868,13 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
return false ;
// 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 ;
// eventuale aggiuntivo all'elevazione per l'oscillazione
double dAddElev = ( bPathOscEnable ? abs( m_Params.m_dOscHeight) : 0) ;
// eventuale elevazione di fianco (solo per lama)
double dSideElev = 0 ;
GetValInNotes( m_Params.m_sUserNotes, "SideElev", dSideElev) ;
GetValInNotes( m_Params.m_sUserNotes, UN_SIDEELEV, dSideElev) ;
// verifico che lo step dell'utensile sia sensato
double dOkStep = 0 ;
@@ -1960,7 +1994,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
// recupero eventuale flag di inizio forzato fuori dal grezzo
int nStartOutRaw = 0 ;
GetValInNotes( m_Params.m_sUserNotes, "OutRaw", nStartOutRaw) ;
GetValInNotes( m_Params.m_sUserNotes, UN_OUTRAW, nStartOutRaw) ;
m_bStartOutRaw = (( nStartOutRaw & 1) != 0) ;
m_bEndOutRaw = (( nStartOutRaw & 2) != 0) ;
@@ -3936,7 +3970,7 @@ Milling::AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtT
// recupero eventuale superficie trimesh chiusa per trim/extend
int nTriExtCstm = GDB_ID_NULL ;
int nTesId ;
if ( GetValInNotes( m_Params.m_sUserNotes, "TrimExt", nTesId)) {
if ( GetValInNotes( m_Params.m_sUserNotes, UN_TRIMEXT, nTesId)) {
const ISurfTriMesh* pTes = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nTesId)) ;
if ( pTes != nullptr && pTes->IsClosed())
nTriExtCstm = nTesId ;
@@ -4112,7 +4146,7 @@ Milling::AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtT
// recupero eventuale superficie trimesh chiusa per trim/extend
int nTriExtCstm = GDB_ID_NULL ;
int nTesId ;
if ( GetValInNotes( m_Params.m_sUserNotes, "TrimExt", nTesId)) {
if ( GetValInNotes( m_Params.m_sUserNotes, UN_TRIMEXT, nTesId)) {
const ISurfTriMesh* pTes = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nTesId)) ;
if ( pTes != nullptr && pTes->IsClosed())
nTriExtCstm = nTesId ;