EgtMachKernel 2.4i :

- aggiunta gestione offset assi per visualizzazione
- correzioni in Milling e Pocketing per approcci e retrazioni con TiltingTab (comprende asse rotante tipo ralla).
This commit is contained in:
DarioS
2022-09-24 18:53:47 +02:00
parent dffc7ec956
commit ff6aae071a
14 changed files with 103 additions and 41 deletions
+5 -3
View File
@@ -46,6 +46,7 @@ Axis::Clone( void) const
pAx->m_sName = m_sName ;
pAx->m_sToken = m_sToken ;
pAx->m_bInvert = m_bInvert ;
pAx->m_dOffset = m_dOffset ;
pAx->m_nType = m_nType ;
pAx->m_ptPos = m_ptPos ;
pAx->m_vtDir = m_vtDir ;
@@ -109,19 +110,20 @@ Axis::GetGeomDB( void) const
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
Axis::Axis( void)
: m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr),
: m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_bInvert( false), m_dOffset( 0),
m_nType( MCH_AT_NONE), m_Stroke( {{0,0}}), m_dHomeVal( 0), m_dCurrVal( 0)
{
}
//----------------------------------------------------------------------------
bool
Axis::Set( const string& sName, const string& sToken, bool bInvert, int nType,
const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome)
Axis::Set( const string& sName, const string& sToken, bool bInvert, double dOffset,
int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome)
{
m_sName = sName ;
m_sToken = sToken ;
m_bInvert = bInvert ;
m_dOffset = dOffset ;
m_nType = nType ;
m_ptPos = ptPos ;
m_vtDir = vtDir ;
+7 -4
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2015
// EgalTech 2015-2022
//----------------------------------------------------------------------------
// File : Axis.h Data : 24.05.15 Versione : 1.6e7
// File : Axis.h Data : 21.09.22 Versione : 2.4i
// Contenuto : Dichiarazione della classe Axis.
//
//
@@ -30,8 +30,8 @@ class Axis : public IUserObj
public :
Axis( void) ;
bool Set( const std::string& sName, const std::string& sToken, bool bInvert, int nType,
const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) ;
bool Set( const std::string& sName, const std::string& sToken, bool bInvert, double dOffset,
int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke, double dHome) ;
bool Modify( const Point3d& ptPos, double dAxisMaxAdjust) ;
bool Modify( const Vector3d& vtDir, double dAxisMaxRotAdj) ;
bool Modify( const STROKE& Stroke) ;
@@ -44,6 +44,8 @@ class Axis : public IUserObj
{ return m_sToken ; }
bool GetInvert( void) const
{ return m_bInvert ; }
double GetOffset( void) const
{ return m_dOffset ; }
int GetType( void) const
{ return m_nType ; }
const Point3d& GetPos( void) const
@@ -63,6 +65,7 @@ class Axis : public IUserObj
std::string m_sName ;
std::string m_sToken ;
bool m_bInvert ;
double m_dOffset ;
int m_nType ;
Point3d m_ptPos ;
Vector3d m_vtDir ;
BIN
View File
Binary file not shown.
+4 -2
View File
@@ -1,7 +1,7 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2021
// EgalTech 2015-2022
//----------------------------------------------------------------------------
// File : MachMgr.h Data : 24.05.21 Versione : 2.3e3
// File : MachMgr.h Data : 21.09.22 Versione : 2.4i4
// Contenuto : Dichiarazione della classe MachMgr.
//
//
@@ -10,6 +10,7 @@
// 16.05.19 DS Aggiunto parametro sToolMakersDir a Init.
// 17.08.20 DS Aggiunte GetAxisMin e GetAxisMax.
// 17.03.21 DS Aggiunte funzioni per import/export utensili.
// 21.09.22 DS Aggiunta GetAxisOffset.
//
//----------------------------------------------------------------------------
@@ -353,6 +354,7 @@ class MachMgr : public IMachMgr
bool GetAxisToken( const std::string& sAxis, std::string& sToken) const override ;
bool GetAxisType( const std::string& sAxis, bool& bLinear) const override ;
bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const override ;
bool GetAxisOffset( const std::string& sAxis, double& dOffset) const override ;
bool SetAxisPos( const std::string& sAxis, double dVal, double* pdNewVal = nullptr) override ;
bool GetAxisPos( const std::string& sAxis, double& dVal) const override ;
bool GetAxisMin( const std::string& sAxis, double& dMin) const override ;
+9
View File
@@ -339,6 +339,15 @@ MachMgr::GetAxisInvert( const string& sAxis, bool& bInvert) const
return ( ( pMch != nullptr) ? pMch->GetAxisInvert( sAxis, bInvert) : false) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::GetAxisOffset( const string& sAxis, double& dOffset) const
{
Machine* pMch = GetCurrMachine() ;
// restituisco il valore di offset asse in visualizzazione
return ( ( pMch != nullptr) ? pMch->GetAxisOffset( sAxis, dOffset) : false) ;
}
//----------------------------------------------------------------------------
bool
MachMgr::SetAxisPos( const string& sAxis, double dVal, double* pdNewVal)
+2 -2
View File
@@ -286,7 +286,7 @@ Machine::AdjustTable( int nLay, const Point3d& ptRef1)
//----------------------------------------------------------------------------
bool
Machine::LoadMachineAxis( const string& sName, const string& sParent, const string& sToken, bool bInvert,
int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
double dOffset, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
double dHome, bool bAdjustAux, const string& sGeo, const STRVECTOR& vsAux)
{
// verifico sia di tipo ammesso
@@ -327,7 +327,7 @@ Machine::LoadMachineAxis( const string& sName, const string& sParent, const stri
Axis* pAxis = new(nothrow) Axis ;
if ( pAxis == nullptr)
return false ;
pAxis->Set( sName, sToken, bInvert, nType, ptPos, vtDir, Stroke, dHome) ;
pAxis->Set( sName, sToken, bInvert, dOffset, nType, ptPos, vtDir, Stroke, dHome) ;
m_pGeomDB->SetUserObj( nLay, pAxis) ;
// verifico il vettore rappresentativo dell'asse
if ( ! AdjustAxis( nLay, sPart, sName, nType, ptPos, vtDir, bAdjustAux))
+3 -2
View File
@@ -75,6 +75,7 @@ class Machine
bool ResetHeadSet( const std::string& sHead) ;
bool GetAxisToken( const std::string& sAxis, std::string& sToken) const ;
bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const ;
bool GetAxisOffset( const std::string& sAxis, double& dOffset) const ;
bool GetAxisType( const std::string& sAxis, bool& bLinear) const ;
bool SetAxisPos( const std::string& sAxis, double dVal, double* pdNewVal = nullptr) ;
bool GetAxisPos( const std::string& sAxis, double& dVal) const ;
@@ -184,8 +185,8 @@ class Machine
const Point3d& ptRef1, double dCoeffX, double dCoeffY, double dCoeffZ,
const std::string& sGeo, const STRVECTOR& vsAux) ;
bool AdjustTable( int nLay, const Point3d& ptRef1) ;
bool LoadMachineAxis( const std::string& sName, const std::string& sParent, const std::string& sToken,
bool bInvert, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
bool LoadMachineAxis( const std::string& sName, const std::string& sParent, const std::string& sToken, bool bInvert,
double dOffset, int nType, const Point3d& ptPos, const Vector3d& vtDir, const STROKE& Stroke,
double dHome, bool bAdjustAux, const std::string& sGeo, const STRVECTOR& vsAux) ;
bool AdjustAxis( int nLay, const std::string& sPart, const std::string& sName,
int nType, const Point3d& ptPos, const Vector3d& vtDir, bool bAdjustAux) ;
+16
View File
@@ -54,6 +54,22 @@ Machine::GetAxisInvert( const string& sAxis, bool& bInvert) const
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::GetAxisOffset( const string& sAxis, double& dOffset) const
{
// controllo GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero il relativo gestore
Axis* pAx = GetAxis( GetGroup( sAxis)) ;
if ( pAx == nullptr)
return false ;
// recupero il valore di offset dell'asse in visualizzazione
dOffset = pAx->GetOffset() ;
return true ;
}
//----------------------------------------------------------------------------
bool
Machine::GetAxisType( const string& sAxis, bool& bLinear) const
+6 -2
View File
@@ -41,6 +41,7 @@ static const string FLD_AUX = "Aux" ;
static const string FLD_TOKEN = "Token" ;
static const string FLD_TYPE = "Type" ;
static const string FLD_INVERT = "Invert" ;
static const string FLD_AXIS_OFFSET = "Offset" ;
static const string FLD_REF1 = "Ref1" ;
static const string FLD_SCALE = "Scale" ;
static const string FLD_POS = "Pos" ;
@@ -490,6 +491,9 @@ Machine::LuaEmtAxis( lua_State* L)
// lettura eventuale campo 'Invert' dalla tabella (default false)
bool bInvert = false ;
LuaGetTabFieldParam( L, 1, FLD_INVERT, bInvert) ;
// lettura eventuale campo 'Offset' dalla tabella (default 0)
double dOffset = 0 ;
LuaGetTabFieldParam( L, 1, FLD_AXIS_OFFSET, dOffset) ;
// lettura campo 'Type' dalla tabella
int nType ;
LuaCheckTabFieldParam( L, 1, FLD_TYPE, nType)
@@ -525,8 +529,8 @@ Machine::LuaEmtAxis( lua_State* L)
return luaL_error( L, " Unknown Machine") ;
// carico i dati dell'asse
if ( ! m_pMchLua->LoadMachineAxis( sName, sParent, sToken, bInvert, nType, ptPos, vtDir,
Stroke, dHome, bAdjustAux, sGeo, vsAux))
if ( ! m_pMchLua->LoadMachineAxis( sName, sParent, sToken, bInvert, dOffset,
nType, ptPos, vtDir, Stroke, dHome, bAdjustAux, sGeo, vsAux))
return luaL_error( L, " Load Machine Axis failed") ;
// restituisco l'indice dell'asse
+10 -10
View File
@@ -2267,7 +2267,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) {
// correggo elevazione iniziale per punto inizio attacco (se testa da sopra senza aggregato approccio mai Z-)
Vector3d vtEscape = vtTool ;
if ( m_bAboveHead && ! m_bAggrBottom && vtTool.z < - EPS_SMALL) {
if ( m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab && vtTool.z < - EPS_SMALL) {
vtEscape.z = 0 ;
vtEscape.Normalize() ;
}
@@ -2416,7 +2416,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
bool bAboveEnd = m_bAboveHead && GetPointAboveRaw( ptP1, vtTool) ;
// correggo elevazione finale per punto fine uscita (se testa da sopra senza aggregato approccio mai Z-)
Vector3d vtEscape = vtTool ;
if ( m_bAboveHead && ! m_bAggrBottom && vtTool.z < - EPS_SMALL) {
if ( m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab && vtTool.z < - EPS_SMALL) {
vtEscape.z = 0 ;
vtEscape.Normalize() ;
}
@@ -2578,7 +2578,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
if ( j == 1 && ( m_TParams.m_nType & TF_SAWBLADE) == 0) {
// correggo elevazione iniziale per punto inizio attacco (se testa da sopra senza aggregato approccio mai Z-)
Vector3d vtEscape = vtTool ;
if ( m_bAboveHead && ! m_bAggrBottom && vtTool.z < - EPS_SMALL) {
if ( m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab && vtTool.z < - EPS_SMALL) {
vtEscape.z = 0 ;
vtEscape.Normalize() ;
}
@@ -2709,7 +2709,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
bool bAboveEnd = m_bAboveHead && GetPointAboveRaw( ptP1, vtTool) ;
// correggo elevazione finale per punto fine uscita (se testa da sopra senza aggregato approccio mai Z-)
Vector3d vtEscape = vtTool ;
if ( m_bAboveHead && ! m_bAggrBottom && vtTool.z < - EPS_SMALL) {
if ( m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab && vtTool.z < - EPS_SMALL) {
vtEscape.z = 0 ;
vtEscape.Normalize() ;
}
@@ -2837,7 +2837,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
// correggo elevazione iniziale per punto inizio attacco (se testa da sopra senza aggregato approccio mai Z-)
Point3d ptP1m = ptP1 - 10 * EPS_SMALL * vtTool ;
Vector3d vtEscape = vtTool ;
if ( m_bAboveHead && ! m_bAggrBottom && vtTool.z < - EPS_SMALL) {
if ( m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab && vtTool.z < - EPS_SMALL) {
vtEscape.z = 0 ;
vtEscape.Normalize() ;
}
@@ -2959,7 +2959,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
// correggo elevazione finale per punto fine uscita (se testa da sopra senza aggregato approccio mai Z-)
Point3d ptP1m = ptP1 - 10 * EPS_SMALL * vtTool ;
Vector3d vtEscape = vtTool ;
if ( m_bAboveHead && ! m_bAggrBottom && vtTool.z < - EPS_SMALL) {
if ( m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab && vtTool.z < - EPS_SMALL) {
vtEscape.z = 0 ;
vtEscape.Normalize() ;
}
@@ -3062,7 +3062,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) {
// correggo elevazione iniziale per punto inizio attacco (se testa da sopra senza aggregato approccio mai Z-)
Vector3d vtEscape = vtTool ;
if ( m_bAboveHead && ! m_bAggrBottom && vtTool.z < - EPS_SMALL) {
if ( m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab && vtTool.z < - EPS_SMALL) {
vtEscape.z = 0 ;
vtEscape.Normalize() ;
}
@@ -3165,7 +3165,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
bool bAboveEnd = m_bAboveHead && GetPointAboveRaw( ptP1, vtTool) ;
// correggo elevazione finale per punto fine uscita (se testa da sopra senza aggregato approccio mai Z-)
Vector3d vtEscape = vtTool ;
if ( m_bAboveHead && ! m_bAggrBottom && vtTool.z < - EPS_SMALL) {
if ( m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab && vtTool.z < - EPS_SMALL) {
vtEscape.z = 0 ;
vtEscape.Normalize() ;
}
@@ -3234,7 +3234,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
if ( ( m_TParams.m_nType & TF_SAWBLADE) == 0) {
// correggo elevazione iniziale per punto inizio attacco (se testa da sopra senza aggregato approccio mai Z-)
Vector3d vtEscape = vtTool ;
if ( m_bAboveHead && ! m_bAggrBottom && vtTool.z < - EPS_SMALL) {
if ( m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab && vtTool.z < - EPS_SMALL) {
vtEscape.z = 0 ;
vtEscape.Normalize() ;
}
@@ -3337,7 +3337,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
bool bAboveEnd = m_bAboveHead && GetPointAboveRaw( ptP1, vtTool) ;
// correggo elevazione finale per punto fine uscita (se testa da sopra senza aggregato approccio mai Z-)
Vector3d vtEscape = vtTool ;
if ( m_bAboveHead && ! m_bAggrBottom && vtTool.z < - EPS_SMALL) {
if ( m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab && vtTool.z < - EPS_SMALL) {
vtEscape.z = 0 ;
vtEscape.Normalize() ;
}
+1
View File
@@ -95,6 +95,7 @@ static const std::string GVAR_AUX = ".AUX" ; // (string) dato ausi
static const std::string GVAR_MOVEID = ".MOVEID" ; // (int) identificativo movimento
static const std::string GVAR_MOVEIND = ".MOVEIND" ; // (int) indice movimento
static const std::string GVAR_MOVE = ".MOVE" ; // (int) tipo di movimento (0,1,2,3)
static const std::string GVAR_AXESMASK = ".AXESMASK" ; // (int) mask del movimento degli assi (solo se rapido)
static const std::string GVAR_L1 = ".L1" ; // (num) valore del primo asse lineare
static const std::string GVAR_L2 = ".L2" ; // (num) valore del secondo asse lineare
static const std::string GVAR_L3 = ".L3" ; // (num) valore del terzo asse lineare
+10 -10
View File
@@ -2083,7 +2083,7 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
double dStElev ;
GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev) ;
dStElev = max( dStElev, j * dStep) ;
bool bUnderRaw = m_bAboveHead && ! m_bAggrBottom &&
bool bUnderRaw = m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab &&
GetPointUnderRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dStElev) ;
if ( bUnderRaw)
dStElev = max( dStElev, j * dStep) ;
@@ -2233,7 +2233,7 @@ Pocketing::AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, con
double dStElev ;
if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev))
dStElev = dStep ;
bool bUnderRaw = m_bAboveHead && ! m_bAggrBottom &&
bool bUnderRaw = m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab &&
GetPointUnderRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dStElev) ;
if ( bUnderRaw)
dStElev = max( dStElev, dStep) ;
@@ -3040,7 +3040,7 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con
double dStElev ;
if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev))
dStElev = dStep ;
bool bUnderRaw = m_bAboveHead && ! m_bAggrBottom &&
bool bUnderRaw = m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab &&
GetPointUnderRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dStElev) ;
if ( bUnderRaw)
dStElev = max( dStElev, dStep) ;
@@ -3194,7 +3194,7 @@ Pocketing::AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, con
double dStElev ;
if ( ! GetElevation( m_nPhase, ptS - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev))
dStElev = j * dStep ;
bool bUnderRaw = m_bAboveHead && ! m_bAggrBottom &&
bool bUnderRaw = m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab &&
GetPointUnderRaw( ptP, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dStElev) ;
if ( bUnderRaw)
dStElev = max( dStElev, j * dStep) ;
@@ -3382,7 +3382,7 @@ Pocketing::AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, c
double dStElev ;
if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev))
dStElev = dStep ;
bool bUnderRaw = m_bAboveHead && ! m_bAggrBottom &&
bool bUnderRaw = m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab &&
GetPointUnderRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dStElev) ;
if ( bUnderRaw || ( bOutStart && ! m_bAboveHead))
dStElev = max( dStElev, dStep) ;
@@ -3608,7 +3608,7 @@ Pocketing::AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool,
double dStElev ;
if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev))
dStElev = dStep ;
bool bUnderRaw = m_bAboveHead && ! m_bAggrBottom &&
bool bUnderRaw = m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab &&
GetPointUnderRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dStElev) ;
if ( bUnderRaw || ( bOutStart && ! m_bAboveHead))
dStElev = max( dStElev, dStep) ;
@@ -5268,8 +5268,8 @@ Pocketing::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector
dElev = dEndElev ;
// correzione per punto sotto il grezzo con testa normale da sopra
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
bool bUnderEnd = m_bAboveHead && ! m_bAggrBottom && GetPointUnderRaw( ptP1, vtN, 0,
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtN, dElev) ;
bool bUnderEnd = m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab &&
GetPointUnderRaw( ptP1, vtN, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtN, dElev) ;
return true ;
}
case POCKET_LO_GLIDE :
@@ -5304,8 +5304,8 @@ Pocketing::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector
dElev = dEndElev ;
// correzione per punto sotto il grezzo con testa normale da sopra
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
bool bUnderEnd = m_bAboveHead && ! m_bAggrBottom && GetPointUnderRaw( ptP1, vtN, 0,
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtN, dElev) ;
bool bUnderEnd = m_bAboveHead && ! m_bAggrBottom && ! m_bTiltingTab &&
GetPointUnderRaw( ptP1, vtN, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtN, dElev) ;
return true ;
}
default :
+26 -5
View File
@@ -70,6 +70,7 @@ Simulator::Simulator( void)
m_dVmTdOffs = 0 ;
m_dVmAdOffs = 0 ;
m_dSafeDist = SAFEDIST_STD ;
m_nAxesMask = 0 ;
m_bEnabAxes = true ;
m_bShowAxes = true ;
m_AxesName.reserve( 8) ;
@@ -208,6 +209,7 @@ Simulator::ResetInterpolation( void)
m_dVmTdOffs = 0 ;
m_dVmAdOffs = 0 ;
m_dSafeDist = SAFEDIST_STD ;
m_nAxesMask = 0 ;
m_bEnabAxes = true ;
m_bShowAxes = true ;
return true ;
@@ -311,14 +313,16 @@ Simulator::GetAxisInfoPos( int nI, string& sName, string& sToken, bool& bLinear,
// recupero la posizione
if ( ! m_pMchMgr->GetAxisPos( sName, dVal))
return false ;
// verifico se da invertire
// verifico se da invertire o offsettare
if ( nI < nAxisCount) {
if ( m_AxesInvert[nI])
dVal = - dVal ;
dVal += m_AxesOffset[nI] ;
}
else {
if ( m_AuxAxesInvert[nI - nAxisCount])
dVal = - dVal ;
dVal += m_AxesOffset[nI - nAxisCount] ;
}
return true ;
}
@@ -552,6 +556,9 @@ Simulator::UpdateAxes( void)
bool bInvert ;
m_pMachine->GetAxisInvert( m_AxesName[i], bInvert) ;
m_AxesInvert.push_back( bInvert) ;
double dOffset ;
m_pMachine->GetAxisOffset( m_AxesName[i], dOffset) ;
m_AxesOffset.push_back( dOffset) ;
bool bLinear ;
m_pMachine->GetAxisType( m_AxesName[i], bLinear) ;
m_AxesLinear.push_back( bLinear) ;
@@ -590,6 +597,7 @@ Simulator::ResetAxes( void)
m_AxesInvert.clear() ;
m_AxesLinear.clear() ;
m_AxesVal.clear() ;
m_nAxesMask = 0 ;
return true ;
}
@@ -601,6 +609,7 @@ Simulator::ResetAuxAxes( void)
m_AuxAxesName.clear() ;
m_AuxAxesToken.clear() ;
m_AuxAxesInvert.clear() ;
m_AuxAxesOffset.clear() ;
m_AuxAxesLinear.clear() ;
m_AuxAxesVal.clear() ;
m_AuxAxesEnd.clear() ;
@@ -943,10 +952,13 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
DBLVECTOR AxesEnd = pCamData->GetAxesVal() ;
// Tipo di movimento
int nMoveType = pCamData->GetMoveType() ;
// Se inizio di nuova entità, mascheratura movimento
if ( m_nEntId != GDB_ID_NULL && m_dCoeff < EPS_ZERO)
m_nAxesMask = pCamData->GetAxesMask() ;
// Se movimento in rapido muovo solo gli assi abilitati dal mask
if ( nMoveType == 0) {
for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i) {
if ( ( pCamData->GetAxesMask() & 1 << i) == 0)
if ( ( m_nAxesMask & 1 << i) == 0)
AxesEnd[i] = m_AxesVal[i] ;
}
}
@@ -962,7 +974,7 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
// Se movimento in rapido aggiorno quote degli assi disabilitati dal mask
if ( nMoveType == 0) {
for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i) {
if ( ( pCamData->GetAxesMask() & 1 << i) == 0)
if ( ( m_nAxesMask & 1 << i) == 0)
AxesEnd[i] = m_AxesVal[i] ;
}
}
@@ -1511,15 +1523,17 @@ Simulator::OnToolSelect( const string& sTool, const string& sHead, int nExit, co
m_AuxAxesName.reserve( nNumAuxAxes) ;
m_AuxAxesToken.reserve( nNumAuxAxes) ;
m_AuxAxesInvert.reserve( nNumAuxAxes) ;
m_AuxAxesOffset.reserve( nNumAuxAxes) ;
m_AuxAxesLinear.reserve( nNumAuxAxes) ;
m_AuxAxesVal.reserve( nNumAuxAxes) ;
m_AuxAxesEnd.reserve( nNumAuxAxes) ;
for ( int i = 1 ; i <= nNumAuxAxes && bOk ; ++ i) {
string sName ; string sToken ; bool bInvert ; bool bLinear ; double dVal ;
string sName ; string sToken ; bool bInvert ; double dOffset ; bool bLinear ; double dVal ;
string sAuxAxName = GLOB_VAR + GVAR_ANN ; ReplaceString( sAuxAxName, "N", ToString( i)) ;
if ( m_pMachine->LuaGetGlobVar( sAuxAxName, sName) &&
m_pMachine->GetAxisToken( sName, sToken) &&
m_pMachine->GetAxisInvert( sName, bInvert) &&
m_pMachine->GetAxisOffset( sName, dOffset) &&
m_pMachine->GetAxisType( sName, bLinear) &&
m_pMachine->GetAxisPos( sName, dVal)) {
// se non è già negli assi principali, lo aggiungo
@@ -1527,6 +1541,7 @@ Simulator::OnToolSelect( const string& sTool, const string& sHead, int nExit, co
m_AuxAxesName.emplace_back( sName) ;
m_AuxAxesToken.emplace_back( sToken) ;
m_AuxAxesInvert.push_back( bInvert) ;
m_AuxAxesOffset.push_back( dOffset) ;
m_AuxAxesLinear.push_back( bLinear) ;
m_AuxAxesVal.emplace_back( dVal) ;
m_AuxAxesEnd.emplace_back( dVal) ;
@@ -1713,6 +1728,7 @@ Simulator::OnMoveStart( const CamData* pCamData, int& nErr)
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEID, m_nEntId) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVEIND, m_nEntInd) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MOVE, pCamData->GetMoveType()) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_AXESMASK, pCamData->GetAxesMask()) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG, pCamData->GetFlag()) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_FLAG2, pCamData->GetFlag2()) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_INDEX, pCamData->GetIndex()) ;
@@ -1764,6 +1780,7 @@ Simulator::OnMoveStart( const CamData* pCamData, int& nErr)
ResetAuxAxes() ;
// recupero i dati di ritorno
m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_AXESMASK, m_nAxesMask) ;
if ( ! m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_ENABAXES, m_bEnabAxes))
m_bEnabAxes = true ;
if ( ! m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_SHOWAXES, m_bShowAxes))
@@ -1774,17 +1791,19 @@ Simulator::OnMoveStart( const CamData* pCamData, int& nErr)
m_AuxAxesName.reserve( nNumAuxAxes) ;
m_AuxAxesToken.reserve( nNumAuxAxes) ;
m_AuxAxesInvert.reserve( nNumAuxAxes) ;
m_AuxAxesOffset.reserve( nNumAuxAxes) ;
m_AuxAxesLinear.reserve( nNumAuxAxes) ;
m_AuxAxesVal.reserve( nNumAuxAxes) ;
m_AuxAxesEnd.reserve( nNumAuxAxes) ;
for ( int i = 1 ; i <= nNumAuxAxes && bOk ; ++ i) {
string sName ; string sToken ; bool bInvert ; bool bLinear ; double dVal ; double dEnd ; string sLink ;
string sName ; string sToken ; bool bInvert ; double dOffset ; bool bLinear ; double dVal ; double dEnd ; string sLink ;
string sAuxAxVal = GLOB_VAR + GVAR_AN ; ReplaceString( sAuxAxVal, "N", ToString( i)) ;
string sAuxAxName = GLOB_VAR + GVAR_ANN ; ReplaceString( sAuxAxName, "N", ToString( i)) ;
string sAuxAxMaster = GLOB_VAR + GVAR_ANM ; ReplaceString( sAuxAxMaster, "N", ToString( i)) ;
if ( m_pMachine->LuaGetGlobVar( sAuxAxName, sName) &&
m_pMachine->GetAxisToken( sName, sToken) &&
m_pMachine->GetAxisInvert( sName, bInvert) &&
m_pMachine->GetAxisOffset( sName, dOffset) &&
m_pMachine->GetAxisType( sName, bLinear) &&
m_pMachine->GetAxisPos( sName, dVal)) {
// se assi principali abilitati e da agganciare ad asse principale
@@ -1801,6 +1820,7 @@ Simulator::OnMoveStart( const CamData* pCamData, int& nErr)
m_AuxAxesName.emplace_back( sName) ;
m_AuxAxesToken.emplace_back( sToken) ;
m_AuxAxesInvert.push_back( bInvert) ;
m_AuxAxesOffset.push_back( dOffset) ;
m_AuxAxesLinear.push_back( bLinear) ;
m_AuxAxesVal.emplace_back( 0) ;
m_AuxAxesEnd.emplace_back( 0) ;
@@ -1814,6 +1834,7 @@ Simulator::OnMoveStart( const CamData* pCamData, int& nErr)
m_AuxAxesName.emplace_back( sName) ;
m_AuxAxesToken.emplace_back( sToken) ;
m_AuxAxesInvert.push_back( bInvert) ;
m_AuxAxesOffset.push_back( dOffset) ;
m_AuxAxesLinear.push_back( bLinear) ;
m_AuxAxesVal.emplace_back( dVal) ;
m_AuxAxesEnd.emplace_back( dEnd) ;
+4 -1
View File
@@ -132,16 +132,19 @@ class Simulator
double m_dVmAdOffs ; // offset utensile in direzione ausiliaria per VM
COBVECTOR m_CollObj ; // vettore oggetti da testare per collisione con grezzo
double m_dSafeDist ; // distanza di sicurezza per verifica collisioni
int m_nAxesMask ; // maschera a bit di abilitazione movimento assi (solo se rapido)
bool m_bEnabAxes ; // flag abilitazione movimento assi attivi
bool m_bShowAxes ; // flag visualizzazione assi attivi
STRVECTOR m_AxesName ; // nomi degli assi macchina attivi
STRVECTOR m_AxesToken ; // token degli assi macchina attivi
BOOLVECTOR m_AxesInvert ; // flag di asse con verso invertito
BOOLVECTOR m_AxesInvert ; // flag di asse con verso invertito degli assi macchina attivi
DBLVECTOR m_AxesOffset ; // valore di offset delgli assi macchina ttivi
BOOLVECTOR m_AxesLinear ; // flag di lineare degli assi macchina attivi
DBLVECTOR m_AxesVal ; // valori degli assi macchina all'inizio del movimento corrente
STRVECTOR m_AuxAxesName ; // nomi degli assi macchina ausiliari abilitati
STRVECTOR m_AuxAxesToken ; // token degli assi macchina ausiliari abilitati
BOOLVECTOR m_AuxAxesInvert ; // flag di asse con verso invertito degli assi macchina ausiliari abilitati
DBLVECTOR m_AuxAxesOffset ; // valore di offset degli assi macchina ausiliari abilitati
BOOLVECTOR m_AuxAxesLinear ; // flag di lineare degli assi macchina ausiliari abilitati
DBLVECTOR m_AuxAxesVal ; // valori degli assi macchina ausiliari all'inizio del movimento corrente
DBLVECTOR m_AuxAxesEnd ; // valori degli assi macchina ausiliari alla fine del movimento corrente