EgtMachKernel :

- corretta gestione inserimento/cancellazione punti intermedi aggiunti per cambio direzione utensile.
This commit is contained in:
Dario Sassi
2025-04-23 12:20:03 +02:00
parent fc03d2f737
commit 34e96d1f06
2 changed files with 44 additions and 17 deletions
+27
View File
@@ -1870,11 +1870,17 @@ Operation::CalculateClPathCenterAxesValues( int nClPathId, int nLinAxes, int nRo
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec)
{
DBLVECTOR vAxRotPrecOri = vAxRotPrec ;
// cancello eventuali punti aggiunti
EraseAddedPoints( nClPathId) ;
// calcolo
int nOutStrC = 0 ;
if ( ! CalculateClPathAxesValues( nClPathId, nLinAxes, nRotAxes, dRot1W, bMaxDeltaR2OnFirst,
bRotContOnNext, dAngDeltaMinForHome, vAxRotHome, vAxRotPrec, nOutStrC)) {
// se attivata scelta angolo iniziale vicino ad home ed extra corsa C, provo a rifarlo disattivando
if ( dAngDeltaMinForHome < ANG_FULL && nOutStrC != 0) {
// cancello eventuali punti aggiunti
EraseAddedPoints( nClPathId) ;
// ricalcolo
m_pMchMgr->GetCurrMachine()->ResetOutstrokeInfo() ;
if ( CalculateClPathAxesValues( nClPathId, nLinAxes, nRotAxes, dRot1W, bMaxDeltaR2OnFirst,
bRotContOnNext, INFINITO, vAxRotHome, vAxRotPrec, nOutStrC))
@@ -1882,6 +1888,9 @@ Operation::CalculateClPathCenterAxesValues( int nClPathId, int nLinAxes, int nRo
}
// se extracorsa dell'asse C, provo a precaricarlo al contrario
if ( nOutStrC != 0) {
// cancello eventuali punti aggiunti
EraseAddedPoints( nClPathId) ;
// ricalcolo
vAxRotPrec = vAxRotPrecOri ;
vAxRotPrec[0] = vAxRotPrecOri[0] + ( nOutStrC > 0 ? - ANG_FULL : ANG_FULL) ;
m_pMchMgr->GetCurrMachine()->ResetOutstrokeInfo() ;
@@ -1895,6 +1904,24 @@ Operation::CalculateClPathCenterAxesValues( int nClPathId, int nLinAxes, int nRo
return true ;
}
//----------------------------------------------------------------------------
bool
Operation::EraseAddedPoints( int nClPathId)
{
int nEntId = m_pGeomDB->GetFirstInGroup( nClPathId) ;
while ( nEntId != GDB_ID_NULL) {
// salvo successivo
int nNextId = m_pGeomDB->GetNext( nEntId) ;
// recupero i dati Cam dell'entità
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
// se punto aggiunto, lo elimino
if ( pCamData != nullptr && pCamData->GetFlag2() == -1)
m_pGeomDB->Erase( nEntId) ;
nEntId = nNextId ;
}
return true ;
}
//----------------------------------------------------------------------------
bool
Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
+17 -17
View File
@@ -178,6 +178,18 @@ class Operation : public IUserObj
bool CalcMirrorByDouble( int nClId, const std::string& sUserNotes) ;
std::string ExtractInfo( const std::string& sNotes, const std::string& sKey) const ;
std::string ExtractHint( const std::string& sNotes) const ;
bool SetBlockedRotAxis( const std::string& sBlockedAxis) const ;
bool CalculateAxesValues( const std::string& sHint, bool bRotContOnNext = true, bool bSolChExact = false) ;
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
bool RemoveClimbRiseHome( void) ;
double GetDeltaSafeZ( const Vector3d& vtTool) const ;
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int* pnLKAMO = nullptr) const ;
bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) const ;
bool IsAggrBottom( const std::string& sHead) const ;
private :
bool GetInitialAxesValues( bool bSkipClimb, DBLVECTOR& vAxVal) const ;
bool GetClPathInitialAxesValues( int nClPathId, bool bSkipClimb, DBLVECTOR& vAxVal) const ;
bool GetFinalAxesValues( bool bSkipRise, DBLVECTOR& vAxVal) const ;
@@ -190,13 +202,10 @@ class Operation : public IUserObj
const CamData* GetClPathInitialCamData( int nClPathId, bool bSkipClimb) const ;
const CamData* GetFinalCamData( bool bSkipRise) const ;
const CamData* GetClPathFinalCamData( int nClPathId, bool bSkipRise) const ;
std::string ExtractInfo( const std::string& sNotes, const std::string& sKey) const ;
std::string ExtractHint( const std::string& sNotes) const ;
bool SetBlockedRotAxis( const std::string& sBlockedAxis) const ;
bool CalculateAxesValues( const std::string& sHint, bool bRotContOnNext = true, bool bSolChExact = false) ;
bool CalculateClPathCenterAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
bool EraseAddedPoints( int nClPathId) ;
bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
@@ -209,7 +218,10 @@ class Operation : public IUserObj
bool CalculateClPathRobotAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
bool GetAxisMidForTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nAxisOrder, Machine* pMch,
DBLVECTOR& vAxMid) const ;
bool OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd,
Machine* pMch, const INTVECTOR& vRawId, const INTVECTOR& vFxtId) const ;
bool ManageProtectedAreas( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, Operation* pPrevOp, Operation* pNextOp, bool& bClimbDone) ;
bool AdjustOneStartEndMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, const DBLVECTOR& vAxPrev, bool bMaxZ) ;
bool ToolChangeNeeded( const Operation& Op1, const Operation& Op2) const ;
@@ -221,7 +233,6 @@ class Operation : public IUserObj
int nFlag = 0, int nFlag2 = 0, int nMask = -1, const std::string& sInfo = "") ;
bool RemoveRise( int nClPathId = GDB_ID_NULL) ;
bool AddHome( void) ;
bool RemoveClimbRiseHome( void) ;
bool AddRobotClimb( int nEntId, double dDeltaZ = NAN) ;
bool CalcRobotAxesAbovePos( const Point3d& ptP, const Vector3d& vtT, const Vector3d& vtA, double dDeltaZ,
DBLVECTOR& vAx, double* pdNewDeltaZ = nullptr) const ;
@@ -235,23 +246,12 @@ class Operation : public IUserObj
bool GetRotationAtZmax( void) const ;
bool ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, const BBox3d& b3Raws) const ;
int GetUserNotesZmax( void) const ;
double GetDeltaSafeZ( const Vector3d& vtTool) const ;
bool GetZHomeDown( void) const ;
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int* pnLKAMO = nullptr) const ;
int SpecialTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
bool SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nFlag2, bool& bModif) ;
bool SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nOutstroke, int nLinkType,
POSVECTOR& vNewPos) ;
bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) const ;
bool IsAggrBottom( const std::string& sHead) const ;
private :
bool GetAxisMidForTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int nAxisOrder, Machine* pMch,
DBLVECTOR& vAxMid) const ;
bool OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd,
Machine* pMch, const INTVECTOR& vRawId, const INTVECTOR& vFxtId) const ;
protected :
int m_nOwnerId ; // identificativo dell'oggetto geometrico possessore
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico