diff --git a/MachMgr.h b/MachMgr.h index e94d39d..3285115 100644 --- a/MachMgr.h +++ b/MachMgr.h @@ -117,6 +117,7 @@ class MachMgr : public IMachMgr bool MoveToCenterRawPart( int nRawId, const Point3d& ptCenter, int nFlag) override ; bool MoveRawPart( int nRawId, const Vector3d& vtMove) override ; bool GetRawPartCenter( int nRawId, Point3d& ptCen) override ; + bool GetRawPartBBox( int nRawId, BBox3d& b3Raw) override ; int SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId) override ; // Parts int GetPartInRawPartCount( int nRawId) const override ; diff --git a/MachMgrRawParts.cpp b/MachMgrRawParts.cpp index 38d1eb0..64e1690 100644 --- a/MachMgrRawParts.cpp +++ b/MachMgrRawParts.cpp @@ -789,6 +789,9 @@ MachMgr::ResetRawPartCenter( int nRawId) bool MachMgr::GetRawPartCenter( int nRawId, Point3d& ptCen) { + // verifica validità grezzo + if ( ! VerifyRawPart( nRawId)) + return false ; // cerco di recuperare l'oggetto int nGPntId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_CENTER) ; // ne verifico la validità @@ -815,6 +818,18 @@ MachMgr::GetRawPartCenter( int nRawId, Point3d& ptCen) return true ; } +//---------------------------------------------------------------------------- +bool +MachMgr::GetRawPartBBox( int nRawId, BBox3d& b3Raw) +{ + // verifica validità grezzo + if ( ! VerifyRawPart( nRawId)) + return false ; + // recupero solido del grezzo + int nRawSolidId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ; + return m_pGeomDB->GetGlobalBBox( nRawSolidId, b3Raw) ; +} + //---------------------------------------------------------------------------- int MachMgr::SplitFlatRawPartWithMachinings( int nRawId, const INTVECTOR& vMchId) diff --git a/Milling.cpp b/Milling.cpp index 0f53b17..c6f51ec 100644 --- a/Milling.cpp +++ b/Milling.cpp @@ -1672,7 +1672,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo dEndElev = dElev ; // aggiungo uscita Point3d ptP1 ; - SetFeed( GetStartFeed()) ; + SetFeed( GetEndFeed()) ; if ( ! AddLeadOut( ptEnd, vtEnd, vtExtr, dEndElev, false, pCompo, bSplitArcs, ptP1)) { m_pMchMgr->SetLastError( 2310, "Error in Milling : LeadOut not computable") ; return false ; @@ -1823,7 +1823,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool dEndElev = - LIO_ELEV_TOL ; // aggiungo uscita Point3d ptP1 ; - SetFeed( GetStartFeed()) ; + SetFeed( GetEndFeed()) ; if ( ! AddLeadOut( ptEnd, vtEnd, vtExtr, dEndElev, bInvert, pCompo, bSplitArcs, ptP1)) { m_pMchMgr->SetLastError( 2310, "Error in Milling : LeadOut not computable") ; return false ; @@ -1965,7 +1965,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool dEndElev = dElev ; // aggiungo uscita Point3d ptP1 ; - SetFeed( GetStartFeed()) ; + SetFeed( GetEndFeed()) ; if ( ! AddLeadOut( ptEnd, vtEnd, vtExtr, dEndElev, false, pCompo, bSplitArcs, ptP1)) { m_pMchMgr->SetLastError( 2310, "Error in Milling : LeadOut not computable") ; return false ; @@ -2104,7 +2104,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool dEndElev = dElev ; // aggiungo uscita Point3d ptP1 ; - SetFeed( GetStartFeed()) ; + SetFeed( GetEndFeed()) ; if ( ! AddLeadOut( ptEnd, vtEnd, vtExtr, dEndElev, false, pCompo, bSplitArcs, ptP1)) { m_pMchMgr->SetLastError( 2310, "Error in Milling : LeadOut not computable") ; return false ; @@ -2220,7 +2220,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool dEndElev = dElev ; // aggiungo uscita Point3d ptP1 ; - SetFeed( GetStartFeed()) ; + SetFeed( GetEndFeed()) ; if ( ! AddLeadOut( ptEnd, vtEnd, vtExtr, dEndElev, bInvert, pCompo, bSplitArcs, ptP1)) { m_pMchMgr->SetLastError( 2310, "Error in Milling : LeadOut not computable") ; return false ; diff --git a/Simulator.cpp b/Simulator.cpp index cd0a4e2..55deac7 100644 --- a/Simulator.cpp +++ b/Simulator.cpp @@ -355,6 +355,9 @@ Simulator::UpdateTool( bool bFirst) // recupero i dati string sTool ; string sHead ; int nExit ; string sTcPos ; pDisp->GetToolData( sTool, sHead, nExit, sTcPos) ; + // !!! PROVVISORIO !!! Per disposizioni con percorso dummy con movimenti ausiliari + if ( sTcPos == "***") + return true ; // se esiste utensile corrente e cambierà, lo scarico if ( ! m_sTool.empty() && sTool != m_sTool) { // eventuale lancio script per scarico utensile @@ -542,13 +545,16 @@ bool Simulator::ManageOperationEnd( int& nStatus) { bool bOk = false ; - // se è una lavorazione - if ( GetMachining( m_pGeomDB->GetUserObj( m_nOpId)) != nullptr) { + // non c'è operazione in corso (solo prima disposizione senza lavorazioni) + if ( m_nOpId == GDB_ID_NULL) + bOk = true ; + // se altrimenti è una lavorazione + else if ( GetMachining( m_pGeomDB->GetUserObj( m_nOpId)) != nullptr) { // richiamo gestione evento fine lavorazione bOk = OnMachiningEnd() ; } - // se è una disposizione - if ( GetDisposition( m_pGeomDB->GetUserObj( m_nOpId)) != nullptr) { + // se altrimenti è una disposizione + else if ( GetDisposition( m_pGeomDB->GetUserObj( m_nOpId)) != nullptr) { // richiamo gestione evento fine disposizione bOk = OnDispositionEnd() ; } @@ -585,7 +591,7 @@ Simulator::FindAndManagePathStart( int& nStatus) m_dCoeff = 0 ; } } - // se trovato nuovo CLpath, gestisco inizio percorso di lavoro + // se trovato nuovo CLpath con entità, gestisco inizio percorso di lavoro if ( m_nEntId != GDB_ID_NULL) { ++ m_nCLPathInd ; // recupero punto di inizio del percorso @@ -614,6 +620,16 @@ Simulator::FindAndManagePathStart( int& nStatus) return false ; } } + // se altrimenti trovato nuovo CL path vuoto + else if ( m_nCLPathId != GDB_ID_NULL) { + // non ci possono essere eventi ausiliari di inizio + m_nAuxSTot = 0 ; + m_nAuxSInd = 0 ; + // recupero il numero di eventi ausiliari di fine + if ( ! m_pGeomDB->GetInfo( m_nCLPathId, KEY_AE_TOT, m_nAuxETot)) + m_nAuxETot = 0 ; + m_nAuxEInd = 0 ; + } return true ; }