Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d86f1cf47f | |||
| bca5dbb6dd | |||
| c3fa0bad11 | |||
| b2dacc0cef | |||
| 4af09db198 | |||
| 1507f18b88 | |||
| abbc7ee12b |
Binary file not shown.
@@ -452,10 +452,11 @@ class MachMgr : public IMachMgr
|
|||||||
bool GetOperationNewName( std::string& sName) const ;
|
bool GetOperationNewName( std::string& sName) const ;
|
||||||
const ToolData* GetMachiningToolData( void) const ;
|
const ToolData* GetMachiningToolData( void) const ;
|
||||||
// Simulation
|
// Simulation
|
||||||
bool SimAddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
|
bool SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
|
||||||
bool SimExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ;
|
bool SimExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ;
|
||||||
bool SimOnCollision( int nCdInd, int nObjInd, int& nErr) ;
|
bool SimOnCollision( int nCdInd, int nObjInd, int& nErr) ;
|
||||||
bool SimSetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst) ;
|
bool SimSetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst) ;
|
||||||
|
int SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) ;
|
||||||
// Machine
|
// Machine
|
||||||
bool GetHeadAbove( const std::string& sHead) const ;
|
bool GetHeadAbove( const std::string& sHead) const ;
|
||||||
double GetDeltaSafeZ( const std::string& sHead) const ;
|
double GetDeltaSafeZ( const std::string& sHead) const ;
|
||||||
|
|||||||
+15
-4
@@ -1,7 +1,7 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2015-2015
|
// EgalTech 2015-2023
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : MachMgrSimulation.cpp Data : 20.10.15 Versione : 1.6j2
|
// File : MachMgrSimulation.cpp Data : 16.01.23 Versione : 2.5a2
|
||||||
// Contenuto : Implementazione gestione simulazione della classe MachMgr.
|
// Contenuto : Implementazione gestione simulazione della classe MachMgr.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@@ -150,13 +150,13 @@ MachMgr::SimExit( void)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
MachMgr::SimAddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3)
|
MachMgr::SimAddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3)
|
||||||
{
|
{
|
||||||
// verifico simulatore
|
// verifico simulatore
|
||||||
if ( m_pSimul == nullptr)
|
if ( m_pSimul == nullptr)
|
||||||
return false ;
|
return false ;
|
||||||
// aggiungo un oggetto da verificare per la collisione con il grezzo
|
// aggiungo un oggetto da verificare per la collisione con il grezzo
|
||||||
return m_pSimul->AddCollisionObj( nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
|
return m_pSimul->AddCollisionObj( nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -191,3 +191,14 @@ MachMgr::SimSetToolForVmill( const string& sTool, const string& sHead, int nExit
|
|||||||
// imposto utensile per Vmill
|
// imposto utensile per Vmill
|
||||||
return m_pSimul->SetToolForVmill( sTool, sHead, nExit, vVmill, bFirst) ;
|
return m_pSimul->SetToolForVmill( sTool, sHead, nExit, vVmill, bFirst) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
int
|
||||||
|
MachMgr::SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
|
||||||
|
{
|
||||||
|
// verifico simulatore
|
||||||
|
if ( m_pSimul == nullptr)
|
||||||
|
return false ;
|
||||||
|
// lancio movimento assi
|
||||||
|
return m_pSimul->MoveAxes( nMoveType, vAxNaEpSt) ;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2015-2021
|
// EgalTech 2015-2023
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : Machine.h Data : 14.10.21 Versione : 2.3j5
|
// File : Machine.h Data : 16.01.23 Versione : 2.5a2
|
||||||
// Contenuto : Dichiarazione della classe Machine.
|
// Contenuto : Dichiarazione della classe Machine.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@@ -356,6 +356,8 @@ class Machine
|
|||||||
static int LuaEmtOnCollision( lua_State* L) ;
|
static int LuaEmtOnCollision( lua_State* L) ;
|
||||||
static int LuaEmtSetToolForVmill( lua_State* L) ;
|
static int LuaEmtSetToolForVmill( lua_State* L) ;
|
||||||
static int LuaEmtAddToolForVmill( lua_State* L) ;
|
static int LuaEmtAddToolForVmill( lua_State* L) ;
|
||||||
|
static int LuaEmtMoveAxes( lua_State* L) ;
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|||||||
+48
-3
@@ -136,6 +136,8 @@ Machine::LuaInit( const string& sMachineName)
|
|||||||
m_LuaMgr.RegisterFunction( "EmtSetToolForVmill", Machine::LuaEmtSetToolForVmill) ;
|
m_LuaMgr.RegisterFunction( "EmtSetToolForVmill", Machine::LuaEmtSetToolForVmill) ;
|
||||||
// registro la funzione di impostazione di utensile aggiuntivo per virtual milling in simulazione
|
// registro la funzione di impostazione di utensile aggiuntivo per virtual milling in simulazione
|
||||||
m_LuaMgr.RegisterFunction( "EmtAddToolForVmill", Machine::LuaEmtAddToolForVmill) ;
|
m_LuaMgr.RegisterFunction( "EmtAddToolForVmill", Machine::LuaEmtAddToolForVmill) ;
|
||||||
|
// registro la funzione di movimento assi in simulazione
|
||||||
|
m_LuaMgr.RegisterFunction( "EmtMoveAxes", Machine::LuaEmtMoveAxes) ;
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
@@ -1260,7 +1262,7 @@ Machine::LuaEmtAddCollisionObj( lua_State* L)
|
|||||||
if ( m_pMchLua == nullptr)
|
if ( m_pMchLua == nullptr)
|
||||||
return luaL_error( L, " Unknown Machine") ;
|
return luaL_error( L, " Unknown Machine") ;
|
||||||
// assegno i dati
|
// assegno i dati
|
||||||
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimAddCollisionObj( nInd, nFrameId, nType, Vector3d(), dPar1, dPar2, dPar3)) ;
|
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimAddCollisionObj( nInd, false, nFrameId, nType, Vector3d(), dPar1, dPar2, dPar3)) ;
|
||||||
// assegno risultato
|
// assegno risultato
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
@@ -1270,7 +1272,7 @@ Machine::LuaEmtAddCollisionObj( lua_State* L)
|
|||||||
int
|
int
|
||||||
Machine::LuaEmtAddCollisionObjEx( lua_State* L)
|
Machine::LuaEmtAddCollisionObjEx( lua_State* L)
|
||||||
{
|
{
|
||||||
// 7 parametri : nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3
|
// 7 o 8 parametri : nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3 [,bToolOn]
|
||||||
int nInd ;
|
int nInd ;
|
||||||
LuaCheckParam( L, 1, nInd)
|
LuaCheckParam( L, 1, nInd)
|
||||||
int nFrameId ;
|
int nFrameId ;
|
||||||
@@ -1285,12 +1287,14 @@ Machine::LuaEmtAddCollisionObjEx( lua_State* L)
|
|||||||
LuaCheckParam( L, 6, dPar2)
|
LuaCheckParam( L, 6, dPar2)
|
||||||
double dPar3 ;
|
double dPar3 ;
|
||||||
LuaCheckParam( L, 7, dPar3)
|
LuaCheckParam( L, 7, dPar3)
|
||||||
|
bool bToolOn = false ;
|
||||||
|
LuaGetParam( L, 8, bToolOn) ;
|
||||||
LuaClearStack( L) ;
|
LuaClearStack( L) ;
|
||||||
// verifico ci sia una macchina attiva
|
// verifico ci sia una macchina attiva
|
||||||
if ( m_pMchLua == nullptr)
|
if ( m_pMchLua == nullptr)
|
||||||
return luaL_error( L, " Unknown Machine") ;
|
return luaL_error( L, " Unknown Machine") ;
|
||||||
// assegno i dati
|
// assegno i dati
|
||||||
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimAddCollisionObj( nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3)) ;
|
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SimAddCollisionObj( nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3)) ;
|
||||||
// assegno risultato
|
// assegno risultato
|
||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
@@ -1386,3 +1390,44 @@ Machine::LuaEmtAddToolForVmill( lua_State* L)
|
|||||||
LuaSetParam( L, bOk) ;
|
LuaSetParam( L, bOk) ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
int
|
||||||
|
Machine::LuaEmtMoveAxes( lua_State* L)
|
||||||
|
{
|
||||||
|
// 4, ..., 16 parametri : nMoveType, sAx1, dPos1, dStep1 [, sAx2, dPos2, dStep2] [, sAx3, dPos3, dStep3] [, sAx4, dPos4, dStep4] [, sAx5, dPos5, dStep5]
|
||||||
|
int nMoveType ;
|
||||||
|
LuaCheckParam( L, 1, nMoveType)
|
||||||
|
string sAx1 ;
|
||||||
|
LuaCheckParam( L, 2, sAx1) ;
|
||||||
|
double dEnd1 ;
|
||||||
|
LuaCheckParam( L, 3, dEnd1) ;
|
||||||
|
double dStep1 ;
|
||||||
|
LuaCheckParam( L, 4, dStep1) ;
|
||||||
|
SAMVECTOR vAxNaEpSt ;
|
||||||
|
vAxNaEpSt.emplace_back( sAx1, dEnd1, dStep1) ;
|
||||||
|
for ( int i = 0 ; i < 4 ; ++ i) {
|
||||||
|
int nInd = 5 + 3 * i ;
|
||||||
|
string sAxN ;
|
||||||
|
double dEndN ;
|
||||||
|
double dStepN ;
|
||||||
|
if ( LuaGetParam( L, nInd, sAxN) && LuaGetParam( L, nInd + 1, dEndN) && LuaGetParam( L, nInd + 2, dStepN))
|
||||||
|
vAxNaEpSt.emplace_back( sAxN, dEndN, dStepN) ;
|
||||||
|
else
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
LuaClearStack( L) ;
|
||||||
|
// verifico ci sia una macchina attiva
|
||||||
|
if ( m_pMchLua == nullptr)
|
||||||
|
return luaL_error( L, " Unknown Machine") ;
|
||||||
|
// eseguo movimento in simulazione
|
||||||
|
int nRes = 0 ;
|
||||||
|
if ( m_pMchLua->m_pMchMgr != nullptr)
|
||||||
|
nRes = m_pMchLua->m_pMchMgr->SimMoveAxes( nMoveType, vAxNaEpSt) ;
|
||||||
|
// assegno risultato
|
||||||
|
if ( nRes == SIM_AXMV_RES_STOP)
|
||||||
|
return luaL_error( L, "STOP") ;
|
||||||
|
else
|
||||||
|
LuaSetParam( L, ( nRes == SIM_AXMV_RES_OK)) ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
@@ -1555,8 +1555,8 @@ Operation::CalculateAxesValues( const string& sHint, bool bSolChExact)
|
|||||||
}
|
}
|
||||||
// se extracorsa dell'asse C, provo a precaricarlo al contrario
|
// se extracorsa dell'asse C, provo a precaricarlo al contrario
|
||||||
if ( nOutStrC != 0) {
|
if ( nOutStrC != 0) {
|
||||||
|
vAxRotPrec = vAxRotPrecOri ;
|
||||||
vAxRotPrec[0] = vAxRotPrecOri[0] + ( nOutStrC > 0 ? - ANG_FULL : ANG_FULL) ;
|
vAxRotPrec[0] = vAxRotPrecOri[0] + ( nOutStrC > 0 ? - ANG_FULL : ANG_FULL) ;
|
||||||
vAxRotPrec[1] = vAxRotPrecOri[1] ;
|
|
||||||
m_pMchMgr->GetCurrMachine()->ResetOutstrokeInfo() ;
|
m_pMchMgr->GetCurrMachine()->ResetOutstrokeInfo() ;
|
||||||
if ( ! CalculateClPathAxesValues( nClPathId, nLinAxes, nRotAxes, dRot1W, bMaxDeltaR2OnFirst,
|
if ( ! CalculateClPathAxesValues( nClPathId, nLinAxes, nRotAxes, dRot1W, bMaxDeltaR2OnFirst,
|
||||||
INFINITO, vAxRotHome, vAxRotPrec, nOutStrC))
|
INFINITO, vAxRotHome, vAxRotPrec, nOutStrC))
|
||||||
|
|||||||
+51
-58
@@ -1149,7 +1149,7 @@ Pocketing::GetCurves( SelData Id, ICURVEPLIST& lstPC)
|
|||||||
if ( ! pSurf->GetFacetNormal( nFacet, vtN))
|
if ( ! pSurf->GetFacetNormal( nFacet, vtN))
|
||||||
return false ;
|
return false ;
|
||||||
// creo la curva a partire dei loop
|
// creo la curva a partire dei loop
|
||||||
for ( int i = 0 ; i < vPL.size() ; i++) {
|
for ( int i = 0 ; i < int( vPL.size()) ; i++) {
|
||||||
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
|
||||||
pCrvCompo->FromPolyLine( vPL[i]) ;
|
pCrvCompo->FromPolyLine( vPL[i]) ;
|
||||||
if ( ! pCrvCompo->IsValid())
|
if ( ! pCrvCompo->IsValid())
|
||||||
@@ -2430,7 +2430,7 @@ Pocketing::AddZigZag( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, c
|
|||||||
// se sono nel caso ottimizzato devo togliere il loop esterno
|
// se sono nel caso ottimizzato devo togliere il loop esterno
|
||||||
if ( bOptimizedZigZag) {
|
if ( bOptimizedZigZag) {
|
||||||
double dMaxArea = -INFINITO ; int nJumpInd = 0 ;
|
double dMaxArea = -INFINITO ; int nJumpInd = 0 ;
|
||||||
for ( int i = 0 ; i < vCrvLoops.size() ; i++) {
|
for ( int i = 0 ; i < int( vCrvLoops.size()) ; i++) {
|
||||||
double dArea ; vCrvLoops[i]->GetAreaXY( dArea) ;
|
double dArea ; vCrvLoops[i]->GetAreaXY( dArea) ;
|
||||||
if ( dArea > dMaxArea) {
|
if ( dArea > dMaxArea) {
|
||||||
dMaxArea = dArea ;
|
dMaxArea = dArea ;
|
||||||
@@ -2438,13 +2438,13 @@ Pocketing::AddZigZag( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ICRVCOMPOPOVECTOR vCrvHelp ;
|
ICRVCOMPOPOVECTOR vCrvHelp ;
|
||||||
for ( int i = 0 ; i < vCrvLoops.size() ; i++) {
|
for ( int i = 0 ; i < int( vCrvLoops.size()) ; i++) {
|
||||||
if ( i != nJumpInd)
|
if ( i != nJumpInd)
|
||||||
vCrvHelp.emplace_back( vCrvLoops[i]->Clone()) ;
|
vCrvHelp.emplace_back( vCrvLoops[i]->Clone()) ;
|
||||||
}
|
}
|
||||||
vCrvLoops.clear() ;
|
vCrvLoops.clear() ;
|
||||||
vCrvLoops.resize( vCrvHelp.size()) ;
|
vCrvLoops.resize( vCrvHelp.size()) ;
|
||||||
for ( int i = 0 ; i < vCrvHelp.size() ; i++)
|
for ( int i = 0 ; i < int( vCrvHelp.size()) ; i++)
|
||||||
vCrvLoops[i].Set( Release( vCrvHelp[i])) ;
|
vCrvLoops[i].Set( Release( vCrvHelp[i])) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2457,8 +2457,8 @@ Pocketing::AddZigZag( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, c
|
|||||||
Point3d ptRef = ptEnd ;
|
Point3d ptRef = ptEnd ;
|
||||||
double dMinDist = INFINITO ;
|
double dMinDist = INFINITO ;
|
||||||
int nIndexSwitch = -1 ;
|
int nIndexSwitch = -1 ;
|
||||||
for ( int i = -1 ; i < vCrvLoops.size() - 1 ; i++) {
|
for ( int i = -1 ; i < int( vCrvLoops.size()) - 1 ; i++) {
|
||||||
for ( int j = i + 1 ; j < vCrvLoops.size() ; j++) {
|
for ( int j = i + 1 ; j < int( vCrvLoops.size()) ; j++) {
|
||||||
Point3d ptS ; vCrvLoops[j]->GetStartPoint( ptS) ;
|
Point3d ptS ; vCrvLoops[j]->GetStartPoint( ptS) ;
|
||||||
if ( Dist( ptS, ptRef) < dMinDist) {
|
if ( Dist( ptS, ptRef) < dMinDist) {
|
||||||
dMinDist = Dist( ptS, ptRef) ;
|
dMinDist = Dist( ptS, ptRef) ;
|
||||||
@@ -2474,7 +2474,7 @@ Pocketing::AddZigZag( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, c
|
|||||||
dMinDist = INFINITO ;
|
dMinDist = INFINITO ;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int u = 0 ; u < vCrvLoops.size() ; u++) {
|
for( int u = 0 ; u < int( vCrvLoops.size()) ; u++) {
|
||||||
|
|
||||||
// recupero la prima curva di offset disponibile
|
// recupero la prima curva di offset disponibile
|
||||||
PtrOwner<ICurveComposite> pOffs( CreateCurveComposite());
|
PtrOwner<ICurveComposite> pOffs( CreateCurveComposite());
|
||||||
@@ -2681,7 +2681,7 @@ Pocketing::CalcZigZag( const ISurfFlatRegion* pSrfZigZag, ICRVCOMPOPOVECTOR& vpC
|
|||||||
// calcolo la classificazione della linea rispetto alla superificie
|
// calcolo la classificazione della linea rispetto alla superificie
|
||||||
CRVCVECTOR ccClass ;
|
CRVCVECTOR ccClass ;
|
||||||
pSrfZigZag->GetCurveClassification( *pLine, EPS_SMALL, ccClass) ;
|
pSrfZigZag->GetCurveClassification( *pLine, EPS_SMALL, ccClass) ;
|
||||||
for ( int j = 0 ; j < ccClass.size() ; j++) {
|
for ( int j = 0 ; j < int( ccClass.size()) ; j++) {
|
||||||
if ( ccClass[j].nClass == CRVC_IN) { // memorizzo il segmento
|
if ( ccClass[j].nClass == CRVC_IN) { // memorizzo il segmento
|
||||||
Section currSec;
|
Section currSec;
|
||||||
currSec.bActive = true;
|
currSec.bActive = true;
|
||||||
@@ -2689,7 +2689,7 @@ Pocketing::CalcZigZag( const ISurfFlatRegion* pSrfZigZag, ICRVCOMPOPOVECTOR& vpC
|
|||||||
Point3d ptS, ptE ;
|
Point3d ptS, ptE ;
|
||||||
pSeg->GetStartPoint( ptS) ; pSeg->GetEndPoint( ptE) ;
|
pSeg->GetStartPoint( ptS) ; pSeg->GetEndPoint( ptE) ;
|
||||||
currSec.ptS = ptS ; currSec.ptE = ptE ;
|
currSec.ptS = ptS ; currSec.ptE = ptE ;
|
||||||
for ( int k = 0 ; k < vFirstOff.size() ; k++) {
|
for ( int k = 0 ; k < int( vFirstOff.size()) ; k++) {
|
||||||
if ( vFirstOff[k]->IsPointOn( ptS)) {
|
if ( vFirstOff[k]->IsPointOn( ptS)) {
|
||||||
currSec.nOffIndS = k ;
|
currSec.nOffIndS = k ;
|
||||||
double dUOS; vFirstOff[k]->GetParamAtPoint( ptS, dUOS) ;
|
double dUOS; vFirstOff[k]->GetParamAtPoint( ptS, dUOS) ;
|
||||||
@@ -2745,9 +2745,6 @@ Pocketing::CalcZigZag( const ISurfFlatRegion* pSrfZigZag, ICRVCOMPOPOVECTOR& vpC
|
|||||||
Sec.bActive = false ;
|
Sec.bActive = false ;
|
||||||
vpCrvs.back()->AddLine( vvSec[nI][nJ].ptE) ;
|
vpCrvs.back()->AddLine( vvSec[nI][nJ].ptE) ;
|
||||||
|
|
||||||
if (vpCrvs[0]->GetCurveCount() == 9)
|
|
||||||
int a = 0;
|
|
||||||
|
|
||||||
if ( nStatus == 0) { // primo segmento per il raccordo smussato
|
if ( nStatus == 0) { // primo segmento per il raccordo smussato
|
||||||
plastLine.Set( GetCurveLine( vpCrvs.back()->GetLastCurve()->Clone())) ;
|
plastLine.Set( GetCurveLine( vpCrvs.back()->GetLastCurve()->Clone())) ;
|
||||||
plastLine->GetStartPoint( ptS_ref) ;
|
plastLine->GetStartPoint( ptS_ref) ;
|
||||||
@@ -2933,7 +2930,7 @@ Pocketing::GetUnclearedRegion( ICRVCOMPOPOVECTOR& vFirstOffs, ICRVCOMPOPOVECTOR&
|
|||||||
if ( IsNull( pSrfExtern))
|
if ( IsNull( pSrfExtern))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
for ( int i = 0 ; i < vFirstOffs.size() ; i++) {
|
for ( int i = 0 ; i < int( vFirstOffs.size()) ; i++) {
|
||||||
if ( i == 0)
|
if ( i == 0)
|
||||||
pSrfExtern->AddExtLoop( vFirstOffs[i]->Clone()) ;
|
pSrfExtern->AddExtLoop( vFirstOffs[i]->Clone()) ;
|
||||||
else {
|
else {
|
||||||
@@ -2948,7 +2945,7 @@ Pocketing::GetUnclearedRegion( ICRVCOMPOPOVECTOR& vFirstOffs, ICRVCOMPOPOVECTOR&
|
|||||||
if ( IsNull( pSrfTool))
|
if ( IsNull( pSrfTool))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
for ( int i = 0 ; i < vCrvs.size(); i++) {
|
for ( int i = 0 ; i < int( vCrvs.size()) ; i++) {
|
||||||
PtrOwner<ISurfFlatRegion> pSrfToolRegOffi( GetSurfFlatRegionFromFatCurve( vCrvs[i]->Clone(), m_TParams.m_dDiam / 2 + 5 * EPS_SMALL, false, false)) ;
|
PtrOwner<ISurfFlatRegion> pSrfToolRegOffi( GetSurfFlatRegionFromFatCurve( vCrvs[i]->Clone(), m_TParams.m_dDiam / 2 + 5 * EPS_SMALL, false, false)) ;
|
||||||
if ( i == 0)
|
if ( i == 0)
|
||||||
pSrfTool.Set( Release( pSrfToolRegOffi)) ;
|
pSrfTool.Set( Release( pSrfToolRegOffi)) ;
|
||||||
@@ -2956,7 +2953,7 @@ Pocketing::GetUnclearedRegion( ICRVCOMPOPOVECTOR& vFirstOffs, ICRVCOMPOPOVECTOR&
|
|||||||
pSrfTool->Add( *Release( pSrfToolRegOffi)) ;
|
pSrfTool->Add( *Release( pSrfToolRegOffi)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( int i = 0; i < vLinks.size(); i++) {
|
for ( int i = 0; i < int( vLinks.size()) ; i++) {
|
||||||
if ( ! IsNull( vLinks[i])) {
|
if ( ! IsNull( vLinks[i])) {
|
||||||
PtrOwner<ISurfFlatRegion> pSrfToolRegLinki( GetSurfFlatRegionFromFatCurve( vLinks[i]->Clone(), m_TParams.m_dDiam / 2 + 5 * EPS_SMALL, false, false)) ;
|
PtrOwner<ISurfFlatRegion> pSrfToolRegLinki( GetSurfFlatRegionFromFatCurve( vLinks[i]->Clone(), m_TParams.m_dDiam / 2 + 5 * EPS_SMALL, false, false)) ;
|
||||||
pSrfTool->Add( *Release( pSrfToolRegLinki)) ;
|
pSrfTool->Add( *Release( pSrfToolRegLinki)) ;
|
||||||
@@ -3213,7 +3210,7 @@ Pocketing::OptimizedZigZag( ISurfFlatRegion* pSrf, const Vector3d& vtTool, doubl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( int i = 0 ; i < vCrvAllLoops.size() ; i++) {
|
for ( int i = 0 ; i < int( vCrvAllLoops.size()) ; i++) {
|
||||||
if ( i != nIndex) {
|
if ( i != nIndex) {
|
||||||
vFirstOffsets.emplace_back( vCrvAllLoops[i]->Clone()) ;
|
vFirstOffsets.emplace_back( vCrvAllLoops[i]->Clone()) ;
|
||||||
}
|
}
|
||||||
@@ -3221,7 +3218,7 @@ Pocketing::OptimizedZigZag( ISurfFlatRegion* pSrf, const Vector3d& vtTool, doubl
|
|||||||
|
|
||||||
// creo la superficie da svuotare ottimizzata
|
// creo la superficie da svuotare ottimizzata
|
||||||
SurfFlatRegionByContours pSrfMod ;
|
SurfFlatRegionByContours pSrfMod ;
|
||||||
for ( int i = 0 ; i < vFirstOffsets.size() ; i++)
|
for ( int i = 0 ; i < int( vFirstOffsets.size()) ; i++)
|
||||||
pSrfMod.AddCurve( vFirstOffsets[i]->Clone()) ;
|
pSrfMod.AddCurve( vFirstOffsets[i]->Clone()) ;
|
||||||
PtrOwner<ISurfFlatRegion> pSrfZigZag( GetSurfFlatRegion( pSrfMod.GetSurf())) ;
|
PtrOwner<ISurfFlatRegion> pSrfZigZag( GetSurfFlatRegion( pSrfMod.GetSurf())) ;
|
||||||
if ( IsNull( pSrfZigZag))
|
if ( IsNull( pSrfZigZag))
|
||||||
@@ -3673,7 +3670,7 @@ Pocketing::AddOneWay( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, c
|
|||||||
return false ;
|
return false ;
|
||||||
pSrfIdeal.Set( pSrfToPock->CloneChunk( c)) ;
|
pSrfIdeal.Set( pSrfToPock->CloneChunk( c)) ;
|
||||||
vChunksAvailable[c] = -1 ;
|
vChunksAvailable[c] = -1 ;
|
||||||
for ( int i = 0; i < vChunksAvailable.size(); i++) {
|
for ( int i = 0; i < int( vChunksAvailable.size()) ; i++) {
|
||||||
if ( vChunksAvailable[i] == 1) { // se chunk valido...
|
if ( vChunksAvailable[i] == 1) { // se chunk valido...
|
||||||
PtrOwner<ICurveComposite> pCrvExtC( GetCurveComposite( pSrfToPock->GetLoop( i, 0))) ;
|
PtrOwner<ICurveComposite> pCrvExtC( GetCurveComposite( pSrfToPock->GetLoop( i, 0))) ;
|
||||||
if ( IsNull( pCrvExtC))
|
if ( IsNull( pCrvExtC))
|
||||||
@@ -3697,7 +3694,7 @@ Pocketing::AddOneWay( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, c
|
|||||||
// - dOffs con le curve da percorrere all'inizio ( bordo da percorrere, senza mai superarlo)
|
// - dOffs con le curve da percorrere all'inizio ( bordo da percorrere, senza mai superarlo)
|
||||||
// - dOffs - dExtra per definire le curve interne della svuotatura ( bordo immaginario per il OneWay )
|
// - dOffs - dExtra per definire le curve interne della svuotatura ( bordo immaginario per il OneWay )
|
||||||
|
|
||||||
for ( int nIdealSurf = 0 ; nIdealSurf < vSrfFlat.size() ; nIdealSurf++) {
|
for ( int nIdealSurf = 0 ; nIdealSurf < int( vSrfFlat.size()) ; nIdealSurf++) {
|
||||||
|
|
||||||
// === PRIMO OFFSET ===
|
// === PRIMO OFFSET ===
|
||||||
PtrOwner<ISurfFlatRegion> pSrfIdeal( CloneSurfFlatRegion( vSrfFlat[nIdealSurf])->Clone()) ;
|
PtrOwner<ISurfFlatRegion> pSrfIdeal( CloneSurfFlatRegion( vSrfFlat[nIdealSurf])->Clone()) ;
|
||||||
@@ -3726,7 +3723,7 @@ Pocketing::AddOneWay( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, c
|
|||||||
Point3d ptHelp ;
|
Point3d ptHelp ;
|
||||||
|
|
||||||
// scorro tutte le curve
|
// scorro tutte le curve
|
||||||
for ( int i = 0 ; i < vAllCrv.size() ; i++) {
|
for ( int i = 0 ; i < int( vAllCrv.size()) ; i++) {
|
||||||
|
|
||||||
//se richiesto, la inverto
|
//se richiesto, la inverto
|
||||||
if ( m_Params.m_bInvert)
|
if ( m_Params.m_bInvert)
|
||||||
@@ -3742,7 +3739,7 @@ Pocketing::AddOneWay( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, c
|
|||||||
// sposto l'inizio a metà del tratto più lungo
|
// sposto l'inizio a metà del tratto più lungo
|
||||||
AdjustContourStart( vAllCrv[i]) ;
|
AdjustContourStart( vAllCrv[i]) ;
|
||||||
}
|
}
|
||||||
else if ( i < vAllCrv.size() - 1) {
|
else if ( i < int( vAllCrv.size()) - 1) {
|
||||||
// sposto l'inizio della curva più vicina al punto finale precendente
|
// sposto l'inizio della curva più vicina al punto finale precendente
|
||||||
Point3d ptS ;
|
Point3d ptS ;
|
||||||
vAllCrv[i]->GetStartPoint( ptS) ;
|
vAllCrv[i]->GetStartPoint( ptS) ;
|
||||||
@@ -3752,7 +3749,7 @@ Pocketing::AddOneWay( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, c
|
|||||||
return false ;
|
return false ;
|
||||||
dDist = INFINITO ;
|
dDist = INFINITO ;
|
||||||
|
|
||||||
for ( int j = i + 1 ; j <= vAllCrv.size() - 1 ; j++) {
|
for ( int j = i + 1 ; j <= int( vAllCrv.size()) - 1 ; j++) {
|
||||||
|
|
||||||
// cerco il punto più vicino della curva
|
// cerco il punto più vicino della curva
|
||||||
Point3d ptE ;
|
Point3d ptE ;
|
||||||
@@ -3937,7 +3934,7 @@ Pocketing::AddOneWay( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, c
|
|||||||
// riempio il vettore di segmenti
|
// riempio il vettore di segmenti
|
||||||
CRVCVECTOR ccClassSeg ;
|
CRVCVECTOR ccClassSeg ;
|
||||||
pSrfIdeal->GetCurveClassification( *pLine, EPS_SMALL, ccClassSeg) ;
|
pSrfIdeal->GetCurveClassification( *pLine, EPS_SMALL, ccClassSeg) ;
|
||||||
for ( int w = 0 ; w < ccClassSeg.size() ; w++) {
|
for ( int w = 0 ; w < int( ccClassSeg.size()) ; w++) {
|
||||||
if ( ccClassSeg[w].nClass == CRVC_IN) {
|
if ( ccClassSeg[w].nClass == CRVC_IN) {
|
||||||
|
|
||||||
PtrOwner<ICurveLine> pCrvSeg( GetCurveLine( pLine->CopyParamRange( ccClassSeg[w].dParS, ccClassSeg[w].dParE))) ;
|
PtrOwner<ICurveLine> pCrvSeg( GetCurveLine( pLine->CopyParamRange( ccClassSeg[w].dParS, ccClassSeg[w].dParE))) ;
|
||||||
@@ -4735,14 +4732,14 @@ Pocketing::CalcSpiral( const ISurfFlatRegion* pSrfPock, int nReg, Point3d ptStar
|
|||||||
// smusso le curve di offset ( ad eccezione della prima)
|
// smusso le curve di offset ( ad eccezione della prima)
|
||||||
ICRVCOMPOPOVECTOR vOffsClosedCurves( vOffs.size()) ; // vettore con tutte le curve di Offset Chiuse
|
ICRVCOMPOPOVECTOR vOffsClosedCurves( vOffs.size()) ; // vettore con tutte le curve di Offset Chiuse
|
||||||
|
|
||||||
for ( int i = 0; i < vOffs.size(); i++ ) {
|
for ( int i = 0; i < int( vOffs.size()) ; i++ ) {
|
||||||
if( i != 0)
|
if( i != 0)
|
||||||
ModifyCurveToSmooted( vOffs[i], 0.01, 0.01) ;
|
ModifyCurveToSmooted( vOffs[i], 0.01, 0.01) ;
|
||||||
vOffs[i]->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL) ;
|
vOffs[i]->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL) ;
|
||||||
vOffsClosedCurves[i].Set( vOffs[i]->Clone()) ;
|
vOffsClosedCurves[i].Set( vOffs[i]->Clone()) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( int i = 0 ; i < vOffsFirstCurve.size() ; i++ ) {
|
for ( int i = 0 ; i < int( vOffsFirstCurve.size()) ; i++ ) {
|
||||||
if( i != 0 )
|
if( i != 0 )
|
||||||
ModifyCurveToSmooted( vOffsFirstCurve[i], 0.01, 0.01) ;
|
ModifyCurveToSmooted( vOffsFirstCurve[i], 0.01, 0.01) ;
|
||||||
vOffsFirstCurve[i]->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL) ;
|
vOffsFirstCurve[i]->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL) ;
|
||||||
@@ -4750,7 +4747,7 @@ Pocketing::CalcSpiral( const ISurfFlatRegion* pSrfPock, int nReg, Point3d ptStar
|
|||||||
|
|
||||||
// setto il punto iniziale della svuotatura
|
// setto il punto iniziale della svuotatura
|
||||||
double dNewUS ;
|
double dNewUS ;
|
||||||
vOffs[0]->GetParamAtPoint( ptNewStart, dNewUS);
|
vOffs[0]->GetParamAtPoint( ptNewStart, dNewUS) ;
|
||||||
vOffs[0]->ChangeStartPoint( dNewUS) ;
|
vOffs[0]->ChangeStartPoint( dNewUS) ;
|
||||||
|
|
||||||
// riordino le curve cambiando il loro punto di inizio e creando poi i collegamenti
|
// riordino le curve cambiando il loro punto di inizio e creando poi i collegamenti
|
||||||
@@ -4759,7 +4756,7 @@ Pocketing::CalcSpiral( const ISurfFlatRegion* pSrfPock, int nReg, Point3d ptStar
|
|||||||
Point3d ptHelp ;
|
Point3d ptHelp ;
|
||||||
ICURVEPOVECTOR vLinks( vOffs.size()) ;
|
ICURVEPOVECTOR vLinks( vOffs.size()) ;
|
||||||
|
|
||||||
for ( int i = 0 ; i < vOffs.size() - 1; i++) {
|
for ( int i = 0 ; i < int( vOffs.size()) - 1 ; i++) {
|
||||||
|
|
||||||
Point3d ptS ;
|
Point3d ptS ;
|
||||||
if ( ! vOffs[i]->GetStartPoint( ptS))
|
if ( ! vOffs[i]->GetStartPoint( ptS))
|
||||||
@@ -4770,7 +4767,7 @@ Pocketing::CalcSpiral( const ISurfFlatRegion* pSrfPock, int nReg, Point3d ptStar
|
|||||||
return false ;
|
return false ;
|
||||||
dDist = INFINITO ;
|
dDist = INFINITO ;
|
||||||
|
|
||||||
for ( int j = i + 1 ; j <= vOffs.size() - 1; j++) {
|
for ( int j = i + 1 ; j <= int( vOffs.size()) - 1 ; j++) {
|
||||||
// cerco il punto più vicino della curva
|
// cerco il punto più vicino della curva
|
||||||
Point3d ptE ;
|
Point3d ptE ;
|
||||||
|
|
||||||
@@ -4842,7 +4839,7 @@ Pocketing::CalcSpiral( const ISurfFlatRegion* pSrfPock, int nReg, Point3d ptStar
|
|||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
double dUNS, dUNE, dUNEE, dLen ;
|
double dUNS, dUNE ;
|
||||||
PtrOwner<ICurveComposite> pCrvTest( CreateCurveComposite()) ;
|
PtrOwner<ICurveComposite> pCrvTest( CreateCurveComposite()) ;
|
||||||
PtrOwner<ICurveComposite> pOff_i0(CloneCurveComposite( vOffs[i])) ;
|
PtrOwner<ICurveComposite> pOff_i0(CloneCurveComposite( vOffs[i])) ;
|
||||||
PtrOwner<ICurveComposite> pOff_i1(CloneCurveComposite( vOffs[i + 1])) ;
|
PtrOwner<ICurveComposite> pOff_i1(CloneCurveComposite( vOffs[i + 1])) ;
|
||||||
@@ -4983,10 +4980,10 @@ Pocketing::ModifyCurveToSmooted( ICurveComposite* pCrv, double dRightPer, double
|
|||||||
vCrvStepsToFill.emplace_back( pMyCrvFirst->Clone()) ;
|
vCrvStepsToFill.emplace_back( pMyCrvFirst->Clone()) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
double dUE_ref, dUS_ref, dRadius, dPar1, dPar2, dULast;
|
double dUE_ref, dUS_ref, dRadius, dPar1, dPar2 ;
|
||||||
|
|
||||||
// riempio il vettore degli archi, scorro tutte le curve da raccordare ( la i-esima e la (i+1)-esima )
|
// riempio il vettore degli archi, scorro tutte le curve da raccordare ( la i-esima e la (i+1)-esima )
|
||||||
for ( int i = 0; i < vCrvStepsToFill.size() - 1; i++) {
|
for ( int i = 0; i < int( vCrvStepsToFill.size()) - 1 ; i++) {
|
||||||
|
|
||||||
// controllo che le curve non siano già tangenti
|
// controllo che le curve non siano già tangenti
|
||||||
Vector3d vtS, vtE ;
|
Vector3d vtS, vtE ;
|
||||||
@@ -5077,7 +5074,7 @@ Pocketing::ModifyCurveToSmooted( ICurveComposite* pCrv, double dRightPer, double
|
|||||||
Point3d ptArcHelp, ptFirstPoint ;
|
Point3d ptArcHelp, ptFirstPoint ;
|
||||||
|
|
||||||
// unisco la curva i-esima con l'arco i-esimo (non guardo l'ultima curva nel vettore, controllo dopo il caso di curva chiusa)
|
// unisco la curva i-esima con l'arco i-esimo (non guardo l'ultima curva nel vettore, controllo dopo il caso di curva chiusa)
|
||||||
for ( int i = 0 ; i < vCrvStepsToFill.size() -1 ; i++) {
|
for ( int i = 0 ; i < int( vCrvStepsToFill.size()) - 1 ; i++) {
|
||||||
|
|
||||||
if ( vArcsToJump[i] == -1) { // se esiste l'arco ...
|
if ( vArcsToJump[i] == -1) { // se esiste l'arco ...
|
||||||
Point3d ptArcS, ptArcE ;
|
Point3d ptArcS, ptArcE ;
|
||||||
@@ -5190,7 +5187,7 @@ Pocketing::CutCurveToConnect( ICurveComposite* pCrvS, ICurveComposite* pCrvE, IC
|
|||||||
|
|
||||||
// se ho una curva di primo Offset allora non devo accorciarla ...
|
// se ho una curva di primo Offset allora non devo accorciarla ...
|
||||||
bool bCut = true ;
|
bool bCut = true ;
|
||||||
for ( int i = 0 ; i < vFirstOffset.size() ; i++ ) {
|
for ( int i = 0 ; i < int( vFirstOffset.size()) ; i++ ) {
|
||||||
if ( vFirstOffset[i]->IsPointOn( ptSS) && vFirstOffset[i]->IsPointOn( ptSE))
|
if ( vFirstOffset[i]->IsPointOn( ptSS) && vFirstOffset[i]->IsPointOn( ptSE))
|
||||||
dLenPercS = 0 ;
|
dLenPercS = 0 ;
|
||||||
if ( vFirstOffset[i]->IsPointOn( ptES) && vFirstOffset[i]->IsPointOn( ptEE))
|
if ( vFirstOffset[i]->IsPointOn( ptES) && vFirstOffset[i]->IsPointOn( ptEE))
|
||||||
@@ -5221,7 +5218,7 @@ Pocketing::CutCurveToConnect( ICurveComposite* pCrvS, ICurveComposite* pCrvE, IC
|
|||||||
|
|
||||||
// se il BiArco creato interseca le altre curve di Offset allora mi fermo...
|
// se il BiArco creato interseca le altre curve di Offset allora mi fermo...
|
||||||
bool bInterr = false ;
|
bool bInterr = false ;
|
||||||
for ( int i = 0 ; i < vOffsCL.size() && ! bInterr ; i++) {
|
for ( int i = 0 ; i < int( vOffsCL.size()) && ! bInterr ; i++) {
|
||||||
if ( vOffsCL[i]->IsPointOn( ptSE) || vOffsCL[i]->IsPointOn( ptES))
|
if ( vOffsCL[i]->IsPointOn( ptSE) || vOffsCL[i]->IsPointOn( ptES))
|
||||||
continue ;
|
continue ;
|
||||||
|
|
||||||
@@ -5340,7 +5337,6 @@ Pocketing::RemoveExtraParts( ISurfFlatRegion* pSrfToCut, ICRVCOMPOPOVECTOR& vOff
|
|||||||
if ( ! GetNewCurvetWithPath( pCrvH1, pCrvH2, pCrvPath, vOffsFirstCurve, vOffsClosedCurves, ptCrvNewLink))
|
if ( ! GetNewCurvetWithPath( pCrvH1, pCrvH2, pCrvPath, vOffsFirstCurve, vOffsClosedCurves, ptCrvNewLink))
|
||||||
bSucc = false;
|
bSucc = false;
|
||||||
|
|
||||||
double dLen, dLenI ;
|
|
||||||
PtrOwner<ICurveComposite> pCrvPathI( pCrvPath->Clone()) ;
|
PtrOwner<ICurveComposite> pCrvPathI( pCrvPath->Clone()) ;
|
||||||
pCrvPathI->Invert() ;
|
pCrvPathI->Invert() ;
|
||||||
PtrOwner<ICurveComposite> ptCrvNewLinkI( CreateCurveComposite()) ;
|
PtrOwner<ICurveComposite> ptCrvNewLinkI( CreateCurveComposite()) ;
|
||||||
@@ -5378,9 +5374,8 @@ Pocketing::RemoveExtraParts( ISurfFlatRegion* pSrfToCut, ICRVCOMPOPOVECTOR& vOff
|
|||||||
bool bSucc = true; bool bSuccI = true;
|
bool bSucc = true; bool bSuccI = true;
|
||||||
|
|
||||||
if ( ! GetNewCurvetWithPath( pCrvH1, pCrvH2, pCrvPath, vOffsFirstCurve, vOffsClosedCurves, ptCrvNewOffs))
|
if ( ! GetNewCurvetWithPath( pCrvH1, pCrvH2, pCrvPath, vOffsFirstCurve, vOffsClosedCurves, ptCrvNewOffs))
|
||||||
bSucc == false ;
|
bSucc = false ;
|
||||||
|
|
||||||
double dLen, dLenI ;
|
|
||||||
PtrOwner<ICurveComposite> pCrvPathI( pCrvPath->Clone()) ;
|
PtrOwner<ICurveComposite> pCrvPathI( pCrvPath->Clone()) ;
|
||||||
pCrvPathI->Invert() ;
|
pCrvPathI->Invert() ;
|
||||||
PtrOwner<ICurveComposite> ptCrvNewOffsI( CreateCurveComposite()) ;
|
PtrOwner<ICurveComposite> ptCrvNewOffsI( CreateCurveComposite()) ;
|
||||||
@@ -5493,8 +5488,8 @@ Pocketing::ChoosePath( ICurveComposite* pCrv1, ICurveComposite* pCrv2, int nP, d
|
|||||||
double CR1, CR2 ;
|
double CR1, CR2 ;
|
||||||
|
|
||||||
if ( dRot1 == 0 && dRot2 == 0) {
|
if ( dRot1 == 0 && dRot2 == 0) {
|
||||||
CR1 == 0 ;
|
CR1 = 0 ;
|
||||||
CR2 == 0 ;
|
CR2 = 0 ;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CR1 = dRot1 / max( dRot1, dRot2) ;
|
CR1 = dRot1 / max( dRot1, dRot2) ;
|
||||||
@@ -5529,7 +5524,7 @@ GetClosestOffsetToAPoint( ICRVCOMPOPOVECTOR& vCurves, Point3d& ptFocus, Point3d&
|
|||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( int j = 1; j < vCurves.size(); j++ ) {
|
for ( int j = 1; j < int( vCurves.size()) ; ++ j) {
|
||||||
if ( ! DistPointCurve( ptFocus, *vCurves[j]).GetMinDistPoint( EPS_SMALL, ptCl_H, nFlag))
|
if ( ! DistPointCurve( ptFocus, *vCurves[j]).GetMinDistPoint( EPS_SMALL, ptCl_H, nFlag))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
@@ -5541,7 +5536,7 @@ GetClosestOffsetToAPoint( ICRVCOMPOPOVECTOR& vCurves, Point3d& ptFocus, Point3d&
|
|||||||
}
|
}
|
||||||
if ( ! bFirst && vCurves.size() > 1) {
|
if ( ! bFirst && vCurves.size() > 1) {
|
||||||
int nindexOld = nIndex ; dDistance = INFINITO ;
|
int nindexOld = nIndex ; dDistance = INFINITO ;
|
||||||
for ( int j = 1; j < vCurves.size(); j++ ) {
|
for ( int j = 1; j < int( vCurves.size()) ; ++ j) {
|
||||||
if ( j != nindexOld) {
|
if ( j != nindexOld) {
|
||||||
if ( ! DistPointCurve( ptFocus, *vCurves[j]).GetMinDistPoint( EPS_SMALL, ptCl_H, nFlag))
|
if ( ! DistPointCurve( ptFocus, *vCurves[j]).GetMinDistPoint( EPS_SMALL, ptCl_H, nFlag))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -5561,7 +5556,7 @@ GetClosestOffsetToAPoint( ICRVCOMPOPOVECTOR& vCurves, Point3d& ptFocus, Point3d&
|
|||||||
PtrOwner<ICurveComposite> pCrv_H( vCurves[nIndex]->Clone()) ;
|
PtrOwner<ICurveComposite> pCrv_H( vCurves[nIndex]->Clone()) ;
|
||||||
|
|
||||||
// 2) Sulle curve di Offset ricavo: vettore iniziale, finale | punto iniziale, finale
|
// 2) Sulle curve di Offset ricavo: vettore iniziale, finale | punto iniziale, finale
|
||||||
Vector3d vtTanS, vtTanE, vtHelp ; double dUTan, dLenHelp, dUS, dUE ; bool bMustUseBiArcs = false ;
|
Vector3d vtTanS, vtTanE, vtHelp ; double dUTan, dUS, dUE ; bool bMustUseBiArcs = false ;
|
||||||
|
|
||||||
if ( ! pCrv_H->GetParamAtPoint( ptCL, dUTan) || ! pCrv_H->GetDomain( dUS, dUE))
|
if ( ! pCrv_H->GetParamAtPoint( ptCL, dUTan) || ! pCrv_H->GetDomain( dUS, dUE))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -5583,7 +5578,7 @@ GetClosestLinkToAPoint( ICURVEPOVECTOR& vCurves, ICRVCOMPOPOVECTOR& vOffs, Point
|
|||||||
pCrv2->Clear() ;
|
pCrv2->Clear() ;
|
||||||
bfound = false ;
|
bfound = false ;
|
||||||
|
|
||||||
for ( int j = 1; j < vCurves.size(); j++ ) {
|
for ( int j = 1; j < int( vCurves.size()) ; ++ j) {
|
||||||
if ( ! DistPointCurve( ptFocus, *vCurves[j]).GetMinDistPoint( EPS_SMALL, ptCl_H, nFlag))
|
if ( ! DistPointCurve( ptFocus, *vCurves[j]).GetMinDistPoint( EPS_SMALL, ptCl_H, nFlag))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
@@ -5973,14 +5968,15 @@ Pocketing::RemoveExtraPartByMedialAxis( ISurfFlatRegion* pChunkToCut, ICRVCOMPOP
|
|||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
ISurfFlatRegion* pSrfChunkToCutCloneTest( pSrfBiggerChunk->Clone()) ;
|
ISurfFlatRegion* pSrfChunkToCutCloneTest( pSrfBiggerChunk->Clone()) ;
|
||||||
if ( bForceCentroid || pSrfChunkToCutCloneTest->Subtract( *pSrfTool) && ! pSrfChunkToCutCloneTest->GetArea( dArea) && dArea < 10 * EPS_SMALL) {
|
if ( bForceCentroid ||
|
||||||
|
( pSrfChunkToCutCloneTest->Subtract( *pSrfTool) && ! pSrfChunkToCutCloneTest->GetArea( dArea) && dArea < 10 * EPS_SMALL)) {
|
||||||
if ( nIter == 1) { // se alla prima iterazione svuoto tutto con il centroide ...
|
if ( nIter == 1) { // se alla prima iterazione svuoto tutto con il centroide ...
|
||||||
nOptFlag = 1 ;
|
nOptFlag = 1 ;
|
||||||
ptCentroid = ptC;
|
ptCentroid = ptC;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
else { // ... altrimenti devo prendere il centroide (che poi unirò al medil axis più vicino...)
|
else { // ... altrimenti devo prendere il centroide (che poi unirò al medil axis più vicino...)
|
||||||
for ( int cen = 0 ; cen < vPtCentroid.size(); cen++) {
|
for ( int cen = 0 ; cen < int( vPtCentroid.size()) ; ++ cen) {
|
||||||
if ( AreSamePointApprox( vPtCentroid[cen], ptC)) {
|
if ( AreSamePointApprox( vPtCentroid[cen], ptC)) {
|
||||||
pSrfChunkToCutClone->Clear() ;
|
pSrfChunkToCutClone->Clear() ;
|
||||||
break ;
|
break ;
|
||||||
@@ -6065,7 +6061,7 @@ Pocketing::RemoveExtraPartByMedialAxis( ISurfFlatRegion* pChunkToCut, ICRVCOMPOP
|
|||||||
|
|
||||||
pCrvPath->AddCurve( vCrvCoMedAxi[0]->Clone()) ; // inserisco il primo medial Axis nel percorso finale
|
pCrvPath->AddCurve( vCrvCoMedAxi[0]->Clone()) ; // inserisco il primo medial Axis nel percorso finale
|
||||||
|
|
||||||
for ( int i = 1; i < vCrvCoMedAxi.size(); i++) { // scorro i restanti
|
for ( int i = 1; i < int( vCrvCoMedAxi.size()) ; ++ i) { // scorro i restanti
|
||||||
Point3d ptS, ptE ; Vector3d vtS, vtE ; // parametri iniziali del medialAxis iesimo e (i-1)esimo
|
Point3d ptS, ptE ; Vector3d vtS, vtE ; // parametri iniziali del medialAxis iesimo e (i-1)esimo
|
||||||
if ( ! vCrvCoMedAxi[i]->GetStartPoint( ptE)
|
if ( ! vCrvCoMedAxi[i]->GetStartPoint( ptE)
|
||||||
|| ! vCrvCoMedAxi[i-1]->GetEndPoint( ptS)
|
|| ! vCrvCoMedAxi[i-1]->GetEndPoint( ptS)
|
||||||
@@ -6096,7 +6092,7 @@ Pocketing::RemoveExtraPartByMedialAxis( ISurfFlatRegion* pChunkToCut, ICRVCOMPOP
|
|||||||
// la tengo chiusa in modo da unire facilmente le circonferenze che collegheranno i vari centroidi a questa curva
|
// la tengo chiusa in modo da unire facilmente le circonferenze che collegheranno i vari centroidi a questa curva
|
||||||
|
|
||||||
// se ho trovato dei centroidi li unisco nei punti più vicino a questo percorso
|
// se ho trovato dei centroidi li unisco nei punti più vicino a questo percorso
|
||||||
for ( int i = 0; i < vPtCentroid.size(); i++) {
|
for ( int i = 0; i < int( vPtCentroid.size()) ; ++ i) {
|
||||||
|
|
||||||
// 1) cerco il punto sulla curva più vicino al centroide i
|
// 1) cerco il punto sulla curva più vicino al centroide i
|
||||||
Point3d ptClosestOnPath ; int nFlag ;
|
Point3d ptClosestOnPath ; int nFlag ;
|
||||||
@@ -6110,7 +6106,6 @@ Pocketing::RemoveExtraPartByMedialAxis( ISurfFlatRegion* pChunkToCut, ICRVCOMPOP
|
|||||||
|
|
||||||
// 3) prendo il vettore tangente al percorso nel punto PtClosestOnPath
|
// 3) prendo il vettore tangente al percorso nel punto PtClosestOnPath
|
||||||
Vector3d vtTanCpt ;
|
Vector3d vtTanCpt ;
|
||||||
double dParClosest ;
|
|
||||||
ICurveComposite* pCrvCoHelpToTan( pCrvPath->Clone()) ;
|
ICurveComposite* pCrvCoHelpToTan( pCrvPath->Clone()) ;
|
||||||
if ( ! pCrvCoHelpToTan->GetStartDir( vtTanCpt))
|
if ( ! pCrvCoHelpToTan->GetStartDir( vtTanCpt))
|
||||||
return false ;
|
return false ;
|
||||||
@@ -6171,7 +6166,7 @@ Pocketing::CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, ICRVCO
|
|||||||
|
|
||||||
// porto la curva di contenimento in locale a questo riferimento
|
// porto la curva di contenimento in locale a questo riferimento
|
||||||
vector<CurveLocal> vOffsExtr ;
|
vector<CurveLocal> vOffsExtr ;
|
||||||
for ( int i = 0 ; i < vOffIslands.size(); i++) {
|
for ( int i = 0 ; i < int( vOffIslands.size()) ; ++ i) {
|
||||||
CurveLocal CrvOutLoc( vOffIslands[i], GLOB_FRM, frLoc) ;
|
CurveLocal CrvOutLoc( vOffIslands[i], GLOB_FRM, frLoc) ;
|
||||||
vOffsExtr.push_back( CrvOutLoc) ;
|
vOffsExtr.push_back( CrvOutLoc) ;
|
||||||
}
|
}
|
||||||
@@ -6198,7 +6193,7 @@ Pocketing::CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, ICRVCO
|
|||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// scorro il vettore degli indici degli offset delle isole intersecati
|
// scorro il vettore degli indici degli offset delle isole intersecati
|
||||||
for ( int i = 0 ; i < vOffIslands.size(); i++ ) {
|
for ( int i = 0 ; i < int( vOffIslands.size()) ; i++) {
|
||||||
CRVCVECTOR ccClass ;
|
CRVCVECTOR ccClass ;
|
||||||
IntersCurveCurve intCC( *pCompo, *vOffIslands[i]) ;
|
IntersCurveCurve intCC( *pCompo, *vOffIslands[i]) ;
|
||||||
intCC.GetCurveClassification( 0, EPS_SMALL, ccClass) ;
|
intCC.GetCurveClassification( 0, EPS_SMALL, ccClass) ;
|
||||||
@@ -6292,7 +6287,7 @@ Pocketing::CalcBoundedSmootedLink( const Point3d& ptStart, const Vector3d& vtSta
|
|||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// scorro tutte le curve per controllare le intersezioni ...
|
// scorro tutte le curve per controllare le intersezioni ...
|
||||||
for ( int i = 0 ; i < vOffIslands.size(); i++) {
|
for ( int i = 0 ; i < int( vOffIslands.size()) ; i++) {
|
||||||
|
|
||||||
CRVCVECTOR ccClass ;
|
CRVCVECTOR ccClass ;
|
||||||
IntersCurveCurve intCC( *pCompo, *vOffIslands[i]) ;
|
IntersCurveCurve intCC( *pCompo, *vOffIslands[i]) ;
|
||||||
@@ -6392,8 +6387,6 @@ Pocketing::ModifyBiArc( ICurve* pBiArcLink, double dToll, ICurveComposite* pNewB
|
|||||||
if ( pArc1 == nullptr || pArc2 == nullptr)
|
if ( pArc1 == nullptr || pArc2 == nullptr)
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
double dUTollS, dUTollE ;
|
|
||||||
|
|
||||||
// primo pezzo
|
// primo pezzo
|
||||||
pArc1->GetDomain( dUS, dUE) ;
|
pArc1->GetDomain( dUS, dUE) ;
|
||||||
PtrOwner<ICurve> pArc1A( GetCurve( pArc1->CopyParamRange( dUS, dUS + ( dUE - dUS ) * dToll))) ; // Arc1
|
PtrOwner<ICurve> pArc1A( GetCurve( pArc1->CopyParamRange( dUS, dUS + ( dUE - dUS ) * dToll))) ; // Arc1
|
||||||
@@ -6433,8 +6426,8 @@ Pocketing::CutCurveByOffsets( ICurveComposite* pCurve, ICRVCOMPOPOVECTOR& vOffs)
|
|||||||
if ( vOffs.size() == 0)
|
if ( vOffs.size() == 0)
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
ICRVCOMPOPOVECTOR vOffOrig( vOffs.size());
|
ICRVCOMPOPOVECTOR vOffOrig( vOffs.size()) ;
|
||||||
for ( int i = 0; i < vOffs.size(); i++ ) {
|
for ( int i = 0; i < int( vOffs.size()) ; i++) {
|
||||||
vOffOrig[i].Set(vOffs[i]->Clone()) ;
|
vOffOrig[i].Set(vOffs[i]->Clone()) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6451,7 +6444,7 @@ Pocketing::CutCurveByOffsets( ICurveComposite* pCurve, ICRVCOMPOPOVECTOR& vOffs)
|
|||||||
int nTypeOfCut = -1 ;
|
int nTypeOfCut = -1 ;
|
||||||
bool bAttention = false ;
|
bool bAttention = false ;
|
||||||
|
|
||||||
for ( int i = 0; i < vOffOrig.size() ; i++) {
|
for ( int i = 0; i < int( vOffOrig.size()) ; i++) {
|
||||||
|
|
||||||
if ( vOffOrig[i]->IsPointOn( ptStart))
|
if ( vOffOrig[i]->IsPointOn( ptStart))
|
||||||
pOffCheck.Set( vOffOrig[i]->Clone()) ;
|
pOffCheck.Set( vOffOrig[i]->Clone()) ;
|
||||||
@@ -8149,7 +8142,7 @@ Pocketing::VerifyLeadInHelix( ISurfFlatRegion* pSrfChunk, const Point3d& ptCen,
|
|||||||
double dMinDist ;
|
double dMinDist ;
|
||||||
bool bOk = DistPointCurve( ptCenL, *pCompo).GetDist( dMinDist) && dMinDist > dRad + 0.5 * m_TParams.m_dDiam - 10 * EPS_SMALL ;
|
bool bOk = DistPointCurve( ptCenL, *pCompo).GetDist( dMinDist) && dMinDist > dRad + 0.5 * m_TParams.m_dDiam - 10 * EPS_SMALL ;
|
||||||
// se la curva per l'attacco è valida per tale, controllo che l'elica non intersechi eventuali isole
|
// se la curva per l'attacco è valida per tale, controllo che l'elica non intersechi eventuali isole
|
||||||
for ( int i = 1 ; bOk && i < vCrv.size() ; i++)
|
for ( int i = 1 ; bOk && i < int( vCrv.size()) ; i++)
|
||||||
bOk = DistPointCurve( ptCenL, *vCrv[i]).GetDist( dMinDist) && dMinDist > dRad + 0.5 * m_TParams.m_dDiam - 10 * EPS_SMALL ;
|
bOk = DistPointCurve( ptCenL, *vCrv[i]).GetDist( dMinDist) && dMinDist > dRad + 0.5 * m_TParams.m_dDiam - 10 * EPS_SMALL ;
|
||||||
return bOk ;
|
return bOk ;
|
||||||
}
|
}
|
||||||
@@ -8194,7 +8187,7 @@ Pocketing::VerifyLeadInZigZag( ISurfFlatRegion* pSrfChunk, const Point3d& ptPa,
|
|||||||
return false ;
|
return false ;
|
||||||
bool bOk = dMinDistPa > 0.5 * m_TParams.m_dDiam - 10 * EPS_SMALL && dMinDistPb > 0.5 * m_TParams.m_dDiam - 10 * EPS_SMALL ;
|
bool bOk = dMinDistPa > 0.5 * m_TParams.m_dDiam - 10 * EPS_SMALL && dMinDistPb > 0.5 * m_TParams.m_dDiam - 10 * EPS_SMALL ;
|
||||||
// se la curva per l'attacco è valida per tale, controllo che lo ZigZag non intersechi eventuali isole
|
// se la curva per l'attacco è valida per tale, controllo che lo ZigZag non intersechi eventuali isole
|
||||||
for ( int i = 1 ; bOk && i < vCrv.size() ; i++) {
|
for ( int i = 1 ; bOk && i < int( vCrv.size()) ; i++) {
|
||||||
if ( ! DistPointCurve( ptPaL, *vCrv[i]).GetDist( dMinDistPa))
|
if ( ! DistPointCurve( ptPaL, *vCrv[i]).GetDist( dMinDistPa))
|
||||||
return false ;
|
return false ;
|
||||||
if ( ! DistPointCurve( ptPbL, *vCrv[i]).GetDist( dMinDistPb))
|
if ( ! DistPointCurve( ptPbL, *vCrv[i]).GetDist( dMinDistPb))
|
||||||
|
|||||||
@@ -1564,18 +1564,6 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
|
|||||||
// La porto in globale
|
// La porto in globale
|
||||||
PL.ToGlob( frSect) ;
|
PL.ToGlob( frSect) ;
|
||||||
|
|
||||||
// Calcolo eventuale anticipo dell'inizio
|
|
||||||
double dAddStart = 0 ;
|
|
||||||
if ( m_Params.m_nLeadLinkType == SAWFIN_LL_OUT) {
|
|
||||||
BBox3d b3PL ;
|
|
||||||
PL.GetLocalBBox( b3PL) ;
|
|
||||||
double dMaxElev = min( dDepth, b3Raw.GetMax().z - b3PL.GetMin().z) ;
|
|
||||||
if ( dMaxElev > 0.0 && dMaxElev < 0.5 * m_TParams.m_dDiam)
|
|
||||||
dAddStart = sqrt( dMaxElev * m_TParams.m_dDiam - dMaxElev * dMaxElev) ;
|
|
||||||
else
|
|
||||||
dAddStart = 0.5 * m_TParams.m_dDiam ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Imposto versore fresa come Z+
|
// Imposto versore fresa come Z+
|
||||||
Vector3d vtTool = Z_AX ;
|
Vector3d vtTool = Z_AX ;
|
||||||
|
|
||||||
@@ -1857,7 +1845,6 @@ SawFinishing::ClassifySection( ICurve* pCrv, INTVECTOR& vnClass)
|
|||||||
{
|
{
|
||||||
const ICurveComposite* pCompo = GetCurveComposite( pCrv) ;
|
const ICurveComposite* pCompo = GetCurveComposite( pCrv) ;
|
||||||
if ( pCompo != nullptr) {
|
if ( pCompo != nullptr) {
|
||||||
int Ind = 0 ;
|
|
||||||
const ICurve* pSimpCrv = pCompo->GetFirstCurve() ;
|
const ICurve* pSimpCrv = pCompo->GetFirstCurve() ;
|
||||||
while ( pSimpCrv != nullptr) {
|
while ( pSimpCrv != nullptr) {
|
||||||
// analizzo la curva
|
// analizzo la curva
|
||||||
@@ -1875,7 +1862,6 @@ SawFinishing::ClassifySection( ICurve* pCrv, INTVECTOR& vnClass)
|
|||||||
else
|
else
|
||||||
vnClass.push_back( CCL_FALL) ;
|
vnClass.push_back( CCL_FALL) ;
|
||||||
// passo alla curva successiva
|
// passo alla curva successiva
|
||||||
++ Ind ;
|
|
||||||
pSimpCrv = pCompo->GetNextCurve() ;
|
pSimpCrv = pCompo->GetNextCurve() ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,16 +181,12 @@ SetupMgr::Import( const string& sFileName)
|
|||||||
m_pMchMgr->GetCurrMachGroup() == GDB_ID_NULL)
|
m_pMchMgr->GetCurrMachGroup() == GDB_ID_NULL)
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// recupero il gruppo di setup
|
|
||||||
int nSetupId = m_pMchMgr->GetCurrSetupGroupId() ;
|
|
||||||
|
|
||||||
// inizializzo lo scanner
|
// inizializzo lo scanner
|
||||||
Scanner TheScanner ;
|
Scanner TheScanner ;
|
||||||
if ( ! TheScanner.Init( sFileName, ";"))
|
if ( ! TheScanner.Init( sFileName, ";"))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
// eseguo la lettura dei campi di attrezzaggio
|
// eseguo la lettura dei campi di attrezzaggio
|
||||||
int nPos = 1 ;
|
|
||||||
string sLine ;
|
string sLine ;
|
||||||
while ( TheScanner.GetLine( sLine)) {
|
while ( TheScanner.GetLine( sLine)) {
|
||||||
// salto dichiarazione sezione
|
// salto dichiarazione sezione
|
||||||
@@ -228,8 +224,6 @@ SetupMgr::Import( const string& sFileName)
|
|||||||
stuData.m_nExit = 0 ;
|
stuData.m_nExit = 0 ;
|
||||||
m_vStuData.emplace_back( stuData) ;
|
m_vStuData.emplace_back( stuData) ;
|
||||||
}
|
}
|
||||||
// passo alla successiva posizione
|
|
||||||
++ nPos ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
|
|||||||
+163
-21
@@ -44,8 +44,11 @@ using namespace std ;
|
|||||||
static const double MIN_STEP = 1.0 ;
|
static const double MIN_STEP = 1.0 ;
|
||||||
static const double MAX_STEP = 100.0 ;
|
static const double MAX_STEP = 100.0 ;
|
||||||
static const double MID_STEP = 50.0 ;
|
static const double MID_STEP = 50.0 ;
|
||||||
|
static const double COLL_STEP = 10. ;
|
||||||
static const double COEFF_LIM = 0.999 ;
|
static const double COEFF_LIM = 0.999 ;
|
||||||
static const double SAFEDIST_STD = 5.0 ;
|
static const double SAFEDIST_STD = 5.0 ;
|
||||||
|
static const int ERR_OUTSTROKE = 1 ;
|
||||||
|
static const int ERR_COLLISION = 11 ;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
Simulator::Simulator( void)
|
Simulator::Simulator( void)
|
||||||
@@ -450,7 +453,7 @@ Simulator::UpdateTool( bool bFirst, int& nErr)
|
|||||||
int nCurrErr ;
|
int nCurrErr ;
|
||||||
if ( ! OnToolDeselect( sTool, sHead, nExit, sTcPos, nCurrErr)) {
|
if ( ! OnToolDeselect( sTool, sHead, nExit, sTcPos, nCurrErr)) {
|
||||||
nErr = ( nErr != 0 ? nErr : nCurrErr) ;
|
nErr = ( nErr != 0 ? nErr : nCurrErr) ;
|
||||||
if ( nCurrErr != 11)
|
if ( nCurrErr != ERR_COLLISION)
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -477,7 +480,7 @@ Simulator::UpdateTool( bool bFirst, int& nErr)
|
|||||||
int nCurrErr ;
|
int nCurrErr ;
|
||||||
if ( ! OnToolSelect( m_sTool, sHead, nExit, sTcPos, bFirst, nCurrErr)) {
|
if ( ! OnToolSelect( m_sTool, sHead, nExit, sTcPos, bFirst, nCurrErr)) {
|
||||||
nErr = ( nErr != 0 ? nErr : nCurrErr) ;
|
nErr = ( nErr != 0 ? nErr : nCurrErr) ;
|
||||||
if ( nCurrErr != 11)
|
if ( nCurrErr != ERR_COLLISION)
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -495,7 +498,7 @@ Simulator::UpdateTool( bool bFirst, int& nErr)
|
|||||||
int nCurrErr ;
|
int nCurrErr ;
|
||||||
if ( ! OnToolDeselect( sTool, sHead, nExit, sTcPos, nCurrErr)) {
|
if ( ! OnToolDeselect( sTool, sHead, nExit, sTcPos, nCurrErr)) {
|
||||||
nErr = ( nErr != 0 ? nErr : nCurrErr) ;
|
nErr = ( nErr != 0 ? nErr : nCurrErr) ;
|
||||||
if ( nCurrErr != 11)
|
if ( nCurrErr != ERR_COLLISION)
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -513,7 +516,7 @@ Simulator::UpdateTool( bool bFirst, int& nErr)
|
|||||||
int nCurrErr ;
|
int nCurrErr ;
|
||||||
if ( ! OnToolSelect( m_sTool, sHead, nExit, sTcPos, bFirst, nCurrErr)) {
|
if ( ! OnToolSelect( m_sTool, sHead, nExit, sTcPos, bFirst, nCurrErr)) {
|
||||||
nErr = ( nErr != 0 ? nErr : nCurrErr) ;
|
nErr = ( nErr != 0 ? nErr : nCurrErr) ;
|
||||||
if ( nCurrErr != 11)
|
if ( nCurrErr != ERR_COLLISION)
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
return ( nErr == 0) ;
|
return ( nErr == 0) ;
|
||||||
@@ -622,13 +625,14 @@ Simulator::FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus)
|
|||||||
// se lavorazione valida
|
// se lavorazione valida
|
||||||
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( m_nOpId)) ;
|
Machining* pMch = GetMachining( m_pGeomDB->GetUserObj( m_nOpId)) ;
|
||||||
if ( pMch != nullptr && ! pMch->IsEmpty()) {
|
if ( pMch != nullptr && ! pMch->IsEmpty()) {
|
||||||
|
bool bOk = true ;
|
||||||
// aggiorno utensile e assi conseguenti
|
// aggiorno utensile e assi conseguenti
|
||||||
int nErr ;
|
int nErr ;
|
||||||
if ( ! UpdateTool( bFirst, nErr)) {
|
if ( ! UpdateTool( bFirst, nErr)) {
|
||||||
string sOut = "Err=" + ToString( nErr) ;
|
string sOut = "Err=" + ToString( nErr) ;
|
||||||
LOG_INFO( GetEMkLogger(), sOut.c_str())
|
LOG_INFO( GetEMkLogger(), sOut.c_str())
|
||||||
nStatus = CalcStatusOnError( nErr) ;
|
nStatus = CalcStatusOnError( nErr) ;
|
||||||
return false ;
|
bOk = false ;
|
||||||
}
|
}
|
||||||
++ m_nOpInd ;
|
++ m_nOpInd ;
|
||||||
// imposto la lavorazione come corrente
|
// imposto la lavorazione come corrente
|
||||||
@@ -644,8 +648,10 @@ Simulator::FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus)
|
|||||||
// richiamo gestione evento inizio lavorazione
|
// richiamo gestione evento inizio lavorazione
|
||||||
if ( ! OnMachiningStart( m_nOpId, m_nOpInd, ptMin, ptMax, vAxMin, vAxMax)) {
|
if ( ! OnMachiningStart( m_nOpId, m_nOpInd, ptMin, ptMax, vAxMin, vAxMax)) {
|
||||||
nStatus = CalcStatusOnError( 0) ;
|
nStatus = CalcStatusOnError( 0) ;
|
||||||
return false ;
|
bOk = false ;
|
||||||
}
|
}
|
||||||
|
if ( ! bOk)
|
||||||
|
return false ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
// se disposizione con cambio di fase
|
// se disposizione con cambio di fase
|
||||||
@@ -1004,10 +1010,8 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
|
|||||||
if ( nMoveType != 2 && nMoveType != 3) {
|
if ( nMoveType != 2 && nMoveType != 3) {
|
||||||
// se attivo CollisionCheck approssimo movimento con più step
|
// se attivo CollisionCheck approssimo movimento con più step
|
||||||
int nStep = 1 ;
|
int nStep = 1 ;
|
||||||
if ( NeedCollisionCheck()) {
|
if ( NeedCollisionCheck())
|
||||||
const double LEN_COLL_STEP = 10. ;
|
nStep = max( int( dMove / COLL_STEP), 1) ;
|
||||||
nStep = max( int( dMove / LEN_COLL_STEP), 1) ;
|
|
||||||
}
|
|
||||||
for ( int i = 1 ; i <= nStep ; ++ i) {
|
for ( int i = 1 ; i <= nStep ; ++ i) {
|
||||||
double dCurrCoeff = dPrevCoeff + ( m_dCoeff - dPrevCoeff) / nStep * i ;
|
double dCurrCoeff = dPrevCoeff + ( m_dCoeff - dPrevCoeff) / nStep * i ;
|
||||||
DBLVECTOR vDeltaVal( m_AxesName.size()) ;
|
DBLVECTOR vDeltaVal( m_AxesName.size()) ;
|
||||||
@@ -1160,10 +1164,8 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
|
|||||||
dMove = ( m_dCoeff - dPrevCoeff) * dDist ;
|
dMove = ( m_dCoeff - dPrevCoeff) * dDist ;
|
||||||
// se attivo CollisionCheck approssimo movimento con più step
|
// se attivo CollisionCheck approssimo movimento con più step
|
||||||
int nStep = 1 ;
|
int nStep = 1 ;
|
||||||
if ( NeedCollisionCheck()) {
|
if ( NeedCollisionCheck())
|
||||||
const double LEN_COLL_STEP = 10. ;
|
nStep = max( int( dMove / COLL_STEP), 1) ;
|
||||||
nStep = max( int( dMove / LEN_COLL_STEP), 1) ;
|
|
||||||
}
|
|
||||||
for ( int i = 1 ; i <= nStep ; ++ i) {
|
for ( int i = 1 ; i <= nStep ; ++ i) {
|
||||||
double dCurrCoeff = dPrevCoeff + ( m_dCoeff - dPrevCoeff) / nStep * i ;
|
double dCurrCoeff = dPrevCoeff + ( m_dCoeff - dPrevCoeff) / nStep * i ;
|
||||||
// muovo eventuali assi ausiliari
|
// muovo eventuali assi ausiliari
|
||||||
@@ -1223,9 +1225,9 @@ Simulator::CalcStatusOnError( int nErr)
|
|||||||
{
|
{
|
||||||
if ( Stopped())
|
if ( Stopped())
|
||||||
return MCH_SIM_STOP ;
|
return MCH_SIM_STOP ;
|
||||||
else if ( nErr == 1)
|
else if ( nErr == ERR_OUTSTROKE)
|
||||||
return MCH_SIM_OUTSTROKE ;
|
return MCH_SIM_OUTSTROKE ;
|
||||||
else if ( nErr == 11)
|
else if ( nErr == ERR_COLLISION)
|
||||||
return MCH_SIM_COLLISION ;
|
return MCH_SIM_COLLISION ;
|
||||||
else
|
else
|
||||||
return MCH_SIM_ERR ;
|
return MCH_SIM_ERR ;
|
||||||
@@ -1317,8 +1319,8 @@ Simulator::ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
|
|||||||
// verifico se è l'utensile attivo
|
// verifico se è l'utensile attivo
|
||||||
string sHead ; m_pGeomDB->GetName( m_pGeomDB->GetParentId( m_CollObj[j].nFrameId), sHead) ;
|
string sHead ; m_pGeomDB->GetName( m_pGeomDB->GetParentId( m_CollObj[j].nFrameId), sHead) ;
|
||||||
string sExit ; m_pGeomDB->GetName( m_CollObj[j].nFrameId, sExit) ;
|
string sExit ; m_pGeomDB->GetName( m_CollObj[j].nFrameId, sExit) ;
|
||||||
bool bIsTool = ( sHead == m_sHead &&
|
bool bIsTool = m_CollObj[j].bToolOn ||
|
||||||
( sExit == string( "_T") + ToString( m_nExit) || sExit == string( "_TT") + ToString( m_nExit))) ;
|
( sHead == m_sHead && ( sExit == "_T" + ToString( m_nExit) || sExit == "_TT" + ToString( m_nExit))) ;
|
||||||
// se utensile attivo su grezzo in lavoro e non è rapido, salto
|
// se utensile attivo su grezzo in lavoro e non è rapido, salto
|
||||||
if ( bIsTool && bIsRaw && nMoveType != 0)
|
if ( bIsTool && bIsRaw && nMoveType != 0)
|
||||||
continue ;
|
continue ;
|
||||||
@@ -1901,7 +1903,7 @@ Simulator::OnCollision( int nCdInd, int nObjInd, int& nErr)
|
|||||||
m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_ERR, nErr) ;
|
m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_ERR, nErr) ;
|
||||||
// l'errore standard di collisione è stato portato da 1 a 11 per non collidere con altri tipi di errori
|
// l'errore standard di collisione è stato portato da 1 a 11 per non collidere con altri tipi di errori
|
||||||
if ( nErr == 1) {
|
if ( nErr == 1) {
|
||||||
nErr = 11 ;
|
nErr = ERR_COLLISION ;
|
||||||
m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ERR, nErr) ;
|
m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ERR, nErr) ;
|
||||||
}
|
}
|
||||||
return ( nErr == 0) ;
|
return ( nErr == 0) ;
|
||||||
@@ -1920,7 +1922,7 @@ Simulator::OnResetMachine( void)
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool
|
bool
|
||||||
Simulator::AddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3)
|
Simulator::AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3)
|
||||||
{
|
{
|
||||||
// verifiche sui parametri
|
// verifiche sui parametri
|
||||||
if ( nInd <= 0 || nFrameId <= GDB_ID_NULL)
|
if ( nInd <= 0 || nFrameId <= GDB_ID_NULL)
|
||||||
@@ -1946,7 +1948,7 @@ Simulator::AddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& v
|
|||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
// aggiungo al vettore
|
// aggiungo al vettore
|
||||||
m_CollObj.emplace_back( nInd, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
|
m_CollObj.emplace_back( nInd, bToolOn, nFrameId, nType, vtMove, dPar1, dPar2, dPar3) ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2040,3 +2042,143 @@ Simulator::SetToolForVmill( const string& sTool, const string& sHead, int nExit,
|
|||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
int
|
||||||
|
Simulator::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
|
||||||
|
{
|
||||||
|
// Salvo lo step di simulazione corrente
|
||||||
|
double dOrigStep = m_dStep ;
|
||||||
|
// Verifico ci siano assi da muovere
|
||||||
|
if ( vAxNaEpSt.empty())
|
||||||
|
return SIM_AXMV_RES_ERR ;
|
||||||
|
// Numero assi da muovere
|
||||||
|
int nAxCount = int( vAxNaEpSt.size()) ;
|
||||||
|
// Posizioni iniziali
|
||||||
|
DBLVECTOR vPrev( nAxCount) ;
|
||||||
|
for ( int i = 0 ; i < nAxCount ; ++ i) {
|
||||||
|
if ( ! m_pMchMgr->GetAxisPos( vAxNaEpSt[i].sName, vPrev[i]))
|
||||||
|
return SIM_AXMV_RES_ERR ;
|
||||||
|
}
|
||||||
|
// Posizione e direzione attuali degli utensili e riferimenti dei pezzi (per Vmill)
|
||||||
|
bool bExecVmill = (( nMoveType != 0 || ! NeedCollisionCheck()) && ! m_VmTool.empty() && ! m_VmId.empty()) ;
|
||||||
|
PNTVECTOR vPtNoseI ;
|
||||||
|
VCT3DVECTOR vVtDirI ;
|
||||||
|
VCT3DVECTOR vVtAuxI ;
|
||||||
|
vector<Frame3d> vFrVzmI ;
|
||||||
|
if ( bExecVmill) {
|
||||||
|
vPtNoseI.resize( m_VmTool.size()) ;
|
||||||
|
vVtDirI.resize( m_VmTool.size()) ;
|
||||||
|
vVtAuxI.resize( m_VmTool.size()) ;
|
||||||
|
vFrVzmI.resize( m_VmId.size()) ;
|
||||||
|
bool bOkI = true ;
|
||||||
|
for ( int i = 0 ; i < int( m_VmTool.size()) ; ++ i)
|
||||||
|
bOkI = GetHeadCurrPosDirAux( m_VmTool[i].sHead, m_VmTool[i].nExit, vPtNoseI[i], vVtDirI[i], vVtAuxI[i]) && bOkI ;
|
||||||
|
for ( int i = 0 ; i < int( m_VmId.size()) ; ++ i)
|
||||||
|
bOkI = m_pGeomDB->GetGlobFrame( m_VmId[i], vFrVzmI[i]) && bOkI ;
|
||||||
|
}
|
||||||
|
// Determino gli step di movimento
|
||||||
|
static const int STEP_FEED = -1 ;
|
||||||
|
static const int STEP_RAPID = -2 ;
|
||||||
|
static const int STEP_RAPROT = -3 ;
|
||||||
|
static const int STEP_COLLROT = -4 ;
|
||||||
|
int nStep = 1 ;
|
||||||
|
for ( int i = 0 ; i < nAxCount ; ++ i) {
|
||||||
|
double dMove = abs( vAxNaEpSt[i].dEndPos - vPrev[i]) ;
|
||||||
|
double dStep = vAxNaEpSt[i].dStep ;
|
||||||
|
if ( dStep < 0) {
|
||||||
|
if ( abs( dStep - STEP_FEED) < EPS_SMALL)
|
||||||
|
dStep = m_dStep ;
|
||||||
|
else if ( abs( dStep - STEP_RAPID) < EPS_SMALL)
|
||||||
|
dStep = 4 * m_dStep ;
|
||||||
|
else if ( abs( dStep - STEP_RAPROT) < EPS_SMALL)
|
||||||
|
dStep = 0.4 * m_dStep ;
|
||||||
|
else // STEP_COLLROT
|
||||||
|
dStep = min( 0.4 * m_dStep, 10.) ;
|
||||||
|
}
|
||||||
|
dStep = max( dStep, 1.) ;
|
||||||
|
int nAxStep = int( dMove / dStep) + 1 ;
|
||||||
|
nStep = max( nStep, nAxStep) ;
|
||||||
|
}
|
||||||
|
// Eseguo il movimento
|
||||||
|
for ( int i = 1 ; i <= nStep ; ++ i) {
|
||||||
|
// Muovo
|
||||||
|
bool bMoveOk = true ;
|
||||||
|
double dCoeff = double( i) / nStep ;
|
||||||
|
for ( int j = 0 ; j < nAxCount ; ++ j) {
|
||||||
|
bMoveOk = m_pMchMgr->SetAxisPos( vAxNaEpSt[j].sName, ( 1 - dCoeff) * vPrev[j] + dCoeff * vAxNaEpSt[j].dEndPos) && bMoveOk ;
|
||||||
|
}
|
||||||
|
// Eseguo eventuale Vmill
|
||||||
|
if ( bExecVmill) {
|
||||||
|
for ( int j = 0 ; j < int( m_VmTool.size()) ; ++ j) {
|
||||||
|
Point3d ptNoseF ; Vector3d vtDirF ; Vector3d vtAuxF ;
|
||||||
|
bool bOkF = GetHeadCurrPosDirAux( m_VmTool[j].sHead, m_VmTool[j].nExit, ptNoseF, vtDirF, vtAuxF) ;
|
||||||
|
for ( int k = 0 ; k < int( m_VmId.size()) ; ++ k) {
|
||||||
|
Frame3d frVzmF ;
|
||||||
|
bOkF = m_pGeomDB->GetGlobFrame( m_VmId[k], frVzmF) && bOkF ;
|
||||||
|
ExecLineVmill( m_VmId[k], j, m_VmTool[j].dTdOffs, m_VmTool[j].dAdOffs,
|
||||||
|
vPtNoseI[j], vVtDirI[j], vVtAuxI[j], vFrVzmI[k], ptNoseF, vtDirF, vtAuxF, frVzmF) ;
|
||||||
|
// se ultimo utensile, salvo riferimento per prossimo inizio
|
||||||
|
if ( j == int( m_VmTool.size()) - 1)
|
||||||
|
vFrVzmI[k] = frVzmF ;
|
||||||
|
}
|
||||||
|
// aggiorno prossimo inizio
|
||||||
|
vPtNoseI[j] = ptNoseF ;
|
||||||
|
vVtDirI[j] = vtDirF ;
|
||||||
|
vVtAuxI[j] = vtAuxF ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Aggiorno visualizzazione
|
||||||
|
ExeDraw() ;
|
||||||
|
// Verifico collisioni
|
||||||
|
int nCdInd, nObjInd ;
|
||||||
|
bool bCollCheck = ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ;
|
||||||
|
if ( ! bCollCheck) {
|
||||||
|
// Richiamo funzione di convalida collisione
|
||||||
|
int nPrevErr ;
|
||||||
|
m_pMachine->LuaGetGlobVar( GLOB_VAR + GVAR_ERR, nPrevErr) ;
|
||||||
|
int nErr ;
|
||||||
|
if ( ! OnCollision( nCdInd, nObjInd, nErr) && nErr == ERR_COLLISION) {
|
||||||
|
m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ERR, nErr) ;
|
||||||
|
if ( ExeGetEnableUI()) {
|
||||||
|
// Box di messaggio : Collisione! AVVERTIMENTO
|
||||||
|
ExeMessageBox( ExeGetMsg( 5319), ExeGetMsg( 5315), MB_OK | MB_ICONWARNING) ;
|
||||||
|
// Gestione Pausa
|
||||||
|
m_nUiStatus = MCH_UISIM_PAUSE ;
|
||||||
|
while ( m_nUiStatus == MCH_UISIM_PAUSE) {
|
||||||
|
// -11 notifica al simulatore pausa dopo collisione
|
||||||
|
ExeProcessEvents( -11, 4) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_ERR, nPrevErr) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// In caso di errore esco
|
||||||
|
if ( ! bMoveOk)
|
||||||
|
return SIM_AXMV_RES_ERR ;
|
||||||
|
// Gestione aggiornamenti...
|
||||||
|
if ( ExeGetEnableUI()) {
|
||||||
|
// Aggiornamento interfaccia
|
||||||
|
ExeProcessEvents( 0, 4) ;
|
||||||
|
while ( m_nUiStatus == MCH_UISIM_PAUSE) {
|
||||||
|
ExeProcessEvents( 0, 4) ;
|
||||||
|
}
|
||||||
|
// Gestione Stop
|
||||||
|
if ( m_nUiStatus == MCH_UISIM_STOP)
|
||||||
|
return SIM_AXMV_RES_STOP ;
|
||||||
|
// Se cambia lo step di simulazione in modo significativo ...
|
||||||
|
if ( abs( m_dStep - dOrigStep) > 10 || abs( ( m_dStep - dOrigStep) / ( m_dStep + dOrigStep)) > 0.2) {
|
||||||
|
double dRat = m_dStep / dOrigStep ;
|
||||||
|
for ( int j = 0 ; j < nAxCount ; ++ j) {
|
||||||
|
if ( vAxNaEpSt[j].dStep > 0)
|
||||||
|
const_cast<double&>( vAxNaEpSt[j].dStep) *= dRat ;
|
||||||
|
}
|
||||||
|
return MoveAxes( nMoveType, vAxNaEpSt) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return SIM_AXMV_RES_OK ;
|
||||||
|
}
|
||||||
|
|||||||
+25
-10
@@ -1,7 +1,7 @@
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// EgalTech 2015-2015
|
// EgalTech 2015-2023
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// File : Simulator.h Data : 19.10.15 Versione : 1.6j2
|
// File : Simulator.h Data : 16.01.23 Versione : 2.5a2
|
||||||
// Contenuto : Dichiarazione della classe Simulator.
|
// Contenuto : Dichiarazione della classe Simulator.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@@ -21,6 +21,21 @@ class IGeomDB ;
|
|||||||
class Machine ;
|
class Machine ;
|
||||||
class PerformanceCounter ;
|
class PerformanceCounter ;
|
||||||
|
|
||||||
|
//------------------------ Struttura per movimento esterno assi --------------
|
||||||
|
struct SimAxMv
|
||||||
|
{
|
||||||
|
std::string sName ;
|
||||||
|
double dEndPos ;
|
||||||
|
double dStep ;
|
||||||
|
SimAxMv( void) : dEndPos( 0), dStep( 0) { }
|
||||||
|
SimAxMv( std::string sN, double dE, double dS) : sName( sN), dEndPos( dE), dStep( dS) {}
|
||||||
|
} ;
|
||||||
|
typedef std::vector<SimAxMv> SAMVECTOR ;
|
||||||
|
|
||||||
|
//------------------------ Risultato movimento esterno assi -------------------
|
||||||
|
enum SimAxMvRes { SIM_AXMV_RES_STOP = -1,
|
||||||
|
SIM_AXMV_RES_ERR = 0,
|
||||||
|
SIM_AXMV_RES_OK = 1} ;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
class Simulator
|
class Simulator
|
||||||
@@ -38,10 +53,11 @@ class Simulator
|
|||||||
bool GetToolInfo( std::string& sName, double& dSpeed) const ;
|
bool GetToolInfo( std::string& sName, double& dSpeed) const ;
|
||||||
bool GetOperationInfo( std::string& sName, int& nType) const ;
|
bool GetOperationInfo( std::string& sName, int& nType) const ;
|
||||||
bool GetMoveInfo( int& nGmove, double& dFeed) const ;
|
bool GetMoveInfo( int& nGmove, double& dFeed) const ;
|
||||||
bool AddCollisionObj( int nInd, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
|
bool AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, const Vector3d& vtMove, double dPar1, double dPar2, double dPar3) ;
|
||||||
bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ;
|
bool ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType) ;
|
||||||
bool OnCollision( int nCdInd, int nObjInd, int& nErr) ;
|
bool OnCollision( int nCdInd, int nObjInd, int& nErr) ;
|
||||||
bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst) ;
|
bool SetToolForVmill( const std::string& sTool, const std::string& sHead, int nExit, const INTVECTOR& vVmill, bool bFirst) ;
|
||||||
|
int MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt) ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
bool UpdateTool( bool bFirst, int& nErr) ;
|
bool UpdateTool( bool bFirst, int& nErr) ;
|
||||||
@@ -95,17 +111,18 @@ class Simulator
|
|||||||
private :
|
private :
|
||||||
struct CollObj {
|
struct CollObj {
|
||||||
int nInd ;
|
int nInd ;
|
||||||
|
bool bToolOn ;
|
||||||
int nFrameId ;
|
int nFrameId ;
|
||||||
int nType ;
|
int nType ;
|
||||||
Vector3d vtMove ;
|
Vector3d vtMove ;
|
||||||
double dPar1 ;
|
double dPar1 ;
|
||||||
double dPar2 ;
|
double dPar2 ;
|
||||||
double dPar3 ;
|
double dPar3 ;
|
||||||
CollObj( void) : nInd( 0), nFrameId( -1), nType( 0), vtMove(), dPar1( 0), dPar2( 0), dPar3( 0) {}
|
CollObj( void) : nInd( 0), bToolOn( false), nFrameId( -1), nType( 0), vtMove(), dPar1( 0), dPar2( 0), dPar3( 0) {}
|
||||||
CollObj( int nI, int nF, int nT, const Vector3d& vtM, double dP1, double dP2, double dP3)
|
CollObj( int nI, bool bTOn, int nF, int nT, const Vector3d& vtM, double dP1, double dP2, double dP3)
|
||||||
: nInd( nI), nFrameId( nF), nType( nT), vtMove( vtM), dPar1( dP1), dPar2( dP2), dPar3( dP3) {}
|
: nInd( nI), bToolOn( bTOn), nFrameId( nF), nType( nT), vtMove( vtM), dPar1( dP1), dPar2( dP2), dPar3( dP3) {}
|
||||||
} ;
|
} ;
|
||||||
typedef std::vector< CollObj> COBVECTOR ;
|
typedef std::vector<CollObj> COBVECTOR ;
|
||||||
struct VmTool
|
struct VmTool
|
||||||
{
|
{
|
||||||
std::string sName ;
|
std::string sName ;
|
||||||
@@ -117,7 +134,7 @@ class Simulator
|
|||||||
VmTool( std::string sN, std::string sH, int nE, double dT, double dA)
|
VmTool( std::string sN, std::string sH, int nE, double dT, double dA)
|
||||||
: sName( sN), sHead( sH), nExit( nE), dTdOffs( dT), dAdOffs( dA) {}
|
: sName( sN), sHead( sH), nExit( nE), dTdOffs( dT), dAdOffs( dA) {}
|
||||||
} ;
|
} ;
|
||||||
typedef std::vector< VmTool> VMTVECTOR ;
|
typedef std::vector<VmTool> VMTVECTOR ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
|
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
|
||||||
@@ -143,8 +160,6 @@ class Simulator
|
|||||||
double m_dTDiam ; // diametro dell'utensile corrente
|
double m_dTDiam ; // diametro dell'utensile corrente
|
||||||
INTVECTOR m_VmId ; // vettore identificativi Zmap per Virtual Milling
|
INTVECTOR m_VmId ; // vettore identificativi Zmap per Virtual Milling
|
||||||
INTVECTOR m_CdId ; // vettore identificativi Zmap per Collision Detection
|
INTVECTOR m_CdId ; // vettore identificativi Zmap per Collision Detection
|
||||||
//double m_dVmTdOffs ; // offset utensile in direzione principale per VM
|
|
||||||
//double m_dVmAdOffs ; // offset utensile in direzione ausiliaria per VM
|
|
||||||
VMTVECTOR m_VmTool ; // vettore utensili attivi per virtual milling
|
VMTVECTOR m_VmTool ; // vettore utensili attivi per virtual milling
|
||||||
COBVECTOR m_CollObj ; // vettore oggetti da testare per collisione con grezzo
|
COBVECTOR m_CollObj ; // vettore oggetti da testare per collisione con grezzo
|
||||||
double m_dSafeDist ; // distanza di sicurezza per verifica collisioni
|
double m_dSafeDist ; // distanza di sicurezza per verifica collisioni
|
||||||
|
|||||||
Reference in New Issue
Block a user