Compare commits
58 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a1113ad94c | |||
| c321205086 | |||
| 33f969a254 | |||
| aad600faca | |||
| caee6ccb83 | |||
| 839639fcc8 | |||
| c3729befbb | |||
| a79d9c9fe8 | |||
| 0980e10c33 | |||
| 85258fe4c4 | |||
| d3b281a858 | |||
| 37d0b8f552 | |||
| ecc2c66fac | |||
| 97a0aed32c | |||
| 737124b0bd | |||
| 09bdd4852d | |||
| 1d3c722fd3 | |||
| 3ca2db72e9 | |||
| c23c975275 | |||
| b9e0c6e7e3 | |||
| 028a5b7bba | |||
| dd28529753 | |||
| 9d471f4647 | |||
| 1179ad7e84 | |||
| 6c8d1931f3 | |||
| 7f8798a159 | |||
| 443fac5f0f | |||
| 84fc7b0dc3 | |||
| 4f64b1efc2 | |||
| 9c09f30f08 | |||
| e10f917bab | |||
| d8c5fe0ea7 | |||
| a21be79df8 | |||
| 073c5f737e | |||
| d57198ac19 | |||
| ea20040495 | |||
| 6adad38ffa | |||
| bac737ee53 | |||
| 4ae515befd | |||
| d66cc47936 | |||
| cd2315af46 | |||
| 58b119c68f | |||
| 204d63b7c9 | |||
| 5a5b48326f | |||
| bd448babd9 | |||
| 28e76415ed | |||
| c163fe503e | |||
| c928a50243 | |||
| ac8feb7a17 | |||
| 8ae1d4cdc2 | |||
| d684f6fb82 | |||
| 0cbf148bb6 | |||
| 73ba4eb93a | |||
| 268fa05cc0 | |||
| ee9a446cc0 | |||
| 2e1d893d5d | |||
| cdfa857c02 | |||
| 511d1c0aef |
+89
-45
@@ -616,6 +616,12 @@ Drilling::Apply( bool bRecalc, bool bPostApply)
|
||||
nDblId = GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
// rendo corrente l'utensile usato nella lavorazione
|
||||
if ( ! m_pMchMgr->SetCalcTool( m_TParams.m_sName, m_TParams.m_sHead, m_TParams.m_nExit)) {
|
||||
m_pMchMgr->SetLastError( 2322, "Error in Milling : Tool loading failed") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// se lavorazione standard
|
||||
if ( m_Params.m_nSubType == DRI_SUB_STD) {
|
||||
if ( ! StandardProcess( bRecalc, GDB_ID_NULL, nClId))
|
||||
@@ -712,28 +718,57 @@ Drilling::Update( bool bPostApply)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::VerifyMultiParallelFixedDrills( void)
|
||||
{
|
||||
// se aggregato da sotto, sicuramente con una sola punta
|
||||
bool bAggrBottom = IsAggrBottom( m_TParams.m_sHead) ;
|
||||
if ( bAggrBottom)
|
||||
return false ;
|
||||
// se una sola uscita, inutile continuare
|
||||
int nExitCnt = m_pMchMgr->GetCurrMachine()->GetHeadExitCount( m_TParams.m_sHead) ;
|
||||
if ( nExitCnt == 1)
|
||||
return false ;
|
||||
// verifico che le uscite siano fisse
|
||||
int nSelectType = m_pMchMgr->GetCurrMachine()->GetHeadSelectType( m_TParams.m_sHead) ;
|
||||
if ( nSelectType != MCH_SLT_FIXEDEXITS)
|
||||
return false ;
|
||||
// recupero la direzione dell'utensile principale
|
||||
Point3d ptMainExit ; Vector3d vtMainTool, vtMainAux ;
|
||||
m_pMchMgr->GetCurrMachine()->GetHeadExitPosDirAux( m_TParams.m_sHead, m_TParams.m_nExit, ptMainExit, vtMainTool, vtMainAux) ;
|
||||
// verifico ci sia almeno un'altra uscita attrezzata parallela a quella principale
|
||||
for ( int nT = 0 ; nT < nExitCnt ; ++ nT) {
|
||||
if ( nT + 1 == m_TParams.m_nExit)
|
||||
continue ;
|
||||
string sToolName ;
|
||||
if ( m_pMchMgr->GetLoadedTool( m_TParams.m_sHead, nT + 1, sToolName) && ! sToolName.empty()) {
|
||||
Point3d ptExit ; Vector3d vtTool, vtAux ;
|
||||
if ( m_pMchMgr->GetCurrMachine()->GetHeadExitPosDirAux(m_TParams.m_sHead, nT + 1, ptExit, vtTool, vtAux) &&
|
||||
AreSameVectorApprox( vtTool, vtMainTool))
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// non è stato trovato niente
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId)
|
||||
{
|
||||
// controllo se ho più uscite
|
||||
string sCurrHead ;
|
||||
if ( ! m_pMchMgr->GetCurrMachine()->GetCurrHead( sCurrHead))
|
||||
return false ;
|
||||
int nExitCnt = m_pMchMgr->GetCurrMachine()->GetHeadExitCount( sCurrHead) ;
|
||||
TABMHDRILL tabDrills ;
|
||||
double dMHOff = 0 ;
|
||||
// se ho più uscite...
|
||||
if ( nExitCnt > 1) {
|
||||
if ( ! MultiHeadDrilling( nExitCnt, m_vId, nClId, tabDrills, dMHOff))
|
||||
// se ho almeno un'altra punta fissa parallela alla principale ...
|
||||
if ( VerifyMultiParallelFixedDrills()) {
|
||||
TABMHDRILL tabDrills ;
|
||||
double dMHOff = 0 ;
|
||||
if ( ! MultiHeadDrilling( m_vId, nClId, tabDrills, dMHOff))
|
||||
return false ;
|
||||
if( tabDrills.size() == 0)
|
||||
if ( tabDrills.empty())
|
||||
return true ;
|
||||
int j = 0 ;
|
||||
for ( int i = 0 ; i < ( int)tabDrills.size() ; ++i) {
|
||||
// se richiesto preview
|
||||
if ( nPvId != GDB_ID_NULL) {
|
||||
if ( ! GenerateHolePv( j, m_vId[tabDrills[i][0].nInd_id_hole], MCH_PATH, nClId))
|
||||
if ( ! GenerateHolePv( i, m_vId[tabDrills[i][0].nInd_id_hole], MCH_PATH, nClId))
|
||||
return false ;
|
||||
// creo la regione di ingombro del foro
|
||||
int nDriId = m_pGeomDB->GetFirstInGroup( m_pGeomDB->GetLastGroupInGroup( nPvId)) ;
|
||||
@@ -741,17 +776,15 @@ Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId)
|
||||
}
|
||||
// se richiesta lavorazione
|
||||
if ( nClId != GDB_ID_NULL) {
|
||||
if ( ! GenerateHoleCl( j, m_vId[tabDrills[i][0].nInd_id_hole], MCH_PATH, nClId, dMHOff, tabDrills[i][0].vtAux))
|
||||
if ( ! GenerateHoleCl( i, m_vId[tabDrills[i][0].nInd_id_hole], MCH_PATH, nClId, dMHOff, tabDrills[i][0].vtAux))
|
||||
return false ;
|
||||
}
|
||||
// incremento indice
|
||||
++j ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
// ... altrimenti elaboro i singoli fori
|
||||
int i = 0 ;
|
||||
for ( const auto& vId : m_vId) {
|
||||
for ( int i = 0 ; i < int( m_vId.size()) ; ++ i) {
|
||||
const auto& vId = m_vId[i] ;
|
||||
// se richiesto preview
|
||||
if ( nPvId != GDB_ID_NULL) {
|
||||
if ( ! GenerateHolePv( i, vId, MCH_PATH, nPvId))
|
||||
@@ -765,8 +798,6 @@ Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId)
|
||||
if ( ! GenerateHoleCl( i, vId, MCH_PATH, nClId))
|
||||
return false ;
|
||||
}
|
||||
// incremento indice
|
||||
++i ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
@@ -774,29 +805,29 @@ Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::MultiHeadDrilling( int nExitCnt, const SELVECTOR& vId, int nClId, TABMHDRILL& tabDrills, double& dMHOff, bool bOrd)
|
||||
Drilling::MultiHeadDrilling( const SELVECTOR& vId, int nClId, TABMHDRILL& tabDrills, double& dMHOff, bool bOrd)
|
||||
{
|
||||
// controllo parametri
|
||||
tabDrills.clear() ;
|
||||
if ( vId.empty())
|
||||
return true ;
|
||||
|
||||
// recupero il nome della testa
|
||||
string sHead ;
|
||||
m_pMchMgr->GetCurrMachine()->GetCurrHead( sHead) ;
|
||||
|
||||
// gestore degli utensili
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
if ( pTMgr == nullptr)
|
||||
return false ;
|
||||
|
||||
// recupero il nome della testa e il numero di uscite
|
||||
string sHead ;
|
||||
m_pMchMgr->GetCurrMachine()->GetCurrHead( sHead) ;
|
||||
int nExitCnt = m_pMchMgr->GetCurrMachine()->GetHeadExitCount( sHead) ;
|
||||
|
||||
// Recupero i dati degli utensili montati sulla testa
|
||||
int nMainToolInd = -1 ;
|
||||
VECTORTOOL vTools ; vTools.reserve( nExitCnt) ;
|
||||
// ricavo gli utensili presenti sulle uscite
|
||||
for ( int nT = 0 ; nT < nExitCnt ; ++ nT) {
|
||||
string sToolName ;
|
||||
ToolInfo TInf ;
|
||||
if ( ! m_pMchMgr->GetLoadedTool( sHead, nT + 1, sToolName) || sToolName.empty()) {
|
||||
// non c'è utensile
|
||||
vTools.emplace_back( nullptr) ;
|
||||
@@ -816,9 +847,23 @@ Drilling::MultiHeadDrilling( int nExitCnt, const SELVECTOR& vId, int nClId, TABM
|
||||
return false ;
|
||||
}
|
||||
|
||||
// carico i dati della testa con le sue uscite
|
||||
// recupero i dati dell'uscita dell'utensile principale
|
||||
Vector3d vtTool, vtAux ;
|
||||
Point3d ptExit ;
|
||||
m_pMchMgr->GetCurrMachine()->GetHeadExitPosDirAux( sHead, nMainToolInd + 1, ptExit, vtTool, vtAux) ;
|
||||
vTools[nMainToolInd].ptToolTip = ptExit - vtTool * vTools[nMainToolInd].pTool->m_dLen ;
|
||||
if ( vtAux.IsSmall() && m_pMchMgr->GetCurrMachine()->GetCurrRotAxes() == 0)
|
||||
vtAux = FromUprightOrtho( vtTool) ;
|
||||
if ( vtTool.IsSmall() || vtAux.IsSmall()) {
|
||||
m_pMchMgr->SetLastError( 2117, "Error in Drilling : incorrect multi drilling head") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// carico gli altri dati della testa con le sue uscite
|
||||
for ( int nT = 0 ; nT < nExitCnt ; ++ nT) {
|
||||
// se utensile principale, salto al successivo
|
||||
if ( nT == nMainToolInd)
|
||||
continue ;
|
||||
// se non attrezzato, salto al successivo
|
||||
if ( vTools[nT].pTool == nullptr)
|
||||
continue ;
|
||||
@@ -826,26 +871,14 @@ Drilling::MultiHeadDrilling( int nExitCnt, const SELVECTOR& vId, int nClId, TABM
|
||||
Point3d ptExit ;
|
||||
Vector3d vtCurrDir, vtCurrAux ;
|
||||
m_pMchMgr->GetCurrMachine()->GetHeadExitPosDirAux( sHead, nT + 1, ptExit, vtCurrDir, vtCurrAux) ;
|
||||
// se utensile successivo
|
||||
if ( ! vtTool.IsSmall()) {
|
||||
// controllo abbia la stessa direzione dei precedenti, altrimenti errore
|
||||
if ( ! AreSameVectorApprox( vtCurrDir, vtTool)) {
|
||||
vtTool = V_NULL ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
// altrimenti primo utensile
|
||||
else {
|
||||
vtTool = vtCurrDir ;
|
||||
vtAux = vtCurrAux ;
|
||||
// controllo abbia la stessa direzione del principale, altrimenti disattrezzo
|
||||
if ( ! AreSameVectorApprox( vtCurrDir, vtTool)) {
|
||||
vTools[nT].pTool = nullptr ;
|
||||
continue ;
|
||||
}
|
||||
// assegno tip utensile
|
||||
vTools[nT].ptToolTip = ptExit - vtCurrDir * vTools[nT].pTool->m_dLen ;
|
||||
}
|
||||
if ( vtTool.IsSmall() || vtAux.IsSmall()) {
|
||||
m_pMchMgr->SetLastError( 2117, "Error in Drilling : incorrect multi drilling head") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Recupero le geometrie dei fori
|
||||
bool bSomeHoleOk = false ;
|
||||
@@ -886,7 +919,7 @@ Drilling::MultiHeadDrilling( int nExitCnt, const SELVECTOR& vId, int nClId, TABM
|
||||
// i fori con dimensione 0 del vettore vToolHole non possono essere lavorati
|
||||
int nNoDrillHoles = 0 ;
|
||||
for ( int i = 0 ; i < ( int)vHoles.size() ; ++ i) {
|
||||
if ( vHoles[i].vToolHole.size() == 0)
|
||||
if ( vHoles[i].vToolHole.empty())
|
||||
++ nNoDrillHoles ;
|
||||
}
|
||||
|
||||
@@ -897,10 +930,19 @@ Drilling::MultiHeadDrilling( int nExitCnt, const SELVECTOR& vId, int nClId, TABM
|
||||
// numero di fori lavorati
|
||||
int nOkHole = 0 ;
|
||||
|
||||
// se c'è un solo foro va sicuramente bene
|
||||
if ( vHoles.size() == 1 && ! vHoles[0].vVtAux.empty()) {
|
||||
vHoles[0].bForToolM = true ;
|
||||
vHoles[0].nIndTool = nMainToolInd ;
|
||||
vHoles[0].nIndHoleToolM = 0 ;
|
||||
vHoles[0].vtAux = vHoles[0].vVtAux[0] ;
|
||||
}
|
||||
|
||||
// decido in quali fori inserire il tool principale
|
||||
for ( int nCheck = 1 ; nCheck < ( int)vHoles.size() && nOkHole < ( int)vHoles.size() - nNoDrillHoles ; ++ nCheck) {
|
||||
for ( int i = 0 ; i < ( int)vHoles.size() ; ++i) {
|
||||
if ( vHoles[i].vToolHole.size() == nCheck && ! vHoles[i].bDrill) { // prendo tutti i fori con vToolHope di lunghezza nCheck non già svuotati
|
||||
// prendo tutti i fori con vToolHope di lunghezza nCheck non già lavorati
|
||||
if ( vHoles[i].vToolHole.size() == nCheck && ! vHoles[i].bDrill) {
|
||||
vHoles[vHoles[i].vToolHole[0]].bForToolM = true ;
|
||||
vHoles[vHoles[i].vToolHole[0]].nIndTool = nMainToolInd ;
|
||||
vHoles[vHoles[i].vToolHole[0]].nIndHoleToolM = vHoles[i].vToolHole[0] ;
|
||||
@@ -1055,6 +1097,8 @@ Drilling::CalcMask( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndMT, co
|
||||
// nuova configurazione del versore A ottenuta
|
||||
if ( ! m_pMchMgr->GetCalcAuxDirFromAngles( vAng1, vtAnew))
|
||||
continue ;
|
||||
if ( vtAnew.IsSmall() && m_pMchMgr->GetCurrMachine()->GetCurrRotAxes() == 0)
|
||||
vtAnew = vtAux ;
|
||||
|
||||
// creo un nuovo sistema di riferimento centrato nel Tool principale
|
||||
Frame3d frMT ;
|
||||
|
||||
+2
-1
@@ -86,11 +86,12 @@ class Drilling : public Machining
|
||||
bool VerifyHoleFromBottom( const Hole& hole, SelData Id) ;
|
||||
bool DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double nMHOff, Vector3d vtA) ;
|
||||
bool DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) ;
|
||||
bool MultiHeadDrilling( int nExitCnt, const SELVECTOR& vId, int nClId, TABMHDRILL& vDrills, double& dMHOff, bool bOrd = true) ;
|
||||
bool MultiHeadDrilling( const SELVECTOR& vId, int nClId, TABMHDRILL& vDrills, double& dMHOff, bool bOrd = true) ;
|
||||
bool CalcMask( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndMT, const Vector3d& vtTool, const Vector3d& vtAux) ;
|
||||
bool CheckOtherHolesWithTools( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndTM, int nIndHTM, Hole holeICP,
|
||||
const Frame3d& frHTM, const Frame3d& frHMTOP, double dDiamToler, int& nDrills) ;
|
||||
bool MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamToler, SelData Id) ;
|
||||
bool VerifyMultiParallelFixedDrills( void) ;
|
||||
|
||||
private :
|
||||
double GetSpeed() const
|
||||
|
||||
Binary file not shown.
@@ -103,7 +103,7 @@ Head::GetGeomDB( void) const
|
||||
//----------------------------------------------------------------------------
|
||||
Head::Head( void)
|
||||
: m_nOwnerId( GDB_ID_NULL), m_pGeomDB( nullptr), m_nType( MCH_HT_NONE), m_nExitCount( 0),
|
||||
m_dRot1W( 1), m_bMaxDeltaR2On1( true), m_nSolCh( MCH_SCC_NONE)
|
||||
m_nSelectType( MCH_SLT_FIXEDEXITS), m_dRot1W( 1), m_bMaxDeltaR2On1( true), m_nSolCh( MCH_SCC_NONE)
|
||||
{
|
||||
m_Rot2Stroke.Min = - INFINITO ;
|
||||
m_Rot2Stroke.Max = INFINITO ;
|
||||
@@ -111,7 +111,7 @@ Head::Head( void)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet, const Vector3d& vtADir,
|
||||
Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet, int nSelectType, const Vector3d& vtADir,
|
||||
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl)
|
||||
{
|
||||
m_sName = sName ;
|
||||
@@ -122,6 +122,10 @@ Head::Set( const string& sName, int nType, int nExitCount, const string& sHSet,
|
||||
m_nExitCount = 1 ;
|
||||
m_vsHSet.clear() ;
|
||||
m_vsHSet.push_back( sHSet) ;
|
||||
if ( nSelectType == MCH_SLT_FIXEDEXITS || nSelectType == MCH_SLT_ONEEXIT || nSelectType == MCH_SLT_MULTIEXITS)
|
||||
m_nSelectType = nSelectType ;
|
||||
else
|
||||
m_nSelectType = MCH_SLT_FIXEDEXITS ;
|
||||
m_vtADir = vtADir ;
|
||||
m_vtADir.Normalize() ;
|
||||
m_dRot1W = dRot1W ;
|
||||
|
||||
@@ -30,7 +30,7 @@ class Head : public IUserObj
|
||||
|
||||
public :
|
||||
Head( void) ;
|
||||
bool Set( const std::string& sName, int nType, int nExitCount, const std::string& sHSet,
|
||||
bool Set( const std::string& sName, int nType, int nExitCount, const std::string& sHSet, int nSelectType,
|
||||
const Vector3d& vtADir, double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh,
|
||||
const STRVECTOR& vsOthColl) ;
|
||||
bool AddHeadToHSet( const std::string& sHead) ;
|
||||
@@ -43,6 +43,8 @@ class Head : public IUserObj
|
||||
{ return m_nExitCount ; }
|
||||
const STRVECTOR& GetHSet(void) const
|
||||
{ return m_vsHSet ; }
|
||||
int GetSelectType( void) const
|
||||
{ return m_nSelectType ; }
|
||||
const Vector3d& GetADir( void) const
|
||||
{ return m_vtADir ; }
|
||||
double GetRot1W( void) const
|
||||
@@ -63,6 +65,7 @@ class Head : public IUserObj
|
||||
int m_nType ;
|
||||
int m_nExitCount ;
|
||||
STRVECTOR m_vsHSet ;
|
||||
int m_nSelectType ;
|
||||
Vector3d m_vtADir ;
|
||||
double m_dRot1W ;
|
||||
bool m_bMaxDeltaR2On1 ;
|
||||
|
||||
@@ -99,6 +99,7 @@ class MachMgr : public IMachMgr
|
||||
int AddMachGroup( const std::string& sName, const std::string& sMachineName) override ;
|
||||
int CopyMachGroup( const std::string& sSouName, const std::string& sName) override ;
|
||||
bool RemoveMachGroup( int nId) override ;
|
||||
bool ChangeMachGroupName( int nId, const std::string& sNewName) override ;
|
||||
std::string GetMachGroupName( int nId) const override ;
|
||||
std::string GetMachGroupMachineName( int nId) const override ;
|
||||
int GetMachGroupId( const std::string& sName) const override ;
|
||||
@@ -439,6 +440,8 @@ class MachMgr : public IMachMgr
|
||||
bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ;
|
||||
bool GetCurrAxisHomePos( int nInd, double& dHome) const ;
|
||||
const Frame3d& GetCurrLinAxesFrame( void) const ;
|
||||
bool GetCurrIsCenter( void) const ;
|
||||
bool GetCurrIsRobot( void) const ;
|
||||
bool ApplyRotAxisBlock( void) ;
|
||||
void ClearRotAxisBlock( void)
|
||||
{ m_vAxisBlock.clear() ; }
|
||||
|
||||
@@ -760,6 +760,8 @@ MachMgr::UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx
|
||||
pTdata->GetParam( TPA_DIAM, dDiam) ;
|
||||
double dDist = 0 ;
|
||||
pTdata->GetParam( TPA_DIST, dDist) ;
|
||||
double dSpeed = 0 ;
|
||||
pTdata->GetParam( TPA_SPEED, dSpeed) ;
|
||||
// Imposto contesto per il disegno utensile
|
||||
if ( ! ExeSetCurrentContext( nToolCtx))
|
||||
return TD_INT_ERR ;
|
||||
@@ -769,6 +771,7 @@ MachMgr::UpdateCustomToolDraw( const ToolData* pTdata, int nGenCtx, int nToolCtx
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.LEN", dLen) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIST", dDist) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SPEED", dSpeed) ;
|
||||
// Eseguo aggiornamento utensile
|
||||
bOk = bOk && ExeLuaCallFunction( "AdjustCustomTool") ;
|
||||
// Recupero errore
|
||||
|
||||
+32
-19
@@ -268,44 +268,60 @@ MachMgr::VerifyMachGroup( int nId, MachGrp& mgData) const
|
||||
// verifica della macchina
|
||||
bool bMName = m_pGeomDB->GetInfo( nId, MACH_MACHINE_KEY, mgData.MGeoName) ;
|
||||
// scansiono i sottogruppi
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
|
||||
if ( IsNull( pIter))
|
||||
return false ;
|
||||
bool bSetup = false ;
|
||||
bool bFixt = false ;
|
||||
bool bRaw = false ;
|
||||
bool bOper = false ;
|
||||
bool bIter = pIter->GoToFirstGroupInGroup( nId) ;
|
||||
while ( bIter) {
|
||||
int nGrpId = m_pGeomDB->GetFirstGroupInGroup( nId) ;
|
||||
while ( nGrpId != GDB_ID_NULL) {
|
||||
string sName ;
|
||||
if ( pIter->GetName( sName)) {
|
||||
if ( m_pGeomDB->GetName( nGrpId, sName)) {
|
||||
if ( sName == MACH_SETUP_GROUP) {
|
||||
if ( ! bSetup)
|
||||
mgData.SetupGroupId = pIter->GetId() ;
|
||||
mgData.SetupGroupId = nGrpId ;
|
||||
bSetup = true ;
|
||||
}
|
||||
else if ( sName == MACH_FIXT_GROUP) {
|
||||
if ( ! bFixt)
|
||||
mgData.FixtGroupId = pIter->GetId() ;
|
||||
mgData.FixtGroupId = nGrpId ;
|
||||
bFixt = true ;
|
||||
}
|
||||
else if ( sName == MACH_RAW_GROUP) {
|
||||
if ( ! bRaw)
|
||||
mgData.RawGroupId = pIter->GetId() ;
|
||||
mgData.RawGroupId = nGrpId ;
|
||||
bRaw = true ;
|
||||
}
|
||||
else if ( sName == MACH_OPER_GROUP) {
|
||||
if ( ! bOper)
|
||||
mgData.OperGroupId = pIter->GetId() ;
|
||||
mgData.OperGroupId = nGrpId ;
|
||||
bOper = true ;
|
||||
}
|
||||
}
|
||||
// passo al successivo
|
||||
bIter = pIter->GoToNextGroup() ;
|
||||
nGrpId = m_pGeomDB->GetNextGroup( nGrpId) ;
|
||||
}
|
||||
return ( bMName && bSetup && bRaw && bOper) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::ChangeMachGroupName( int nId, const string& sNewName)
|
||||
{
|
||||
// verifica del gruppo base per le lavorazioni
|
||||
if ( ! VerifyMachBase())
|
||||
return false ;
|
||||
// verifico che il gruppo ricevuto sia corretto
|
||||
if ( m_pGeomDB->GetParentId( nId) != m_nMachBaseId)
|
||||
return false ;
|
||||
// verifico nome non vuoto e non esista già un gruppo con lo stesso nome
|
||||
if ( &sNewName == nullptr || sNewName.empty() || GetMachGroupId( sNewName) != GDB_ID_NULL)
|
||||
return false ;
|
||||
// cambio il nome del gruppo di lavoro
|
||||
if ( ! m_pGeomDB->SetName( nId, sNewName))
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
string
|
||||
MachMgr::GetMachGroupName( int nId) const
|
||||
@@ -349,17 +365,14 @@ MachMgr::GetMachGroupId( const string& sName) const
|
||||
if ( ! VerifyMachBase())
|
||||
return GDB_ID_NULL ;
|
||||
// recupero l'identificativo del gruppo con il nome indicato
|
||||
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
|
||||
if ( IsNull( pIter))
|
||||
return GDB_ID_NULL ;
|
||||
bool bIter = pIter->GoToFirstGroupInGroup( m_nMachBaseId) ;
|
||||
while( bIter) {
|
||||
int nGrpId = m_pGeomDB->GetFirstGroupInGroup( m_nMachBaseId) ;
|
||||
while ( nGrpId != GDB_ID_NULL) {
|
||||
// verifico il nome
|
||||
string sMGroupName ;
|
||||
if ( pIter->GetName( sMGroupName) && EqualNoCase( sMGroupName, sName))
|
||||
return pIter->GetId() ;
|
||||
if ( m_pGeomDB->GetName( nGrpId, sMGroupName) && EqualNoCase( sMGroupName, sName))
|
||||
return nGrpId ;
|
||||
// passo al successivo
|
||||
bIter = pIter->GoToNextGroup() ;
|
||||
nGrpId = m_pGeomDB->GetNextGroup( nGrpId) ;
|
||||
}
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
|
||||
@@ -683,6 +683,26 @@ MachMgr::GetCurrLinAxesFrame( void) const
|
||||
return pMch->GetCurrLinAxesFrame() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCurrIsCenter( void) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
return ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_CENTER) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCurrIsRobot( void) const
|
||||
{
|
||||
Machine* pMch = GetCurrMachine() ;
|
||||
if ( pMch == nullptr)
|
||||
return false ;
|
||||
return ( pMch->GetCurrKinematicChainType() == KIN_CHAIN_ROBOT) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
MachMgr::GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
|
||||
@@ -198,7 +198,7 @@ MachMgr::SimMoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
|
||||
{
|
||||
// verifico simulatore
|
||||
if ( m_pSimul == nullptr)
|
||||
return false ;
|
||||
return SIM_AXMV_RES_ERR ;
|
||||
// lancio movimento assi
|
||||
return m_pSimul->MoveAxes( nMoveType, vAxNaEpSt) ;
|
||||
}
|
||||
|
||||
+8
-4
@@ -58,6 +58,7 @@ Machine::Machine( void)
|
||||
m_nHeadRotAxes = 0 ;
|
||||
m_nHeadSpecRotAxis = -1 ;
|
||||
m_frLinAx.Reset( false) ;
|
||||
m_nCalcChainType = KIN_CHAIN_NONE ;
|
||||
m_nMachineLook = MCH_LOOK_NONE ;
|
||||
}
|
||||
|
||||
@@ -141,6 +142,8 @@ Machine::Init( const string& sMachineName, const string& sMachineDir, MachMgr* p
|
||||
m_nMachineLook = ( bOk ? MCH_LOOK_ALL : MCH_LOOK_NONE) ;
|
||||
// metto tutti gli assi in posizione home
|
||||
bOk = bOk && ResetAllAxesPos() ;
|
||||
// reset catena cinematica corrente
|
||||
m_nCalcChainType = KIN_CHAIN_NONE ;
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -544,7 +547,7 @@ Machine::LoadMachineStdHead( const string& sName, const string& sParent, const s
|
||||
Head* pHead = new(nothrow) Head ;
|
||||
if ( pHead == nullptr)
|
||||
return false ;
|
||||
pHead->Set( sName, MCH_HT_STD, 1, sHSet, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
|
||||
pHead->Set( sName, MCH_HT_STD, 1, sHSet, 0, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
|
||||
m_pGeomDB->SetUserObj( nLay, pHead) ;
|
||||
// aggiorno la testa capostipite
|
||||
if ( ! AddHeadToSet( sHSet, sName))
|
||||
@@ -564,7 +567,7 @@ Machine::LoadMachineStdHead( const string& sName, const string& sParent, const s
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::LoadMachineMultiHead( const string& sName, const string& sParent, const string& sHSet,
|
||||
const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
|
||||
int nSelectType, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
|
||||
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
|
||||
const string& sGeo, const STRVECTOR& vsAux)
|
||||
{
|
||||
@@ -593,7 +596,8 @@ Machine::LoadMachineMultiHead( const string& sName, const string& sParent, const
|
||||
Head* pHead = new(nothrow) Head ;
|
||||
if ( pHead == nullptr)
|
||||
return false ;
|
||||
pHead->Set( sName, MCH_HT_MULTI, int( vMuExit.size()), sHSet, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
|
||||
pHead->Set( sName, MCH_HT_MULTI, int( vMuExit.size()), sHSet, nSelectType,
|
||||
vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
|
||||
m_pGeomDB->SetUserObj( nLay, pHead) ;
|
||||
// aggiorno la testa capostipite
|
||||
if ( ! AddHeadToSet( sHSet, sName))
|
||||
@@ -640,7 +644,7 @@ Machine::LoadMachineSpecialHead( const string& sName, const string& sParent, con
|
||||
Head* pHead = new(nothrow) Head ;
|
||||
if ( pHead == nullptr)
|
||||
return false ;
|
||||
pHead->Set( sName, MCH_HT_SPECIAL, 1, sHSet, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
|
||||
pHead->Set( sName, MCH_HT_SPECIAL, 1, sHSet, 0, vtADir, dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl) ;
|
||||
m_pGeomDB->SetUserObj( nLay, pHead) ;
|
||||
// aggiorno la testa capostipite
|
||||
if ( ! AddHeadToSet( sHSet, sName))
|
||||
|
||||
@@ -53,7 +53,7 @@ class Machine
|
||||
int GetHeadId( const std::string& sHead) const
|
||||
{ int nId = GetGroup( sHead) ;
|
||||
return ( IsHeadGroup( nId) ? nId : GDB_ID_NULL) ; }
|
||||
int GetExitId( const std::string& sHead, int nExit) const
|
||||
int GetExitId( const std::string& sHead, int nExit) const
|
||||
{ int nHeadId = GetHeadId( sHead) ;
|
||||
int nId = ( m_pGeomDB != nullptr ? m_pGeomDB->GetFirstNameInGroup( nHeadId, MCH_EXIT + ToString( nExit)) : GDB_ID_NULL) ;
|
||||
return ( IsExitGroup( nId) ? nId : GDB_ID_NULL) ; }
|
||||
@@ -67,6 +67,7 @@ class Machine
|
||||
int GetHeadExitCount( const std::string& sHead) const ;
|
||||
int GetHeadExitPosDirAux( const std::string& sHead, int nExit, Point3d& ptPos, Vector3d& vtDir, Vector3d& vtAux) const ;
|
||||
int GetHeadSolCh( const std::string& sHead) const ;
|
||||
int GetHeadSelectType(const std::string& sHead) const ;
|
||||
double GetAngDeltaMinForHome( void) const
|
||||
{ return m_dAngDeltaMinForHome ; }
|
||||
bool LoadTool( const std::string& sHead, int nExit, const std::string& sTool) ;
|
||||
@@ -131,12 +132,16 @@ class Machine
|
||||
bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ;
|
||||
const Frame3d& GetCurrLinAxesFrame( void) const
|
||||
{ return m_frLinAx ; }
|
||||
int GetCurrKinematicChainType( void) const
|
||||
{ return m_nCalcChainType ; }
|
||||
bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) const ;
|
||||
bool GetAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ;
|
||||
bool GetPositions( const Point3d& ptP, const DBLVECTOR& vAng,
|
||||
int& nStat, double& dX, double& dY, double& dZ) const ;
|
||||
bool GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const ;
|
||||
bool GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
|
||||
Point3d& ptNose) const ;
|
||||
bool GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR& vAng,
|
||||
@@ -208,7 +213,7 @@ class Machine
|
||||
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
|
||||
const std::string& sGeo, const STRVECTOR& vsAux) ;
|
||||
bool LoadMachineMultiHead( const std::string& sName, const std::string& sParent, const std::string& sHSet,
|
||||
const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
|
||||
int nSelectType, const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
|
||||
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
|
||||
const std::string& sGeo, const STRVECTOR& vsAux) ;
|
||||
bool LoadMachineSpecialHead( const std::string& sName, const std::string& sParent, const std::string& sHSet,
|
||||
@@ -310,6 +315,9 @@ class Machine
|
||||
KINAXISVECTOR m_vCalcLinAx ; // vettore assi lineari attivi per calcoli
|
||||
KINAXISVECTOR m_vCalcRotAx ; // vettore assi rotanti attivi per calcoli
|
||||
Frame3d m_frLinAx ; // sistema di riferimento definito dagli assi lineari
|
||||
int m_nCalcChainType ; // tipologia testa attiva (nulla, centro di lavoro o robot)
|
||||
Point3d m_ptWristCen ; // centro del polso sferico nel riferimento testa/uscita di calcolo
|
||||
Vector3d m_vtWristRef ; // direzione del polso sferico nel riferimento testa/uscita di calcolo
|
||||
mutable OutStroke m_OutstrokeInfo ; // informazioni su ultima extra corsa
|
||||
// stato di visualizzazione
|
||||
int m_nMachineLook ; // stato di visualizzazione della macchina
|
||||
|
||||
+239
-49
@@ -466,14 +466,13 @@ Machine::CalculateKinematicChain( void)
|
||||
m_nHeadSpecRotAxis = -1 ;
|
||||
m_vCalcLinAx.clear() ;
|
||||
m_vCalcRotAx.clear() ;
|
||||
m_nCalcChainType = KIN_CHAIN_NONE ;
|
||||
// recupero gli assi di tavola
|
||||
if ( m_nCalcTabId == GDB_ID_NULL)
|
||||
return false ;
|
||||
int nTParId = m_pGeomDB->GetParentId( m_nCalcTabId) ;
|
||||
if ( nTParId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_nTabLinAxes = 0 ;
|
||||
m_nTabRotAxes = 0 ;
|
||||
while ( IsAxisGroup( nTParId)) {
|
||||
if ( ! AddKinematicAxis( false, nTParId))
|
||||
return false ;
|
||||
@@ -485,14 +484,62 @@ Machine::CalculateKinematicChain( void)
|
||||
int nHParId = m_pGeomDB->GetParentId( m_nCalcHeadId) ;
|
||||
if ( nHParId == GDB_ID_NULL)
|
||||
return false ;
|
||||
m_nHeadLinAxes = 0 ;
|
||||
m_nHeadRotAxes = 0 ;
|
||||
while ( IsAxisGroup( nHParId)) {
|
||||
if ( ! AddKinematicAxis( true, nHParId))
|
||||
return false ;
|
||||
nHParId = m_pGeomDB->GetParentId( nHParId) ;
|
||||
}
|
||||
|
||||
// se non ci sono assi, né lineari né rotanti, sicuramente errore
|
||||
if ( m_nTabLinAxes == 0 && m_nHeadLinAxes == 0 &&
|
||||
m_nTabRotAxes == 0 && m_nHeadRotAxes == 0) {
|
||||
LOG_ERROR( GetEMkLogger(), "Errors in Axes : none have been found")
|
||||
return false ;
|
||||
}
|
||||
|
||||
// se nessun asse lineare deve essere un robot (in futuro va permesso un lineare di tavola)
|
||||
if ( m_nTabLinAxes == 0 && m_nHeadLinAxes == 0) {
|
||||
// verifico ci siano 6 assi rotanti tutti di testa (in futuro va permesso un rotante di tavola)
|
||||
if ( m_nTabRotAxes != 0 || m_nHeadRotAxes != 6) {
|
||||
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : number or type")
|
||||
return false ;
|
||||
}
|
||||
// riordino gli assi rotanti
|
||||
swap( m_vCalcRotAx[0], m_vCalcRotAx[5]) ;
|
||||
swap( m_vCalcRotAx[1], m_vCalcRotAx[4]) ;
|
||||
swap( m_vCalcRotAx[2], m_vCalcRotAx[3]) ;
|
||||
// direzione assi rotanti deve essere Z Y Y X Y X
|
||||
if ( ! m_vCalcRotAx[0].vtDir.IsZ() ||
|
||||
! m_vCalcRotAx[1].vtDir.IsY() ||
|
||||
! m_vCalcRotAx[2].vtDir.IsY() ||
|
||||
! m_vCalcRotAx[3].vtDir.IsX() ||
|
||||
! m_vCalcRotAx[4].vtDir.IsY() ||
|
||||
! m_vCalcRotAx[5].vtDir.IsX()) {
|
||||
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : not ZYY-XYX")
|
||||
return false ;
|
||||
}
|
||||
// verifico che gli ultimi 3 assi formino un polso sferico (ovvero passino per uno stesso punto)
|
||||
if ( abs( m_vCalcRotAx[3].ptPos.y - m_vCalcRotAx[5].ptPos.y) > EPS_SMALL ||
|
||||
abs( m_vCalcRotAx[3].ptPos.z - m_vCalcRotAx[5].ptPos.z) > EPS_SMALL ||
|
||||
abs( m_vCalcRotAx[4].ptPos.z - m_vCalcRotAx[3].ptPos.z) > EPS_SMALL) {
|
||||
LOG_ERROR( GetEMkLogger(), "Robot with errors in Rotary Axes : not spherical Wrist")
|
||||
return false ;
|
||||
}
|
||||
// calcolo il centro del polso in coordinate globali (R5.x, R6.y, R5.z)
|
||||
Point3d ptCenG( m_vCalcRotAx[4].ptPos.x, m_vCalcRotAx[5].ptPos.y, m_vCalcRotAx[4].ptPos.z) ;
|
||||
// recupero il riferimento dell'uscita (da posizione, direzione utensile e direzione ausiliaria)
|
||||
Frame3d frExit ;
|
||||
if ( ! frExit.Set( m_ptCalcPos, m_vtCalcDir, m_vtCalcADir))
|
||||
return false ;
|
||||
// calcolo il centro del polso in locale a questo riferimento
|
||||
m_ptWristCen = GetToLoc( ptCenG, frExit) ;
|
||||
// calcolo la direzione di riferimento del polso in locale a questo riferimento
|
||||
m_vtWristRef = GetToLoc( m_vCalcRotAx[5].vtDir, frExit) ;
|
||||
// dichiaro tipo robot
|
||||
m_nCalcChainType = KIN_CHAIN_ROBOT ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
// verifiche sugli assi lineari :
|
||||
// aggiusto gli indici di ordine sulla sua catena cinematica (1-based)
|
||||
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
|
||||
@@ -531,7 +578,6 @@ Machine::CalculateKinematicChain( void)
|
||||
}
|
||||
|
||||
// verifiche sugli assi rotanti :
|
||||
bool bOk = false ;
|
||||
// aggiusto gli indici di ordine sulla sua catena cinematica (1-based)
|
||||
for ( int i = 0 ; i < int( m_vCalcRotAx.size()) ; ++ i) {
|
||||
if ( m_vCalcRotAx[i].bHead)
|
||||
@@ -541,7 +587,7 @@ Machine::CalculateKinematicChain( void)
|
||||
}
|
||||
// se 0 o 1 va bene
|
||||
if ( m_vCalcRotAx.size() <= 1)
|
||||
bOk = true ;
|
||||
;
|
||||
// se 2 va bene
|
||||
else if ( m_vCalcRotAx.size() == 2) {
|
||||
// se entrambi di testa devo invertirne l'ordine
|
||||
@@ -555,7 +601,6 @@ Machine::CalculateKinematicChain( void)
|
||||
m_vCalcRotAx[1].stroke.Max = min( m_vCalcRotAx[1].stroke.Max, pHead->GetRot2Stroke().Max) ;
|
||||
}
|
||||
}
|
||||
bOk = true ;
|
||||
}
|
||||
// se 3 va bene ( uno dovrà poi avere valore assegnato)
|
||||
else if ( m_vCalcRotAx.size() == 3) {
|
||||
@@ -578,10 +623,13 @@ Machine::CalculateKinematicChain( void)
|
||||
m_vCalcRotAx[n2ndHeadRotAx].stroke.Max = min( m_vCalcRotAx[n2ndHeadRotAx].stroke.Max, pHead->GetRot2Stroke().Max) ;
|
||||
}
|
||||
}
|
||||
bOk = true ;
|
||||
}
|
||||
if ( ! bOk)
|
||||
// se più di 3
|
||||
else {
|
||||
// altrimenti non ancora gestito, quindi errore
|
||||
LOG_ERROR( GetEMkLogger(), "Rotary Axes not manageable")
|
||||
return false ;
|
||||
}
|
||||
// verifico esistenza eventuale asse rotante speciale di testa
|
||||
if ( m_nHeadRotAxes > 0 && m_nHeadLinAxes > 0) {
|
||||
// indice di posizione primo asse di testa
|
||||
@@ -617,11 +665,9 @@ Machine::CalculateKinematicChain( void)
|
||||
}
|
||||
}
|
||||
}
|
||||
// dichiaro tipo centro di lavoro
|
||||
m_nCalcChainType = KIN_CHAIN_CENTER ;
|
||||
return true ;
|
||||
|
||||
// altrimenti non ancora gestito, quindi errore
|
||||
LOG_ERROR( GetEMkLogger(), "Rotary Axes not manageable")
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -1230,26 +1276,46 @@ Machine::GetNoseFromPositions( double dX, double dY, double dZ, const DBLVECTOR&
|
||||
// la posizione deve essere espressa rispetto allo ZERO MACCHINA
|
||||
// è espressa nel riferimento di macchina (tiene conto delle sole traslazioni e rotazioni di testa)
|
||||
|
||||
// aggiorno posizione testa a riposo mediante ciclo inverso sugli assi rotanti di testa
|
||||
ptNose = m_ptCalcPos ;
|
||||
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
|
||||
// se asse di testa non speciale
|
||||
if ( m_vCalcRotAx[i].bHead && i != m_nHeadSpecRotAxis)
|
||||
ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
|
||||
// verifico dimensione vettore angoli rispetto al numero di assi rotanti
|
||||
if ( vAng.size() < m_vCalcRotAx.size())
|
||||
return false ;
|
||||
|
||||
// se centro di lavoro
|
||||
if ( m_nCalcChainType == KIN_CHAIN_CENTER) {
|
||||
// aggiorno posizione testa a riposo mediante ciclo inverso sugli assi rotanti di testa
|
||||
ptNose = m_ptCalcPos ;
|
||||
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
|
||||
// se asse di testa non speciale
|
||||
if ( m_vCalcRotAx[i].bHead && i != m_nHeadSpecRotAxis)
|
||||
ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
|
||||
}
|
||||
// aggiorno posizione testa con assi lineari di testa
|
||||
DBLVECTOR vMov( {dX, dY, dZ}) ;
|
||||
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
|
||||
if ( m_vCalcLinAx[i].bHead)
|
||||
ptNose += m_vCalcLinAx[i].vtDir * vMov[i] ;
|
||||
}
|
||||
// eseguo rotazione eventuale asse rotante speciale di testa
|
||||
if ( m_nHeadSpecRotAxis != -1) {
|
||||
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
|
||||
return false ;
|
||||
int i = m_nHeadSpecRotAxis ;
|
||||
ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
|
||||
}
|
||||
}
|
||||
// aggiorno posizione testa con assi lineari di testa
|
||||
DBLVECTOR vMov( {dX, dY, dZ}) ;
|
||||
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
|
||||
if ( m_vCalcLinAx[i].bHead)
|
||||
ptNose += m_vCalcLinAx[i].vtDir * vMov[i] ;
|
||||
}
|
||||
// eseguo rotazione eventuale asse rotante speciale di testa
|
||||
if ( m_nHeadSpecRotAxis != -1) {
|
||||
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
|
||||
return false ;
|
||||
int i = m_nHeadSpecRotAxis ;
|
||||
ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
|
||||
// se robot
|
||||
else if ( m_nCalcChainType == KIN_CHAIN_ROBOT) {
|
||||
// aggiorno posizione testa a riposo mediante ciclo inverso sugli assi rotanti di testa
|
||||
ptNose = m_ptCalcPos ;
|
||||
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
|
||||
// se asse di testa
|
||||
if ( m_vCalcRotAx[i].bHead)
|
||||
ptNose.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
|
||||
}
|
||||
}
|
||||
// altrimenti errore
|
||||
else
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -1262,26 +1328,46 @@ Machine::GetTipFromPositions( double dX, double dY, double dZ, const DBLVECTOR&
|
||||
// la posizione deve essere espressa rispetto allo ZERO MACCHINA
|
||||
// è espressa nel riferimento di macchina (tiene conto delle sole rotazioni di testa)
|
||||
|
||||
// aggiorno posizione tip utensile a riposo mediante ciclo inverso sugli assi rotanti di testa
|
||||
ptTip = m_ptCalcPos - m_vtCalcDir * m_dCalcTLen ;
|
||||
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
|
||||
// se asse di testa non speciale
|
||||
if ( m_vCalcRotAx[i].bHead && i != m_nHeadSpecRotAxis)
|
||||
ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
|
||||
// verifico dimensione vettore angoli rispetto al numero di assi rotanti
|
||||
if ( vAng.size() < m_vCalcRotAx.size())
|
||||
return false ;
|
||||
|
||||
// se centro di lavoro
|
||||
if ( m_nCalcChainType == KIN_CHAIN_CENTER) {
|
||||
// aggiorno posizione tip utensile a riposo mediante ciclo inverso sugli assi rotanti di testa
|
||||
ptTip = m_ptCalcPos - m_vtCalcDir * m_dCalcTLen ;
|
||||
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
|
||||
// se asse di testa non speciale
|
||||
if ( m_vCalcRotAx[i].bHead && i != m_nHeadSpecRotAxis)
|
||||
ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
|
||||
}
|
||||
// aggiorno posizione tip utensile con assi lineari di testa
|
||||
DBLVECTOR vMov( {dX, dY, dZ}) ;
|
||||
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
|
||||
if ( m_vCalcLinAx[i].bHead)
|
||||
ptTip += m_vCalcLinAx[i].vtDir * vMov[i] ;
|
||||
}
|
||||
// eseguo rotazione eventuale asse rotante speciale di testa
|
||||
if ( m_nHeadSpecRotAxis != -1) {
|
||||
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
|
||||
return false ;
|
||||
int i = m_nHeadSpecRotAxis ;
|
||||
ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
|
||||
}
|
||||
}
|
||||
// aggiorno posizione tip utensile con assi lineari di testa
|
||||
DBLVECTOR vMov( {dX, dY, dZ}) ;
|
||||
for ( int i = 0 ; i < int( m_vCalcLinAx.size()) ; ++ i) {
|
||||
if ( m_vCalcLinAx[i].bHead)
|
||||
ptTip += m_vCalcLinAx[i].vtDir * vMov[i] ;
|
||||
}
|
||||
// eseguo rotazione eventuale asse rotante speciale di testa
|
||||
if ( m_nHeadSpecRotAxis != -1) {
|
||||
if ( m_nHeadSpecRotAxis < 0 || m_nHeadSpecRotAxis >= int( m_vCalcRotAx.size()))
|
||||
return false ;
|
||||
int i = m_nHeadSpecRotAxis ;
|
||||
ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
|
||||
// se robot
|
||||
else if ( m_nCalcChainType == KIN_CHAIN_ROBOT) {
|
||||
// aggiorno posizione tip utensile a riposo mediante ciclo inverso sugli assi rotanti di testa
|
||||
ptTip = m_ptCalcPos - m_vtCalcDir * m_dCalcTLen ;
|
||||
for ( int i = int( m_vCalcRotAx.size()) - 1 ; i >= 0 ; -- i) {
|
||||
// se asse di testa
|
||||
if ( m_vCalcRotAx[i].bHead)
|
||||
ptTip.Rotate( m_vCalcRotAx[i].ptPos, m_vCalcRotAx[i].vtDir, vAng[i]) ;
|
||||
}
|
||||
}
|
||||
// altrimenti errore
|
||||
else
|
||||
return false ;
|
||||
|
||||
// Se richiesto ingombro totale o punto sotto del tip utensile
|
||||
if ( bOverall || bBottom) {
|
||||
@@ -1928,3 +2014,107 @@ Machine::GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const
|
||||
}
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetRobotAngles( const Point3d& ptP, const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
DBLVECTOR& vAng1, DBLVECTOR& vAng2) const
|
||||
{
|
||||
// pulisco il risultato
|
||||
vAng1.clear() ;
|
||||
vAng2.clear() ;
|
||||
// riferimento utensile
|
||||
Frame3d frTool ;
|
||||
frTool.Set( ORIG, vtDirT, vtDirA) ;
|
||||
// deduco la posizione richiesta del centro del polso
|
||||
Point3d ptCen = ptP + m_ptWristCen.x * frTool.VersX() +
|
||||
m_ptWristCen.y * frTool.VersY() +
|
||||
( m_dCalcTLen + m_ptWristCen.z) * frTool.VersZ() ;
|
||||
// deduco la direzione richiesta del centro del polso
|
||||
Vector3d vtCen = m_vtWristRef.x * frTool.VersX() +
|
||||
m_vtWristRef.y * frTool.VersY() +
|
||||
m_vtWristRef.z * frTool.VersZ() ;
|
||||
// calcolo il primo asse rotante
|
||||
Vector3d vtArm = ptCen - m_vCalcRotAx[0].ptPos ;
|
||||
double dAng1 ; bool bDet1 ;
|
||||
if ( ! X_AX.GetRotation( vtArm, m_vCalcRotAx[0].vtDir, EPS_SMALL, dAng1, bDet1) || ! bDet1) {
|
||||
LOG_ERROR( GetEMkLogger(), "Error : direction unreachable (robot)")
|
||||
return false ;
|
||||
}
|
||||
vAng1.push_back( dAng1) ;
|
||||
vAng2.push_back( dAng1) ;
|
||||
// calcolo secondo e terzo asse rotante
|
||||
Point3d ptR2 = m_vCalcRotAx[1].ptPos ;
|
||||
ptR2.Rotate( m_vCalcRotAx[0].ptPos, m_vCalcRotAx[0].vtDir, dAng1) ;
|
||||
Vector3d vtR2 = m_vCalcRotAx[1].vtDir ;
|
||||
vtR2.Rotate( m_vCalcRotAx[0].vtDir, dAng1) ;
|
||||
Vector3d vtR2Cen = ptCen - ( ptR2 + ( ptCen - ptR2) * vtR2 * vtR2) ;
|
||||
double dDistR2Cen = vtR2Cen.Len() ;
|
||||
double dDistR2R3 = m_vCalcRotAx[2].ptPos.z - m_vCalcRotAx[1].ptPos.z ;
|
||||
Vector3d vtR3R5 = m_vCalcRotAx[4].ptPos - m_vCalcRotAx[2].ptPos ; vtR3R5.y = 0 ;
|
||||
double dDistR3R5 = vtR3R5.Len() ;
|
||||
double dAngR3R5 = atan2( vtR3R5.z, vtR3R5.x) * RADTODEG ;
|
||||
double dCosB = ( dDistR2R3 * dDistR2R3 + dDistR2Cen * dDistR2Cen - dDistR3R5 * dDistR3R5) / ( 2 * dDistR2R3 * dDistR2Cen) ;
|
||||
double dCosC = ( dDistR3R5 * dDistR3R5 + dDistR2Cen * dDistR2Cen - dDistR2R3 * dDistR2R3) / ( 2 * dDistR3R5 * dDistR2Cen) ;
|
||||
if ( abs( dCosB) > 1 || abs( dCosC) > 1) {
|
||||
LOG_ERROR( GetEMkLogger(), "Error : position unreachable (robot)")
|
||||
return false ;
|
||||
}
|
||||
double dAngB = acos( dCosB) * RADTODEG ;
|
||||
double dAng2 ; bool bDet2 ;
|
||||
if ( ! Z_AX.GetRotation( vtR2Cen, vtR2, EPS_SMALL, dAng2, bDet2) || ! bDet2) {
|
||||
LOG_ERROR( GetEMkLogger(), "Error : R2 not calculable (robot)")
|
||||
return false ;
|
||||
}
|
||||
dAng2 -= dAngB ;
|
||||
vAng1.push_back( dAng2) ;
|
||||
vAng2.push_back( dAng2) ;
|
||||
double dAngC = acos( dCosC) * RADTODEG ;
|
||||
double dAng3 = dAngB + dAngC + dAngR3R5 - ANG_RIGHT ;
|
||||
vAng1.push_back( dAng3) ;
|
||||
vAng2.push_back( dAng3) ;
|
||||
// calcolo i primi due assi rotanti del polso
|
||||
Frame3d frWrist ;
|
||||
frWrist.Set( m_vCalcRotAx[3].ptPos, m_vCalcRotAx[3].vtDir, m_vCalcRotAx[4].vtDir ^ m_vCalcRotAx[3].vtDir) ;
|
||||
frWrist.Rotate( m_vCalcRotAx[2].ptPos, m_vCalcRotAx[2].vtDir, dAng3) ;
|
||||
frWrist.Rotate( m_vCalcRotAx[1].ptPos, m_vCalcRotAx[1].vtDir, dAng2) ;
|
||||
frWrist.Rotate( m_vCalcRotAx[0].ptPos, m_vCalcRotAx[0].vtDir, dAng1) ;
|
||||
Vector3d vtCenL = GetToLoc( vtCen, frWrist) ;
|
||||
double dAng4, dAng5 ;
|
||||
vtCenL.ToSpherical( nullptr, &dAng5, &dAng4) ;
|
||||
if ( dAng4 > ANG_STRAIGHT)
|
||||
dAng4 -= ANG_FULL ;
|
||||
if ( dAng4 > ANG_RIGHT) {
|
||||
dAng4 -= ANG_STRAIGHT ;
|
||||
dAng5 = -dAng5 ;
|
||||
}
|
||||
else if ( dAng4 < -ANG_RIGHT) {
|
||||
dAng4 += ANG_STRAIGHT ;
|
||||
dAng5 = -dAng5 ;
|
||||
}
|
||||
vAng1.push_back( dAng4) ;
|
||||
vAng1.push_back( dAng5) ;
|
||||
vAng2.push_back( dAng4 + ( dAng4 > EPS_ANG_ZERO ? -ANG_STRAIGHT : ANG_STRAIGHT)) ;
|
||||
vAng2.push_back( -dAng5) ;
|
||||
// calcolo il terzo asse rotante del polso
|
||||
Vector3d vtR6 = m_vCalcRotAx[5].vtDir ;
|
||||
for ( int i = 4; i >= 0 ; --i)
|
||||
vtR6.Rotate( m_vCalcRotAx[i].vtDir, vAng1[i]) ;
|
||||
Vector3d vtTool = m_vtCalcDir ;
|
||||
for ( int i = 4; i >= 0 ; --i)
|
||||
vtTool.Rotate( m_vCalcRotAx[i].vtDir, vAng1[i]) ;
|
||||
double dAng6 ; bool bDet6 ;
|
||||
if ( ! vtTool.GetRotation( vtDirT, vtR6, EPS_SMALL, dAng6, bDet6) || ! bDet6) {
|
||||
Vector3d vtAux = m_vtCalcADir ;
|
||||
for ( int i = 4; i >= 0 ; --i)
|
||||
vtAux.Rotate( m_vCalcRotAx[i].vtDir, vAng1[i]) ;
|
||||
if ( ! vtAux.GetRotation( vtDirA, vtR6, EPS_SMALL, dAng6, bDet6) || ! bDet6) {
|
||||
LOG_ERROR( GetEMkLogger(), "Error : R6 not calculable (robot)")
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
vAng1.push_back( dAng6) ;
|
||||
vAng2.push_back( dAng6 + ( dAng6 > EPS_ANG_ZERO ? -ANG_STRAIGHT : ANG_STRAIGHT)) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -98,6 +98,18 @@ Machine::GetHeadSolCh( const string& sHead) const
|
||||
return pHead->GetSolCh() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::GetHeadSelectType( const string& sHead) const
|
||||
{
|
||||
// recupero testa
|
||||
Head* pHead = GetHead( GetGroup( sHead)) ;
|
||||
if ( pHead == nullptr)
|
||||
return MCH_SCC_NONE ;
|
||||
// recupero tipo di selezione delle uscite della testa
|
||||
return pHead->GetSelectType() ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::LoadTool( const string& sHead, int nExit, const string& sTool)
|
||||
|
||||
+9
-12
@@ -51,6 +51,7 @@ static const string FLD_STROKE = "Stroke" ;
|
||||
static const string FLD_HOME = "Home" ;
|
||||
static const string FLD_ADJUSTAUX = "AdjustAux" ;
|
||||
static const string FLD_HSET = "HSet" ;
|
||||
static const string FLD_SEL_TYPE = "SelType" ;
|
||||
static const string FLD_TDIR = "TDir" ;
|
||||
static const string FLD_ADIR = "ADir" ;
|
||||
static const string FLD_ROT1W = "Rot1W" ;
|
||||
@@ -660,6 +661,9 @@ Machine::LuaEmtMultiHead( lua_State* L)
|
||||
// lettura campo 'HSet' dalla tabella
|
||||
string sHSet ;
|
||||
LuaCheckTabFieldParam( L, 1, FLD_HSET, sHSet)
|
||||
// lettura eventuale campo tipo di selezione ammessa per le uscite
|
||||
int nSelectType = MCH_SLT_FIXEDEXITS ;
|
||||
LuaGetTabFieldParam( L, 1, FLD_SEL_TYPE, nSelectType) ;
|
||||
// lettura campo 'ExitNbr' dalla tabella
|
||||
int nExitNbr ;
|
||||
LuaCheckTabFieldParam( L, 1, FLD_EXIT_NBR, nExitNbr)
|
||||
@@ -712,7 +716,7 @@ Machine::LuaEmtMultiHead( lua_State* L)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
|
||||
// carico i dati della testa multipla
|
||||
if ( ! m_pMchLua->LoadMachineMultiHead( sName, sParent, sHSet, vMuExit, vtADir,
|
||||
if ( ! m_pMchLua->LoadMachineMultiHead( sName, sParent, sHSet, nSelectType, vMuExit, vtADir,
|
||||
dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl, sGeo, vsAux))
|
||||
return luaL_error( L, " Load Machine Multi Head failed") ;
|
||||
|
||||
@@ -1479,18 +1483,11 @@ int
|
||||
Machine::LuaEmtMoveAxes( lua_State* L)
|
||||
{
|
||||
// 4, ..., 31 parametri : nMoveType, sAx1, dPos1, dStep1 [, sAx2, dPos2, dStep2] ... [, sAx10, dPos10, dStep10]
|
||||
int nMoveType ;
|
||||
LuaCheckParam( L, 1, nMoveType)
|
||||
string sAx1 ;
|
||||
LuaCheckParam( L, 2, sAx1) ;
|
||||
double dEnd1 ;
|
||||
LuaCheckParam( L, 3, dEnd1) ;
|
||||
double dStep1 ;
|
||||
LuaCheckParam( L, 4, dStep1) ;
|
||||
int nMoveType = 0 ;
|
||||
LuaGetParam( L, 1, nMoveType) ;
|
||||
SAMVECTOR vAxNaEpSt ;
|
||||
vAxNaEpSt.emplace_back( sAx1, dEnd1, dStep1) ;
|
||||
for ( int i = 0 ; i < 9 ; ++ i) {
|
||||
int nInd = 5 + 3 * i ;
|
||||
for ( int i = 0 ; i < 10 ; ++ i) {
|
||||
int nInd = 2 + 3 * i ;
|
||||
string sAxN ;
|
||||
double dEndN ;
|
||||
double dStepN ;
|
||||
|
||||
+14
-2
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
// EgalTech 2015-2024
|
||||
//----------------------------------------------------------------------------
|
||||
// File : MachineStruConst.h Data : 25.05.15 Versione : 1.6e7
|
||||
// File : MachineStruConst.h Data : 15.01.24 Versione : 2.5l6
|
||||
// Contenuto : Strutture e costanti di macchina.
|
||||
//
|
||||
//
|
||||
@@ -88,6 +88,18 @@ enum MchHeadType { MCH_HT_NONE = 0,
|
||||
MCH_HT_MULTI = 2,
|
||||
MCH_HT_SPECIAL = 3} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Tipo di selezione ammessa per le uscite
|
||||
enum MchSelType { MCH_SLT_FIXEDEXITS = 0,
|
||||
MCH_SLT_ONEEXIT = 1,
|
||||
MCH_SLT_MULTIEXITS = 2} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Tipo della catena cinematica
|
||||
enum KinChainType { KIN_CHAIN_NONE = 0,
|
||||
KIN_CHAIN_CENTER = 1,
|
||||
KIN_CHAIN_ROBOT = 2} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Identificativo iniziale riferimenti di tavola
|
||||
const std::string MCH_TREF = "R" ;
|
||||
|
||||
+370
-54
@@ -33,6 +33,7 @@
|
||||
#include "/EgtDev/Include/EGkSurfTriMesh.h"
|
||||
#include "/EgtDev/Include/EGkExtText.h"
|
||||
#include "/EgtDev/Include/EGkDistPointCurve.h"
|
||||
#include "/EgtDev/Include/EGkIntersCurveSurfTm.h"
|
||||
#include "/EgtDev/Include/EGkIntervals.h"
|
||||
#include "/EgtDev/Include/EGkUserObjFactory.h"
|
||||
#include "/EgtDev/Include/EGnStringKeyVal.h"
|
||||
@@ -53,7 +54,7 @@ const double DELTA_ELEV_RAD = 4.0 ;
|
||||
// 2303 = "Error in Milling : Empty RawBox"
|
||||
// 2304 = "Error in Milling : Depth not computable"
|
||||
// 2305 = "Error in Milling : machining depth (xx) bigger than MaxMaterial (yy)"
|
||||
// 2306 = "Error in Milling : Entity GetElevation"
|
||||
// 2306 = "Error in Milling : machining step (xx) bigger than MaxMaterial (yy)"
|
||||
// 2307 = "Error in Milling : missing aggregate from bottom"
|
||||
// 2308 = "Error in Milling : path too far from part sides"
|
||||
// 2309 = "Error in Milling : Approach not computable"
|
||||
@@ -1792,9 +1793,12 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
bool bSplitArcs = ( nSplitArcs == SPLAR_ALWAYS ||
|
||||
( nSplitArcs == SPLAR_NO_XY_PLANE && ! vtTool.IsZplus()) ||
|
||||
( nSplitArcs == SPLAR_GEN_PLANE && vtTool.IsGeneric())) ;
|
||||
if ( bSplitArcs && ! ApproxWithLines( pCompo)) {
|
||||
m_pMchMgr->SetLastError( 2313, "Error in Milling : Linear Approx not computable") ;
|
||||
return false ;
|
||||
if ( bSplitArcs) {
|
||||
double dMaxLen = ( m_pMchMgr->GetCurrIsRobot() ? 5 : 0) ;
|
||||
if ( ! ApproxWithLines( pCompo, dMaxLen)) {
|
||||
m_pMchMgr->SetLastError( 2313, "Error in Milling : Linear Approx not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
// verifiche sull'ampiezza dell'angolo al centro degli eventuali archi
|
||||
@@ -1828,7 +1832,7 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
dOkStep = m_Params.m_dStep + EPS_ZERO ;
|
||||
else if ( m_Params.m_dStep < -EPS_SMALL &&
|
||||
( m_TParams.m_nType == TT_MILL_NOTIP ||
|
||||
( ( m_TParams.m_nType & TF_SAWBLADE) != 0 && dSideElev < 10 * EPS_SMALL))) {
|
||||
( ( m_TParams.m_nType & TF_SAWBLADE) != 0 && abs( dSideElev) < 10 * EPS_SMALL))) {
|
||||
dOkStep = abs( m_Params.m_dStep) + EPS_ZERO ;
|
||||
bStepUp = true ;
|
||||
}
|
||||
@@ -1899,12 +1903,27 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
}
|
||||
}
|
||||
// per lame e con elevazione di lato definita
|
||||
else if ( dSideElev > EPS_SMALL) {
|
||||
if ( dSideElev > m_TParams.m_dMaxMat) {
|
||||
string sInfo = "Error in Milling : machining depth (" + ToString( dSideElev, 1) +
|
||||
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
|
||||
m_pMchMgr->SetLastError( 2305, sInfo) ;
|
||||
return false ;
|
||||
else if ( abs( dSideElev) > EPS_SMALL) {
|
||||
// caso standard
|
||||
if ( dSideElev > 0) {
|
||||
// se l'elevazione di lato supera la capacità dell'utensile
|
||||
if ( dSideElev > m_TParams.m_dMaxMat + EPS_SMALL) {
|
||||
string sInfo = "Error in Milling : machining depth (" + ToString( dSideElev, 1) +
|
||||
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
|
||||
m_pMchMgr->SetLastError( 2305, sInfo) ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// per tagli a cubetti (ciascuno step di taglio cade)
|
||||
else {
|
||||
// se lo step supera la capacità dell'utensile
|
||||
if ( m_Params.m_dStep > m_TParams.m_dMaxMat + EPS_SMALL) {
|
||||
string sInfo = "Error in Milling : machining step (" + ToString( m_Params.m_dStep, 1) +
|
||||
") bigger than MaxMaterial (" + ToString( m_TParams.m_dMaxMat, 1) + ")" ;
|
||||
m_pMchMgr->SetLastError( 2306, sInfo) ;
|
||||
return false ;
|
||||
}
|
||||
dSideElev = abs( dSideElev) ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1983,7 +2002,10 @@ Milling::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
// Se lama con elevazione e step di fianco
|
||||
if ( ( m_TParams.m_nType & TF_SAWBLADE) != 0 && dSideElev > 10 * EPS_SMALL && dOkStep > EPS_SMALL) {
|
||||
m_bStepOn = true ;
|
||||
bOk = AddSawZigZagMilling( pCompo, vtTool, dDepth, dSideElev, dOkStep, bSplitArcs) ;
|
||||
if ( m_Params.m_nStepType != MILL_ST_ONEWAY)
|
||||
bOk = AddSawZigZagMilling( pCompo, vtTool, dDepth, dSideElev, dOkStep, bSplitArcs) ;
|
||||
else
|
||||
bOk = AddSawOneWayMilling( pCompo, vtTool, dDepth, dSideElev, dOkStep, bSplitArcs) ;
|
||||
}
|
||||
// se altrimenti una sola passata
|
||||
else if ( dOkStep < EPS_SMALL || dOkStep > dElev) {
|
||||
@@ -2247,6 +2269,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
double dExtrAppr = dAppr + max( 0.0, m_TParams.m_dTLen - m_TParams.m_dLen) ;
|
||||
|
||||
// in caso di tabs ne aggiusto i parametri secondo il percorso
|
||||
TabData tdTabs ;
|
||||
@@ -2333,7 +2356,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
dStElev = -LIO_ELEV_TOL ;
|
||||
}
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bOutStart, bAboveStart)) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dExtrAppr, bOutStart, bAboveStart)) {
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2500,7 +2523,7 @@ Milling::AddStandardMilling( const ICurveComposite* pCompo, const Vector3d& vtTo
|
||||
bool bUhAboveEnd = ! m_bAboveHead && GetUhPointAboveRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(),
|
||||
m_TParams.m_dLen, false, dSafeZ, vtEscape, dEndElev) ;
|
||||
// aggiungo retrazione
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bAboveEnd)) {
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dExtrAppr, bAboveEnd)) {
|
||||
m_pMchMgr->SetLastError( 2312, "Error in Milling : Retract not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2574,6 +2597,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
double dExtrAppr = dAppr + max( 0.0, m_TParams.m_dTLen - m_TParams.m_dLen) ;
|
||||
|
||||
// determino numero e affondamento degli step
|
||||
int nStep = max( 1, static_cast<int>( ceil( dElev / dOkStep))) ;
|
||||
@@ -2684,7 +2708,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
dStElev = - LIO_ELEV_TOL ;
|
||||
}
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bOutStart, bAboveStart)) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dExtrAppr, bOutStart, bAboveStart)) {
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2940,7 +2964,7 @@ Milling::AddZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
bool bUhAboveEnd = ! m_bAboveHead && GetUhPointAboveRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(),
|
||||
m_TParams.m_dLen, false, dSafeZ, vtEscape, dEndElev) ;
|
||||
// aggiungo retrazione
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bAboveEnd)) {
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dExtrAppr, bAboveEnd)) {
|
||||
m_pMchMgr->SetLastError( 2312, "Error in Milling : Retract not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -2961,6 +2985,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
double dExtrAppr = dAppr + max( 0.0, m_TParams.m_dTLen - m_TParams.m_dLen) ;
|
||||
|
||||
// in caso di tabs ne aggiusto i parametri secondo il percorso
|
||||
TabData tdTabs ;
|
||||
@@ -3156,7 +3181,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
}
|
||||
// approccio standard al punto iniziale
|
||||
if ( j == 1 || bMidRetract) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bOutStart, bAboveStartEnd)) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dExtrAppr, bOutStart, bAboveStartEnd)) {
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3334,7 +3359,7 @@ Milling::AddOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
bool bUhAboveEnd = ! m_bAboveHead && GetUhPointAboveRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(),
|
||||
m_TParams.m_dLen, false, dSafeZ, vtEscape, dEndElev) ;
|
||||
// aggiungo retrazione
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bAboveStartEnd)) {
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dExtrAppr, bAboveStartEnd)) {
|
||||
m_pMchMgr->SetLastError( 2312, "Error in Milling : Retract not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3408,7 +3433,9 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
// se attacco ad inseguimento (per ora nullo), parto sopra di elevazione in attacco
|
||||
double dExtrAppr = dAppr + max( 0.0, m_TParams.m_dTLen - m_TParams.m_dLen) ;
|
||||
|
||||
// se attacco ad inseguimento (per ora nullo), parto sopra di elevazione in attacco
|
||||
double dStart = 0 ;
|
||||
if ( m_Params.m_nLeadInType == MILL_LI_NONE)
|
||||
dStart = m_Params.m_dLiElev ;
|
||||
@@ -3491,7 +3518,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
bool bUhAboveStart = ! m_bAboveHead && GetUhPointAboveRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(),
|
||||
m_TParams.m_dLen, false, dSafeZ, vtEscape, dStElev) ;
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bOutStart, bAboveStart)) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dExtrAppr, bOutStart, bAboveStart)) {
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3599,7 +3626,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
bool bUhAboveEnd = ! m_bAboveHead && GetUhPointAboveRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(),
|
||||
m_TParams.m_dLen, false, dSafeZ, vtEscape, dEndElev) ;
|
||||
// aggiungo retrazione
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bAboveEnd)) {
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dExtrAppr, bAboveEnd)) {
|
||||
m_pMchMgr->SetLastError( 2312, "Error in Milling : Retract not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3679,7 +3706,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
bool bUhAboveStart = ! m_bAboveHead && GetUhPointAboveRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(),
|
||||
m_TParams.m_dLen, false, dSafeZ, vtEscape, dStElev) ;
|
||||
// approccio al punto iniziale
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dAppr, bOutStart, bAboveStart)) {
|
||||
if ( ! AddApproach( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dStElev, dExtrAppr, bOutStart, bAboveStart)) {
|
||||
m_pMchMgr->SetLastError( 2309, "Error in Milling : Approach not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3782,7 +3809,7 @@ Milling::AddSpiralMilling( const ICurveComposite* pCompo, const Vector3d& vtTool
|
||||
bool bUhAboveEnd = ! m_bAboveHead && GetUhPointAboveRaw( ptP1, vtTool, 0, GetRadiusForStartEndElevation(),
|
||||
m_TParams.m_dLen, false, dSafeZ, vtEscape, dEndElev) ;
|
||||
// aggiungo retrazione
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dAppr, bAboveEnd)) {
|
||||
if ( ! AddRetract( ptP1, vtTool, dSafeZ, dSafeAggrBottZ, dEndElev, dExtrAppr, bAboveEnd)) {
|
||||
m_pMchMgr->SetLastError( 2312, "Error in Milling : Retract not computable") ;
|
||||
return false ;
|
||||
}
|
||||
@@ -3802,20 +3829,26 @@ class LeadIOStatus
|
||||
LeadIOStatus( Milling* pMill)
|
||||
{ m_pMill = pMill ;
|
||||
m_dLiPerp = m_pMill->m_Params.m_dLiPerp ;
|
||||
m_dLiTang = m_pMill->m_Params.m_dLiTang ;
|
||||
m_dLoPerp = m_pMill->m_Params.m_dLoPerp ;
|
||||
m_dLoTang = m_pMill->m_Params.m_dLoTang ;
|
||||
}
|
||||
~LeadIOStatus( void)
|
||||
{ Restore() ;
|
||||
}
|
||||
void Restore( void)
|
||||
{ m_pMill->m_Params.m_dLiPerp = m_dLiPerp ;
|
||||
m_pMill->m_Params.m_dLiTang = m_dLiTang ;
|
||||
m_pMill->m_Params.m_dLoPerp = m_dLoPerp ;
|
||||
m_pMill->m_Params.m_dLoTang = m_dLoTang ;
|
||||
}
|
||||
|
||||
private :
|
||||
Milling* m_pMill ;
|
||||
double m_dLiPerp ;
|
||||
double m_dLiTang ;
|
||||
double m_dLoPerp ;
|
||||
double m_dLoTang ;
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -3831,44 +3864,64 @@ Milling::AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtT
|
||||
// flag di percorso chiuso
|
||||
bool bClosed = pCompo->IsClosed() ;
|
||||
|
||||
// recupero eventuale superficie trimesh chiusa per trim/extend
|
||||
int nTriExtCstm = GDB_ID_NULL ;
|
||||
int nTesId ;
|
||||
if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "TrimExt="), nTesId)) {
|
||||
const ISurfTriMesh* pTes = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nTesId)) ;
|
||||
if ( pTes != nullptr && pTes->IsClosed())
|
||||
nTriExtCstm = nTesId ;
|
||||
}
|
||||
|
||||
// determino numero e affondamento degli step
|
||||
int nStep = max( 1, static_cast<int>( ceil( dElev / dOkStep))) ;
|
||||
double dStep = dElev / nStep ;
|
||||
|
||||
// gestione parametri di attacco/uscita (con backup per ripristino all'uscita)
|
||||
LeadIOStatus LioStatus( this) ;
|
||||
bool bAdjustLiPerp = ( m_Params.m_dLiPerp > EPS_SMALL) ;
|
||||
if ( bAdjustLiPerp)
|
||||
m_Params.m_dLiPerp = max( 0., m_Params.m_dLiPerp - ( nStep - 1) * dStep) ;
|
||||
bool bAdjustLoPerp = ( m_Params.m_dLoPerp > EPS_SMALL) ;
|
||||
m_Params.m_dLoPerp = 0. ;
|
||||
bool bAdjustLiPerp = ( m_Params.m_dLiPerp > 10 * EPS_SMALL) ;
|
||||
if ( bAdjustLiPerp) {
|
||||
double dNewLiPerp = max( 0., m_Params.m_dLiPerp - ( nStep - 1) * dStep) ;
|
||||
m_Params.m_dLiTang *= dNewLiPerp / m_Params.m_dLiPerp ;
|
||||
m_Params.m_dLiPerp = dNewLiPerp ;
|
||||
}
|
||||
bool bAdjustLoPerp = ( m_Params.m_dLoPerp > 10 * EPS_SMALL) ;
|
||||
if ( bAdjustLoPerp) {
|
||||
m_Params.m_dLoTang = 0 ;
|
||||
m_Params.m_dLoPerp = 0. ;
|
||||
}
|
||||
|
||||
// ciclo sugli step
|
||||
for ( int j = 1 ; j <= nStep ; ++ j) {
|
||||
// flag direzione (prima passata indice 1)
|
||||
bool bInvert = ( ( j % 2) == 0) ;
|
||||
// flag direzione
|
||||
bool bInvert = ( (( nStep - j) % 2) == 1) ;
|
||||
// copio la curva
|
||||
PtrOwner<ICurveComposite> pMyCompo( pCompo->Clone()) ;
|
||||
if ( IsNull( pMyCompo))
|
||||
return false ;
|
||||
// eseguo offset
|
||||
// eseguo offset ed eventuale inversione
|
||||
double dSignOffs = ( dElev - j * dStep) * ( m_Params.m_nWorkSide == MILL_WS_LEFT ? - 1 : 1) ;
|
||||
if ( ! CalcOffset( pMyCompo, dSignOffs))
|
||||
return false ;
|
||||
// dopo primo step annullo parametro di attacco
|
||||
if ( j > 1)
|
||||
if ( bInvert)
|
||||
pMyCompo->Invert() ;
|
||||
// eventuale trim/extend con la superficie indicata
|
||||
if ( nTriExtCstm != GDB_ID_NULL) {
|
||||
// trim con ripristino dell'originale in caso di errore
|
||||
PtrOwner<ICurveComposite> pMyCopy( pMyCompo->Clone()) ;
|
||||
if ( ! TrimExtendCurveToClosedStm( pMyCompo, nTriExtCstm, bInvert))
|
||||
pMyCompo.Set( pMyCopy) ;
|
||||
}
|
||||
// dopo primo step annullo parametri di attacco
|
||||
if ( j > 1 && bAdjustLiPerp) {
|
||||
m_Params.m_dLiPerp = 0. ;
|
||||
m_Params.m_dLiTang = 0. ;
|
||||
}
|
||||
// ciclo sulle curve elementari
|
||||
int nMaxInd = pCompo->GetCurveCount() - 1 ;
|
||||
int nMaxInd = pMyCompo->GetCurveCount() - 1 ;
|
||||
for ( int i = 0 ; i <= nMaxInd ; ++ i) {
|
||||
// curva corrente
|
||||
const ICurve* pCrvC = pMyCompo->GetCurve( ( bInvert ? nMaxInd - i : i)) ;
|
||||
// copio la curva
|
||||
PtrOwner<ICurve> pCurve( pCrvC->Clone()) ;
|
||||
if ( IsNull( pCurve))
|
||||
return false ;
|
||||
if ( bInvert)
|
||||
pCurve->Invert() ;
|
||||
const ICurve* pCurve = pMyCompo->GetCurve( i) ;
|
||||
// se prima entità, se primo step approccio e sempre affondo
|
||||
if ( i == 0) {
|
||||
// dati inizio entità
|
||||
@@ -3888,15 +3941,15 @@ Milling::AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtT
|
||||
Point3d ptP1 ;
|
||||
Vector3d vtDir1 ;
|
||||
double dCalcStElev = dStElev ;
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtTool, dCalcStElev, bInvert, pCompo, ptP1, vtDir1))
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtTool, dCalcStElev, bInvert, pMyCompo, ptP1, vtDir1))
|
||||
return false ;
|
||||
// determino se l'inizio dell'attacco è fuori dal grezzo
|
||||
Vector3d vtCorr = CalcCorrDir( pCompo, ( bInvert ? nMaxInd - i + 1 : i)) ;
|
||||
Vector3d vtCorr = CalcCorrDir( pMyCompo, i, bInvert) ;
|
||||
bool bOutStart = GetPointOutOfRaw( ptP1, vtTool, vtCorr, dElev, dSafeZ) ;
|
||||
// determino se l'inizio dell'attacco è sopra il grezzo
|
||||
bool bAboveStart = m_bAboveHead && GetPointAboveRaw( ptP1, vtTool) ;
|
||||
// imposto versore correzione e ausiliario sul punto di partenza
|
||||
CalcAndSetCorrAuxDir( pCompo, ( bInvert ? nMaxInd - i + 1 : i)) ;
|
||||
CalcAndSetCorrAuxDir( pMyCompo, i, bInvert) ;
|
||||
// se primo step
|
||||
if ( j == 1) {
|
||||
// verifico di entrare in aria
|
||||
@@ -3919,23 +3972,23 @@ Milling::AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtT
|
||||
// aggiungo attacco
|
||||
bool bTang = (( ! bInvert && m_Params.m_dLiTang > EPS_SMALL) || ( bInvert && m_Params.m_dLoTang > EPS_SMALL)) ;
|
||||
SetFeed( bTang ? GetStartFeed() : GetTipFeed()) ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtTool, dCalcStElev, bInvert, pCompo, bSplitArcs)) {
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtTool, dCalcStElev, bInvert, pMyCompo, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2310, "Error in Milling : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// imposto versore correzione e ausiliario sul punto di arrivo
|
||||
CalcAndSetCorrAuxDir( pCompo, ( bInvert ? nMaxInd - i : i + 1)) ;
|
||||
CalcAndSetCorrAuxDir( pMyCompo, i + 1, bInvert) ;
|
||||
// elaborazioni sulla curva corrente
|
||||
if ( pCurve->GetType() == CRV_LINE) {
|
||||
ICurveLine* pLine = GetCurveLine( pCurve) ;
|
||||
const ICurveLine* pLine = GetCurveLine( pCurve) ;
|
||||
Point3d ptP3 = pLine->GetEnd() ;
|
||||
SetFeed( GetFeed()) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
ICurveArc* pArc = GetCurveArc( pCurve) ;
|
||||
const ICurveArc* pArc = GetCurveArc( pCurve) ;
|
||||
Point3d ptCen = pArc->GetCenter() ;
|
||||
double dAngCen = pArc->GetAngCenter() ;
|
||||
Vector3d vtN = pArc->GetNormVersor() ;
|
||||
@@ -3967,10 +4020,209 @@ Milling::AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtT
|
||||
Point3d ptP1 ;
|
||||
Vector3d vtDir1 ;
|
||||
SetFeed( GetEndFeed()) ;
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtTool, dEndElev, bInvert, pCompo, bSplitArcs, ptP1, vtDir1)) {
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtTool, dEndElev, bInvert, pMyCompo, bSplitArcs, ptP1, vtDir1)) {
|
||||
m_pMchMgr->SetLastError( 2311, "Error in Milling : LeadOut not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// imposto flag fine passata sull'ultima entità emessa
|
||||
if ( ! SetFlagOnLastMove( 301))
|
||||
return false ;
|
||||
// per lame retrazione non è necessaria
|
||||
}
|
||||
}
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Milling::AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs)
|
||||
{
|
||||
// recupero distanze di sicurezza
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
|
||||
// lunghezza di approccio/retrazione
|
||||
double dAppr = m_Params.m_dStartPos ;
|
||||
// flag di percorso chiuso
|
||||
bool bClosed = pCompo->IsClosed() ;
|
||||
|
||||
// recupero eventuale superficie trimesh chiusa per trim/extend
|
||||
int nTriExtCstm = GDB_ID_NULL ;
|
||||
int nTesId ;
|
||||
if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "TrimExt="), nTesId)) {
|
||||
const ISurfTriMesh* pTes = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nTesId)) ;
|
||||
if ( pTes != nullptr && pTes->IsClosed())
|
||||
nTriExtCstm = nTesId ;
|
||||
}
|
||||
|
||||
// determino numero e affondamento degli step
|
||||
int nStep = max( 1, static_cast<int>( ceil( dElev / dOkStep))) ;
|
||||
double dStep = dElev / nStep ;
|
||||
|
||||
// gestione parametri di attacco/uscita (con backup per ripristino all'uscita)
|
||||
LeadIOStatus LioStatus( this) ;
|
||||
bool bAdjustLiPerp = ( m_Params.m_dLiPerp > 10 * EPS_SMALL) ;
|
||||
if ( bAdjustLiPerp) {
|
||||
double dNewLiPerp = max( 0., m_Params.m_dLiPerp - ( nStep - 1) * dStep) ;
|
||||
m_Params.m_dLiTang *= dNewLiPerp / m_Params.m_dLiPerp ;
|
||||
m_Params.m_dLiPerp = dNewLiPerp ;
|
||||
}
|
||||
bool bAdjustLoPerp = ( m_Params.m_dLoPerp > 10 * EPS_SMALL) ;
|
||||
if ( bAdjustLoPerp) {
|
||||
m_Params.m_dLoTang = 0 ;
|
||||
m_Params.m_dLoPerp = 0. ;
|
||||
}
|
||||
|
||||
// ciclo su step più ritorni (quelli pari sono i ritorni)
|
||||
for ( int k = 1 ; k <= 2 * nStep - 1 ; ++ k) {
|
||||
// indice step
|
||||
int j = ( k + 1) / 2 ;
|
||||
// flag ritorno
|
||||
bool bReturn = ( ( k % 2) == 0) ;
|
||||
// copio la curva
|
||||
PtrOwner<ICurveComposite> pMyCompo( pCompo->Clone()) ;
|
||||
if ( IsNull( pMyCompo))
|
||||
return false ;
|
||||
// eseguo offset ed eventuale inversione per ritorno
|
||||
double dDelta = ( bReturn ? min( dStep, 5.) : 0) ;
|
||||
double dSignOffs = ( dElev - j * dStep + dDelta) * ( m_Params.m_nWorkSide == MILL_WS_LEFT ? - 1 : 1) ;
|
||||
if ( ! CalcOffset( pMyCompo, dSignOffs))
|
||||
return false ;
|
||||
if ( bReturn)
|
||||
pMyCompo->Invert() ;
|
||||
// eventuale trim/extend con la superficie indicata
|
||||
if ( nTriExtCstm != GDB_ID_NULL) {
|
||||
// trim con ripristino dell'originale in caso di errore
|
||||
PtrOwner<ICurveComposite> pMyCopy( pMyCompo->Clone()) ;
|
||||
if ( ! TrimExtendCurveToClosedStm( pMyCompo, nTriExtCstm, bReturn))
|
||||
pMyCompo.Set( pMyCopy) ;
|
||||
}
|
||||
// dopo primo step annullo parametro di attacco
|
||||
if ( k > 1 && bAdjustLiPerp) {
|
||||
m_Params.m_dLiPerp = 0. ;
|
||||
m_Params.m_dLiTang = 0. ;
|
||||
}
|
||||
// ciclo sulle curve elementari
|
||||
int nMaxInd = pMyCompo->GetCurveCount() - 1 ;
|
||||
for ( int i = 0 ; i <= nMaxInd ; ++ i) {
|
||||
// curva corrente
|
||||
const ICurve* pCurve = pMyCompo->GetCurve( i) ;
|
||||
// se prima entità, se primo step approccio e sempre affondo
|
||||
if ( i == 0) {
|
||||
// dati inizio entità
|
||||
Point3d ptStart ;
|
||||
pCurve->GetStartPoint( ptStart) ;
|
||||
Vector3d vtStart ;
|
||||
pCurve->GetStartDir( vtStart) ;
|
||||
// determino elevazione su inizio attacco
|
||||
double dStElev ;
|
||||
if ( k == 1) {
|
||||
if ( ! GetElevation( m_nPhase, ptStart, vtTool, GetRadiusForStartEndElevation(), vtTool, dStElev))
|
||||
dStElev = dElev ;
|
||||
}
|
||||
else
|
||||
dStElev = dStep - LIO_ELEV_TOL - 10 * EPS_SMALL ;
|
||||
// determino inizio attacco
|
||||
Point3d ptP1 ;
|
||||
Vector3d vtDir1 ;
|
||||
double dCalcStElev = dStElev ;
|
||||
if ( ! CalcLeadInStart( ptStart, vtStart, vtTool, dCalcStElev, bReturn, pMyCompo, ptP1, vtDir1))
|
||||
return false ;
|
||||
// determino se l'inizio dell'attacco è fuori dal grezzo
|
||||
Vector3d vtCorr = CalcCorrDir( pMyCompo, i, bReturn) ;
|
||||
bool bOutStart = GetPointOutOfRaw( ptP1, vtTool, vtCorr, dElev, dSafeZ) ;
|
||||
// determino se l'inizio dell'attacco è sopra il grezzo
|
||||
bool bAboveStart = m_bAboveHead && GetPointAboveRaw( ptP1, vtTool) ;
|
||||
// imposto versore correzione e ausiliario sul punto di partenza
|
||||
CalcAndSetCorrAuxDir( pMyCompo, i, bReturn) ;
|
||||
// se primo step
|
||||
if ( k == 1) {
|
||||
// verifico di entrare in aria
|
||||
if ( ! bOutStart) {
|
||||
m_pMchMgr->SetLastError( 2314, "Error in Milling : LeadIn must be out of rawpart") ;
|
||||
return false ;
|
||||
}
|
||||
// eseguo affondo
|
||||
SetFlag( 0) ;
|
||||
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// altrimenti, affondo ( o retrazione se Return) in feed opportuna
|
||||
else {
|
||||
bool bStartFeed = ( bOutStart || m_TParams.m_nType == TT_MILL_NOTIP || m_TParams.m_nType == TT_MILL_POLISHING) ;
|
||||
SetFeed( bReturn ? GetEndFeed() : ( bStartFeed ? GetStartFeed() : GetTipFeed())) ;
|
||||
if ( AddLinearMove( ptP1) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
// aggiungo attacco
|
||||
bool bTang = (( ! bReturn && m_Params.m_dLiTang > EPS_SMALL) || ( bReturn && m_Params.m_dLoTang > EPS_SMALL)) ;
|
||||
SetFeed( bReturn ? GetEndFeed() : ( bTang ? GetStartFeed() : GetTipFeed())) ;
|
||||
if ( ! AddLeadIn( ptP1, ptStart, vtStart, vtTool, dCalcStElev, bReturn, pMyCompo, bSplitArcs)) {
|
||||
m_pMchMgr->SetLastError( 2310, "Error in Milling : LeadIn not computable") ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
// imposto versore correzione e ausiliario sul punto di arrivo
|
||||
CalcAndSetCorrAuxDir( pMyCompo, i + 1, bReturn) ;
|
||||
// se Retrazione e ultima entità, dichiaro fine passata
|
||||
if ( bReturn && i == nMaxInd)
|
||||
SetFlag( 301) ;
|
||||
// elaborazioni sulla curva corrente
|
||||
if ( pCurve->GetType() == CRV_LINE) {
|
||||
const ICurveLine* pLine = GetCurveLine( pCurve) ;
|
||||
Point3d ptP3 = pLine->GetEnd() ;
|
||||
SetFeed( bReturn ? GetEndFeed() : GetFeed()) ;
|
||||
if ( AddLinearMove( ptP3) == GDB_ID_NULL) {
|
||||
SetFlag( 0) ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
else if ( pCurve->GetType() == CRV_ARC) {
|
||||
const ICurveArc* pArc = GetCurveArc( pCurve) ;
|
||||
Point3d ptCen = pArc->GetCenter() ;
|
||||
double dAngCen = pArc->GetAngCenter() ;
|
||||
Vector3d vtN = pArc->GetNormVersor() ;
|
||||
Point3d ptP3 ;
|
||||
pArc->GetEndPoint( ptP3) ;
|
||||
SetFeed( bReturn ? GetEndFeed() : GetFeed()) ;
|
||||
if ( AddArcMove( ptP3, ptCen, dAngCen, vtN) == GDB_ID_NULL) {
|
||||
SetFlag( 0) ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
SetFlag( 0) ;
|
||||
// se ultima entità, uscita e se ultimo step retrazione
|
||||
if ( i == nMaxInd) {
|
||||
// se ultima passata, ripristino parametri originali di attacco/uscita
|
||||
if ( j == nStep)
|
||||
LioStatus.Restore() ;
|
||||
// dati fine entità
|
||||
Point3d ptEnd ;
|
||||
pCurve->GetEndPoint( ptEnd) ;
|
||||
Vector3d vtEnd ;
|
||||
pCurve->GetEndDir( vtEnd) ;
|
||||
// elevazione sul punto finale
|
||||
double dEndElev ;
|
||||
if ( j == nStep) {
|
||||
if ( ! GetElevation( m_nPhase, ptEnd, vtTool, GetRadiusForStartEndElevation(), vtTool, dEndElev))
|
||||
dEndElev = dElev ;
|
||||
}
|
||||
else
|
||||
dEndElev = - LIO_ELEV_TOL ;
|
||||
// aggiungo uscita
|
||||
Point3d ptP1 ;
|
||||
Vector3d vtDir1 ;
|
||||
SetFeed( GetEndFeed()) ;
|
||||
if ( ! AddLeadOut( ptEnd, vtEnd, vtTool, dEndElev, bReturn, pMyCompo, bSplitArcs, ptP1, vtDir1)) {
|
||||
m_pMchMgr->SetLastError( 2311, "Error in Milling : LeadOut not computable") ;
|
||||
return false ;
|
||||
}
|
||||
// se non è return, imposto flag fine passata sull'ultima entità emessa
|
||||
if ( ! bReturn) {
|
||||
if ( ! SetFlagOnLastMove( 301))
|
||||
return false ;
|
||||
}
|
||||
// per lame retrazione non è necessaria
|
||||
}
|
||||
}
|
||||
@@ -4277,6 +4529,8 @@ Milling::GetLeadInType( void) const
|
||||
if ( abs( m_Params.m_dLiTang) < min( 0.1 * m_TParams.m_dDiam, 0.1) &&
|
||||
abs( m_Params.m_dLiPerp) < min( 0.1 * m_TParams.m_dDiam, 0.1))
|
||||
return MILL_LI_NONE ;
|
||||
if ( m_Params.m_nLeadInType == MILL_LI_GLIDE && m_Params.m_dLiElev < 10 * EPS_SMALL)
|
||||
return MILL_LI_NONE ;
|
||||
if ( ( m_Params.m_nLeadInType == MILL_LI_HELIX || m_Params.m_nLeadInType == MILL_LI_ZIGZAG) &&
|
||||
( m_Params.m_dLiTang < min( 0.1 * m_TParams.m_dDiam, 1.0) || m_Params.m_dLiElev < 10 * EPS_SMALL))
|
||||
return MILL_LI_NONE ;
|
||||
@@ -4303,7 +4557,7 @@ Milling::CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const
|
||||
if ( bInvert) {
|
||||
// va aggiustato se non zigzag o spirale
|
||||
if ( nType != MILL_LI_ZIGZAG && nType != MILL_LI_HELIX) {
|
||||
switch ( m_Params.m_nLeadOutType) {
|
||||
switch ( GetLeadOutType()) {
|
||||
case MILL_LO_LINEAR : nType = MILL_LI_LINEAR ; break ;
|
||||
case MILL_LO_PERP_TG : nType = MILL_LI_TG_PERP ; break ;
|
||||
case MILL_LO_TANGENT : nType = MILL_LI_TANGENT ; break ;
|
||||
@@ -4653,6 +4907,8 @@ Milling::GetLeadOutType( void) const
|
||||
abs( m_Params.m_dLoPerp) < min( 0.1 * m_TParams.m_dDiam, 0.1) &&
|
||||
m_Params.m_nLeadOutType != MILL_LO_AS_LI)
|
||||
return MILL_LO_NONE ;
|
||||
if ( m_Params.m_nLeadOutType == MILL_LO_GLIDE && m_Params.m_dLoElev < 10 * EPS_SMALL)
|
||||
return MILL_LO_NONE ;
|
||||
return m_Params.m_nLeadOutType ;
|
||||
}
|
||||
|
||||
@@ -5944,7 +6200,7 @@ Milling::GetPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Milling::CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU)
|
||||
Milling::CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU, bool bInvertSide)
|
||||
{
|
||||
// verifico curva
|
||||
if ( pCompo == nullptr)
|
||||
@@ -5953,7 +6209,7 @@ Milling::CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU)
|
||||
if ( m_Params.m_nWorkSide == MILL_WS_CENTER)
|
||||
return true ;
|
||||
// calcolo del versore correzione
|
||||
Vector3d vtCorr = CalcCorrDir( pCompo, dU) ;
|
||||
Vector3d vtCorr = CalcCorrDir( pCompo, dU, bInvertSide) ;
|
||||
// imposto versore correzione
|
||||
SetCorrDir( vtCorr) ;
|
||||
// se rinvio da sotto in uso, non devo impostare direzione aux da correzione
|
||||
@@ -5973,7 +6229,7 @@ Milling::CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
Vector3d
|
||||
Milling::CalcCorrDir( const ICurveComposite* pCompo, double dU)
|
||||
Milling::CalcCorrDir( const ICurveComposite* pCompo, double dU, bool bInvertSide)
|
||||
{
|
||||
// verifico curva
|
||||
if ( pCompo == nullptr)
|
||||
@@ -5982,7 +6238,7 @@ Milling::CalcCorrDir( const ICurveComposite* pCompo, double dU)
|
||||
if ( m_Params.m_nWorkSide == MILL_WS_CENTER)
|
||||
return V_NULL ;
|
||||
// angolo di rotazione da tg a versore corr/aux
|
||||
bool bCcwRot = (m_Params.m_nWorkSide == MILL_WS_LEFT) ;
|
||||
bool bCcwRot = (( m_Params.m_nWorkSide == MILL_WS_LEFT) != bInvertSide) ;
|
||||
double dCaRot = ( bCcwRot ? ANG_RIGHT : -ANG_RIGHT) ;
|
||||
// dominio parametrico della curva
|
||||
double dUs, dUe ;
|
||||
@@ -6070,3 +6326,63 @@ Milling::CalcOffset( ICurveComposite* pCompo, double dSignOffs)
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Milling::TrimExtendCurveToClosedStm( ICurveComposite* pCompo, int nCstmId, bool bInvert)
|
||||
{
|
||||
// dati preparatori
|
||||
const ISurfTriMesh* pCstm = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nCstmId)) ;
|
||||
if ( pCstm == nullptr || ! pCstm->IsClosed())
|
||||
return false ;
|
||||
Frame3d frCstm ;
|
||||
if ( ! m_pGeomDB->GetGlobFrame( nCstmId, frCstm))
|
||||
return false ;
|
||||
BBox3d b3Tes = pCstm->GetAllTriaBox() ;
|
||||
if ( b3Tes.IsEmpty())
|
||||
return false ;
|
||||
double dTriExtLen ;
|
||||
b3Tes.GetDiameter( dTriExtLen) ;
|
||||
|
||||
// inverto offset su centro utensile
|
||||
double dCompOffs = 0.5 * m_TParams.m_dDiam * ( ( m_Params.m_nWorkSide == MILL_WS_RIGHT) != bInvert ? 1 : -1) ;
|
||||
if ( ! CalcOffset( pCompo, -dCompOffs))
|
||||
return false ;
|
||||
// porto la curva nel riferimento della superficie
|
||||
pCompo->ToLoc( frCstm) ;
|
||||
|
||||
// allungo la curva in testa e coda per essere sicuro che gli estremi siano esterni
|
||||
if ( ! pCompo->AddLineTg( dTriExtLen, false) || ! pCompo->AddLineTg( dTriExtLen, true))
|
||||
return false ;
|
||||
// calcolo intersezioni con superficie chiusa
|
||||
INTDBLVECTOR vInters ;
|
||||
if ( ! IntersCurveSurfTmExt( *pCompo, *pCstm, 10 * EPS_SMALL, vInters))
|
||||
return false ;
|
||||
// prendo prima intersezione entrante e ultima uscente
|
||||
double dParStart = -1 ;
|
||||
for ( int i = 0 ; i < int( vInters.size()) ; ++ i) {
|
||||
if ( vInters[i].first == CSIT_OUT_IN || vInters[i].first == CSIT_ON_IN) {
|
||||
dParStart = vInters[i].second ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
double dParEnd = -1 ;
|
||||
for ( int i = int( vInters.size()) - 1 ; i >= 0 ; -- i) {
|
||||
if ( vInters[i].first == CSIT_IN_OUT || vInters[i].first == CSIT_IN_ON) {
|
||||
dParEnd = vInters[i].second ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
// eseguo trim ed unisco le eventuali parti allineate
|
||||
if ( ! pCompo->TrimStartEndAtParam( dParStart, dParEnd) ||
|
||||
! pCompo->MergeCurves(10 * EPS_SMALL, 10 * EPS_ANG_SMALL))
|
||||
return false ;
|
||||
|
||||
// riporto la curva in globale
|
||||
pCompo->ToGlob( frCstm) ;
|
||||
// ritorno in centro utensile
|
||||
if ( ! CalcOffset(pCompo, dCompOffs))
|
||||
return false ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -96,6 +96,8 @@ class Milling : public Machining
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bPathTabsEnable, bool bPathOscEnable) ;
|
||||
bool AddSawZigZagMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
|
||||
bool AddSawOneWayMilling( const ICurveComposite* pCompo, const Vector3d& vtTool,
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bOutStart, bool bAboveStart) ;
|
||||
bool AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, const Vector3d& vtTool,
|
||||
@@ -123,9 +125,10 @@ class Milling : public Machining
|
||||
double GetRadiusForStartEndElevation( bool bExtra = true) const ;
|
||||
bool GetPointOutOfRaw( const Point3d& ptP, const Vector3d& vtTool, const Vector3d& vtCorr, double dElev, double dSafeZ) const ;
|
||||
bool GetPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool) const ;
|
||||
bool CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU) ;
|
||||
Vector3d CalcCorrDir( const ICurveComposite* pCompo, double dU) ;
|
||||
bool CalcAndSetCorrAuxDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false) ;
|
||||
Vector3d CalcCorrDir( const ICurveComposite* pCompo, double dU, bool bInvertSide = false) ;
|
||||
bool CalcOffset( ICurveComposite* pCompo, double dSignOffs) ;
|
||||
bool TrimExtendCurveToClosedStm( ICurveComposite* pCompo, int nCstmId, bool bInvert) ;
|
||||
|
||||
private :
|
||||
double GetSpeed() const
|
||||
|
||||
+956
-449
File diff suppressed because it is too large
Load Diff
+16
-2
@@ -109,7 +109,7 @@ class Operation : public IUserObj
|
||||
|
||||
bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo, int nToolDir, int nFaceUse, double dToolThick, int nGrade = 3) ;
|
||||
bool ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp = false) const ;
|
||||
bool ApproxWithLines( ICurveComposite* pCompo) const ;
|
||||
bool ApproxWithLines( ICurveComposite* pCompo, double dMaxLen = 0) const ;
|
||||
bool VerifyArcs( ICurveComposite* pCompo, double dMaxAngCen = MAX_ANG_CEN) const ;
|
||||
|
||||
bool CalcAndSetBBox( int nClId) ;
|
||||
@@ -133,9 +133,15 @@ class Operation : public IUserObj
|
||||
std::string ExtractHint( const std::string& sNotes) const ;
|
||||
bool SetBlockedRotAxis( const std::string& sBlockedAxis) const ;
|
||||
bool CalculateAxesValues( const std::string& sHint, bool bRotContOnNext = true, bool bSolChExact = false) ;
|
||||
bool CalculateClPathCenterAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
|
||||
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
|
||||
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
|
||||
bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
|
||||
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
|
||||
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
|
||||
bool CalculateClPathRobotAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
|
||||
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
|
||||
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec) ;
|
||||
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
|
||||
bool AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, const DBLVECTOR& vAxPrev, bool bMaxZ) ;
|
||||
bool ToolChangeNeeded( const Operation& Op1, const Operation& Op2) const ;
|
||||
@@ -145,6 +151,9 @@ class Operation : public IUserObj
|
||||
bool RemoveRise( int nClPathId = GDB_ID_NULL) ;
|
||||
bool AddHome( void) ;
|
||||
bool RemoveClimbRiseHome( void) ;
|
||||
bool AddRobotClimb( int nEntId, double dDeltaZ) ;
|
||||
bool CalcRobotAxesAbovePos( const Point3d& ptP, const Vector3d& vtT, const Vector3d& vtA, double dDeltaZ,
|
||||
DBLVECTOR& vAx, double* pdNewDeltaZ = nullptr) const ;
|
||||
bool CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) const ;
|
||||
bool GetExtraZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
|
||||
const DBLVECTOR& vAx2, const Vector3d& vtTool2,
|
||||
@@ -157,10 +166,12 @@ class Operation : public IUserObj
|
||||
int GetUserNotesZmax( void) const ;
|
||||
bool GetZHomeDown( void) const ;
|
||||
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
|
||||
bool SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nFlag2, bool& bModif) ;
|
||||
int SpecialTestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
|
||||
bool SpecialMoveZup( DBLVECTOR& vAx, Vector3d& vtTool, int& nFlag, int& nFlag2, bool& bModif) ;
|
||||
bool SpecialMoveRapid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, DBLVECTOR& vAxNew, bool& bModif) ;
|
||||
|
||||
bool GetAggrBottomData( const std::string& sHead, AggrBottom& agbData) const ;
|
||||
bool IsAggrBottom( const std::string& sHead) const ;
|
||||
|
||||
protected :
|
||||
int m_nOwnerId ; // identificativo dell'oggetto geometrico possessore
|
||||
@@ -176,6 +187,7 @@ class Operation : public IUserObj
|
||||
bool SetCorrAuxDir( const Vector3d& vtDir) ;
|
||||
bool SetFeed( double dFeed) ;
|
||||
bool SetFlag( int nFlag) ;
|
||||
bool SetFlagOnLastMove( int nFlag) ;
|
||||
bool SetFlag2( int nFlag2) ;
|
||||
bool SetIndex( int nIndex) ;
|
||||
bool GetCurrPos( Point3d& ptCurr) const
|
||||
@@ -222,3 +234,5 @@ inline Operation* GetOperation( IUserObj* pUserObj)
|
||||
enum { TOOL_PARAL = 1, TOOL_ORTHO = 2, TOOL_ORTUP = 3, TOOL_PAR_SLANT= 4} ;
|
||||
// tipo di utilizzo contorno faccia
|
||||
enum { FACE_DOWN = 1, FACE_TOP = 2, FACE_FRONT = 3, FACE_BACK = 4, FACE_LEFT = 5, FACE_RIGHT = 6, FACE_CONT = 7} ;
|
||||
// risultato di SpecialTestCollisionAvoid
|
||||
enum { SCAV_ERROR = -1, SCAV_COLLIDE = 0, SCAV_AVOID = 1, SCAV_TOTEST = 2};
|
||||
|
||||
@@ -82,6 +82,18 @@ Operation::SetFlag( int nFlag)
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::SetFlagOnLastMove( int nFlag)
|
||||
{
|
||||
int nLastEntId = m_pGeomDB->GetLastInGroup( m_nPathId) ;
|
||||
CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nLastEntId)) ;
|
||||
if ( pCamData == nullptr)
|
||||
return false ;
|
||||
pCamData->SetFlag( nFlag) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::SetFlag2( int nFlag2)
|
||||
|
||||
@@ -206,6 +206,8 @@ static const std::string ON_ESTIM_RAPID = "OnEstimRapid" ;
|
||||
static const std::string ON_ESTIM_LINEAR = "OnEstimLinear" ;
|
||||
static const std::string ON_ESTIM_ARC = "OnEstimArc" ;
|
||||
// Funzioni simulazione
|
||||
static const std::string ON_SIMUL_INIT = "OnSimulInit" ;
|
||||
static const std::string ON_SIMUL_EXIT = "OnSimulExit" ;
|
||||
static const std::string ON_SIMUL_START = "OnSimulStart" ;
|
||||
static const std::string ON_SIMUL_END = "OnSimulEnd" ;
|
||||
static const std::string ON_SIMUL_DISPOSITION_STARTING = "OnSimulDispositionStarting" ;
|
||||
|
||||
+3935
-1356
File diff suppressed because it is too large
Load Diff
+93
-41
@@ -69,6 +69,17 @@ class Pocketing : public Machining
|
||||
Pocketing( void) ;
|
||||
|
||||
private :
|
||||
// Debug functions ----
|
||||
void DrawLoopsSurf( const ISurfFlatRegion* pSfr, bool bWithSurf = true, Color Col = Color( 0., 0., 1., 0.45),
|
||||
bool bAlphaCoverage = false) ;
|
||||
void DrawSimpleSurf( const ISurfFlatRegion* pSrf, Color Col = Color( 0., 0., 1., 0.45)) ;
|
||||
void DrawVectorCurves( const ICRVCOMPOPOVECTOR& vCrv) ;
|
||||
void DrawSimpleCurve( const ICurveComposite* pCrv, bool bUniform = false, Color Col = WHITE) ;
|
||||
void DrawSimpleTriMesh( const ISurfTriMesh* pStm, Color Col = Color( 0., 0., 0., 1.)) ;
|
||||
void DrawSimplePoint( const Point3d& pT, Color Col = WHITE) ;
|
||||
void DrawSimpleVector( const Vector3d& vt, Point3d ptPos = ORIG, Color Col = WHITE) ;
|
||||
// --------------------
|
||||
|
||||
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
|
||||
bool GetCurvesAndPartialVolume( SelData Id, ICURVEPLIST& lstPC, ISurfTriMesh* pStmTmp, Vector3d& vtN) ;
|
||||
bool GetForcedClosed( void) ;
|
||||
@@ -81,62 +92,89 @@ class Pocketing : public Machining
|
||||
bool GeneratePocketingPv( int nPathId, const ISurfTriMesh* pStm_PartVolume) ;
|
||||
bool CheckSimpleOverlap( const ICurve* pCrv, const ICurveComposite* pCrvOri, int& nStat, double dToll) ;
|
||||
bool CalcDepth( const int nId, const Vector3d& vtExtr, double dThick, double& dDepth) ;
|
||||
bool ChainCurveArray( const SELVECTOR vInds, ICURVEPOVECTOR& vpCrvs, ICRVCOMPOPOVECTOR& vCrvCompo) ;
|
||||
bool ChainCurveArray( ICURVEPOVECTOR& vpCrvs, ICRVCOMPOPOVECTOR& vCrvCompo) ;
|
||||
bool CreateStmForIntersection( ISurfTriMesh* pStm, ICRVCOMPOPOVECTOR& vCrvCompo, const Vector3d& vtN) ;
|
||||
bool CalcOffsExtensionsForCurves( const ICurveComposite* pCrvCompo, const Vector3d& vtN, double& dExt) ;
|
||||
bool GetExtendedLoopToFitStmVolume( ICurveComposite* pCrvLoop, const double& dExt, const Vector3d& vtN) ;
|
||||
bool GetCurrentPart( const Point3d& ptInside, ISurfTriMesh* pStmPart) ;
|
||||
bool SetPocketingVolume( const Point3d& ptInside, ISurfTriMesh* pStm) ;
|
||||
bool GetCurrentPart( const PNTVECTOR& vPtInside, ISurfTriMesh* pStmPart) ;
|
||||
bool SetPocketingVolume( const PNTVECTOR& vPtInside, ISurfTriMesh* pStm) ;
|
||||
bool AdjustPocketingSideForVolumePart( ISurfTriMesh* pStmVolPart, const Vector3d& vtTool) ;
|
||||
bool SewingMissingFacesOnPlanes( ISurfTriMesh* pStm, const Plane3d& plPlane) ;
|
||||
bool SliceVolume( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part, ISURFFRPOVECTOR& vSrfSliced,
|
||||
std::vector<ICRVCOMPOPOVECTOR>& vCrvOEWithFlags, BOOLVECTOR& vbChangedPrec,
|
||||
VCT3DVECTOR& vVtTrasl, int& nStep, const Vector3d vtTool,
|
||||
const double dElev, const double dDepth, const double dStep) ;
|
||||
bool ChainBisectors( ICURVEPOVECTOR& vpCrvs, ICRVCOMPOPOVECTOR& vCrvCompo) ;
|
||||
bool ChooseBestBisectorPath( ICRVCOMPOPOVECTOR& vCrvCompo, const Point3d& ptS,
|
||||
const Point3d& ptE, ICurveComposite* pCrvPath) ;
|
||||
bool GetSpecialElevation( const ISurfFlatRegion* pSfr, const ICurveLine* pLine, const bool bInVsOut,
|
||||
double& dElev) ;
|
||||
|
||||
bool GetDangerSfrForSideStep( const ISurfFlatRegion* pSfr, const ISurfTriMesh* pStm_Part, const double dExtraLenInOut,
|
||||
ISurfFlatRegion* pSfrDanger) ;
|
||||
bool AdjustTrapezoidSpiralLeadInLeadOutForSideAngle( ICurveComposite* pMCrv, const double dExtraLenInOut,
|
||||
const int nOutsideRaw, const Vector3d& vtN) ;
|
||||
bool GetRaw( ISurfTriMesh* pStmRaw) ;
|
||||
bool SliceVolume( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part, const ISurfTriMesh* pSt_Raw,
|
||||
ISURFFRPOVECTOR& vSrfSliced, ISURFFRPOVECTOR& vSfrLimit, std::vector<ICRVCOMPOPOVECTOR>& vCrvOEWithFlags,
|
||||
BOOLVECTOR& vbChangedPrec, VCT3DVECTOR& vVtTrasl, int& nStep, const Vector3d vtTool,
|
||||
const double dElev, const double dDepth, const double dStep, double& dExtraLenInOut) ;
|
||||
bool TranslateVolumeFaces( const double dTrasl, Frame3d& frElevation, ISurfTriMesh* pStmVol, ISurfTriMesh* pStm_Part,
|
||||
ISurfTriMesh* pStmRaw) ;
|
||||
bool CalcExtraSteps( const ISurfTriMesh* pStmVol, VCT3DVECTOR& vVtTrasl, int& nStep, const double dElev,
|
||||
const double dDepth, const double dStep, INTVECTOR& vIndExtraSteps,
|
||||
ISURFTMPOVECTOR& vStmES_Edges_OC) ;
|
||||
bool CutVolumeByPlane( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part, const Vector3d& vtTrasl,
|
||||
const bool bIsExtraStep, ISurfFlatRegion* pSfrResult) ;
|
||||
bool CheckSideAngleForVolume( const ISurfTriMesh* pStmVol_Sliced, const ISurfTriMesh* pStm_Part,
|
||||
ISurfFlatRegion* pSfr_Projection, double& dExtraLenInOut, ISurfFlatRegion* pSfr) ;
|
||||
bool ProjectVolume( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part, const Vector3d& vtTrasl,
|
||||
const Vector3d& vtTraslPrec, ISurfFlatRegion* pSfrOpenProjPrec, ISurfFlatRegion* pSfr) ;
|
||||
const Vector3d& vtTraslPrec, const bool bIsExtraStep, ISurfFlatRegion* pSfrOpenProjPrec,
|
||||
ISurfFlatRegion* pSfr, const bool bOneStep, double& dExtraLenInOut) ;
|
||||
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStm, const bool bOnIsClosed = false) ;
|
||||
bool SimplifySfrLoops( ISurfFlatRegion* pSfr) ;
|
||||
bool GetCurvesForOptimizedPocketing( ISurfFlatRegion* pSfr, ICRVCOMPOPOVECTOR& vCrvOEWithFlags) ;
|
||||
bool ModifySurfByOpenEdges( ISurfFlatRegion* pSfr, const ISurfFlatRegion* pSfrLimit) ;
|
||||
bool AdjustContourWithOpenEdges( ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vCrvIsl, const double dDiam,
|
||||
const double dOffR, const double dStep, const ISurfFlatRegion* pSfrLimit) ;
|
||||
bool AdjustOpenEdge( const ICurveComposite* pCrvCompo, const ICRVCOMPOPOVECTOR& vCrvIsland,
|
||||
const double dParS, const double dParE, const double dRad, const double dDiamJ,
|
||||
const double dParS, const double dParE, const Vector3d& vtTanS,
|
||||
const Vector3d& vtTanE, const double dRad, const double dDiamJ,
|
||||
const ISurfFlatRegion* pSfrLimit, ICurveComposite* pCrvBorder) ;
|
||||
bool GetProjectionOfStmToNotPocket( const ISurfTriMesh* pStmPart, const ISurfTriMesh* pStmVol,
|
||||
bool GetProjectionOfStmToNotPocket( const ISurfTriMesh* pStm, const ISurfTriMesh* pStmVol,
|
||||
const Vector3d& vtTrasl, ISurfFlatRegion* pSfrProj) ;
|
||||
bool CreateSurfFrIncidence( const ICurveComposite* pCrv, const double dRad, ISurfFlatRegion* pSfrInc) ;
|
||||
bool CreateSurfFrIncidence( const ICurveComposite* pCrv, const Vector3d& vtTanS, const Vector3d& vtTaneE,
|
||||
const double dRad, ISurfFlatRegion* pSfrInc) ;
|
||||
bool GetNewSfrByAnotherPocketing( ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrNoExtendedByOpenEdges,
|
||||
const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part,
|
||||
const ISurfFlatRegion* pSfrLimit) ;
|
||||
bool CalcAdaptedElevation( const Point3d& pt1, const Point3d& pt2) ;
|
||||
bool GetHomogeneousParts( ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vpCrvs) ;
|
||||
bool OptimizedSpiralCirle( const ICurveComposite* pCrvCompo, const double dToll, double& dRad,
|
||||
Point3d& ptC, bool& bIsCirlce) ;
|
||||
bool ModifyCurveToSmoothed( ICurveComposite* pCrv, double dRightLen, double dLeftLen, bool bAsParam) ;
|
||||
bool OrderCurvesByLastPntOfPath( ICRVCOMPOPOVECTOR& vCrv, Point3d ptEnd, PNTVECTOR& vPtStart,
|
||||
VCT3DVECTOR& vVtOut, BOOLVECTOR& vbMidOut) ;
|
||||
bool SetBetterPtStartForSubChunks( ICurveComposite* pCrv0, const ISurfFlatRegion* pSrfToWork, Point3d& ptStart,
|
||||
Vector3d& vtMidOut, bool& bMidOut) ;
|
||||
bool SetPtStartForPath( ICurveComposite* pCrv0, const ISurfFlatRegion* pSrfToWork, const Point3d& ptEndPrec,
|
||||
const Frame3d& frPocket, Point3d& ptStart, Vector3d& vtMidOut, bool& bMidOut,
|
||||
int nOffs = 0, ICurveComposite* pCrvOrig = nullptr) ;
|
||||
bool SetSpecialPtStartForOpenEdges( const ICurveComposite* pCrvOrig, const Frame3d& frPocket,
|
||||
ICurveComposite* pCrvCompo, Point3d& ptStart, Vector3d& vtMidOut,
|
||||
bool& bMidOut) ;
|
||||
bool GetOptCrvIndex( const std::vector<ICRVCOMPOPOVECTOR>& vCrvOEWithFlags, int nStep, ISurfFlatRegion* pSrfChunkFinal,
|
||||
int& nIndex) ;
|
||||
bool GetTrapezoidFromShape( const ICurveComposite* pCrvCompo, ICurveComposite* pCrvTrap, Frame3d& frTrap,
|
||||
double& dPocketSize, int& nBase, int& nSecondBase) ;
|
||||
bool GetBoxCrvOptTrap( const int nCrv, const ICurveComposite* pCrvCompo, const double dDiam, int& nType, ICurveComposite* pCrvBox) ;
|
||||
bool CheckTrapezoidClosedEdgePosition( const ICurveComposite* pCrvCompo, const int nCrvInd, const double dDimBoxY,
|
||||
INTVECTOR& vIndClosedSides, bool& bOk,
|
||||
ICurveComposite* pCrvTrap) ;
|
||||
bool CheckSecondBaseTrapezoid( const ICurveComposite* pCrvCompo, const int nCrvInd, int& nSecondBase) ;
|
||||
bool PreparareTrapezoidTwoBases( const ICurveComposite* pCrvCompo, BBox3d BBox, const int nBase, int& nSecondBase,
|
||||
bool& bOk, ICurveComposite* pCrvTrap) ;
|
||||
bool PreparareTrapezoidTwoBases( const ICurveComposite* pCrvCompo, const double dDiam, const int nType, int& nBase,
|
||||
int& nSecondBase, bool& bOk, ICurveComposite* pCrvTrap) ;
|
||||
bool GetSfrByStm( const ISurfTriMesh* pStm, ISurfFlatRegion* pSfr, const Plane3d plPock, const Vector3d& vtExtr,
|
||||
const double dThick, double dToll = 5 * EPS_SMALL) ;
|
||||
bool ProjectStmOnPlane( const ISurfTriMesh* pStmAbove, const Plane3d plPock, ISurfFlatRegion* pSfrProj) ;
|
||||
bool GetCoeffLinArc( const ICurveArc* pArc, double dDiam, double& dSubArc) ;
|
||||
bool GetParamOnOpenSide( const ICurveComposite* pCompo,const ICRVCOMPOPOVECTOR& vCrvIsl, Point3d& ptMid, Vector3d& vtMidOut) ;
|
||||
bool AdjustContourStart( ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvIsl, bool bOrder = false) ;
|
||||
bool GetParamOnOpenSide( const ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvIsl,
|
||||
const Frame3d& frPocket, Point3d& ptMid, Vector3d& vtMidOut) ;
|
||||
bool AdjustContourStart( ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvIsl, bool bOrder = false,
|
||||
Point3d ptRef = P_INVALID) ;
|
||||
bool GetParamForPtStartOnEdge( const ICurve* pCrv, const ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvIsl,
|
||||
double& dPar) ;
|
||||
bool CheckForRemovingIsland( const ICurveComposite* pCrvIslandBorder, double dOffs, bool bRemove) ;
|
||||
@@ -163,20 +201,24 @@ class Pocketing : public Machining
|
||||
VCT3DVECTOR& vVtTrasl, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs) ;
|
||||
bool AddSpiralIn( ISURFFRPOVECTOR& vSfr, const std::vector<ICRVCOMPOPOVECTOR>& vCrvOrig, BOOLVECTOR& vbChangedPrec,
|
||||
VCT3DVECTOR& vVtTrasl, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs) ;
|
||||
VCT3DVECTOR& vVtTrasl, ISURFFRPOVECTOR& vSrfLimit, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
const double dDepth, const double dElev, const double dMaxElev, const double dOkStep,
|
||||
const bool bSplitArcs, const double dExtraLenInOut) ;
|
||||
bool AddSpiralOut( ISURFFRPOVECTOR& vSfr, const std::vector<ICRVCOMPOPOVECTOR>& vCrvOrig, BOOLVECTOR& vbChangedPrec,
|
||||
VCT3DVECTOR& vVtTrasl, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs) ;
|
||||
bool CalcSpiral( const ISurfFlatRegion* pSrfPock, int& nReg, Point3d& ptStart, Vector3d& vtMidOut , bool& bMidOut,
|
||||
VCT3DVECTOR& vVtTrasl, ISURFFRPOVECTOR& vSrfLimit, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs,
|
||||
const double dExtraLenInOut) ;
|
||||
bool CalcSpiral( const ISurfFlatRegion* pSrfPock, int& nReg, Point3d& ptStart, const Point3d& ptEndPrec, Vector3d& vtMidOut , bool& bMidOut,
|
||||
bool bSplitArcs,ICurveComposite* pMCrv, ICurveComposite* pRCrv, ICurveComposite* pCrvOEWithFlags,
|
||||
bool vbChangedPrec, bool& bOptimizedTrap) ;
|
||||
bool CheckIfOffsetIsNecessary( const ICurveComposite* pCrvOffs, const double dOffs, const int nIter,
|
||||
const int nOffsCount, const Vector3d& vtN, bool& bInsert) ;
|
||||
bool CreateSpiralPocketingPath( ICRVCOMPOPOVECTOR& vOffs, ICURVEPOVECTOR& vLinks,
|
||||
const ICRVCOMPOPOVECTOR& vOffsClosedCurves, const ICRVCOMPOPOVECTOR& vOffsFirstCurve) ;
|
||||
bool GetUnclearedRegion( ICRVCOMPOPOVECTOR& vFirstOffs, ICRVCOMPOPOVECTOR& vCrvs, ICURVEPOVECTOR& vLinks,
|
||||
const ICurveComposite* pCrv_orig, ISurfFlatRegion* pSrfToCut) ;
|
||||
bool GetDynamicClearedRegion( ISurfFlatRegion* pSrfPrec, const ICurveComposite* pCrv) ;
|
||||
bool RemoveFirstLoopFromSfr( ISurfFlatRegion* pSrfOrig ) ;
|
||||
bool RemoveFirstLoopFromSfr( ISurfFlatRegion* pSrfOrig) ;
|
||||
bool RemoveExtraParts( ISurfFlatRegion* pSrfToCut, ICRVCOMPOPOVECTOR& vOffs, ICRVCOMPOPOVECTOR& vOffsClosedCurves,
|
||||
ICRVCOMPOPOVECTOR& vOffsFirstCurve, ICURVEPOVECTOR& vLinks) ;
|
||||
bool RemoveExtraPartByMedialAxis( const ISurfFlatRegion* pChunkToCut, ICRVCOMPOPOVECTOR& vOffsFirstCurve,
|
||||
@@ -193,20 +235,24 @@ class Pocketing : public Machining
|
||||
ICurveComposite* pPath2, ICRVCOMPOPOVECTOR& vOffsCL) ;
|
||||
bool GetCurveWeightInfo( const ICurveComposite* pCrvCompo, double dMaxLen, double& dToTRot, int& nSmallArcs, int& nSmallLines) ;
|
||||
bool ChoosePath( const ICurveComposite* pCrv1, const ICurveComposite* pCrv2, int nP, double dPerP, double dMaxLen, int& nC) ;
|
||||
bool CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, ICRVCOMPOPOVECTOR& vOffIslands,
|
||||
bool CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, const ICRVCOMPOPOVECTOR& vOffIslands,
|
||||
ICurveComposite* pCrvLink) ;
|
||||
bool CalcBoundedSmootedLink( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd, const Vector3d& vtEnd, double dParMeet,
|
||||
ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink) ;
|
||||
bool CalcBoundedSmootedLink( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd,
|
||||
const Vector3d& vtEnd, const double dParMeet,
|
||||
const ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink) ;
|
||||
bool ModifyBiArc( ICurve* pCrvBiArc, double dCutToll, ICurveComposite* pNewCrv) ;
|
||||
bool CutCurveByOffsets( ICurveComposite* pCurve, ICRVCOMPOPOVECTOR& vOffs) ;
|
||||
bool CutCurveToConnect( ICurveComposite* pCrvS, ICurveComposite* pCrvE, ICRVCOMPOPOVECTOR& vOffs, ICRVCOMPOPOVECTOR& vOffIslands,
|
||||
ICurveComposite* pCrvLink, double dLenPercS = 0.01, double dLenPercE = 0.01, int nMaxIter = 2) ;
|
||||
bool CutCurveToConnect( ICurveComposite* pCrvS, ICurveComposite* pCrvE, const ICRVCOMPOPOVECTOR& vOffs,
|
||||
const ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink,
|
||||
double dLenPercS = 0.01, double dLenPercE = 0.01, int nMaxIter = 2) ;
|
||||
bool CalcBoundedLinkWithBiArcs( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd, const Vector3d& vtEnd,
|
||||
const ICurve* pCrvBound, ICurveComposite* pCrvLink) ;
|
||||
bool CalcCircleSpiral( const Point3d& ptCen, const Vector3d& vtN, double dOutRad, double dIntRad,
|
||||
bool bSplitArcs, ICurveComposite* pMCrv, ICurveComposite* pRCrv) ;
|
||||
bool CalcTrapezoidSpiral( ICurveComposite* pCrvPocket, const Frame3d& frTrap, double dPocketSize, int nBase,
|
||||
int nSecondBase, ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool& bOptimizedTrap) ;
|
||||
bool CalcSingleOffsetSpiral( const ISurfFlatRegion* pSfr, ICurveComposite* pOffs,
|
||||
Point3d& ptStart, Vector3d& vtMidOut, bool& bMidOut) ;
|
||||
bool CalcTrapezoidSpiralLocalFrame( ICurveComposite * pCrvPocket, const Vector3d& vtDir, Frame3d& frLoc) ;
|
||||
bool CalcTrapezoidSpiralXCoord( const ICurveComposite * pCrvPocket, int nBase,int nSecondBase,
|
||||
bool bStart, double dYCoord, double& dXCoord, double dPocketSize) ;
|
||||
@@ -248,8 +294,9 @@ class Pocketing : public Machining
|
||||
double dElev, double dAppr) ;
|
||||
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
|
||||
const ICurveComposite* pRCrv, Point3d& ptP1) const ;
|
||||
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
|
||||
ISurfFlatRegion* pSrfChunk, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs,
|
||||
bool AddLeadIn( const ICurveComposite* pCrvCompo, const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
|
||||
const Vector3d& vtEnd, const Vector3d& vtN, ISurfFlatRegion* pSrfChunk,
|
||||
const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs,
|
||||
bool bNoneForced = false, bool bSkipControl = false) ;
|
||||
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
|
||||
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced, Point3d& ptP1,
|
||||
@@ -257,7 +304,12 @@ class Pocketing : public Machining
|
||||
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
|
||||
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced,
|
||||
Point3d& ptP1, double& dElev, bool& bOppositeHome, bool bRecalcElev = true) ;
|
||||
bool SetLeadInPointStart( const Point3d& ptCurr, const Vector3d vtN,
|
||||
const bool& bAtLeft, Vector3d& vtStart, Point3d& ptDest) ;
|
||||
bool CalcLinkOnStep( const Point3d& ptS, const Point3d& ptE, const ISurfFlatRegion* pSfr,
|
||||
const ISurfFlatRegion* pSfrLimit, ICurveComposite* pCrvStepLink) ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
|
||||
// ===================================================================
|
||||
|
||||
private :
|
||||
@@ -311,14 +363,14 @@ class Pocketing : public Machining
|
||||
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
|
||||
bool m_bOpenOutRaw ; // flag forzatura lati aperti sempre fuori dal grezzo
|
||||
double m_dOpenMinSafe ; // minima distanza di sicurezza di attacco su lato aperto
|
||||
bool m_bOptOffset = true ; // flag per ottimizzazione numero di Offset necessari
|
||||
bool m_bOptOffsetCM = false ; // flag per ottimizzazione numero di Offset necessari con centroidi e medial Axis
|
||||
bool m_bAssignFeed = false ; // flag per controllo della Feed
|
||||
double m_dDiam_Prec = 0.0 ; // diametro utensile per precedente svuotatura
|
||||
double m_dOffsetR_Prec = 0.0 ; // offset radiale della svuotatura precedente
|
||||
double m_dSideStep_Prec = 0.0 ; // side Step della svuotatura precedente
|
||||
double m_dLen_Prec = 0.0 ; // Lunghezza del tool precedente
|
||||
bool m_bOrderStepZ = true ; // parametro per ordinare gli step Extra per Z decrescente o meno
|
||||
bool m_bPocketPlane = false ; // flag per svuotare solo la rimanenza sullo Step Extra
|
||||
|
||||
bool m_bOptOffset ; // flag per ottimizzazione numero di Offset necessari
|
||||
bool m_bOptOffsetCM ; // flag per ottimizzazione numero di Offset necessari con centroidi e medial Axis
|
||||
bool m_bAssignFeed ; // flag per controllo della Feed
|
||||
double m_dDiam_Prec ; // diametro utensile per precedente svuotatura
|
||||
double m_dOffsetR_Prec ; // offset radiale della svuotatura precedente
|
||||
double m_dSideStep_Prec ; // side Step della svuotatura precedente
|
||||
double m_dLen_Prec ; // Lunghezza del tool precedente
|
||||
bool m_bOrderStepZ ; // parametro per ordinare gli step Extra per Z decrescente o meno
|
||||
bool m_bPocketPlane ; // flag per svuotare solo la rimanenza sullo Step Extra
|
||||
double m_dOpenEdgeRad ; // raggio di rientro per i lati aperti
|
||||
} ;
|
||||
+73
-23
@@ -61,6 +61,7 @@ Simulator::Simulator( void)
|
||||
m_pGeomDB = nullptr ;
|
||||
m_pMachine = nullptr ;
|
||||
m_pPerfCnt = nullptr ;
|
||||
m_nStatus = SIS_CREATED ;
|
||||
m_dStep = MID_STEP ;
|
||||
m_nUiStatus = MCH_UISIM_NULL ;
|
||||
m_nOpId = GDB_ID_NULL ;
|
||||
@@ -92,6 +93,8 @@ Simulator::~Simulator( void)
|
||||
{
|
||||
// porto la macchina in posizione home
|
||||
GoHome() ;
|
||||
// gestione evento uscita dal simulatore
|
||||
OnExit() ;
|
||||
// rimuovo tavola variabili globali
|
||||
m_pMachine->LuaResetGlobVar( GLOB_VAR) ;
|
||||
// rimuovo performance counter
|
||||
@@ -113,6 +116,7 @@ Simulator::Init( MachMgr* pMchMgr)
|
||||
m_pGeomDB = m_pMchMgr->GetGeomDB() ;
|
||||
m_pMachine = m_pMchMgr->GetCurrMachine() ;
|
||||
m_pPerfCnt = new PerformanceCounter ;
|
||||
m_nStatus = SIS_INITIALIZED ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
@@ -129,8 +133,8 @@ Simulator::Start( bool bFirst)
|
||||
|
||||
bool bOk = true ;
|
||||
|
||||
// Se avvio vero
|
||||
if ( bFirst) {
|
||||
// Se appena entrati in simulazione
|
||||
if ( m_nStatus == SIS_INITIALIZED) {
|
||||
// Forzo aggiornamento attrezzaggio della macchinata
|
||||
if ( ! m_pMchMgr->UpdateCurrSetup())
|
||||
bOk = false ;
|
||||
@@ -167,19 +171,42 @@ Simulator::Start( bool bFirst)
|
||||
m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_VER, GetEMkVer()) ;
|
||||
m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_MACHNAME, m_pMachine->GetMachineName()) ;
|
||||
|
||||
// Richiamo funzione su avvio simulazione
|
||||
if ( ! OnStart( bFirst))
|
||||
// Se appena entrati in simulazione
|
||||
if ( m_nStatus == SIS_INITIALIZED) {
|
||||
if ( ! OnInit())
|
||||
bOk = false ;
|
||||
m_nStatus = SIS_READYTOSTART ;
|
||||
}
|
||||
|
||||
// Richiamo funzione per evento avvio simulazione
|
||||
if ( ! OnProgramStart( bFirst))
|
||||
bOk = false ;
|
||||
|
||||
// Arrivo alla preparazione per la prima lavorazione
|
||||
int nStatus ;
|
||||
if ( ! FindAndManageOperationStart( true, bFirst, nStatus) && nStatus != MCH_SIM_STOP)
|
||||
bOk = false ;
|
||||
// se sono ancora su disposizione
|
||||
if ( m_pMchMgr->GetOperationType( m_nOpId) == OPER_DISP) {
|
||||
// ricerca e gestione inizio percorso di lavoro
|
||||
if ( ! FindAndManagePathStart( nStatus))
|
||||
return false ;
|
||||
// eventuali comandi ausiliari di inizio percorso
|
||||
while ( m_nAuxSInd < m_nAuxSTot) {
|
||||
if ( ! ManagePathStartAux( nStatus))
|
||||
return false ;
|
||||
}
|
||||
// aggiornamento assi per eventuali teste caricate
|
||||
UpdateAxes() ;
|
||||
}
|
||||
|
||||
// Reset timer
|
||||
if ( m_pPerfCnt != nullptr)
|
||||
m_pPerfCnt->Start() ;
|
||||
|
||||
// Imposto lo stato interno
|
||||
m_nStatus = ( bOk ? SIS_READYTORUN : SIS_READYTOSTART) ;
|
||||
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
@@ -235,7 +262,7 @@ bool
|
||||
Simulator::Move( int& nStatus)
|
||||
{
|
||||
// Verifiche
|
||||
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr || m_pMachine == nullptr) {
|
||||
if ( m_pGeomDB == nullptr || m_pMchMgr == nullptr || m_pMachine == nullptr || m_nStatus != SIS_READYTORUN) {
|
||||
nStatus = MCH_SIM_ERR ;
|
||||
return false ;
|
||||
}
|
||||
@@ -279,7 +306,7 @@ Simulator::Move( int& nStatus)
|
||||
return false ;
|
||||
// se non ce ne sono altre, sono alla fine
|
||||
if ( m_nOpId == GDB_ID_NULL) {
|
||||
OnEnd() ;
|
||||
OnProgramEnd() ;
|
||||
nStatus = MCH_SIM_END ;
|
||||
return false ;
|
||||
}
|
||||
@@ -555,7 +582,7 @@ Simulator::UpdateAxes( void)
|
||||
if ( ! pMachine->GetAllCurrAxesName( m_AxesName) ||
|
||||
! pMachine->GetAllCurrAxesToken( m_AxesToken))
|
||||
return false ;
|
||||
// Aggiorno flag invertito, il tipo e la posizione corrente degli assi macchina attivi
|
||||
// Aggiorno flag di invertito, offset, tipo e posizione corrente degli assi macchina attivi
|
||||
for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i) {
|
||||
bool bInvert ;
|
||||
m_pMachine->GetAxisInvert( m_AxesName[i], bInvert) ;
|
||||
@@ -833,8 +860,9 @@ Simulator::FindAndManagePathStart( int& nStatus)
|
||||
}
|
||||
// se altrimenti trovato nuovo CL path vuoto
|
||||
else if ( m_nCLPathId != GDB_ID_NULL) {
|
||||
// non ci possono essere eventi ausiliari di inizio
|
||||
m_nAuxSTot = 0 ;
|
||||
// recupero il numero di eventi ausiliari di inizio
|
||||
if ( ! m_pGeomDB->GetInfo( m_nCLPathId, KEY_AS_TOT, m_nAuxSTot))
|
||||
m_nAuxSTot = 0 ;
|
||||
m_nAuxSInd = 0 ;
|
||||
// recupero il numero di eventi ausiliari di fine
|
||||
if ( ! m_pGeomDB->GetInfo( m_nCLPathId, KEY_AE_TOT, m_nAuxETot))
|
||||
@@ -998,8 +1026,8 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
|
||||
// Calcolo distanza di movimento
|
||||
double dSqDist = 0 ;
|
||||
for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i) {
|
||||
// coefficiente moltiplicativo per differenziare assi lineari (primi 3) e rotanti (altri)
|
||||
double dSqCoeff = (( i < 3) ? 1 : SQ_COEFF_ROT_MOVE) ;
|
||||
// coefficiente moltiplicativo per differenziare assi lineari e rotanti
|
||||
double dSqCoeff = ( m_AxesLinear[i] ? 1 : SQ_COEFF_ROT_MOVE) ;
|
||||
dSqDist += dSqCoeff * ( AxesEnd[i] - m_AxesVal[i]) * ( AxesEnd[i] - m_AxesVal[i]) ;
|
||||
}
|
||||
// Calcolo distanza di movimento eventuali assi ausiliari
|
||||
@@ -1411,27 +1439,27 @@ Simulator::ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
|
||||
if ( m_CollObj[j].nType == MCH_SIM_COB_BOX) {
|
||||
Vector3d vtDiag( m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3) ;
|
||||
if ( pVZM != nullptr)
|
||||
bOk = pVZM->AvoidBox( frObj, vtDiag, m_dSafeDist) ;
|
||||
bOk = ! pVZM->CDeBox( frObj, vtDiag, m_dSafeDist) ;
|
||||
else
|
||||
bOk = ! CDeBoxClosedSurfTm( frObj, vtDiag, m_dSafeDist, *pSTM) ;
|
||||
bOk = ! CDeBoxClosedSurfTm( frObj, vtDiag, *pSTM, m_dSafeDist) ;
|
||||
}
|
||||
else if ( m_CollObj[j].nType == MCH_SIM_COB_CYL) {
|
||||
if ( pVZM != nullptr)
|
||||
bOk = pVZM->AvoidCylinder( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_dSafeDist) ;
|
||||
bOk = ! pVZM->CDeCylinder( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_dSafeDist) ;
|
||||
else
|
||||
bOk = ! CDeCylClosedSurfTm( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_dSafeDist, *pSTM) ;
|
||||
bOk = ! CDeCylClosedSurfTm( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, *pSTM, m_dSafeDist) ;
|
||||
}
|
||||
else if ( m_CollObj[j].nType == MCH_SIM_COB_SPHE) {
|
||||
if ( pVZM != nullptr)
|
||||
bOk = pVZM->AvoidSphere( frObj.Orig(), m_CollObj[j].dPar1, m_dSafeDist) ;
|
||||
bOk = ! pVZM->CDeSphere( frObj.Orig(), m_CollObj[j].dPar1, m_dSafeDist) ;
|
||||
else
|
||||
bOk = ! CDeSpheClosedSurfTm( frObj.Orig(), m_CollObj[j].dPar1, m_dSafeDist, *pSTM) ;
|
||||
bOk = ! CDeSpheClosedSurfTm( frObj.Orig(), m_CollObj[j].dPar1, *pSTM, m_dSafeDist) ;
|
||||
}
|
||||
else if ( m_CollObj[j].nType == MCH_SIM_COB_CONE) {
|
||||
if ( pVZM != nullptr)
|
||||
bOk = pVZM->AvoidConeFrustum( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3, m_dSafeDist) ;
|
||||
bOk = ! pVZM->CDeConeFrustum( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3, m_dSafeDist) ;
|
||||
else
|
||||
bOk = ! CDeConeFrustumClosedSurfTm( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3, m_dSafeDist, *pSTM) ;
|
||||
bOk = ! CDeConeFrustumClosedSurfTm( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3, *pSTM, m_dSafeDist) ;
|
||||
}
|
||||
}
|
||||
// altrimenti poliedro
|
||||
@@ -1440,7 +1468,7 @@ Simulator::ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
|
||||
const ISurfTriMesh* pStmLoc = GetSurfTriMesh( SurfLoc) ;
|
||||
if ( pStmLoc != nullptr) {
|
||||
if ( pVZM != nullptr)
|
||||
bOk = pVZM->AvoidSurfTm( *pStmLoc, m_dSafeDist) ;
|
||||
bOk = ! pVZM->CDeSurfTm( *pStmLoc, m_dSafeDist) ;
|
||||
else
|
||||
bOk = ! CDeClosedSurfTmClosedSurfTm( *pStmLoc, *pSTM, m_dSafeDist) ;
|
||||
}
|
||||
@@ -1460,7 +1488,29 @@ Simulator::ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::OnStart( bool bFirst)
|
||||
Simulator::OnInit( void)
|
||||
{
|
||||
// verifico esistenza funzione
|
||||
if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_INIT))
|
||||
return true ;
|
||||
// chiamo la funzione di ingresso nella simulazione
|
||||
return m_pMachine->LuaCallFunction( ON_SIMUL_INIT) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::OnExit( void)
|
||||
{
|
||||
// verifico esistenza funzione
|
||||
if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_EXIT))
|
||||
return true ;
|
||||
// chiamo la funzione di uscita dalla simulazione
|
||||
return m_pMachine->LuaCallFunction( ON_SIMUL_EXIT) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::OnProgramStart( bool bFirst)
|
||||
{
|
||||
// assegno flag inizio simulazione
|
||||
bool bOk = m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_SIM1ST, bFirst) ;
|
||||
@@ -1474,7 +1524,7 @@ Simulator::OnStart( bool bFirst)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Simulator::OnEnd( void)
|
||||
Simulator::OnProgramEnd( void)
|
||||
{
|
||||
// verifico esistenza funzione
|
||||
if ( ! m_pMachine->LuaExistsFunction( ON_SIMUL_END))
|
||||
@@ -2223,7 +2273,7 @@ Simulator::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
|
||||
}
|
||||
}
|
||||
// Aggiorno visualizzazione
|
||||
if ( bViewAllFrames || ( i % 2) == 0 || i == nStep)
|
||||
if ( bViewAllFrames || ( i % 4) == 0 || i == nStep)
|
||||
ExeDraw() ;
|
||||
// Verifico collisioni
|
||||
int nCdInd, nObjInd ;
|
||||
|
||||
+9
-2
@@ -86,8 +86,10 @@ class Simulator
|
||||
{ return ( ! m_CollObj.empty() && ! m_CdId.empty()) ; }
|
||||
bool Stopped( void)
|
||||
{ return ( m_nUiStatus == MCH_UISIM_STOP) ; }
|
||||
bool OnStart( bool bFirst) ;
|
||||
bool OnEnd( void) ;
|
||||
bool OnInit( void) ;
|
||||
bool OnExit( void) ;
|
||||
bool OnProgramStart( bool bFirst) ;
|
||||
bool OnProgramEnd( void) ;
|
||||
bool OnDispositionStarting( int nOpId, int nOpInd, int nPhase,
|
||||
const std::string& sTable, const Point3d& ptOri1, bool bEmpty, bool bSomeByHand) ;
|
||||
bool OnDispositionStart( int nOpId, int nOpInd, int nPhase,
|
||||
@@ -135,12 +137,17 @@ class Simulator
|
||||
: sName( sN), sHead( sH), nExit( nE), dTdOffs( dT), dAdOffs( dA) {}
|
||||
} ;
|
||||
typedef std::vector<VmTool> VMTVECTOR ;
|
||||
enum { SIS_CREATED = 0,
|
||||
SIS_INITIALIZED = 1,
|
||||
SIS_READYTOSTART = 2,
|
||||
SIS_READYTORUN = 3} ;
|
||||
|
||||
private :
|
||||
MachMgr* m_pMchMgr ; // puntatore al gestore di tutte le lavorazioni
|
||||
IGeomDB* m_pGeomDB ; // puntatore al DB geometrico
|
||||
Machine* m_pMachine ; // puntatore alla macchina
|
||||
PerformanceCounter* m_pPerfCnt ; // timer per calcolo FPS
|
||||
int m_nStatus ; // stato interno del simulatore (creato, inizializzato, pronto al movimento)
|
||||
double m_dStep ; // lunghezza di riferimento per la velocità di simulazione
|
||||
int m_nUiStatus ; // stato simulazione a livello utente
|
||||
int m_nOpId ; // identificativo della operazione (lavoraz.) corrente
|
||||
|
||||
+8
-8
@@ -738,10 +738,11 @@ ToolsMgr::GetCurrToolThDiam( double& dThDiam) const
|
||||
if ( ! m_bCurrTool)
|
||||
return false ;
|
||||
|
||||
// se punta a forare, lama, fresa o scalpello
|
||||
// se punta a forare, lama, fresa, mortasatrice/sega a catena o scalpello
|
||||
if ( ( m_tdCurrTool.m_nType & TF_DRILLBIT) != 0 ||
|
||||
( m_tdCurrTool.m_nType & TF_SAWBLADE) != 0 ||
|
||||
( m_tdCurrTool.m_nType & TF_MILL) != 0 ||
|
||||
( m_tdCurrTool.m_nType & TF_MORTISE) != 0 ||
|
||||
( m_tdCurrTool.m_nType & TF_CHISEL) != 0) {
|
||||
// recupero le dimensioni del porta utensili
|
||||
double dTHoldBase = 0 ;
|
||||
@@ -761,9 +762,8 @@ ToolsMgr::GetCurrToolThDiam( double& dThDiam) const
|
||||
dThDiam = dTHoldDiam ;
|
||||
return true ;
|
||||
}
|
||||
// se mortasatrice/sega a catena o waterjet
|
||||
else if ( ( m_tdCurrTool.m_nType & TF_MORTISE) != 0 ||
|
||||
( m_tdCurrTool.m_nType & TF_WATERJET) != 0) {
|
||||
// se waterjet
|
||||
else if ( ( m_tdCurrTool.m_nType & TF_WATERJET) != 0) {
|
||||
dThDiam = 0 ;
|
||||
return true ;
|
||||
}
|
||||
@@ -779,10 +779,11 @@ ToolsMgr::GetCurrToolThLength( double& dThLen) const
|
||||
if ( ! m_bCurrTool)
|
||||
return false ;
|
||||
|
||||
// se punta a forare, lama, fresa o scalpello
|
||||
// se punta a forare, lama, fresa, mortasatrice/sega a catena o scalpello
|
||||
if ( ( m_tdCurrTool.m_nType & TF_DRILLBIT) != 0 ||
|
||||
( m_tdCurrTool.m_nType & TF_SAWBLADE) != 0 ||
|
||||
( m_tdCurrTool.m_nType & TF_MILL) != 0 ||
|
||||
( m_tdCurrTool.m_nType & TF_MORTISE) != 0 ||
|
||||
( m_tdCurrTool.m_nType & TF_CHISEL) != 0) {
|
||||
// recupero le dimensioni del porta utensili
|
||||
double dTHoldBase = 0 ;
|
||||
@@ -802,9 +803,8 @@ ToolsMgr::GetCurrToolThLength( double& dThLen) const
|
||||
dThLen = dTHoldLen ;
|
||||
return true ;
|
||||
}
|
||||
// se mortasatrice/sega a catena o waterjet
|
||||
else if ( ( m_tdCurrTool.m_nType & TF_MORTISE) != 0 ||
|
||||
( m_tdCurrTool.m_nType & TF_WATERJET) != 0) {
|
||||
// se waterjet
|
||||
else if ( ( m_tdCurrTool.m_nType & TF_WATERJET) != 0) {
|
||||
dThLen = 0 ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user