EgtMachKernel 2.1k1 :

- ora si esegue reset su OutstrokeInfo quando si ricalcolano gli angoli con C variato di un angolo giro
- in lavorazione Waterjet corretto caso con archi prima e dopo angoli
- in lavorazione Waterjet Preview con anche ingombro sotto.
This commit is contained in:
Dario Sassi
2019-11-04 07:26:48 +00:00
parent a3a97ecbe3
commit 2cd8303f58
3 changed files with 147 additions and 22 deletions
BIN
View File
Binary file not shown.
+5 -2
View File
@@ -1136,13 +1136,16 @@ Operation::CalculateAxesValues( const string& sHint, bool bSolChExact)
DBLVECTOR vAxRotPrecOri = vAxRotPrec ;
int nOutStrC = 0 ;
if ( ! CalculateClPathAxesValues( nClPathId, nLinAxes, nRotAxes, dRot1W, dAngDeltaMinForHome, vAxRotHome, vAxRotPrec, nOutStrC)) {
// se attivata scelta angolo iniziale vicino ad home e extra corsa C, provo a rifarlo disattivando
if ( dAngDeltaMinForHome < ANG_FULL && nOutStrC != 0)
// 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, INFINITO, vAxRotHome, vAxRotPrec, nOutStrC) ;
}
// se extracorsa dell'asse C, provo a precaricarlo al contrario
if ( nOutStrC != 0) {
vAxRotPrec[0] = vAxRotPrecOri[0] + ( nOutStrC > 0 ? - ANG_FULL : ANG_FULL) ;
vAxRotPrec[1] = vAxRotPrecOri[1] ;
m_pMchMgr->GetCurrMachine()->ResetOutstrokeInfo() ;
if ( ! CalculateClPathAxesValues( nClPathId, nLinAxes, nRotAxes, dRot1W, INFINITO, vAxRotHome, vAxRotPrec, nOutStrC))
bOk = false ;
}
+142 -20
View File
@@ -1561,6 +1561,10 @@ WaterJetting::ProcessPath( int nPathId, int nPvId, int nClId)
bool
WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, double dAddedOverlap)
{
// colore taglio, dipendente da angolo di inclinazione
Color colCut = LIME ;
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL)
colCut = FUCHSIA ;
// creo copia della curva composita
PtrOwner< ICurve> pCrv( pCompo->Clone()) ;
if ( IsNull( pCrv))
@@ -1598,7 +1602,7 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
return false ;
// assegno nome e colore
m_pGeomDB->SetName( nC2Id, MCH_PV_CUT) ;
m_pGeomDB->SetMaterial( nC2Id, LIME) ;
m_pGeomDB->SetMaterial( nC2Id, colCut) ;
// eventuali altri contorni ( interni di contornatura chiusa)
const int MAX_INT_LOOP = 1000 ;
for ( int i = 1 ; i <= MAX_INT_LOOP ; ++i) {
@@ -1612,7 +1616,7 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
return false ;
// assegno nome e colore
m_pGeomDB->SetName( nC3Id, MCH_PV_CUT) ;
m_pGeomDB->SetMaterial( nC3Id, LIME) ;
m_pGeomDB->SetMaterial( nC3Id, colCut) ;
}
// inserisco la regione nel DB
int nRId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pSfr)) ;
@@ -1626,6 +1630,109 @@ WaterJetting::GeneratePreView( int nPathId, const ICurveComposite* pCompo, doubl
return false ;
m_pGeomDB->SetName( nRrId, MCH_PV_RRCUT) ;
m_pGeomDB->SetMaterial( nRrId, INVISIBLE) ;
// eventuali ripetizioni in basso per tagli inclinati
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL) {
// creo copia della curva composita
PtrOwner< ICurve> pCrv( pCompo->Clone()) ;
if ( IsNull( pCrv))
return false ;
// rimuovo eventuale overlap
if ( dAddedOverlap > EPS_SMALL) {
pCrv->Invert() ;
pCrv->TrimStartAtLen( dAddedOverlap) ;
pCrv->Invert() ;
}
// offset per raggio utensile
double dRad = 0.5 * m_TParams.m_dDiam / cos( m_Params.m_dSideAngle * DEGTORAD) ;
double dSignOffs1 = dRad ;
if ( ( m_Params.m_nWorkSide == WJET_WS_RIGHT && m_Params.m_dSideAngle > 0) ||
( m_Params.m_nWorkSide == WJET_WS_LEFT && m_Params.m_dSideAngle < 0))
dSignOffs1 = - dSignOffs1 ;
OffsetCurve OffsCrv1 ;
OffsCrv1.Make( pCrv, dSignOffs1, ICurve::OFF_FILLET) ;
PtrOwner< ICurve> pOffs1( OffsCrv1.GetLongerCurve()) ;
if ( IsNull( pOffs1))
return false ;
// offset per inclinazione
double dSignOffs2 = dRad + m_dElev * abs( sin( m_Params.m_dSideAngle * DEGTORAD)) ;
if ( ( m_Params.m_nWorkSide == WJET_WS_RIGHT && m_Params.m_dSideAngle < 0) ||
( m_Params.m_nWorkSide == WJET_WS_LEFT && m_Params.m_dSideAngle > 0))
dSignOffs2 = - dSignOffs2 ;
OffsetCurve OffsCrv2 ;
OffsCrv2.Make( pCrv, dSignOffs2, ICurve::OFF_EXTEND) ;
PtrOwner< ICurve> pOffs2( OffsCrv2.GetLongerCurve()) ;
if ( IsNull( pOffs2))
return false ;
// calcolo la regione
PtrOwner<ISurfFlatRegion> pSfr ;
// se i due offset sono aperti
if ( ! pOffs1->IsClosed() && ! pOffs2->IsClosed()) {
// li unisco
PtrOwner<ICurveComposite> pBound( CreateCurveComposite()) ;
if ( IsNull( pBound))
return false ;
pBound->AddCurve( Release( pOffs1)) ;
pOffs2->Invert() ;
Point3d ptStart ; pOffs2->GetStartPoint( ptStart) ;
pBound->AddLine( ptStart) ;
pBound->AddCurve( Release( pOffs2)) ;
pBound->Close() ;
// creo la regione
SurfFlatRegionByContours SfrCntr( false, false) ;
SfrCntr.AddCurve( Release( pBound)) ;
pSfr.Set( SfrCntr.GetSurf()) ;
}
// altrimenti sono chiusi
else {
// creo la regione
SurfFlatRegionByContours SfrCntr( false, false) ;
SfrCntr.AddCurve( Release( pOffs1)) ;
SfrCntr.AddCurve( Release( pOffs2)) ;
pSfr.Set( SfrCntr.GetSurf()) ;
}
if ( IsNull( pSfr))
return false ;
// la regione deve essere rivolta verso Z+
if ( pSfr->GetNormVersor().z < 0) pSfr->Invert() ; // ne recupero il contorno
PtrOwner< ICurve> pCrv2 ;
pCrv2.Set( pSfr->GetLoop( 0, 0)) ;
if ( IsNull( pCrv2))
return false ;
// inserisco la curva nel DB
int nC2Id = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrv2)) ;
if ( nC2Id == GDB_ID_NULL)
return false ;
// assegno nome e colore
m_pGeomDB->SetName( nC2Id, MCH_PV_DOWN_CUT) ;
m_pGeomDB->SetMaterial( nC2Id, colCut) ;
// eventuali altri contorni ( interni di contornatura chiusa)
const int MAX_INT_LOOP = 1000 ;
for ( int i = 1 ; i <= MAX_INT_LOOP ; ++i) {
PtrOwner< ICurve> pCrv3 ;
pCrv3.Set( pSfr->GetLoop( 0, i)) ;
if ( IsNull( pCrv3))
break ;
// inserisco la curva nel DB
int nC3Id = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrv3)) ;
if ( nC3Id == GDB_ID_NULL)
return false ;
// assegno nome e colore
m_pGeomDB->SetName( nC3Id, MCH_PV_DOWN_CUT) ;
m_pGeomDB->SetMaterial( nC3Id, colCut) ;
}
// inserisco la regione nel DB
int nRId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pSfr)) ;
if ( nRId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nRId, MCH_PV_DOWN_RCUT) ;
m_pGeomDB->SetMaterial( nRId, INVISIBLE) ;
// la copio anche come regione ridotta
int nRrId = m_pGeomDB->Copy( nRId, GDB_ID_NULL, nPathId) ;
if ( nRrId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nRrId, MCH_PV_DOWN_RRCUT) ;
m_pGeomDB->SetMaterial( nRrId, INVISIBLE) ;
}
return true ;
}
@@ -1817,6 +1924,9 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
// recupero distanze di sicurezza
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
// Recupero versore estrusione
Vector3d vtN ; pCompo->GetExtrusion( vtN) ;
// ciclo sulle curve elementari
int nIdxSkip = 0 ;
int nMaxInd = pCompo->GetCurveCount() - 1 ;
@@ -1857,8 +1967,6 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
}
// altrimenti verifico con l'entità precedente
else {
// Recupero versore estrusione
Vector3d vtN ; pCompo->GetExtrusion( vtN) ;
// direzione finale precedente
const ICurve* pCrvP = pCompo->GetCurve( i - 1) ;
Vector3d vtEnd ; pCrvP->GetEndDir( vtEnd) ;
@@ -1867,7 +1975,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
// angolo tra le direzioni
double dAng ;
vtEnd.GetAngleXY( vtStart, dAng) ;
// Se richiesto loop e angolo esterno con precedente
// Se richiesto anello esterno e angolo esterno con precedente
if ( m_Params.m_nExtCornerType == WJET_EC_LOOP && IsExternalAngle( dAng)) {
// lunghezza tratti lineari e loro punti estremi
double dTgLen = 0.5 * m_TParams.m_dDiam * tan( 0.5 * dAng * DEGTORAD) ;
@@ -1881,8 +1989,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
// anello
PtrOwner<ICurve> pCrvA( GetArc2PVN( ptPe, ptPs, vtEnd, vtN)) ;
if ( ! IsNull( pCrvA) && pCrvA->GetType() == CRV_ARC) {
ICurveArc* pArc = GetCurveArc( pCrvA) ;
if ( ! AddArcMove( ptPs, pArc->GetCenter(), pArc->GetAngCenter(), vtN))
if ( ! AddCurveMove( pCrvA))
return false ;
}
else {
@@ -1902,14 +2009,18 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
// Feed ridotta
double dMinFeed = GetActualReducedFeed() ;
// ciclo sui punti di accelerazione
double dUprev = 0 ;
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) ;
PtrOwner<ICurve> pCrvT( pCrvC->Clone()) ;
if ( IsNull( pCrvT) || ! pCrvT->TrimStartEndAtParam( dUprev, dU))
return false ;
CalcAndSetToolCorrAuxDir( pCompo, i + dU) ;
SetFeed( ( 1 - dCoeff) * dMinFeed + dCoeff * GetActualFeed()) ;
if ( AddLinearMove( ptP) == GDB_ID_NULL)
if ( ! AddCurveMove( pCrvT))
return false ;
dUprev = dU ;
}
}
// se richiesto rallentamento interno e angolo interno, eseguo accelerazione e interpolazione direzione utensile
@@ -1933,17 +2044,21 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
Vector3d vtTp = CalcToolDir( pCompo, i) ;
Vector3d vtTn = CalcToolDir( pCompo, i + 0.5) ;
// ciclo sui punti di accelerazione
double dUprev = 0 ;
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) ;
PtrOwner<ICurve> pCrvT( pCrvC->Clone()) ;
if ( IsNull( pCrvT) || ! pCrvT->TrimStartEndAtParam( dUprev, dU))
return false ;
Vector3d vtTool = ( 1 - dCoeff) * vtTp + dCoeff * vtTn ;
vtTool.Normalize() ;
Vector3d vtCorr = CalcCorrDir( pCompo, i + dU) ;
SetToolCorrAuxDir( vtTool, vtCorr) ;
SetFeed( ( 1 - dCoeff) * dMinFeed + dCoeff * GetActualFeed()) ;
if ( AddLinearMove( ptP) == GDB_ID_NULL)
if ( ! AddCurveMove( pCrvT))
return false ;
dUprev = dU ;
}
}
}
@@ -1954,8 +2069,6 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
Point3d ptP3 ; pCrvC->GetEndPoint( ptP3) ;
if ( SqDistXY( ptP3, m_ptLastProbe) >= m_Params.m_dProbingMinDist * m_Params.m_dProbingMinDist)
SetIndex( i + 1 - nIdxSkip) ;
// Recupero versore estrusione
Vector3d vtN ; pCompo->GetExtrusion( vtN) ;
// direzione finale corrente
Vector3d vtEnd ; pCrvC->GetEndDir( vtEnd) ;
// direzione iniziale successiva
@@ -1972,14 +2085,18 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
// Feed ridotta
double dMinFeed = GetActualReducedFeed() ;
// ciclo sui punti di decelerazione
double dUprev = 0 ;
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) ;
PtrOwner<ICurve> pCrvT( pCrvC->Clone()) ;
if ( IsNull( pCrvT) || ! pCrvT->TrimStartEndAtParam( dUprev, dU))
return false ;
CalcAndSetToolCorrAuxDir( pCompo, i + dU) ;
SetFeed( ( 1 - dCoeff) * GetActualFeed() + dCoeff * dMinFeed) ;
if ( AddLinearMove( ptP) == GDB_ID_NULL)
if ( ! AddCurveMove( pCrvT))
return false ;
dUprev = dU ;
}
dNextFeed = dMinFeed ;
}
@@ -1987,7 +2104,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
if ( m_Params.m_nIntCornerType == WJET_IC_SLOW && IsInternalAngle( dAng)) {
// lunghezza entità
double dLen ; pCrvC->GetLength( dLen) ;
// lunghezza di deccelerazione
// lunghezza di decelerazione
double dAccLen = min( m_Params.m_dCornerSlowLen, dLen / 2 - EXTRA_ACC_LEN) ;
if ( m_Params.m_dSideAngle > 0) {
double dW = m_dElev * sin( m_Params.m_dSideAngle * DEGTORAD) ;
@@ -2004,17 +2121,21 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
Vector3d vtTp = CalcToolDir( pCompo, i + 0.5) ;
Vector3d vtTn = CalcToolDir( pCompo, i + 1) ;
// ciclo sui punti di decelerazione
double dUprev = 0 ;
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) ;
PtrOwner<ICurve> pCrvT( pCrvC->Clone()) ;
if ( IsNull( pCrvT) || ! pCrvT->TrimStartEndAtParam( dUprev, dU))
return false ;
Vector3d vtTool = ( 1 - dCoeff) * vtTp + dCoeff * vtTn ;
vtTool.Normalize() ;
Vector3d vtCorr = CalcCorrDir( pCompo, i + dU) ;
SetToolCorrAuxDir( vtTool, vtCorr) ;
SetFeed( ( 1 - dCoeff) * GetActualFeed() + dCoeff * dMinFeed) ;
if ( AddLinearMove( ptP) == GDB_ID_NULL)
if ( ! AddCurveMove( pCrvT))
return false ;
dUprev = dU ;
}
dNextFeed = dMinFeed ;
}
@@ -2040,8 +2161,9 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
ICurveArc* pArc = GetCurveArc( pCurve) ;
Point3d ptCen = pArc->GetCenter() ;
double dAngCen = pArc->GetAngCenter() ;
Vector3d vtN = pArc->GetNormVersor() ;
Point3d ptP3 ; pArc->GetEndPoint( ptP3) ;
Point3d ptCurr ; GetCurrPos( ptCurr) ;
double dDeltaAng ; pArc->CalcPointAngle( ptCurr, dDeltaAng) ;
SetFeed( dNextFeed) ;
// controlli per indice del punto di arrivo
if ( SqDistXY( ptP3, m_ptLastProbe) >= m_Params.m_dProbingMinDist * m_Params.m_dProbingMinDist) {
@@ -2050,7 +2172,7 @@ WaterJetting::AddStandardWj( const ICurveComposite* pCompo, const Vector3d& vtTo
}
else
++ nIdxSkip ;
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
if ( AddArcMove( ptP3, ptCen, dAngCen - dDeltaAng, vtN) == GDB_ID_NULL)
return false ;
}
// se ultima entità, uscita e retrazione