EgtMachKernel :

- migliorati test su tolleranza fori
- piccole correzioni per lavorazioni vuote o disabilitate.
This commit is contained in:
Dario Sassi
2016-02-01 07:44:24 +00:00
parent 5558e368f3
commit da24353a11
6 changed files with 52 additions and 14 deletions
+14 -3
View File
@@ -321,7 +321,7 @@ Drilling::SetGeometry( const SELVECTOR& vIds)
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
// recupero i dati del foro
Hole hole ;
if ( ! GetHoleData( vIds[i], hole) || fabs( hole.dDiam - m_TParams.m_dDiam) > dDiamTol) {
if ( ! GetHoleData( vIds[i], hole) || ! VerifyDiameter( hole.dDiam, m_TParams.m_dDiam, dDiamTol)) {
string sOut = "Entity " + ToString( vIds[i].nId) + " skipped by Drilling" ;
LOG_INFO( GetEMkLogger(), sOut.c_str()) ;
continue ;
@@ -730,7 +730,7 @@ Drilling::GenerateHolePv( int nInd, const SelData& nCircId, const string& sPName
double dDiamTol = m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ;
// recupero i dati del foro
Hole hole ;
if ( ! GetHoleData( nCircId, hole) || fabs( hole.dDiam - m_TParams.m_dDiam) > dDiamTol) {
if ( ! GetHoleData( nCircId, hole) || ! VerifyDiameter( hole.dDiam, m_TParams.m_dDiam, dDiamTol)) {
m_pGeomDB->Erase( nPathId) ;
string sOut = "Entity " + ToString( nCircId) + " skipped by Drilling" ;
LOG_INFO( GetEMkLogger(), sOut.c_str()) ;
@@ -774,7 +774,7 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName
double dDiamTol = m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ;
// recupero i dati del foro
Hole hole ;
if ( ! GetHoleData( nCircId, hole) || fabs( hole.dDiam - m_TParams.m_dDiam) > dDiamTol) {
if ( ! GetHoleData( nCircId, hole) || ! VerifyDiameter( hole.dDiam, m_TParams.m_dDiam, dDiamTol)) {
m_pGeomDB->Erase( nPathId) ;
string sOut = "Entity " + ToString( nCircId) + " skipped by Drilling" ;
LOG_INFO( GetEMkLogger(), sOut.c_str()) ;
@@ -874,6 +874,17 @@ Drilling::GenerateHoleRegionPv( int nFirstId, int nCount, int nPvId)
return true ;
}
//----------------------------------------------------------------------------
bool
Drilling::VerifyDiameter( double dHdiam, double dTdiam, double dDiamTol)
{
// se tolleranza in più o in meno
if ( dDiamTol > 0)
return ( abs( dHdiam - dTdiam) < dDiamTol) ;
// altrimenti tolleranza solo in meno
return ( dTdiam < dHdiam + 10 * EPS_SMALL && dTdiam > dHdiam + dDiamTol - EPS_SMALL) ;
}
//----------------------------------------------------------------------------
bool
Drilling::GetParam( int nType, bool& bVal) const
+1
View File
@@ -64,6 +64,7 @@ class Drilling : public Machining
bool GenerateHolePv( int nInd, const SelData& nCircId, const string& sPName, int nPvId) ;
bool GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName, int nClId) ;
bool GenerateHoleRegionPv( int nFirstId, int nCount, int nPvId) ;
bool VerifyDiameter( double dHdiam, double dTdiam, double ddiamTol) ;
bool DoStandardDrilling( const Hole& hole, SelData Id, int nPathId) ;
bool DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) ;
+4
View File
@@ -279,6 +279,10 @@ Generator::ProcessMachining( int nOpId, int nOpInd)
if ( ! m_pMchMgr->SetCurrMachining( nOpId))
return false ;
// Verifico non sia vuota
if ( ! m_pMchMgr->IsNotEmpty())
return true ;
// Recupero l'utensile della lavorazione corrente
string sTool ;
if ( ! m_pMchMgr->GetMachiningParam( MPA_TOOL, sTool))
+10 -2
View File
@@ -530,9 +530,17 @@ Machining::CalculateAxesValues( void)
{
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
// recupero la lavorazione precedente
int nPrevOpId = m_pMchMgr->GetPrevOperation( GetOwner()) ;
// recupero la lavorazione precedente non vuota
int nPrevOpId = m_pMchMgr->GetPrevActiveOperation( m_nOwnerId) ;
Machining* pPrevMch = dynamic_cast<Machining*>( m_pGeomDB->GetUserObj( nPrevOpId)) ;
while ( pPrevMch != nullptr) {
if ( pPrevMch->IsNotEmpty())
break ;
else {
nPrevOpId = m_pMchMgr->GetPrevActiveOperation( nPrevOpId) ;
pPrevMch = dynamic_cast<Machining*>( m_pGeomDB->GetUserObj( nPrevOpId)) ;
}
}
// recupero l'utensile precedente
string sPrevTool ;
if ( pPrevMch != nullptr)
+5 -5
View File
@@ -828,11 +828,11 @@ MachiningsMgr::SetExtraROnDrillRegion( double dExtraR)
bool
MachiningsMgr::SetHoleDiamToler( double dToler)
{
// deve essere un valore positivo o nullo
if ( dToler < - EPS_SMALL)
return false ;
// minimo EPS_SMALL
dToler = max( dToler, EPS_SMALL) ;
// Tolleranza > 0 -> la punta può essere uguale, più piccola o più grande
// Tolleranza < 0 -> la punta può essere solo uguale o più piccola
// minimo valore assoluto EPS_SMALL
if ( abs( dToler) < EPS_SMALL)
dToler = EPS_SMALL ;
// se cambiato, salvo e setto modifica
if ( fabs( dToler - m_dHoleDiamToler) > EPS_SMALL) {
m_dHoleDiamToler = dToler ;
+18 -4
View File
@@ -68,10 +68,16 @@ Simulator::Start( void)
int nOpId = m_pMchMgr->GetFirstActiveOperation() ;
if ( m_pMchMgr->GetOperationType( nOpId) != OPER_DISP)
return false ;
// cerco la prima lavorazione
// cerco la prima lavorazione valida
nOpId = m_pMchMgr->GetNextActiveOperation( nOpId) ;
while ( nOpId != GDB_ID_NULL && ! IsValidMachiningType( m_pMchMgr->GetOperationType( nOpId)))
nOpId = m_pMchMgr->GetNextActiveOperation( nOpId) ;
Machining* pMch = dynamic_cast<Machining*>( m_pGeomDB->GetUserObj( nOpId)) ;
while ( nOpId != GDB_ID_NULL) {
if ( IsValidMachiningType( m_pMchMgr->GetOperationType( nOpId)) &&
pMch != nullptr && pMch->IsNotEmpty())
break ;
nOpId = m_pMchMgr->GetNextActiveOperation( m_nOpId) ;
pMch = dynamic_cast<Machining*>( m_pGeomDB->GetUserObj( nOpId)) ;
}
if ( nOpId == GDB_ID_NULL)
return false ;
m_nOpId = nOpId ;
@@ -116,9 +122,17 @@ Simulator::Move( int& nStatus)
m_nEntId = m_pGeomDB->GetFirstInGroup( m_nCLPathId) ;
m_dCoeff = 0 ;
}
// Se arrivato alla fine di una lavorazione, recupero la successiva
// Se arrivato alla fine di una lavorazione, recupero la successiva valida
while ( m_nCLPathId == GDB_ID_NULL) {
m_nOpId = m_pMchMgr->GetNextActiveOperation( m_nOpId) ;
Machining* pMch = dynamic_cast<Machining*>( m_pGeomDB->GetUserObj( m_nOpId)) ;
while ( m_nOpId != GDB_ID_NULL) {
if ( IsValidMachiningType( m_pMchMgr->GetOperationType( m_nOpId)) &&
pMch != nullptr && pMch->IsNotEmpty())
break ;
m_nOpId = m_pMchMgr->GetNextActiveOperation( m_nOpId) ;
pMch = dynamic_cast<Machining*>( m_pGeomDB->GetUserObj( m_nOpId)) ;
}
// se non ce ne sono altre, sono alla fine
if ( m_nOpId == GDB_ID_NULL) {
nStatus = MCH_SIM_END ;