EgtMachKernel 3.1h4 :

- corretta gestione inserimento punto medio in rapidi con lama con cambio di direzioni T e A a spirale
- eliminata funzione AdjustEndPointForAxesCalc da SurfFinishing, SurfRoughing e WaterJetting
- a AdjustEndPointForAxesCalc aggiunto parametro per indicare se da punto di lavoro a tip o viceversa.
This commit is contained in:
DarioS
2026-08-28 10:06:34 +02:00
parent b63914f60b
commit 56774c497f
21 changed files with 67 additions and 108 deletions
BIN
View File
Binary file not shown.
+2 -2
View File
@@ -960,12 +960,12 @@ FiveAxisMilling::GetGeometry( SELVECTOR& vIds) const
//----------------------------------------------------------------------------
bool
FiveAxisMilling::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const
FiveAxisMilling::AdjustEndPointForAxesCalc( const Vector3d& vtCorr, Point3d& ptP, bool bToVsFrom) const
{
// se utensile lama
if ( ( m_TParams.m_nType & TF_SAWBLADE) != 0) {
// compenso il raggio dell'utensile
ptP += pCamData->GetCorrDir() * ( m_TParams.m_dDiam / 2) ;
ptP += ( bToVsFrom ? +1 : -1) * vtCorr * ( m_TParams.m_dDiam / 2) ;
}
return true ;
}
+1 -1
View File
@@ -49,7 +49,7 @@ class FiveAxisMilling : public Machining
protected : // Operation
int GetSolCh( void) const override
{ return m_Params.m_nSolCh ; }
bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override ;
bool AdjustEndPointForAxesCalc( const Vector3d& vtCorr, Point3d& ptP, bool bToVsFrom = true) const override ;
public : // Machining
bool Prepare( const std::string& sMillName) override ;
+3
View File
@@ -19,6 +19,9 @@
//----------- Minima distanza di sicurezza ----------------------------------
const double MIN_SAFEDIST = 5.0 ;
//----------- Minima tolleranza su movimenti in rapido ----------------------
const double MIN_SAFERAPID = 2.0 ;
//----------- Costanti per approssimazioni con polilinee o poliarchi --------
const double LIN_TOL_STD = 0.1 ;
const double LIN_TOL_FINE = 0.01 ;
+1 -1
View File
@@ -853,7 +853,7 @@ Machining::MyToolPreview( int nEntId, bool bDouble) const
if ( pCamData == nullptr)
return false ;
Point3d ptEnd = pCamData->GetEndPoint() ;
AdjustEndPointForAxesCalc( pCamData, ptEnd) ;
AdjustEndPointForAxesCalc( pCamData->GetCorrDir(), ptEnd) ;
// recupero gli assi e i loro valori per la posizione corrente
const DBLVECTOR& vAxVal = pCamData->GetAxesVal() ;
+3 -4
View File
@@ -1647,13 +1647,12 @@ Milling::Chain( int nGrpDestId)
//----------------------------------------------------------------------------
bool
Milling::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const
Milling::AdjustEndPointForAxesCalc( const Vector3d& vtCorr, Point3d& ptP, bool bToVsFrom) const
{
// se utensile lama
if ( ( m_TParams.m_nType & TF_SAWBLADE) != 0) {
// traslazione opposta a quanto fatto in AdjustPathDrawForSaw
double dOffset = 0.5 * m_TParams.m_dDiam - 10 * EPS_SMALL ;
ptP.Translate( dOffset * pCamData->GetCorrDir()) ;
// se To traslazione opposta a quanto fatto in AdjustPathDrawForSaw, altrimenti uguale
ptP += ( bToVsFrom ? +1 : -1) * vtCorr * ( 0.5 * m_TParams.m_dDiam - 10 * EPS_SMALL) ;
}
// negli altri casi, non devo fare alcunché
return true ;
+1 -1
View File
@@ -51,7 +51,7 @@ class Milling : public Machining
protected : // Operation
int GetSolCh( void) const override
{ return m_Params.m_nSolCh ; }
bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override ;
bool AdjustEndPointForAxesCalc( const Vector3d& vtCorr, Point3d& ptP, bool bToVsFrom = true) const override ;
bool AdjustArcCenterForAxesCalc( const CamData* pCamData, Point3d& ptCen) const override ;
public : // Machining
+44 -34
View File
@@ -1444,7 +1444,7 @@ Operation::CalcAndSetBBox( int nClId)
continue ;
// recupero il punto finale e lo uso per aggiornare l'ingombro
Point3d ptP = pCamData->GetEndPoint() ;
AdjustEndPointForAxesCalc( pCamData, ptP) ;
AdjustEndPointForAxesCalc( pCamData->GetCorrDir(), ptP) ;
b3Grp.Add( ptP) ;
// se arco, determino anche alcuni punti intermedi
if ( pCamData->IsArc()) {
@@ -2123,7 +2123,7 @@ Operation::MyCalculateClPathMcentAxesValues( int nClPathId, double dAngDeltaMinF
}
// ricavo posizione con eventuali modifiche dipendenti dalla lavorazione
Point3d ptP = pCamData->GetEndPoint() ;
AdjustEndPointForAxesCalc( pCamData, ptP) ;
AdjustEndPointForAxesCalc( pCamData->GetCorrDir(), ptP) ;
// calcolo gli assi lineari della macchina
double dX, dY, dZ ;
bool bLOk = m_pMchMgr->GetCalcPositions( ptP, vAxRot, dX, dY, dZ) ;
@@ -2525,8 +2525,8 @@ Operation::VerifyMcentLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDir
bAxError = false ;
Machine* pMachine = m_pMchMgr->GetCurrMachine() ;
// se disposizione o finitura di cornici con lama non vanno fatti controlli
if ( GetType() == OPER_DISP || GetType() == OPER_SAWFINISHING)
// se disposizione non vanno fatti controlli
if ( GetType() == OPER_DISP)
return true ;
// se superato il limite di ricursioni, non devo fare alcunché
@@ -2555,13 +2555,44 @@ Operation::VerifyMcentLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDir
Point3d ptMoveMid ;
if ( ! pMachine->GetTipFromPositions( vAxMid[0], vAxMid[1], vAxMid[2], vAxRotMid, false, false, true, ptMoveMid))
return false ;
// verifico le differenze
// ne calcolo le direzioni associate
bool bDirFromAngles = false ;
Vector3d vtDirMid = Media( vtDirPrec, vtDir) ;
Vector3d vtAuxMid = Media( vtAuxPrec, vtAux) ;
if ( ! vtDirMid.Normalize() ||
( ! vtAuxPrec.IsSmall() && ! vtAux.IsSmall() && ( nMoveType == 0 || ! vtAuxMid.Normalize() || abs( vtAuxMid * vtDirMid) > SQRT1_2))) {
if ( ! pMachine->GetBackToolDirFromAngles( vAxRotMid, vtDirMid))
return false ;
if ( ! pMachine->GetBackAuxDirFromAngles( vAxRotMid, vtAuxMid))
return false ;
bDirFromAngles = true ;
}
Vector3d vtCorrMid = Media( vtCorrPrec, vtCorr) ;
if ( ! vtCorrPrec.IsSmall() && ! vtCorr.IsSmall() && ( bDirFromAngles || ! vtCorrMid.Normalize())) {
// assegno il versore correzione precedente
vtCorrMid = vtCorrPrec ;
// se possibile, cerco di migliorarlo considerando i rif. prec. e sul medio da direzioni fresa (Z) e ausiliaria (X)
Frame3d refPrec, refMid ;
if ( refPrec.Set( ORIG, vtDirPrec, vtAuxPrec) &&
refMid.Set( ORIG, vtDirMid, vtAuxMid)) {
// versore correzione in locale al precente coincide con quello in locale al corrente
vtCorrMid.ToLoc( refPrec) ;
vtCorrMid.ToGlob( refMid) ;
}
}
// verifico le differenze sui punti aggiustati
Point3d ptPrecAdj = ptPrec ;
AdjustEndPointForAxesCalc( vtCorrPrec, ptPrecAdj, false) ;
Point3d ptCurrAdj = ptP ;
AdjustEndPointForAxesCalc( vtCorr, ptCurrAdj, false) ;
Point3d ptMoveMidAdj = ptMoveMid ;
AdjustEndPointForAxesCalc( vtCorrMid, ptMoveMidAdj, false) ;
double dDist ;
if ( ! DistPointLine( ptMoveMid, ptPrec, ptP).GetDist( dDist))
if ( ! DistPointLine( ptMoveMidAdj, ptPrecAdj, ptCurrAdj).GetDist( dDist))
return false ;
double dLinTol = GetApproxLinTol() ;
if ( nMoveType == 0)
dLinTol = max( 10 * dLinTol, LIN_TOL_RAW) ;
dLinTol = max( 10 * dLinTol, MIN_SAFERAPID) ;
else
dLinTol = max( dLinTol, 2 * EPS_SMALL) ;
bool bInTol = ( dDist <= dLinTol) ;
@@ -2577,37 +2608,16 @@ Operation::VerifyMcentLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDir
// Va inserito il punto medio
bAdded = true ;
Point3d ptMid = Media( ptPrec, ptP) ;
Vector3d vtDirMid = Media( vtDirPrec, vtDir) ;
if ( ! vtDirMid.Normalize()) {
if ( ! pMachine->GetBackToolDirFromAngles( vAxRotMid, vtDirMid))
return ( nMoveType == 0) ;
}
Vector3d vtAuxMid = Media( vtAuxPrec, vtAux) ;
if ( ! vtAuxPrec.IsSmall() && ! vtAux.IsSmall() && ! vtAuxMid.Normalize()) {
if ( ! pMachine->GetBackAuxDirFromAngles( vAxRotMid, vtAuxMid))
return ( nMoveType == 0) ;
}
Vector3d vtCorrMid = Media( vtCorrPrec, vtCorr) ;
if ( ! vtCorrPrec.IsSmall() && ! vtCorr.IsSmall() && ! vtCorrMid.Normalize()) {
// assegno il versore correzione precedente
vtCorrMid = vtCorrPrec ;
// se possibile, cerco di migliorarlo considerando i rif. prec. e sul medio da direzioni fresa (Z) e ausiliaria (X)
Frame3d refPrec, refMid ;
if ( refPrec.Set( ORIG, vtDirPrec, vtAuxPrec) &&
refMid.Set( ORIG, vtDirMid, vtAuxMid)) {
// versore correzione in locale al precente coincide con quello in locale al corrente
vtCorrMid.ToLoc( refPrec) ;
vtCorrMid.ToGlob( refMid) ;
}
}
// inserisco nuova entità punto (per evitare problemi di lunghezza linea)
// creo oggetto punto per DB geometrico
PtrOwner<IGeoPoint3d> pGP( CreateGeoPoint3d()) ;
if ( IsNull( pGP))
return false ;
// assegno le coordinate del punto
pGP->Set( ptMid) ;
Point3d ptMidAdj = Media( ptPrecAdj, ptCurrAdj) ;
Point3d ptMid = ptMidAdj ;
AdjustEndPointForAxesCalc( vtCorrMid, ptMid) ;
pGP->Set( ptMidAdj) ;
// inserisco l'oggetto nel DB geometrico
int nMidEntId = m_pGeomDB->InsertGeoObj( GDB_ID_NULL, nEntId, GDB_BEFORE, Release( pGP)) ;
if ( nMidEntId == GDB_ID_NULL)
@@ -2625,7 +2635,7 @@ Operation::VerifyMcentLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDir
CamData* pMidCamData = GetCamData( m_pGeomDB->GetUserObj( nMidEntId)) ;
if ( pMidCamData == nullptr)
return false ;
pMidCamData->SetEndPoint( ptMid) ;
pMidCamData->SetEndPoint( ptMidAdj) ;
pMidCamData->SetToolDir( vtDirMid) ;
pMidCamData->SetAuxDir( vtAuxMid) ;
pMidCamData->SetCorrDir( vtCorrMid) ;
@@ -2736,7 +2746,7 @@ Operation::CalculateClPathRobotAxesValues( int nClPathId, double dAngDeltaMinFor
}
// ricavo posizione con eventuali modifiche dipendenti dalla lavorazione
Point3d ptP = pCamData->GetEndPoint() ;
AdjustEndPointForAxesCalc( pCamData, ptP) ;
AdjustEndPointForAxesCalc( pCamData->GetCorrDir(), ptP) ;
// recupero direzioni
Vector3d vtDir = pCamData->GetToolDir() ;
Vector3d vtAux ;
+3 -3
View File
@@ -65,7 +65,7 @@ class Operation : public IUserObj
virtual const std::string& GetToolTcPos( void) const = 0 ;
virtual bool GetDoubleToolData( std::string& sDblTool, std::string& sDblTcPos, std::string& sDblHead, int& nDblExit) const = 0 ;
virtual bool NeedPrevHome( void) const = 0 ;
virtual bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const
virtual bool AdjustEndPointForAxesCalc( const Vector3d& vtCorr, Point3d& ptP, bool bToVsFrom = true) const
{ return true ; }
virtual bool AdjustArcCenterForAxesCalc( const CamData* pCamData, Point3d& ptCen) const
{ return true ; }
@@ -222,8 +222,8 @@ class Operation : public IUserObj
bool CalculateMcentRotAxesValues( bool bFirst, const Vector3d& vtTool, const Vector3d& vtAux,
double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, const DBLVECTOR& vAxRotPrec,
DBLVECTOR& vAxRot) ;
bool VerifyMcentLineMidPoint( const Point3d& ptPrec, const Vector3d& vtDirPrec, const Vector3d& vtAuxPrec, const Vector3d& vtCorrPrec, const DBLVECTOR& vAxPrec,
const Point3d& ptP, const Vector3d& vtDir, const Vector3d& vtAux, const Vector3d& vtCorr, const DBLVECTOR& vAxVal,
bool VerifyMcentLineMidPoint( const Point3d& ptEndPrec, const Vector3d& vtDirPrec, const Vector3d& vtAuxPrec, const Vector3d& vtCorrPrec, const DBLVECTOR& vAxPrec,
const Point3d& ptEnd, const Vector3d& vtDir, const Vector3d& vtAux, const Vector3d& vtCorr, const DBLVECTOR& vAxVal,
int nCnt, int nEntId, int nMoveType, bool bToolShow, bool& bAdded, bool& bAxError) ;
bool CalculateClPathRobotAxesValues( int nClPathId, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome,
DBLVECTOR& vAxRotPrec) ;
+2 -2
View File
@@ -907,10 +907,10 @@ SawFinishing::GetGeometry( SELVECTOR& vIds) const
//----------------------------------------------------------------------------
bool
SawFinishing::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const
SawFinishing::AdjustEndPointForAxesCalc( const Vector3d& vtCorr, Point3d& ptP, bool bToVsFrom) const
{
// compenso il raggio dell'utensile
ptP += pCamData->GetCorrDir() * ( m_TParams.m_dDiam / 2) ;
ptP += ( bToVsFrom ? +1 : -1) * vtCorr * ( m_TParams.m_dDiam / 2) ;
return true ;
}
+1 -1
View File
@@ -71,7 +71,7 @@ class SawFinishing : public Machining
protected : // Operation
int GetSolCh( void) const override
{ return m_Params.m_nSolCh ; }
bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override ;
bool AdjustEndPointForAxesCalc( const Vector3d& vtCorr, Point3d& ptP, bool bToVsFrom = true) const override ;
bool AdjustArcCenterForAxesCalc( const CamData* pCamData, Point3d& ptCen) const override ;
public : // Machining
+2 -2
View File
@@ -892,10 +892,10 @@ SawRoughing::GetGeometry( SELVECTOR& vIds) const
//----------------------------------------------------------------------------
bool
SawRoughing::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const
SawRoughing::AdjustEndPointForAxesCalc( const Vector3d& vtCorr, Point3d& ptP, bool bToVsFrom) const
{
// compenso il raggio dell'utensile
ptP += pCamData->GetCorrDir() * ( m_TParams.m_dDiam / 2) ;
ptP += (bToVsFrom ? +1 : -1) * vtCorr * ( m_TParams.m_dDiam / 2) ;
return true ;
}
+1 -1
View File
@@ -53,7 +53,7 @@ class SawRoughing : public Machining
protected : // Operation
int GetSolCh( void) const override
{ return m_Params.m_nSolCh ; }
bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override ;
bool AdjustEndPointForAxesCalc( const Vector3d& vtCorr, Point3d& ptP, bool bToVsFrom = true) const override ;
public : // Machining
bool Prepare( const std::string& sSawName) override ;
+2 -2
View File
@@ -1108,10 +1108,10 @@ Sawing::GetGeometry( SELVECTOR& vIds) const
//----------------------------------------------------------------------------
bool
Sawing::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const
Sawing::AdjustEndPointForAxesCalc( const Vector3d& vtCorr, Point3d& ptP, bool bToVsFrom) const
{
// compenso il raggio dell'utensile
ptP += pCamData->GetCorrDir() * ( m_TParams.m_dDiam / 2) ;
ptP += ( bToVsFrom ? +1 : -1) * vtCorr * ( m_TParams.m_dDiam / 2) ;
return true ;
}
+1 -1
View File
@@ -53,7 +53,7 @@ class Sawing : public Machining
protected : // Operation
int GetSolCh( void) const override
{ return m_Params.m_nSolCh ; }
bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override ;
bool AdjustEndPointForAxesCalc( const Vector3d& vtCorr, Point3d& ptP, bool bToVsFrom = true) const override ;
public : // Machining
bool Prepare( const std::string& sSawName) override ;
-9
View File
@@ -1039,15 +1039,6 @@ SurfFinishing::GetGeometry( SELVECTOR& vIds) const
return true ;
}
//----------------------------------------------------------------------------
bool
SurfFinishing::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const
{
// compenso il raggio dell'utensile
ptP += pCamData->GetCorrDir() * ( m_TParams.m_dDiam / 2) ;
return true ;
}
//----------------------------------------------------------------------------
bool
SurfFinishing::VerifyGeometry( SelData Id, int& nSubs)
-1
View File
@@ -79,7 +79,6 @@ class SurfFinishing : public Machining
protected : // Operation
int GetSolCh( void) const override
{ return m_Params.m_nSolCh ; }
bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override ;
public : // Machining
bool Prepare( const std::string& sSawName) override ;
-10
View File
@@ -986,16 +986,6 @@ SurfRoughing::GetGeometry( SELVECTOR& vIds) const
return true ;
}
//----------------------------------------------------------------------------
bool
SurfRoughing::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const
{
// compenso il raggio dell'utensile
ptP += pCamData->GetCorrDir() * ( m_TParams.m_dDiam / 2) ;
return true ;
}
//----------------------------------------------------------------------------
bool
SurfRoughing::VerifyGeometry( SelData Id, int& nSubs)
-1
View File
@@ -154,7 +154,6 @@ class SurfRoughing : public Machining
protected : // Operation
int GetSolCh( void) const override
{ return m_Params.m_nSolCh ; }
bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override ;
public : // Machining
bool Prepare( const std::string& sSawName) override ;
-30
View File
@@ -1439,36 +1439,6 @@ WaterJetting::VerifySideAngle( void)
return true ;
}
//----------------------------------------------------------------------------
bool
WaterJetting::AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const
{
// non devo fare alcunché
return true ;
}
//----------------------------------------------------------------------------
bool
WaterJetting::AdjustArcCenterForAxesCalc( const CamData* pCamData, Point3d& ptCen) const
{
// se utensile lama
if ( ( m_TParams.m_nType & TF_SAWBLADE) != 0) {
// recupero il precedente movimento
int nPrevId = m_pGeomDB->GetPrev( pCamData->GetOwner()) ;
CamData* pPrevCamData = GetCamData( m_pGeomDB->GetUserObj( nPrevId)) ;
if ( pPrevCamData == nullptr)
return false ;
// se versori correzione uguali, correggo il centro
if ( AreSameVectorApprox( pCamData->GetCorrDir(), pPrevCamData->GetCorrDir())) {
// traslazione opposta a quanto fatto in AdjustPathDrawForSaw
double dOffset = 0.5 * m_TParams.m_dTDiam - 10 * EPS_SMALL ;
ptCen.Translate( dOffset * pCamData->GetCorrDir()) ;
}
}
// negli altri casi, non devo fare alcunché
return true ;
}
//----------------------------------------------------------------------------
bool
WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
-2
View File
@@ -50,8 +50,6 @@ class WaterJetting : public Machining
protected : // Operation
int GetSolCh( void) const override
{ return m_Params.m_nSolCh ; }
bool AdjustEndPointForAxesCalc( const CamData* pCamData, Point3d& ptP) const override ;
bool AdjustArcCenterForAxesCalc( const CamData* pCamData, Point3d& ptCen) const override ;
public : // Machining
bool Prepare( const std::string& sMillName) override ;