Compare commits
27 Commits
5AxTrimming
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 8198d6667b | |||
| 54ce972fa1 | |||
| 67cce96f4a | |||
| ab5f4a7cc4 | |||
| a49bf49157 | |||
| 5ed415ca4b | |||
| a997be46ff | |||
| e8b547b66c | |||
| f597c5769b | |||
| 3d848fbf4e | |||
| cbb15bf69c | |||
| 2a687d76b7 | |||
| e55d481ab7 | |||
| dceb899adb | |||
| b877fe54b2 | |||
| 5578036bcd | |||
| 2338870692 | |||
| 1769c76bfe | |||
| 0787d66b72 | |||
| 443f04116f | |||
| 5196ffe33e | |||
| a4758aad6e | |||
| 72c71b817e | |||
| ad8a69b7e5 | |||
| 1395ba2c04 | |||
| 1a4faa645c | |||
| 69d128dbe9 |
Binary file not shown.
@@ -21,6 +21,7 @@ const double MIN_SAFEDIST = 5.0 ;
|
|||||||
|
|
||||||
//----------- Costanti per approssimazioni con polilinee o poliarchi --------
|
//----------- Costanti per approssimazioni con polilinee o poliarchi --------
|
||||||
const double LIN_TOL_STD = 0.1 ;
|
const double LIN_TOL_STD = 0.1 ;
|
||||||
|
const double LIN_TOL_FINE = 0.01 ;
|
||||||
const double LIN_TOL_MID = 0.05 ;
|
const double LIN_TOL_MID = 0.05 ;
|
||||||
const double LIN_TOL_RAW = 0.5 ;
|
const double LIN_TOL_RAW = 0.5 ;
|
||||||
const double ANG_TOL_STD_DEG = 15 ;
|
const double ANG_TOL_STD_DEG = 15 ;
|
||||||
|
|||||||
@@ -1046,8 +1046,12 @@ Machine::ModifyMachineExitPosition( const string& sHead, int nExit, const Point3
|
|||||||
if ( pExit == nullptr)
|
if ( pExit == nullptr)
|
||||||
return false ;
|
return false ;
|
||||||
// eseguo la modifica
|
// eseguo la modifica
|
||||||
|
Point3d ptOrigPos = pExit->GetPos() ;
|
||||||
if ( ! pExit->Modify( ptPos, m_dExitMaxAdjust))
|
if ( ! pExit->Modify( ptPos, m_dExitMaxAdjust))
|
||||||
return false ;
|
return false ;
|
||||||
|
// ripeto modifica su frame speciale "_T" + N
|
||||||
|
int nSpecFrId = m_pGeomDB->GetFirstNameInGroup( nHeadId, "_T" + ToString( nExit)) ;
|
||||||
|
m_pGeomDB->Translate( nSpecFrId, ptPos - ptOrigPos) ;
|
||||||
// eventuale aggiornamento variabile lua EMC.EXITPOS con la nuova posizione
|
// eventuale aggiornamento variabile lua EMC.EXITPOS con la nuova posizione
|
||||||
LuaSetGlobVar( "EMC.EXITPOS", ptPos) ;
|
LuaSetGlobVar( "EMC.EXITPOS", ptPos) ;
|
||||||
return true ;
|
return true ;
|
||||||
|
|||||||
+74
-175
@@ -22,7 +22,9 @@
|
|||||||
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
||||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||||
|
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||||
#include "/EgtDev/Include/EGkIntersLineCylinder.h"
|
#include "/EgtDev/Include/EGkIntersLineCylinder.h"
|
||||||
|
#include "/EgtDev/Include/EGkOffsetCurve3d.h"
|
||||||
#include "/EgtDev/Include/EGkGeomDB.h"
|
#include "/EgtDev/Include/EGkGeomDB.h"
|
||||||
#include "/EgtDev/Include/EGkLuaAux.h"
|
#include "/EgtDev/Include/EGkLuaAux.h"
|
||||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||||
@@ -33,6 +35,9 @@
|
|||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
|
|
||||||
|
#define COLOR5AX 0
|
||||||
|
#define DRAWCYL 0
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
int
|
int
|
||||||
Machine::LuaEmtAddRapidStart( lua_State* L)
|
Machine::LuaEmtAddRapidStart( lua_State* L)
|
||||||
@@ -598,36 +603,6 @@ Machine::LuaEmtGetBackAuxDir( lua_State* L)
|
|||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Cyl {
|
|
||||||
Cyl( void): frCyl( GLOB_FRM), dH( 0.), dRad( 0.) {;} ;
|
|
||||||
Cyl( const Frame3d& _frCyl, double _dH, double _dRad, double _dLinTol) :
|
|
||||||
frCyl( _frCyl), dH( _dH), dRad( _dRad) { ;}
|
|
||||||
Cyl( const Point3d& _ptBase, const Vector3d& vtZ, double _dH, double _dRad, double _dLinTol) :
|
|
||||||
dH( _dH), dRad( _dRad){
|
|
||||||
frCyl.Set( _ptBase, vtZ); }
|
|
||||||
public :
|
|
||||||
Frame3d frCyl ;
|
|
||||||
public:
|
|
||||||
double dH ;
|
|
||||||
double dRad ;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef vector<Cyl> OFFSETCYLVECT ;
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
bool
|
|
||||||
IsPointInsideCylinder( const Point3d& ptTest, const Cyl& offCyl)
|
|
||||||
{
|
|
||||||
Point3d ptTestLoc = ptTest ; ptTestLoc.ToLoc( offCyl.frCyl) ;
|
|
||||||
if ( ptTestLoc.z > offCyl.dH || ptTestLoc.z < 0)
|
|
||||||
return false ;
|
|
||||||
double dDist = ptTestLoc.x * ptTestLoc.x + ptTestLoc.y * ptTestLoc.y ;
|
|
||||||
double dRadSq = offCyl.dRad * offCyl.dRad ;
|
|
||||||
if ( dDist > dRadSq)
|
|
||||||
return false ;
|
|
||||||
return true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
int
|
int
|
||||||
Machine::LuaEmtAdjustConcavePartsInPath( lua_State* L)
|
Machine::LuaEmtAdjustConcavePartsInPath( lua_State* L)
|
||||||
@@ -644,159 +619,86 @@ Machine::LuaEmtAdjustConcavePartsInPath( lua_State* L)
|
|||||||
IGeomDB* pGeomDB = m_pMchLua->m_pGeomDB ;
|
IGeomDB* pGeomDB = m_pMchLua->m_pGeomDB ;
|
||||||
int nId = pGeomDB->GetFirstInGroup( nPathId) ;
|
int nId = pGeomDB->GetFirstInGroup( nPathId) ;
|
||||||
int nIdCrvAux = pGeomDB->GetFirstInGroup( nAuxPathId) ;
|
int nIdCrvAux = pGeomDB->GetFirstInGroup( nAuxPathId) ;
|
||||||
const ICurve* pCrvAux = GetCurve( pGeomDB->GetGeoObj(nIdCrvAux)) ;
|
const ICurveComposite* pCrvAux = GetCurveComposite( pGeomDB->GetGeoObj(nIdCrvAux)) ;
|
||||||
const double dLinTol = 5 * EPS_SMALL ;
|
if ( pCrvAux == nullptr)
|
||||||
|
return GDB_ID_NULL ;
|
||||||
|
int nFirstCrvOffset = nId ;
|
||||||
|
OFFSETSEGVEC vOffsetCrvs ;
|
||||||
while ( nId != GDB_ID_NULL) {
|
while ( nId != GDB_ID_NULL) {
|
||||||
if ( pGeomDB->GetGeoType( nId) == CRV_LINE) {
|
if ( pGeomDB->GetGeoType( nId) == CRV_LINE) {
|
||||||
int nFlag = 0 ; pGeomDB->GetInfo( nId, "Flg2", nFlag) ;
|
const ICurve* pCrv = GetCurve( pGeomDB->GetGeoObj( nId)) ;
|
||||||
if ( nFlag == 1) {
|
int nParent = -1 ;
|
||||||
// scorro i prossimi finchè trovo la fine della zona concava
|
int nDerivFrom = - 1 ;
|
||||||
INTINTVECTOR vLines ;
|
pGeomDB->GetInfo( nId, "DerivFrom", nDerivFrom) ;
|
||||||
while ( nFlag == 1 && nId != GDB_ID_NULL) {
|
const IGeoVector3d* pGV = GetGeoVector3d( pGeomDB->GetGeoObj( nDerivFrom)) ;
|
||||||
nId = pGeomDB->GetNext( nId) ;
|
if ( pGV != nullptr) {
|
||||||
if ( nId != GDB_ID_NULL && pGeomDB->GetGeoType( nId) == CRV_LINE) {
|
|
||||||
int nDerivedFromId = GDB_ID_NULL ;
|
|
||||||
if ( pGeomDB->GetInfo( nId, "DerivFrom", nDerivedFromId)) {
|
|
||||||
pGeomDB->GetInfo( nId, "Flg2", nFlag) ;
|
|
||||||
vLines.emplace_back( nId, nDerivedFromId) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
OFFSETCYLVECT vCyl ;
|
|
||||||
// creo un cilindro della dimensione del raggio
|
|
||||||
for ( int i = 0 ; i < ssize( vLines) ; ++i) {
|
|
||||||
|
|
||||||
const IGeoVector3d* pGV = GetGeoVector3d( pGeomDB->GetGeoObj( vLines[i].second)) ;
|
|
||||||
if ( pGV == nullptr)
|
|
||||||
return false ;
|
|
||||||
Point3d ptBase = pGV->GetBase() ;
|
Point3d ptBase = pGV->GetBase() ;
|
||||||
double dPar = 0 ;
|
double dPar = 0 ;
|
||||||
if ( ! pCrvAux->GetParamAtPoint( ptBase, dPar))
|
if ( pCrvAux->GetParamAtPoint( ptBase, dPar))
|
||||||
return false ;
|
nParent = int( round( dPar)) - 1 ;
|
||||||
|
|
||||||
dPar = round( dPar) ;
|
|
||||||
if ( dPar > 0) {
|
|
||||||
Point3d ptStart, ptEnd ;
|
|
||||||
Vector3d vtHeight ;
|
|
||||||
pCrvAux->GetPointD1D2( dPar, ICurve::FROM_MINUS, ptEnd, &vtHeight) ;
|
|
||||||
pCrvAux->GetPointD1D2( dPar - 1, ICurve::FROM_MINUS, ptStart) ;
|
|
||||||
vtHeight = ptEnd - ptStart ;
|
|
||||||
double dHeight = vtHeight.Len() ;
|
|
||||||
// questa altezza dovrebbe coincidere con quella precedentemente calcolata come direzione della linea
|
|
||||||
vtHeight.Normalize() ;
|
|
||||||
vCyl.emplace_back( ptStart, vtHeight, dHeight, dRad, dLinTol) ;
|
|
||||||
}
|
}
|
||||||
|
int nFlagAng = 0 ;
|
||||||
|
pGeomDB->GetInfo( nId, "FlgAng", nFlagAng) ;
|
||||||
|
vOffsetCrvs.emplace_back( pCrv->Clone(), nFlagAng, nParent) ;
|
||||||
}
|
}
|
||||||
|
nId = pGeomDB->GetNext( nId) ;
|
||||||
|
}
|
||||||
|
EDITCRVINFOVEC vEditInfo ;
|
||||||
|
if ( ! CalcAdjustConcavePartsInPath( pCrvAux, vOffsetCrvs, dRad, vEditInfo))
|
||||||
|
return GDB_ID_NULL ;
|
||||||
|
|
||||||
// controllo l'end di ogni linea per verificare se sta nel cilindro definito da uno degli altri tratti
|
// applico le modifiche calcolate
|
||||||
// controllo tutto i punti
|
for ( int i = 0 ; i < ssize( vEditInfo) ; ++i) {
|
||||||
bool bErasedSomePart = false ;
|
if ( vEditInfo[i].nFlag == EditCrvInfo::NOEDIT)
|
||||||
bool bErasedPrev = false ;
|
|
||||||
INTINTVECTOR vInters ;
|
|
||||||
for ( int i = 0 ; i < ssize( vLines) ; ++i) {
|
|
||||||
Point3d ptStart, ptEnd ;
|
|
||||||
const ICurveLine* pCL = GetCurveLine( pGeomDB->GetGeoObj( vLines[i].first)) ;
|
|
||||||
if ( pCL == nullptr)
|
|
||||||
return false ;
|
|
||||||
pCL->GetEndPoint( ptEnd) ;
|
|
||||||
pCL->GetStartPoint( ptStart) ;
|
|
||||||
// se stanno in uno dei cilindri degli altri tratti della zona concava
|
|
||||||
for ( int j = 0 ; j < ssize( vLines) ; ++j) {
|
|
||||||
if ( i == j)
|
|
||||||
continue ;
|
continue ;
|
||||||
bool bToErase = IsPointInsideCylinder( ptEnd, vCyl[j]) ;
|
else if ( vEditInfo[i].nFlag == EditCrvInfo::DEL) {
|
||||||
if ( bErasedPrev && ! bToErase)
|
pGeomDB->Erase( nFirstCrvOffset + i) ;
|
||||||
bToErase = bToErase || IsPointInsideCylinder( ptStart, vCyl[j]) ;
|
|
||||||
if ( bToErase) {
|
|
||||||
bErasedSomePart = true ;
|
|
||||||
bErasedPrev = true ;
|
|
||||||
vInters.emplace_back(vLines[i].first,i) ;
|
|
||||||
vInters.emplace_back(vLines[i+1].first,i+1) ;
|
|
||||||
++i ;
|
|
||||||
break ;
|
|
||||||
}
|
}
|
||||||
|
else if ( vEditInfo[i].nFlag == EditCrvInfo::EDIT) {
|
||||||
|
if ( vEditInfo[i].ptStart.IsValid()) {
|
||||||
|
ICurveLine* pCL = GetCurveLine( pGeomDB->GetGeoObj( nFirstCrvOffset + i)) ;
|
||||||
|
pCL->ModifyStart( vEditInfo[i].ptStart) ;
|
||||||
|
}
|
||||||
|
if ( vEditInfo[i].ptEnd.IsValid()) {
|
||||||
|
ICurveLine* pCL = GetCurveLine( pGeomDB->GetGeoObj( nFirstCrvOffset + i)) ;
|
||||||
|
pCL->ModifyEnd( vEditInfo[i].ptEnd) ;
|
||||||
|
CamData* camData = GetCamData( pGeomDB->GetUserObj( nFirstCrvOffset + i)) ;
|
||||||
|
camData->SetEndPoint( vEditInfo[i].ptEnd) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// scorro tutto il vettore delle linee di offset e unisco aggiungendo una linea dove ne ho cancellate
|
||||||
|
for ( int i = 0 ; i < ssize( vEditInfo) - 1 ; ++i) {
|
||||||
|
if ( vEditInfo[i].nFlag == EditCrvInfo::DEL || ( vEditInfo[i].nFlag == EditCrvInfo::NOEDIT))
|
||||||
|
continue ;
|
||||||
|
int nPrevId = nFirstCrvOffset + i ;
|
||||||
|
int c = i + 1 ;
|
||||||
|
// scorro finché trovo la successiva modificata
|
||||||
|
while ( c < ssize( vEditInfo) && ( vEditInfo[c].nFlag == EditCrvInfo::DEL || vEditInfo[c].nFlag == EditCrvInfo::NOEDIT))
|
||||||
|
++c ;
|
||||||
|
if ( vEditInfo[c].nFlag != EditCrvInfo::EDIT)
|
||||||
|
return GDB_ID_NULL ;
|
||||||
|
int nNextId = nFirstCrvOffset + c ;
|
||||||
|
Point3d ptEndCurr, ptStartNext ;
|
||||||
|
if ( vEditInfo[i].ptEnd.IsValid())
|
||||||
|
ptEndCurr = vEditInfo[i].ptEnd ;
|
||||||
else
|
else
|
||||||
bErasedPrev = false ;
|
vOffsetCrvs[i].pCrv->GetEndPoint( ptEndCurr) ;
|
||||||
}
|
|
||||||
}
|
if ( vEditInfo[c].ptStart.IsValid())
|
||||||
if ( bErasedSomePart) {
|
ptStartNext = vEditInfo[c].ptStart ;
|
||||||
// calcolo le intersezioni effettive del primo e ultimo tratto cancellati con i cilindri che li hanno cancellati
|
else
|
||||||
// controllo che effettivamente tutti i tratti cancellati siano consecutivi
|
vOffsetCrvs[c].pCrv->GetStartPoint( ptStartNext) ;
|
||||||
for ( int i = 1 ; i < ssize( vInters) ; ++i) {
|
|
||||||
if ( vInters[i].first != vInters[i-1].first + 1)
|
if ( ! AreSamePointApprox( ptEndCurr, ptStartNext)) {
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
for ( int i = 0 ; i < ssize( vInters) ; ++i) {
|
|
||||||
// cancello i tratti intermedi
|
|
||||||
if ( i > 0 && i < ssize( vInters) - 1) {
|
|
||||||
pGeomDB->Erase( vInters[i].first) ;
|
|
||||||
continue ;
|
|
||||||
}
|
|
||||||
// per il primo e ultimo controllo le intersezioni con tutti i cilindri
|
|
||||||
ICurveLine* pCL = GetCurveLine( pGeomDB->GetGeoObj( vInters[i].first)) ;
|
|
||||||
Point3d ptStart = pCL->GetStart() ;
|
|
||||||
Vector3d vtStart ; pCL->GetStartDir( vtStart) ;
|
|
||||||
double dLen ; pCL->GetLength( dLen) ;
|
|
||||||
double dUTrim = ( i == 0 ? INFINITO : 0) ;
|
|
||||||
Point3d ptTrim = P_INVALID ;
|
|
||||||
for ( int j = 0 ; j < ssize( vCyl) ; ++j) {
|
|
||||||
if ( vInters[i].second == j)
|
|
||||||
continue ;
|
|
||||||
Point3d ptInt1 = P_INVALID, ptInt2 = P_INVALID ;
|
|
||||||
double dU1, dU2 ;
|
|
||||||
Vector3d vtN1, vtN2 ;
|
|
||||||
if ( IntersLineCyl( ptStart, vtStart * dLen, vCyl[j].frCyl, vCyl[j].dH, vCyl[j].dRad, dU1, ptInt1, vtN1, dU2, ptInt2, vtN2)) {
|
|
||||||
bool bUpdate = ( i == 0 ? dU1 < dUTrim : dU1 > dUTrim) ;
|
|
||||||
bUpdate = bUpdate && ptInt1.IsValid() && dU1 > 0 && dU1 < 1 ;
|
|
||||||
bUpdate = bUpdate && vtN1 * vtStart < 0 ;
|
|
||||||
if ( bUpdate) {
|
|
||||||
dUTrim = dU1 ;
|
|
||||||
ptTrim = ptInt1 ;
|
|
||||||
}
|
|
||||||
bUpdate = ( i == 0 ? dU2 < dUTrim : dU2 > dUTrim) ;
|
|
||||||
bUpdate = bUpdate && ptInt2.IsValid() && dU2 > 0 && dU2 < 1 ;
|
|
||||||
bUpdate = bUpdate && vtN2 * vtStart > 0 ;
|
|
||||||
if ( bUpdate) {
|
|
||||||
dUTrim = dU2 ;
|
|
||||||
ptTrim = ptInt2 ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( ptTrim.IsValid()) {
|
|
||||||
if ( i == 0) {
|
|
||||||
pCL->ModifyEnd( ptTrim) ;
|
|
||||||
double dNewLen ; pCL->GetLength( dNewLen) ;
|
|
||||||
if ( dNewLen < 0.1) {
|
|
||||||
int nPrev = pGeomDB->GetPrev( vInters[0].first) ;
|
|
||||||
pGeomDB->Erase( vInters[0].first) ;
|
|
||||||
vInters[0].first = nPrev ;
|
|
||||||
ICurveLine* pCLPrev = GetCurveLine( pGeomDB->GetGeoObj( nPrev)) ;
|
|
||||||
pCLPrev->ModifyEnd( ptTrim) ;
|
|
||||||
}
|
|
||||||
CamData* camData = GetCamData( pGeomDB->GetUserObj( vInters[0].first)) ;
|
|
||||||
camData->SetEndPoint( ptTrim) ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pCL->ModifyStart( ptTrim) ;
|
|
||||||
double dNewLen ; pCL->GetLength( dNewLen) ;
|
|
||||||
if ( dNewLen < 0.1) {
|
|
||||||
int nNext = pGeomDB->GetNext( vInters[i].first) ;
|
|
||||||
pGeomDB->Erase( vInters[i].first) ;
|
|
||||||
vInters[i].first = nNext ;
|
|
||||||
ICurveLine* pCLNext = GetCurveLine( pGeomDB->GetGeoObj( nNext)) ;
|
|
||||||
pCLNext->ModifyStart( ptTrim) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// giunto questi due punti
|
// giunto questi due punti
|
||||||
ICurveLine* pCLprev = GetCurveLine( pGeomDB->GetGeoObj( vInters[0].first)) ;
|
ICurveLine* pCLprev = GetCurveLine( pGeomDB->GetGeoObj( nPrevId)) ;
|
||||||
Point3d ptIni = pCLprev->GetEnd() ;
|
Point3d ptIni = pCLprev->GetEnd() ;
|
||||||
ICurveLine* pCLnext = GetCurveLine( pGeomDB->GetGeoObj( vInters.back().first)) ;
|
ICurveLine* pCLnext = GetCurveLine( pGeomDB->GetGeoObj( nNextId)) ;
|
||||||
Point3d ptFin = pCLnext->GetStart() ;
|
Point3d ptFin = pCLnext->GetStart() ;
|
||||||
const CamData* camDataPrev = GetCamData( pGeomDB->GetUserObj( vInters[0].first)) ;
|
const CamData* camDataPrev = GetCamData( pGeomDB->GetUserObj( nPrevId)) ;
|
||||||
const CamData* camDataNext = GetCamData( pGeomDB->GetUserObj( vInters.back().first)) ;
|
const CamData* camDataNext = GetCamData( pGeomDB->GetUserObj( nNextId)) ;
|
||||||
Vector3d vtTool = Media( camDataPrev->GetToolDir(), camDataNext->GetToolDir()) ;
|
Vector3d vtTool = Media( camDataPrev->GetToolDir(), camDataNext->GetToolDir()) ;
|
||||||
Vector3d vtCorr = Media( camDataPrev->GetCorrDir(), camDataNext->GetCorrDir()) ;
|
Vector3d vtCorr = Media( camDataPrev->GetCorrDir(), camDataNext->GetCorrDir()) ;
|
||||||
Vector3d vtAux = Media( camDataPrev->GetAuxDir(), camDataNext->GetAuxDir()) ;
|
Vector3d vtAux = Media( camDataPrev->GetAuxDir(), camDataNext->GetAuxDir()) ;
|
||||||
@@ -804,12 +706,9 @@ Machine::LuaEmtAdjustConcavePartsInPath( lua_State* L)
|
|||||||
int nFlag = camDataPrev->GetFlag() ;
|
int nFlag = camDataPrev->GetFlag() ;
|
||||||
int nFlag2 = camDataPrev->GetFlag2() ;
|
int nFlag2 = camDataPrev->GetFlag2() ;
|
||||||
bool bToolShow = camDataPrev->GetToolShow() ;
|
bool bToolShow = camDataPrev->GetToolShow() ;
|
||||||
AddLinearMove( ptIni, ptFin, pGeomDB, nPathId, vtTool, vtCorr, vtAux, dFeed, nFlag, nFlag2, bToolShow, vInters[0].first) ;
|
AddLinearMove( ptIni, ptFin, pGeomDB, nPathId, vtTool, vtCorr, vtAux, dFeed, nFlag, nFlag2, bToolShow, nPrevId) ;
|
||||||
}
|
}
|
||||||
nId = vLines.back().first ;
|
i = c ;
|
||||||
}
|
|
||||||
}
|
|
||||||
nId = m_pMchLua->m_pGeomDB->GetNext( nId) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
|
|||||||
@@ -71,8 +71,7 @@ static const std::string UN_STEPNUMBER = "StepNumber" ;
|
|||||||
static const std::string UN_BITANGANG = "BiTangAng" ;
|
static const std::string UN_BITANGANG = "BiTangAng" ;
|
||||||
static const std::string UN_OPTIMALTYPE = "OptimalType" ;
|
static const std::string UN_OPTIMALTYPE = "OptimalType" ;
|
||||||
static const std::string UN_ANGLETOL = "AngleTol" ;
|
static const std::string UN_ANGLETOL = "AngleTol" ;
|
||||||
static const std::string UN_THETA = "Theta" ;
|
static const std::string UN_TILT_ANGS = "Tilt" ;
|
||||||
static const std::string UN_PHI = "Phi" ;
|
|
||||||
|
|
||||||
// Solo per SurfRoughing
|
// Solo per SurfRoughing
|
||||||
static const std::string UN_PLANEZ = "PlaneZ" ;
|
static const std::string UN_PLANEZ = "PlaneZ" ;
|
||||||
|
|||||||
+12
-14
@@ -3390,7 +3390,7 @@ Operation::AdjustStartEndMovementsStd( bool bVerifyPreviousLink)
|
|||||||
while ( bOk && nClPathId != GDB_ID_NULL) {
|
while ( bOk && nClPathId != GDB_ID_NULL) {
|
||||||
// se richiesta verifica collegamento con lavorazione precedente, sistemo inizio
|
// se richiesta verifica collegamento con lavorazione precedente, sistemo inizio
|
||||||
if ( bVerifyPreviousLink) {
|
if ( bVerifyPreviousLink) {
|
||||||
if ( ! AdjustOneStartEndMovement( nClPathId, nPrevClPathId, pPrevOp, vAxVal, dPrevOffsX, bMaxZ))
|
if ( ! AdjustOneStartEndMovement( nClPathId, nPrevClPathId, pPrevOp, true, vAxVal, dPrevOffsX, bMaxZ))
|
||||||
bOk = false ;
|
bOk = false ;
|
||||||
}
|
}
|
||||||
bMaxZ = false ;
|
bMaxZ = false ;
|
||||||
@@ -3433,7 +3433,7 @@ Operation::MoveHeadFromHomeToMach( bool bCurrMain, const string& sToolName, cons
|
|||||||
|
|
||||||
// sistemo approccio a Zmax
|
// sistemo approccio a Zmax
|
||||||
DBLVECTOR vAxVal ;
|
DBLVECTOR vAxVal ;
|
||||||
if ( ! AdjustOneStartEndMovement( GetFirstFullToolpath( bCurrMain), GDB_ID_NULL, nullptr, vAxVal, 0, true))
|
if ( ! AdjustOneStartEndMovement( GetFirstFullToolpath( bCurrMain), GDB_ID_NULL, nullptr, false, vAxVal, 0, true))
|
||||||
return false ;
|
return false ;
|
||||||
// eseguo collegamento speciale
|
// eseguo collegamento speciale
|
||||||
if ( ! ManageSpecialLink( nullptr, GDB_ID_NULL, false, this, GDB_ID_NULL, bCurrMain, nStartZMax, nOtherLinkType))
|
if ( ! ManageSpecialLink( nullptr, GDB_ID_NULL, false, this, GDB_ID_NULL, bCurrMain, nStartZMax, nOtherLinkType))
|
||||||
@@ -3474,7 +3474,7 @@ Operation::MoveHeadFromMachToMach( Operation* pPrevOpe,
|
|||||||
if ( ! SpecialPrevMachiningOffset( pPrevOpe, dPrevOffsX))
|
if ( ! SpecialPrevMachiningOffset( pPrevOpe, dPrevOffsX))
|
||||||
return false ;
|
return false ;
|
||||||
// sistemo collegamento con lavorazione precedente ( senza passare per Zmax)
|
// sistemo collegamento con lavorazione precedente ( senza passare per Zmax)
|
||||||
if ( ! AdjustOneStartEndMovement( GetFirstFullToolpath( bCurrMain), GDB_ID_NULL, pPrevOpe, vAxVal, dPrevOffsX, false))
|
if ( ! AdjustOneStartEndMovement( GetFirstFullToolpath( bCurrMain), GDB_ID_NULL, pPrevOpe, bPrevMain, vAxVal, dPrevOffsX, false))
|
||||||
return false ;
|
return false ;
|
||||||
// gestione collegamento speciale
|
// gestione collegamento speciale
|
||||||
if ( ! ManageSpecialLink( pPrevOpe, GDB_ID_NULL, bPrevMain, this, GDB_ID_NULL, bCurrMain, nStartZMax, nOtherLinkType))
|
if ( ! ManageSpecialLink( pPrevOpe, GDB_ID_NULL, bPrevMain, this, GDB_ID_NULL, bCurrMain, nStartZMax, nOtherLinkType))
|
||||||
@@ -3696,7 +3696,7 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
|
|||||||
RemoveRise( nPrevCLPathId) ;
|
RemoveRise( nPrevCLPathId) ;
|
||||||
DBLVECTOR vAxVal ;
|
DBLVECTOR vAxVal ;
|
||||||
bOk = bOk && GetClPathFinalAxesValues( nPrevCLPathId, false, vAxVal) ;
|
bOk = bOk && GetClPathFinalAxesValues( nPrevCLPathId, false, vAxVal) ;
|
||||||
bOk = bOk && AdjustOneStartEndMovement( nCLPathId, nPrevCLPathId, nullptr, vAxVal, 0, false) ;
|
bOk = bOk && AdjustOneStartEndMovement( nCLPathId, nPrevCLPathId, nullptr, true, vAxVal, 0, false) ;
|
||||||
bOk = bOk && ManageSpecialLink( this, nPrevCLPathId, true, this, nCLPathId, true, nStartZMax, LINK_NULL) ;
|
bOk = bOk && ManageSpecialLink( this, nPrevCLPathId, true, this, nCLPathId, true, nStartZMax, LINK_NULL) ;
|
||||||
// passo al successivo
|
// passo al successivo
|
||||||
nPrevCLPathId = nCLPathId ;
|
nPrevCLPathId = nCLPathId ;
|
||||||
@@ -3728,13 +3728,13 @@ Operation::ManageDoubleOperNew( Operation* pPrevOpe)
|
|||||||
DBLVECTOR vAxVal ;
|
DBLVECTOR vAxVal ;
|
||||||
// Utensile Main
|
// Utensile Main
|
||||||
bOk = bOk && GetClPathFinalAxesValues( nPrevCLPathId, false, vAxVal) ;
|
bOk = bOk && GetClPathFinalAxesValues( nPrevCLPathId, false, vAxVal) ;
|
||||||
bOk = bOk && AdjustOneStartEndMovement( nCLPathId, nPrevCLPathId, nullptr, vAxVal, 0, false) ;
|
bOk = bOk && AdjustOneStartEndMovement( nCLPathId, nPrevCLPathId, nullptr, true, vAxVal, 0, false) ;
|
||||||
bOk = bOk && ManageSpecialLink( this, nPrevCLPathId, true, this, nCLPathId, true, nStartZMax, LINK_MACH_TO_HOME) ;
|
bOk = bOk && ManageSpecialLink( this, nPrevCLPathId, true, this, nCLPathId, true, nStartZMax, LINK_MACH_TO_HOME) ;
|
||||||
// Utensile Double
|
// Utensile Double
|
||||||
DBLVECTOR vAxDblVal ;
|
DBLVECTOR vAxDblVal ;
|
||||||
bOk = bOk && m_pMchMgr->SetCalcTool( sCurrDblTool, sCurrDblHead, nCurrDblExitNbr) ;
|
bOk = bOk && m_pMchMgr->SetCalcTool( sCurrDblTool, sCurrDblHead, nCurrDblExitNbr) ;
|
||||||
bOk = bOk && GetClPathFinalAxesValues( nPrevDBLPathId, false, vAxDblVal) ;
|
bOk = bOk && GetClPathFinalAxesValues( nPrevDBLPathId, false, vAxDblVal) ;
|
||||||
bOk = bOk && AdjustOneStartEndMovement( nDBLPathId, nPrevDBLPathId, nullptr, vAxDblVal, 0, false) ;
|
bOk = bOk && AdjustOneStartEndMovement( nDBLPathId, nPrevDBLPathId, nullptr, false, vAxDblVal, 0, false) ;
|
||||||
bOk = bOk && ManageSpecialLink( this, nPrevDBLPathId, false, this, nDBLPathId, false, nStartZMax, LINK_MACH_TO_HOME) ;
|
bOk = bOk && ManageSpecialLink( this, nPrevDBLPathId, false, this, nDBLPathId, false, nStartZMax, LINK_MACH_TO_HOME) ;
|
||||||
bOk = bOk && m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr()) ;
|
bOk = bOk && m_pMchMgr->SetCalcTool( GetToolName(), GetHeadName(), GetExitNbr()) ;
|
||||||
// passo al successivo
|
// passo al successivo
|
||||||
@@ -3812,7 +3812,7 @@ Operation::AdjustStartEndMovementsNew( void)
|
|||||||
return false ;
|
return false ;
|
||||||
// sistemo approccio da Zmax
|
// sistemo approccio da Zmax
|
||||||
DBLVECTOR vAxVal ;
|
DBLVECTOR vAxVal ;
|
||||||
if ( ! AdjustOneStartEndMovement( GetFirstFullToolpath(), GDB_ID_NULL, nullptr, vAxVal, 0, true))
|
if ( ! AdjustOneStartEndMovement( GetFirstFullToolpath(), GDB_ID_NULL, nullptr, true, vAxVal, 0, true))
|
||||||
return false ;
|
return false ;
|
||||||
// eseguo collegamento speciale
|
// eseguo collegamento speciale
|
||||||
if ( ! ManageSpecialLink( nullptr, GDB_ID_NULL, true, this, GDB_ID_NULL, true, nStartZMax))
|
if ( ! ManageSpecialLink( nullptr, GDB_ID_NULL, true, this, GDB_ID_NULL, true, nStartZMax))
|
||||||
@@ -3835,7 +3835,7 @@ Operation::AdjustStartEndMovementsNew( void)
|
|||||||
if ( ! SpecialPrevMachiningOffset( pPrevOp, dPrevOffsX))
|
if ( ! SpecialPrevMachiningOffset( pPrevOp, dPrevOffsX))
|
||||||
return false ;
|
return false ;
|
||||||
// sistemo collegamento con lavorazione precedente
|
// sistemo collegamento con lavorazione precedente
|
||||||
if ( ! AdjustOneStartEndMovement( GetFirstFullToolpath(), GDB_ID_NULL, pPrevOp, vAxVal, dPrevOffsX, false))
|
if ( ! AdjustOneStartEndMovement( GetFirstFullToolpath(), GDB_ID_NULL, pPrevOp, true, vAxVal, dPrevOffsX, false))
|
||||||
return false ;
|
return false ;
|
||||||
// gestione collegamento speciale
|
// gestione collegamento speciale
|
||||||
if ( ! ManageSpecialLink( pPrevOp, GDB_ID_NULL, true, this, GDB_ID_NULL, true, nStartZMax))
|
if ( ! ManageSpecialLink( pPrevOp, GDB_ID_NULL, true, this, GDB_ID_NULL, true, nStartZMax))
|
||||||
@@ -3866,7 +3866,7 @@ Operation::AdjustStartEndMovementsNew( void)
|
|||||||
return false ;
|
return false ;
|
||||||
// sistemo approccio da Zmax
|
// sistemo approccio da Zmax
|
||||||
DBLVECTOR vAxVal ;
|
DBLVECTOR vAxVal ;
|
||||||
if ( ! AdjustOneStartEndMovement( GetFirstFullToolpath(), GDB_ID_NULL, nullptr, vAxVal, 0, true))
|
if ( ! AdjustOneStartEndMovement( GetFirstFullToolpath(), GDB_ID_NULL, nullptr, true, vAxVal, 0, true))
|
||||||
return false ;
|
return false ;
|
||||||
// eseguo verifica
|
// eseguo verifica
|
||||||
if ( ! ManageSpecialLink( nullptr, GDB_ID_NULL, true, this, GDB_ID_NULL, true, nStartZMax))
|
if ( ! ManageSpecialLink( nullptr, GDB_ID_NULL, true, this, GDB_ID_NULL, true, nStartZMax))
|
||||||
@@ -3884,7 +3884,7 @@ Operation::AdjustStartEndMovementsNew( void)
|
|||||||
if ( ! GetClPathFinalAxesValues( nPrevClPathId, false, vAxVal))
|
if ( ! GetClPathFinalAxesValues( nPrevClPathId, false, vAxVal))
|
||||||
bOk = false ;
|
bOk = false ;
|
||||||
// sistemo collegamento con precedente
|
// sistemo collegamento con precedente
|
||||||
if ( ! AdjustOneStartEndMovement( nClPathId, nPrevClPathId, nullptr, vAxVal, 0, false))
|
if ( ! AdjustOneStartEndMovement( nClPathId, nPrevClPathId, nullptr, true, vAxVal, 0, false))
|
||||||
bOk = false ;
|
bOk = false ;
|
||||||
// gestione collegamento speciale ( tra due percorsi della stessa lavorazione)
|
// gestione collegamento speciale ( tra due percorsi della stessa lavorazione)
|
||||||
if ( ! ManageSpecialLink( this, nPrevClPathId, true, this, nClPathId, true, nStartZMax))
|
if ( ! ManageSpecialLink( this, nPrevClPathId, true, this, nClPathId, true, nStartZMax))
|
||||||
@@ -3979,7 +3979,7 @@ Operation::ManageSpecialLink( Operation* pPrevOpe, int nPrevClPathId, bool bPrev
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
Operation::AdjustOneStartEndMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp,
|
Operation::AdjustOneStartEndMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, bool bPrevMain,
|
||||||
const DBLVECTOR& vAxPrev, double dPrevOffsX, bool bMaxZ)
|
const DBLVECTOR& vAxPrev, double dPrevOffsX, bool bMaxZ)
|
||||||
{
|
{
|
||||||
// verifico gestore delle lavorazione, DB geometrico e macchina corrente
|
// verifico gestore delle lavorazione, DB geometrico e macchina corrente
|
||||||
@@ -3991,8 +3991,6 @@ Operation::AdjustOneStartEndMovement( int nClPathId, int nPrevClPathId, Operatio
|
|||||||
// dagli Id dei Path verifico se è Main o Double
|
// dagli Id dei Path verifico se è Main o Double
|
||||||
string sCLName ; m_pGeomDB->GetName( m_pGeomDB->GetParentId( nClPathId), sCLName) ;
|
string sCLName ; m_pGeomDB->GetName( m_pGeomDB->GetParentId( nClPathId), sCLName) ;
|
||||||
bool bMain = ( ! EqualNoCase( sCLName, MCH_DBL)) ;
|
bool bMain = ( ! EqualNoCase( sCLName, MCH_DBL)) ;
|
||||||
string sCLPrevName ; m_pGeomDB->GetName( m_pGeomDB->GetParentId( nPrevClPathId), sCLPrevName) ;
|
|
||||||
bool bPrevMain = ( ! EqualNoCase( sCLPrevName, MCH_DBL)) ;
|
|
||||||
// elimino eventuali CLIMB già presenti
|
// elimino eventuali CLIMB già presenti
|
||||||
RemoveClimb( nClPathId, bMain) ;
|
RemoveClimb( nClPathId, bMain) ;
|
||||||
// recupero la prima entità di questo percorso
|
// recupero la prima entità di questo percorso
|
||||||
@@ -5987,7 +5985,7 @@ Operation::SpecialLink( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, int
|
|||||||
string sHeadName = GetHeadName() ;
|
string sHeadName = GetHeadName() ;
|
||||||
int nExitNbr = GetExitNbr() ;
|
int nExitNbr = GetExitNbr() ;
|
||||||
string sTcPos = GetToolTcPos() ;
|
string sTcPos = GetToolTcPos() ;
|
||||||
if ( ( pPrevOpe != nullptr && ! bPrevMain) || ( pNextOpe != nullptr && ! bNextMain)) {
|
if ( ( pPrevOpe != nullptr && pNextOpe == nullptr && ! bPrevMain) || ( pNextOpe != nullptr && ! bNextMain)) {
|
||||||
if ( ! GetDoubleToolData( sToolName, sTcPos, sHeadName, nExitNbr))
|
if ( ! GetDoubleToolData( sToolName, sTcPos, sHeadName, nExitNbr))
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -238,7 +238,8 @@ class Operation : public IUserObj
|
|||||||
bool OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd,
|
bool OneMoveTestCollisionAvoid( const STRVECTOR& vAxName, const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd,
|
||||||
Machine* pMch, const INTVECTOR& vRawId, const INTVECTOR& vFxtId) const ;
|
Machine* pMch, const INTVECTOR& vRawId, const INTVECTOR& vFxtId) const ;
|
||||||
bool AdjustStartEndMovementsStd( bool bVerifyPreviousLink) ;
|
bool AdjustStartEndMovementsStd( bool bVerifyPreviousLink) ;
|
||||||
bool AdjustOneStartEndMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOpe, const DBLVECTOR& vAxPrev, double dPrevOffsX, bool bMaxZ) ;
|
bool AdjustOneStartEndMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOpe, bool bPreMain, const DBLVECTOR& vAxPrev,
|
||||||
|
double dPrevOffsX, bool bMaxZ) ;
|
||||||
bool AdjustStartEndMovementsNew( void) ;
|
bool AdjustStartEndMovementsNew( void) ;
|
||||||
bool MoveHeadFromHomeToMach( bool bMain, const std::string& sToolName, const std::string& sHeadName, int nExitNbr, int nStartZMax,
|
bool MoveHeadFromHomeToMach( bool bMain, const std::string& sToolName, const std::string& sHeadName, int nExitNbr, int nStartZMax,
|
||||||
int nOtherLinkType) ;
|
int nOtherLinkType) ;
|
||||||
|
|||||||
+179
-54
@@ -116,6 +116,7 @@ static double FEED_MAX_COEFF = 1000. ;
|
|||||||
// 2457 = "Warning in PocketingNT : machining step (xxx) bigger than MaxMaterial (yyy)"
|
// 2457 = "Warning in PocketingNT : machining step (xxx) bigger than MaxMaterial (yyy)"
|
||||||
// 2458 = "Warning in PocketingNT : machining depth (xxx) bigger than MaxMaterial (yyy)"
|
// 2458 = "Warning in PocketingNT : machining depth (xxx) bigger than MaxMaterial (yyy)"
|
||||||
// 2459 = "Warning in PocketingNT : No compensation in tool, so no compensation in machine"
|
// 2459 = "Warning in PocketingNT : No compensation in tool, so no compensation in machine"
|
||||||
|
// 2460 = "Warning in PocketingNT : Machining toolpath empty"
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Debug
|
// Debug
|
||||||
@@ -314,6 +315,7 @@ PocketingNT::PocketingNT( void)
|
|||||||
m_bAggrBottom = false ;
|
m_bAggrBottom = false ;
|
||||||
m_bOpenOutRaw = false ;
|
m_bOpenOutRaw = false ;
|
||||||
m_dOpenMinSafe = 0 ;
|
m_dOpenMinSafe = 0 ;
|
||||||
|
m_dOpen = -1. ;
|
||||||
m_bRunning = false ;
|
m_bRunning = false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -705,6 +707,14 @@ PocketingNT::MyApply( bool bRecalc, bool bPostApply)
|
|||||||
// se modificata geometria, necessario ricalcolo
|
// se modificata geometria, necessario ricalcolo
|
||||||
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
|
if ( ( m_nStatus & MCH_ST_GEO_MODIF) != 0)
|
||||||
bRecalc = true ;
|
bRecalc = true ;
|
||||||
|
// se modificato flag per lati aperti, forzo il ricalcolo
|
||||||
|
double dOpenOld = m_dOpen ;
|
||||||
|
double dOpen = -1 ;
|
||||||
|
GetValInNotes( m_Params.m_sUserNotes, UN_OPEN, dOpen) ;
|
||||||
|
if ( abs( dOpenOld - dOpen) > 10. * EPS_SMALL) {
|
||||||
|
m_dOpen = dOpen ;
|
||||||
|
bRecalc = true ;
|
||||||
|
}
|
||||||
|
|
||||||
// verifico se necessario continuare nell'aggiornamento
|
// verifico se necessario continuare nell'aggiornamento
|
||||||
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
if ( ! bRecalc && ( m_nStatus == MCH_ST_OK || m_nStatus == MCH_ST_NO_POSTAPPL)) {
|
||||||
@@ -1331,7 +1341,7 @@ PocketingNT::AdjustCurvesByStmTopology( const ISurfTriMesh* pSurf, const Frame3d
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// le isole sono considerate estese fino al grezzo; creo dei solidi di estrusione per le isole chiuse
|
// le isole sono considerate estese fino al grezzo; creo dei solidi di estrusione per le isole chiuse
|
||||||
if ( int( vCrvCompo.size() > 1)) {
|
if ( ssize( vCrvCompo) > 1) {
|
||||||
Vector3d vtN ; lstPC.back()->GetExtrusion( vtN) ;
|
Vector3d vtN ; lstPC.back()->GetExtrusion( vtN) ;
|
||||||
const double EXTR_LEN = 1000. ;
|
const double EXTR_LEN = 1000. ;
|
||||||
SurfFlatRegionByContours SfrByC ;
|
SurfFlatRegionByContours SfrByC ;
|
||||||
@@ -1408,9 +1418,9 @@ PocketingNT::AdjustCurvesByStmTopology( const ISurfTriMesh* pSurf, const Frame3d
|
|||||||
if ( ! plProj.Set( ptC, vtN))
|
if ( ! plProj.Set( ptC, vtN))
|
||||||
return false ;
|
return false ;
|
||||||
POLYLINEVECTOR vPLVol, vPLRaw ;
|
POLYLINEVECTOR vPLVol, vPLRaw ;
|
||||||
if ( ! pStmVol->GetSilhouette( plProj, 20 * EPS_SMALL, vPLVol))
|
if ( ! pStmVol->GetSilhouette( plProj, 20 * EPS_SMALL, vPLVol, false, EPS_SMALL))
|
||||||
return false ;
|
return false ;
|
||||||
if ( ! pStmRawCl->GetSilhouette( plProj, 20 * EPS_SMALL, vPLRaw))
|
if ( ! pStmRawCl->GetSilhouette( plProj, 20 * EPS_SMALL, vPLRaw, false, EPS_SMALL))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
#if DEBUG_STM_TOPOLOGY
|
#if DEBUG_STM_TOPOLOGY
|
||||||
@@ -2327,7 +2337,7 @@ PocketingNT::GetSfrRawProjection( const ISurfTriMesh* pStmRaw, const ISurfFlatRe
|
|||||||
POLYLINEVECTOR vPL ;
|
POLYLINEVECTOR vPL ;
|
||||||
if ( bSimpleSil) {
|
if ( bSimpleSil) {
|
||||||
// calcolo la Silhouette base mediante proiezione dei triangoli
|
// calcolo la Silhouette base mediante proiezione dei triangoli
|
||||||
bSimpleSil = ( pStmRaw->GetSilhouette( plProj, EPS_SMALL, vPL)) ;
|
bSimpleSil = ( pStmRaw->GetSilhouette( plProj, EPS_SMALL, vPL, false, EPS_SMALL)) ;
|
||||||
}
|
}
|
||||||
if ( ! bSimpleSil) {
|
if ( ! bSimpleSil) {
|
||||||
// calcolo la Silhouette mediante CAv
|
// calcolo la Silhouette mediante CAv
|
||||||
@@ -3027,12 +3037,52 @@ PocketingNT::CalcLimitRegion( const ISurfFlatRegion* pSfrPock, const ISurfFlatRe
|
|||||||
if ( pSfrLimit == nullptr || ! pSfrLimit->IsValid())
|
if ( pSfrLimit == nullptr || ! pSfrLimit->IsValid())
|
||||||
return false ;
|
return false ;
|
||||||
// piccolo Offset di correzione
|
// piccolo Offset di correzione
|
||||||
PtrOwner<ISurfFlatRegion> pSfrOffs( pSfrPock->CreateOffsetSurf( 10 * EPS_SMALL, ICurve::OFF_FILLET)) ;
|
PtrOwner<ISurfFlatRegion> pSfrOffs( pSfrPock->CreateOffsetSurf( 10. * EPS_SMALL, ICurve::OFF_FILLET)) ;
|
||||||
if ( IsNull( pSfrOffs) || ! pSfrOffs->IsValid())
|
if ( IsNull( pSfrOffs) || ! pSfrOffs->IsValid())
|
||||||
return false ;
|
return false ;
|
||||||
// sottrazione
|
// sottrazione
|
||||||
pSfrLimit->Subtract( *pSfrOffs) ;
|
pSfrLimit->Subtract( *pSfrOffs) ;
|
||||||
|
|
||||||
|
// se la superficie corrente ha delle isole aperte interne al grezzo, la prevalenza va sulle isole aperte
|
||||||
|
// [NB. Queste isole potrebbero essere definite sul bordo del grezzo, seza che vengano riconosciute come lati aperti interni al grezzo,
|
||||||
|
// per estrerema sicurezza semplifico la regione Limite]
|
||||||
|
if ( pSfrLimit->IsValid()) {
|
||||||
|
for ( int nC = 0 ; nC < pSfrPock->GetChunkCount() && pSfrLimit->IsValid() ; ++ nC) {
|
||||||
|
int nLoopCnt = ( pSfrPock->GetLoopCount( nC)) ;
|
||||||
|
if ( nLoopCnt > 1) {
|
||||||
|
// raggio di riferimento per offset
|
||||||
|
double dOutEdge = 0.5 * m_TParams.m_dDiam ;
|
||||||
|
if ( m_Params.m_nSubType == POCKET_SPIRALIN || m_Params.m_nSubType == POCKET_ZIGZAG)
|
||||||
|
dOutEdge = max( dOutEdge, m_TParams.m_dDiam - m_Params.m_dSideStep) ;
|
||||||
|
double dExtension = dOutEdge + GetOffsR() + 100. * EPS_SMALL ;
|
||||||
|
for ( int nL = 1 ; nL < nLoopCnt && pSfrLimit->IsValid() ; ++ nL) {
|
||||||
|
PtrOwner<ICurveComposite> pInternalLoop( ConvertCurveToComposite( pSfrPock->GetLoop( nC, nL))) ;
|
||||||
|
if ( IsNull( pInternalLoop) || ! pInternalLoop->IsValid())
|
||||||
|
return false ;
|
||||||
|
ICRVCOMPOPOVECTOR vCrv ;
|
||||||
|
GetHomogeneousParts( pInternalLoop, vCrv) ;
|
||||||
|
if ( ssize( vCrv) == 1 && vCrv[0]->GetTempProp() == TEMP_PROP_OPEN_EDGE) {
|
||||||
|
// considero la curva come chiusa, le isole non sono definite
|
||||||
|
OffsetCurve OffsCrv ;
|
||||||
|
OffsCrv.Make( pInternalLoop, dExtension, ICurve::OFF_FILLET) ;
|
||||||
|
PtrOwner<ICurve> pCrvOffs( OffsCrv.GetLongerCurve()) ;
|
||||||
|
if ( ! IsNull( pCrvOffs) && pCrvOffs->IsValid()) {
|
||||||
|
SurfFlatRegionByContours SfrByC ;
|
||||||
|
SfrByC.AddCurve( Release( pCrvOffs)) ;
|
||||||
|
SfrByC.AddCurve( CloneCurveComposite( pInternalLoop)) ;
|
||||||
|
PtrOwner<ISurfFlatRegion> pSfrSub( SfrByC.GetSurf()) ;
|
||||||
|
if ( ! IsNull( pSfrSub) && pSfrSub->IsValid()) {
|
||||||
|
if ( AreOppositeVectorApprox( pSfrSub->GetNormVersor(), pSfrLimit->GetNormVersor()))
|
||||||
|
pSfrSub->Invert() ;
|
||||||
|
pSfrLimit->Subtract( *pSfrSub) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// se richiesto non controllo dei lati aperti
|
// se richiesto non controllo dei lati aperti
|
||||||
if ( m_bOpenOutRaw && pSfrLimit->IsValid()) {
|
if ( m_bOpenOutRaw && pSfrLimit->IsValid()) {
|
||||||
double dExtension = 4. * m_TParams.m_dDiam + max( 0., m_dOpenMinSafe) + EPS_SMALL ;
|
double dExtension = 4. * m_TParams.m_dDiam + max( 0., m_dOpenMinSafe) + EPS_SMALL ;
|
||||||
@@ -3596,8 +3646,8 @@ PocketingNT::CheckMaxDepth( const ISurfFlatRegion* pSfr, double dDepth, const Ve
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
PocketingNT::CalcGeoExtSurfFr( const ISurfFlatRegion* pSfrPock, const Vector3d& vtTool, const double dDepth, const ISurfTriMesh* pStmRaw,
|
PocketingNT::CalcGeoExtSurfFr( const ISurfFlatRegion* pSfrPock, const Vector3d& vtTool, double dDepth, const ISurfTriMesh* pStmRaw,
|
||||||
const SELVECTOR& vGeoSel, ISURFFRPOVECTOR& vSfrGeoExt)
|
const SELVECTOR& vGeoSel, ISURFFRPOVECTOR& vSfrGeoLimit)
|
||||||
{
|
{
|
||||||
// verifica valdità dei parametri
|
// verifica valdità dei parametri
|
||||||
if ( pSfrPock == nullptr || ! pSfrPock->IsValid() || pStmRaw == nullptr || ! pStmRaw->IsValid())
|
if ( pSfrPock == nullptr || ! pSfrPock->IsValid() || pStmRaw == nullptr || ! pStmRaw->IsValid())
|
||||||
@@ -3646,14 +3696,13 @@ PocketingNT::CalcGeoExtSurfFr( const ISurfFlatRegion* pSfrPock, const Vector3d&
|
|||||||
if ( IsNull( pSfrOrigFace) || ! pSfrOrigFace->IsValid())
|
if ( IsNull( pSfrOrigFace) || ! pSfrOrigFace->IsValid())
|
||||||
return false ;
|
return false ;
|
||||||
#if DEBUG_SFR_GEO_EXT
|
#if DEBUG_SFR_GEO_EXT
|
||||||
int nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pSfrOrigFace->Clone()) ;
|
int nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pStm->Clone()) ;
|
||||||
m_pGeomDB->SetMaterial( nId, Color( 0., 0., 1.)) ;
|
m_pGeomDB->SetMaterial( nId, Color( 0., .5, 0., 1.)) ;
|
||||||
nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pStmRaw->Clone()) ;
|
|
||||||
m_pGeomDB->SetMaterial( nId, Color( 255, 165, 0, 50)) ;
|
|
||||||
nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pSfrOrigFace->Clone()) ;
|
nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pSfrOrigFace->Clone()) ;
|
||||||
m_pGeomDB->SetMaterial( nId, Color( 0., 1., 0., .5)) ;
|
m_pGeomDB->SetMaterial( nId, Color( 0., 1., 0., 1.)) ;
|
||||||
#endif
|
#endif
|
||||||
// recupero tutte le facce adiacenti alla faccia selezionata
|
// -------------- analisi facce adiacenti, quindi perpendicolari alla faccia di svuotatura ----------------
|
||||||
|
// recupero tutte le facce adiacenti e che formano lati chiusi con la faccia selezionata
|
||||||
INTSET setAdjFace ;
|
INTSET setAdjFace ;
|
||||||
for ( int i = 0 ; i < ssize( vPL) ; ++ i) {
|
for ( int i = 0 ; i < ssize( vPL) ; ++ i) {
|
||||||
double dPar ;
|
double dPar ;
|
||||||
@@ -3675,31 +3724,38 @@ PocketingNT::CalcGeoExtSurfFr( const ISurfFlatRegion* pSfrPock, const Vector3d&
|
|||||||
bFound = vPL[i].GetNextU( dPar, true) ;
|
bFound = vPL[i].GetNextU( dPar, true) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// scorro tutte le facce ad eccezione di quella da lavorare
|
// da queste definisco una regione da non rovinare
|
||||||
for ( auto Iter = setAdjFace.begin() ; Iter != setAdjFace.end() ; ++ Iter) {
|
for ( INTSET::iterator Iter = setAdjFace.begin() ; Iter != setAdjFace.end() ; ++ Iter) {
|
||||||
int nAdjFace = *Iter ;
|
int nAdjFace = *Iter ;
|
||||||
// recupero il bordo della faccia
|
// recupero il bordo della faccia
|
||||||
POLYLINEVECTOR vPL ;
|
POLYLINEVECTOR vPL ; pStm->GetFacetLoops( nAdjFace, vPL) ;
|
||||||
pStm->GetFacetLoops( nAdjFace, vPL) ;
|
// definisco una geometria di estrusione in direzione opposta alla normale corrente (non considero isole)
|
||||||
// definisco una geometria di estrusione in direzione opposta alla normale corrente
|
|
||||||
// NB. Considero solo il Loop esterno per le pareti verticali, non mi aspetto isole...
|
|
||||||
Vector3d vtFaceN ; pStm->GetFacetNormal( nAdjFace, vtFaceN) ;
|
|
||||||
if ( ! vPL.empty()) {
|
if ( ! vPL.empty()) {
|
||||||
PtrOwner<ISurfTriMesh> pStm( CreateSurfTriMesh()) ;
|
// recupero la composita associata alla PolyLine
|
||||||
if ( ! IsNull( pStm) && pStm->AdjustTopology() && pStm->CreateByExtrusion( vPL[0], 4. * m_TParams.m_dDiam * ( - vtFaceN))) {
|
PtrOwner<ICurveComposite> pCompoFaceLoop( CreateCurveComposite()) ;
|
||||||
|
pCompoFaceLoop->FromPolyLine( vPL[0]) ;
|
||||||
|
#if DEBUG_SFR_GEO_EXT
|
||||||
|
nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pCompoFaceLoop->Clone()) ;
|
||||||
|
m_pGeomDB->SetMaterial( nId, Color( 0., 0., 1., 1.)) ;
|
||||||
|
#endif
|
||||||
|
Vector3d vtFaceN ; pStm->GetFacetNormal( nAdjFace, vtFaceN) ;
|
||||||
|
PtrOwner<ISurfTriMesh> pStmExtr( GetSurfTriMeshByExtrusion( pCompoFaceLoop, 4. * m_TParams.m_dDiam * ( - vtFaceN), true)) ;
|
||||||
|
if ( ! IsNull( pStmExtr)) {
|
||||||
|
#if DEBUG_SFR_GEO_EXT
|
||||||
|
nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pStmExtr->Clone()) ;
|
||||||
|
m_pGeomDB->SetMaterial( nId, Color( 0., 0., 1., 1.)) ;
|
||||||
|
#endif
|
||||||
POLYLINEVECTOR vPLSil ;
|
POLYLINEVECTOR vPLSil ;
|
||||||
if ( pStm->GetSilhouette( plFace, EPS_SMALL, vPLSil) && ! vPLSil.empty()) {
|
if ( pStmExtr->GetSilhouette( plFace, 10. * EPS_SMALL, vPLSil, false, EPS_SMALL) && ! vPLSil.empty()) {
|
||||||
PtrOwner<ICurveComposite> pCompoLoop( CreateCurveComposite()) ;
|
PtrOwner<ICurveComposite> pCompoLoop( CreateCurveComposite()) ;
|
||||||
if ( ! IsNull( pCompoLoop) && pCompoLoop->FromPolyLine( vPLSil[0])) {
|
if ( ! IsNull( pCompoLoop) && pCompoLoop->FromPolyLine( vPLSil[0])) {
|
||||||
PtrOwner<ISurfFlatRegion> pSfrCnt( CreateSurfFlatRegion()) ;
|
PtrOwner<ISurfFlatRegion> pSfrCnt( CreateSurfFlatRegion()) ;
|
||||||
pSfrCnt->AddExtLoop( Release( pCompoLoop)) ;
|
pSfrCnt->AddExtLoop( Release( pCompoLoop)) ;
|
||||||
if ( ! AreSameVectorApprox( pSfrCnt->GetNormVersor(), vtN))
|
if ( ! AreSameVectorApprox( pSfrCnt->GetNormVersor(), vtN))
|
||||||
pSfrCnt->Invert() ;
|
pSfrCnt->Invert() ;
|
||||||
// rimuovo tutto ciò che non è interno alla regione originale selezionata
|
vSfrGeoLimit.emplace_back( Release( pSfrCnt)) ;
|
||||||
pSfrCnt->Subtract( *pSfrOrigFace) ;
|
|
||||||
vSfrGeoExt.emplace_back( Release( pSfrCnt)) ;
|
|
||||||
#if DEBUG_SFR_GEO_EXT
|
#if DEBUG_SFR_GEO_EXT
|
||||||
int nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, vSfrGeoExt.back()->Clone()) ;
|
nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, vSfrGeoLimit.back()->Clone()) ;
|
||||||
m_pGeomDB->SetMaterial( nId, Color( 1., 0., 0., .5)) ;
|
m_pGeomDB->SetMaterial( nId, Color( 1., 0., 0., .5)) ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -3707,25 +3763,67 @@ PocketingNT::CalcGeoExtSurfFr( const ISurfFlatRegion* pSfrPock, const Vector3d&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// se ho una regione valida
|
|
||||||
if ( ! vSfrGeoExt.empty()) {
|
// ------------- recupero eventuale Silhouette della TriMesh corrente al di sopra della faccia selezionata --------------
|
||||||
for ( int i = 0 ; i < ssize( vSfrGeoExt) ; ++ i) {
|
const double TRIA_NUM = 500 ;
|
||||||
|
int nTriaCnt = pStm->GetTriangleCount() ;
|
||||||
|
bool bSimpleSil = ( nTriaCnt <= TRIA_NUM) ;
|
||||||
|
POLYLINEVECTOR vPLSil ;
|
||||||
|
if ( bSimpleSil) {
|
||||||
|
Plane3d plSil = plFace ;
|
||||||
|
plSil.Translate( 2. * EPS_SMALL * vtN) ;
|
||||||
|
bSimpleSil = ( pStm->GetSilhouette( plSil, 10. * EPS_SMALL, vPLSil, false, EPS_SMALL)) ;
|
||||||
|
}
|
||||||
|
if ( ! bSimpleSil) {
|
||||||
|
vPLSil.clear() ;
|
||||||
|
Frame3d frFace ;
|
||||||
|
if ( ! frFace.Set( ptC + 2. * EPS_SMALL * vtN, vtN))
|
||||||
|
return false ;
|
||||||
|
const double SIL_TOL = 1.0 ;
|
||||||
|
PtrOwner<ICAvParSilhouettesSurfTm> pCAvParDangSil( CreateCAvParSilhouettesSurfTm()) ;
|
||||||
|
if ( IsNull( pCAvParDangSil) || ! pCAvParDangSil->SetData( { pStm }, frFace, SIL_TOL))
|
||||||
|
return false ;
|
||||||
|
if ( ! pCAvParDangSil->GetSilhouette( 0., vPLSil))
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
PtrOwner<ISurfFlatRegion> pSfrSil( nullptr) ;
|
||||||
|
if ( ! vPLSil.empty()) {
|
||||||
|
SurfFlatRegionByContours SfrByC ;
|
||||||
|
for ( const PolyLine& PL : vPLSil) {
|
||||||
|
PtrOwner<ICurveComposite> pCompoLoop( CreateCurveComposite()) ;
|
||||||
|
if ( IsNull( pCompoLoop) || ! pCompoLoop->FromPolyLine( PL))
|
||||||
|
return false ;
|
||||||
|
#if DEBUG_SFR_GEO_EXT
|
||||||
|
nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, pCompoLoop->Clone()) ;
|
||||||
|
m_pGeomDB->SetMaterial( nId, ORANGE) ;
|
||||||
|
#endif
|
||||||
|
SfrByC.AddCurve( Release( pCompoLoop)) ;
|
||||||
|
}
|
||||||
|
pSfrSil.Set( SfrByC.GetSurf()) ;
|
||||||
|
if ( ! IsNull( pSfrSil) && pSfrSil->IsValid()) {
|
||||||
|
if ( ! vSfrGeoLimit.emplace_back( ::Release( pSfrSil)))
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// limito queste regioni alla presenza del grezzo
|
||||||
|
for ( int i = 0 ; i < ssize( vSfrGeoLimit) ; ++ i) {
|
||||||
// porto la superficie in globale
|
// porto la superficie in globale
|
||||||
Frame3d frGlob ; m_pGeomDB->GetGlobFrame( Id.nId, frGlob) ;
|
Frame3d frGlob ; m_pGeomDB->GetGlobFrame( Id.nId, frGlob) ;
|
||||||
vSfrGeoExt[i]->ToGlob( frGlob) ;
|
vSfrGeoLimit[i]->ToGlob( frGlob) ;
|
||||||
// la limito al grezzo
|
// la limito al grezzo
|
||||||
if ( ! IsNull( pSfrRaw) && pSfrRaw->IsValid()) {
|
if ( ! IsNull( pSfrRaw) && pSfrRaw->IsValid()) {
|
||||||
vSfrGeoExt[i]->Intersect( *pSfrRaw) ;
|
vSfrGeoLimit[i]->Intersect( *pSfrRaw) ;
|
||||||
if ( vSfrGeoExt[i]->IsValid()) {
|
if ( vSfrGeoLimit[i]->IsValid()) {
|
||||||
// Assegno le proprietà di lato chiuso ad ogni parte trovata
|
// Assegno le proprietà di lato chiuso ad ogni parte trovata
|
||||||
for ( int nC = 0 ; nC < vSfrGeoExt[i]->GetChunkCount() ; ++ nC) {
|
for ( int nC = 0 ; nC < vSfrGeoLimit[i]->GetChunkCount() ; ++ nC) {
|
||||||
for ( int nL = 0 ; nL < vSfrGeoExt[i]->GetLoopCount( nC) ; ++ nL) {
|
for ( int nL = 0 ; nL < vSfrGeoLimit[i]->GetLoopCount( nC) ; ++ nL) {
|
||||||
for ( int nU = 0 ; nU < vSfrGeoExt[i]->GetLoopCurveCount( nC, nL) ; ++ nU)
|
for ( int nU = 0 ; nU < vSfrGeoLimit[i]->GetLoopCurveCount( nC, nL) ; ++ nU)
|
||||||
vSfrGeoExt[i]->SetCurveTempProp( nC, nL, nU, TEMP_PROP_CLOSE_EDGE, 0) ;
|
vSfrGeoLimit[i]->SetCurveTempProp( nC, nL, nU, TEMP_PROP_CLOSE_EDGE, 0) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if DEBUG_SFR_GEO_EXT
|
#if DEBUG_SFR_GEO_EXT
|
||||||
int nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, vSfrGeoExt[i]->Clone()) ;
|
int nId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, GDB_ID_ROOT, vSfrGeoLimit[i]->Clone()) ;
|
||||||
m_pGeomDB->SetMaterial( nId, GRAY) ;
|
m_pGeomDB->SetMaterial( nId, GRAY) ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -3734,7 +3832,6 @@ PocketingNT::CalcGeoExtSurfFr( const ISurfFlatRegion* pSfrPock, const Vector3d&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
@@ -3933,6 +4030,7 @@ PocketingNT::ProcessPath( int nPathId, int nPvId, int nClId)
|
|||||||
CalcGeoExtSurfFr( pSfr, vtTool, 0., pStmRaw, vGeoSel, vSurfFrGeoExt) ;
|
CalcGeoExtSurfFr( pSfr, vtTool, 0., pStmRaw, vGeoSel, vSurfFrGeoExt) ;
|
||||||
for ( int i = 0 ; i < ssize( vSurfFrGeoExt) ; ++ i)
|
for ( int i = 0 ; i < ssize( vSurfFrGeoExt) ; ++ i)
|
||||||
pSfr->Subtract( *vSurfFrGeoExt[i]) ;
|
pSfr->Subtract( *vSurfFrGeoExt[i]) ;
|
||||||
|
|
||||||
if ( ! pSfr->IsValid())
|
if ( ! pSfr->IsValid())
|
||||||
return true ; // nulla da svuotare
|
return true ; // nulla da svuotare
|
||||||
pSfr->Translate( vtTool * ( dDepth + m_TParams.m_dMaxMat)) ;
|
pSfr->Translate( vtTool * ( dDepth + m_TParams.m_dMaxMat)) ;
|
||||||
@@ -4049,6 +4147,7 @@ PocketingNT::ProcessPath( int nPathId, int nPvId, int nClId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// se richiesta lavorazione
|
// se richiesta lavorazione
|
||||||
|
bool bEmptyPocket = false ;
|
||||||
if ( nClId != GDB_ID_NULL) {
|
if ( nClId != GDB_ID_NULL) {
|
||||||
// creo gruppo per geometria di lavorazione del percorso
|
// creo gruppo per geometria di lavorazione del percorso
|
||||||
int nPxId = m_pGeomDB->AddGroup( GDB_ID_NULL, nClId, Frame3d()) ;
|
int nPxId = m_pGeomDB->AddGroup( GDB_ID_NULL, nClId, Frame3d()) ;
|
||||||
@@ -4189,7 +4288,7 @@ PocketingNT::ProcessPath( int nPathId, int nPvId, int nClId)
|
|||||||
// calcolo le lavorazioni
|
// calcolo le lavorazioni
|
||||||
Point3d ptPockStart ; pSfr->GetCentroid( ptPockStart) ;
|
Point3d ptPockStart ; pSfr->GetCentroid( ptPockStart) ;
|
||||||
Point3d ptPockEnd = ptPockStart ;
|
Point3d ptPockEnd = ptPockStart ;
|
||||||
if ( ! AddPocket( vStepInfo, vtTool, dStep, bSplitArcs, ptPockStart, ptPockEnd))
|
if ( ! AddPocket( vStepInfo, vtTool, dStep, bSplitArcs, ptPockStart, ptPockEnd, bEmptyPocket))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// assegno il vettore estrazione al gruppo del percorso
|
// assegno il vettore estrazione al gruppo del percorso
|
||||||
@@ -4216,6 +4315,7 @@ PocketingNT::ProcessPath( int nPathId, int nPvId, int nClId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// incremento numero di svuotature
|
// incremento numero di svuotature
|
||||||
|
if ( ! bEmptyPocket)
|
||||||
++ m_nPockets ;
|
++ m_nPockets ;
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
@@ -4701,11 +4801,12 @@ PocketingNT::CalcRetCurve( PathInfoPO& PathInfo, const StepInfoPO& StepInfo, con
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
PocketingNT::CalcPaths( STEPINFOPOVECTOR& vStepInfo)
|
PocketingNT::CalcPaths( STEPINFOPOVECTOR& vStepInfo, bool& bEmpty)
|
||||||
{
|
{
|
||||||
// se non ho Step, non faccio nulla
|
// se non ho Step, non faccio nulla
|
||||||
if ( vStepInfo.empty())
|
if ( vStepInfo.empty())
|
||||||
return true ;
|
return true ;
|
||||||
|
bEmpty = false ;
|
||||||
|
|
||||||
// definisco il tipo di punto iniziale
|
// definisco il tipo di punto iniziale
|
||||||
enum START_PT { DEFAULT = 0, BY_USER = 1, BY_HEAD = 2, BY_OPEN_GEO = 3, BY_CLOSE_GEO = 4} ;
|
enum START_PT { DEFAULT = 0, BY_USER = 1, BY_HEAD = 2, BY_OPEN_GEO = 3, BY_CLOSE_GEO = 4} ;
|
||||||
@@ -4791,17 +4892,20 @@ PocketingNT::CalcPaths( STEPINFOPOVECTOR& vStepInfo)
|
|||||||
for ( int i = 0 ; i < ssize( vStepInfo) ; ++ i) {
|
for ( int i = 0 ; i < ssize( vStepInfo) ; ++ i) {
|
||||||
// calcolo i percorsi di Pocketing ( o di lucidatura se richiesto)
|
// calcolo i percorsi di Pocketing ( o di lucidatura se richiesto)
|
||||||
ICRVCOMPOPOVECTOR vCrvPaths ;
|
ICRVCOMPOPOVECTOR vCrvPaths ;
|
||||||
if ( ! CalcPocketing( vStepInfo[i].pSfrPock, m_TParams.m_dDiam / 2, GetOffsR(), dSideStep,
|
if ( ! CalcPocketing( vStepInfo[i].pSfrPock, m_TParams.m_dDiam / 2, GetOffsR(), dSideStep, m_Params.m_dSideAngle, m_dOpenMinSafe,
|
||||||
m_Params.m_dSideAngle, m_dOpenMinSafe, m_Params.m_nSubType, true, true, m_Params.m_bInvert,
|
m_Params.m_nSubType, true, true, m_Params.m_bInvert, false, bConventionalMilling, true, m_bOpenOutRaw,
|
||||||
false, bConventionalMilling, true, bAdjustFeed, ptStartRef, vStepInfo[i].pSfrLimit, bAllOffset, dMaxOptSize,
|
bAdjustFeed, ptStartRef, vStepInfo[i].pSfrLimit, bAllOffset, dMaxOptSize, GetLeadInType(), m_Params.m_dLiTang,
|
||||||
GetLeadInType(), m_Params.m_dLiTang, m_Params.m_dLiElev, GetLeadOutType(), m_Params.m_dLoTang,
|
m_Params.m_dLiElev, GetLeadOutType(), m_Params.m_dLoTang, bPolishing, m_Params.m_dEpicyclesRad,
|
||||||
bPolishing, m_Params.m_dEpicyclesRad, m_Params.m_dEpicyclesDist, bToolComp, vCrvPaths)) {
|
m_Params.m_dEpicyclesDist, bToolComp, vCrvPaths)) {
|
||||||
m_pMchMgr->SetLastError( 2442, "Error in PocketingNT : Error in CalcPocketing") ;
|
m_pMchMgr->SetLastError( 2442, "Error in PocketingNT : Error in CalcPocketing") ;
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
// se non ho ottenuto percorsi, errore
|
// se non ho ottenuto percorsi, errore
|
||||||
if ( vCrvPaths.empty())
|
if ( vCrvPaths.empty()) {
|
||||||
return false ;
|
m_pMchMgr->SetWarning( 2460, "Warning in PocketingNT : Machining toolpath empty") ;
|
||||||
|
bEmpty = true ;
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
// sistemo gli archi per massimo angolo al centro
|
// sistemo gli archi per massimo angolo al centro
|
||||||
for ( int j = 0 ; j < ssize( vCrvPaths) ; ++ j)
|
for ( int j = 0 ; j < ssize( vCrvPaths) ; ++ j)
|
||||||
VerifyArcs( vCrvPaths[j]) ;
|
VerifyArcs( vCrvPaths[j]) ;
|
||||||
@@ -5161,6 +5265,8 @@ PocketingNT::CalcDoubleParallelPenultimateStep( int nDouble, int nIdDblS, double
|
|||||||
// recupero l'entità camData corrispondente
|
// recupero l'entità camData corrispondente
|
||||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
|
||||||
if ( pCamData != nullptr) {
|
if ( pCamData != nullptr) {
|
||||||
|
// assegno Flag e recupero Feed
|
||||||
|
pCamData->SetFlag( 405) ;
|
||||||
double dFeed = pCamData->GetFeed() ;
|
double dFeed = pCamData->GetFeed() ;
|
||||||
// verifico se la curva corrente appartiene al piano del LastStep
|
// verifico se la curva corrente appartiene al piano del LastStep
|
||||||
bool bOnPlane = false ;
|
bool bOnPlane = false ;
|
||||||
@@ -5270,11 +5376,13 @@ PocketingNT::CalcDoubleParallelPenultimateStep( int nDouble, int nIdDblS, double
|
|||||||
double dNini = ( ptCurr - ORIG) * vtTool ;
|
double dNini = ( ptCurr - ORIG) * vtTool ;
|
||||||
double dNfin = ( ptStart - ORIG) * vtTool ;
|
double dNfin = ( ptStart - ORIG) * vtTool ;
|
||||||
AdjustCurveSlope( pCrvSafeLink, dNini, dNfin) ;
|
AdjustCurveSlope( pCrvSafeLink, dNini, dNfin) ;
|
||||||
|
SetFlag( 405) ;
|
||||||
AddCurveMove( pCrvSafeLink, bSplitArcs, MCH_CL_PARALLEL_DBL) ;
|
AddCurveMove( pCrvSafeLink, bSplitArcs, MCH_CL_PARALLEL_DBL) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// aggiungo risalita nel vuoto
|
// aggiungo risalita nel vuoto
|
||||||
|
SetFlag( 405) ;
|
||||||
AddLinearMove( ptStart, bSplitArcs, MCH_CL_PARALLEL_DBL) ;
|
AddLinearMove( ptStart, bSplitArcs, MCH_CL_PARALLEL_DBL) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5299,6 +5407,7 @@ PocketingNT::CalcDoubleParallelPenultimateStep( int nDouble, int nIdDblS, double
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
SetFeed( dFeed) ;
|
SetFeed( dFeed) ;
|
||||||
|
SetFlag( 405) ;
|
||||||
// elaborazioni sulla curva corrente
|
// elaborazioni sulla curva corrente
|
||||||
if ( pCurve->GetType() == CRV_LINE) {
|
if ( pCurve->GetType() == CRV_LINE) {
|
||||||
ICurveLine* pLine = GetCurveLine( pCurve) ;
|
ICurveLine* pLine = GetCurveLine( pCurve) ;
|
||||||
@@ -5316,25 +5425,34 @@ PocketingNT::CalcDoubleParallelPenultimateStep( int nDouble, int nIdDblS, double
|
|||||||
GetCurrPos( ptCurr) ;
|
GetCurrPos( ptCurr) ;
|
||||||
double dDepth = ( - ( ptNeatEnd - ptCurr) * vtTool) / 2. ;
|
double dDepth = ( - ( ptNeatEnd - ptCurr) * vtTool) / 2. ;
|
||||||
if ( dDepth > 25. * EPS_SMALL) { // sempre...
|
if ( dDepth > 25. * EPS_SMALL) { // sempre...
|
||||||
|
SetFlag( 405) ;
|
||||||
SetFeed( GetEndFeed()) ; // ho rimosso tutto il materiale
|
SetFeed( GetEndFeed()) ; // ho rimosso tutto il materiale
|
||||||
AddLinearMove( ptCurr - dDepth * vtTool, bSplitArcs, MCH_CL_PARALLEL_DBL) ;
|
AddLinearMove( ptCurr - dDepth * vtTool, bSplitArcs, MCH_CL_PARALLEL_DBL) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SetFlag( 0) ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dStep, bool bSplitArcs,
|
PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dStep, bool bSplitArcs,
|
||||||
Point3d& ptPockStart, Point3d& ptPockEnd)
|
Point3d& ptPockStart, Point3d& ptPockEnd, bool& bEmpty)
|
||||||
{
|
{
|
||||||
// se non ho superfici da svuotare, non faccio nulla
|
// se non ho superfici da svuotare, non faccio nulla
|
||||||
if ( vStepInfo.empty())
|
if ( vStepInfo.empty())
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
// calcolo i percorsi di svuotatura per ogni Step/SubStep
|
// calcolo i percorsi di svuotatura per ogni Step/SubStep
|
||||||
if ( ! CalcPaths( vStepInfo))
|
if ( ! CalcPaths( vStepInfo, bEmpty))
|
||||||
return false ;
|
return false ;
|
||||||
|
// se svuotatura vuota, aggiorno la ProgressBar ed esco
|
||||||
|
if ( bEmpty) {
|
||||||
|
ExeProcessEvents( 100, 0) ;
|
||||||
|
return true ;
|
||||||
|
}
|
||||||
|
|
||||||
#if DEBUG_FEED
|
#if DEBUG_FEED
|
||||||
nGrpDebugFeed = m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, GLOB_FRM) ;
|
nGrpDebugFeed = m_pGeomDB->AddGroup( GDB_ID_NULL, GDB_ID_ROOT, GLOB_FRM) ;
|
||||||
nLayDebugFeed = m_pGeomDB->AddGroup( GDB_ID_NULL, nGrpDebugFeed, GLOB_FRM) ;
|
nLayDebugFeed = m_pGeomDB->AddGroup( GDB_ID_NULL, nGrpDebugFeed, GLOB_FRM) ;
|
||||||
@@ -5556,9 +5674,12 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou
|
|||||||
Vector3d vtEscape ;
|
Vector3d vtEscape ;
|
||||||
if ( ! CalcLastElevation( ptP1, vtTool, currStep, dSafeZ, dStep, dLastElev, dEscapeElev, vtEscape))
|
if ( ! CalcLastElevation( ptP1, vtTool, currStep, dSafeZ, dStep, dLastElev, dEscapeElev, vtEscape))
|
||||||
return false ;
|
return false ;
|
||||||
|
// -->! Per lavorazioni in doppio, si evita il movimento lineare finale !<--
|
||||||
|
if ( bDouble)
|
||||||
|
dAppr = max( dAppr, dSafeZ) ;
|
||||||
if ( dEscapeElev > 10. * EPS_SMALL && vtEscape.Len() > 10. * EPS_SMALL) {
|
if ( dEscapeElev > 10. * EPS_SMALL && vtEscape.Len() > 10. * EPS_SMALL) {
|
||||||
AddLinearMove( ptP1 + vtTool * dLastElev, bSplitArcs) ;
|
AddLinearMove( ptP1 + vtTool * dLastElev, bSplitArcs) ;
|
||||||
if ( ! AddRetract( ptP1 + vtTool * dLastElev, vtEscape, dSafeZ, dSafeAggrBottZ, dEscapeElev, dAppr, bSplitArcs)) {
|
if ( ! AddRetract( ptP1 + vtTool * dLastElev, vtEscape, dSafeZ, dSafeAggrBottZ, dEscapeElev, dAppr, bSplitArcs, bDouble)) {
|
||||||
m_pMchMgr->SetLastError( 2417, "Error in PocketingNT : Retract not computable") ;
|
m_pMchMgr->SetLastError( 2417, "Error in PocketingNT : Retract not computable") ;
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
@@ -5567,7 +5688,7 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou
|
|||||||
// aggiungo retroazione finale
|
// aggiungo retroazione finale
|
||||||
if ( currPath.bToolCompensation && dLastElev < EPS_SMALL)
|
if ( currPath.bToolCompensation && dLastElev < EPS_SMALL)
|
||||||
dLastElev = currStep.dDepth ;
|
dLastElev = currStep.dDepth ;
|
||||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dLastElev, dAppr, bSplitArcs)) {
|
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dLastElev, dAppr, bSplitArcs, bDouble)) {
|
||||||
m_pMchMgr->SetLastError( 2417, "Error in PocketingNT : Retract not computable") ;
|
m_pMchMgr->SetLastError( 2417, "Error in PocketingNT : Retract not computable") ;
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
@@ -5669,7 +5790,7 @@ PocketingNT::AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, dou
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// aggiorno per sicurezza la ProgressBar nel caso di Step vuoti
|
// aggiorno per sicurezza la ProgressBar
|
||||||
ExeProcessEvents( 100, 0) ;
|
ExeProcessEvents( 100, 0) ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
@@ -6189,7 +6310,7 @@ PocketingNT::AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
PocketingNT::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
PocketingNT::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||||
double dElev, double dAppr, bool bSplitArcs)
|
double dElev, double dAppr, bool bSplitArcs, bool bDouble)
|
||||||
{
|
{
|
||||||
// se con aggregato da sotto o equivalente (rinvio a 90 gradi su testa 5 assi)
|
// se con aggregato da sotto o equivalente (rinvio a 90 gradi su testa 5 assi)
|
||||||
bool bBottomOutStart = false ;
|
bool bBottomOutStart = false ;
|
||||||
@@ -6200,6 +6321,8 @@ PocketingNT::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSaf
|
|||||||
dDistBottom = 0 ;
|
dDistBottom = 0 ;
|
||||||
bBottomOutStart = ( dDistBottom < - 10 * EPS_SMALL) ;
|
bBottomOutStart = ( dDistBottom < - 10 * EPS_SMALL) ;
|
||||||
}
|
}
|
||||||
|
if ( bDouble)
|
||||||
|
SetFlag( 404) ;
|
||||||
// se sopra uscita c'è spazio per sicurezza o approccio
|
// se sopra uscita c'è spazio per sicurezza o approccio
|
||||||
double dSafeDist = ( m_bAggrBottom ? dSafeAggrBottZ : dSafeZ) ;
|
double dSafeDist = ( m_bAggrBottom ? dSafeAggrBottZ : dSafeZ) ;
|
||||||
if ( ! bBottomOutStart && dElev + max( dSafeDist, dAppr) > 10 * EPS_SMALL) {
|
if ( ! bBottomOutStart && dElev + max( dSafeDist, dAppr) > 10 * EPS_SMALL) {
|
||||||
@@ -6249,6 +6372,8 @@ PocketingNT::AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSaf
|
|||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( bDouble)
|
||||||
|
SetFlag( 0) ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-3
@@ -137,10 +137,11 @@ class PocketingNT : public Machining
|
|||||||
bool CalcGeoExtSurfFr( const ISurfFlatRegion* pSfrPock, const Vector3d& vtTool, double dDepth, const ISurfTriMesh* pStmRaw,
|
bool CalcGeoExtSurfFr( const ISurfFlatRegion* pSfrPock, const Vector3d& vtTool, double dDepth, const ISurfTriMesh* pStmRaw,
|
||||||
const SELVECTOR& vGeoSel, ISURFFRPOVECTOR& vSfrGeoExt) ;
|
const SELVECTOR& vGeoSel, ISURFFRPOVECTOR& vSfrGeoExt) ;
|
||||||
bool CalcLimitRegion( const ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrRaw, ISurfFlatRegion* pSfrLimit) ;
|
bool CalcLimitRegion( const ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrRaw, ISurfFlatRegion* pSfrLimit) ;
|
||||||
bool CalcPaths( STEPINFOPOVECTOR& vStepInfo) ;
|
bool CalcPaths( STEPINFOPOVECTOR& vStepInfo, bool& bEmpty) ;
|
||||||
bool CalcRetCurve( PathInfoPO& PathInfo, const StepInfoPO& StepInfo, const ICurveComposite* pCrvPath,
|
bool CalcRetCurve( PathInfoPO& PathInfo, const StepInfoPO& StepInfo, const ICurveComposite* pCrvPath,
|
||||||
const Vector3d& vtTool, bool bHolePocketing, const Point3d& ptHoleDest, bool bToolComp, bool bInVsOut, ICurveComposite* pCrvGlide) ;
|
const Vector3d& vtTool, bool bHolePocketing, const Point3d& ptHoleDest, bool bToolComp, bool bInVsOut, ICurveComposite* pCrvGlide) ;
|
||||||
bool AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dStep, bool bSplitArcs, Point3d& ptPockStart, Point3d& ptPockEnd) ;
|
bool AddPocket( STEPINFOPOVECTOR& vStepInfo, const Vector3d& vtTool, double dStep, bool bSplitArcs, Point3d& ptPockStart, Point3d& ptPockEnd,
|
||||||
|
bool& bEmpty) ;
|
||||||
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
||||||
double GetRightStartFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
double GetRightStartFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
||||||
bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ;
|
bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ;
|
||||||
@@ -155,7 +156,7 @@ class PocketingNT : public Machining
|
|||||||
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
bool AddLinkRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||||
double dElev, double dAppr, bool bSplitArcs) ;
|
double dElev, double dAppr, bool bSplitArcs) ;
|
||||||
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||||
double dElev, double dAppr, bool bSplitArcs) ;
|
double dElev, double dAppr, bool bSplitArcs, bool bDouble) ;
|
||||||
bool CalcFirstElevation( const Point3d& ptP1, const Vector3d& vtTool,
|
bool CalcFirstElevation( const Point3d& ptP1, const Vector3d& vtTool,
|
||||||
const StepInfoPO& currStep, double dSafeZ, double dStep, double& dCurrElev,
|
const StepInfoPO& currStep, double dSafeZ, double dStep, double& dCurrElev,
|
||||||
double& dEscapeElev, Vector3d& vtEscape) const ;
|
double& dEscapeElev, Vector3d& vtEscape) const ;
|
||||||
@@ -252,5 +253,6 @@ class PocketingNT : public Machining
|
|||||||
double m_dOpenMinSafe ; // minima distanza di sicurezza di attacco su lato aperto
|
double m_dOpenMinSafe ; // minima distanza di sicurezza di attacco su lato aperto
|
||||||
double m_dOpenInRawExtension ; // estensione dei tratti aperti dentro al grezzo
|
double m_dOpenInRawExtension ; // estensione dei tratti aperti dentro al grezzo
|
||||||
bool m_bAllClose ; // flag per forzare i lati come tutti chiusi
|
bool m_bAllClose ; // flag per forzare i lati come tutti chiusi
|
||||||
|
double m_dOpen ; // estensione lati aperti interno alla geometria del grezzo da note utente
|
||||||
bool m_bRunning ; // flag di calcoli in corso
|
bool m_bRunning ; // flag di calcoli in corso
|
||||||
} ;
|
} ;
|
||||||
+621
-291
File diff suppressed because it is too large
Load Diff
+28
-18
@@ -100,21 +100,27 @@ class SurfFinishing : public Machining
|
|||||||
|
|
||||||
public :
|
public :
|
||||||
SurfFinishing( void) ;
|
SurfFinishing( void) ;
|
||||||
|
Frame3d GetFrame() const { return m_Frame ; } ; // spostare in Machining se tutto ok
|
||||||
|
Frame3d& GetFrame() { return m_Frame ; } ; // spostare in Machining se tutto ok
|
||||||
|
void SetFrame( const Frame3d& frFinishing) { m_Frame = frFinishing ; } ; // spostare in Machining se tutto ok
|
||||||
|
|
||||||
private :
|
private :
|
||||||
bool MyApply( bool bRecalc, bool bPostApply) ;
|
bool MyApply( bool bRecalc, bool bPostApply) ;
|
||||||
bool VerifyGeometry( SelData Id, int& nSubs) ;
|
bool VerifyGeometry( SelData Id, int& nSubs) ;
|
||||||
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
|
bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
|
||||||
bool Chain( int nGrpDestId) ;
|
bool Chain( int nGrpDestId) ;
|
||||||
|
bool FlattenCurves( ICURVEPOVECTOR& vpCrv) const ;
|
||||||
|
bool UpdateFrameAndToolDir( int nAuxId, bool& bRecalc) ;
|
||||||
bool GetSurfacesByIds( SURFLOCALVECTOR& vSrfLoc, SURFLOCALVECTOR& vSrfSuppLoc, Frame3d& frSurf) ;
|
bool GetSurfacesByIds( SURFLOCALVECTOR& vSrfLoc, SURFLOCALVECTOR& vSrfSuppLoc, Frame3d& frSurf) ;
|
||||||
bool CalcRegionElevation( const ISurfFlatRegion* pSfr, const Vector3d& vtTool, double dRad, double dLen, double& dElev) const ; ;
|
bool CalcRegionElevation( const ISurfFlatRegion* pSfr, const Vector3d& vtTool, double dRad, double dLen, double& dElev) const ;
|
||||||
bool SetCAvTlStmForSurfaces( ICAvToolSurfTm* pCAvTlStm, const ISurfFlatRegion* pSfrCnt, double dDepth,
|
bool SetCAvTlStmForSurfaces( ICAvToolSurfTm* pCAvTlStm, const ISurfFlatRegion* pSfrCnt, double dDepth,
|
||||||
double dToolLen, double dToolDiam, double dToolCornRad,
|
double dToolLen, double dToolDiam, double dToolCornRad,
|
||||||
double dToolSideAng, double dToolMaxMat, double dMachOffsR,
|
double dToolSideAng, double dToolMaxMat, double dMachOffsR,
|
||||||
const SURFLOCALVECTOR& vSurfLoc, const SURFLOCALVECTOR& vSurfSuppLoc) ;
|
const SURFLOCALVECTOR& vSurfLoc, const SURFLOCALVECTOR& vSurfSuppLoc) ;
|
||||||
bool EraseMaxDownSurf( const SURFLOCALVECTOR& vSurfLoc, const Frame3d& frSurf, const Vector3d& vtTool,
|
bool EraseMaxDownSurf( const SURFLOCALVECTOR& vSurfLoc, const Frame3d& frSurf, const Vector3d& vtMove,
|
||||||
double dDepth, ISurfFlatRegion* pSfrCnt) ;
|
double dDepth, ISurfFlatRegion* pSfrCnt) const ;
|
||||||
bool ProcessCrvCompo( int nPathId, int nPvId, int nClId) ;
|
bool EraseMaxDownStartEndPolyLine( PolyLine& PL) const ;
|
||||||
|
bool ProcessCrv( int nPathId, int nPvId, int nClId) ;
|
||||||
bool ProcessSfr( int nPathId, int nPvId, int nClId) ;
|
bool ProcessSfr( int nPathId, int nPvId, int nClId) ;
|
||||||
bool SimplifyCurve( ICurveComposite* pCompo, const Frame3d& frLocXY,
|
bool SimplifyCurve( ICurveComposite* pCompo, const Frame3d& frLocXY,
|
||||||
double dMergeLinTol = 200. * EPS_SMALL, double dMergeAndTolDeg = 200. * EPS_ANG_SMALL,
|
double dMergeLinTol = 200. * EPS_SMALL, double dMergeAndTolDeg = 200. * EPS_ANG_SMALL,
|
||||||
@@ -126,26 +132,26 @@ class SurfFinishing : public Machining
|
|||||||
ICurveComposite* pCrv) const ;
|
ICurveComposite* pCrv) const ;
|
||||||
// lavorazioni per superfici
|
// lavorazioni per superfici
|
||||||
bool AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrCnt,
|
bool AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrCnt,
|
||||||
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
|
const Vector3d& vtTool, const Vector3d& vtMove, double dDepth, double dElev, bool bSplitArcs) ;
|
||||||
bool AddOneWay( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrCnt,
|
bool AddOneWay( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrCnt,
|
||||||
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
|
const Vector3d& vtTool, const Vector3d& vtMove, double dDepth, double dElev, bool bSplitArcs) ;
|
||||||
bool AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrCnt,
|
bool AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ISurfFlatRegion* pSfrCnt,
|
||||||
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs, bool bInVsOut) ;
|
const Vector3d& vtTool, const Vector3d& vtMove, double dDepth, double dElev, bool bSplitArcs, bool bInVsOut) ;
|
||||||
bool AddZConst( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
|
bool AddZConst( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
|
||||||
const ISurfFlatRegion* pSfrCnt, const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
|
const ISurfFlatRegion* pSfrCnt, const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
|
||||||
bool AddOptimal( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
|
bool AddOptimal( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
|
||||||
const ISurfFlatRegion* pSfrCntZigZag, const ISurfFlatRegion* pSfrCntZConst, const Vector3d& vtTool,
|
const ISurfFlatRegion* pSfrCntZigZag, const ISurfFlatRegion* pSfrCntZConst, const Vector3d& vtTool,
|
||||||
double dDepth, double dElev, bool bSplitArcs) ;
|
const Vector3d& vtMove, double dDepth, double dElev, bool bSplitArcs) ;
|
||||||
bool AddPencil( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
|
bool AddPencil( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf,
|
||||||
const ISurfFlatRegion* pSfrCnt, const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
|
const ISurfFlatRegion* pSfrCnt, const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
|
||||||
// lavorazioni per curve
|
// lavorazioni per curve
|
||||||
bool AddProjection( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ICurveComposite* pCompo,
|
bool AddProjection( ICAvToolSurfTm* pCAvTlStm, const SURFLOCALVECTOR& vSrfLoc, const Frame3d& frSurf, const ICurveComposite* pCompo,
|
||||||
const Vector3d& vtTool, double dDepth, double dElev, bool bSplitArcs) ;
|
const Vector3d& vtTool, const Vector3d& vtMove, double dDepth, double dElev, bool bSplitArcs) ;
|
||||||
// creazione del percorso finale di lavorazione
|
// creazione del percorso finale di lavorazione
|
||||||
bool AddFinishing( const ISurfFlatRegion* pSfrCnt, ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ICRVCOMPOPOVECTOR& vCrvCompo,
|
bool AddFinishing( const ISurfFlatRegion* pSfrCnt, ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const ICRVCOMPOPOVECTOR& vCrvCompo,
|
||||||
const Vector3d& vtTool, double dElev, double dDepth, bool bSplitArcs) ;
|
const Vector3d& vtTool, const Vector3d& vtMove, double dElev, double dDepth, bool bSplitArcs) ;
|
||||||
// collisione con i percorsi di lavorazione
|
// collisione con i percorsi di lavorazione
|
||||||
bool CorrectPathByCollision( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const Vector3d& vtTool,
|
bool CorrectPathByCollision( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const Vector3d& vtTool, const Vector3d& vtMove,
|
||||||
double dDepth, ICRVCOMPOPOVECTOR& vpCrvs) ;
|
double dDepth, ICRVCOMPOPOVECTOR& vpCrvs) ;
|
||||||
|
|
||||||
bool WorkPencilCurves( const ICRVCOMPOPOVECTOR& vCrvCompo, const ISurfFlatRegion* pSfrCnt, int nPencilType, double dOffs, int nOffs,
|
bool WorkPencilCurves( const ICRVCOMPOPOVECTOR& vCrvCompo, const ISurfFlatRegion* pSfrCnt, int nPencilType, double dOffs, int nOffs,
|
||||||
@@ -198,13 +204,12 @@ class SurfFinishing : public Machining
|
|||||||
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool, bool bSplitArcs) ;
|
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool, bool bSplitArcs) ;
|
||||||
bool CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool, const Vector3d& vtNorm, Point3d& ptP1) const ;
|
bool CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool, const Vector3d& vtNorm, Point3d& ptP1) const ;
|
||||||
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Point3d& ptP1, const Vector3d& vtTool, bool bSplitArcs) ;
|
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Point3d& ptP1, const Vector3d& vtTool, bool bSplitArcs) ;
|
||||||
bool GetLastGoodPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const Point3d& ptStart,
|
bool GetLastGoodPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, const Point3d& ptStart, const Point3d& ptEnd,
|
||||||
const Point3d& ptEnd, const Vector3d& vtInit, const Vector3d& vtTool,
|
const Vector3d& vtInit, const Vector3d& vtTool, const Vector3d& vtMove, bool bLeadInVsOut, Point3d& ptP1) const ;
|
||||||
bool bLeadInVsOut, Point3d& ptP1) const ;
|
bool GetLinkFromPaths( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, const Vector3d& vtMove, const ISurfFlatRegion* pSfrCnt,
|
||||||
bool GetLinkFromPaths( const Point3d& ptStart, const Point3d& ptEnd, const Vector3d& vtTool, const ISurfFlatRegion* pSfrCnt,
|
|
||||||
double dDepth, double dSafeZ, ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, ICurveComposite* pCrvLink) const ;
|
double dDepth, double dSafeZ, ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf, ICurveComposite* pCrvLink) const ;
|
||||||
bool GetSurfaceNormalAtPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
|
bool GetSurfaceNormalAtPoint( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
|
||||||
const Point3d& ptTool, const Vector3d& vtTool, Vector3d& vtNorm) const ;
|
const Point3d& ptTool, const Vector3d& vtTool, const Vector3d& vtMove, Vector3d& vtNorm) const ;
|
||||||
bool GetActiveSurfaces( INTVECTOR& vSurfId, INTVECTOR& vSurfSuppId) const ;
|
bool GetActiveSurfaces( INTVECTOR& vSurfId, INTVECTOR& vSurfSuppId) const ;
|
||||||
int ProcessSquare( int nFlag, double dLevel, double dQPt0, double dQpt1, double dQpt2, double dQpt3,
|
int ProcessSquare( int nFlag, double dLevel, double dQPt0, double dQpt1, double dQpt2, double dQpt3,
|
||||||
int& nI1s, int& nI1e, int& nI2s, int& nI2e) const ;
|
int& nI1s, int& nI1e, int& nI2s, int& nI2e) const ;
|
||||||
@@ -218,10 +223,11 @@ class SurfFinishing : public Machining
|
|||||||
double dLimInfClippingAng, double dLimSupClippingAng, const Vector3d& vtAxL, const Vector3d& vtMoveL, ICAvToolSurfTm* pCAvTlStm,
|
double dLimInfClippingAng, double dLimSupClippingAng, const Vector3d& vtAxL, const Vector3d& vtMoveL, ICAvToolSurfTm* pCAvTlStm,
|
||||||
ICRVCOMPOPOVECTOR& vCrvCompo) const ;
|
ICRVCOMPOPOVECTOR& vCrvCompo) const ;
|
||||||
bool AreSameSfrChunkEpsilon( const ISurfFlatRegion* pSfrChunkA, const ISurfFlatRegion* pSfrChunkB, double dMaxDist) const ;
|
bool AreSameSfrChunkEpsilon( const ISurfFlatRegion* pSfrChunkA, const ISurfFlatRegion* pSfrChunkB, double dMaxDist) const ;
|
||||||
bool CalcOptimalZigZagRegion( const ISurfFlatRegion* pSfrCntLoc, const ISurfFlatRegion* pSfrZLevelColl, const SURFLOCALVECTOR& vSrfLoc,
|
bool CalcOptimalZigZagRegion( const ISurfFlatRegion* pSfrCntLoc, const ISurfFlatRegion* pSfrZLevelColl, ISURFFRPOVECTOR& vpSfrZigZagProj) const ;
|
||||||
const Frame3d& frSurf, const Vector3d& vtTool, double dDepth, double dSplitAngDeg, ISURFFRPOVECTOR& vpSfrZigZagProj) const ;
|
|
||||||
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
double GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) const ;
|
||||||
double GetRadiusForStartEndElevation( void) const ;
|
double GetRadiusForStartEndElevation( void) const ;
|
||||||
|
double GetLocalSideAngle() const ;
|
||||||
|
bool GetLocalToolDir( Vector3d& vtToolLoc) const ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
double GetSpeed() const
|
double GetSpeed() const
|
||||||
@@ -238,6 +244,7 @@ class SurfFinishing : public Machining
|
|||||||
{ return ( IsUnknownValue( m_Params.m_dOffsR) ? m_TParams.m_dOffsR : m_Params.m_dOffsR) ; }
|
{ return ( IsUnknownValue( m_Params.m_dOffsR) ? m_TParams.m_dOffsR : m_Params.m_dOffsR) ; }
|
||||||
double GetSideStep( void) const
|
double GetSideStep( void) const
|
||||||
{ return Clamp( m_Params.m_dSideStep, 0.1, m_TParams.m_dTDiam) ; }
|
{ return Clamp( m_Params.m_dSideStep, 0.1, m_TParams.m_dTDiam) ; }
|
||||||
|
|
||||||
int GetLeadInType( void) const ;
|
int GetLeadInType( void) const ;
|
||||||
int GetLeadOutType( void) const ;
|
int GetLeadOutType( void) const ;
|
||||||
|
|
||||||
@@ -245,6 +252,9 @@ class SurfFinishing : public Machining
|
|||||||
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
|
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
|
||||||
SurfFinishingData m_Params ; // parametri lavorazione
|
SurfFinishingData m_Params ; // parametri lavorazione
|
||||||
ToolData m_TParams ; // parametri utensile
|
ToolData m_TParams ; // parametri utensile
|
||||||
|
Frame3d m_Frame ; // terna per orientamento finitura ZigZag/OneWay
|
||||||
|
double m_dTheta ; // orientamento verticale utensile rispetto a m_Frame
|
||||||
|
double m_dPhi ; // orientamento orizzontale utesnile rispetto a m_Frame
|
||||||
double m_dTHoldBase ; // posizione base del porta-utensile
|
double m_dTHoldBase ; // posizione base del porta-utensile
|
||||||
double m_dTHoldLen ; // lunghezza del porta-utensile
|
double m_dTHoldLen ; // lunghezza del porta-utensile
|
||||||
double m_dTHoldDiam ; // diametro del porta-utensile
|
double m_dTHoldDiam ; // diametro del porta-utensile
|
||||||
|
|||||||
+1
-1
@@ -3043,7 +3043,7 @@ SurfRoughing::CalcPaths( const INTINTVECTOR& vPocket, STEPINFOSRVECTOR& vStepInf
|
|||||||
ICRVCOMPOPOVECTOR vCrvPaths ;
|
ICRVCOMPOPOVECTOR vCrvPaths ;
|
||||||
if ( ! CalcPocketing( vStepInfo[nInd].pSfrPock, m_TParams.m_dDiam / 2, 0., m_Params.m_dSideStep,
|
if ( ! CalcPocketing( vStepInfo[nInd].pSfrPock, m_TParams.m_dDiam / 2, 0., m_Params.m_dSideStep,
|
||||||
m_Params.m_dSideAngle, 5., vStepInfo[nInd].nSubType, true, true, vStepInfo[nInd].bInverted,
|
m_Params.m_dSideAngle, 5., vStepInfo[nInd].nSubType, true, true, vStepInfo[nInd].bInverted,
|
||||||
false, bConventionalMilling, true, true, ptEndLastPath, vStepInfo[nInd].pSfrLimit, false, m_Params.m_dSideStep,
|
false, bConventionalMilling, true, false, true, ptEndLastPath, vStepInfo[nInd].pSfrLimit, false, m_Params.m_dSideStep,
|
||||||
GetLeadInType(), m_Params.m_dLiTang, m_Params.m_dLiElev, GetLeadOutType(), m_Params.m_dLoTang,
|
GetLeadInType(), m_Params.m_dLiTang, m_Params.m_dLiElev, GetLeadOutType(), m_Params.m_dLoTang,
|
||||||
false, 0., 0., false, vCrvPaths)) {
|
false, 0., 0., false, vCrvPaths)) {
|
||||||
if ( vStepInfo[nInd].bIsExtraStep) {
|
if ( vStepInfo[nInd].bIsExtraStep) {
|
||||||
|
|||||||
Reference in New Issue
Block a user