EgtMachKernel :
- prime modifiche per miglior gestione delle lavorazioni in doppio.
This commit is contained in:
+129
@@ -16,6 +16,7 @@
|
||||
#include "DllMain.h"
|
||||
#include "MachMgr.h"
|
||||
#include "Machining.h"
|
||||
#include "OperUserNotesConst.h"
|
||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EGkCurve.h"
|
||||
|
||||
@@ -391,6 +392,134 @@ Machining::ToolPreview( int nEntId, int nStep) const
|
||||
return nEntId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machining::CalcMirrorByDouble( int nClId, const string& sUserNotes)
|
||||
{
|
||||
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
|
||||
return false ;
|
||||
// recupero macchina corrente
|
||||
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
// recupero il gestore DB utensili della macchina corrente
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
if ( pTMgr == nullptr)
|
||||
return false ;
|
||||
|
||||
// verifico se prevista lavorazione in doppio
|
||||
int nDouble ;
|
||||
if ( ! GetValInNotes( sUserNotes, UN_DOUBLE, nDouble) ||
|
||||
( nDouble != 1 && nDouble != 2 && nDouble != 3))
|
||||
return true ;
|
||||
// recupero dati utensile principale
|
||||
string sMainTool ; string sMainHead ; int nMainExit ;
|
||||
if ( ! pMch->GetCurrTool( sMainTool) || ! pMch->GetCurrHead( sMainHead) || ! pMch->GetCurrExit( nMainExit))
|
||||
return false ;
|
||||
// recupero dati utensile in doppio
|
||||
string sDblTool ; string sDblHead ; int nDblExit ; string sDblTcPos ;
|
||||
if ( ! GetValInNotes( GetToolData().m_sUserNotes, "DOUBLE", sDblTool))
|
||||
return false ;
|
||||
if ( ! m_pMchMgr->GetCurrSetupMgr().GetToolData( sDblTool, sDblTcPos, sDblHead, nDblExit)) {
|
||||
const ToolData* pTdata = pTMgr->GetTool( sDblTool) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
sDblHead = pTdata->m_sHead ;
|
||||
nDblExit = pTdata->m_nExit ;
|
||||
}
|
||||
|
||||
// assegno Id entità originali
|
||||
int nPathId = m_pGeomDB->GetFirstNameInGroup( nClId, MCH_PATH + "*") ;
|
||||
while ( nPathId != GDB_ID_NULL) {
|
||||
int nEntId = m_pGeomDB->GetFirstInGroup( nPathId) ;
|
||||
while ( nEntId != GDB_ID_NULL) {
|
||||
string sName ;
|
||||
if ( ! m_pGeomDB->GetName( nEntId, sName) ||
|
||||
( sName != MCH_CL_CLIMB && sName != MCH_CL_RISE && sName != MCH_CL_HOME))
|
||||
m_pGeomDB->SetInfo( nEntId, KEY_DBL_MAIN, nEntId) ;
|
||||
nEntId = m_pGeomDB->GetNext( nEntId) ;
|
||||
}
|
||||
nPathId = m_pGeomDB->GetNextName( nPathId, MCH_PATH + "*") ;
|
||||
}
|
||||
|
||||
// copio gruppo di lavorazione e cambio nome
|
||||
int nDblId = m_pGeomDB->Copy( nClId, GDB_ID_NULL, nClId, GDB_AFTER) ;
|
||||
if ( nDblId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_pGeomDB->SetName( nDblId, MCH_DBL) ;
|
||||
// assegno colore di copia
|
||||
int nClPathId = m_pGeomDB->GetFirstGroupInGroup( nDblId) ;
|
||||
while ( nClPathId != GDB_ID_NULL) {
|
||||
m_pGeomDB->SetMaterial( nClPathId, GRAY) ;
|
||||
nClPathId = m_pGeomDB->GetNextGroup( nClPathId) ;
|
||||
}
|
||||
// assegno Id entità double
|
||||
nPathId = m_pGeomDB->GetFirstNameInGroup( nDblId, MCH_PATH + "*") ;
|
||||
while ( nPathId != GDB_ID_NULL) {
|
||||
int nEntId = m_pGeomDB->GetFirstInGroup( nPathId) ;
|
||||
while ( nEntId != GDB_ID_NULL) {
|
||||
int nMainEntId ;
|
||||
if ( m_pGeomDB->GetInfo( nEntId, KEY_DBL_MAIN, nMainEntId)) {
|
||||
m_pGeomDB->RemoveInfo( nMainEntId, KEY_DBL_MAIN) ;
|
||||
m_pGeomDB->SetInfo( nMainEntId, KEY_CL_DOUBLE, nEntId) ;
|
||||
}
|
||||
nEntId = m_pGeomDB->GetNext( nEntId) ;
|
||||
}
|
||||
nPathId = m_pGeomDB->GetNextName( nPathId, MCH_PATH + "*") ;
|
||||
}
|
||||
|
||||
// determino posizione del piano di mirroring
|
||||
BBox3d b3Raw ;
|
||||
Point3d ptOn ;
|
||||
if ( ! GetCurrRawsGlobBox( b3Raw) || ! b3Raw.GetCenter( ptOn))
|
||||
return false ;
|
||||
Vector3d vtNorm ;
|
||||
switch ( nDouble) {
|
||||
case 1 : vtNorm = X_AX ; break ;
|
||||
case 2 : vtNorm = Y_AX ; break ;
|
||||
case 3 : vtNorm = Z_AX ; break ;
|
||||
}
|
||||
double dPlanePos ;
|
||||
if ( GetValInNotes( sUserNotes, UN_MIRRORAX, dPlanePos))
|
||||
ptOn = b3Raw.GetMin() + dPlanePos * vtNorm ;
|
||||
|
||||
// eseguo mirroring rispetto a piano opportuno
|
||||
nPathId = m_pGeomDB->GetFirstNameInGroup( nDblId, MCH_PATH + "*") ;
|
||||
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) ;
|
||||
}
|
||||
nPathId = m_pGeomDB->GetNextName( nPathId, MCH_PATH + "*") ;
|
||||
}
|
||||
|
||||
// se presente una differenza in Z, eseguo spostamento
|
||||
double dDeltaZ ;
|
||||
if ( GetValInNotes( sUserNotes, UN_DELTAZ, dDeltaZ) && abs( dDeltaZ) > EPS_SMALL)
|
||||
m_pGeomDB->TranslateGlob( nDblId, Vector3d( 0, 0, dDeltaZ)) ;
|
||||
|
||||
// elimino approcci e retrazioni (CLIMB e RISE)
|
||||
RemoveClimbRiseHome( false) ;
|
||||
|
||||
// imposto testa in doppio
|
||||
if ( ! pMch->SetCurrTool( sDblTool, sDblHead, nDblExit))
|
||||
return false ;
|
||||
|
||||
// calcolo gli assi macchina
|
||||
string sHint = ExtractHint( sUserNotes) ;
|
||||
string sInitAngs ;
|
||||
if ( GetParam( MPA_INITANGS, sInitAngs) && ! sInitAngs.empty())
|
||||
sHint = sInitAngs ;
|
||||
if ( ! CalculateDoubleAxesValues( sHint))
|
||||
return false ;
|
||||
|
||||
// ripristino testa principale
|
||||
pMch->SetCurrTool( sMainTool, sMainHead, nMainExit) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machining::ActivateDrillingUnit( int nHeadId, const INTVECTOR& vActExit) const
|
||||
|
||||
Reference in New Issue
Block a user