EgtMachKernel 1.6k10 :

- sistemazioni varie in grezzi, lavorazioni, ....
This commit is contained in:
Dario Sassi
2015-12-07 08:03:39 +00:00
parent 5eb5cb387f
commit 42e1a696a1
33 changed files with 1354 additions and 277 deletions
+66 -39
View File
@@ -59,8 +59,6 @@ Drilling::Clone( void) const
// eseguo copia dei dati
if ( pDri != nullptr) {
try {
pDri->m_nOwnerId = GDB_ID_NULL ;
pDri->m_pGeomDB = nullptr ;
pDri->m_Params = m_Params ;
pDri->m_TParams = m_TParams ;
}
@@ -135,8 +133,6 @@ Drilling::Load( const STRVECTOR& vString)
//----------------------------------------------------------------------------
Drilling::Drilling( void)
{
m_nOwnerId = GDB_ID_NULL ;
m_pGeomDB = nullptr ;
m_Params.m_sName = "*" ;
m_Params.m_sToolName = "*" ;
m_TParams.m_sName = "*" ;
@@ -341,7 +337,14 @@ Drilling::Apply( void)
}
// calcolo gli assi macchina
return CalculateAxesValues() ;
if ( ! CalculateAxesValues())
return false ;
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione
if ( ! AdjustStartMovements())
return false ;
return true ;
}
//----------------------------------------------------------------------------
@@ -438,16 +441,40 @@ Drilling::GetHoleData( SelData Id, Hole& hole)
const ICurveArc* pArc = GetCurveArc( m_pGeomDB->GetGeoObj( Id.nId)) ;
if ( pArc == nullptr)
return false ;
// deve avere estrusione e spessore
double dThick ;
Vector3d vtExtr ;
if ( ! pArc->GetThickness( dThick) || ! pArc->GetExtrusion( vtExtr) ||
( dThick * vtExtr).IsSmall ())
return false ;
// ne recupero il riferimento globale
Frame3d frGlob ;
if ( ! m_pGeomDB->GetGlobFrame( Id.nId, frGlob))
return false ;
// deve avere estrusione
Vector3d vtExtr ;
if ( ! pArc->GetExtrusion( vtExtr))
return false ;
// recupero spessore
double dThick = 0 ;
pArc->GetThickness( dThick) ;
// se diretto come asse Z, recupero distanza da fondo dei grezzi interessati dal foro
double dRbDist = 0 ;
Vector3d vtExtrG = vtExtr ;
vtExtrG.ToGlob( frGlob) ;
if ( vtExtrG.IsZplus())
GetDistanceFromRawBottom( Id.nId, EPS_SMALL, dRbDist) ;
// valuto l'espressione dell'affondamento
ExeLuaSetGlobNumVar( "TH", - dThick) ;
ExeLuaSetGlobNumVar( "RB", dRbDist) ;
double dDepth ;
if ( ! ExeLuaEvalNumExpr( m_Params.m_sDepth, &dDepth)) {
LOG_INFO( GetEMkLogger(), "Depth not computable by Drilling") ;
return false ;
}
if ( fabs( dDepth) < EPS_SMALL) {
LOG_INFO( GetEMkLogger(), "Drill with zero depth") ;
return false ;
}
// foro sempre cieco
bool bBlind = true ;
// se verticale e arriva fino al fondo grezzo, allora passante
if ( vtExtrG.IsZplus() && dDepth > dRbDist - EPS_SMALL)
bBlind = false ;
// assegno Id
hole.nOriId = Id.nId ;
// ne recupero il diametro
@@ -456,12 +483,12 @@ Drilling::GetHoleData( SelData Id, Hole& hole)
hole.ptIni = pArc->GetCenter() ;
hole.ptIni.ToGlob( frGlob) ;
// ne recupero versore direzione e lunghezza
hole.vtDir = (( dThick < 0) ? vtExtr : - vtExtr) ;
hole.vtDir = (( dDepth > 0) ? vtExtr : - vtExtr) ;
hole.vtDir.ToGlob( frGlob) ;
hole.vtDir.Normalize() ;
hole.dLen = fabs( dThick) ;
// lo dichiaro cieco (andrà calcolato opportunamente)
hole.bBlind = true ;
hole.dLen = fabs( dDepth) ;
// cieco/passante
hole.bBlind = bBlind ;
return true ;
}
@@ -490,23 +517,23 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId)
SetPathId( nPathId) ;
SetToolDir( hole.vtDir) ;
// 1 -> punto approccio
double dAppr = GetApproachDist() ;
SetFlag( 1) ;
double dAppr = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
Point3d ptP1 = hole.ptIni + hole.vtDir * ( dAppr + dTExtrLen) ;
if ( AddStart( ptP1) == GDB_ID_NULL)
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
return false ;
SetFlag( 0) ;
// 2 -> punto fuori (se diverso dal precedente)
if ( m_Params.m_dStartPos < dAppr) {
SetFeed( MAX_FEED) ;
SetFlag( 0) ;
Point3d ptP2 = hole.ptIni + hole.vtDir * ( m_Params.m_dStartPos + dTExtrLen) ;
if ( AddLinearMove( ptP2) == GDB_ID_NULL)
if ( AddRapidMove( ptP2) == GDB_ID_NULL)
return false ;
}
// 3 -> punto termine velocità ridotta iniziale (se previsto)
if ( bStartSlow) {
SetFeed( m_TParams.m_dStartFeed) ;
if ( ! bStd && ! bEndSlow)
SetFlag( 1) ; // fondo del foro
SetFlag( 101) ; // fondo del foro
Point3d ptP3 = hole.ptIni - hole.vtDir * dStartSlowLen ;
if ( ! bStd && ! bEndSlow)
ptP3 -= hole.vtDir * dAddLen ;
@@ -517,7 +544,7 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId)
if ( bStd) {
SetFeed( m_TParams.m_dFeed) ;
if ( ! bEndSlow)
SetFlag( 1) ; // fondo del foro
SetFlag( 101) ; // fondo del foro
Point3d ptP4 = hole.ptIni - hole.vtDir * ( hole.dLen - dEndSlowLen) ;
if ( ! bEndSlow)
ptP4 -= hole.vtDir * dAddLen ;
@@ -527,13 +554,13 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId)
// 5 -> punto termine velocità finale ridotta (se previsto)
if ( bEndSlow) {
SetFeed( m_TParams.m_dEndFeed) ;
SetFlag( 1) ; // fondo del foro
SetFlag( 101) ; // fondo del foro
Point3d ptP5 = hole.ptIni - hole.vtDir * ( hole.dLen + dAddLen) ;
if ( AddLinearMove( ptP5) == GDB_ID_NULL)
return false ;
}
// 6 -> ritorno all'approccio del foro
SetFeed( MAX_FEED) ;
SetFeed( m_TParams.m_dEndFeed) ;
SetFlag( 0) ;
if ( AddLinearMove( ptP1) == GDB_ID_NULL)
return false ;
@@ -571,16 +598,16 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
SetPathId( nPathId) ;
SetToolDir( hole.vtDir) ;
// 1 -> punto approccio
double dAppr = GetApproachDist() ;
SetFlag( 1) ;
double dAppr = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
Point3d ptP1 = hole.ptIni + hole.vtDir * ( dAppr + dTExtrLen) ;
if ( AddStart( ptP1) == GDB_ID_NULL)
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
return false ;
SetFlag( 0) ;
// 2 -> punto fuori (se diverso dal precedente)
if ( m_Params.m_dStartPos < dAppr) {
SetFeed( MAX_FEED) ;
SetFlag( 0) ;
Point3d ptP2 = hole.ptIni + hole.vtDir * ( m_Params.m_dStartPos + dTExtrLen) ;
if ( AddLinearMove( ptP2) == GDB_ID_NULL)
if ( AddRapidMove( ptP2) == GDB_ID_NULL)
return false ;
}
// ciclo di affondamento a step
@@ -597,13 +624,13 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
// se non è primo step faccio retrazione e riaffondo
if ( i != 1) {
// retrazione
SetFeed( MAX_FEED) ;
SetFlag( 3) ; // punto di scarico truciolo
SetFeed( m_TParams.m_dEndFeed) ;
SetFlag( 103) ; // punto di scarico truciolo
Point3d ptPr = hole.ptIni + hole.vtDir * dReturnPos ;
if ( AddLinearMove( ptPr) == GDB_ID_NULL)
return false ;
// riaffondo
SetFeed( MAX_FEED) ;
SetFeed( m_TParams.m_dEndFeed) ;
SetFlag( 0) ;
Point3d ptPa = hole.ptIni - hole.vtDir * ( dCurrLen - APPR_STEP) ;
if ( AddLinearMove( ptPa) == GDB_ID_NULL)
@@ -622,9 +649,9 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
// assegno parametri
SetFeed( m_TParams.m_dStartFeed) ;
if ( bHoleEnd)
SetFlag( 1) ; // fondo del foro
SetFlag( 101) ; // fondo del foro
else if ( bStepEnd)
SetFlag( 2) ; // fondo dello step
SetFlag( 102) ; // fondo dello step
// movimento
Point3d ptP3 = hole.ptIni - hole.vtDir * dLen ;
if ( bHoleEnd)
@@ -647,9 +674,9 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
// assegno parametri
SetFeed( m_TParams.m_dFeed) ;
if ( bHoleEnd)
SetFlag( 1) ; // fondo del foro
SetFlag( 101) ; // fondo del foro
else if ( bStepEnd)
SetFlag( 2) ; // fondo dello step
SetFlag( 102) ; // fondo dello step
// movimento
Point3d ptP4 = hole.ptIni - hole.vtDir * dLen ;
if ( bHoleEnd)
@@ -671,9 +698,9 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
// assegno parametri
SetFeed( m_TParams.m_dEndFeed) ;
if ( bHoleEnd)
SetFlag( 1) ; // fondo del foro
SetFlag( 101) ; // fondo del foro
else
SetFlag( 2) ; // fondo dello step
SetFlag( 102) ; // fondo dello step
// movimento
Point3d ptP5 = hole.ptIni - hole.vtDir * dLen ;
if ( bHoleEnd)
@@ -686,7 +713,7 @@ Drilling::DoPeckDrilling( const Hole& hole, SelData Id, int nPathId)
}
// 6 -> ritorno all'approccio del foro
SetFeed( MAX_FEED) ;
SetFeed( m_TParams.m_dEndFeed) ;
SetFlag( 0) ;
if ( AddLinearMove( ptP1) == GDB_ID_NULL)
return false ;