Merge commit 'df86ffdee340b33c359d7e6b57598a70c1a1c006' into svuotature

This commit is contained in:
Riccardo Elitropi
2023-06-05 08:33:45 +02:00
9 changed files with 124 additions and 24 deletions
+2 -1
View File
@@ -1353,7 +1353,8 @@ Disposition::SpecialApply( bool bRecalc)
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori ed esco
if ( ! bOk || nErr > 0) {
m_nShifts = -2 ;
if ( m_nShifts != -1)
m_nShifts = -2 ;
string sOut = sMsg ;
if ( IsEmptyOrSpaces( sOut))
sOut = " Error in " + ON_SPECIAL_APPLY + " (" + ToString( nErr) + ")" ;
BIN
View File
Binary file not shown.
+29 -11
View File
@@ -19,6 +19,7 @@
#include "OutputConst.h"
#include "/EgtDev/Include/EMkDllMain.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EGnGetKeyData.h"
using namespace std ;
@@ -46,19 +47,31 @@ Generator::Init( MachMgr* pMchMgr)
bool
Generator::Run( const string& sCncFile, const string& sInfo)
{
// verifico sia abilitato dalla licenza
bool bEnabled = false ;
if ( GetEMkNetHwKey()) {
bEnabled = true ;
}
else {
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
// Controllo della licenza
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
if ( ! GetEMkNetHwKey())
int nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ;
bEnabled = ( nRet == KEY_OK && ( nOpt1 & KEYOPT_EMK_NC_OFF) == 0) ;
}
if ( bEnabled) {
// Verifica della abilitazione
bool bMinTime = false ;
if ( nOptExpDays >= GetMinDay())
bMinTime = true ;
bool bCurrTime = false ;
if ( nOptExpDays >= GetCurrDay())
bCurrTime = true ;
bool bKey = false ;
if ( nRet == KEY_OK)
bKey = true ;
bool bOption = false ;
if ( ( nOpt1 & KEYOPT_EMK_NC_OFF) == 0)
bOption = true ;
// Esecuzione
if ( bMinTime && bCurrTime && bKey && bOption) {
// emetto info di log
{ string sOut = "Generator Run : " + sCncFile ;
@@ -79,6 +92,11 @@ Generator::Run( const string& sCncFile, const string& sInfo)
return bOk ;
}
// cancello l'eventuale file di uscita (e anche il file errore)
EraseFile( sCncFile) ;
string sErrFile = ChangeFileExtension( sCncFile, ERR_EXT) ;
EraseFile( sErrFile) ;
// Generazione non abilitata
m_pMchMgr->SetLastError( 1000, "NC_OFF") ;
std::string sErr = "Warning on Key (MKC/NCO)" ;
+2
View File
@@ -125,6 +125,8 @@ class Machine
bool GetAllCurrAxesToken( STRVECTOR& vAxToken) const ;
bool GetCurrAxisMin( int nInd, double& dMin) const ;
bool GetCurrAxisMax( int nInd, double& dMax) const ;
bool GetCurrAxisOffset( int nInd, double& dOffset) const ;
bool GetCurrAxisInvert( int nInd, bool& bInvert) const ;
bool GetCurrAxisHomePos( int nInd, double& dHome) const ;
bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ;
const Frame3d& GetCurrLinAxesFrame( void) const
+46
View File
@@ -1827,6 +1827,52 @@ Machine::GetCurrAxisMax( int nInd, double& dMax) const
return false ;
}
//----------------------------------------------------------------------------
bool
Machine::GetCurrAxisOffset( int nInd, double& dOffset) const
{
int nLinAxes = int( m_vCalcLinAx.size()) ;
int nRotAxes = int( m_vCalcRotAx.size()) ;
if ( nInd >= 0 && nInd < nLinAxes) {
Axis* pAx = GetAxis( m_vCalcLinAx[nInd].nGrpId) ;
if ( pAx == nullptr)
return false ;
dOffset = pAx->GetOffset() ;
return true ;
}
else if ( nInd >= nLinAxes && nInd < nLinAxes + nRotAxes) {
Axis* pAx = GetAxis( m_vCalcRotAx[nInd-nLinAxes].nGrpId) ;
if ( pAx == nullptr)
return false ;
dOffset = pAx->GetOffset() ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
Machine::GetCurrAxisInvert( int nInd, bool& bInvert) const
{
int nLinAxes = int( m_vCalcLinAx.size()) ;
int nRotAxes = int( m_vCalcRotAx.size()) ;
if ( nInd >= 0 && nInd < nLinAxes) {
Axis* pAx = GetAxis( m_vCalcLinAx[nInd].nGrpId) ;
if ( pAx == nullptr)
return false ;
bInvert = pAx->GetInvert() ;
return true ;
}
else if ( nInd >= nLinAxes && nInd < nLinAxes + nRotAxes) {
Axis* pAx = GetAxis( m_vCalcRotAx[nInd-nLinAxes].nGrpId) ;
if ( pAx == nullptr)
return false ;
bInvert = pAx->GetInvert() ;
return true ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
Machine::GetCurrAxisHomePos( int nInd, double& dHome) const
+15 -5
View File
@@ -2569,7 +2569,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
bOk = false ;
}
// aggiungo opportuna retrazione
if ( ! AddSawBladeSideRetract( ptP1, vtRetr, dSafeZ, dSawEndElev, dAppr)) {
if ( ! AddSawBladeSideRetract( ptP1, vtRetr, vtTool, dSafeZ, dSawEndElev, dAppr)) {
m_pMchMgr->SetLastError( 2312, "Error in Milling : Retract not computable") ;
return false ;
}
@@ -2915,7 +2915,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
bOk = false ;
}
// aggiungo opportuna retrazione
if ( ! AddSawBladeSideRetract( ptP1, vtRetr, dSafeZ, dSawEndElev, dAppr)) {
if ( ! AddSawBladeSideRetract( ptP1, vtRetr, vtTool, dSafeZ, dSawEndElev, dAppr)) {
m_pMchMgr->SetLastError( 2312, "Error in Milling : Retract not computable") ;
return false ;
}
@@ -3377,7 +3377,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
bOk = false ;
}
// aggiungo opportuna retrazione
if ( ! AddSawBladeSideRetract( ptP1, vtRetr, dSafeZ, dSawEndElev, dAppr)) {
if ( ! AddSawBladeSideRetract( ptP1, vtRetr, vtTool, dSafeZ, dSawEndElev, dAppr)) {
m_pMchMgr->SetLastError( 2312, "Error in Milling : Retract not computable") ;
return false ;
}
@@ -4196,7 +4196,8 @@ Milling::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ,
//----------------------------------------------------------------------------
bool
Milling::AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, double dSafeZ, double dEndElev, double dAppr)
Milling::AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, const Vector3d& vtTool,
double dSafeZ, double dEndElev, double dAppr)
{
// per retrazione orizzontale vtAppr deve essere già stato sistemato dal chiamante
// se sopra uscita c'è spazio per sicurezza o approccio
@@ -4217,7 +4218,16 @@ Milling::AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, dou
return false ;
}
// 4b -> movimento di risalita sopra il punto finale
Point3d ptP4b = ptP4a + vtRetr * ( dSafeZ - dAppr) ;
Vector3d vtMove = vtRetr ;
double dMove = dSafeZ - dAppr ;
if ( ! m_bTiltingTab && vtRetr.z < sin( -ANG_RIGHT / 2)) {
vtMove = Vector3d( vtTool.x, vtTool.y, 0) ;
if ( vtMove.Normalize())
dMove = dSafeZ ;
else
vtMove = vtRetr ;
}
Point3d ptP4b = ptP4a + vtMove * dMove ;
if ( AddRapidMove( ptP4b) == GDB_ID_NULL)
return false ;
}
+2 -1
View File
@@ -102,7 +102,8 @@ class Milling : public Machining
bool AddDirectApproach( const Point3d& ptP) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bAboveEnd) ;
bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, double dSafeZ, double dEndElev, double dAppr) ;
bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, const Vector3d& vtTool,
double dSafeZ, double dEndElev, double dAppr) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool,
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1) const ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
+10 -1
View File
@@ -1917,8 +1917,17 @@ Operation::CalculateAxesValues( const string& sHint, bool bRotContOnNext, bool b
if ( m_pMchMgr->GetCurrMachine()->GetCurrAxisToken( nLinAxes + i, sAxToken) &&
szKey == Trim( sAxToken)) {
double dVal ;
if ( FromString( szVal, dVal))
if ( FromString( szVal, dVal)) {
double dOffset = 0 ;
m_pMchMgr->GetCurrMachine()->GetCurrAxisOffset( nLinAxes + i, dOffset) ;
if ( abs( dOffset) > EPS_ANG_SMALL)
dVal -= dOffset ;
bool bInvert = false ;
m_pMchMgr->GetCurrMachine()->GetCurrAxisInvert( nLinAxes + i, bInvert) ;
if ( bInvert)
dVal = -dVal ;
vAxRotPrec[i] = dVal ;
}
break ;
}
}
+18 -5
View File
@@ -7606,14 +7606,22 @@ Pocketing::AdjustTrapezoidSpiralForAngles( ICurveComposite* pMCrv, const ICurveC
}
}
// se il lato opposto a quello di riferimento è chiuso ha senso aggiungere solo se il punto è sotto la linea di svuotatura
// se il lato opposto a quello di riferimento chiuso bisogna distinguere i casi
else {
if ( ptP2.y < dYCoord) {
pCompo->AddPoint( ptP2) ;
Point3d ptCrv ;
pMCrv->GetStartPoint( ptCrv) ;
pCompo->AddLine( ptCrv) ;
}
else {
Vector3d vtDir ;
pLine->GetStartDir( vtDir) ;
if ( bStart)
vtDir.Invert() ;
Point3d ptP2N = ptP2 - m_TParams.m_dDiam / 2 * abs( vtDir.x / vtDir.y) * vtDir ;
pCompo->AddPoint( ptP2N) ;
}
Point3d ptCrv ;
pMCrv->GetStartPoint( ptCrv) ;
pCompo->AddLine( ptCrv) ;
}
// setto temp prop per ricordare che è curva aggiuntiva per pulire angoli
@@ -7793,8 +7801,13 @@ Pocketing::ComputeTrapezoidSpiralLeadInLeadOut( ICurveComposite* pCompo, const V
// return false ;
if( ! GetSignedDistFromStmRaw( m_nPhase, ptP, vtDirP, dDist, vtNorm))
return false ;
if ( abs( dDist) < EPS_SMALL) {
ptP -= vtDirP ;
if ( ! CalcDistanceFromRawSurface( m_nPhase, ptP, vtDirP, dDist, vtNorm))
return false ;
}
// calcolo eventuali fattori correttivi
// calcolo eventuali fattori correttivi (se uscita approx. con fianco utensile)
double dCorr = 1 ;
double dDistRef = dDist ;
double dDistMin ;