From 15931dc3046a4928e6d943e812a7e893befd9daa Mon Sep 17 00:00:00 2001 From: DarioS Date: Fri, 10 Feb 2023 16:28:00 +0100 Subject: [PATCH] =?UTF-8?q?EgtMachKernel=202.5b2=20:=20-=20nel=20calcolo?= =?UTF-8?q?=20spostamenti=20in=20disposizioni=20(movimenti=20di=20pezzi=20?= =?UTF-8?q?con=20ventose)=20=C3=A8=20ora=20possibile=20fare=20rotazioni=20?= =?UTF-8?q?non=20minime=20pur=20di=20stare=20nelle=20corse.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Disposition.cpp | 2 +- EgtMachKernel.rc | Bin 11774 -> 11774 bytes Mortising.cpp | 2 +- Operation.cpp | 34 ++++++++++++++++++++++------------ Operation.h | 7 ++++--- 5 files changed, 28 insertions(+), 17 deletions(-) diff --git a/Disposition.cpp b/Disposition.cpp index 4ff8484..e126a10 100644 --- a/Disposition.cpp +++ b/Disposition.cpp @@ -1398,7 +1398,7 @@ Disposition::SpecialUpdate( void) return true ; } // calcolo assi macchina - if ( ! CalculateAxesValues( "")) { + if ( ! CalculateAxesValues( "", false)) { string sInfo = m_pMchMgr->GetOutstrokeInfo() ; if ( sInfo.empty()) m_pMchMgr->SetLastError( 2007, "Error in Disposition : axes values not calculable") ; diff --git a/EgtMachKernel.rc b/EgtMachKernel.rc index a8bea5240b8b351e03065de86cf096b23d6001d2..de5c6ee74fe8ec97205fe0b2cf754a69f13a1254 100644 GIT binary patch delta 97 zcmewt{V#gMFE&P_&A-`fnHh~HKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmU8!BZvS1 delta 97 zcmewt{V#gMFE&QQ&A-`fnHdcyKa|wnoW?bQ1uSxrY4Qod0+^@}R1`^_2jk{d(jGv4 NK<#LXK~l;gTmU3rBY*$^ diff --git a/Mortising.cpp b/Mortising.cpp index 3689048..0d2904b 100644 --- a/Mortising.cpp +++ b/Mortising.cpp @@ -641,7 +641,7 @@ Mortising::Update( bool bPostApply) string sHint = ExtractHint( m_Params.m_sUserNotes) ; if ( ! m_Params.m_sInitAngs.empty()) sHint = m_Params.m_sInitAngs ; - if ( ! CalculateAxesValues( sHint, true)) { + if ( ! CalculateAxesValues( sHint, true, true)) { string sInfo = m_pMchMgr->GetOutstrokeInfo() ; if ( sInfo.empty()) m_pMchMgr->SetLastError( 2507, "Error in Mortising : axes values not calculable") ; diff --git a/Operation.cpp b/Operation.cpp index 8592032..3100b77 100644 --- a/Operation.cpp +++ b/Operation.cpp @@ -1434,7 +1434,7 @@ Operation::SetBlockedRotAxis( const string& sBlockedAxis) const //---------------------------------------------------------------------------- bool -Operation::CalculateAxesValues( const string& sHint, bool bSolChExact) +Operation::CalculateAxesValues( const string& sHint, bool bRotContOnNext, bool bSolChExact) { if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr) return false ; @@ -1534,12 +1534,12 @@ Operation::CalculateAxesValues( const string& sHint, bool bSolChExact) DBLVECTOR vAxRotPrecOri = vAxRotPrec ; int nOutStrC = 0 ; if ( ! CalculateClPathAxesValues( nClPathId, nLinAxes, nRotAxes, dRot1W, bMaxDeltaR2OnFirst, - dAngDeltaMinForHome, vAxRotHome, vAxRotPrec, nOutStrC)) { + 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) { m_pMchMgr->GetCurrMachine()->ResetOutstrokeInfo() ; CalculateClPathAxesValues( nClPathId, nLinAxes, nRotAxes, dRot1W, bMaxDeltaR2OnFirst, - INFINITO, vAxRotHome, vAxRotPrec, nOutStrC) ; + bRotContOnNext, INFINITO, vAxRotHome, vAxRotPrec, nOutStrC) ; } // se extracorsa dell'asse C, provo a precaricarlo al contrario if ( nOutStrC != 0) { @@ -1547,7 +1547,7 @@ Operation::CalculateAxesValues( const string& sHint, bool bSolChExact) vAxRotPrec[0] = vAxRotPrecOri[0] + ( nOutStrC > 0 ? - ANG_FULL : ANG_FULL) ; m_pMchMgr->GetCurrMachine()->ResetOutstrokeInfo() ; if ( ! CalculateClPathAxesValues( nClPathId, nLinAxes, nRotAxes, dRot1W, bMaxDeltaR2OnFirst, - INFINITO, vAxRotHome, vAxRotPrec, nOutStrC)) + bRotContOnNext, INFINITO, vAxRotHome, vAxRotPrec, nOutStrC)) bOk = false ; } else @@ -1561,8 +1561,9 @@ Operation::CalculateAxesValues( const string& sHint, bool bSolChExact) //---------------------------------------------------------------------------- bool -Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W, bool bMaxDeltaR2OnFirst, - double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) +Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W, + bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome, + const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) { if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr) return false ; @@ -1625,9 +1626,12 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, else { // scelgo gli angoli pił vicini, per continuitą non applico offset per stare nelle corse for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) { - vAng1[i] = AngleNearAngle( vAng1[i], vAxRotPrec[i]) ; + if ( bRotContOnNext) + vAng1[i] = AngleNearAngle( vAng1[i], vAxRotPrec[i]) ; + else + m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ; if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome) - vAng1[i] = AngleNearAngle( vAng1[i], vAxRotHome[i]) ; + vAng1[i] = m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ; } // se sol.ne indeterminata (sempre il primo asse libero), assegno il precedente if ( nRStat < 0 && vAng1.size() >= 1) { @@ -1673,12 +1677,18 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, else { // scelgo gli angoli pił vicini, per continuitą non applico offset per stare nelle corse for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) { - vAng1[i] = AngleNearAngle( vAng1[i], vAxRotPrec[i]) ; + if ( bRotContOnNext) + vAng1[i] = AngleNearAngle( vAng1[i], vAxRotPrec[i]) ; + else + m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ; if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome) - vAng1[i] = AngleNearAngle( vAng1[i], vAxRotHome[i]) ; - vAng2[i] = AngleNearAngle( vAng2[i], vAxRotPrec[i]) ; + vAng1[i] = m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ; + if ( bRotContOnNext) + vAng2[i] = AngleNearAngle( vAng2[i], vAxRotPrec[i]) ; + else + m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng2[i]) ; if ( abs( vAng2[i] - vAxRotPrec[i]) > dAngDeltaMinForHome) - vAng2[i] = AngleNearAngle( vAng2[i], vAxRotHome[i]) ; + vAng2[i] = m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng2[i]) ; } // se sol.ne indeterminata (sempre il primo asse libero), assegno il precedente if ( nRStat < 0 && vAng1.size() >= 1) { diff --git a/Operation.h b/Operation.h index 7fd7d90..b6e9142 100644 --- a/Operation.h +++ b/Operation.h @@ -115,9 +115,10 @@ class Operation : public IUserObj 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 bSolChExact = false) ; - bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W, bool bMaxDeltaR2OnFirst, - double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ; + bool CalculateAxesValues( const std::string& sHint, bool bRotContOnNext = true, bool bSolChExact = false) ; + bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W, + bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome, + const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ; bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ; bool AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, const DBLVECTOR& vAxPrev, bool bMaxZ) ; bool ToolChangeNeeded( const Operation& Op1, const Operation& Op2) const ;