EgtMachKernel (Preview) :

- in Drilling in doppio aggiunta nuova gestione per punte in opposizione e aggiunta gestione della realtiva preview.
- correzioni varie.
This commit is contained in:
Riccardo Elitropi
2026-03-03 17:10:23 +01:00
parent 9005ea481f
commit 5801b85a31
3 changed files with 119 additions and 27 deletions
+58 -17
View File
@@ -596,14 +596,22 @@ Machining::PrepareToolPreview()
RemoveToolPreview() ;
return false ;
}
m_pGeomDB->SetName( nStdIdDBL, MCH_ST_DBL) ;
m_pGeomDB->SetLevel( nStdIdDBL, GDB_LV_TEMP) ;
}
m_pGeomDB->SetName( nStdIdDBL, MCH_ST_DBL) ;
m_pGeomDB->SetLevel( nStdIdDBL, GDB_LV_TEMP) ;
}
// altrimenti lo svuoto
else
m_pGeomDB->EmptyGroup( nStdIdDBL) ;
// reset delle variabili membro
m_nPreviewHeadId = GDB_ID_NULL ;
m_nPreviewHeadIdDBL = GDB_ID_NULL ;
m_nPreviewToolTip = GDB_ID_NULL ;
m_nPreviewToolTipDBL = GDB_ID_NULL ;
m_vPreviewAxisIds.clear() ;
m_vPreviewAxisIdsBBL.clear() ;
// preparo l'anteprima per il gruppo ST
bool bOk = true ;
if ( nStId != GDB_ID_NULL) {
@@ -740,16 +748,8 @@ Machining::GetToolPreviewNext( int nEntId, int nParentId, int nStId) const
//----------------------------------------------------------------------------
int
Machining::GetToolPreviewPrev( int nEntId, int nParentId, int nStId) /*const*/
Machining::GetToolPreviewPrev( int nEntId, int nParentId, int nStId) const
{
if ( m_nLookFlag == MCH_LOOK_TAB_HEAD)
ChangeToolPreviewShow( MCH_LOOK_TAB_TOOL) ;
else if ( m_nLookFlag == MCH_LOOK_TAB_TOOL)
ChangeToolPreviewShow( MCH_LOOK_NONE) ;
else
ChangeToolPreviewShow( MCH_LOOK_TAB_HEAD) ;
// recupero la precedente
int nNewId = ( ( nEntId != GDB_ID_NULL) ? m_pGeomDB->GetPrev( nEntId) : m_pGeomDB->GetLastInGroup( nParentId)) ;
int nNewParentId = nParentId ;
@@ -781,7 +781,7 @@ Machining::GetToolPreviewPrev( int nEntId, int nParentId, int nStId) /*const*/
//----------------------------------------------------------------------------
bool
Machining::MyToolPreview( int nEntId, bool bDouble)
Machining::MyToolPreview( int nEntId, bool bDouble) const
{
// verifico validità gestori DB geometrico e CAM
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
@@ -829,7 +829,7 @@ Machining::MyToolPreview( int nEntId, bool bDouble)
}
// scorro gli assi dentro al gruppo "ST" ( considero solo quelli rotativi)
INTVECTOR& vCurrPreviewAxisIds = ( ! bDouble ? m_vPreviewAxisIds : m_vPreviewAxisIdsBBL) ;
const INTVECTOR& vCurrPreviewAxisIds = ( ! bDouble ? m_vPreviewAxisIds : m_vPreviewAxisIdsBBL) ;
for ( auto Iter = vCurrPreviewAxisIds.begin() ; Iter != vCurrPreviewAxisIds.end() ; ++ Iter) {
// recupero l'Id dell'asse corrente
int nAxisId = *Iter ;
@@ -885,7 +885,7 @@ Machining::MyToolPreview( int nEntId, bool bDouble)
//----------------------------------------------------------------------------
int
Machining::ToolPreview( int nEntId, int nStep) /*const*/
Machining::ToolPreview( int nEntId, int nStep) const
{
// verifico validità gestori DB geometrico e CAM
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
@@ -997,7 +997,7 @@ Machining::GetDoubleType( const string& sUserNotes)
//----------------------------------------------------------------------------
bool
Machining::GetDoubleToolData( string& sDblTool, string& sDblHead, int& nDblExit)
Machining::GetDoubleToolData( string& sDblTool, string& sDblHead, int& nDblExit) const
{
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
return false ;
@@ -1091,8 +1091,49 @@ Machining::CalcMirrorByDouble( int nClId, const string& sUserNotes)
while ( nPathId != GDB_ID_NULL) {
int nEntId = m_pGeomDB->GetFirstInGroup( nPathId) ;
while ( nEntId != GDB_ID_NULL) {
m_pGeomDB->Mirror( nEntId, ptOn, vtNorm) ;
nEntId = m_pGeomDB->GetNext( nEntId) ;
string sName ; m_pGeomDB->GetName( nEntId, sName) ;
// nel caso di fuorature in doppio, il movimento deve essere sincronizzato
if ( sName == MCH_CL_DBP) {
INTVECTOR vSyncEntId ;
do {
vSyncEntId.push_back( nEntId) ;
nEntId = m_pGeomDB->GetNext( nEntId) ;
sName.clear() ;
m_pGeomDB->GetName( nEntId, sName) ;
} while ( sName == MCH_CL_DBP) ;
Vector3d vtRef ;
bool bOk = true ;
for ( int i = 0 ; bOk && i < ssize( vSyncEntId) ; ++ i) {
// curva corrente di sincronizzazione
const ICurve* pCrv = GetCurve( m_pGeomDB->GetGeoObj( vSyncEntId[i])) ;
bOk = ( pCrv != nullptr && pCrv->IsValid()) ;
if ( bOk) {
if ( i == 0) {
Point3d ptS ; pCrv->GetStartPoint( ptS) ;
Point3d ptE ; pCrv->GetEndPoint( ptE) ;
Point3d ptSMirror = ptS ; ptSMirror.Mirror( ptOn, vtNorm) ;
vtRef = ( ptSMirror - ptS) ;
}
m_pGeomDB->Translate( vSyncEntId[i], vtRef) ;
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( vSyncEntId[i])) ;
bOk = ( pCamData != nullptr) ;
if ( bOk) {
Vector3d vtTool = pCamData->GetToolDir() ;
vtTool.Mirror( vtNorm) ;
pCamData->SetToolDir( vtTool) ;
}
}
}
if ( ! bOk) {
m_pGeomDB->Erase( nPathId) ;
return false ;
}
}
// per tutti gli altri casi si fa il mirror
else {
m_pGeomDB->Mirror( nEntId, ptOn, vtNorm) ;
nEntId = m_pGeomDB->GetNext( nEntId) ;
}
}
nPathId = m_pGeomDB->GetNextName( nPathId, MCH_PATH + "*") ;
}