EgtMachKernel :
- modifiche per preview di tagli di lama inclinati su esterno archi.
This commit is contained in:
+45
-14
@@ -2135,8 +2135,9 @@ Sawing::ProcessExtCurve( const ICurve* pCrvP, const ICurveComposite* pCrvC, cons
|
||||
dDepthZ *= cos( m_Params.m_dSideAngle * DEGTORAD) ;
|
||||
pCrv->Translate( - Z_AX * dDepthZ) ;
|
||||
// offset per taglio inclinato
|
||||
double dOffs = 0 ;
|
||||
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL) {
|
||||
double dOffs = dDepth * sin( abs( m_Params.m_dSideAngle) * DEGTORAD) ;
|
||||
dOffs = dDepth * sin( abs( m_Params.m_dSideAngle) * DEGTORAD) ;
|
||||
if ( m_Params.m_nHeadSide == SAW_HS_LEFT)
|
||||
dOffs = - dOffs ;
|
||||
pCrv->SimpleOffset( dOffs) ;
|
||||
@@ -2214,7 +2215,7 @@ Sawing::ProcessExtCurve( const ICurve* pCrvP, const ICurveComposite* pCrvC, cons
|
||||
|
||||
// Se richiesto Preview
|
||||
if ( nPvId != GDB_ID_NULL) {
|
||||
if ( ! GenerateExtCurvePv( pCrv, dElev, dExtraCut, dRbHeight, sName, nPvId))
|
||||
if ( ! GenerateExtCurvePv( pCrv, dOffs, dElev, dExtraCut, dRbHeight, sName, nPvId))
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -2232,7 +2233,7 @@ Sawing::ProcessExtCurve( const ICurve* pCrvP, const ICurveComposite* pCrvC, cons
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv,
|
||||
Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv, double dOffs,
|
||||
double dElev, double dExtraCut, double dRbHeight, const string& sName, int nPvId)
|
||||
{
|
||||
// creo gruppo per anteprima di lavorazione della curva
|
||||
@@ -2245,6 +2246,11 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv,
|
||||
// disabilito eventuale registrazione comandi EXE (riabilitazione automatica)
|
||||
CmdLogOff cmdLogOff ;
|
||||
|
||||
// colore taglio, dipendente da angolo di inclinazione
|
||||
Color colCut = LIME ;
|
||||
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL)
|
||||
colCut = FUCHSIA ;
|
||||
|
||||
// dimensione da aggiungere alle regioni nelle parti in cui la lama è inclinata
|
||||
double dExtraL = m_pMchMgr->GetCurrMachiningsMgr()->GetExtraLOnCutRegion() ;
|
||||
|
||||
@@ -2277,16 +2283,41 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv,
|
||||
// se arco
|
||||
else if ( pArc != nullptr) {
|
||||
|
||||
// seno e coseno di angolo di inclinazione
|
||||
double dSinAS = sin( m_Params.m_dSideAngle * DEGTORAD) ;
|
||||
double dCosAS = cos( m_Params.m_dSideAngle * DEGTORAD) ;
|
||||
|
||||
// se taglio inclinato, devo applicare l'offset, aggiustare lo spessore lama e lo spostamento in Z
|
||||
PtrOwner< ICurveArc> pMyArc ;
|
||||
double dMyThick = m_TParams.m_dThick ;
|
||||
double dMyZmove = dElev ;
|
||||
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL) {
|
||||
// offset arco
|
||||
pMyArc.Set( pArc->Clone()) ;
|
||||
if ( IsNull( pMyArc))
|
||||
return false ;
|
||||
pMyArc->SimpleOffset( -dOffs) ;
|
||||
pArc = pMyArc ;
|
||||
// sistemazione spessore lama
|
||||
dMyThick = m_TParams.m_dThick / dCosAS ;
|
||||
// sistemazione spostamento in Z
|
||||
dMyZmove = dElev * dCosAS ;
|
||||
}
|
||||
|
||||
// calcolo dei raggi
|
||||
double dIntRad ;
|
||||
double dExtRad ;
|
||||
if ( AreHeadWorkOnSameSide()) {
|
||||
dIntRad = pArc->GetRadius() ;
|
||||
double dRadTot = pArc->GetRadius() + m_TParams.m_dThick ;
|
||||
double dRadTot = pArc->GetRadius() + dMyThick ;
|
||||
dExtRad = sqrt( dRadTot * dRadTot + dDeltaT * dDeltaT) ;
|
||||
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL)
|
||||
dExtRad = max( dExtRad, dRadTot + ( dElev - dExtraCut) * dSinAS) ;
|
||||
}
|
||||
else {
|
||||
dIntRad = pArc->GetRadius() - m_TParams.m_dThick ;
|
||||
dIntRad = pArc->GetRadius() - dMyThick ;
|
||||
if ( abs( m_Params.m_dSideAngle) > EPS_ANG_SMALL)
|
||||
dIntRad -= ( dElev - dExtraCut - abs( dSinAS) * dMyThick) * abs( dSinAS) ;
|
||||
dExtRad = sqrt( pArc->GetRadius() * pArc->GetRadius() + dDeltaT * dDeltaT) ;
|
||||
}
|
||||
dMaxW = max( dMaxW, dExtRad - dIntRad) ;
|
||||
@@ -2295,28 +2326,28 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv,
|
||||
PtrOwner<ICurveComposite> pCompo( GenerateExtArcPvTrueCut( pArc, dIntRad, dExtRad, 0)) ;
|
||||
if ( IsNull( pCompo))
|
||||
return false ;
|
||||
pCompo->Translate( dElev * vtCorr + Vector3d( 0, 0, 0.1)) ;
|
||||
pCompo->Translate( dMyZmove * vtCorr + Vector3d( 0, 0, 0.1)) ;
|
||||
int nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPxId, Release( pCompo)) ;
|
||||
m_pGeomDB->SetName( nId, MCH_PV_CUT) ;
|
||||
m_pGeomDB->SetMaterial( nId, LIME) ;
|
||||
m_pGeomDB->SetMaterial( nId, colCut) ;
|
||||
|
||||
// contorno per parte iniziale di taglio
|
||||
PtrOwner<ICurveComposite> pCompo2( GenerateExtArcPvPreCut( pArc, dIntRad, dExtRad, dDeltaT, 0, 0)) ;
|
||||
if ( IsNull( pCompo2))
|
||||
return false ;
|
||||
pCompo2->Translate( dElev * vtCorr) ;
|
||||
pCompo2->Translate( dMyZmove * vtCorr) ;
|
||||
int nId2 = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPxId, Release( pCompo2)) ;
|
||||
m_pGeomDB->SetName( nId2, ( bFirst ? MCH_PV_PRE_CUT : MCH_PV_CUT)) ;
|
||||
m_pGeomDB->SetMaterial( nId2, ( bFirst ? BLUE : LIME)) ;
|
||||
m_pGeomDB->SetMaterial( nId2, ( bFirst ? BLUE : colCut)) ;
|
||||
|
||||
// contorno per parte finale di taglio
|
||||
PtrOwner<ICurveComposite> pCompo3( GenerateExtArcPvPostCut( pArc, dIntRad, dExtRad, dDeltaT, 0, 0)) ;
|
||||
if ( IsNull( pCompo3))
|
||||
return false ;
|
||||
pCompo3->Translate( dElev * vtCorr) ;
|
||||
pCompo3->Translate( dMyZmove * vtCorr) ;
|
||||
int nId3 = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPxId, Release( pCompo3)) ;
|
||||
m_pGeomDB->SetName( nId3, ( bLast ? MCH_PV_POST_CUT : MCH_PV_CUT)) ;
|
||||
m_pGeomDB->SetMaterial( nId3, ( bLast ? BLUE : LIME)) ;
|
||||
m_pGeomDB->SetMaterial( nId3, ( bLast ? BLUE : colCut)) ;
|
||||
|
||||
// regione ridotta di taglio per nesting (escluse parti iniziali e finali)
|
||||
PtrOwner<ICurveComposite> pCmpRr( GenerateExtArcPvTrueCut( pArc, dIntRad, dExtRad, dExtraL)) ;
|
||||
@@ -2327,7 +2358,7 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv,
|
||||
ISurfFlatRegion* pSfrRr = SfrCntrRr.GetSurf() ;
|
||||
if ( pSfrRr == nullptr)
|
||||
return false ;
|
||||
pSfrRr->Translate( dElev * vtCorr) ;
|
||||
pSfrRr->Translate( dMyZmove * vtCorr) ;
|
||||
int nRrId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPxId, pSfrRr) ;
|
||||
m_pGeomDB->SetName( nRrId, MCH_PV_RRCUT) ;
|
||||
m_pGeomDB->SetMaterial( nRrId, INVISIBLE) ;
|
||||
@@ -2341,7 +2372,7 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv,
|
||||
ISurfFlatRegion* pSfrRs = SfrCntrRs.GetSurf() ;
|
||||
if ( pSfrRs == nullptr)
|
||||
return false ;
|
||||
pSfrRs->Translate( dElev * vtCorr) ;
|
||||
pSfrRs->Translate( dMyZmove * vtCorr) ;
|
||||
int nRsId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPxId, pSfrRs) ;
|
||||
m_pGeomDB->SetName( nRsId, ( bFirst ? MCH_PV_RLICUT : MCH_PV_RRCUT)) ;
|
||||
m_pGeomDB->SetMaterial( nRsId, INVISIBLE) ;
|
||||
@@ -2355,7 +2386,7 @@ Sawing::GenerateExtCurvePv( const ICurveComposite* pCrv,
|
||||
ISurfFlatRegion* pSfrRe = SfrCntrRe.GetSurf() ;
|
||||
if ( pSfrRe == nullptr)
|
||||
return false ;
|
||||
pSfrRe->Translate( dElev * vtCorr) ;
|
||||
pSfrRe->Translate( dMyZmove * vtCorr) ;
|
||||
int nReId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPxId, pSfrRe) ;
|
||||
m_pGeomDB->SetName( nReId, ( bLast ? MCH_PV_RLOCUT : MCH_PV_RRCUT)) ;
|
||||
m_pGeomDB->SetMaterial( nReId, INVISIBLE) ;
|
||||
|
||||
@@ -89,7 +89,7 @@ class Sawing : public Machining
|
||||
bool ProcessExtCurve( const ICurve* pCrvP, const ICurveComposite* pCrvC, const ICurve* pCrvN,
|
||||
double dDepth, double dExtraCut, double dRbHeight, bool bIsFirst, bool bIsLast,
|
||||
const std::string& sName, int nPvId, int nClId) ;
|
||||
bool GenerateExtCurvePv( const ICurveComposite* pCrv,
|
||||
bool GenerateExtCurvePv( const ICurveComposite* pCrv, double dOffs,
|
||||
double dElev, double dExtraCut, double dRbHeight, const std::string& sName, int nPvId) ;
|
||||
ICurveComposite* GenerateExtArcPvTrueCut( const ICurveArc* pArc, double dIntRad, double dExtRad,
|
||||
double dSafety) ;
|
||||
|
||||
Reference in New Issue
Block a user