Merge remote-tracking branch 'origin/HEAD' into feature/SvuotatureConIsole

This commit is contained in:
SaraP
2021-06-30 15:43:38 +02:00
3 changed files with 122 additions and 112 deletions
BIN
View File
Binary file not shown.
+118 -112
View File
@@ -465,15 +465,15 @@ Pocketing::SetParam( int nType, const string& sVal)
bool
Pocketing::SetGeometry( const SELVECTOR& vIds)
{
// verifico validità gestore DB geometrico
// verifico validit gestore DB geometrico
if ( m_pGeomDB == nullptr)
return false ;
// reset della geometria corrente
m_vId.clear() ;
// verifico che gli identificativi rappresentino delle entità ammissibili (tutte curve o tutte facce)
// verifico che gli identificativi rappresentino delle entit ammissibili (tutte curve o tutte facce)
int nType = GEO_NONE ;
for ( const auto& Id : vIds) {
// test sull'entità
// test sull'entit
int nSubs ;
if ( ! VerifyGeometry( Id, nSubs, nType)) {
string sInfo = "Warning in Pocketing : Skipped entity " + ToString( Id) ;
@@ -496,14 +496,14 @@ Pocketing::Preview( bool bRecalc)
// reset numero percorsi di svuotatura generati
m_nPockets = 0 ;
// verifico validità gestore DB geometrico e Id del gruppo
// verifico validit gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
// recupero gruppo per geometria ausiliaria
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
bool bChain = false ;
// se non c'è, lo aggiungo
// se non c', lo aggiungo
if ( nAuxId == GDB_ID_NULL) {
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nAuxId == GDB_ID_NULL)
@@ -544,7 +544,7 @@ Pocketing::Preview( bool bRecalc)
// recupero gruppo per geometria di Preview
int nPvId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_PV) ;
// se non c'è, lo aggiungo
// se non c', lo aggiungo
if ( nPvId == GDB_ID_NULL) {
nPvId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nPvId == GDB_ID_NULL)
@@ -577,7 +577,7 @@ Pocketing::Apply( bool bRecalc, bool bPostApply)
// reset raggio massimo attacco ad elica nel caso di cerchi
m_dMaxHelixRad = INFINITO ;
// verifico validità gestore DB geometrico e Id del gruppo
// verifico validit gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
@@ -600,7 +600,7 @@ Pocketing::Apply( bool bRecalc, bool bPostApply)
// recupero gruppo per geometria ausiliaria
int nAuxId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_AUX) ;
bool bChain = false ;
// se non c'è, lo aggiungo
// se non c', lo aggiungo
if ( nAuxId == GDB_ID_NULL) {
nAuxId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nAuxId == GDB_ID_NULL)
@@ -635,7 +635,7 @@ Pocketing::Apply( bool bRecalc, bool bPostApply)
// recupero gruppo per geometria di lavorazione (Cutter Location)
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
// se non c'è, lo aggiungo
// se non c', lo aggiungo
if ( nClId == GDB_ID_NULL) {
nClId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nClId == GDB_ID_NULL)
@@ -679,7 +679,7 @@ Pocketing::Apply( bool bRecalc, bool bPostApply)
bool
Pocketing::Update( bool bPostApply)
{
// verifico validità gestore DB geometrico e Id del gruppo
// verifico validit gestore DB geometrico e Id del gruppo
if ( m_pGeomDB == nullptr || ! m_pGeomDB->ExistsObj( m_nOwnerId))
return false ;
@@ -914,7 +914,7 @@ Pocketing::UpdateToolData( bool* pbChanged)
bool
Pocketing::GetGeometry( SELVECTOR& vIds) const
{
// restituisco l'elenco delle entità
// restituisco l'elenco delle entit
vIds = m_vId ;
return true ;
}
@@ -927,7 +927,7 @@ Pocketing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( Id.nId) ;
if ( pGObj == nullptr)
return false ;
// se ammesse curve ed è tale
// se ammesse curve ed tale
if ( ( nType == GEO_NONE || nType == GEO_CURVE) && ( pGObj->GetType() & GEO_CURVE) != 0) {
nType = GEO_CURVE ;
const ICurve* pCurve = nullptr ;
@@ -951,7 +951,7 @@ Pocketing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
}
return true ;
}
// se altrimenti ammessi testi ed è tale
// se altrimenti ammessi testi ed tale
else if ( ( nType == GEO_NONE || nType == EXT_TEXT) && pGObj->GetType() == EXT_TEXT) {
nType = EXT_TEXT ;
const IExtText* pText = ::GetExtText( pGObj) ;
@@ -960,7 +960,7 @@ Pocketing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
nSubs = 0 ;
return true ;
}
// se altrimenti ammesse superfici trimesh ed è tale
// se altrimenti ammesse superfici trimesh ed tale
else if ( ( nType == GEO_NONE || nType == SRF_TRIMESH) && pGObj->GetType() == SRF_TRIMESH) {
nType = SRF_TRIMESH ;
const ISurfTriMesh* pSurf = ::GetSurfTriMesh( pGObj) ;
@@ -982,7 +982,7 @@ Pocketing::VerifyGeometry( SelData Id, int& nSubs, int& nType)
}
return true ;
}
// se altrimenti ammesse regioni ed è tale
// se altrimenti ammesse regioni ed tale
else if ( ( nType == GEO_NONE || nType == SRF_FLATRGN) && pGObj->GetType() == SRF_FLATRGN) {
nType = SRF_FLATRGN ;
const ISurfFlatRegion* pReg = ::GetSurfFlatRegion( pGObj) ;
@@ -1051,7 +1051,7 @@ Pocketing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
return false ;
// la duplico
pCurve.Set( pOriCurve->Clone()) ;
// reset proprietà temporanee
// reset propriet temporanee
ResetCurveAllTempProp( pCurve) ;
// recupero estrusione e spessore
Vector3d vtExtr ;
@@ -1079,7 +1079,7 @@ Pocketing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
// recupero l'outline del testo
if ( ! pText->GetOutline( lstPC))
return false ;
// reset proprietà temporanee
// reset propriet temporanee
for ( auto pCrv : lstPC)
ResetCurveAllTempProp( pCrv) ;
// porto le curve in globale
@@ -1109,16 +1109,16 @@ Pocketing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
if ( ! pCrvCompo->IsValid())
return false ;
// reset proprietà temporanee
// reset propriet temporanee
ResetCurveAllTempProp( pCrvCompo) ;
// determino eventuali lati aperti e aggiorno proprietà del contorno
// determino eventuali lati aperti e aggiorno propriet del contorno
int nInd = 0 ;
double dPar ;
bool bFound = vPL[k].GetFirstU( dPar, true) ;
while ( bFound) {
// recupero il flag
int nFlag = int( dPar) ;
// se non c'è nulla di adiacente, lato aperto
// se non c' nulla di adiacente, lato aperto
if ( nFlag == SVT_NULL)
pCrvCompo->SetCurveTempProp( nInd, 1) ;
// altrimenti verifico se la faccia adiacente forma diedro convesso o concavo
@@ -1181,7 +1181,7 @@ Pocketing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
if ( IsNull( pCrvCompo) || ! pCrvCompo->AddCurve( pReg->GetLoop( nC, nL)))
return false ;
// reset proprietà temporanee
// reset propriet temporanee
ResetCurveAllTempProp( pCrvCompo) ;
// assegno l'estrusione dalla normale alla regione
pCrvCompo->SetExtrusion( vtN) ;
@@ -1208,7 +1208,7 @@ Pocketing::SetCurveAllTempProp( int nCrvId, ICurve* pCurve)
{
if ( pCurve == nullptr)
return false ;
// reset proprietà temporanee
// reset propriet temporanee
ResetCurveAllTempProp( pCurve) ;
// verifico se presenti info per lati aperti
if ( ! m_pGeomDB->ExistsInfo( nCrvId, KEY_OPEN))
@@ -1374,7 +1374,7 @@ Pocketing::ProcessPath2( int nPathId, int nPvId, int nClId)
// recupero gruppo per geometria temporanea
const string GRP_TEMP = "Temp" ;
int nTempId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, GRP_TEMP) ;
// se non c'è, lo aggiungo
// se non c', lo aggiungo
if ( nTempId == GDB_ID_NULL) {
nTempId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nTempId == GDB_ID_NULL)
@@ -1433,7 +1433,7 @@ Pocketing::ProcessPath2( int nPathId, int nPvId, int nClId)
if ( ! pSrfTmp->GetCurveClassification( *pCrv, ccClass))
return false ;
// se una curva non è completamente contenuta la ignoro
// se una curva non completamente contenuta la ignoro
if ( ccClass.size() != 1 || ccClass[0].nClass != CRVC_IN) {
m_pMchMgr->SetWarning( 2413, "Warining in Pocketing : curve " + to_string( it->first) + " is ignored") ;
vIdxArea.erase( it) ;
@@ -1588,7 +1588,7 @@ Pocketing::ProcessPath2( int nPathId, int nPvId, int nClId)
}
// end while
//
// sistemo senso antiorario visto dalla direzione di estrusione per curva più esterna
// sistemo senso antiorario visto dalla direzione di estrusione per curva pi esterna
ICurveComposite * pCompoExt = GetCurveComposite( m_pGeomDB->GetGeoObj( vCopyIds[0])) ;
Plane3d plPlane ; double dArea ;
pCompoExt->GetArea( plPlane, dArea) ;
@@ -1596,13 +1596,13 @@ Pocketing::ProcessPath2( int nPathId, int nPvId, int nClId)
pCompoExt->Invert() ;
}
// gestione lati aperti per la curva più esterna
// gestione lati aperti per la curva pi esterna
bool bMidOpen = false ;
Point3d ptMidOpen ;
Vector3d vtMidOut ;
bool bSomeOpen = m_pGeomDB->ExistsInfo( vCopyIds[0], KEY_OPEN) ;
if ( bSomeOpen) {
// ricerca del punto medio del lato aperto più lungo
// ricerca del punto medio del lato aperto pi lungo
bMidOpen = GetMidOfLongestOpenSide( pCompoExt, ptMidOpen, vtMidOut) ;
// sistemazioni per eventuali lati aperti
if ( ! AdjustContourWithOpenEdges( pCompoExt)) {
@@ -1611,7 +1611,7 @@ Pocketing::ProcessPath2( int nPathId, int nPvId, int nClId)
}
}
// sposto l'inizio a metà del tratto più lungo ( o aperto più lungo)
// sposto l'inizio a met del tratto pi lungo ( o aperto pi lungo)
if ( bMidOpen) {
const double LEN_OUT = 5 ;
double dPar ; int nFlag ;
@@ -1659,7 +1659,7 @@ Pocketing::ProcessPath2( int nPathId, int nPvId, int nClId)
}
// verifico di non superare il massimo materiale
// se lo step supera la capacità dell'utensile
// se lo step supera la capacit dell'utensile
if ( m_Params.m_dStep > m_TParams.m_dMaxMat + EPS_SMALL) {
dOkStep = m_TParams.m_dMaxMat + EPS_SMALL ;
string sInfo = "Warning in Pocketing : machining step (" + ToString( m_Params.m_dStep, 1) +
@@ -1668,7 +1668,7 @@ Pocketing::ProcessPath2( int nPathId, int nPvId, int nClId)
}
// se lavorazione singola
if ( dOkStep < EPS_SMALL || dOkStep > dElev) {
// se l'elevazione supera la capacità dell'utensile
// se l'elevazione supera la capacit dell'utensile
if ( dElev > m_TParams.m_dMaxMat + EPS_SMALL) {
string sInfo = "Warning in Pocketing : machining depth (" + ToString( dElev, 1) +
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
@@ -1790,7 +1790,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
// recupero gruppo per geometria temporanea
const string GRP_TEMP = "Temp" ;
int nTempId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, GRP_TEMP) ;
// se non c'è, lo aggiungo
// se non c', lo aggiungo
if ( nTempId == GDB_ID_NULL) {
nTempId = m_pGeomDB->AddGroup( GDB_ID_NULL, m_nOwnerId, Frame3d()) ;
if ( nTempId == GDB_ID_NULL)
@@ -1873,7 +1873,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
Point3d ptMidOpen ;
Vector3d vtMidOut ;
if ( bSomeOpen) {
// ricerca del punto medio del lato aperto più lungo
// ricerca del punto medio del lato aperto pi lungo
bMidOpen = GetMidOfLongestOpenSide( pCompo, ptMidOpen, vtMidOut) ;
// sistemazioni per eventuali lati aperti
if ( ! AdjustContourWithOpenEdges( pCompo)) {
@@ -1882,7 +1882,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
}
}
// sposto l'inizio a metà del tratto più lungo ( o aperto più lungo)
// sposto l'inizio a met del tratto pi lungo ( o aperto pi lungo)
if ( bMidOpen) {
const double LEN_OUT = 5 ;
double dPar ; int nFlag ;
@@ -1964,7 +1964,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
}
// verifico di non superare il massimo materiale
// se lo step supera la capacità dell'utensile
// se lo step supera la capacit dell'utensile
if ( m_Params.m_dStep > m_TParams.m_dMaxMat + EPS_SMALL) {
dOkStep = m_TParams.m_dMaxMat + EPS_SMALL ;
string sInfo = "Warning in Pocketing : machining step (" + ToString( m_Params.m_dStep, 1) +
@@ -1973,7 +1973,7 @@ Pocketing::ProcessPath( int nPathId, int nPvId, int nClId)
}
// se lavorazione singola
if ( dOkStep < EPS_SMALL || dOkStep > dElev) {
// se l'elevazione supera la capacità dell'utensile
// se l'elevazione supera la capacit dell'utensile
if ( dElev > m_TParams.m_dMaxMat + EPS_SMALL) {
string sInfo = "Warning in Pocketing : machining depth (" + ToString( dElev, 1) +
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
@@ -2227,10 +2227,10 @@ Pocketing::CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& v
bool
Pocketing::VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool)
{
// se non è svuotatura dal basso in alto, esco
// se non svuotatura dal basso in alto, esco
if ( vtTool.z > MIN_ZDIR_TOP_TOOL)
return true ;
// se c'è testa non dall'alto o tavola basculante, esco
// se c' testa non dall'alto o tavola basculante, esco
if ( ! m_bAboveHead || m_bTiltingTab)
return true ;
// recupero dati di eventuale rinvio da sotto
@@ -2289,9 +2289,10 @@ Pocketing::GeneratePocketingPv( int nPathId, const ICurveComposite* pCompo)
PtrOwner< ICurve> pCrv( pCompo->Clone()) ;
if ( IsNull( pCrv))
return false ;
// calcolo la regione
PtrOwner<ISurfFlatRegion> pSfr ;
pSfr.Set( GetSurfFlatRegionFromFatCurve( Release( pCrv), 0.5 * m_TParams.m_dDiam, false, false)) ;
// calcolo la regione
SurfFlatRegionByContours SfrCntrRr ;
SfrCntrRr.AddCurve( Release( pCrv)) ;
PtrOwner<ISurfFlatRegion> pSfr( SfrCntrRr.GetSurf()) ;
if ( IsNull( pSfr))
return false ;
// ne recupero il contorno
@@ -2305,8 +2306,8 @@ Pocketing::GeneratePocketingPv( int nPathId, const ICurveComposite* pCompo)
return false ;
// assegno nome e colore
m_pGeomDB->SetName( nC2Id, MCH_PV_CUT) ;
m_pGeomDB->SetMaterial( nC2Id, LIME) ;
// eventuali altri contorni ( interni di contornatura chiusa)
m_pGeomDB->SetMaterial( nC2Id, RED) ;
// 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 ;
@@ -2319,15 +2320,15 @@ Pocketing::GeneratePocketingPv( int nPathId, const ICurveComposite* pCompo)
return false ;
// assegno nome e colore
m_pGeomDB->SetName( nC3Id, MCH_PV_CUT) ;
m_pGeomDB->SetMaterial( nC3Id, LIME) ;
m_pGeomDB->SetMaterial( nC3Id, RED) ;
}
// 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_RCUT) ;
m_pGeomDB->SetMaterial( nRId, INVISIBLE) ;
// la copio anche come regione ridotta
m_pGeomDB->SetMaterial( nRId, Color( 255, 0, 0, 60)) ;
// la copio anche come regione ridotta
int nRrId = m_pGeomDB->Copy( nRId, GDB_ID_NULL, nPathId) ;
if ( nRrId == GDB_ID_NULL)
return false ;
@@ -2362,10 +2363,12 @@ Pocketing::AddZigZag( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, const
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
// se utensile che non lavora di testa poichè ingresso non fuori dal pezzo, errore
// se utensile che non lavora di testa poich ingresso non fuori dal pezzo, errore
if ( m_TParams.m_nType == TT_MILL_NOTIP) {
m_pMchMgr->SetLastError( 2431, "Error in Pocketing : LeadIn with Mill NoTip in material") ;
return false ;
if ( ! LeadInIsOk()) {
m_pMchMgr->SetLastError( 2431, "Error in Pocketing : LeadIn with Mill NoTip in material") ;
return false ;
}
}
// determino numero e affondamento degli step
@@ -2461,9 +2464,9 @@ Pocketing::AddZigZag( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, const
pCurve->ToGlob( frPocket) ;
// aggiungo affondamento
pCurve->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
// se prima entità
// se prima entit
if ( i == 0 ) {
// dati inizio entità
// dati inizio entit
Point3d ptStart ;
pCurve->GetStartPoint( ptStart) ;
Vector3d vtStart ;
@@ -2475,11 +2478,10 @@ Pocketing::AddZigZag( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, const
// determino elevazione su inizio attacco
double dStElev ;
if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev))
dStElev = dElev ;
bool bUnderStart = m_bAboveHead && GetPointUnderRaw( ptP1, vtTool, 0,
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ;
if ( bUnderStart)
dStElev = max( dStElev, dElev) ;
dStElev = j * dStep ;
bool bUnderRaw = GetPointUnderRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ;
if ( bUnderRaw == m_bAboveHead)
dStElev = max( dStElev, j * dStep) ;
dStElev -= ( ptP1 - ptStart) * vtExtr ;
// se inizio, approccio globale al punto iniziale
if ( bStart) {
@@ -2522,9 +2524,9 @@ Pocketing::AddZigZag( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, const
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
return false ;
}
// se ultima entità
// se ultima entit
if ( i == nMaxInd) {
// dati fine entità
// dati fine entit
Point3d ptEnd ;
pCurve->GetEndPoint( ptEnd) ;
Vector3d vtEnd ;
@@ -2592,7 +2594,7 @@ Pocketing::AddZigZag( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, const
if ( m_Params.m_bInvert)
pOffs2->Invert() ;
// sposto l'inizio a metà del tratto più lungo
// sposto l'inizio a met del tratto pi lungo
AdjustContourStart( pOffs2) ;
// aggiungo la lavorazione di questa curva
@@ -2609,9 +2611,9 @@ Pocketing::AddZigZag( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, const
return false ;
// aggiungo affondamento
pCurve->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
// se prima entità
// se prima entit
if ( i == 0 ) {
// dati inizio entità
// dati inizio entit
Point3d ptStart ;
pCurve->GetStartPoint( ptStart) ;
Vector3d vtStart ;
@@ -2678,11 +2680,11 @@ Pocketing::AddZigZag( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, const
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
return false ;
}
// se ultima entità
// se ultima entit
if ( i == nMaxInd) {
// se ultimo step, uscita e retrazione di collegamento
if ( j == nStep) {
// dati fine entità
// dati fine entit
Point3d ptEnd ;
pCurve->GetEndPoint( ptEnd) ;
Vector3d vtEnd ;
@@ -2882,7 +2884,7 @@ Pocketing::CalcZigZag( const ISurfFlatRegion* pSrf, ICRVCOMPOPOVECTOR& vpCrvs)
for ( int l = li ; l < int( vvSec[k].size()) ; ++ l) {
if ( ! vvSec[k][l].bActive)
continue ;
// la nuova sezione deve partire dalla stessa curva su cui ci si è fermati
// la nuova sezione deve partire dalla stessa curva su cui ci si fermati
if ( vvSec[k][l].nIdxS != Sec.nIdxE)
continue ;
double dU = vvSec[k][l].dOs ;
@@ -2968,10 +2970,12 @@ Pocketing::AddOneWay( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, const
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
// se utensile che non lavora di testa poichè ingresso non fuori dal pezzo, errore
// se utensile che non lavora di testa poich ingresso non fuori dal pezzo, errore
if ( m_TParams.m_nType == TT_MILL_NOTIP) {
m_pMchMgr->SetLastError( 2431, "Error in Pocketing : LeadIn with Mill NoTip in material") ;
return false ;
if ( ! LeadInIsOk()) {
m_pMchMgr->SetLastError( 2431, "Error in Pocketing : LeadIn with Mill NoTip in material") ;
return false ;
}
}
// determino numero e affondamento degli step
@@ -3006,7 +3010,7 @@ Pocketing::AddOneWay( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, const
if ( m_Params.m_bInvert)
pOffs->Invert() ;
// sposto l'inizio a metà del tratto più lungo
// sposto l'inizio a met del tratto pi lungo
AdjustContourStart( pOffs) ;
// coefficiente di riduzione feed di lavorazione di questa curva
@@ -3026,9 +3030,9 @@ Pocketing::AddOneWay( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, const
return false ;
// aggiungo affondamento
pCurve->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
// se prima entità
// se prima entit
if ( i == 0 ) {
// dati inizio entità
// dati inizio entit
Point3d ptStart ;
pCurve->GetStartPoint( ptStart) ;
Vector3d vtStart ;
@@ -3095,11 +3099,11 @@ Pocketing::AddOneWay( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, const
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
return false ;
}
// se ultima entità
// se ultima entit
if ( i == nMaxInd) {
// se ultimo step, uscita e retrazione di collegamento
if ( j == nStep) {
// dati fine entità
// dati fine entit
Point3d ptEnd ;
pCurve->GetEndPoint( ptEnd) ;
Vector3d vtEnd ;
@@ -3198,11 +3202,10 @@ Pocketing::AddOneWay( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, const
// determino elevazione su inizio attacco
double dStElev ;
if ( ! GetElevation( m_nPhase, ptS - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev))
dStElev = dElev ;
bool bUnderStart = m_bAboveHead && GetPointUnderRaw( ptP, vtTool, 0,
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ;
if ( bUnderStart)
dStElev = max( dStElev, dElev) ;
dStElev = j * dStep ;
bool bUnderRaw = GetPointUnderRaw( ptP, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ;
if ( bUnderRaw == m_bAboveHead)
dStElev = max( dStElev, j * dStep) ;
dStElev -= ( ptP - ptS) * vtExtr ;
// sempre approccio di collegamento
if ( ! AddLinkApproach( ptP, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr)) {
@@ -3306,8 +3309,10 @@ Pocketing::AddSpiralIn( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, con
// se utensile che non lavora di testa e ingresso non fuori dal pezzo, errore
if ( m_TParams.m_nType == TT_MILL_NOTIP && ! bOutStart) {
m_pMchMgr->SetLastError( 2431, "Error in Pocketing : LeadIn with Mill NoTip in material") ;
return false ;
if ( ! LeadInIsOk()) {
m_pMchMgr->SetLastError( 2431, "Error in Pocketing : LeadIn with Mill NoTip in material") ;
return false ;
}
}
// determino numero e affondamento degli step
@@ -3331,9 +3336,9 @@ Pocketing::AddSpiralIn( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, con
return false ;
// aggiungo affondamento
pCurve->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
// se prima entità
// se prima entit
if ( i == 0 ) {
// dati inizio entità
// dati inizio entit
Point3d ptStart ;
pCurve->GetStartPoint( ptStart) ;
Vector3d vtStart ;
@@ -3343,14 +3348,13 @@ Pocketing::AddSpiralIn( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, con
// determino inizio attacco
if ( ! CalcLeadInStart( ptStart, vtStart, vtExtr, pRCrv, ptP1))
return false ;
// determino elevazione su inizio attacco
// determino elevazione su inizio attacco (se non trovata, elevazione step)
double dStElev ;
if ( ! GetElevation( m_nPhase, ptStart - 10 * EPS_SMALL * vtTool, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev))
dStElev = dElev ;
bool bUnderStart = m_bAboveHead && GetPointUnderRaw( ptP1, vtTool, 0,
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ;
if ( bUnderStart)
dStElev = max( dStElev, dElev) ;
dStElev = dStep ;
bool bUnderRaw = GetPointUnderRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, dStElev) ;
if ( bUnderRaw == m_bAboveHead)
dStElev = max( dStElev, dStep) ;
dStElev -= ( ptP1 - ptStart) * vtExtr ;
// se attacco a zigzag o a spirale o a scivolo, l'elevazione va nell'attacco
@@ -3401,7 +3405,7 @@ Pocketing::AddSpiralIn( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, con
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
return false ;
}
// se ultima entità
// se ultima entit
if ( i == nMaxInd) {
// se step intermedio, ritorno all'inizio direttamente
if ( j < nStep) {
@@ -3429,7 +3433,7 @@ Pocketing::AddSpiralIn( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, con
}
// atrimenti ultimo step, uscita e retrazione
else {
// dati fine entità
// dati fine entit
Point3d ptEnd ;
pCurve->GetEndPoint( ptEnd) ;
Vector3d vtEnd ;
@@ -3465,10 +3469,12 @@ Pocketing::AddSpiralOut( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, co
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
// lunghezza di approccio/retrazione
double dAppr = m_Params.m_dStartPos ;
// se utensile che non lavora di testa poichè ingresso non fuori dal pezzo, errore
// se utensile che non lavora di testa poich ingresso non fuori dal pezzo, errore
if ( m_TParams.m_nType == TT_MILL_NOTIP) {
m_pMchMgr->SetLastError( 2431, "Error in Pocketing : LeadIn with Mill NoTip in material") ;
return false ;
if ( ! LeadInIsOk()) {
m_pMchMgr->SetLastError( 2431, "Error in Pocketing : LeadIn with Mill NoTip in material") ;
return false ;
}
}
// ciclo sulle regioni
const int MAX_REGS = 50 ;
@@ -3487,7 +3493,7 @@ Pocketing::AddSpiralOut( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, co
if ( pMCrv->GetCurveCount() == 0)
break ;
++ nReg ;
// inverto i percorsi, perchè sono calcolati dall'esterno all'interno
// inverto i percorsi, perch sono calcolati dall'esterno all'interno
pMCrv->Invert() ;
pRCrv->Invert() ;
@@ -3511,9 +3517,9 @@ Pocketing::AddSpiralOut( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, co
return false ;
// aggiungo affondamento
pCurve->Translate( - vtTool * ( dDepth - dElev + j * dStep)) ;
// se prima entità
// se prima entit
if ( i == 0 ) {
// dati inizio entità
// dati inizio entit
Point3d ptStart ;
pCurve->GetStartPoint( ptStart) ;
Vector3d vtStart ;
@@ -3583,7 +3589,7 @@ Pocketing::AddSpiralOut( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, co
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL)
return false ;
}
// se ultima entità
// se ultima entit
if ( i == nMaxInd) {
// se step intermedio
if ( j < nStep) {
@@ -3611,7 +3617,7 @@ Pocketing::AddSpiralOut( const ISurfFlatRegion* pSrf, const Vector3d& vtTool, co
}
// atrimenti ultimo step, uscita e retrazione
else {
// dati fine entità
// dati fine entit
Point3d ptEnd ;
pCurve->GetEndPoint( ptEnd) ;
Vector3d vtEnd ;
@@ -3725,7 +3731,7 @@ Pocketing::CalcSpiral( const ISurfFlatRegion * pSrf , int nReg, bool bSplitArcs,
break ;
// Inserisco le curve che delimitano la superficie di offset nel vettore vOffs in modo che siano ordinate dalla
// più esterna alla più interna
// pi esterna alla pi interna
for ( int nL = 0 ; nL < pSrfOff->GetLoopCount( 0) ; nL ++) {
pOffs.Set( GetCurveComposite( pSrfOff->GetLoop( 0, nL))) ;
@@ -3792,7 +3798,7 @@ Pocketing::CalcSpiral( const ISurfFlatRegion * pSrf , int nReg, bool bSplitArcs,
Point3d ptOld ;
AdjustContourStart( vOffs[0]) ;
vOffs[0]->GetEndPoint( ptOld) ;
// per le curve successive scelgo come start point quello più vicino all'end point della curva precedente
// per le curve successive scelgo come start point quello pi vicino all'end point della curva precedente
for ( size_t i = 1 ; i < vOffs.size() ; i++) {
double dParam ; int nFlag ;
if ( DistPointCurve( ptOld, *vOffs[i]).GetParamAtMinDistPoint( 0, dParam, nFlag))
@@ -3890,7 +3896,7 @@ Pocketing::CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, const
CRVCVECTOR ccClass ;
pSrf->GetCurveClassification( *pLine, ccClass) ;
// se nessuno o un solo tratto e interno, la retta è il collegamento
// se nessuno o un solo tratto e interno, la retta il collegamento
if ( ccClass.empty() || ( ccClass.size() == 1 && ccClass[0].nClass == CRVC_IN)) {
pCrvLink->AddCurve( Release( pLine)) ;
return true ;
@@ -3941,14 +3947,14 @@ Pocketing::CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, const
pLine->GetPointD1D2( ccClass[j].dParE, ICurve::FROM_MINUS, ptE) ;
bFound = vpCrvBound[CrvIdx]->GetParamAtPoint( ptE, dOffE) ;
}
// se intervallo non esiste, è errore
// se intervallo non esiste, errore
if ( ! bFound) {
m_pMchMgr->SetLastError( 2413, "Error in Pocketing : Toolpath not computable") ;
return false ;
}
}
// recupero i due possibili percorsi e uso il più corto
// recupero i due possibili percorsi e uso il pi corto
PtrOwner<ICurve> pCrvA( vpCrvBound[CrvIdx]->CopyParamRange( dOffS, dOffE)) ;
PtrOwner<ICurve> pCrvB( vpCrvBound[CrvIdx]->CopyParamRange( dOffE, dOffS)) ;
if ( IsNull( pCrvA) || IsNull( pCrvB))
@@ -4128,7 +4134,7 @@ Pocketing::AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafe
SetFlag( 0) ;
}
}
// se sopra attacco c'è spazio per sicurezza o approccio
// se sopra attacco c' spazio per sicurezza o approccio
double dSafeDist = ( m_bAggrBottom ? dSafeAggrBottZ : dSafeZ) ;
if ( dElev + max( dSafeDist, dAppr) > 10 * EPS_SMALL) {
// se distanza di sicurezza minore di distanza di inizio
@@ -4174,7 +4180,7 @@ bool
Pocketing::AddLinkApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr)
{
// se sopra attacco c'è spazio per approccio
// se sopra attacco c' spazio per approccio
if ( ( dElev + dAppr) > 10 * EPS_SMALL) {
// 1b -> punto appena sopra inizio
Point3d ptP1b = ptP + vtTool * ( dElev + dAppr) ;
@@ -4203,7 +4209,7 @@ bool
Pocketing::AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr)
{
// se sopra uscita c'è spazio per approccio
// se sopra uscita c' spazio per approccio
if ( ( dElev + dAppr) > 10 * EPS_SMALL) {
// 4 -> movimento di risalita sopra il punto finale
SetFeed( GetEndFeed()) ;
@@ -4219,7 +4225,7 @@ bool
Pocketing::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr)
{
// se sopra uscita c'è spazio per sicurezza o approccio
// se sopra uscita c' spazio per sicurezza o approccio
double dSafeDist = ( m_bAggrBottom ? dSafeAggrBottZ : dSafeZ) ;
if ( dElev + max( dSafeDist, dAppr) > 10 * EPS_SMALL) {
if ( dSafeDist < dAppr + 10 * EPS_SMALL) {
@@ -4509,7 +4515,7 @@ Pocketing::GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMi
}
pMyCrv = pCompo->GetNextCurve() ;
}
// richiedo lunghezza superiore a diametro utensile più doppio offset radiale
// richiedo lunghezza superiore a diametro utensile pi doppio offset radiale
double dMaxLen = ( bAllOpen ? 0 : m_TParams.m_dDiam + 2 * GetOffsR() - EPS_SMALL) ;
// ciclo sulle singole curve
bool bFound = false ;
@@ -4529,7 +4535,7 @@ Pocketing::GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMi
pNextCrv->GetLength( dLenNext) ;
// verifico la curva corrente
if ( pCrv->GetTempProp() == 1) {
// contributo dalle entità adiacenti (se non tutte aperte)
// contributo dalle entit adiacenti (se non tutte aperte)
double dLenAgg = 0 ;
if ( ! bAllOpen) {
if ( pPrevCrv != nullptr && pPrevCrv->GetTempProp() == 1) {
@@ -4543,7 +4549,7 @@ Pocketing::GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMi
dLenAgg += max( 0., vtEnd * vtNextStart * dLenNext) ;
}
}
// entità corrente
// entit corrente
double dLen = 0 ;
if ( pCrv->GetLength( dLen) && dLen + dLenAgg > dMaxLen) {
dMaxLen = dLen + dLenAgg ;
@@ -4575,7 +4581,7 @@ Pocketing::AdjustContourWithOpenEdges( ICurveComposite* pCompo)
Frame3d frPocket ;
Point3d ptStart ; pCompo->GetStartPoint( ptStart) ;
frPocket.Set( ptStart, vtExtr) ;
// sposto l'inizio a metà del tratto più lungo
// sposto l'inizio a met del tratto pi lungo
AdjustContourStart( pCompo) ;
// raggio di riferimento per offset
double dRad = 0.5 * m_TParams.m_dDiam + GetOffsR() ;
@@ -4694,7 +4700,7 @@ Pocketing::AdjustContourWithOpenEdges( ICurveComposite* pCompo)
bool
Pocketing::AdjustContourStart( ICurveComposite* pCompo)
{
// cerco il tratto lineare più lungo
// cerco il tratto lineare pi lungo
int i = 0 ;
double dLenMax = 0 ;
int nMax = - 1 ;
@@ -4709,7 +4715,7 @@ Pocketing::AdjustContourStart( ICurveComposite* pCompo)
pCrv = pCompo->GetNextCurve() ;
}
// se non trovato o troppo corto, cerco il tratto generico più lungo
// se non trovato o troppo corto, cerco il tratto generico pi lungo
if ( nMax < 0 || dLenMax < 2 * m_TParams.m_dDiam) {
i = 0 ;
pCrv = pCompo->GetFirstCurve() ;
@@ -4724,7 +4730,7 @@ Pocketing::AdjustContourStart( ICurveComposite* pCompo)
}
}
// sposto inizio a metà del tratto più lungo
// sposto inizio a met del tratto pi lungo
bool bOk = true ;
if ( nMax >= 0)
bOk = pCompo->ChangeStartPoint( nMax + 0.5) ;
+4
View File
@@ -137,6 +137,10 @@ class Pocketing : public Machining
if ( m_Params.m_nLeadInType != POCKET_LI_GLIDE && m_Params.m_dLiElev < 10 * EPS_SMALL)
return POCKET_LI_NONE ;
return m_Params.m_nLeadInType ; }
int LeadInIsOk( void) const
{ if ( m_TParams.m_nType != TT_MILL_NOTIP)
return true ;
return ( GetLeadInType() == POCKET_LI_HELIX && m_Params.m_dLiTang >= 0.49 * m_TParams.m_dDiam && m_Params.m_dLiElev <= 2) ; }
int GetLeadOutType( void) const
{ if ( m_Params.m_dLoTang < std::min( 0.1 * m_TParams.m_dDiam, 1.0))
return POCKET_LO_NONE ;