EgtGeomKernel 3.1f6 :
- In CalcPocketing aggiunta gestione di lati chiusi da trattare come aperti per ZigZag/OneWay/Spiral.
This commit is contained in:
+61
-20
@@ -78,11 +78,14 @@ struct PocketParams {
|
||||
// -------------------------------------------------------
|
||||
bool bAllClosed = true ; // flag per indicare se tutti i bordi della *pSfr da svuotare sono chiusi
|
||||
bool bAllOpen = true ; // flag per indicare se tutti i bordi della *pSfr da svuotare sono aperti
|
||||
bool bToolInRegion = false ; // flag per forzare l'utensile a rimanere all'interno della regione (usato per Conformal)
|
||||
double dOffsExtra = 2. ; // Offset aggiuntivo per percosi a ZigZag/OneWay se richieste le curve di bordo
|
||||
Frame3d frLocXY ; // frame per conti nel piano XY
|
||||
int nOffsType = ICurve::OFF_FILLET ; // tipologia di Offset per estensione degli aperti
|
||||
double dOpenEdgeRad = 0. ; // raggio effettivo di estensione degli aperti
|
||||
// --------------------------------------------------------
|
||||
bool bSpecialRegion = false ; // Conformal : -> l'utensile non esce da questa regione -> (
|
||||
// ZigZag/OneWay : -> i percorsi vengono raccordati su tali regioni
|
||||
// Spiral : -> i percorsi comprendono anche il bordo stesso della regione
|
||||
// --------------------------------------------------------
|
||||
bool bPolishing = false ; // flag per lucidatura
|
||||
double dEpicyclesRad = 0. ; // raggio degli epicicli
|
||||
@@ -440,12 +443,32 @@ AssignFeedZigZagOneWay( ICurveComposite* pCompo, const bool bIsLink, const ICURV
|
||||
static bool
|
||||
SwapSideBySecondTempParam( ICurveComposite* pCompo)
|
||||
{
|
||||
// controllo validità della curva
|
||||
if ( pCompo == nullptr || ! pCompo->IsValid())
|
||||
return false ;
|
||||
// imposto il prarametro
|
||||
pCompo->SetTempParam( int( pCompo->GetTempParam( 1)) == MDS_LEFT ? MDS_RIGHT : MDS_LEFT, 1) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
SetAllEdgesAsClose( ISurfFlatRegion* pSfr)
|
||||
{
|
||||
// controllo validità della regione
|
||||
if ( pSfr == nullptr || ! pSfr->IsValid())
|
||||
return false ;
|
||||
// assegno le proprietà di lato chiuso a tutta la regione
|
||||
for ( int nC = 0 ; nC < pSfr->GetChunkCount() ; ++ nC) {
|
||||
for ( int nL = 0 ; nL < pSfr->GetLoopCount( nC) ; ++ nL) {
|
||||
for ( int nU = 0 ; nU < pSfr->GetLoopCurveCount( nC, nL) ; ++ nU)
|
||||
pSfr->SetCurveTempProp( nC, nL, nU, TEMP_PROP_CLOSE_EDGE, 0) ;
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
CheckSimpleOverlap( const ICurve* pCrv, const ICurveComposite* pCrvOri, int& nStat, double dToll)
|
||||
@@ -820,31 +843,37 @@ ResetCurveTempProps( ICurveComposite* pCrvCompo)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool
|
||||
IsToolInRegion( const ISurfFlatRegion* pSfr, int nType)
|
||||
IsSpecialRegion( const ISurfFlatRegion* pSfr, int nType)
|
||||
{
|
||||
// Verifico se la regione presenta solo TempProp TEMP_PROP_CLOSE_EDGE e TEMP_PROP_OPEN_AS_CLOSE.
|
||||
// La lavorazione può essere solo di tipo conformal e deve presentare un solo Chunk
|
||||
// verifico valditià della regione
|
||||
if ( pSfr == nullptr || ! pSfr->IsValid())
|
||||
return false ;
|
||||
if ( ! ( nType == POCKET_CONFORMAL_ZIGZAG || nType == POCKET_CONFORMAL_ONEWAY))
|
||||
return false ;
|
||||
int nChunkCnt = pSfr->GetChunkCount() ;
|
||||
if ( nChunkCnt != 1)
|
||||
return false ;
|
||||
bool bExistClose = false ;
|
||||
bool bExistOpen = false ;
|
||||
bool bExistOpenAsClose = false ;
|
||||
bool bExistTempProp = false ;
|
||||
for ( int nL = 0 ; nL < pSfr->GetLoopCount( nL) ; ++ nL) {
|
||||
for ( int nU = 0 ; nU < pSfr->GetLoopCurveCount( 0, nL) ; ++ nU) {
|
||||
int nTmpProp0 = TEMP_PROP_INVALID ; pSfr->GetCurveTempProp( 0, nL, nU, nTmpProp0, 0) ;
|
||||
bExistOpen = ( bExistOpen || ( nTmpProp0 == TEMP_PROP_OPEN_EDGE)) ;
|
||||
bExistOpen = ( nTmpProp0 == TEMP_PROP_OPEN_EDGE) ;
|
||||
if ( bExistOpen)
|
||||
return false ;
|
||||
bExistClose = ( bExistClose || ( nTmpProp0 == TEMP_PROP_CLOSE_EDGE)) ;
|
||||
bExistOpenAsClose = ( bExistOpenAsClose || ( nTmpProp0 == TEMP_PROP_OPEN_AS_CLOSE)) ;
|
||||
if ( nType == POCKET_CONFORMAL_ZIGZAG || nType == POCKET_CONFORMAL_ONEWAY)
|
||||
bExistTempProp = ( bExistTempProp || ( nTmpProp0 == TEMP_PROP_OPEN_AS_CLOSE)) ;
|
||||
else if ( nType == POCKET_ZIGZAG || nType == POCKET_ONEWAY || nType == POCKET_SPIRALIN || nType == POCKET_SPIRALOUT)
|
||||
bExistTempProp = ( bExistTempProp || ( nTmpProp0 == TEMP_PROP_CLOSE_AS_OPEN)) ;
|
||||
else
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
return ( bExistClose && bExistOpenAsClose) ;
|
||||
return (
|
||||
( ( nType == POCKET_CONFORMAL_ZIGZAG || nType == POCKET_CONFORMAL_ONEWAY) && bExistClose && bExistTempProp) ||
|
||||
( ( nType == POCKET_ZIGZAG || nType == POCKET_ONEWAY) && bExistTempProp) ||
|
||||
( ( nType == POCKET_SPIRALIN || nType == POCKET_SPIRALOUT) && bExistTempProp)
|
||||
) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -1099,6 +1128,10 @@ ExtendPath( ICurveComposite* pCompo, const ISurfFlatRegion* pSfr, const PocketPa
|
||||
return false ;
|
||||
bOkExtended = false ;
|
||||
|
||||
// se regione speciale non estendo mai i percorsi
|
||||
if ( PockParams.bSpecialRegion)
|
||||
return true ;
|
||||
|
||||
// recupero il punto iniziale/finale della curva con versore tangente
|
||||
Point3d pt ;
|
||||
if ( bEndOrStart) {
|
||||
@@ -1253,7 +1286,7 @@ SetConformalSurfShapedByOpen( const PocketParams& PockParams, ISurfFlatRegion* p
|
||||
return false ;
|
||||
|
||||
// verifico che il controllo sia necessario
|
||||
if ( ! PockParams.bToolInRegion)
|
||||
if ( ! PockParams.bSpecialRegion)
|
||||
return false ;
|
||||
|
||||
double dOffs = PockParams.dRad + PockParams.dRadialOffset ;
|
||||
@@ -2202,7 +2235,7 @@ GetSinglePocketingCurves( ISurfFlatRegion* pSfr, PocketParams& PockParams, ICRVC
|
||||
vCrvSingleCurves.clear() ;
|
||||
|
||||
// se superficie con lati aperti da considerare me chiusi, per ora non calcolo le curve singole
|
||||
if ( PockParams.bToolInRegion)
|
||||
if ( PockParams.bSpecialRegion)
|
||||
return true ;
|
||||
|
||||
// tengo una copia della superficie ( serve per l'estensione dei percorsi fuori dal grezzo)
|
||||
@@ -2288,7 +2321,7 @@ ModifySurfByOpenEdges( ISurfFlatRegion* pSfr, PocketParams& PockParams)
|
||||
return true ;
|
||||
|
||||
// se lati tutti chiusi o se lati aperti da considerare come chiusi, allora non devo fare nulla
|
||||
if ( PockParams.bAllClosed || PockParams.bToolInRegion)
|
||||
if ( PockParams.bAllClosed || PockParams.bSpecialRegion)
|
||||
return true ;
|
||||
|
||||
// NB. Tutti i Loop che presentano dei lati aperti possono essere estesi ; sia per loop esterni che per isole...
|
||||
@@ -4129,7 +4162,7 @@ GetPocketingOptimizedCurves( ISurfFlatRegion* pSfr, PocketParams& PockParam, ICR
|
||||
if ( PockParam.bAvoidOpt)
|
||||
return true ;
|
||||
// se aperti da trattare come chiusi, per ora esco
|
||||
if ( PockParam.bToolInRegion)
|
||||
if ( PockParam.bSpecialRegion)
|
||||
return true ;
|
||||
|
||||
// scorro i Chunk della superficie
|
||||
@@ -6995,7 +7028,7 @@ CalcSpiral( const ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrOrig, co
|
||||
pMCrv->Clear() ;
|
||||
|
||||
// Offset corrente ( il primo è definito dal raggio utensile)
|
||||
double dOffs = PockParams.dRad + PockParams.dRadialOffset ;
|
||||
double dOffs = ( PockParams.bSpecialRegion ? 0. : PockParams.dRad) + PockParams.dRadialOffset ;
|
||||
// se lucidatura
|
||||
if ( PockParams.bPolishing && nReg == 0)
|
||||
dOffs += PockParams.dEpicyclesRad ;
|
||||
@@ -8034,6 +8067,8 @@ AddZigZag( ISurfFlatRegion* pSrfPock, const ISurfFlatRegion* pSfrOrig, PocketPar
|
||||
double dOffs = PockParams.dRad + PockParams.dRadialOffset ;
|
||||
if ( PockParams.bAllowZigZagOneWayBorders && ! PockParams.bPolishing)
|
||||
dOffs += PockParams.dOffsExtra ;
|
||||
if ( PockParams.bSpecialRegion)
|
||||
dOffs = 0. ;
|
||||
|
||||
// ciclo su tutti i chunks della superficie originale
|
||||
for ( int nC = 0 ; nC < nChunk ; ++ nC) {
|
||||
@@ -9160,7 +9195,7 @@ AddLeadInLeadOutToCurveConformalPaths( const ISurfFlatRegion* pSfrOrig, const IS
|
||||
}
|
||||
|
||||
// se lati aperti da considerare come chiusi, non estendo i percorsi
|
||||
if ( PockParams.bToolInRegion)
|
||||
if ( PockParams.bSpecialRegion)
|
||||
return true ;
|
||||
|
||||
// ricavo le curve aperte della superficie di pocketing
|
||||
@@ -10071,13 +10106,13 @@ AddConformal( ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrOrig, Pocket
|
||||
if ( IsNull( pSfrToRemove) || ! pSfrToRemove->IsValid())
|
||||
return false ;
|
||||
PtrOwner<ISurfFlatRegion> pSfrClass( nullptr) ;
|
||||
if ( PockParams.bToolInRegion) {
|
||||
if ( PockParams.bSpecialRegion) {
|
||||
if ( ! pSfrClass.Set( CloneSurfFlatRegion( pSfrPock)))
|
||||
return false ;
|
||||
}
|
||||
|
||||
// --- se superficie con lati aperti da considerare come chiusi, aggiorno i lati della superficie
|
||||
if ( PockParams.bToolInRegion) {
|
||||
if ( PockParams.bSpecialRegion) {
|
||||
// modifico la forma della superficie in modo da rimanere sempre all'interno della regione originale
|
||||
if ( ! SetConformalSurfShapedByOpen( PockParams, pSfrChunk, pSfrToRemove))
|
||||
return false ;
|
||||
@@ -10098,7 +10133,7 @@ AddConformal( ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrOrig, Pocket
|
||||
// definisco i vettori ordinati degli Offset e dei Link
|
||||
ICRVCOMPOPOVECTOR vCrvOffs ;
|
||||
ICURVEPOVECTOR vCrvLink ;
|
||||
if ( ! CalcConformalOffsAndLinks( vvCrvOffs, pSfrChunk, ( ! PockParams.bToolInRegion ? pSfrPock : pSfrToRemove),
|
||||
if ( ! CalcConformalOffsAndLinks( vvCrvOffs, pSfrChunk, ( ! PockParams.bSpecialRegion ? pSfrPock : pSfrToRemove),
|
||||
PockParams, vCrvOffs, vCrvLink)) {
|
||||
if ( ! GetOrigChunkForConformal( pSfrChunk, pSfrToRemove, setIndChunkSpiralIn))
|
||||
return false ;
|
||||
@@ -10369,7 +10404,7 @@ CalcPocketing( const ISurfFlatRegion* pSfr, double dRad, double dRadOffs, double
|
||||
return false ;
|
||||
// controllo se la superficie corrente presenta lati aperti da considerare come chiusi
|
||||
if ( ! myParams.bAllOpen && ! myParams.bAllClosed)
|
||||
myParams.bToolInRegion = IsToolInRegion( pSfr, myParams.nType) ;
|
||||
myParams.bSpecialRegion = IsSpecialRegion( pSfr, myParams.nType) ;
|
||||
|
||||
// Se richiesti contorni tengo una copia della supericie attuale ( le funzioni sotto potrebbero rimuoverne dei Chunks)
|
||||
PtrOwner<ISurfFlatRegion> pSfrContour( nullptr) ;
|
||||
@@ -10419,6 +10454,12 @@ CalcPocketing( const ISurfFlatRegion* pSfr, double dRad, double dRadOffs, double
|
||||
if ( IsNull( pSfrLoc) || ! pSfrLoc->IsValid() || ! pSfrLoc->ToLoc( myParams.frLocXY))
|
||||
return false ;
|
||||
|
||||
// Se regione Speciale, considero i lati come tutti chiusi (se necessario)
|
||||
if ( myParams.bSpecialRegion) {
|
||||
if ( nType == POCKET_ZIGZAG || nType == POCKET_ONEWAY || nType == POCKET_SPIRALIN || nType == POCKET_SPIRALOUT)
|
||||
SetAllEdgesAsClose( pSfrAdjLoc) ;
|
||||
}
|
||||
|
||||
// ------------ calcolo delle curve elementari della superficie -------------------
|
||||
ICRVCOMPOPOVECTOR vCrvCompoPock ;
|
||||
switch ( nType) {
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user