EgtMachKernel :
- in lavorazione WJ si adatta la feed alla elevazione di taglio riferendola ad un valore di riferimento.
This commit is contained in:
+22
-88
@@ -38,9 +38,7 @@ using namespace std ;
|
||||
// 3201 = "Error in WaterJetting : UpdateToolData failed"
|
||||
// 3202 = "Error in WaterJetting : Offset not computable"
|
||||
// 3203 = "Error in WaterJetting : Empty RawBox"
|
||||
// 3204 = "Error in WaterJetting : Depth not computable"
|
||||
// 3205 = "Error in WaterJetting : machining depth (xx) bigger than MaxMaterial (yy)"
|
||||
// 3206 = "Error in WaterJetting : Entity GetElevation"
|
||||
// 3207 = "Error in WaterJetting : Approach not computable"
|
||||
// 3208 = "Error in WaterJetting : LeadIn not computable"
|
||||
// 3209 = "Error in WaterJetting : LeadOut not computable"
|
||||
@@ -88,9 +86,11 @@ WaterJetting::Clone( void) const
|
||||
pWJ->m_TParams = m_TParams ;
|
||||
pWJ->m_dTHoldLen = m_dTHoldLen ;
|
||||
pWJ->m_dTHoldDiam = m_dTHoldDiam ;
|
||||
pWJ->m_dElev = m_dElev ;
|
||||
pWJ->m_nStatus = m_nStatus ;
|
||||
pWJ->m_nMills = m_nMills ;
|
||||
pWJ->m_nHeadSolCh = m_nHeadSolCh ;
|
||||
pWJ->m_ptLastProbe = m_ptLastProbe ;
|
||||
}
|
||||
catch( ...) {
|
||||
delete pWJ ;
|
||||
@@ -204,6 +204,7 @@ WaterJetting::WaterJetting( void)
|
||||
m_TParams.m_sHead = "*" ;
|
||||
m_dTHoldLen = 0 ;
|
||||
m_dTHoldDiam = 0 ;
|
||||
m_dElev = 0 ;
|
||||
m_nStatus = MCH_ST_TO_VERIFY ;
|
||||
m_nMills = 0 ;
|
||||
m_nHeadSolCh = MCH_SCC_NONE ;
|
||||
@@ -1467,9 +1468,6 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
}
|
||||
}
|
||||
|
||||
// recupero distanza da fondo dei grezzi interessati dal percorso
|
||||
double dRbDist = ( b3Raw.GetMax() - b3Raw.GetMin()).z ;
|
||||
|
||||
// recupero nome del path
|
||||
string sPathName ;
|
||||
m_pGeomDB->GetName( nPathId, sPathName) ;
|
||||
@@ -1492,11 +1490,11 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
VerifyMaxLenCurves( pCompo, m_Params.m_dProbingMaxDist) ;
|
||||
|
||||
// calcolo l'elevazione massima
|
||||
double dElev = 0 ;
|
||||
m_dElev = ( b3Raw.GetMax().z - b3Raw.GetMin().z) / cos( m_Params.m_dSideAngle * DEGTORAD) ;
|
||||
|
||||
// verifico che il massimo materiale dell'utensile sia sensato
|
||||
const double MIN_MAXMAT = 1.0 ;
|
||||
if ( m_TParams.m_dMaxMat < dElev && m_TParams.m_dMaxMat < MIN_MAXMAT) {
|
||||
if ( m_TParams.m_dMaxMat < m_dElev && m_TParams.m_dMaxMat < MIN_MAXMAT) {
|
||||
string sInfo = "Error in WaterJetting : Tool MaxMaterial too small (" +
|
||||
ToString( m_TParams.m_dMaxMat, 2) + ")" ;
|
||||
m_pMchMgr->SetLastError( 3213, sInfo) ;
|
||||
@@ -1504,8 +1502,8 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
}
|
||||
|
||||
// verifico di non superare il massimo materiale con l'elevazione
|
||||
if ( dElev > m_TParams.m_dMaxMat + EPS_SMALL) {
|
||||
string sInfo = "Error in WaterJetting : machining depth (" + ToString( dElev, 1) +
|
||||
if ( m_dElev > m_TParams.m_dMaxMat + EPS_SMALL) {
|
||||
string sInfo = "Error in WaterJetting : machining depth (" + ToString( m_dElev, 1) +
|
||||
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
|
||||
m_pMchMgr->SetLastError( 3205, sInfo) ;
|
||||
return false ;
|
||||
@@ -1539,13 +1537,13 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_START, ptStart) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_END, ptEnd) ;
|
||||
// assegno l'elevazione massima
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, dElev) ;
|
||||
m_pGeomDB->SetInfo( nPxId, KEY_ELEV, m_dElev) ;
|
||||
|
||||
// Imposto dati comuni
|
||||
SetPathId( nPxId) ;
|
||||
|
||||
// Inserisco la lavorazione
|
||||
if ( ! AddStandardWj( pCompo, vtTool, dRbDist, dElev, bSplitArcs))
|
||||
if ( ! AddStandardWj( pCompo, vtTool, bSplitArcs))
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -1555,69 +1553,6 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
WaterJetting::CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad,
|
||||
double& dElev) const
|
||||
{
|
||||
dElev = 0 ;
|
||||
int nMaxInd = pCompo->GetCurveCount() - 1 ;
|
||||
for ( int i = 0 ; i <= nMaxInd ; ++ i) {
|
||||
// curva corrente
|
||||
const ICurve* pCrvC = pCompo->GetCurve( i) ;
|
||||
// calcolo elevazione
|
||||
double dCurrElev ;
|
||||
Point3d ptStart, ptMid, ptEnd ;
|
||||
pCrvC->GetStartPoint( ptStart) ;
|
||||
pCrvC->GetMidPoint( ptMid) ;
|
||||
pCrvC->GetEndPoint( ptEnd) ;
|
||||
Vector3d vtStartPerp, vtMidPerp, vtEndPerp, vtTg ;
|
||||
pCrvC->GetStartDir( vtTg) ;
|
||||
vtStartPerp = vtTg ^ vtTool ;
|
||||
vtStartPerp.Normalize() ;
|
||||
vtStartPerp *= dRad ;
|
||||
pCrvC->GetMidDir( vtTg) ;
|
||||
vtMidPerp = vtTg ^ vtTool ;
|
||||
vtMidPerp.Normalize() ;
|
||||
vtMidPerp *= dRad ;
|
||||
pCrvC->GetEndDir( vtTg) ;
|
||||
vtEndPerp = vtTg ^ vtTool ;
|
||||
vtEndPerp.Normalize() ;
|
||||
vtEndPerp *= dRad ;
|
||||
Vector3d vtDepth = vtTool * dDepth ;
|
||||
// linea centro utensile
|
||||
if ( GetElevation( m_nPhase, ptStart - vtDepth, ptMid - vtDepth, ptEnd - vtDepth, vtTool, dCurrElev)) {
|
||||
if ( dCurrElev > dElev)
|
||||
dElev = dCurrElev ;
|
||||
}
|
||||
else {
|
||||
m_pMchMgr->SetLastError( 3206, "Error in WaterJetting : Entity GetElevation") ;
|
||||
return false ;
|
||||
}
|
||||
// da una parte
|
||||
if ( GetElevation( m_nPhase, ptStart + vtStartPerp - vtDepth, ptMid + vtMidPerp - vtDepth,
|
||||
ptEnd + vtEndPerp - vtDepth, vtTool, dCurrElev)) {
|
||||
if ( dCurrElev > dElev)
|
||||
dElev = dCurrElev ;
|
||||
}
|
||||
else {
|
||||
m_pMchMgr->SetLastError( 3206, "Error in WaterJetting : Entity GetElevation") ;
|
||||
return false ;
|
||||
}
|
||||
// dall'altra parte
|
||||
if ( GetElevation( m_nPhase, ptStart - vtStartPerp - vtDepth, ptMid - vtMidPerp - vtDepth,
|
||||
ptEnd - vtEndPerp - vtDepth, vtTool, dCurrElev)) {
|
||||
if ( dCurrElev > dElev)
|
||||
dElev = dCurrElev ;
|
||||
}
|
||||
else {
|
||||
m_pMchMgr->SetLastError( 3206, "Error in WaterJetting : Entity GetElevation") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, double dAddedOverlap)
|
||||
@@ -1870,8 +1805,7 @@ WaterJetting::AddLoopsPreview( const ICurveComposite* pCompo, ISurfFlatRegion* p
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
double dRbDist, double dElev, bool bSplitArcs)
|
||||
WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTool, bool bSplitArcs)
|
||||
{
|
||||
// numero punti di accelerazione/decelerazione
|
||||
const int ACC_PNT_NUM = 7 ;
|
||||
@@ -1908,7 +1842,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
return false ;
|
||||
}
|
||||
// aggiungo attacco
|
||||
SetFeed( GetFeed()) ;
|
||||
SetFeed( GetActualFeed()) ;
|
||||
SetFlag( 0) ;
|
||||
SetIndex( 0 - nIdxSkip) ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtTool, bSplitArcs)) {
|
||||
@@ -1937,7 +1871,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
Point3d ptPe = ptP + vtEnd * dTgLen ;
|
||||
Point3d ptPs = ptP - vtStart * dTgLen ;
|
||||
// tratto prima dell'anello
|
||||
SetFeed( GetFeed()) ;
|
||||
SetFeed( GetActualFeed()) ;
|
||||
if ( AddLinearMove( ptPe) == GDB_ID_NULL)
|
||||
return false ;
|
||||
// anello
|
||||
@@ -1962,14 +1896,14 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
// lunghezza di accelerazione
|
||||
double dAccLen = min( m_Params.m_dCornerSlowLen, dLen / 2 - 0.1) ;
|
||||
// Feed ridotta
|
||||
double dMinFeed = GetReducedFeed() ;
|
||||
double dMinFeed = GetActualReducedFeed() ;
|
||||
// ciclo sui punti di accelerazione
|
||||
for ( int j = 1 ; j <= ACC_PNT_NUM ; ++ j) {
|
||||
double dCoeff = j / double( ACC_PNT_NUM) ;
|
||||
double dU ; pCrvC->GetParamAtLength( dCoeff * dAccLen, dU) ;
|
||||
Point3d ptP ; pCrvC->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP) ;
|
||||
CalcAndSetToolCorrAuxDir( pCompo, i + dU) ;
|
||||
SetFeed( ( 1 - dCoeff) * dMinFeed + dCoeff * GetFeed()) ;
|
||||
SetFeed( ( 1 - dCoeff) * dMinFeed + dCoeff * GetActualFeed()) ;
|
||||
if ( AddLinearMove( ptP) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
@@ -1981,7 +1915,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
// lunghezza di accelerazione
|
||||
double dAccLen = min( m_Params.m_dCornerSlowLen, dLen / 2 - 0.1) ;
|
||||
// Feed ridotta
|
||||
double dMinFeed = GetReducedFeed() ;
|
||||
double dMinFeed = GetActualReducedFeed() ;
|
||||
// Direzioni utensile nell'angolo e finale
|
||||
Vector3d vtTp = CalcToolDir( pCompo, i) ;
|
||||
Vector3d vtTn = CalcToolDir( pCompo, i + 0.5) ;
|
||||
@@ -1994,14 +1928,14 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
vtTool.Normalize() ;
|
||||
Vector3d vtCorr = CalcCorrDir( pCompo, i + dU) ;
|
||||
SetToolCorrAuxDir( vtTool, vtCorr) ;
|
||||
SetFeed( ( 1 - dCoeff) * dMinFeed + dCoeff * GetFeed()) ;
|
||||
SetFeed( ( 1 - dCoeff) * dMinFeed + dCoeff * GetActualFeed()) ;
|
||||
if ( AddLinearMove( ptP) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// se non è l'ultima entità, verifico se dopo c'è un angolo interno
|
||||
double dNextFeed = GetFeed() ;
|
||||
double dNextFeed = GetActualFeed() ;
|
||||
if ( i < nMaxInd) {
|
||||
// controlli per indice del punto di arrivo
|
||||
Point3d ptP3 ; pCrvC->GetEndPoint( ptP3) ;
|
||||
@@ -2023,14 +1957,14 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
// lunghezza di accelerazione
|
||||
double dAccLen = min( m_Params.m_dCornerSlowLen, dLen / 2 - 0.1) ;
|
||||
// Feed ridotta
|
||||
double dMinFeed = GetReducedFeed() ;
|
||||
double dMinFeed = GetActualReducedFeed() ;
|
||||
// ciclo sui punti di decelerazione
|
||||
for ( int j = 0 ; j < ACC_PNT_NUM ; ++ j) {
|
||||
double dCoeff = j / double( ACC_PNT_NUM) ;
|
||||
double dU ; pCrvC->GetParamAtLength( dLen - ( 1 - dCoeff) * dAccLen, dU) ;
|
||||
Point3d ptP ; pCrvC->GetPointD1D2( dU, ICurve::FROM_MINUS, ptP) ;
|
||||
CalcAndSetToolCorrAuxDir( pCompo, i + dU) ;
|
||||
SetFeed( ( 1 - dCoeff) * GetFeed() + dCoeff * dMinFeed) ;
|
||||
SetFeed( ( 1 - dCoeff) * GetActualFeed() + dCoeff * dMinFeed) ;
|
||||
if ( AddLinearMove( ptP) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
@@ -2043,7 +1977,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
// lunghezza di accelerazione
|
||||
double dAccLen = min( m_Params.m_dCornerSlowLen, dLen / 2 - 0.1) ;
|
||||
// Feed ridotta
|
||||
double dMinFeed = GetReducedFeed() ;
|
||||
double dMinFeed = GetActualReducedFeed() ;
|
||||
// Direzioni utensile iniziale e nell'angolo
|
||||
Vector3d vtTp = CalcToolDir( pCompo, i + 0.5) ;
|
||||
Vector3d vtTn = CalcToolDir( pCompo, i + 1) ;
|
||||
@@ -2056,7 +1990,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
vtTool.Normalize() ;
|
||||
Vector3d vtCorr = CalcCorrDir( pCompo, i + dU) ;
|
||||
SetToolCorrAuxDir( vtTool, vtCorr) ;
|
||||
SetFeed( ( 1 - dCoeff) * GetFeed() + dCoeff * dMinFeed) ;
|
||||
SetFeed( ( 1 - dCoeff) * GetActualFeed() + dCoeff * dMinFeed) ;
|
||||
if ( AddLinearMove( ptP) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
@@ -2104,7 +2038,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
Vector3d vtEnd ; pCurve->GetEndDir( vtEnd) ;
|
||||
// aggiungo uscita
|
||||
Point3d ptP1 ;
|
||||
SetFeed( GetFeed()) ;
|
||||
SetFeed( GetActualFeed()) ;
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtTool, bSplitArcs, ptP1)) {
|
||||
m_pMchMgr->SetLastError( 3209, "Error in WaterJetting : LeadOut not computable") ;
|
||||
return false ;
|
||||
|
||||
+6
-5
@@ -74,13 +74,11 @@ class WaterJetting : public Machining
|
||||
bool Chain( int nGrpDestId) ;
|
||||
bool VerifySideAngle( void) ;
|
||||
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
|
||||
bool CalcPathElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double& dElev) const ;
|
||||
bool GeneratePreView( int nPathId, const ICurveComposite* pCompo, double dAddedOverlap) ;
|
||||
bool AddLeadInPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV) ;
|
||||
bool AddLeadOutPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV) ;
|
||||
bool AddLoopsPreview( const ICurveComposite* pCompo, ISurfFlatRegion* pSPV) ;
|
||||
bool AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
double dRbDist, double dElev, bool bSplitArcs) ;
|
||||
bool AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTool, bool bSplitArcs) ;
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ) ;
|
||||
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ) ;
|
||||
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
|
||||
@@ -106,8 +104,10 @@ class WaterJetting : public Machining
|
||||
{ return ( IsNullAngValue( m_Params.m_dSpeed) ? m_TParams.m_dSpeed : m_Params.m_dSpeed) ; }
|
||||
double GetFeed() const
|
||||
{ return ( IsNullLenValue( m_Params.m_dFeed) ? m_TParams.m_dFeed : m_Params.m_dFeed) ; }
|
||||
double GetReducedFeed() const
|
||||
{ return ( 100. - m_Params.m_nCornerSlowPerc) / 100. * GetFeed() ; }
|
||||
double GetActualFeed() const
|
||||
{ return ( ( m_Params.m_dThickRef < EPS_SMALL ? 1. : m_Params.m_dThickRef / m_dElev) * GetFeed()) ; }
|
||||
double GetActualReducedFeed() const
|
||||
{ return ( 100. - m_Params.m_nCornerSlowPerc) / 100. * GetActualFeed() ; }
|
||||
double GetTipFeed() const
|
||||
{ return ( IsNullLenValue( m_Params.m_dTipFeed) ? m_TParams.m_dTipFeed : m_Params.m_dTipFeed) ; }
|
||||
double GetOffsR() const
|
||||
@@ -122,6 +122,7 @@ class WaterJetting : public Machining
|
||||
ToolData m_TParams ; // parametri utensile
|
||||
double m_dTHoldLen ; // lunghezza del porta-utensile
|
||||
double m_dTHoldDiam ; // diametro del porta-utensile
|
||||
double m_dElev ; // elevazione del percorso tenendo conto dell'angolo di fianco
|
||||
int m_nStatus ; // stato di aggiornamento della lavorazione
|
||||
int m_nMills ; // numero di percorsi di lavoro generati
|
||||
int m_nHeadSolCh ; // criterio scelta soluzione impostato nella testa
|
||||
|
||||
Reference in New Issue
Block a user