Merge commit '0b5fe6a6190f52f24fabf6a9c7c2680d803ad9b5' into feature/Svuotature

This commit is contained in:
Riccardo Elitropi
2025-02-04 14:54:38 +01:00
14 changed files with 276 additions and 185 deletions
+104 -103
View File
@@ -123,13 +123,13 @@ struct ToolInfo {
// struttura per foratura con MultiHeadDrills
struct MHDrill {
int nInd_id_hole ; // indice foro
Vector3d vtAux ; // vettore ausiliario per tale foratura
INTVECTOR vActiveExist ; // nel caso di più utensili selezionabili, contiene gli indici delle uscite attive
MHDrill( int nIndH, Vector3d vtA)
: nInd_id_hole( nIndH), vtAux( vtA) {} ;
MHDrill( int nIndH, Vector3d vtA, INTVECTOR vAE)
: nInd_id_hole( nIndH), vtAux( vtA), vActiveExist( vAE) {} ;
int nHoleInd ; // indice del foro
Vector3d vtAux ; // vettore ausiliario per tale foratura
INTVECTOR vActiveExit ; // nel caso di più utensili selezionabili, contiene gli indici delle uscite attive
MHDrill( int nHInd, Vector3d vtA)
: nHoleInd( nHInd), vtAux( vtA) {} ;
MHDrill( int nHInd, Vector3d vtA, INTVECTOR vAE)
: nHoleInd( nHInd), vtAux( vtA), vActiveExit( vAE) {} ;
} ;
@@ -761,7 +761,7 @@ Drilling::Update( bool bPostApply)
//----------------------------------------------------------------------------
int
Drilling::VerifyMultiParallelFixedDrills( void)
Drilling::VerifyMultiParallelDrills( void)
{
// se aggregato da sotto, sicuramente con una sola punta
bool bAggrBottom = IsAggrBottom( m_TParams.m_sHead) ;
@@ -805,7 +805,7 @@ Drilling::VerifyMultiParallelFixedDrills( void)
}
}
// non è stato trovato niente
return DRILL_TYPE_STD ;
return ( nSelectType == MCH_SLT_MULTIEXITS ? DRILL_TYPE_MULTI_SEL : DRILL_TYPE_STD) ;
}
//----------------------------------------------------------------------------
@@ -813,96 +813,94 @@ bool
Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId)
{
// recupero il tipo di lavorazione
int nDrillType = VerifyMultiParallelFixedDrills() ;
int nDrillType = VerifyMultiParallelDrills() ;
// eseguo la lavorazione richiesta
switch ( nDrillType) {
case DRILL_TYPE_STD : {
// elaboro i singoli fori
for ( int i = 0 ; i < int( m_vId.size()) ; ++ i) {
const auto& vId = m_vId[i] ;
// se richiesto preview
if ( nPvId != GDB_ID_NULL) {
if ( ! GenerateHolePv( i, vId, MCH_PATH, nPvId))
return false ;
// creo la regione di ingombro del foro
int nDriId = m_pGeomDB->GetFirstInGroup( m_pGeomDB->GetLastGroupInGroup( nPvId)) ;
GenerateHoleRegionPv( nDriId, 1, nPvId) ;
}
// se richiesta lavorazione
if ( nClId != GDB_ID_NULL) {
if ( ! GenerateHoleCl( i, vId, MCH_PATH, nClId))
return false ;
case DRILL_TYPE_STD :
{ // elaboro i singoli fori
for ( int i = 0 ; i < int( m_vId.size()) ; ++ i) {
const auto& vId = m_vId[i] ;
// se richiesto preview
if ( nPvId != GDB_ID_NULL) {
if ( ! GenerateHolePv( i, vId, MCH_PATH, nPvId))
return false ;
// creo la regione di ingombro del foro
int nDriId = m_pGeomDB->GetFirstInGroup( m_pGeomDB->GetLastGroupInGroup( nPvId)) ;
GenerateHoleRegionPv( nDriId, 1, nPvId) ;
}
// se richiesta lavorazione
if ( nClId != GDB_ID_NULL) {
if ( ! GenerateHoleCl( i, vId, MCH_PATH, nClId))
return false ;
}
}
}
}
break ;
case DRILL_TYPE_MULTI_FIXED : {
TABMHDRILL tabDrills ;
double dMHOff = 0 ;
if ( ! MultiHeadDrilling( m_vId, nClId, true, tabDrills, dMHOff))
return false ;
if ( tabDrills.empty())
return true ;
for ( int i = 0 ; i < int( tabDrills.size()) ; ++ i) {
// se richiesto preview
if ( nPvId != GDB_ID_NULL) {
if ( ! GenerateHolePv( i, m_vId[tabDrills[i].nInd_id_hole], MCH_PATH, nPvId))
return false ;
// creo la regione di ingombro del foro
int nDriId = m_pGeomDB->GetFirstInGroup( m_pGeomDB->GetLastGroupInGroup( nPvId)) ;
GenerateHoleRegionPv( nDriId, 1, nPvId) ;
}
// se richiesta lavorazione
if ( nClId != GDB_ID_NULL) {
if ( ! GenerateHoleCl( i, m_vId[tabDrills[i].nInd_id_hole], MCH_PATH, nClId, dMHOff, tabDrills[i].vtAux))
return false ;
break ;
case DRILL_TYPE_MULTI_FIXED :
{ TABMHDRILL tabDrills ;
double dMHOff = 0 ;
if ( ! MultiHeadDrilling( m_vId, nClId, true, tabDrills, dMHOff))
return false ;
if ( tabDrills.empty())
return true ;
for ( int i = 0 ; i < int( tabDrills.size()) ; ++ i) {
// se richiesto preview
if ( nPvId != GDB_ID_NULL) {
if ( ! GenerateHolePv( i, m_vId[tabDrills[i].nHoleInd], MCH_PATH, nPvId))
return false ;
// creo la regione di ingombro del foro
int nDriId = m_pGeomDB->GetFirstInGroup( m_pGeomDB->GetLastGroupInGroup( nPvId)) ;
GenerateHoleRegionPv( nDriId, 1, nPvId) ;
}
// se richiesta lavorazione
if ( nClId != GDB_ID_NULL) {
if ( ! GenerateHoleCl( i, m_vId[tabDrills[i].nHoleInd], MCH_PATH, nClId, dMHOff, tabDrills[i].vtAux))
return false ;
}
}
}
}
break ;
case DRILL_TYPE_MULTI_SEL : {
// eseguo il MultiHead drilling per gruppo a forare
TABMHDRILL tabDrills ;
double dMHOff = 0 ;
if ( ! MultiHeadDrilling( m_vId, nClId, false, tabDrills, dMHOff))
return false ;
if ( tabDrills.empty())
return true ;
for ( int i = 0 ; i < int( tabDrills.size()) ; ++ i) {
// se richiesto preview
if ( nPvId != GDB_ID_NULL) {
if ( ! GenerateHolePv( i, m_vId[tabDrills[i].nInd_id_hole], MCH_PATH, nPvId))
return false ;
// creo la regione di ingombro del foro
int nDriId = m_pGeomDB->GetFirstInGroup( m_pGeomDB->GetLastGroupInGroup( nPvId)) ;
GenerateHoleRegionPv( nDriId, 1, nPvId) ;
break ;
case DRILL_TYPE_MULTI_SEL :
{ // eseguo il MultiHead drilling per gruppo a forare
TABMHDRILL tabDrills ;
double dMHOff = 0 ;
if ( ! MultiHeadDrilling( m_vId, nClId, false, tabDrills, dMHOff))
return false ;
if ( tabDrills.empty())
return true ;
for ( int i = 0 ; i < int( tabDrills.size()) ; ++ i) {
// se richiesto preview
if ( nPvId != GDB_ID_NULL) {
if ( ! GenerateHolePv( i, m_vId[tabDrills[i].nHoleInd], MCH_PATH, nPvId))
return false ;
// creo la regione di ingombro del foro
int nDriId = m_pGeomDB->GetFirstInGroup( m_pGeomDB->GetLastGroupInGroup( nPvId)) ;
GenerateHoleRegionPv( nDriId, 1, nPvId) ;
}
// se richiesta lavorazione
if ( nClId != GDB_ID_NULL) {
if ( ! GenerateHoleCl( i, m_vId[tabDrills[i].nHoleInd], MCH_PATH, nClId,
dMHOff, tabDrills[i].vtAux, &( tabDrills[i].vActiveExit)))
return false ;
}
#if ENABLE_DEBUG_MULTIHEAD_HOLES
LOG_ERROR( GetEMkLogger(), ( " --- Tool main in " + ToString( m_vId[tabDrills[i].nHoleInd].nId)).c_str()) ;
string sActiveTool = "" ;
for ( int _a = 0 ; _a < int( tabDrills[i].vActiveExit.size()) ; ++ _a)
sActiveTool.append( "->" + ToString( tabDrills[i].vActiveExit[_a])) ;
LOG_ERROR( GetEMkLogger(), ( " Uscite attive : " + sActiveTool).c_str()) ;
string s_vtAux = "{" ;
s_vtAux.append( ToString( tabDrills[i].vtAux.x) + ", ") ;
s_vtAux.append( ToString( tabDrills[i].vtAux.y) + ", ") ;
s_vtAux.append( ToString( tabDrills[i].vtAux.z) + "}") ;
LOG_ERROR( GetEMkLogger(), ( " vtAux : " + s_vtAux).c_str()) ;
#endif
}
// se richiesta lavorazione
if ( nClId != GDB_ID_NULL) {
if ( ! GenerateHoleCl( i, m_vId[tabDrills[i].nInd_id_hole], MCH_PATH, nClId, dMHOff, tabDrills[i].vtAux))
return false ;
}
#if ENABLE_DEBUG_MULTIHEAD_HOLES
LOG_ERROR( GetEMkLogger(), ( " --- Tool main in " + ToString( m_vId[tabDrills[i].nInd_id_hole].nId)).c_str()) ;
string sActiveTool = "" ;
for ( int _a = 0 ; _a < int( tabDrills[i].vActiveExist.size()) ; ++ _a)
sActiveTool.append( "->" + ToString( tabDrills[i].vActiveExist[_a])) ;
LOG_ERROR( GetEMkLogger(), ( " Uscite attive : " + sActiveTool).c_str()) ;
string s_vtAux = "{" ;
s_vtAux.append( ToString( tabDrills[i].vtAux.x) + ", ") ;
s_vtAux.append( ToString( tabDrills[i].vtAux.y) + ", ") ;
s_vtAux.append( ToString( tabDrills[i].vtAux.z) + "}") ;
LOG_ERROR( GetEMkLogger(), ( " vtAux : " + s_vtAux).c_str()) ;
#endif
// ----------------------------------------------------------
}
}
break ;
break ;
case DRILL_TYPE_ERR :
default :
return false ;
default :
break ;
}
@@ -1259,7 +1257,7 @@ Drilling::EraseDuplicatedConfigs( VECTORHOLE& vHoles)
//----------------------------------------------------------------------------
bool
Drilling::KeepMinRotatedConfigs( VECTORHOLE& vHoles, const Vector3d vtAux, const Vector3d vtTool)
Drilling::KeepMinRotatedConfigs( VECTORHOLE& vHoles, const Vector3d& vtAux, const Vector3d& vtTool)
{
/* riduco il numero di cobinazioni in base a vtAux */
@@ -1348,10 +1346,10 @@ Drilling::CalcMultyHeadUndrilledHoles( const VECTORHOLE& vHoles, INTVECTOR& vIdU
//----------------------------------------------------------------------------
bool
Drilling::CheckBasedConfig( const VECTORHOLE& vHoles, int nIndHole, int& nValidConfig, bool& bBaseCase)
Drilling::CheckBasedConfig( const VECTORHOLE& vHoles, int nHoleInd, int& nValidConfig, bool& bBaseCase)
{
// controllo dei parametri
if ( nIndHole < 0 || nIndHole >= int( vHoles.size()))
if ( nHoleInd < 0 || nHoleInd >= int( vHoles.size()))
return false ;
if ( vHoles.empty())
return false ;
@@ -1359,14 +1357,14 @@ Drilling::CheckBasedConfig( const VECTORHOLE& vHoles, int nIndHole, int& nValidC
bBaseCase = false ;
nValidConfig = 0 ;
Vector3d vtAuxRef ;
for ( int i = 0 ; i < int( vHoles[nIndHole].vIndTools.size()) ; ++ i) {
if ( vHoles[nIndHole].vIndTools[i] != IND_TOOL_INVALID) {
for ( int i = 0 ; i < int( vHoles[nHoleInd].vIndTools.size()) ; ++ i) {
if ( vHoles[nHoleInd].vIndTools[i] != IND_TOOL_INVALID) {
++ nValidConfig ;
if ( nValidConfig == 1)
vtAuxRef = vHoles[nIndHole].vVtAux[i] ;
vtAuxRef = vHoles[nHoleInd].vVtAux[i] ;
else {
// controllo se i versori ausiliari sono opposti
if ( ! AreOppositeVectorApprox( vtAuxRef, vHoles[nIndHole].vVtAux[i]))
if ( ! AreOppositeVectorApprox( vtAuxRef, vHoles[nHoleInd].vVtAux[i]))
return true ;
}
}
@@ -1397,7 +1395,7 @@ Drilling::MultiHeadOrderConfig( TABMHDRILL& tabDrills, const VECTORHOLE& vHoles,
PNTVECTOR vPtLoc ;
BBox3d BBoxOrder ;
for ( int i = 0 ; i < int( tabDrills.size()) ; ++ i) {
vPtLoc.emplace_back( GetToLoc( vHoles[tabDrills[i].nInd_id_hole].hole.ptIni, frOrder)) ;
vPtLoc.emplace_back( GetToLoc( vHoles[tabDrills[i].nHoleInd].hole.ptIni, frOrder)) ;
BBoxOrder.Add( vPtLoc.back()) ;
}
// recupero il punto minimo del Box
@@ -1417,14 +1415,14 @@ Drilling::MultiHeadOrderConfig( TABMHDRILL& tabDrills, const VECTORHOLE& vHoles,
// una volta determinato il primo foro
struct OrderTabDrill {
int nInd_id_hole ;
int nHoleInd ;
Point3d ptIni ;
OrderTabDrill( int nInH, Point3d ptI)
: nInd_id_hole( nInH), ptIni( ptI) {} ;
OrderTabDrill( int nHInd, Point3d ptI)
: nHoleInd( nHInd), ptIni( ptI) {} ;
} ;
vector<OrderTabDrill> vOrderedTab ;
for ( int i = 0 ; i < int( tabDrills.size()) ; ++ i)
vOrderedTab.emplace_back( tabDrills[i].nInd_id_hole, vHoles[tabDrills[i].nInd_id_hole].hole.ptIni) ;
vOrderedTab.emplace_back( tabDrills[i].nHoleInd, vHoles[tabDrills[i].nHoleInd].hole.ptIni) ;
// per sicurezza ...
if ( vOrderedTab.empty())
return false ;
@@ -1739,7 +1737,7 @@ Drilling::MultiHeadDrilling( const SELVECTOR& vId, int nClId, bool bFixed, TABMH
// per vicinanza cerco gli altri fori oltre ai casi base
while ( nOkHole < int( vHoles.size()) - nUndrilleds) {
INTVECTOR vNextInds ;
if ( ! GetClosestHolesToHole( vHoles, tabDrills.back().nInd_id_hole, false, vNextInds) ||
if ( ! GetClosestHolesToHole( vHoles, tabDrills.back().nHoleInd, false, vNextInds) ||
vNextInds.empty() ||
! GetHoleBestConfig( vHoles, vNextInds[0], tabDrills, vtAux, vtTool, nOkHole))
return false ;
@@ -2374,7 +2372,8 @@ Drilling::GenerateHolePv( int nInd, const SelData& nCircId, const string& sPName
//----------------------------------------------------------------------------
bool
Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName, int nClId, double dMHOff, Vector3d vtA)
Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName, int nClId,
double dMHOff, const Vector3d& vtA, INTVECTOR* pvActiveExit)
{
// creo gruppo per geometria di lavorazione del foro
int nPathId = m_pGeomDB->AddGroup( GDB_ID_NULL, nClId, Frame3d()) ;
@@ -2382,6 +2381,8 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName
return false ;
m_pGeomDB->SetName( nPathId, sPName + ToString( nInd + 1)) ;
m_pGeomDB->SetInfo( nPathId, KEY_IDS, ToString( nCircId)) ;
if ( pvActiveExit != nullptr)
m_pGeomDB->SetInfo( nPathId, KEY_DRACEX, ToString( *pvActiveExit)) ;
m_pGeomDB->SetMaterial( nPathId, GREEN) ;
// recupero il valore di tolleranza sul diametro
double dDiamTol = GetHoleDiamToler() ;
+5 -4
View File
@@ -81,7 +81,8 @@ class Drilling : public Machining
ICurve* GetCurve( SelData Id) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool GenerateHolePv( int nInd, const SelData& nCircId, const std::string& sPName, int nPvId) ;
bool GenerateHoleCl( int nInd, const SelData& nCircId, const std::string& sPName, int nClId, double dMHOff = .0, Vector3d vtAux = V_NULL) ;
bool GenerateHoleCl( int nInd, const SelData& nCircId, const std::string& sPName, int nClId,
double dMHOff = 0, const Vector3d& vtAux = V_NULL, INTVECTOR* pvActiveExit = nullptr) ;
bool GenerateHoleRegionPv( int nFirstId, int nCount, int nPvId) ;
bool VerifyDiameter( double dHdiam, double dTdiam, double ddiamTol) ;
bool VerifyHoleFromBottom( const Hole& hole, SelData Id) ;
@@ -91,9 +92,9 @@ class Drilling : public Machining
bool CalcMask( VECTORHOLE& vHoles, const VECTORTOOL& vTools, bool bFixed, int nIndMT, const Vector3d& vtTool, const Vector3d& vtAux) ;
bool CalcDrilledHolesByConfig( VECTORHOLE& vHoles, int nMyInd, int nIndConfig, INTVECTOR& vIndDrilled) ;
bool EraseDuplicatedConfigs( VECTORHOLE& vHoles) ;
bool KeepMinRotatedConfigs( VECTORHOLE& vHoles, const Vector3d vtAux, const Vector3d vtTool) ;
bool KeepMinRotatedConfigs( VECTORHOLE& vHoles, const Vector3d& vtAux, const Vector3d& vtTool) ;
bool CalcMultyHeadUndrilledHoles( const VECTORHOLE& vHoles, INTVECTOR& vIdUndrilledHoles) ;
bool CheckBasedConfig( const VECTORHOLE& vHoles, int nIndHole, int& nValidConfig, bool& bBaseCase) ;
bool CheckBasedConfig( const VECTORHOLE& vHoles, int nHoleInd, int& nValidConfig, bool& bBaseCase) ;
bool GetClosestHolesToHole( const VECTORHOLE& vHoles, int nMyInd, bool bDrilled, INTVECTOR& vInds) ;
bool OrderConfigsForSelectableTools( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndToolMain, TABMHDRILL& vDrills) ;
bool GetConfigsWithMoreDrilledHoles( const VECTORHOLE& vHoles, INTVECTOR& vInds) ;
@@ -103,7 +104,7 @@ class Drilling : public Machining
bool GetHoleBestConfig( VECTORHOLE& vHoles, int nInd, TABMHDRILL& tabDrills, const Vector3d& vtAux, const Vector3d& vtTool, int& nOkHole) ;
bool MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamToler, SelData Id) ;
bool MultiHeadOrderConfig( TABMHDRILL& tabDrills, const VECTORHOLE& vHoles, const Vector3d& vtTool, const Vector3d& vtAux) ;
int VerifyMultiParallelFixedDrills( void) ;
int VerifyMultiParallelDrills( void) ;
private :
double GetSpeed() const
+2 -2
View File
@@ -1005,8 +1005,8 @@ Machine::CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit)
m_pGeomDB->SetName( nGT, sName) ;
// copio le info
m_pGeomDB->CopyAllInfoFrom( nGT, nT) ;
// assegno info per eventuale movimento
m_pGeomDB->SetInfo( nGT, "Val", 0) ;
// assegno info per eventuale movimento (sempre in Z globale)
m_pGeomDB->SetInfo( nGT, MCH_EXIT_VAL, 0) ;
// installo e inizializzo il gestore dell'uscita
Exit* pExit = new(nothrow) Exit ;
if ( pExit == nullptr)
+4
View File
@@ -153,3 +153,7 @@ const std::string MCH_AGB_ENCV = "AGB_ENCV" ;
// Info in rinvio rotante da sotto per definire la direzione di approccio preferenziale (consentito delta max di 95deg)
const std::string MCH_AGB_MDIR = "AGB_MDIR" ;
const double MCH_AGB_DELTAMAX_MDIR = cos( 95 * DEGTORAD) ;
//----------------------------------------------------------------------------
// Info di uscita per indicare quanto mossa lungo la sua Z locale
const std::string MCH_EXIT_VAL = "Val" ;
+124 -63
View File
@@ -211,53 +211,74 @@ Machining::GetToolPreviewStepCount( void) const
}
//----------------------------------------------------------------------------
static int
GetToolPreviewNext( IGeomDB* pGeomDB, int nEntId, int nParentId)
int
Machining::GetToolPreviewNext( int nEntId, int nParentId, int nStId) const
{
// recupero la successiva
int nNewId = (( nEntId != GDB_ID_NULL) ? pGeomDB->GetNext( nEntId) : pGeomDB->GetFirstInGroup( nParentId)) ;
int nNewId = (( nEntId != GDB_ID_NULL) ? m_pGeomDB->GetNext( nEntId) : m_pGeomDB->GetFirstInGroup( nParentId)) ;
int nNewParentId = nParentId ;
// ciclo nei gruppi successivi
do {
// ciclo nel gruppo
while ( nNewId != GDB_ID_NULL) {
string sName ; pGeomDB->GetName( nNewId, sName) ;
string sName ; m_pGeomDB->GetName( nNewId, sName) ;
if ( sName != MCH_CL_CLIMB && sName != MCH_CL_RISE)
break ;
nNewId = pGeomDB->GetNext( nNewId) ;
nNewId = m_pGeomDB->GetNext( nNewId) ;
}
// se trovata, esco
if ( nNewId != GDB_ID_NULL)
if ( nNewId != GDB_ID_NULL) {
// se prima entità, eventuale attivazione uscite di gruppo a forare
if ( nEntId == GDB_ID_NULL && m_pGeomDB->ExistsInfo( nNewParentId, KEY_DRACEX)) {
INTVECTOR vActExit ;
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit))
ActivateDrillingUnit( nStId, vActExit) ;
}
return nNewId ;
}
// passo al gruppo successivo
nNewParentId = m_pGeomDB->GetNextGroup( nNewParentId) ;
// eventuale attivazione uscite di gruppo a forare
if ( m_pGeomDB->ExistsInfo( nNewParentId, KEY_DRACEX)) {
INTVECTOR vActExit ;
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit))
ActivateDrillingUnit( nStId, vActExit) ;
}
// recupero la prima entità del successivo gruppo
nNewParentId = pGeomDB->GetNextGroup( nNewParentId) ;
nNewId = pGeomDB->GetFirstInGroup( nNewParentId) ;
nNewId = m_pGeomDB->GetFirstInGroup( nNewParentId) ;
} while ( nNewId != GDB_ID_NULL) ;
return GDB_ID_NULL ;
}
//----------------------------------------------------------------------------
static int
GetToolPreviewPrev( IGeomDB* pGeomDB, int nEntId, int nParentId)
int
Machining::GetToolPreviewPrev( int nEntId, int nParentId, int nStId) const
{
// recupero la precedente
int nNewId = (( nEntId != GDB_ID_NULL) ? pGeomDB->GetPrev( nEntId) : pGeomDB->GetLastInGroup( nParentId)) ;
int nNewId = (( nEntId != GDB_ID_NULL) ? m_pGeomDB->GetPrev( nEntId) : m_pGeomDB->GetLastInGroup( nParentId)) ;
int nNewParentId = nParentId ;
// ciclo nei gruppi precedenti
do {
// ciclo nel gruppo
while ( nNewId != GDB_ID_NULL) {
string sName ; pGeomDB->GetName( nNewId, sName) ;
string sName ; m_pGeomDB->GetName( nNewId, sName) ;
if ( sName != MCH_CL_CLIMB && sName != MCH_CL_RISE)
break ;
nNewId = pGeomDB->GetPrev( nNewId) ;
nNewId = m_pGeomDB->GetPrev( nNewId) ;
}
// se trovata, esco
if ( nNewId != GDB_ID_NULL)
return nNewId ;
// passo al gruppo precedente
nNewParentId = m_pGeomDB->GetPrevGroup( nNewParentId) ;
// eventuale attivazione uscite di gruppo a forare
if ( m_pGeomDB->ExistsInfo( nNewParentId, KEY_DRACEX)) {
INTVECTOR vActExit ;
if ( m_pGeomDB->GetInfo( nNewParentId, KEY_DRACEX, vActExit))
ActivateDrillingUnit( nStId, vActExit) ;
}
// recupero l'ultima entità del precedente gruppo
nNewParentId = pGeomDB->GetPrevGroup( nNewParentId) ;
nNewId = pGeomDB->GetLastInGroup( nNewParentId) ;
nNewId = m_pGeomDB->GetLastInGroup( nNewParentId) ;
} while ( nNewId != GDB_ID_NULL) ;
return GDB_ID_NULL ;
}
@@ -270,10 +291,10 @@ Machining::ToolPreview( int nEntId, int nStep) const
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr)
return GDB_ID_NULL ;
// recupero la testa nel gruppo per anteprima utensile
int nId = m_pGeomDB->GetFirstGroupInGroup( m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_ST)) ;
if ( nId == GDB_ID_NULL)
int nStId = m_pGeomDB->GetFirstGroupInGroup( m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_ST)) ;
if ( nStId == GDB_ID_NULL)
return GDB_ID_NULL ;
m_pGeomDB->SetStatus( nId, GDB_ST_OFF) ;
m_pGeomDB->SetStatus( nStId, GDB_ST_OFF) ;
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ;
if ( nClId == GDB_ID_NULL)
@@ -285,10 +306,10 @@ Machining::ToolPreview( int nEntId, int nStep) const
nParentId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
// se richiesta successiva
if ( nStep > 0)
nEntId = GetToolPreviewNext( m_pGeomDB, nEntId, nParentId) ;
nEntId = GetToolPreviewNext( nEntId, nParentId, nStId) ;
// se richiesta precedente
else if ( nStep < 0)
nEntId = GetToolPreviewPrev( m_pGeomDB, nEntId, nParentId) ;
nEntId = GetToolPreviewPrev( nEntId, nParentId, nStId) ;
// altrimenti richiesta corrente
else
nEntId = GDB_ID_NULL ;
@@ -296,13 +317,13 @@ Machining::ToolPreview( int nEntId, int nStep) const
// altrimenti
else {
// verifico che l'entità stia in un sottogruppo di CL
nParentId = m_pGeomDB->GetParentId( nEntId) ;
nParentId = m_pGeomDB->GetParentId( nEntId) ;
if ( m_pGeomDB->GetParentId( nParentId) == nClId) {
// se richiesta successiva
if ( nStep > 0) {
while ( nStep > 0) {
int nOldId = nEntId ;
nEntId = GetToolPreviewNext( m_pGeomDB, nEntId, nParentId) ;
nEntId = GetToolPreviewNext( nEntId, nParentId, nStId) ;
-- nStep ;
if ( nEntId == GDB_ID_NULL) {
nEntId = nOldId ;
@@ -314,7 +335,7 @@ Machining::ToolPreview( int nEntId, int nStep) const
else if ( nStep < 0) {
while ( nStep < 0) {
int nOldId = nEntId ;
nEntId = GetToolPreviewPrev( m_pGeomDB, nEntId, nParentId) ;
nEntId = GetToolPreviewPrev( nEntId, nParentId, nStId) ;
++ nStep ;
if ( nEntId == GDB_ID_NULL) {
nEntId = nOldId ;
@@ -328,7 +349,7 @@ Machining::ToolPreview( int nEntId, int nStep) const
}
// se esiste il gruppo genitore, visualizzo testa preview
if ( nParentId != GDB_ID_NULL)
m_pGeomDB->SetStatus( nId, GDB_ST_ON) ;
m_pGeomDB->SetStatus( nStId, GDB_ST_ON) ;
// recupero i dati di questa entità
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
@@ -338,17 +359,21 @@ Machining::ToolPreview( int nEntId, int nStep) const
Vector3d vtTool = pCamData->GetToolDir() ;
Vector3d vtBAux = pCamData->GetBackAuxDir() ;
// dati correnti testa/uscita
int nExitId = m_pGeomDB->GetFirstNameInGroup( nId, MCH_EXIT + ToString( GetExitNbr())) ;
int nExitId = m_pGeomDB->GetFirstNameInGroup( nStId, MCH_EXIT + ToString( GetExitNbr())) ;
Frame3d frExit ;
m_pGeomDB->GetGroupGlobFrame( nExitId, frExit) ;
// correggo eventuale movimento di disattivazione sempre in Z globale
double dVal ;
if ( m_pGeomDB->GetInfo( nExitId, MCH_EXIT_VAL, dVal))
frExit.Translate( -dVal * Z_AX) ;
Point3d ptOrig = frExit.Orig() ;
Vector3d vtDir = frExit.VersZ() ;
Vector3d vtAux ;
int nAvId = m_pGeomDB->GetFirstNameInGroup( nId, MCH_AUX_VECT) ;
int nAvId = m_pGeomDB->GetFirstNameInGroup( nStId, MCH_AUX_VECT) ;
ExeStartVector( nAvId, GDB_ID_ROOT, vtAux) ;
// rototraslo opportunamente
Frame3d frHead ;
m_pGeomDB->GetGroupGlobFrame( nId, frHead) ;
m_pGeomDB->GetGroupGlobFrame( nStId, frHead) ;
Frame3d frRef ;
if ( vtAux.IsSmall() || AreSameOrOppositeVectorApprox( vtAux, vtDir))
frRef.Set( ptOrig, vtDir) ;
@@ -361,11 +386,47 @@ Machining::ToolPreview( int nEntId, int nStep) const
frShow.Set( ptEnd + vtTool * GetToolData().m_dLen, vtTool, vtBAux) ;
frHead.ToLoc( frRef) ;
frHead.ToGlob( frShow) ;
*(m_pGeomDB->GetGroupFrame( nId)) = frHead ;
*(m_pGeomDB->GetGroupFrame( nStId)) = frHead ;
return nEntId ;
}
//----------------------------------------------------------------------------
bool
Machining::ActivateDrillingUnit( int nHeadId, const INTVECTOR& vActExit) const
{
// recupero la macchina corrente
Machine* pMch = m_pMchMgr->GetCurrMachine() ;
if ( pMch == nullptr)
return false ;
// costanti
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
static const string EVAR_HEADID = ".HEADID" ; // IN (int) identificativo testa
static const string EVAR_DRACEX = ".DRACEX" ; // IN (ints) vettore indici uscite attive
static const string EVAR_ERROR = ".ERR" ; // OUT (int) codice di errore ( 0 = ok, > 0 errore)
static const string ON_ACTIVATE_DRILLING_UNIT = "OnActivateDrillingUnit" ;
// se non esiste la funzione, esco
if ( ! pMch->LuaExistsFunction( ON_ACTIVATE_DRILLING_UNIT))
return true ;
// eseguo l'azione
bool bOk = true ;
int nErr = 99 ;
// imposto valori parametri
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEADID, nHeadId) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_DRACEX, vActExit) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( ON_ACTIVATE_DRILLING_UNIT) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
// reset
bOk = pMch->LuaResetGlobVar( EMC_VAR) && bOk ;
// segnalo errori
return ( bOk && nErr == 0) ;
}
//----------------------------------------------------------------------------
bool
Machining::PostApply( string& sErr)
@@ -382,39 +443,39 @@ Machining::PostApply( string& sErr)
static const string EVAR_MSG = ".MSG" ; // OUT (string) stringa di errore ( opzionale)
static const string ON_POST_APPLY = "OnPostApplyMachining" ;
// eseguo l'azione
if ( pMch->LuaExistsFunction( ON_POST_APPLY)) {
bool bOk = true ;
int nErr = 99 ;
// imposto valori parametri
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_PHASE, m_nPhase) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_MCHID, m_nOwnerId) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( ON_POST_APPLY, false) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
// recupero valori parametri opzionali
string sMsg ;
bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MSG, sMsg) ;
// reset
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori
if ( ! bOk || nErr > 0) {
bOk = false ;
sErr = sMsg ;
if ( IsEmptyOrSpaces( sErr))
sErr = " Error in " + ON_POST_APPLY + " (" + ToString( nErr) + ")" ;
}
// recupero eventuale warning
else if ( nErr < 0) {
string sOut = sMsg ;
if ( IsEmptyOrSpaces( sOut))
sOut = " Warning in " + ON_POST_APPLY + " (" + ToString( abs( nErr)) + ")" ;
m_pMchMgr->SetWarning( abs( nErr), sOut) ;
}
return bOk ;
}
else
// se non esiste la funzione, esco
if ( ! pMch->LuaExistsFunction( ON_POST_APPLY))
return true ;
}
// eseguo l'azione
bool bOk = true ;
int nErr = 99 ;
// imposto valori parametri
bOk = bOk && pMch->LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_PHASE, m_nPhase) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_MCHID, m_nOwnerId) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( ON_POST_APPLY, false) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) ;
// recupero valori parametri opzionali
string sMsg ;
bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_MSG, sMsg) ;
// reset
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori
if ( ! bOk || nErr > 0) {
bOk = false ;
sErr = sMsg ;
if ( IsEmptyOrSpaces( sErr))
sErr = " Error in " + ON_POST_APPLY + " (" + ToString( nErr) + ")" ;
}
// recupero eventuale warning
else if ( nErr < 0) {
string sOut = sMsg ;
if ( IsEmptyOrSpaces( sOut))
sOut = " Warning in " + ON_POST_APPLY + " (" + ToString( abs( nErr)) + ")" ;
m_pMchMgr->SetWarning( abs( nErr), sOut) ;
}
return bOk ;
}
+5
View File
@@ -53,10 +53,15 @@ class Machining : public Operation
bool RemoveToolPreview( void) const ;
int GetToolPreviewStepCount( void) const ;
int ToolPreview( int nEntId, int nStep) const ;
bool ActivateDrillingUnit( int nHeadId, const INTVECTOR& vActExit) const ;
protected :
Machining( void) ;
bool PostApply( std::string& sErr) ;
private :
int GetToolPreviewNext( int nEntId, int nParentId, int nStId) const ;
int GetToolPreviewPrev( int nEntId, int nParentId, int nStId) const ;
} ;
//----------------------------------------------------------------------------
+4 -4
View File
@@ -4149,7 +4149,7 @@ Operation::SpecialGetMaxZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TDIRP, vtTool1) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + GVAR_TDIR, vtTool2) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_GETMAXZ, false) ;
bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_GETMAXZ) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) && nErr == 0 ;
if ( bOk && ! pMch->LuaGetGlobVar( EMC_VAR + EVAR_MAXZ, dMaxZ)) {
@@ -4694,7 +4694,7 @@ Operation::SpecialTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR
for ( int i = 1 ; i <= int( vAxEnd.size()) ; ++ i)
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisValue( i, EMC_VAR, bIsRobot), vAxEnd[i-1]) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_TESTCOLLISIONAVOID, false) ;
bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_TESTCOLLISIONAVOID) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) && nErr == 0 ;
if ( bOk && ! pMch->LuaGetGlobVar( EMC_VAR + EVAR_RES, nRes)) {
@@ -4750,7 +4750,7 @@ Operation::SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nF
for ( int i = 1 ; i <= nNumAxes ; ++ i)
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisValue( i, EMC_VAR, bIsRobot), vAx[i-1]) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_MOVEZUP, false) ;
bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_MOVEZUP) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) && nErr == 0 ;
if ( bOk) {
@@ -4819,7 +4819,7 @@ Operation::SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd,
for ( int i = 1 ; i <= nNumAxes ; ++ i)
bOk = bOk && pMch->LuaSetGlobVar( GetGlobVarAxisValue( i, EMC_VAR, bIsRobot), vAxEnd[i-1]) ;
// eseguo
bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_MOVERAPID, false) ;
bOk = bOk && pMch->LuaCallFunction( ON_SPECIAL_MOVERAPID) ;
// recupero valori parametri obbligatori
bOk = bOk && pMch->LuaGetGlobVar( EMC_VAR + EVAR_ERROR, nErr) && nErr == 0 ;
// recupero i parametri facoltativi
+1
View File
@@ -96,6 +96,7 @@ static const std::string GVAR_PMAX = ".PMAX" ; // (Point3d) punto mas
static const std::string GVAR_PAXMIN = ".PAXMIN" ; // (double/s) minimo di ingombro degli assi del percorso di lavorazione
static const std::string GVAR_PAXMAX = ".PAXMAX" ; // (double/s) massimo di ingombro degli assi del percorso di lavorazione
static const std::string GVAR_ELEV = ".ELEV" ; // (double) massima elevazione
static const std::string GVAR_DRACEX = ".DRACEX" ; // (int/s) vettore delle uscite selezionate (per gruppi a forare)
static const std::string GVAR_AUXTOT = ".AUXTOT" ; // (int) numero totale dati ausiliari inizio/fine percorso di lavorazione
static const std::string GVAR_AUXIND = ".AUXIND" ; // (int) indice dato ausiliario inizio/fine percorso di lavorazione
static const std::string GVAR_AUX = ".AUX" ; // (string) dato ausiliario inizio/fine percorso di lavorazione
+8 -2
View File
@@ -420,11 +420,15 @@ Processor::ProcessClPath( int nClPathId, int nClPathInd, int nOpId, int nOpInd)
// Recupero massima elevazione
double dElev = 0 ;
m_pGeomDB->GetInfo( nClPathId, KEY_ELEV, dElev) ;
// recupero eventuale attivazione uscite (gruppi a forare)
INTVECTOR vActiveExit ;
m_pGeomDB->GetInfo( nClPathId, KEY_DRACEX, vActiveExit) ;
// Recupero il numero di eventi ausiliari iniziali
int nAS = 0 ;
m_pGeomDB->GetInfo( nClPathId, KEY_AS_TOT, nAS) ;
// Emetto inizio percorso di lavoro
if ( ! OnPathStart( nClPathId, nClPathInd, nAS, ptStart, ptEnd, vtExtr, ptMin, ptMax, vAxMin, vAxMax, dElev))
if ( ! OnPathStart( nClPathId, nClPathInd, nAS, ptStart, ptEnd, vtExtr,
ptMin, ptMax, vAxMin, vAxMax, dElev, vActiveExit))
return false ;
// Emissione eventuali dati ausiliari di inizio
@@ -969,7 +973,7 @@ Processor::OnMachiningEnd( void)
bool
Processor::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev)
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit)
{
// assegno identificativo e indice percorso di lavorazione
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHID, nClPathId) ;
@@ -988,6 +992,8 @@ Processor::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& p
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PAXMAX, vAxMax) ;
// assegno la massima elevazione
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ELEV, dElev) ;
// assegno uscite attive per gruppi a forare
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DRACEX, vActiveExit) ;
// chiamo la funzione di inizio percorso di lavorazione
bOk = bOk && CallOnPathStart() ;
return bOk ;
+1 -1
View File
@@ -56,7 +56,7 @@ class Processor
bool OnMachiningEnd( void) ;
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev) ;
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) ;
bool OnPathEnd( int nAE) ;
bool OnPathStartAux( int nInd, const std::string& sAS) ;
bool OnPathEndAux( int nInd, const std::string& sAE) ;
+8 -2
View File
@@ -980,6 +980,9 @@ SimulatorMP::FindAndManagePathStart( int& nStatus)
// recupero massima elevazione
double dElev = 0 ;
m_pGeomDB->GetInfo( m_nCLPathId, KEY_ELEV, dElev) ;
// recupero eventuale attivazione uscite (gruppi a forare)
INTVECTOR vActiveExit ;
m_pGeomDB->GetInfo( m_nCLPathId, KEY_DRACEX, vActiveExit) ;
// recupero il numero di eventi ausiliari di inizio
if ( ! m_pGeomDB->GetInfo( m_nCLPathId, KEY_AS_TOT, m_nAuxSTot))
m_nAuxSTot = 0 ;
@@ -988,7 +991,8 @@ SimulatorMP::FindAndManagePathStart( int& nStatus)
m_nAuxEInd = 0 ;
m_nAuxETot = 0 ;
// richiamo gestione evento inizio percorso di lavoro
if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, m_nAuxSTot, ptStart, ptEnd, vtExtr, ptMin, ptMax, vAxMin, vAxMax, dElev)) {
if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, m_nAuxSTot, ptStart, ptEnd, vtExtr,
ptMin, ptMax, vAxMin, vAxMax, dElev, vActiveExit)) {
nStatus = CalcStatusOnError( ERR_NONE) ;
return false ;
}
@@ -1945,7 +1949,7 @@ SimulatorMP::OnMachiningEnd( void)
bool
SimulatorMP::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev)
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit)
{
// assegno identificativo e indice percorso di lavorazione
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHID, nClPathId) ;
@@ -1964,6 +1968,8 @@ SimulatorMP::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d&
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PAXMAX, vAxMax) ;
// assegno la massima elevazione
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ELEV, dElev) ;
// assegno uscite attive per gruppi a forare
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DRACEX, vActiveExit) ;
// chiamo la funzione di inizio percorso di lavorazione
bOk = bOk && CallFunction( ON_SIMUL_PATH_START, true) ;
// forzo aggiornamento posizione assi (possono essere stati mossi nello script)
+1 -1
View File
@@ -101,7 +101,7 @@ class SimulatorMP : public ISimulator
bool OnPathEndAux( int nInd, const std::string& sAE, int& nErr) ;
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev) ;
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) ;
bool OnPathEnd( int nAE) ;
bool OnMoveStart( const CamData* pCamData, const CamData* pNextCamData, int& nErr) ;
bool OnMoveEnd( int& nErr) ;
+8 -2
View File
@@ -910,6 +910,9 @@ SimulatorSP::FindAndManagePathStart( int& nStatus)
// recupero massima elevazione
double dElev = 0 ;
m_pGeomDB->GetInfo( m_nCLPathId, KEY_ELEV, dElev) ;
// recupero eventuale attivazione uscite (gruppi a forare)
INTVECTOR vActiveExit ;
m_pGeomDB->GetInfo( m_nCLPathId, KEY_DRACEX, vActiveExit) ;
// recupero il numero di eventi ausiliari di inizio
if ( ! m_pGeomDB->GetInfo( m_nCLPathId, KEY_AS_TOT, m_nAuxSTot))
m_nAuxSTot = 0 ;
@@ -918,7 +921,8 @@ SimulatorSP::FindAndManagePathStart( int& nStatus)
m_nAuxEInd = 0 ;
m_nAuxETot = 0 ;
// richiamo gestione evento inizio percorso di lavoro
if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, m_nAuxSTot, ptStart, ptEnd, vtExtr, ptMin, ptMax, vAxMin, vAxMax, dElev)) {
if ( ! OnPathStart( m_nCLPathId, m_nCLPathInd, m_nAuxSTot, ptStart, ptEnd, vtExtr,
ptMin, ptMax, vAxMin, vAxMax, dElev, vActiveExit)) {
nStatus = CalcStatusOnError( 0) ;
return false ;
}
@@ -1906,7 +1910,7 @@ SimulatorSP::OnMachiningEnd( void)
bool
SimulatorSP::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev)
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit)
{
// assegno identificativo e indice percorso di lavorazione
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PATHID, nClPathId) ;
@@ -1925,6 +1929,8 @@ SimulatorSP::OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d&
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_PAXMAX, vAxMax) ;
// assegno la massima elevazione
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ELEV, dElev) ;
// assegno uscite attive per gruppi a forare
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_DRACEX, vActiveExit) ;
// verifico esistenza funzione
if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_PATH_START))
return bOk ;
+1 -1
View File
@@ -100,7 +100,7 @@ class SimulatorSP : public ISimulator
bool OnPathEndAux( int nInd, const std::string& sAE, int& nErr) ;
bool OnPathStart( int nClPathId, int nClPathInd, int nAS, const Point3d& ptStart, const Point3d& ptEnd,
const Vector3d& vtExtr, const Point3d& ptMin, const Point3d& ptMax,
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev) ;
const DBLVECTOR& vAxMin, const DBLVECTOR& vAxMax, double dElev, const INTVECTOR& vActiveExit) ;
bool OnPathEnd( int nAE) ;
bool OnMoveStart( const CamData* pCamData, const CamData* pNextCamData, int& nErr) ;
bool OnMoveEnd( int& nErr) ;