EgtMachKernel 1.8g5 :

- migliorata segnalazione extra corse.
This commit is contained in:
Dario Sassi
2017-07-21 13:01:52 +00:00
parent 6a06ca7290
commit d7c7547cd3
18 changed files with 253 additions and 162 deletions
+15 -5
View File
@@ -40,8 +40,10 @@ using namespace std ;
// 2906 = "Error in Chiseling : Entity GetElevation"
// 2907 = "Error in Chiseling : Chaining failed"
// 2908 = "Error in Chiseling : axes values not calculable"
// 2909 = "Error in Chiseling : link movements not calculable"
// 2910 = "Error in Chiseling : post apply not calculable"
// 2909 = "Error in Chiseling : outstroke xx"
// 2910 = "Error in Chiseling : link movements not calculable"
// 2911 = "Error in Chiseling : link outstroke xx"
// 2912 = "Error in Chiseling : post apply not calculable"
//----------------------------------------------------------------------------
struct SqHole
@@ -520,19 +522,27 @@ Chiseling::Update( void)
if ( ! m_Params.m_sInitAngs.empty())
sHint = m_Params.m_sInitAngs ;
if ( ! CalculateAxesValues( sHint)) {
m_pMchMgr->SetLastError( 2908, "Error in Chiseling : axes values not calculable") ;
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2908, "Error in Chiseling : axes values not calculable") ;
else
m_pMchMgr->SetLastError( 2909, "Error in Chiseling : outstroke ") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
if ( ! AdjustStartEndMovements()) {
m_pMchMgr->SetLastError( 2909, "Error in Chiseling : link movements not calculable") ;
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2910, "Error in Chiseling : link movements not calculable") ;
else
m_pMchMgr->SetLastError( 2911, "Error in Chiseling : link outstroke ") ;
return false ;
}
// esecuzione eventuali personalizzazioni
if ( ! PostApply()) {
m_pMchMgr->SetLastError( 2910, "Error in Chiseling : post apply not calculable") ;
m_pMchMgr->SetLastError( 2912, "Error in Chiseling : post apply not calculable") ;
return false ;
}
+13 -3
View File
@@ -33,7 +33,9 @@ using namespace std ;
// 2005 = "Error in ApplyRotationToRawPart xx"
// 2006 = "Error in OnSpecialApplyDisposition (xxx)"
// 2007 = "Error in Disposition : axes values not calculable"
// 2008 = "Error in Disposition : link movements not calculable"
// 2008 = "Error in Disposition : outstroke xxx"
// 2009 = "Error in Disposition : link movements not calculable"
// 2010 = "Error in Disposition : link outstroke xxx"
//----------------------------------------------------------------------------
static std::string DIS_TABLE = "Tab" ;
@@ -1219,12 +1221,20 @@ Disposition::SpecialUpdate( void)
}
// calcolo assi macchina
if ( ! CalculateAxesValues( "")) {
m_pMchMgr->SetLastError( 2007, "Error in Disposition : axes values not calculable") ;
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2007, "Error in Disposition : axes values not calculable") ;
else
m_pMchMgr->SetLastError( 2008, "Error in Disposition : outstroke ") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine di tutti
if ( ! AdjustStartEndMovements()) {
m_pMchMgr->SetLastError( 2008, "Error in Disposition : link movements not calculable") ;
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2009, "Error in Disposition : link movements not calculable") ;
else
m_pMchMgr->SetLastError( 2010, "Error in Disposition : link outstroke ") ;
return false ;
}
return true ;
+15 -5
View File
@@ -40,8 +40,10 @@ using namespace std ;
// 2107 = "Error in Drilling : Entity xx skipped because too far from part sides"
// 2108 = "Error in Drilling : Chaining failed"
// 2109 = "Error in Drilling : axes values not calculable"
// 2110 = "Error in Drilling : link movements not calculable"
// 2111 = "Error in Drilling : post apply not calculable"
// 2110 = "Error in Drilling : outstroke xx"
// 2111 = "Error in Drilling : link movements not calculable"
// 2112 = "Error in Drilling : link outstroke xx"
// 2113 = "Error in Drilling : post apply not calculable"
//----------------------------------------------------------------------------
struct Hole
@@ -516,19 +518,27 @@ Drilling::Update( void)
if ( ! m_Params.m_sInitAngs.empty())
sHint = m_Params.m_sInitAngs ;
if ( ! CalculateAxesValues( sHint)) {
m_pMchMgr->SetLastError( 2109, "Error in Drilling : axes values not calculable") ;
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2109, "Error in Drilling : axes values not calculable") ;
else
m_pMchMgr->SetLastError( 2110, "Error in Drilling : outstroke ") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
if ( ! AdjustStartEndMovements()) {
m_pMchMgr->SetLastError( 2110, "Error in Drilling : link movements not calculable") ;
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2111, "Error in Drilling : link movements not calculable") ;
else
m_pMchMgr->SetLastError( 2112, "Error in Drilling : link outstroke ") ;
return false ;
}
// esecuzione eventuali personalizzazioni
if ( ! PostApply()) {
m_pMchMgr->SetLastError( 2111, "Error in Drilling : post apply not calculable") ;
m_pMchMgr->SetLastError( 2113, "Error in Drilling : post apply not calculable") ;
return false ;
}
BIN
View File
Binary file not shown.
+15 -5
View File
@@ -35,8 +35,10 @@ using namespace std ;
// 2802 = "Error in GenMachining : missing Script (xxx)"
// 2803 = "Error in GenMachining : Error in xxx (nnn)"
// 2804 = "Error in GenMachining : axes values not calculable"
// 2805 = "Error in GenMachining : link movements not calculable"
// 2806 = "Error in GenMachining : post apply not calculable"
// 2805 = "Error in GenMachining : outstroke xx"
// 2806 = "Error in GenMachining : link movements not calculable"
// 2807 = "Error in GenMachining : link outstroke xx"
// 2808 = "Error in GenMachining : post apply not calculable"
//------------------------------ Constants -----------------------------------
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
@@ -569,7 +571,11 @@ GenMachining::Update( void)
if ( ! m_Params.m_sInitAngs.empty())
sHint = m_Params.m_sInitAngs ;
if ( ! CalculateAxesValues( sHint)) {
m_pMchMgr->SetLastError( 2804, "Error in GenMachining : axes values not calculable") ;
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2804, "Error in GenMachining : axes values not calculable") ;
else
m_pMchMgr->SetLastError( 2805, "Error in GenMachining : outstroke ") ;
return false ;
}
@@ -577,13 +583,17 @@ GenMachining::Update( void)
bool bVpl = true ;
FromString( ExtractInfo( m_Params.m_sUserNotes, "Vpl:"), bVpl) ;
if ( ! AdjustStartEndMovements( bVpl)) {
m_pMchMgr->SetLastError( 2805, "Error in GenMachining : link movements not calculable") ;
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2806, "Error in GenMachining : link movements not calculable") ;
else
m_pMchMgr->SetLastError( 2807, "Error in GenMachining : link outstroke ") ;
return false ;
}
// esecuzione eventuali personalizzazioni
if ( ! PostApply()) {
m_pMchMgr->SetLastError( 2806, "Error in GenMachining : post apply not calculable") ;
m_pMchMgr->SetLastError( 2808, "Error in GenMachining : post apply not calculable") ;
return false ;
}
+3 -3
View File
@@ -290,8 +290,7 @@ class MachMgr : public IMachMgr
bool GetCalcAuxDirFromAngles( double dAngA, double dAngB, Vector3d& vtDir) const override ;
bool GetNearestAngleInStroke( int nInd, double dAngRef, double& dAng) const override ;
bool LimitAngleToStroke( int nInd, double& dAng) const override ;
bool VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) override ;
bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat) ;
bool VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) const override ;
std::string GetOutstrokeInfo( bool bMM = true) const override ;
// Machine
int GetBaseId( const std::string& sBase) const override ;
@@ -313,7 +312,7 @@ class MachMgr : public IMachMgr
bool UnloadTool( const std::string& sHead, int nExit) override ;
bool ResetHeadSet( const std::string& sHead) override ;
bool SetMachineLook( int nFlag) override ;
int GetMachineLook( void) override ;
int GetMachineLook( void) const override ;
public :
MachMgr( void) ;
@@ -379,6 +378,7 @@ class MachMgr : public IMachMgr
double GetCalcRot1W( void) const ;
bool SetCalcSolCh( int nScc) ;
bool VerifyAngleOutstroke( int nInd, double dAng) const ;
bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const ;
// Operations
bool GetOperationNewName( std::string& sName) const ;
const ToolData* GetMachiningToolData( void) const ;
+7 -9
View File
@@ -615,18 +615,18 @@ MachMgr::VerifyAngleOutstroke( int nInd, double dAng) const
//----------------------------------------------------------------------------
bool
MachMgr::VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat)
MachMgr::VerifyOutstroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) const
{
DBLVECTOR vAng(2) ; vAng[0] = dAngA ; vAng[1] = dAngB ;
return VerifyOutstroke( dX, dY, dZ, vAng, nStat) ;
return VerifyOutstroke( dX, dY, dZ, vAng, true, nStat) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat)
MachMgr::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const
{
Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->VerifyOutstroke( dX, dY, dZ, vAng, nStat) : false) ;
return ( ( pMch != nullptr) ? pMch->VerifyOutstroke( dX, dY, dZ, vAng, bClear, nStat) : false) ;
}
//----------------------------------------------------------------------------
@@ -634,10 +634,8 @@ std::string
MachMgr::GetOutstrokeInfo( bool bMM) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr) {
static string sNull = "" ;
return sNull ;
}
if ( pMch == nullptr)
return "" ;
return pMch->GetOutstrokeInfo( bMM) ;
}
@@ -651,7 +649,7 @@ MachMgr::SetMachineLook( int nFlag)
//----------------------------------------------------------------------------
int
MachMgr::GetMachineLook( void)
MachMgr::GetMachineLook( void) const
{
Machine* pMch = GetCurrMachine() ;
if ( pMch == nullptr)
+2
View File
@@ -932,6 +932,8 @@ bool
MachMgr::MachiningApply( bool bRecalc)
{
ResetLastError() ;
if ( GetCurrMachine() != nullptr)
GetCurrMachine()->ResetOutstrokeInfo() ;
// recupero la lavorazione corrente
int nCurrMchId = GetCurrMachining() ;
if ( nCurrMchId == GDB_ID_NULL)
+4 -2
View File
@@ -121,10 +121,12 @@ class Machine
bool GetNearestAngleInStroke( int nInd, double dAngRef, double& dAng) const ;
bool LimitAngleToStroke( int nInd, double& dAng) const ;
bool VerifyAngleOutstroke( int nInd, double dAng) const ;
bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat) const ;
bool VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const ;
std::string GetOutstrokeInfo( bool bMM = true) const ;
void ResetOutstrokeInfo( void) const
{ m_OutstrokeInfo.Clear() ; }
bool SetLook( int nFlag) ;
int GetLook( void)
int GetLook( void) const
{ return m_nMachineLook ; }
bool LinkRawPartToGroup( int nRawPartId, const std::string& sGroupName) ;
bool IsLinkedRawPart( int nRawId) const ;
+7 -2
View File
@@ -1226,11 +1226,12 @@ Machine::VerifyAngleOutstroke( int nInd, double dAng) const
//----------------------------------------------------------------------------
bool
Machine::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, int& nStat) const
Machine::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng, bool bClear, int& nStat) const
{
// default tutto ok
nStat = 0 ;
m_OutstrokeInfo.Clear() ;
if ( bClear)
m_OutstrokeInfo.Clear() ;
// verifica degli assi lineari
DBLVECTOR vLin( 3) ; vLin[0] = dX ; vLin[1] = dY ; vLin[2] = dZ ;
for ( size_t i = 0 ; i < m_vCalcLinAx.size() && i < vLin.size() ; ++ i) {
@@ -1277,6 +1278,10 @@ Machine::VerifyOutstroke( double dX, double dY, double dZ, const DBLVECTOR& vAng
std::string
Machine::GetOutstrokeInfo( bool bMM) const
{
// se non c'è extracorsa, ritorno stringa vuota
if ( m_OutstrokeInfo.sAxName.empty())
return "" ;
// creo stringa con info opportune
if ( bMM || ! m_OutstrokeInfo.bLinear)
return m_OutstrokeInfo.sAxToken + "=" + ToString( m_OutstrokeInfo.dExtra, 1) + m_OutstrokeInfo.sAuxInfo ;
else
+17 -7
View File
@@ -50,8 +50,10 @@ using namespace std ;
// 2315 = "Error in Milling : Chaining failed"
// 2316 = "Error in Milling : Tool MaxMaterial too small (xx)"
// 2317 = "Error in Milling : axes values not calculable"
// 2318 = "Error in Milling : link movements not calculable"
// 2319 = "Error in Milling : post apply not calculable"
// 2318 = "Error in Milling : outstroke xx"
// 2319 = "Error in Milling : link movements not calculable"
// 2320 = "Error in Milling : link outstroke xx"
// 2321 = "Error in Milling : post apply not calculable"
//----------------------------------------------------------------------------
USEROBJ_REGISTER( "EMkMilling", Milling) ;
@@ -589,19 +591,27 @@ Milling::Update( void)
if ( ! m_Params.m_sInitAngs.empty())
sHint = m_Params.m_sInitAngs ;
if ( ! CalculateAxesValues( sHint)) {
m_pMchMgr->SetLastError( 2317, "Error in Milling : axes values not calculable") ;
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2317, "Error in Milling : axes values not calculable") ;
else
m_pMchMgr->SetLastError( 2318, "Error in Milling : outstroke ") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
if ( ! AdjustStartEndMovements()) {
m_pMchMgr->SetLastError( 2318, "Error in Milling : link movements not calculable") ;
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2319, "Error in Milling : link movements not calculable") ;
else
m_pMchMgr->SetLastError( 2320, "Error in Milling : link outstroke ") ;
return false ;
}
// esecuzione eventuali personalizzazioni
if ( ! PostApply()) {
m_pMchMgr->SetLastError( 2319, "Error in Milling : post apply not calculable") ;
m_pMchMgr->SetLastError( 2321, "Error in Milling : post apply not calculable") ;
return false ;
}
@@ -1761,7 +1771,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
bool bOutStart = GetPointOutOfRaw( ptP1, vtTool) ;
// determino se l'inizio dell'attacco è sopra il grezzo
bool bAboveStart = m_pMchMgr->GetHeadAbove( m_TParams.m_sHead) && GetPointAboveRaw( ptP1) ;
// aggiungo approccio per frese normali con spazio sopra attacco
// aggiungo approccio per frese normali
if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) {
// correggo elevazione iniziale con punto inizio attacco
dStElev -= ( ptP1 - ptStart) * vtExtr ;
@@ -1776,7 +1786,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
return false ;
}
}
// altrimenti, approccio per lame o diretto
// altrimenti, approccio per lame
else {
// verifico di entrare in aria
if ( ! bOutStart) {
+91 -97
View File
@@ -237,18 +237,22 @@ Operation::GetElevation( int nPhase, const Point3d& ptP,
{
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
// considero il punto
// considero il punto centrale
if ( ! GetElevation( nPhase, ptP, vtDir, dElev))
return false ;
// considero 8 punti sulla circonferenza
// considero 8 direzioni sulla circonferenza
const int N_STEP = 8 ;
Vector3d vtRad = FromUprightOrtho( vtDir) * dRad ;
for ( int i = 0 ; i < N_STEP ; ++ i) {
double dElevT ;
// esploro 4 posizioni sulle direzioni
for ( int j = 1 ; j <= 8 ; j *= 2) {
double dElevT = 0 ;
if ( ! GetElevation( nPhase, ptP + vtRad / j, vtDir, dElevT))
return false ;
dElev = max( dElev, dElevT) ;
}
// passo alla direzione successiva
vtRad.Rotate( vtDir, ANG_FULL / N_STEP) ;
if ( ! GetElevation( nPhase, ptP + vtRad, vtDir, dElevT))
return false ;
dElev = max( dElev, dElevT) ;
}
return true ;
}
@@ -901,7 +905,7 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes,
vAxVal.emplace_back( dAng) ;
// verifico i limiti di corsa degli assi
int nStat ;
bool bOsOk = m_pMchMgr->VerifyOutstroke( dX, dY, dZ, vAng1, nStat) ;
bool bOsOk = m_pMchMgr->VerifyOutstroke( dX, dY, dZ, vAng1, false, nStat) ;
if ( ! bOsOk || nStat != 0) {
bOk = false ;
pCamData->SetAxes( CamData::AS_OUTSTROKE, vAxVal) ;
@@ -1015,7 +1019,7 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes,
for ( size_t i = 0 ; i < vAng1.size() ; ++ i)
vAng[i] = vAxRotPrec[i] * ( 1 - dCoeff) + vAng1[i] * dCoeff ;
int nStat ;
bool bOsOk = m_pMchMgr->VerifyOutstroke( ptCurr.x, ptCurr.y, ptCurr.z, vAng, nStat) ;
bool bOsOk = m_pMchMgr->VerifyOutstroke( ptCurr.x, ptCurr.y, ptCurr.z, vAng, false, nStat) ;
if ( ! bOsOk || nStat != 0) {
bOk = false ;
pCamData->SetAxes( CamData::AS_OUTSTROKE, vAxVal) ;
@@ -1109,18 +1113,18 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
if ( ! GetInitialAxesValues( vAxIni))
return false ;
// aggiungo eventuale delta Z
double dDelta = 0 ;
double dDeltaZ = 0 ;
// determino delta Z rispetto a posizione finale
if ( vAxVal.size() >= 4 && vAxIni.size() >= 4) {
// verifico se movimento assi rotanti richiede una risalita parziale
if ( ! CalcDeltaZForHeadRotation( vAxVal, vAxIni, dDelta))
if ( ! CalcDeltaZForHeadRotation( vAxVal, vAxIni, dDeltaZ))
return false ;
}
// confronto con eventuale risalita di inizio lavorazione
dDelta = max( dDelta, ( vAxIni[2] - vAxVal[2])) ;
dDeltaZ = max( dDeltaZ, ( vAxIni[2] - vAxVal[2])) ;
// se necessaria, aggiungo risalita parziale
if ( dDelta > 100 * EPS_SMALL) {
if ( ! pPrevOp->AddRise( vAxVal, dDelta))
if ( dDeltaZ > 100 * EPS_SMALL) {
if ( ! pPrevOp->AddRise( vAxVal, dDeltaZ))
return false ;
// aggiorno quota in Z della posizione iniziale ( anche se verrà aggiornata solo in seguito)
vAxIni[2] = vAxVal[2] ;
@@ -1193,24 +1197,24 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
bMaxZ = true ;
}
// elimino vecchie risalite alla fine della lavorazione
RemoveRise() ;
// se richiesta verifica collegamento con lavorazione precedente, aggiusto l'inizio di ogni percorso di lavoro
// aggiusto l'inizio di ogni percorso di lavoro
bool bOk = true ;
if ( bVerifyPreviousLink) {
int nClPathId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
while ( bOk && nClPathId != GDB_ID_NULL) {
// sistemo inizio
if ( ! AdjustOneStartMovement( nClPathId, vAxVal, bMaxZ))
int nPrevClPathId = GDB_ID_NULL ;
int nClPathId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
while ( bOk && nClPathId != GDB_ID_NULL) {
// se richiesta verifica collegamento con lavorazione precedente, sistemo inizio
if ( bVerifyPreviousLink) {
if ( ! AdjustOneStartMovement( nClPathId, nPrevClPathId, vAxVal, bMaxZ))
bOk = false ;
bMaxZ = false ;
// recupero nuovi finali
if ( ! GetClPathFinalAxesValues( nClPathId, vAxVal))
bOk = false ;
// passo al successivo
nClPathId = m_pGeomDB->GetNextGroup( nClPathId) ;
}
bMaxZ = false ;
// recupero nuovi finali
RemoveRise( nClPathId) ;
if ( ! GetClPathFinalAxesValues( nClPathId, vAxVal))
bOk = false ;
// passo al successivo
nPrevClPathId = nClPathId ;
nClPathId = m_pGeomDB->GetNextGroup( nClPathId) ;
}
// aggiungo risalita finale
@@ -1227,7 +1231,7 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
//----------------------------------------------------------------------------
bool
Operation::AdjustOneStartMovement( int nClPathId, const DBLVECTOR& vAxPrev, bool bMaxZ)
Operation::AdjustOneStartMovement( int nClPathId, int nPrevClPathId, const DBLVECTOR& vAxPrev, bool bMaxZ)
{
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
@@ -1250,7 +1254,7 @@ Operation::AdjustOneStartMovement( int nClPathId, const DBLVECTOR& vAxPrev, bool
m_pGeomDB->SetName( nEntId, MCH_CL_CLIMB) ;
DBLVECTOR vAxNew = vAxCurr ;
vAxNew[2] = vAxPrev[2] ;
// eventuale aggiustamenti speciali dipendenti dalla macchina
// eventuali aggiustamenti speciali dipendenti dalla macchina
Vector3d vtTool = pCamData->GetToolDir() ;
DBLVECTOR vAxTmp = vAxNew ;
bool bModif ;
@@ -1260,7 +1264,7 @@ Operation::AdjustOneStartMovement( int nClPathId, const DBLVECTOR& vAxPrev, bool
pCamData->SetToolDir( vtTool) ;
vAxNew = vAxTmp ;
}
// applico le modifiche
// applico le modifiche (non forzo emissione della Z che è già massima)
pCamData->SetAxes( CamData::AS_OK, vAxNew) ;
pCamData->ChangeAxesMask( CamData::MSK_L1 | CamData::MSK_L2 | CamData::MSK_R1 | CamData::MSK_R2 | CamData::MSK_R3) ;
pCamData->SetFlag( 2) ;
@@ -1291,80 +1295,52 @@ Operation::AdjustOneStartMovement( int nClPathId, const DBLVECTOR& vAxPrev, bool
dUnsafeZ = dTestSafeZ ;
}
// risalita sopra fine percorso precedente
// copio l'entità
int nNew1Id = m_pGeomDB->Copy( nEntId, GDB_ID_NULL, nEntId, GDB_BEFORE) ;
CamData* pNew1CamData = GetCamData( m_pGeomDB->GetUserObj( nNew1Id)) ;
if ( pNew1CamData == nullptr)
DBLVECTOR vAxNew1 ;
if ( ! AddRise( vAxNew1, dSafeZ - vAxPrev[2], nPrevClPathId))
return false ;
// modifico questa entità
m_pGeomDB->SetName( nNew1Id, MCH_CL_CLIMB) ;
DBLVECTOR vAxNew1 = vAxPrev ;
vAxNew1[2] = dSafeZ ;
int nMask = CamData::MSK_L3 ;
// aggiungo posizione elevata prima dell'inizio del percorso corrente
if ( m_pGeomDB->Copy( nEntId, GDB_ID_NULL, nEntId, GDB_AFTER) == GDB_ID_NULL)
return false ;
// modifico l'entità originale (è la prima del percorso)
m_pGeomDB->SetName( nEntId, MCH_CL_CLIMB) ;
DBLVECTOR vAxNew = vAxCurr ;
vAxNew[2] = vAxNew1[2] ;
// eventuali aggiustamenti speciali dipendenti dalla macchina
Vector3d vtTool = pNew1CamData->GetToolDir() ;
DBLVECTOR vAxTmp = vAxNew1 ;
Vector3d vtTool = pCamData->GetToolDir() ;
DBLVECTOR vAxTmp = vAxNew ;
bool bModif ;
if ( ! SpecialMoveZup( vtTool, vAxTmp, bModif))
return false ;
if ( bModif) {
pNew1CamData->SetToolDir( vtTool) ;
if ( vAxNew1.size() >= 4 && abs( vAxTmp[3] - vAxNew1[3]) > EPS_ANG_SMALL) {
vAxCurr[3] = vAxNew1[3] ;
nMask |= CamData::MSK_R1 ;
}
if ( vAxNew1.size() >= 5 && abs( vAxTmp[4] - vAxNew1[4]) > EPS_ANG_SMALL) {
vAxCurr[4] = vAxNew1[4] ;
nMask |= CamData::MSK_R2 ;
}
if ( vAxNew1.size() >= 6 && abs( vAxTmp[5] - vAxNew1[5]) > EPS_ANG_SMALL) {
vAxCurr[5] = vAxNew1[5] ;
nMask |= CamData::MSK_R3 ;
}
vAxNew1 = vAxTmp ;
pCamData->SetToolDir( vtTool) ;
vAxNew = vAxTmp ;
}
// applico le modifiche
pNew1CamData->SetAxes( CamData::AS_OK, vAxNew1) ;
pNew1CamData->ChangeAxesMask( nMask) ;
pNew1CamData->SetFlag( 0) ;
// spostamento sopra inizio percorso corrente
// copio l'entità
int nNew2Id = m_pGeomDB->Copy( nEntId, GDB_ID_NULL, nEntId, GDB_BEFORE) ;
CamData* pNew2CamData = GetCamData( m_pGeomDB->GetUserObj( nNew2Id)) ;
if ( pNew2CamData == nullptr)
return false ;
// la modifico
m_pGeomDB->SetName( nNew2Id, MCH_CL_CLIMB) ;
DBLVECTOR vAxNew2 = vAxCurr ;
vAxNew2[2] = dSafeZ ;
pNew2CamData->SetAxes( CamData::AS_OK, vAxNew2) ;
pNew2CamData->ChangeAxesMask( CamData::MSK_L1 | CamData::MSK_L2 | CamData::MSK_R1 | CamData::MSK_R2 | CamData::MSK_R3) ;
pNew2CamData->SetFlag( 2) ;
// applico le modifiche (non forzo emissione della Z che è già alta)
pCamData->SetAxes( CamData::AS_OK, vAxNew) ;
pCamData->ChangeAxesMask( CamData::MSK_L1 | CamData::MSK_L2 | CamData::MSK_R1 | CamData::MSK_R2 | CamData::MSK_R3) ;
pCamData->SetFlag( 2) ;
}
// altrimenti
else {
// se Z pressochè uguali non devo fare alcunché
if ( fabs( vAxCurr[2] - vAxPrev[2]) < 100 * EPS_SMALL)
if ( fabs( vAxCurr[2] - vAxPrev[2]) <= 100 * EPS_SMALL)
return true ;
// se Z corrente maggiore della precedente
else if ( vAxCurr[2] > vAxPrev[2]) {
// copio l'entità
if ( m_pGeomDB->Copy( nEntId, GDB_ID_NULL, nEntId, GDB_AFTER) == GDB_ID_NULL)
// devo essere sulla stessa lavorazione
if ( nPrevClPathId == GDB_ID_NULL)
return false ;
// aggiungo risalita alla fine del precedente percorso
DBLVECTOR vAxNew ;
if ( ! AddRise( vAxNew, vAxCurr[2] - vAxPrev[2], nPrevClPathId))
return false ;
// modifico quella originale (è la prima del percorso)
m_pGeomDB->SetName( nEntId, MCH_CL_CLIMB) ;
DBLVECTOR vAxNew = vAxPrev ;
vAxNew[2] = vAxCurr[2] ;
pCamData->SetAxes( CamData::AS_OK, vAxNew) ;
pCamData->ChangeAxesMask( CamData::MSK_L3) ;
pCamData->SetFlag( 0) ;
}
// altrimenti Z corrente minore della precedente
else {
// copio l'entità
// aggiungo posizione elevata prima dell'inizio del percorso corrente
if ( m_pGeomDB->Copy( nEntId, GDB_ID_NULL, nEntId, GDB_AFTER) == GDB_ID_NULL)
return false ;
// modifico quella originale (è la prima del percorso)
// modifico l'entità originale (è la prima del percorso)
m_pGeomDB->SetName( nEntId, MCH_CL_CLIMB) ;
DBLVECTOR vAxNew = vAxCurr ;
vAxNew[2] = vAxPrev[2] ;
@@ -1378,7 +1354,7 @@ Operation::AdjustOneStartMovement( int nClPathId, const DBLVECTOR& vAxPrev, bool
pCamData->SetToolDir( vtTool) ;
vAxNew = vAxTmp ;
}
// applico le modifiche
// applico le modifiche (non forzo emissione della Z che è già alta)
pCamData->SetAxes( CamData::AS_OK, vAxNew) ;
pCamData->ChangeAxesMask( CamData::MSK_L1 | CamData::MSK_L2 | CamData::MSK_R1 | CamData::MSK_R2 | CamData::MSK_R3) ;
pCamData->SetFlag( 2) ;
@@ -1426,7 +1402,7 @@ Operation::RemoveClimb( int nClPathId)
//----------------------------------------------------------------------------
bool
Operation::AddRise( DBLVECTOR& vAxVal, double dDelta)
Operation::AddRise( DBLVECTOR& vAxVal, double dDelta, int nClPathId)
{
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
@@ -1434,10 +1410,19 @@ Operation::AddRise( DBLVECTOR& vAxVal, double dDelta)
int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ;
if ( nClId == GDB_ID_NULL)
return false ;
// recupero l'ultimo percorso
int nLastPxClId = m_pGeomDB->GetLastGroupInGroup( nClId) ;
// se percorso CL specificato, verifico appartenga al gruppo sopra ricavato
if ( nClPathId != GDB_ID_NULL) {
if ( m_pGeomDB->GetParentId( nClPathId) != nClId)
return false ;
}
// altrimenti, recupero l'ultimo percorso CL della operazione
else {
nClPathId = m_pGeomDB->GetLastGroupInGroup( nClId) ;
if ( nClPathId == GDB_ID_NULL)
return false ;
}
// recupero l'ultima entità del percorso
int nEntId = m_pGeomDB->GetLastInGroup( nLastPxClId) ;
int nEntId = m_pGeomDB->GetLastInGroup( nClPathId) ;
if ( nEntId == GDB_ID_NULL)
return false ;
// ne recupero i dati Cam
@@ -1451,7 +1436,7 @@ Operation::AddRise( DBLVECTOR& vAxVal, double dDelta)
// assegno le coordinate del punto
pGP->Set( pCamData->GetEndPoint()) ;
// inserisco l'oggetto nel DB geometrico
int nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nLastPxClId, Release( pGP)) ;
int nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nClPathId, Release( pGP)) ;
if ( nId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nId, MCH_CL_RISE) ;
@@ -1496,7 +1481,7 @@ Operation::AddRise( DBLVECTOR& vAxVal, double dDelta)
for ( int i = 0 ; i < int( vAxVal.size()) - 3 ; ++ i)
vAng.emplace_back( vAxVal[i+3]) ;
int nStat ;
bool bOk = ( m_pMchMgr->VerifyOutstroke( dL1, dL2, dL3, vAng, nStat) && nStat == 0) ;
bool bOk = ( m_pMchMgr->VerifyOutstroke( dL1, dL2, dL3, vAng, false, nStat) && nStat == 0) ;
// assegno i dati
pCam->SetAxes( (bOk ? CamData::AS_OK : CamData::AS_OUTSTROKE), vAxVal) ;
pCam->SetMoveType( 0) ;
@@ -1510,7 +1495,7 @@ Operation::AddRise( DBLVECTOR& vAxVal, double dDelta)
//----------------------------------------------------------------------------
bool
Operation::RemoveRise( void)
Operation::RemoveRise( int nClPathId)
{
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
@@ -1518,15 +1503,24 @@ Operation::RemoveRise( void)
int nClId = m_pGeomDB->GetFirstNameInGroup( GetOwner(), MCH_CL) ;
if ( nClId == GDB_ID_NULL)
return false ;
// recupero l'ultimo percorso CL
int nClPathId = m_pGeomDB->GetLastGroupInGroup( nClId) ;
// se percorso CL specificato, verifico appartenga al gruppo sopra ricavato
if ( nClPathId != GDB_ID_NULL) {
if ( m_pGeomDB->GetParentId( nClPathId) != nClId)
return false ;
}
// altrimenti, recupero l'ultimo percorso CL della operazione
else {
nClPathId = m_pGeomDB->GetLastGroupInGroup( nClId) ;
if ( nClPathId == GDB_ID_NULL)
return false ;
}
// elimino tutte le entità RISE alla fine del percorso
int nId = m_pGeomDB->GetFirstNameInGroup( nClPathId, MCH_CL_RISE) ;
while ( nId != GDB_ID_NULL) {
m_pGeomDB->Erase( nId) ;
nId = m_pGeomDB->GetFirstNameInGroup( nClPathId, MCH_CL_RISE) ;
}
// elimino a maggior ragione le entità HOME
// elimino a maggior ragione eventuali entità HOME
nId = m_pGeomDB->GetFirstNameInGroup( nClPathId, MCH_CL_HOME) ;
while ( nId != GDB_ID_NULL) {
m_pGeomDB->Erase( nId) ;
@@ -1716,7 +1710,7 @@ Operation::TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEn
for ( const auto nFxtId : vFxtId)
pMch->LinkFixtureToGroup( nFxtId, sTable) ;
// distanza di sicurezza
double dSafeDist = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() - 10 * EPS_SMALL ;
double dSafeDist = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() - 100 * EPS_SMALL ;
// Vado nelle posizioni da controllare
const int COLL_STEP = 16 ;
bool bCollide = false ;
+3 -3
View File
@@ -86,11 +86,11 @@ class Operation : public IUserObj
bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
bool AdjustOneStartMovement( int nClPathId, const DBLVECTOR& vAxPrev, bool bMaxZ) ;
bool AdjustOneStartMovement( int nClPathId, int nPrevClPathId, const DBLVECTOR& vAxPrev, bool bMaxZ) ;
bool ToolChangeNeeded( const Operation& Op1, const Operation& Op2) ;
bool RemoveClimb( int nClPathId) ;
bool AddRise( DBLVECTOR& vAxVal, double dDelta = - 1) ;
bool RemoveRise( void) ;
bool AddRise( DBLVECTOR& vAxVal, double dDelta = - 1, int nClPathId = GDB_ID_NULL) ;
bool RemoveRise( int nClPathId = GDB_ID_NULL) ;
bool AddHome( void) ;
bool CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) ;
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) ;
+15 -5
View File
@@ -57,8 +57,10 @@ using namespace std ;
// 2421 = "Error in Pocketing : Chaining failed"
// 2422 = "Error in Pocketing : Tool MaxMaterial too small (xxx)"
// 2423 = "Error in Pocketing : axes values not calculable"
// 2424 = "Error in Pocketing : link movements not calculable"
// 2425 = "Error in Pocketing : post apply not calculable"
// 2424 = "Error in Pocketing : outstroke xxx"
// 2425 = "Error in Pocketing : link movements not calculable"
// 2426 = "Error in Pocketing : link outstroke xxx"
// 2427 = "Error in Pocketing : post apply not calculable"
//----------------------------------------------------------------------------
USEROBJ_REGISTER( "EMkPocketing", Pocketing) ;
@@ -565,19 +567,27 @@ Pocketing::Update( void)
if ( ! m_Params.m_sInitAngs.empty())
sHint = m_Params.m_sInitAngs ;
if ( ! CalculateAxesValues( sHint)) {
m_pMchMgr->SetLastError( 2423, "Error in Pocketing : axes values not calculable") ;
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2423, "Error in Pocketing : axes values not calculable") ;
else
m_pMchMgr->SetLastError( 2424, "Error in Pocketing : outstroke ") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
if ( ! AdjustStartEndMovements()) {
m_pMchMgr->SetLastError( 2424, "Error in Pocketing : link movements not calculable") ;
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2425, "Error in Pocketing : link movements not calculable") ;
else
m_pMchMgr->SetLastError( 2426, "Error in Pocketing : link outstroke ") ;
return false ;
}
// esecuzione eventuali personalizzazioni
if ( ! PostApply()) {
m_pMchMgr->SetLastError( 2425, "Error in Pocketing : post apply not calculable") ;
m_pMchMgr->SetLastError( 2427, "Error in Pocketing : post apply not calculable") ;
return false ;
}
+15 -5
View File
@@ -45,8 +45,10 @@ using namespace std ;
// 2708 = "Error in SawFinishing : CalculateAlongToolPath failed"
// 2709 = "Error in SawFinishing : CalculateAcrossToolPath failed"
// 2710 = "Error in SawFinishing : axes values not calculable"
// 2711 = "Error in SawFinishing : link movements not calculable"
// 2712 = "Error in SawFinishing : post apply not calculable"
// 2711 = "Error in SawFinishing : outstroke xx"
// 2712 = "Error in SawFinishing : link movements not calculable"
// 2713 = "Error in SawFinishing : link outstroke xx"
// 2714 = "Error in SawFinishing : post apply not calculable"
//----------------------------------------------------------------------------
const std::string MCH_SECTION = "Sect" ;
@@ -497,19 +499,27 @@ SawFinishing::Update( void)
if ( ! m_Params.m_sInitAngs.empty())
sHint = m_Params.m_sInitAngs ;
if ( ! CalculateAxesValues( sHint)) {
m_pMchMgr->SetLastError( 2710, "Error in SawFinishing : axes values not calculable") ;
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2710, "Error in SawFinishing : axes values not calculable") ;
else
m_pMchMgr->SetLastError( 2711, "Error in SawFinishing : outstroke ") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
if ( ! AdjustStartEndMovements()) {
m_pMchMgr->SetLastError( 2711, "Error in SawFinishing : link movements not calculable") ;
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2712, "Error in SawFinishing : link movements not calculable") ;
else
m_pMchMgr->SetLastError( 2713, "Error in SawFinishing : link outstroke ") ;
return false ;
}
// esecuzione eventuali personalizzazioni
if ( ! PostApply()) {
m_pMchMgr->SetLastError( 2712, "Error in SawFinishing : post apply not calculable") ;
m_pMchMgr->SetLastError( 2714, "Error in SawFinishing : post apply not calculable") ;
return false ;
}
+15 -5
View File
@@ -45,8 +45,10 @@ using namespace std ;
// 2608 = "Error in SawRoughing : GetElevation"
// 2609 = "Error in SawRoughing : TrimSection failed"
// 2610 = "Error in SawRoughing : axes values not calculable"
// 2611 = "Error in SawRoughing : link movements not calculable"
// 2612 = "Error in SawRoughing : post apply not calculable"
// 2611 = "Error in SawRoughing : outstroke xxx"
// 2612 = "Error in SawRoughing : link movements not calculable"
// 2613 = "Error in SawRoughing : link outstroke xxx"
// 2614 = "Error in SawRoughing : post apply not calculable"
//----------------------------------------------------------------------------
const std::string MCH_SECTION = "Sect" ;
@@ -473,19 +475,27 @@ SawRoughing::Update( void)
if ( ! m_Params.m_sInitAngs.empty())
sHint = m_Params.m_sInitAngs ;
if ( ! CalculateAxesValues( sHint)) {
m_pMchMgr->SetLastError( 2610, "Error in SawRoughing : axes values not calculable") ;
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2610, "Error in SawRoughing : axes values not calculable") ;
else
m_pMchMgr->SetLastError( 2611, "Error in SawRoughing : outstroke ") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
if ( ! AdjustStartEndMovements()) {
m_pMchMgr->SetLastError( 2611, "Error in SawRoughing : link movements not calculable") ;
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2612, "Error in SawRoughing : link movements not calculable") ;
else
m_pMchMgr->SetLastError( 2613, "Error in SawRoughing : link outstroke ") ;
return false ;
}
// esecuzione eventuali personalizzazioni
if ( ! PostApply()) {
m_pMchMgr->SetLastError( 2612, "Error in SawRoughing : post apply not calculable") ;
m_pMchMgr->SetLastError( 2614, "Error in SawRoughing : post apply not calculable") ;
return false ;
}
+15 -5
View File
@@ -49,8 +49,10 @@ using namespace std ;
// 2213 = "Error in Sawing : Center work not allowed with internal arc"
// 2214 = "Error in Sawing : Chaining failed"
// 2215 = "Error in Sawing : axes values not calculable"
// 2216 = "Error in Sawing : link movements not calculable"
// 2217 = "Error in Sawing : post apply not calculable"
// 2216 = "Error in Sawing : outstroke xxx"
// 2217 = "Error in Sawing : link movements not calculable"
// 2218 = "Error in Sawing : link outstroke xxx"
// 2219 = "Error in Sawing : post apply not calculable"
//----------------------------------------------------------------------------
USEROBJ_REGISTER( "EMkSawing", Sawing) ;
@@ -587,19 +589,27 @@ Sawing::Update( void)
if ( ! m_Params.m_sInitAngs.empty())
sHint = m_Params.m_sInitAngs ;
if ( ! CalculateAxesValues( sHint)) {
m_pMchMgr->SetLastError( 2215, "Error in Sawing : axes values not calculable") ;
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2215, "Error in Sawing : axes values not calculable") ;
else
m_pMchMgr->SetLastError( 2216, "Error in Sawing : outstroke ") ;
return false ;
}
// gestione movimenti all'inizio di ogni singolo percorso di lavorazione e alla fine della lavorazione
if ( ! AdjustStartEndMovements()) {
m_pMchMgr->SetLastError( 2216, "Error in Sawing : link movements not calculable") ;
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty())
m_pMchMgr->SetLastError( 2217, "Error in Sawing : link movements not calculable") ;
else
m_pMchMgr->SetLastError( 2218, "Error in Sawing : link outstroke ") ;
return false ;
}
// esecuzione eventuali personalizzazioni
if ( ! PostApply()) {
m_pMchMgr->SetLastError( 2217, "Error in Sawing : post apply not calculable") ;
m_pMchMgr->SetLastError( 2219, "Error in Sawing : post apply not calculable") ;
return false ;
}
+1 -1
View File
@@ -748,7 +748,7 @@ Simulator::ManageMove( int& nStatus)
OutAxes.emplace_back( 0) ;
DBLVECTOR vAng( OutAxes.begin() + 3, OutAxes.end()) ;
int nStat ;
m_pMachine->VerifyOutstroke( OutAxes[0], OutAxes[1], OutAxes[2], vAng, nStat) ;
m_pMachine->VerifyOutstroke( OutAxes[0], OutAxes[1], OutAxes[2], vAng, true, nStat) ;
nStatus = MCH_SIM_OUTSTROKE ;
return false ; }
case CamData::AS_DIR_ERR :