Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d2965af836 | |||
| df86ffdee3 | |||
| 05a6f56cfe | |||
| 8f7fdc3a80 | |||
| 90dbb068a9 | |||
| 577143d176 | |||
| c6aa83ccd5 | |||
| 9e12f9d3b6 | |||
| fc6af5de55 | |||
| 8afece4a6c | |||
| dc3ed5ea0a | |||
| 27a23bcdaa | |||
| 7d554efe60 | |||
| 075c0f4e95 | |||
| 6378dddcdf | |||
| 025eea9c0f | |||
| 4b93557efe | |||
| 04cf5a69a8 | |||
| 7d819a9500 | |||
| a0da9d4e7d | |||
| dd960cb8a4 | |||
| 44af4a5bf4 | |||
| 8ac85f6754 | |||
| e3cfe48da3 | |||
| 068e99df97 | |||
| e3121ff553 | |||
| 0e8c41192d | |||
| 15931dc304 | |||
| c97cc00cdc | |||
| 8b0bbe4ab0 | |||
| 4f264ee64e | |||
| 4e8953e864 |
+2
-2
@@ -349,7 +349,7 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
|
||||
PL.AddUPoint( 1, ptTip) ;
|
||||
// aggiungo simil-freccia
|
||||
Frame3d frF ;
|
||||
if ( m_vtTool. IsSmall())
|
||||
if ( m_vtTool. IsSmall() || AreSameOrOppositeVectorApprox( m_vtTool, m_vtCorr))
|
||||
frF.Set( ptTip, m_vtCorr) ;
|
||||
else
|
||||
frF.Set( ptTip, m_vtCorr, m_vtTool) ;
|
||||
@@ -378,7 +378,7 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
|
||||
PL.AddUPoint( 1, ptTip) ;
|
||||
// aggiungo simil-freccia
|
||||
Frame3d frF ;
|
||||
if ( m_vtTool. IsSmall())
|
||||
if ( m_vtTool. IsSmall() || AreSameOrOppositeVectorApprox( m_vtTool, m_vtAux))
|
||||
frF.Set( ptTip, m_vtAux) ;
|
||||
else
|
||||
frF.Set( ptTip, m_vtAux, m_vtTool) ;
|
||||
|
||||
+23
-3
@@ -768,11 +768,31 @@ Chiseling::UpdateToolData( bool* pbChanged)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
// verifico se sono diversi (ad esclusione del nome)
|
||||
m_TParams.m_sName = pTdata->m_sName ;
|
||||
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
int nOrigExit = m_TParams.m_nExit ;
|
||||
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
|
||||
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
|
||||
// aggiorno comunque i parametri
|
||||
m_TParams = *pTdata ;
|
||||
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
|
||||
string sTcPos ; string sHead ; int nExit ;
|
||||
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
|
||||
if ( sOrigTcPos != sTcPos ||
|
||||
sOrigHead != sHead ||
|
||||
nOrigExit != nExit)
|
||||
bChanged = true ;
|
||||
m_TParams.m_sTcPos = sTcPos ;
|
||||
m_TParams.m_sHead = sHead ;
|
||||
m_TParams.m_nExit = nExit ;
|
||||
}
|
||||
else {
|
||||
if ( sOrigTcPos != pTdata->m_sTcPos ||
|
||||
sOrigHead != pTdata->m_sHead ||
|
||||
nOrigExit != pTdata->m_nExit)
|
||||
bChanged = true ;
|
||||
}
|
||||
// eventuali segnalazioni
|
||||
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
|
||||
string sInfo = "Warning in Chiseling : tool name changed (" +
|
||||
|
||||
+4
-3
@@ -1353,7 +1353,8 @@ Disposition::SpecialApply( bool bRecalc)
|
||||
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
|
||||
// segnalo errori ed esco
|
||||
if ( ! bOk || nErr > 0) {
|
||||
m_nShifts = - 1 ;
|
||||
if ( m_nShifts != -1)
|
||||
m_nShifts = -2 ;
|
||||
string sOut = sMsg ;
|
||||
if ( IsEmptyOrSpaces( sOut))
|
||||
sOut = " Error in " + ON_SPECIAL_APPLY + " (" + ToString( nErr) + ")" ;
|
||||
@@ -1393,12 +1394,12 @@ Disposition::SpecialUpdate( void)
|
||||
|
||||
// se disposizione vuota, esco
|
||||
if ( m_nShifts <= 0) {
|
||||
if ( m_nShifts < 0)
|
||||
if ( m_nShifts == -2)
|
||||
m_pMchMgr->SetWarning( 2052, "Warning in Disposition : No shifts") ;
|
||||
return true ;
|
||||
}
|
||||
// calcolo assi macchina
|
||||
if ( ! CalculateAxesValues( "")) {
|
||||
if ( ! CalculateAxesValues( "", false)) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
if ( sInfo.empty())
|
||||
m_pMchMgr->SetLastError( 2007, "Error in Disposition : axes values not calculable") ;
|
||||
|
||||
+9
-7
@@ -56,14 +56,14 @@ class Disposition : public Operation
|
||||
{ return true ; }
|
||||
bool Save( int nBaseId, STRVECTOR& vString) const override ;
|
||||
bool Load( const STRVECTOR& vString, int nBaseGdbId) override ;
|
||||
|
||||
|
||||
public : // Operation
|
||||
int GetType( void) const override
|
||||
{ return OPER_DISP ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nShifts == 0) ; }
|
||||
int GetType( void) const override
|
||||
{ return OPER_DISP ; }
|
||||
bool IsEmpty( void) const override
|
||||
{ return ( m_nShifts == 0) ; }
|
||||
bool UpdateStatus( int nModif) override
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
{ m_nStatus |= nModif ; return true ; }
|
||||
|
||||
protected : // Operation
|
||||
const std::string& GetToolName( void) const override ;
|
||||
@@ -71,7 +71,7 @@ class Disposition : public Operation
|
||||
int GetExitNbr( void) const override ;
|
||||
const std::string& GetToolTcPos( void) const override ;
|
||||
int GetSolCh( void) const override
|
||||
{ return 0 ; }
|
||||
{ return 0 ; }
|
||||
bool NeedPrevHome( void) const override ;
|
||||
|
||||
public :
|
||||
@@ -111,6 +111,8 @@ class Disposition : public Operation
|
||||
bool GetToolData( std::string& sName, std::string& sHead, int& nExit, std::string& sTcPos) const ;
|
||||
bool GetSomeByHand( void) const
|
||||
{ return m_bSomeByHand ; }
|
||||
bool IsWithTool( void)
|
||||
{ return ( m_nShifts != -1) ;}
|
||||
|
||||
private :
|
||||
bool InsertMoveInfoInList( int nRawId, int nType, const Point3d& ptP, int nFlag) ;
|
||||
|
||||
+584
-23
@@ -19,6 +19,7 @@
|
||||
#include "OperationConst.h"
|
||||
#include "/EgtDev/Include/EXeCmdLogOff.h"
|
||||
#include "/EgtDev/Include/EGkGeoPoint3d.h"
|
||||
#include "/EgtDev/Include/EGkGeoVector3d.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EGkCurveArc.h"
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
@@ -27,6 +28,7 @@
|
||||
#include "/EgtDev/Include/EGkUserObjFactory.h"
|
||||
#include "/EgtDev/Include/EGnStringKeyVal.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include "/EgtDev/Include/EGkGeoFrame3d.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -68,6 +70,35 @@ struct Hole
|
||||
: nOriId( GDB_ID_NULL), ptIni(), vtDir(), dDiam( 0), dThick( 0), dLen( 0), bBlind( true) {}
|
||||
} ;
|
||||
|
||||
struct MHDrill {
|
||||
int nInd_id_hole ; // indice id foro
|
||||
Vector3d vtAux ; // vettore ausiliario per tale foratura
|
||||
} ;
|
||||
|
||||
struct HoleInfo {
|
||||
Hole hole ; // foro
|
||||
bool bDrill = false ; // se alla fine verrà svuotato
|
||||
bool bTempDrill = false ; // per test maschera (se durante un test viene svuotato o no)
|
||||
int nTempTool = -1 ; // per test maschera ( indice utensile che lo svuota durante un test)
|
||||
bool bSkipToAngle = false ; // nel caso di più assi rotanti, se foro già svuotato con testa orientata
|
||||
bool bForToolM = false ; // se tool main svuoterà questo foro
|
||||
int nIndHoleToolM = -1 ; // indice del foro che lo svuoterà inserendo il primo tool in esso
|
||||
INTVECTOR vToolHole ; // vettore di indici dei fori ai quali inserire l'ultim punta per lavorare il foro corrente
|
||||
INTVECTOR vIndTools ; // vettore dei tool associati ad ogni svuotatura in vToolHole (ordinati)
|
||||
VCT3DVECTOR vVtAux ; // vettore dei vtAux ausiliari del tool principale per svuotare questo foro (ordinati)
|
||||
int nIndTool = -1 ; // indice del tool che alla fine svuoterà il foro
|
||||
Vector3d vtAux ; // vettore ausiliario del tool principale che permette al tool principale di svuotare questo foro
|
||||
Point3d ptBtn ; // punto interno alla base del foro
|
||||
int nIndInSelVector = 0 ; // indice nel vettore m_vId (id fori selezionati)
|
||||
} ;
|
||||
|
||||
|
||||
struct ToolInfo
|
||||
{
|
||||
ToolData* pTool ; // 1) puntatore per utensile (nullo se utensile non presente)
|
||||
Point3d ptETool ; // 2) punto finale del tool (per ptBtn del foro)
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
USEROBJ_REGISTER( GetOperationClass( OPER_DRILLING), Drilling) ;
|
||||
|
||||
@@ -95,6 +126,7 @@ Drilling::Clone( void) const
|
||||
pDri->m_nStatus = m_nStatus ;
|
||||
pDri->m_nDrillings = m_nDrillings ;
|
||||
pDri->m_bTiltingTab = m_bTiltingTab ;
|
||||
pDri->m_vtTiltingAx = m_vtTiltingAx ;
|
||||
pDri->m_bAboveHead = m_bAboveHead ;
|
||||
pDri->m_bAggrBottom = m_bAggrBottom ;
|
||||
}
|
||||
@@ -450,16 +482,16 @@ Drilling::SetGeometry( const SELVECTOR& vIds)
|
||||
// se lavorazione standard
|
||||
if ( m_Params.m_nSubType == DRI_SUB_STD) {
|
||||
// recupero il valore di tolleranza sul diametro
|
||||
double dDiamTol = m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ;
|
||||
//double dDiamTol = m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ;
|
||||
// verifico che gli identificativi rappresentino dei fori con il corretto diametro
|
||||
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
|
||||
// recupero i dati del foro
|
||||
Hole hole ;
|
||||
if ( ! GetHoleData( vIds[i], hole) || ! VerifyDiameter( hole.dDiam, m_TParams.m_dDiam, dDiamTol)) {
|
||||
string sInfo = "Warning in Drilling : Skipped entity " + ToString( vIds[i].nId) ;
|
||||
m_pMchMgr->SetWarning( 2151, sInfo) ;
|
||||
continue ;
|
||||
}
|
||||
//Hole hole ;
|
||||
//if ( ! GetHoleData( vIds[i], hole) || !VerifyDiameter(hole.dDiam, m_TParams.m_dDiam, dDiamTol)) {
|
||||
// string sInfo = "Warning in Drilling : Skipped entity " + ToString( vIds[i].nId) ;
|
||||
// m_pMchMgr->SetWarning( 2151, sInfo) ;
|
||||
// continue ;
|
||||
//}
|
||||
// posso aggiungere alla lista
|
||||
m_vId.push_back( vIds[i]) ;
|
||||
}
|
||||
@@ -513,7 +545,7 @@ Drilling::Preview( bool bRecalc)
|
||||
|
||||
// se lavorazione standard
|
||||
if ( m_Params.m_nSubType == DRI_SUB_STD)
|
||||
return StdandardProcess( bRecalc, nPvId, GDB_ID_NULL) ;
|
||||
return StandardProcess( bRecalc, nPvId, GDB_ID_NULL) ;
|
||||
// se altrimenti lavorazione lungo curve
|
||||
else if ( m_Params.m_nSubType == DRI_SUB_ALONG_CURVE)
|
||||
return AlongCurveProcess( bRecalc, nPvId, GDB_ID_NULL) ;
|
||||
@@ -571,7 +603,7 @@ Drilling::Apply( bool bRecalc, bool bPostApply)
|
||||
|
||||
// se lavorazione standard
|
||||
if ( m_Params.m_nSubType == DRI_SUB_STD) {
|
||||
if ( ! StdandardProcess( bRecalc, GDB_ID_NULL, nClId))
|
||||
if ( ! StandardProcess( bRecalc, GDB_ID_NULL, nClId))
|
||||
return false ;
|
||||
}
|
||||
// se altrimenti lavorazione lungo curve
|
||||
@@ -658,10 +690,42 @@ Drilling::Update( bool bPostApply)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::StdandardProcess( bool bRecalc, int nPvId, int nClId)
|
||||
Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId)
|
||||
{
|
||||
|
||||
// elaboro i singoli fori
|
||||
// controllo se ho più uscite
|
||||
string sCurrHead ;
|
||||
if ( ! m_pMchMgr->GetCurrMachine()->GetCurrHead( sCurrHead))
|
||||
return false ;
|
||||
int nExit = m_pMchMgr->GetCurrMachine()->GetHeadExitCount( sCurrHead) ;
|
||||
TABMHDRILL tabDrills ;
|
||||
double dMHOff = 0 ;
|
||||
// se ho più uscite...
|
||||
if ( nExit > 1) {
|
||||
if ( ! MultiHeadDrilling( nExit, m_vId, nClId, tabDrills, dMHOff))
|
||||
return false ;
|
||||
if( tabDrills.size() == 0)
|
||||
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))
|
||||
return false ;
|
||||
// creo la regione di ingombro del foro
|
||||
int nDriId = m_pGeomDB->GetFirstInGroup( m_pGeomDB->GetLastGroupInGroup( nPvId)) ;
|
||||
GenerateHoleRegionPv( nDriId, 1, nPvId) ;
|
||||
}
|
||||
// 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))
|
||||
return false ;
|
||||
}
|
||||
// incremento indice
|
||||
++j ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
// ... altrimenti elaboro i singoli fori
|
||||
int i = 0 ;
|
||||
for ( const auto& vId : m_vId) {
|
||||
// se richiesto preview
|
||||
@@ -678,12 +742,487 @@ Drilling::StdandardProcess( bool bRecalc, int nPvId, int nClId)
|
||||
return false ;
|
||||
}
|
||||
// incremento indice
|
||||
++ i ;
|
||||
++i ;
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::MultiHeadDrilling( int nExit, const SELVECTOR& vId, int nClId, TABMHDRILL& tabDrills, double& dMHOff, bool bOrd) {
|
||||
|
||||
// controllo parametri
|
||||
tabDrills.clear() ;
|
||||
if (( int)vId.size() == 0)
|
||||
return true ;
|
||||
|
||||
// recupero il nome della testa
|
||||
string sHead ;
|
||||
m_pMchMgr->GetCurrMachine()->GetCurrHead( sHead) ;
|
||||
|
||||
// gestore dei tool corrente
|
||||
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
|
||||
|
||||
// ------------------------------ Tools ------------------------------------------
|
||||
|
||||
// ciclo tutti i tools salvando le loro geometrie
|
||||
typedef vector<ToolInfo> VECTORTOOL ;
|
||||
VECTORTOOL vTools ; vTools.reserve( nExit) ;
|
||||
|
||||
int nNullTools = 0 ; // numero di utensili non attivi
|
||||
int nIndMainTool = 0 ; // Main Tool ( non nullo )
|
||||
bool bToolValid = false ; // se il Tool attuale è valido ( non nullo )
|
||||
|
||||
for ( int t = 0 ; t < nExit ; ++t) { // recupero l'utensile sulle uscite
|
||||
string sToolName ;
|
||||
ToolInfo TInf ;
|
||||
if( ! m_pMchMgr->GetLoadedTool( sHead, t + 1, sToolName) || sToolName.empty()) {
|
||||
TInf.pTool = nullptr ; // se non attivo ( nullo )
|
||||
vTools.push_back( TInf) ;
|
||||
++nNullTools ;
|
||||
continue ;
|
||||
}
|
||||
// se attivo ( non nullo )
|
||||
TInf.pTool = (( ToolData*)pTMgr->GetTool( sToolName)) ;
|
||||
vTools.push_back( TInf) ;
|
||||
|
||||
// imposto il tool di riferimento come il tool m_TParams
|
||||
if( TInf.pTool->m_Uuid == m_TParams.m_Uuid)
|
||||
nIndMainTool = t ;
|
||||
}
|
||||
if ( nNullTools == nExit || vTools.size() == 0) // se non ho utensili attivi o validi...
|
||||
return false ;
|
||||
|
||||
Point3d PtEndTool ; // punto finale del tool
|
||||
Vector3d vtDirPrec, vtDirAct, vtAux ; // per controllare direzioni dei tool ( T )
|
||||
Vector3d vtT, vtA ; // versore T e A per sistema di riferimento del tool
|
||||
|
||||
bToolValid = false ;
|
||||
for ( int t = 0 ; t < nExit ; ++t) { // controllo direzioni ( T ) e punto finale all'estremità
|
||||
if ( vTools[t].pTool == nullptr)
|
||||
continue ;
|
||||
m_pMchMgr->GetCurrMachine()->GetHeadExitPosDirAux( sHead, t + 1, PtEndTool, vtDirAct, vtAux) ;
|
||||
if ( ! bToolValid) {
|
||||
bToolValid = true ;
|
||||
vtDirPrec = vtDirAct ;
|
||||
}
|
||||
else {
|
||||
// controllo che le direzioni dei tool siano tutte parallele tra loro
|
||||
if ( ! AreSameVectorApprox( vtDirAct, vtDirPrec))
|
||||
return false ;
|
||||
}
|
||||
if ( t == nIndMainTool) { // per il sistema di riferiemento centrato sul tool principale
|
||||
vtT = vtDirAct ;
|
||||
vtA = vtAux ;
|
||||
}
|
||||
PtEndTool.Translate( - vtDirAct * ( vTools[t].pTool->m_dLen)) ;
|
||||
vTools[t].ptETool = PtEndTool ;
|
||||
}
|
||||
|
||||
// ------------------------------ Holes ------------------------------------------
|
||||
// ciclo tutti i fori salvando le loro geometrie
|
||||
typedef vector<HoleInfo> VECTORHOLE ;
|
||||
VECTORHOLE vHoles(( int)vId.size()) ; // vettore dei fori
|
||||
bool bOKHole = false ; // validità di almeno un foro
|
||||
|
||||
for ( int h = 0 ; h < ( int)vId.size() ; ++h) {
|
||||
Hole hole ;
|
||||
if ( ! GetHoleData( m_vId[h], hole)) {
|
||||
string sInfo = "Warning in Drilling : Skipped entity " + ToString( m_vId[h]) ;
|
||||
m_pMchMgr->SetWarning( 2151, sInfo) ;
|
||||
continue ;
|
||||
}
|
||||
// se richiesta inversione e foro passante, provvedo
|
||||
if ( m_Params.m_bInvert) {
|
||||
if ( hole.bBlind) {
|
||||
m_pMchMgr->SetLastError( 2114, "Error in Drilling : blind hole not reversible") ;
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
hole.ptIni -= hole.vtDir * hole.dThick ;
|
||||
hole.vtDir.Invert() ;
|
||||
}
|
||||
}
|
||||
// se lavorazione del foro non arriva al suo fondo, lo considero cieco
|
||||
if ( hole.dLen < hole.dThick - 10 * EPS_SMALL)
|
||||
hole.bBlind = true ;
|
||||
|
||||
vHoles[h].hole = hole ;
|
||||
vHoles[h].nIndInSelVector = h ;
|
||||
bOKHole = true ;
|
||||
}
|
||||
if ( vHoles.size() == 0 || ! bOKHole) // se non ho fori...
|
||||
return true ;
|
||||
|
||||
// calcolo la maschera tra tools e holes
|
||||
if( ! CalcMask( vHoles, vTools, nIndMainTool, vtT, vtA))
|
||||
return false ;
|
||||
|
||||
// i fori con dimensione 0 del vettore vToolHole non possono essere svuotati
|
||||
int nNoDrillHoles = 0 ;
|
||||
for ( int i = 0 ; i < ( int)vHoles.size() ; ++i) {
|
||||
if ( vHoles[i].vToolHole.size() == 0)
|
||||
++nNoDrillHoles ;
|
||||
}
|
||||
|
||||
// resetto le variabili di controllo di svuotatura temporanea per tutti i fori
|
||||
for ( int k = 0 ; k < ( int)vHoles.size() ; ++k)
|
||||
vHoles[k].bTempDrill = false ;
|
||||
|
||||
// numero di fori svuotati
|
||||
int nOkHole = 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
|
||||
vHoles[vHoles[i].vToolHole[0]].bForToolM = true ;
|
||||
vHoles[vHoles[i].vToolHole[0]].nIndTool = nIndMainTool ;
|
||||
vHoles[vHoles[i].vToolHole[0]].nIndHoleToolM = vHoles[i].vToolHole[0] ;
|
||||
vHoles[vHoles[i].vToolHole[0]].vtAux = vHoles[i].vVtAux[0] ;
|
||||
for ( int k = 0 ; k < ( int)vHoles.size() ; ++k) {
|
||||
for( int l = 0 ; l < ( int)vHoles[k].vToolHole.size() ; ++l) {
|
||||
if ( vHoles[k].vToolHole[l] == vHoles[i].vToolHole[0] && ! vHoles[k].bDrill) {
|
||||
vHoles[k].bDrill = true ;
|
||||
vHoles[k].nIndTool = vHoles[k].vIndTools[0] ;
|
||||
vHoles[k].nIndHoleToolM = vHoles[vHoles[i].vToolHole[0]].nIndHoleToolM ;
|
||||
vHoles[k].vtAux = vHoles[k].vVtAux[l] ;
|
||||
++nOkHole ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// calcolo la massima differenza di lunghezza tra il primo tool e gli altri ( così l'elevazione finale rimane compatibile)
|
||||
double dRefLen = vTools[nIndMainTool].pTool->m_dTLen ;
|
||||
double dOffMax = 0 ;
|
||||
for ( int t = 0 ; t < ( int)vTools.size() && nNoDrillHoles != (int)vHoles.size() ; ++t) {
|
||||
if ( vTools[t].pTool == nullptr || t == nIndMainTool)
|
||||
continue ;
|
||||
if ( vTools[t].pTool->m_dTLen > dRefLen + dOffMax) {
|
||||
dOffMax = vTools[t].pTool->m_dTLen - dRefLen ;
|
||||
}
|
||||
}
|
||||
dMHOff = dOffMax ;
|
||||
|
||||
// riempio la maschera
|
||||
VCT3DVECTOR vVtA ;
|
||||
for ( int i = 0 ; i < ( int)vHoles.size() && nNoDrillHoles != ( int)vHoles.size() ; ++i) {
|
||||
if ( ! vHoles[i].bForToolM)
|
||||
continue ;
|
||||
|
||||
// per tutti i fori che vengono svuotati da un tool t-esimo conto quanti versori A diversi tra loro trovo
|
||||
for( int j = 0 ; j < ( int)vHoles.size() ; ++j) {
|
||||
if ( vHoles[j].nIndHoleToolM != i)
|
||||
continue ;
|
||||
if (( int)vVtA.size() == 0)
|
||||
vVtA.push_back( vHoles[j].vtAux) ;
|
||||
else {
|
||||
bool bPush = true ;
|
||||
for( int v = 0 ; v < ( int)vVtA.size() ; ++v )
|
||||
if( AreSameVectorApprox( vHoles[j].vtAux, vVtA[v])) {
|
||||
bPush = false ;
|
||||
break ;
|
||||
}
|
||||
if( bPush)
|
||||
vVtA.push_back( vHoles[j].vtAux) ;
|
||||
}
|
||||
}
|
||||
|
||||
for( int v = 0 ; v < ( int)vVtA.size() ; ++v) {
|
||||
vector<MHDrill> vRowDrill ;
|
||||
MHDrill FirstMHDrill ;
|
||||
FirstMHDrill.nInd_id_hole = i ;
|
||||
FirstMHDrill.vtAux = vVtA[v] ;
|
||||
vRowDrill.push_back( FirstMHDrill) ;
|
||||
tabDrills.push_back( vRowDrill) ;
|
||||
}
|
||||
vVtA.clear() ;
|
||||
}
|
||||
if ( tabDrills.size() == 0) // se non trovo corrispondenze ...
|
||||
return true ;
|
||||
|
||||
// se devo riordinare
|
||||
if ( bOrd) {
|
||||
struct Order
|
||||
{
|
||||
int nInd_id_hole ;
|
||||
Point3d ptIni ;
|
||||
} ;
|
||||
typedef vector<Order> VECTORORDER ;
|
||||
VECTORORDER vOrder ;
|
||||
for ( int i = 0 ; i < ( int)tabDrills.size() ; ++i) {
|
||||
Order newOrder ;
|
||||
newOrder.nInd_id_hole = tabDrills[i][0].nInd_id_hole ;
|
||||
newOrder.ptIni = vHoles[tabDrills[i][0].nInd_id_hole].hole.ptIni ;
|
||||
vOrder.push_back( newOrder) ;
|
||||
}
|
||||
|
||||
// prendo come riferimento il punto del primo foro selezionato dall'utente
|
||||
Point3d ptRef = vOrder[0].ptIni ;
|
||||
double dMinDist = INFINITO ;
|
||||
int nIndexSwitch = -1 ;
|
||||
for ( int i = 0 ; i < ( int)vOrder.size() - 1 ; ++i) {
|
||||
for ( int j = i + 1 ; j < ( int)vOrder.size() ; ++j) {
|
||||
Point3d ptS = vOrder[j].ptIni ;
|
||||
if ( Dist( ptS, ptRef) < dMinDist) {
|
||||
dMinDist = Dist( ptS, ptRef) ;
|
||||
nIndexSwitch = j ;
|
||||
}
|
||||
}
|
||||
if ( nIndexSwitch != i + 1) {
|
||||
vector<MHDrill> VHelp = tabDrills[nIndexSwitch] ;
|
||||
tabDrills[nIndexSwitch] = tabDrills[i + 1] ;
|
||||
tabDrills[i + 1] = VHelp ;
|
||||
}
|
||||
ptRef = vOrder[i + 1].ptIni ;
|
||||
dMinDist = INFINITO ;
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::CalcMask( VECTORHOLE& vHoles, VECTORTOOL& vTools, int nIndMT, Vector3d vtT, Vector3d vtA) {
|
||||
|
||||
// recupero il valore di tolleranza sul diametro
|
||||
double dDiamTol = m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ;
|
||||
|
||||
// controllo dei parametri
|
||||
if (( int)vHoles.size() <= 0 || ( int)vTools.size() <= 0)
|
||||
return false ;
|
||||
|
||||
int nExit = ( int)vTools.size() ;
|
||||
int nNullTools = 0 ;
|
||||
for( int i = 0 ; i < ( int)vTools.size() ; ++i){
|
||||
if( vTools[i].pTool == nullptr)
|
||||
++nNullTools ;
|
||||
}
|
||||
|
||||
// in ogni foro i-esimo inserisco il Tool principale
|
||||
for( int i = 0 ; i < ( int)vHoles.size() ; ++i){
|
||||
|
||||
// resetto le veriabili di controllo di svuotatura temporanea per tutti i fori
|
||||
for ( int k = 0 ; k < ( int)vHoles.size() ; ++k) {
|
||||
vHoles[k].bTempDrill = false ;
|
||||
vHoles[k].nTempTool = -1 ;
|
||||
}
|
||||
|
||||
// verifica validità del foro i-esimo per il Tool principale
|
||||
Hole Hole_i = vHoles[i].hole ;
|
||||
if ( ! MultiHeadVerifyHole( Hole_i, vTools[nIndMT].pTool, dDiamTol, m_vId[vHoles[i].nIndInSelVector]))
|
||||
continue ;
|
||||
|
||||
int nStat ;
|
||||
DBLVECTOR vAng1, vAng2 ;
|
||||
// angoli per allineare T del tool principale con vtDir del foro i-esimo
|
||||
if ( ! m_pMchMgr->GetCalcAngles( Hole_i.vtDir, V_NULL, nStat, vAng1, vAng2))
|
||||
continue ;
|
||||
Vector3d vtTnew ;
|
||||
// check che T sia allineato con vtDir
|
||||
if ( ! m_pMchMgr->GetCalcToolDirFromAngles( vAng1, vtTnew) || ! AreSameVectorApprox( vtTnew, Hole_i.vtDir))
|
||||
continue ;
|
||||
Vector3d vtAnew ;
|
||||
// nuova configurazione del versore A ottenuta
|
||||
if ( ! m_pMchMgr->GetCalcAuxDirFromAngles( vAng1, vtAnew))
|
||||
continue ;
|
||||
|
||||
// creo un nuovo sistema di riferimento centrato nel Tool principale
|
||||
Frame3d frMT ;
|
||||
frMT.Set( vTools[nIndMT].ptETool, vtT, vtA) ;
|
||||
if( ! frMT.IsValid())
|
||||
return false ;
|
||||
|
||||
// creo un frame nel foro i-esimo orientato come il frame sul tool principale ( origine nella base interna del foro)
|
||||
Frame3d frHMT ;
|
||||
frHMT.Set( Hole_i.ptIni - Hole_i.vtDir * Hole_i.dLen, vtTnew, vtAnew) ;
|
||||
if( ! frHMT.IsValid())
|
||||
return false ;
|
||||
|
||||
// numero di svuotature inserendo il Tool principale nel foro i-esimo
|
||||
int nDrills = 1 ;
|
||||
// setto le variabili temporanee per il foro i-esimo
|
||||
vHoles[i].bTempDrill = true ;
|
||||
vHoles[i].nTempTool = nIndMT ;
|
||||
|
||||
// controllo la compatibilità tra le geometrie dei Tool e dei fori
|
||||
CheckOtherHolesWithTools( vHoles, vTools, nIndMT, i, Hole_i, frMT, frHMT, dDiamTol, nDrills) ;
|
||||
|
||||
// controllo quanti fori sono riuscito a svuotare e setto i loro parametri di foratura
|
||||
if ( nDrills == nExit - nNullTools) { // se ho svuotato il numero corretto di fori ...
|
||||
for ( int d = 0 ; d < ( int)vHoles.size() ; ++d) {
|
||||
if ( vHoles[d].bTempDrill) {
|
||||
vHoles[d].vToolHole.push_back( i) ; // indice del foro per il tool principale
|
||||
vHoles[d].vIndTools.push_back( vHoles[d].nTempTool) ; // indice del tool che svuota questo foro
|
||||
vHoles[d].vVtAux.push_back( frHMT.VersX()) ; // versore ausiliario A del tool principale
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for( int d = 0 ; d < ( int)vHoles.size() ; ++d)
|
||||
if( vHoles[d].bTempDrill)
|
||||
vHoles[d].bTempDrill = false ;
|
||||
}
|
||||
if ( nStat < 0) { // se la testa può ruotare
|
||||
|
||||
// inizio a scorrere tutti i tools
|
||||
for ( int t = 0 ; t < ( int)vTools.size() ; ++t) {
|
||||
if ( vTools[t].pTool == nullptr || t == nIndMT)
|
||||
continue ;
|
||||
|
||||
// cerco se ho un foro j-esimo adatto per quella punta
|
||||
for ( int j = 0 ; j < ( int)vHoles.size() ; ++j) {
|
||||
|
||||
Hole Hole_j = vHoles[j].hole ;
|
||||
if ( i == j
|
||||
|| vHoles[j].bSkipToAngle
|
||||
|| ! AreSameVectorApprox( Hole_j.vtDir, Hole_i.vtDir)
|
||||
|| ! MultiHeadVerifyHole( Hole_j, vTools[t].pTool, dDiamTol, m_vId[vHoles[j].nIndInSelVector]))
|
||||
continue ;
|
||||
|
||||
// resetto le veriabili di controllo di svuotatura temporanea per tutti i fori
|
||||
for ( int k = 0 ; k < ( int)vHoles.size() ; ++k) {
|
||||
vHoles[k].bTempDrill = false ;
|
||||
vHoles[k].nTempTool = -1 ;
|
||||
}
|
||||
|
||||
Vector3d vtRefT = vTools[t].ptETool - vTools[nIndMT].ptETool ;
|
||||
Vector3d vtRefH = Hole_j.ptIni - Hole_j.vtDir * Hole_j.dLen -
|
||||
( Hole_i.ptIni - Hole_i.vtDir * Hole_i.dLen) ;
|
||||
|
||||
if(( vtRefH.Len() - vtRefT.Len()) < EPS_SMALL) { // se le distanze sono compatibili
|
||||
// rioriento il frame sul foro i-esimo
|
||||
Point3d ptHj = Hole_j.ptIni - Hole_j.vtDir * Hole_j.dLen ;
|
||||
ptHj.ToLoc( frHMT) ;
|
||||
Vector3d vtProjB( ptHj.x, ptHj.y, 0) ;
|
||||
|
||||
Point3d ptTt = vTools[t].ptETool ;
|
||||
ptTt.ToLoc( frMT) ;
|
||||
Vector3d vtProjA( ptTt.x, ptTt.y, 0) ;
|
||||
|
||||
double dAngle ; vtProjA.GetAngle( vtProjB, dAngle) ;
|
||||
frHMT.Rotate( frHMT.Orig(), frHMT.VersZ(), dAngle) ;
|
||||
|
||||
nDrills = 1 ; // foratura nel foro i-esimo e j-esimo
|
||||
CheckOtherHolesWithTools( vHoles, vTools, nIndMT, i, Hole_i, frMT, frHMT, dDiamTol, nDrills) ;
|
||||
|
||||
// setto le variabili temporanee per il foro i-esimo
|
||||
vHoles[i].bTempDrill = true ;
|
||||
vHoles[i].nTempTool = nIndMT ;
|
||||
|
||||
// controllo quanti fori sono riuscito a svuotare in questo nuovo sistema di riferimento
|
||||
if ( nDrills == nExit - nNullTools) {
|
||||
for ( int d = 0 ; d < ( int)vHoles.size() ; ++d) {
|
||||
if ( vHoles[d].bTempDrill) {
|
||||
vHoles[d].vToolHole.push_back( i) ; // indice del foro per il tool principale
|
||||
vHoles[d].vIndTools.push_back( vHoles[d].nTempTool) ; // indice del tool che svuota questo foro
|
||||
vHoles[d].vVtAux.push_back( frHMT.VersX()) ; // versore ausiliario del tool principale
|
||||
vHoles[d].bSkipToAngle = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for( int d = 0 ; d < ( int)vHoles.size() ; ++d)
|
||||
if( vHoles[d].bTempDrill)
|
||||
vHoles[d].bTempDrill = false ;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::CheckOtherHolesWithTools( VECTORHOLE& vHoles, VECTORTOOL& vTools, int nIndTM, int nIndHTM, Hole holeICP, Frame3d frMT,
|
||||
Frame3d frHMT, double dDiamTol, int& nDrills) {
|
||||
|
||||
// controllo parametri
|
||||
if(( int)vHoles.size() < 1 || vTools.size() < 1)
|
||||
return true ;
|
||||
if( nIndTM >= ( int)vTools.size() || nIndTM < 0
|
||||
|| nIndHTM >= ( int)vHoles.size() || nIndHTM < 0
|
||||
|| ! frMT.IsValid() || ! frHMT.IsValid()
|
||||
|| nDrills < 0 || nDrills > max(( int)vHoles.size(), ( int)vTools.size()))
|
||||
return false ;
|
||||
|
||||
// definisco il punto dove cade il tool principale
|
||||
Hole holeTM = holeICP ; // copia del foro i-esimo
|
||||
|
||||
// ciclo su tutti i tools
|
||||
for ( int t = 0 ; t < ( int)vTools.size() ; ++t) {
|
||||
if ( vTools[t].pTool == nullptr || t == nIndTM)
|
||||
continue ;
|
||||
// esprimo il punto finale del tool t-esimo nel sistema di riferimento del Tool principale
|
||||
Point3d ptETt = vTools[t].ptETool ;
|
||||
ptETt.ToLoc( frMT) ;
|
||||
|
||||
// cerco se ho un foro j-esimo adatto per quella punta
|
||||
for ( int j = 0 ; j < ( int)vHoles.size() ; ++j) {
|
||||
Hole Hole_j = vHoles[j].hole ; // copia del foro j-esimo
|
||||
// controllo che il foro j-esimo non sia l'i-esimo, che non sia stato già precedentemente svuotato da un altro tool t'-esimo ...
|
||||
// ... che vtDir del foro i-esimo coincida con vtDir del foro j-esimo e che il tool t-esimo sia compatibile con il foro j-esimo
|
||||
if ( nIndHTM == j
|
||||
|| vHoles[j].bTempDrill
|
||||
|| ! AreSameVectorApprox( Hole_j.vtDir, holeTM.vtDir)
|
||||
|| ! MultiHeadVerifyHole( Hole_j, vTools[t].pTool, dDiamTol, m_vId[vHoles[j].nIndInSelVector]))
|
||||
continue ;
|
||||
|
||||
// esprimo il foro j-esimo nel sistema di riferimento del Tool principale centrato nel foro i-esimo
|
||||
Point3d ptHj = Hole_j.ptIni - Hole_j.vtDir * Hole_j.dLen ;
|
||||
ptHj.ToLoc( frHMT) ;
|
||||
|
||||
// controllo la compatibilità
|
||||
if ( AreSamePointApprox( ptHj, ptETt)) {
|
||||
++nDrills ; // un foro in più svuotato
|
||||
// aggiorno le variabili temporanee
|
||||
vHoles[j].bTempDrill = true ;
|
||||
vHoles[j].nTempTool = t ;
|
||||
break ; // non controllo gli altri vertici per la punta t-esima
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamTol, SelData Id) {
|
||||
|
||||
// verifico che il diamtro del tool sia compatibile con quello del foro
|
||||
if ( ! VerifyDiameter( hole.dDiam, Tool->m_dDiam, dDiamTol))
|
||||
return false ;
|
||||
// imposto elevazione da lunghezza foro con possibilità di sovrascrittura da info
|
||||
double dElev = hole.dLen ;
|
||||
double dMaxElev ;
|
||||
if ( FromString( ExtractInfo( m_Params.m_sUserNotes, "MaxElev="), dMaxElev) && dElev > dMaxElev) {
|
||||
dElev = dMaxElev ;
|
||||
hole.ptIni += hole.vtDir * ( dElev - hole.dLen) ;
|
||||
hole.dLen = dElev ;
|
||||
}
|
||||
// limito lunghezza foro a massima lavorazione della punta
|
||||
double dAddLen = ( hole.bBlind ? 0 : m_Params.m_dThroughAddLen) ;
|
||||
if (( dElev + dAddLen) > Tool->m_dMaxMat + EPS_SMALL) {
|
||||
hole.dLen = Tool->m_dMaxMat + max( hole.dLen - dElev, 0.) ;
|
||||
hole.bBlind = true ;
|
||||
}
|
||||
if ( ! VerifyHoleFromBottom( hole, Id))
|
||||
return false ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::AlongCurveProcess( bool bRecalc, int nPvId, int nClId)
|
||||
@@ -976,12 +1515,12 @@ Drilling::GenerateHolePv( int nInd, const SelData& nCircId, const string& sPName
|
||||
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
|
||||
if ( IsNull( pCrvArc) || ! pCrvArc->Set( hole.ptIni, hole.vtDir, 0.5 * m_TParams.m_dDiam))
|
||||
return false ;
|
||||
// assegno il versore estrusione e lo spessore
|
||||
// assegno il versore estrusione e lo spessore
|
||||
pCrvArc->SetExtrusion( hole.vtDir) ;
|
||||
pCrvArc->SetThickness( - hole.dLen) ;
|
||||
// inserisco nel DB
|
||||
int nDriId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrvArc)) ;
|
||||
// assegno nome e colore
|
||||
// assegno nome e colore
|
||||
m_pGeomDB->SetName( nDriId, MCH_PV_CUT) ;
|
||||
m_pGeomDB->SetMaterial( nDriId, LIME) ;
|
||||
// aggiorno numero forature
|
||||
@@ -991,7 +1530,7 @@ Drilling::GenerateHolePv( int nInd, const SelData& nCircId, const string& sPName
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName, int nClId)
|
||||
Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName, int nClId, double dMHOff, Vector3d vtA)
|
||||
{
|
||||
// creo gruppo per geometria di lavorazione del foro
|
||||
int nPathId = m_pGeomDB->AddGroup( GDB_ID_NULL, nClId, Frame3d()) ;
|
||||
@@ -1042,7 +1581,7 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName
|
||||
}
|
||||
// verifico se tavola basculante
|
||||
bool bTiltTab = false ;
|
||||
m_bTiltingTab = ( m_pMchMgr->GetCurrMachine()->GetCurrTableIsTilting( bTiltTab) && bTiltTab) ;
|
||||
m_bTiltingTab = ( m_pMchMgr->GetCurrMachine()->GetCurrTableIsTilting( bTiltTab, m_vtTiltingAx) && bTiltTab) ;
|
||||
// verifico se testa da sopra (Z+)
|
||||
m_bAboveHead = m_pMchMgr->GetHeadAbove( m_TParams.m_sHead) ;
|
||||
// verifiche per foro verso il basso
|
||||
@@ -1059,7 +1598,7 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName
|
||||
// foro normale
|
||||
if ( m_Params.m_dStep < EPS_SMALL ||
|
||||
m_Params.m_dStep > hole.dLen - EPS_SMALL) {
|
||||
if ( DoStandardDrilling( hole, nCircId, nPathId)) {
|
||||
if ( DoStandardDrilling( hole, nCircId, nPathId, dMHOff, vtA)) {
|
||||
// aggiorno numero forature
|
||||
++ m_nDrillings ;
|
||||
}
|
||||
@@ -1304,11 +1843,31 @@ Drilling::UpdateToolData( bool* pbChanged)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
// verifico se sono diversi (ad esclusione del nome)
|
||||
m_TParams.m_sName = pTdata->m_sName ;
|
||||
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
int nOrigExit = m_TParams.m_nExit ;
|
||||
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
|
||||
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
|
||||
// aggiorno comunque i parametri
|
||||
m_TParams = *pTdata ;
|
||||
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
|
||||
string sTcPos ; string sHead ; int nExit ;
|
||||
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
|
||||
if ( sOrigTcPos != sTcPos ||
|
||||
sOrigHead != sHead ||
|
||||
nOrigExit != nExit)
|
||||
bChanged = true ;
|
||||
m_TParams.m_sTcPos = sTcPos ;
|
||||
m_TParams.m_sHead = sHead ;
|
||||
m_TParams.m_nExit = nExit ;
|
||||
}
|
||||
else {
|
||||
if ( sOrigTcPos != pTdata->m_sTcPos ||
|
||||
sOrigHead != pTdata->m_sHead ||
|
||||
nOrigExit != pTdata->m_nExit)
|
||||
bChanged = true ;
|
||||
}
|
||||
// eventuali segnalazioni
|
||||
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
|
||||
string sInfo = "Warning in Drilling : tool name changed (" +
|
||||
@@ -1457,7 +2016,7 @@ Drilling::VerifyHoleFromBottom( const Hole& hole, SelData Id)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId)
|
||||
Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double dMHOff, Vector3d vtA)
|
||||
{
|
||||
// aggiusto alcuni parametri del ciclo di foratura
|
||||
double dStartSlowLen = abs( m_Params.m_dStartSlowLen) ;
|
||||
@@ -1487,7 +2046,7 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId)
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
|
||||
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
|
||||
double dAppr = ( m_bAggrBottom ? dSafeAggrBottZ : dSafeZ) ;
|
||||
Point3d ptP1 = hole.ptIni + hole.vtDir * ( dAppr + dElev + dTExtrLen) ;
|
||||
Point3d ptP1 = hole.ptIni + hole.vtDir * ( dAppr + dElev + dTExtrLen + dMHOff) ;
|
||||
if ( m_bAggrBottom) {
|
||||
Point3d ptP0 = ptP1 + m_vtAggrBottom * ( m_dDistBottom + m_AggrBottom.dEncH + dSafeZ) ;
|
||||
Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAppr + dTExtrLen) ;
|
||||
@@ -1514,6 +2073,8 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId)
|
||||
return false ;
|
||||
}
|
||||
else {
|
||||
if( ! vtA.IsSmall())
|
||||
SetAuxDir( vtA) ;
|
||||
if ( AddRapidStart( ptP1) == GDB_ID_NULL)
|
||||
return false ;
|
||||
}
|
||||
|
||||
+15
-3
@@ -19,7 +19,13 @@
|
||||
#include "MachiningConst.h"
|
||||
|
||||
struct Hole ;
|
||||
struct MHDrill ;
|
||||
struct HoleInfo ;
|
||||
struct ToolInfo ;
|
||||
class ICurve ;
|
||||
typedef std::vector<std::vector<MHDrill>> TABMHDRILL ;
|
||||
typedef std::vector<HoleInfo> VECTORHOLE ;
|
||||
typedef std::vector<ToolInfo> VECTORTOOL ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class Drilling : public Machining
|
||||
@@ -68,18 +74,23 @@ class Drilling : public Machining
|
||||
|
||||
private :
|
||||
bool GetHoleData( SelData Id, Hole& hole) ;
|
||||
bool StdandardProcess( bool bRecalc, int nPvId, int nClId) ;
|
||||
bool StandardProcess( bool bRecalc, int nPvId, int nClId) ;
|
||||
bool AlongCurveProcess( bool bRecalc, int nPvId, int nClId) ;
|
||||
bool Chain( int nGrpDestId) ;
|
||||
ICurve* GetCurve( SelData Id) ;
|
||||
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
|
||||
bool GenerateHolePv( int nInd, const SelData& nCircId, const std::string& sPName, int nPvId) ;
|
||||
bool GenerateHoleCl( int nInd, const SelData& nCircId, const std::string& sPName, int nClId) ;
|
||||
bool GenerateHoleCl( int nInd, const SelData& nCircId, const std::string& sPName, int nClId, double dMHOff = .0, Vector3d vtAux = V_NULL) ;
|
||||
bool GenerateHoleRegionPv( int nFirstId, int nCount, int nPvId) ;
|
||||
bool VerifyDiameter( double dHdiam, double dTdiam, double ddiamTol) ;
|
||||
bool VerifyHoleFromBottom( const Hole& hole, SelData Id) ;
|
||||
bool DoStandardDrilling( const Hole& hole, SelData Id, int nPathId) ;
|
||||
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 nExit, const SELVECTOR& vId, int nClId, TABMHDRILL& vDrills, double& dMHOff, bool bOrd = true) ;
|
||||
bool MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamTol, SelData Id) ;
|
||||
bool CalcMask( VECTORHOLE& vHoles, VECTORTOOL& vTools, int nIndMT, Vector3d vtT, Vector3d vtA) ;
|
||||
bool CheckOtherHolesWithTools( VECTORHOLE& vHoles, VECTORTOOL& vTools, int nIndTM, int nIndHTM, Hole holeICP, Frame3d frHTM,
|
||||
Frame3d frHMTOP, double dDiamTol, int& nDrills) ;
|
||||
|
||||
private :
|
||||
double GetSpeed() const
|
||||
@@ -100,6 +111,7 @@ class Drilling : public Machining
|
||||
int m_nStatus ; // stato di aggiornamento della lavorazione
|
||||
int m_nDrillings ; // numero di fori generati
|
||||
bool m_bTiltingTab ; // flag utilizzo tavola basculante
|
||||
Vector3d m_vtTiltingAx ; // versore direzione eventuale asse basculante
|
||||
bool m_bAboveHead ; // flag utilizzo testa da sopra
|
||||
bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto
|
||||
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
|
||||
|
||||
Binary file not shown.
@@ -21,7 +21,7 @@
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{0BD58222-92F3-48B2-B656-4497D1956874}</ProjectGuid>
|
||||
<RootNamespace>EgtMachKernel</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
@@ -102,9 +102,10 @@
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EMK;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<OpenMPSupport>true</OpenMPSupport>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -166,6 +167,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
|
||||
+23
-3
@@ -806,11 +806,31 @@ GenMachining::UpdateToolData( bool* pbChanged)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
// verifico se sono diversi (ad esclusione del nome)
|
||||
m_TParams.m_sName = pTdata->m_sName ;
|
||||
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
int nOrigExit = m_TParams.m_nExit ;
|
||||
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
|
||||
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
|
||||
// aggiorno comunque i parametri
|
||||
m_TParams = *pTdata ;
|
||||
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
|
||||
string sTcPos ; string sHead ; int nExit ;
|
||||
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
|
||||
if ( sOrigTcPos != sTcPos ||
|
||||
sOrigHead != sHead ||
|
||||
nOrigExit != nExit)
|
||||
bChanged = true ;
|
||||
m_TParams.m_sTcPos = sTcPos ;
|
||||
m_TParams.m_sHead = sHead ;
|
||||
m_TParams.m_nExit = nExit ;
|
||||
}
|
||||
else {
|
||||
if ( sOrigTcPos != pTdata->m_sTcPos ||
|
||||
sOrigHead != pTdata->m_sHead ||
|
||||
nOrigExit != pTdata->m_nExit)
|
||||
bChanged = true ;
|
||||
}
|
||||
// eventuali segnalazioni
|
||||
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
|
||||
string sInfo = "Warning in GenMachining : tool name changed (" +
|
||||
|
||||
+29
-11
@@ -19,6 +19,7 @@
|
||||
#include "OutputConst.h"
|
||||
#include "/EgtDev/Include/EMkDllMain.h"
|
||||
#include "/EgtDev/Include/EGnFileUtils.h"
|
||||
#include "/EgtDev/Include/EGnGetKeyData.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -46,19 +47,31 @@ Generator::Init( MachMgr* pMchMgr)
|
||||
bool
|
||||
Generator::Run( const string& sCncFile, const string& sInfo)
|
||||
{
|
||||
// verifico sia abilitato dalla licenza
|
||||
bool bEnabled = false ;
|
||||
if ( GetEMkNetHwKey()) {
|
||||
bEnabled = true ;
|
||||
}
|
||||
else {
|
||||
unsigned int nOpt1, nOpt2 ;
|
||||
int nOptExpDays ;
|
||||
// Controllo della licenza
|
||||
unsigned int nOpt1, nOpt2 ;
|
||||
int nOptExpDays ;
|
||||
int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
|
||||
nOpt1, nOpt2, nOptExpDays) ;
|
||||
if ( ! GetEMkNetHwKey())
|
||||
int nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
|
||||
nOpt1, nOpt2, nOptExpDays) ;
|
||||
bEnabled = ( nRet == KEY_OK && ( nOpt1 & KEYOPT_EMK_NC_OFF) == 0) ;
|
||||
}
|
||||
if ( bEnabled) {
|
||||
|
||||
// Verifica della abilitazione
|
||||
bool bMinTime = false ;
|
||||
if ( nOptExpDays >= GetMinDay())
|
||||
bMinTime = true ;
|
||||
bool bCurrTime = false ;
|
||||
if ( nOptExpDays >= GetCurrDay())
|
||||
bCurrTime = true ;
|
||||
bool bKey = false ;
|
||||
if ( nRet == KEY_OK)
|
||||
bKey = true ;
|
||||
bool bOption = false ;
|
||||
if ( ( nOpt1 & KEYOPT_EMK_NC_OFF) == 0)
|
||||
bOption = true ;
|
||||
|
||||
// Esecuzione
|
||||
if ( bMinTime && bCurrTime && bKey && bOption) {
|
||||
|
||||
// emetto info di log
|
||||
{ string sOut = "Generator Run : " + sCncFile ;
|
||||
@@ -79,6 +92,11 @@ Generator::Run( const string& sCncFile, const string& sInfo)
|
||||
return bOk ;
|
||||
}
|
||||
|
||||
// cancello l'eventuale file di uscita (e anche il file errore)
|
||||
EraseFile( sCncFile) ;
|
||||
string sErrFile = ChangeFileExtension( sCncFile, ERR_EXT) ;
|
||||
EraseFile( sErrFile) ;
|
||||
|
||||
// Generazione non abilitata
|
||||
m_pMchMgr->SetLastError( 1000, "NC_OFF") ;
|
||||
std::string sErr = "Warning on Key (MKC/NCO)" ;
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ GetRotationComponent( const Vector3d& vtDir1, double dComp, const Vector3d& vtDi
|
||||
double dDenom = dT0uv * dSinG ;
|
||||
double dNumer = dComp - dT0w * dCosG ;
|
||||
// due angoli possibili
|
||||
if ( abs( dDenom) > abs( dNumer)) {
|
||||
if ( abs( dDenom) > abs( dNumer) + SIN_EPS_ANG_ZERO) {
|
||||
double dDeltaAngRad = acos( dNumer / dDenom) ;
|
||||
dAng1Deg = ( dOffsAngRad + dDeltaAngRad) * RADTODEG ;
|
||||
dAng2Deg = ( dOffsAngRad - dDeltaAngRad) * RADTODEG ;
|
||||
|
||||
@@ -631,6 +631,8 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
|
||||
pTdata->GetParam( TPA_TOTDIAM, dTotDiam) ;
|
||||
double dDist = 0 ;
|
||||
pTdata->GetParam( TPA_DIST, dDist) ;
|
||||
double dStemDiam = 0 ;
|
||||
pTdata->GetParam( TPA_STEMDIAM, dStemDiam) ;
|
||||
double dMaxMat = 0 ;
|
||||
pTdata->GetParam( TPA_MAXMAT, dMaxMat) ;
|
||||
double dCornRad = 0 ;
|
||||
@@ -694,6 +696,7 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.LEN", dLen) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.TOTDIAM", dTotDiam) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.STEMDIAM", dStemDiam) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.MAXMAT", dMaxMat) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.HEIGHT", dThick) ;
|
||||
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SIDEANG", dSideAng) ;
|
||||
|
||||
@@ -95,7 +95,7 @@ class Machine
|
||||
bool GetCurrTableRef1( Point3d& ptRef1) const ;
|
||||
bool GetCurrTableArea1( BBox3d& b3Area1) const ;
|
||||
bool GetCurrTableDeltaRef1( Vector3d& vtDelta1) const ;
|
||||
bool GetCurrTableIsTilting( bool& bTilting) const ;
|
||||
bool GetCurrTableIsTilting( bool& bTilting, Vector3d& vtTiltingAx) const ;
|
||||
bool SetCurrTool( const std::string& sTool, const std::string& sHead, int nExit) ;
|
||||
bool ResetCurrTool( void) ;
|
||||
int GetCurrTool( void) const ;
|
||||
@@ -125,6 +125,8 @@ class Machine
|
||||
bool GetAllCurrAxesToken( STRVECTOR& vAxToken) const ;
|
||||
bool GetCurrAxisMin( int nInd, double& dMin) const ;
|
||||
bool GetCurrAxisMax( int nInd, double& dMax) const ;
|
||||
bool GetCurrAxisOffset( int nInd, double& dOffset) const ;
|
||||
bool GetCurrAxisInvert( int nInd, bool& bInvert) const ;
|
||||
bool GetCurrAxisHomePos( int nInd, double& dHome) const ;
|
||||
bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ;
|
||||
const Frame3d& GetCurrLinAxesFrame( void) const
|
||||
|
||||
+59
-6
@@ -167,17 +167,23 @@ Machine::GetCurrTableDeltaRef1( Vector3d& vtDelta1) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetCurrTableIsTilting( bool& bTilting) const
|
||||
Machine::GetCurrTableIsTilting( bool& bTilting, Vector3d& vtTiltingAx) const
|
||||
{
|
||||
// default
|
||||
bTilting = false ;
|
||||
vtTiltingAx = V_NULL ;
|
||||
// verifico esistenza tavola
|
||||
if ( m_nCalcTabId == GDB_ID_NULL)
|
||||
return false ;
|
||||
// verifico se presente flag che lo forza come tale
|
||||
bool bTiltingLike ;
|
||||
if ( m_pGeomDB->GetInfo( m_nCalcTabId, MCH_TILTINGLIKE, bTiltingLike) && bTiltingLike) {
|
||||
int nTiltingLike ;
|
||||
if ( m_pGeomDB->GetInfo( m_nCalcTabId, MCH_TILTINGLIKE, nTiltingLike) && nTiltingLike != 0) {
|
||||
bTilting = true ;
|
||||
switch ( abs( nTiltingLike)) {
|
||||
default : vtTiltingAx = X_AX ; break ;
|
||||
case 2 : vtTiltingAx = Y_AX ; break ;
|
||||
case 3 : vtTiltingAx = Z_AX ; break ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
// recupero gli eventuali assi rotanti della tavola
|
||||
@@ -192,6 +198,7 @@ Machine::GetCurrTableIsTilting( bool& bTilting) const
|
||||
// verifico se asse rotante orizzontale
|
||||
if ( pAx->GetType() == MCH_AT_ROTARY && abs( pAx->GetDir().z) < EPS_SMALL) {
|
||||
bTilting = true ;
|
||||
vtTiltingAx = pAx->GetDir() ;
|
||||
return true ;
|
||||
}
|
||||
// risalgo lungo la catena
|
||||
@@ -1002,7 +1009,7 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
// calcolo primo angolo di rotazione per seconda soluzione
|
||||
bool bDet2 = true ;
|
||||
if ( nStat == 2) {
|
||||
if ( ! vtDirH2.GetRotation( vtDirTn, vtAx1, dAngA2, bDet2) )
|
||||
if ( ! vtDirH2.GetRotation( vtDirTn, vtAx1, SIN_EPS_ANG_SMALL, dAngA2, bDet2))
|
||||
nStat = 1 ;
|
||||
else {
|
||||
// se indeterminato, provo a determinarlo con la direzione ausiliaria
|
||||
@@ -1025,7 +1032,7 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
// calcolo primo angolo di rotazione per prima soluzione
|
||||
bool bDet1 = true ;
|
||||
if ( nStat >= 1) {
|
||||
if ( ! vtDirH1.GetRotation( vtDirTn, vtAx1, dAngA1, bDet1) )
|
||||
if ( ! vtDirH1.GetRotation( vtDirTn, vtAx1, SIN_EPS_ANG_SMALL, dAngA1, bDet1))
|
||||
nStat = 0 ;
|
||||
else {
|
||||
// se indeterminato, provo a determinarlo con la direzione ausiliaria
|
||||
@@ -1070,7 +1077,7 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
}
|
||||
if ( nStat >= 1) {
|
||||
// se non riesco ad aggiustare, elimino
|
||||
if ( ! AdjustAngleInStroke( RotAx1.stroke, dAngA1) ||
|
||||
if ( ( bDet1 && ! AdjustAngleInStroke( RotAx1.stroke, dAngA1)) ||
|
||||
( nNumRotAx == 2 && ! AdjustAngleInStroke( RotAx2.stroke, dAngB1))) {
|
||||
-- nStat ;
|
||||
// riloco eventuale soluzione rimasta
|
||||
@@ -1820,6 +1827,52 @@ Machine::GetCurrAxisMax( int nInd, double& dMax) const
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetCurrAxisOffset( int nInd, double& dOffset) const
|
||||
{
|
||||
int nLinAxes = int( m_vCalcLinAx.size()) ;
|
||||
int nRotAxes = int( m_vCalcRotAx.size()) ;
|
||||
if ( nInd >= 0 && nInd < nLinAxes) {
|
||||
Axis* pAx = GetAxis( m_vCalcLinAx[nInd].nGrpId) ;
|
||||
if ( pAx == nullptr)
|
||||
return false ;
|
||||
dOffset = pAx->GetOffset() ;
|
||||
return true ;
|
||||
}
|
||||
else if ( nInd >= nLinAxes && nInd < nLinAxes + nRotAxes) {
|
||||
Axis* pAx = GetAxis( m_vCalcRotAx[nInd-nLinAxes].nGrpId) ;
|
||||
if ( pAx == nullptr)
|
||||
return false ;
|
||||
dOffset = pAx->GetOffset() ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetCurrAxisInvert( int nInd, bool& bInvert) const
|
||||
{
|
||||
int nLinAxes = int( m_vCalcLinAx.size()) ;
|
||||
int nRotAxes = int( m_vCalcRotAx.size()) ;
|
||||
if ( nInd >= 0 && nInd < nLinAxes) {
|
||||
Axis* pAx = GetAxis( m_vCalcLinAx[nInd].nGrpId) ;
|
||||
if ( pAx == nullptr)
|
||||
return false ;
|
||||
bInvert = pAx->GetInvert() ;
|
||||
return true ;
|
||||
}
|
||||
else if ( nInd >= nLinAxes && nInd < nLinAxes + nRotAxes) {
|
||||
Axis* pAx = GetAxis( m_vCalcRotAx[nInd-nLinAxes].nGrpId) ;
|
||||
if ( pAx == nullptr)
|
||||
return false ;
|
||||
bInvert = pAx->GetInvert() ;
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Machine::GetCurrAxisHomePos( int nInd, double& dHome) const
|
||||
|
||||
+2
-2
@@ -287,12 +287,12 @@ Machining::ToolPreview( int nEntId, int nFlag) const
|
||||
Frame3d frHead ;
|
||||
m_pGeomDB->GetGroupGlobFrame( nId, frHead) ;
|
||||
Frame3d frRef ;
|
||||
if ( vtAux.IsSmall())
|
||||
if ( vtAux.IsSmall() || AreSameOrOppositeVectorApprox( vtAux, vtDir))
|
||||
frRef.Set( ptOrig, vtDir) ;
|
||||
else
|
||||
frRef.Set( ptOrig, vtDir, vtAux) ;
|
||||
Frame3d frShow ;
|
||||
if ( vtBAux.IsSmall())
|
||||
if ( vtBAux.IsSmall() || AreSameOrOppositeVectorApprox( vtBAux, vtTool))
|
||||
frShow.Set( ptEnd + vtTool * GetToolData().m_dLen, vtTool) ;
|
||||
else
|
||||
frShow.Set( ptEnd + vtTool * GetToolData().m_dLen, vtTool, vtBAux) ;
|
||||
|
||||
+522
-187
File diff suppressed because it is too large
Load Diff
@@ -102,7 +102,8 @@ class Milling : public Machining
|
||||
bool AddDirectApproach( const Point3d& ptP) ;
|
||||
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
double dElev, double dAppr, bool bAboveEnd) ;
|
||||
bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, double dSafeZ, double dEndElev, double dAppr) ;
|
||||
bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, const Vector3d& vtTool,
|
||||
double dSafeZ, double dEndElev, double dAppr) ;
|
||||
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool,
|
||||
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1) const ;
|
||||
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
|
||||
@@ -145,7 +146,14 @@ class Milling : public Machining
|
||||
bool IsLeadInHelixOrZigzag() const
|
||||
{ int nType = GetLeadInType() ;
|
||||
return ( nType == MILL_LI_ZIGZAG || nType == MILL_LI_HELIX) ; }
|
||||
friend class LeadIOStatus ;
|
||||
bool LeadInRawIsOk( void) const
|
||||
{ if ( ( m_TParams.m_nType & TF_SAWBLADE) != 0)
|
||||
return false ;
|
||||
if ( m_TParams.m_nType != TT_MILL_NOTIP)
|
||||
return true ;
|
||||
return ( IsLeadInHelixOrZigzag() &&
|
||||
m_Params.m_dLiTang >= 0.9 * m_TParams.m_dDiam && m_Params.m_dLiElev <= 2) ; }
|
||||
friend class LeadIOStatus ;
|
||||
|
||||
private :
|
||||
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
|
||||
@@ -160,10 +168,13 @@ class Milling : public Machining
|
||||
double m_dAddedOverlap ; // overlap effettivamente aggiunto a percorso chiuso
|
||||
int m_nHeadSolCh ; // criterio scelta soluzione impostato nella testa
|
||||
bool m_bTiltingTab ; // flag utilizzo tavola basculante
|
||||
Vector3d m_vtTiltingAx ; // versore direzione eventuale asse basculante
|
||||
bool m_bAboveHead ; // flag utilizzo testa da sopra
|
||||
bool m_bAggrBottom ; // flag utilizzo di aggregato da sotto
|
||||
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
|
||||
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
|
||||
double m_dCurrOscillLen ; // lunghezza corrente lungo il percorso per l'oscillazione
|
||||
double m_dCurrTabsLen ; // lunghezza corrente lungo il percorso per tabs
|
||||
bool m_bStartOutRaw ; // flag forzatura inizio fuori dal grezzo
|
||||
bool m_bEndOutRaw ; // flag forzatura fine fuori dal grezzo
|
||||
} ;
|
||||
+28
-8
@@ -641,7 +641,7 @@ Mortising::Update( bool bPostApply)
|
||||
string sHint = ExtractHint( m_Params.m_sUserNotes) ;
|
||||
if ( ! m_Params.m_sInitAngs.empty())
|
||||
sHint = m_Params.m_sInitAngs ;
|
||||
if ( ! CalculateAxesValues( sHint, true)) {
|
||||
if ( ! CalculateAxesValues( sHint, true, true)) {
|
||||
string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
|
||||
if ( sInfo.empty())
|
||||
m_pMchMgr->SetLastError( 2507, "Error in Mortising : axes values not calculable") ;
|
||||
@@ -816,11 +816,31 @@ Mortising::UpdateToolData( bool* pbChanged)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
// verifico se sono diversi (ad esclusione del nome)
|
||||
m_TParams.m_sName = pTdata->m_sName ;
|
||||
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
int nOrigExit = m_TParams.m_nExit ;
|
||||
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
|
||||
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
|
||||
// aggiorno comunque i parametri
|
||||
m_TParams = *pTdata ;
|
||||
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
|
||||
string sTcPos ; string sHead ; int nExit ;
|
||||
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
|
||||
if ( sOrigTcPos != sTcPos ||
|
||||
sOrigHead != sHead ||
|
||||
nOrigExit != nExit)
|
||||
bChanged = true ;
|
||||
m_TParams.m_sTcPos = sTcPos ;
|
||||
m_TParams.m_sHead = sHead ;
|
||||
m_TParams.m_nExit = nExit ;
|
||||
}
|
||||
else {
|
||||
if ( sOrigTcPos != pTdata->m_sTcPos ||
|
||||
sOrigHead != pTdata->m_sHead ||
|
||||
nOrigExit != pTdata->m_nExit)
|
||||
bChanged = true ;
|
||||
}
|
||||
// eventuali segnalazioni
|
||||
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
|
||||
string sInfo = "Warning in Mortising : tool name changed (" +
|
||||
@@ -1537,8 +1557,8 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
|
||||
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() + m_pMchMgr->GetDeltaSafeZ( m_TParams.m_sHead) ;
|
||||
double dStartElev = 0 ;
|
||||
Point3d ptLi = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * dDelta ;
|
||||
bool bUnderStart = GetPointUnderRaw( ptLi, vtTool, 0,
|
||||
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dStartElev) ;
|
||||
bool bUnderStart = GetAhPointUnderRaw( ptLi, vtTool, 0,
|
||||
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dStartElev) ;
|
||||
// altrimenti ridetermino elevazione su inizio percorso di lavoro
|
||||
if ( ! bUnderStart)
|
||||
GetElevation( m_nPhase, ptLi, vtTool, GetRadiusForStartEndElevation(), vtTool, dStartElev) ;
|
||||
@@ -1643,8 +1663,8 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
|
||||
// determino se la fine dell'uscita è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
|
||||
double dEndElev = 0 ;
|
||||
Point3d ptLo = ptLast + vtTool * dDelta ;
|
||||
bool bUnderEnd = GetPointUnderRaw( ptLo, vtTool, 0,
|
||||
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dEndElev) ;
|
||||
bool bUnderEnd = GetAhPointUnderRaw( ptLo, vtTool, 0,
|
||||
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dEndElev) ;
|
||||
// altrimenti ridetermino elevazione su fine percorso di lavoro
|
||||
if ( ! bUnderEnd)
|
||||
GetElevation( m_nPhase, ptLo, vtTool, GetRadiusForStartEndElevation(), vtTool, dEndElev) ;
|
||||
|
||||
+197
-57
@@ -170,13 +170,32 @@ Operation::GetElevation( int nPhase, const Point3d& ptP,
|
||||
const Vector3d& vtDir, double& dElev) const
|
||||
{
|
||||
Vector3d vtNorm ;
|
||||
return GetElevation( nPhase, ptP, vtDir, dElev, vtNorm) ;
|
||||
INTVECTOR vRawStmId ;
|
||||
return GetElevation( nPhase, ptP, vtDir, dElev, vtNorm, vRawStmId) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetElevation( int nPhase, const Point3d& ptP,
|
||||
const Vector3d& vtDir, double& dElev, Vector3d& vtNorm) const
|
||||
{
|
||||
INTVECTOR vRawStmId ;
|
||||
return GetElevation( nPhase, ptP, vtDir, dElev, vtNorm, vRawStmId) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetElevation( int nPhase, const Point3d& ptP,
|
||||
const Vector3d& vtDir, double& dElev, INTVECTOR& vRawStmId) const
|
||||
{
|
||||
Vector3d vtNorm ;
|
||||
return GetElevation( nPhase, ptP, vtDir, dElev, vtNorm, vRawStmId) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetElevation( int nPhase, const Point3d& ptP,
|
||||
const Vector3d& vtDir, double& dElev, Vector3d& vtNorm, INTVECTOR& vRawStmId) const
|
||||
{
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
@@ -240,11 +259,13 @@ Operation::GetElevation( int nPhase, const Point3d& ptP,
|
||||
}
|
||||
}
|
||||
}
|
||||
// se c'è triangolo di intersezione, ne recupero la normale
|
||||
// se c'è triangolo di intersezione, ne recupero la normale e salvo Id del grezzo
|
||||
if ( nTria != SVT_NULL) {
|
||||
Triangle3d Tria ;
|
||||
if ( pStm->GetTriangle( nTria, Tria))
|
||||
vtNorm = Tria.GetN() ;
|
||||
if ( find( vRawStmId.begin(), vRawStmId.end(), nStmId) == vRawStmId.end())
|
||||
vRawStmId.emplace_back( nStmId) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -363,32 +384,83 @@ Operation::GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool,
|
||||
{
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// vettore grezzi interessati
|
||||
INTVECTOR vRawStmId ;
|
||||
// considero il punto centrale
|
||||
if ( ! GetElevation( nPhase, ptP, vtDir, dElev))
|
||||
if ( ! GetElevation( nPhase, ptP, vtDir, dElev, vRawStmId))
|
||||
return false ;
|
||||
// considero più direzioni sulla circonferenza
|
||||
const int MIN_STEP = 8 ;
|
||||
const double LEN_STEP = 25 ;
|
||||
int nStep = max( int( ( 2 * PIGRECO * dRad) / LEN_STEP), MIN_STEP) ;
|
||||
// considero più posizioni sulla circonferenza
|
||||
const int MIN_STEP = 9 ;
|
||||
const int MAX_STEP = 127 ;
|
||||
const double LEN_STEP = 12.5 ;
|
||||
int nStep = Clamp( 2 * int( ( PIGRECO * dRad) / LEN_STEP) + 1, MIN_STEP, MAX_STEP) ;
|
||||
Vector3d vtRad = FromUprightOrtho( vtTool) * dRad ;
|
||||
for ( int i = 0 ; i < nStep ; ++ i) {
|
||||
// esploro 4 posizioni sulle direzioni
|
||||
for ( int j = 1 ; j <= 8 ; j *= 2) {
|
||||
double dElevT = 0 ;
|
||||
if ( ! GetElevation( nPhase, ptP + vtRad / j, vtDir, dElevT))
|
||||
return false ;
|
||||
dElev = max( dElev, dElevT) ;
|
||||
}
|
||||
double dElevT = 0 ;
|
||||
if ( ! GetElevation( nPhase, ptP + vtRad, vtDir, dElevT, vRawStmId))
|
||||
return false ;
|
||||
dElev = max( dElev, dElevT) ;
|
||||
// passo alla direzione successiva
|
||||
vtRad.Rotate( vtTool, ANG_FULL / nStep) ;
|
||||
}
|
||||
// considero i vertici che cadono entro il cilindro positivo spazzato dal fondo utensile
|
||||
for ( auto nRawStmId : vRawStmId) {
|
||||
// recupero la superficie
|
||||
const ISurfTriMesh* pStm = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nRawStmId)) ;
|
||||
if ( pStm != nullptr) {
|
||||
// recupero il riferimento della trimesh
|
||||
Frame3d frStm ;
|
||||
m_pGeomDB->GetGlobFrame( nRawStmId, frStm) ;
|
||||
// ciclo sui vertici
|
||||
Point3d ptV ;
|
||||
int nV = pStm->GetFirstVertex( ptV) ;
|
||||
while ( nV != SVT_NULL) {
|
||||
ptV.ToGlob( frStm) ;
|
||||
double dDist = ( ptV - ptP) * vtDir ;
|
||||
if ( dDist > EPS_ZERO) {
|
||||
if ( AreSameOrOppositeVectorApprox( vtTool, vtDir)) {
|
||||
Vector3d vtOrtho = OrthoCompo( ptV - ptP, vtDir) ;
|
||||
if ( vtOrtho.SqLen() < dRad * dRad + EPS_ZERO)
|
||||
dElev = max( dElev, dDist) ;
|
||||
}
|
||||
else {
|
||||
Vector3d vtOrtho = OrthoCompo( ptV - ptP, vtDir) ;
|
||||
Vector3d vtMajAx = vtTool ^ vtDir ; vtMajAx.Normalize() ;
|
||||
Vector3d vtMajOrt = ParallCompo( vtOrtho, vtMajAx) ;
|
||||
Vector3d vtMinOrt = ( vtOrtho - vtMajOrt) / abs( vtTool * vtDir) ;
|
||||
if ( vtMajOrt.SqLen() + vtMinOrt.SqLen() < dRad * dRad + EPS_ZERO)
|
||||
dElev = max( dElev, dDist) ;
|
||||
}
|
||||
}
|
||||
nV = pStm->GetNextVertex( nV, ptV) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
|
||||
double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const
|
||||
Operation::GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad, double dLen,
|
||||
const Vector3d& vtDir, double& dElev) const
|
||||
{
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// sopra e sotto
|
||||
double dElev1, dElev2 ;
|
||||
if ( ! GetElevation( nPhase, ptP, vtTool, dRad, vtDir, dElev1))
|
||||
return false ;
|
||||
if ( ! GetElevation( nPhase, ptP + dLen * vtTool, vtTool, dRad, vtDir, dElev2))
|
||||
return false ;
|
||||
dElev = max( dElev1, dElev2) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetAhPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
|
||||
double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const
|
||||
{
|
||||
// punto a metà lunghezza utensile
|
||||
Point3d ptQ = ptP + vtTool * dToolLen / 2 ;
|
||||
@@ -445,6 +517,66 @@ Operation::GetPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetUhPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
|
||||
double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const
|
||||
{
|
||||
// punto a metà lunghezza utensile
|
||||
Point3d ptQ = ptP + vtTool * dToolLen / 2 ;
|
||||
// box di ingombro dell'utensile
|
||||
BBox3d b3Tool ;
|
||||
b3Tool.Set( ptP) ;
|
||||
b3Tool.Add( ptQ) ;
|
||||
double dExpandX = sqrt( 1 - vtTool.x * vtTool.x) * dToolRadForElev ;
|
||||
double dExpandY = sqrt( 1 - vtTool.y * vtTool.y) * dToolRadForElev ;
|
||||
double dExpandZ = sqrt( 1 - vtTool.z * vtTool.z) * dToolRadForElev ;
|
||||
b3Tool.Expand( dExpandX, dExpandY, dExpandZ) ;
|
||||
// extra ingombro reale in Z
|
||||
double dExtraZ = sqrt( 1 - vtTool.z * vtTool.z) * dToolRad ;
|
||||
// direzione di fuga per l'elevazione
|
||||
Vector3d vtMyDir = vtDir ;
|
||||
if ( bIsSaw || vtMyDir.z > EPS_SMALL)
|
||||
vtMyDir.z = 0 ;
|
||||
vtMyDir.Normalize() ;
|
||||
// determino la posizione del punto rispetto al grezzo
|
||||
// ciclo sui grezzi
|
||||
int nRawId = m_pMchMgr->GetFirstRawPart() ;
|
||||
while ( nRawId != GDB_ID_NULL) {
|
||||
// se il grezzo compare nella fase
|
||||
if ( m_pMchMgr->VerifyRawPartPhase( nRawId, m_nPhase)) {
|
||||
int nStmId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
|
||||
BBox3d b3Raw ;
|
||||
m_pGeomDB->GetGlobalBBox( nStmId, b3Raw) ;
|
||||
b3Raw.Expand( 0.5 * dSafeZ, 0.5 * dSafeZ, 0) ;
|
||||
if ( ! b3Raw.IsEmpty() && b3Raw.OverlapsXY( b3Tool) && ptP.z - dExtraZ > b3Raw.GetMax().z + 10 * EPS_SMALL) {
|
||||
double dRawCentZ = ( b3Raw.GetMin().z + b3Raw.GetMax().z) / 2 ;
|
||||
double dRawDimZ = b3Raw.GetMax().z - b3Raw.GetMin().z ;
|
||||
double dToolDimZ = b3Tool.GetMax().z - b3Tool.GetMin().z ;
|
||||
// determino elevazione del punto rispetto al grezzo a metà altezza
|
||||
Point3d ptTest( ptP.x, ptP.y, dRawCentZ) ;
|
||||
double dNewElev ;
|
||||
if ( GetElevation( m_nPhase, ptTest - 10 * EPS_SMALL * vtTool, vtTool, dToolRadForElev, vtMyDir, dNewElev))
|
||||
dElev = max( dElev, dNewElev) ;
|
||||
// se direzione di fuga quasi orizzontale (max 30 deg) e ingombro utensile rilevante rispetto ad altezza grezzo
|
||||
if ( vtMyDir.z > -0.5 && dToolDimZ > dRawDimZ / 2) {
|
||||
// determino elevazione del punto rispetto al grezzo a metà altezza più metà ingombro utensile
|
||||
ptTest = Point3d( ptP.x, ptP.y, dRawCentZ + dToolDimZ / 2) ;
|
||||
if ( GetElevation( m_nPhase, ptTest - 10 * EPS_SMALL * vtTool, vtTool, dToolRadForElev, vtMyDir, dNewElev))
|
||||
dElev = max( dElev, dNewElev) ;
|
||||
// determino elevazione del punto rispetto al grezzo a metà altezza meno metà ingombro utensile
|
||||
ptTest = Point3d( ptP.x, ptP.y, dRawCentZ - dToolDimZ / 2) ;
|
||||
if ( GetElevation( m_nPhase, ptTest - 10 * EPS_SMALL * vtTool, vtTool, dToolRadForElev, vtMyDir, dNewElev))
|
||||
dElev = max( dElev, dNewElev) ;
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
nRawId = m_pMchMgr->GetNextRawPart( nRawId) ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist) const
|
||||
@@ -637,38 +769,26 @@ Operation::GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dEx
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetDistanceFromRawBottom(int nPhase, int nPathId, double dToler, double& dRbDist, double& dAllRbDist) const
|
||||
Operation::GetDistanceFromRawBottom( int nPhase, int nPathId, double dToler, double& dRbDist, double& dAllRbDist) const
|
||||
{
|
||||
if (m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false;
|
||||
|
||||
// ricerco grezzi interessati dal percorso
|
||||
BBox3d b3Compo;
|
||||
if (!m_pGeomDB->GetGlobalBBox(nPathId, b3Compo))
|
||||
return false;
|
||||
return GetDistanceFromRawBottom(nPhase, b3Compo, dToler, dRbDist, dAllRbDist);
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::GetDistanceFromRawBottom(int nPhase, BBox3d& b3Test, double dToler, double& dRbDist, double& dAllRbDist) const
|
||||
{
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
// recupero distanza da fondo dei grezzi interessati o no dal percorso
|
||||
dRbDist = 0 ;
|
||||
dAllRbDist = 0 ;
|
||||
b3Test.Expand(dToler, dToler, 0) ;
|
||||
BBox3d b3Compo ;
|
||||
if ( ! m_pGeomDB->GetGlobalBBox( nPathId, b3Compo))
|
||||
return false ;
|
||||
b3Compo.Expand( dToler, dToler, 0) ;
|
||||
int nRawId = m_pMchMgr->GetFirstRawPart() ;
|
||||
while ( nRawId != GDB_ID_NULL) {
|
||||
// verifico che il grezzo compaia nella fase
|
||||
if ( m_pMchMgr->VerifyRawPartPhase( nRawId, nPhase)) {
|
||||
BBox3d b3Raw ;
|
||||
int nRawSolidId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
|
||||
if (m_pGeomDB->GetGlobalBBox( nRawSolidId, b3Raw)) {
|
||||
double dDist = b3Test.GetMax().z - b3Raw.GetMin().z ;
|
||||
if ( b3Test.OverlapsXY( b3Raw) && dDist > dRbDist)
|
||||
if ( m_pGeomDB->GetGlobalBBox( nRawSolidId, b3Raw)) {
|
||||
double dDist = b3Compo.GetMax().z - b3Raw.GetMin().z ;
|
||||
if ( b3Compo.OverlapsXY( b3Raw) && dDist > dRbDist)
|
||||
dRbDist = dDist ;
|
||||
if ( dDist > dAllRbDist)
|
||||
dAllRbDist = dDist ;
|
||||
@@ -962,8 +1082,9 @@ Operation::ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp)
|
||||
// limito l'approssimazione alle curve piane
|
||||
Frame3d frRef ;
|
||||
frRef.Set( ORIG, vtExtr) ;
|
||||
Frame3d frInvRef = frRef ; frInvRef.Invert() ;
|
||||
BBox3d b3Crv ;
|
||||
if ( ! pCompo->GetBBox( frRef, b3Crv) || abs( b3Crv.GetMax().z - b3Crv.GetMin().z - dThick) > 100 * EPS_SMALL)
|
||||
if ( ! pCompo->GetBBox( frInvRef, b3Crv) || abs( b3Crv.GetMax().z - b3Crv.GetMin().z - dThick) > 100 * EPS_SMALL)
|
||||
return true ;
|
||||
// porto la curva nel suo piano perchè ApproxWithArcsEx funziona bene solo nel piano XY (all'uscita va ripristinato il rif. originale)
|
||||
pCompo->ToLoc( frRef) ;
|
||||
@@ -1026,7 +1147,7 @@ Operation::ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp)
|
||||
for ( int j = 0 ; j < pCC->GetCurveCount() ; ++ j)
|
||||
pCC->SetCurveTempProp( j, vInt[i].second) ;
|
||||
// reinserisco nel vettore di curve
|
||||
vpCrvs.back().Set( Release( pCC)) ;
|
||||
vpCrvs.back().Set( pCC) ;
|
||||
}
|
||||
}
|
||||
// riassemblo la curva e assegno le opportune proprietà
|
||||
@@ -1446,7 +1567,7 @@ Operation::SetBlockedRotAxis( const string& sBlockedAxis) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::CalculateAxesValues( const string& sHint, bool bSolChExact)
|
||||
Operation::CalculateAxesValues( const string& sHint, bool bRotContOnNext, bool bSolChExact)
|
||||
{
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
@@ -1511,8 +1632,17 @@ Operation::CalculateAxesValues( const string& sHint, bool bSolChExact)
|
||||
if ( m_pMchMgr->GetCurrMachine()->GetCurrAxisToken( nLinAxes + i, sAxToken) &&
|
||||
szKey == Trim( sAxToken)) {
|
||||
double dVal ;
|
||||
if ( FromString( szVal, dVal))
|
||||
if ( FromString( szVal, dVal)) {
|
||||
double dOffset = 0 ;
|
||||
m_pMchMgr->GetCurrMachine()->GetCurrAxisOffset( nLinAxes + i, dOffset) ;
|
||||
if ( abs( dOffset) > EPS_ANG_SMALL)
|
||||
dVal -= dOffset ;
|
||||
bool bInvert = false ;
|
||||
m_pMchMgr->GetCurrMachine()->GetCurrAxisInvert( nLinAxes + i, bInvert) ;
|
||||
if ( bInvert)
|
||||
dVal = -dVal ;
|
||||
vAxRotPrec[i] = dVal ;
|
||||
}
|
||||
break ;
|
||||
}
|
||||
}
|
||||
@@ -1546,12 +1676,12 @@ Operation::CalculateAxesValues( const string& sHint, bool bSolChExact)
|
||||
DBLVECTOR vAxRotPrecOri = vAxRotPrec ;
|
||||
int nOutStrC = 0 ;
|
||||
if ( ! CalculateClPathAxesValues( nClPathId, nLinAxes, nRotAxes, dRot1W, bMaxDeltaR2OnFirst,
|
||||
dAngDeltaMinForHome, vAxRotHome, vAxRotPrec, nOutStrC)) {
|
||||
bRotContOnNext, dAngDeltaMinForHome, vAxRotHome, vAxRotPrec, nOutStrC)) {
|
||||
// se attivata scelta angolo iniziale vicino ad home ed extra corsa C, provo a rifarlo disattivando
|
||||
if ( dAngDeltaMinForHome < ANG_FULL && nOutStrC != 0) {
|
||||
m_pMchMgr->GetCurrMachine()->ResetOutstrokeInfo() ;
|
||||
CalculateClPathAxesValues( nClPathId, nLinAxes, nRotAxes, dRot1W, bMaxDeltaR2OnFirst,
|
||||
INFINITO, vAxRotHome, vAxRotPrec, nOutStrC) ;
|
||||
bRotContOnNext, INFINITO, vAxRotHome, vAxRotPrec, nOutStrC) ;
|
||||
}
|
||||
// se extracorsa dell'asse C, provo a precaricarlo al contrario
|
||||
if ( nOutStrC != 0) {
|
||||
@@ -1559,7 +1689,7 @@ Operation::CalculateAxesValues( const string& sHint, bool bSolChExact)
|
||||
vAxRotPrec[0] = vAxRotPrecOri[0] + ( nOutStrC > 0 ? - ANG_FULL : ANG_FULL) ;
|
||||
m_pMchMgr->GetCurrMachine()->ResetOutstrokeInfo() ;
|
||||
if ( ! CalculateClPathAxesValues( nClPathId, nLinAxes, nRotAxes, dRot1W, bMaxDeltaR2OnFirst,
|
||||
INFINITO, vAxRotHome, vAxRotPrec, nOutStrC))
|
||||
bRotContOnNext, INFINITO, vAxRotHome, vAxRotPrec, nOutStrC))
|
||||
bOk = false ;
|
||||
}
|
||||
else
|
||||
@@ -1573,8 +1703,9 @@ Operation::CalculateAxesValues( const string& sHint, bool bSolChExact)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W, bool bMaxDeltaR2OnFirst,
|
||||
double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC)
|
||||
Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
|
||||
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
|
||||
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC)
|
||||
{
|
||||
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
|
||||
return false ;
|
||||
@@ -1637,9 +1768,12 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes,
|
||||
else {
|
||||
// scelgo gli angoli più vicini, per continuità non applico offset per stare nelle corse
|
||||
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
|
||||
vAng1[i] = AngleNearAngle( vAng1[i], vAxRotPrec[i]) ;
|
||||
if ( bRotContOnNext)
|
||||
vAng1[i] = AngleNearAngle( vAng1[i], vAxRotPrec[i]) ;
|
||||
else
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
|
||||
if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
|
||||
vAng1[i] = AngleNearAngle( vAng1[i], vAxRotHome[i]) ;
|
||||
vAng1[i] = m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
|
||||
}
|
||||
// se sol.ne indeterminata (sempre il primo asse libero), assegno il precedente
|
||||
if ( nRStat < 0 && vAng1.size() >= 1) {
|
||||
@@ -1685,12 +1819,18 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes,
|
||||
else {
|
||||
// scelgo gli angoli più vicini, per continuità non applico offset per stare nelle corse
|
||||
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
|
||||
vAng1[i] = AngleNearAngle( vAng1[i], vAxRotPrec[i]) ;
|
||||
if ( bRotContOnNext)
|
||||
vAng1[i] = AngleNearAngle( vAng1[i], vAxRotPrec[i]) ;
|
||||
else
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
|
||||
if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
|
||||
vAng1[i] = AngleNearAngle( vAng1[i], vAxRotHome[i]) ;
|
||||
vAng2[i] = AngleNearAngle( vAng2[i], vAxRotPrec[i]) ;
|
||||
vAng1[i] = m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ;
|
||||
if ( bRotContOnNext)
|
||||
vAng2[i] = AngleNearAngle( vAng2[i], vAxRotPrec[i]) ;
|
||||
else
|
||||
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng2[i]) ;
|
||||
if ( abs( vAng2[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
|
||||
vAng2[i] = AngleNearAngle( vAng2[i], vAxRotHome[i]) ;
|
||||
vAng2[i] = m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng2[i]) ;
|
||||
}
|
||||
// se sol.ne indeterminata (sempre il primo asse libero), assegno il precedente
|
||||
if ( nRStat < 0 && vAng1.size() >= 1) {
|
||||
@@ -2816,7 +2956,7 @@ Operation::CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR
|
||||
bool
|
||||
Operation::GetExtraZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
|
||||
const DBLVECTOR& vAx2, const Vector3d& vtTool2,
|
||||
double dSafeZ, double& dExtraZ) const
|
||||
double dHomeZ, double& dExtraZ) const
|
||||
{
|
||||
// Recupero macchina corrente
|
||||
Machine* pMch = ( m_pMchMgr != nullptr ? m_pMchMgr->GetCurrMachine() : nullptr) ;
|
||||
@@ -2838,12 +2978,12 @@ Operation::GetExtraZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
|
||||
if ( SpecialGetMaxZ( vAx1, vtTool1, vAx2, vtTool2, dMaxZ)) {
|
||||
// se caso standard
|
||||
if ( ! bZHomeDown) {
|
||||
dExtraZ = min( dMaxZ, dAxZmax) - dSafeZ ;
|
||||
dExtraZ = min( dMaxZ, dAxZmax) - dHomeZ ;
|
||||
return ( dExtraZ > EPS_SMALL) ;
|
||||
}
|
||||
// altrimenti caso con posizione sicura in basso (teste da sotto)
|
||||
else {
|
||||
dExtraZ = max( dMaxZ, dAxZmin) - dSafeZ ;
|
||||
dExtraZ = max( dMaxZ, dAxZmin) - dHomeZ ;
|
||||
return ( dExtraZ < EPS_SMALL) ;
|
||||
}
|
||||
}
|
||||
@@ -2868,14 +3008,14 @@ Operation::GetExtraZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
|
||||
if ( ! bZHomeDown) {
|
||||
double dZmax ;
|
||||
pMch->GetCurrAxisMax( 2, dZmax) ;
|
||||
dExtraZ = min( vdVal[0], dZmax - dSafeZ) ;
|
||||
dExtraZ = min( vdVal[0], dZmax - dHomeZ) ;
|
||||
return ( dExtraZ > EPS_SMALL) ;
|
||||
}
|
||||
// altrimenti caso con posizione sicura in basso (teste da sotto)
|
||||
else {
|
||||
double dZmin ;
|
||||
pMch->GetCurrAxisMin( 2, dZmin) ;
|
||||
dExtraZ = max( vdVal[0], dZmin - dSafeZ) ;
|
||||
dExtraZ = max( vdVal[0], dZmin - dHomeZ) ;
|
||||
return ( dExtraZ < EPS_SMALL) ;
|
||||
}
|
||||
}
|
||||
|
||||
+15
-7
@@ -71,14 +71,22 @@ class Operation : public IUserObj
|
||||
const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptP,
|
||||
const Vector3d& vtDir, double& dElev, Vector3d& vtNorm) const ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptP,
|
||||
const Vector3d& vtDir, double& dElev, INTVECTOR& vRawStmId) const ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptP,
|
||||
const Vector3d& vtDir, double& dElev, Vector3d& vtNorm, INTVECTOR& vRawStmId) const ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptP1, const Point3d& ptP2,
|
||||
const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptP3,
|
||||
const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad,
|
||||
const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
|
||||
double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad, double dLen,
|
||||
const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetAhPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
|
||||
double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetUhPointAboveRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
|
||||
double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const ;
|
||||
bool GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist) const ;
|
||||
bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand,
|
||||
double& dDist, Vector3d& vtDir) const ;
|
||||
@@ -89,7 +97,6 @@ class Operation : public IUserObj
|
||||
{ double dDummy ;
|
||||
return GetDistanceFromRawBottom( nPhase, nPathId, dToler, dRbDist, dDummy) ; }
|
||||
bool GetDistanceFromRawBottom( int nPhase, int nPathId, double dToler, double& dRbDist, double& dAllRbDist) const ;
|
||||
bool GetDistanceFromRawBottom( int nPhase, BBox3d& b3Test, double dToler, double& dRbDist, double& dAllRbDist) const;
|
||||
bool GetRawGlobBox( int nPhase, int nPathId, double dToler, BBox3d& b3Raw) const ;
|
||||
bool GetRawGlobBox( int nPhase, const BBox3d& b3Test, double dToler, BBox3d& b3Raw) const ;
|
||||
|
||||
@@ -116,9 +123,10 @@ class Operation : public IUserObj
|
||||
std::string ExtractInfo( const std::string& sNotes, const std::string& sKey) const ;
|
||||
std::string ExtractHint( const std::string& sNotes) const ;
|
||||
bool SetBlockedRotAxis( const std::string& sBlockedAxis) const ;
|
||||
bool CalculateAxesValues( const std::string& sHint, bool bSolChExact = false) ;
|
||||
bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W, bool bMaxDeltaR2OnFirst,
|
||||
double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
|
||||
bool CalculateAxesValues( const std::string& sHint, bool bRotContOnNext = true, bool bSolChExact = false) ;
|
||||
bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W,
|
||||
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome,
|
||||
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
|
||||
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 ;
|
||||
@@ -130,7 +138,7 @@ class Operation : public IUserObj
|
||||
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,
|
||||
double dSafeZ, double& dExtraZ) const ;
|
||||
double dHomeZ, double& dExtraZ) const ;
|
||||
bool SpecialGetMaxZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
|
||||
const DBLVECTOR& vAx2, const Vector3d& vtTool2,
|
||||
double& dMaxZ) const ;
|
||||
|
||||
+1642
-4082
File diff suppressed because it is too large
Load Diff
+31
-56
@@ -19,7 +19,6 @@
|
||||
#include "/EgtDev/Include/EGkCurveComposite.h"
|
||||
#include "/EgtDev/Include/EGkCurveLine.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EGkSurfFlatRegion.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class Pocketing : public Machining
|
||||
@@ -74,18 +73,13 @@ class Pocketing : public Machining
|
||||
bool Chain( int nGrpDestId) ;
|
||||
bool ProcessPath( int nPathId, int nPvId, int nClId) ;
|
||||
bool CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double& dElev) const ;
|
||||
bool VerifyPathFromBottom( const ISurfFlatRegion* pSrf, const Vector3d& vtTool) ;
|
||||
bool GeneratePocketingPv( int nPathId, const ISurfFlatRegion* pSrfPock) ;
|
||||
|
||||
bool ModifyCurveToSmooted( ICurveComposite* pCrvOffset, double dRightPer, double dleftPer) ;
|
||||
|
||||
// ===== ZigZag =====
|
||||
bool AddZigZag( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth, double dElev, double dOkStep,
|
||||
bool bSplitArcs, int nPathId) ;
|
||||
bool CalcZigZag( const ISurfFlatRegion* pSrfZigZag, ICRVCOMPOPOVECTOR& vpCrvs) ;
|
||||
bool CalcBoundedZigZagLink( ICurveLine* pCrv1, ICurveLine* pCrv2, ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink, int nIndexCut = 3) ;
|
||||
bool OptimizedZigZag( ISurfFlatRegion* pSrf, const Vector3d & vtTool, double dDepth, double dSafeZ, Frame3d & frPocket, bool & bOptimizedZigZag,
|
||||
ICRVCOMPOPOVECTOR & vpCrvs) ;
|
||||
bool VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool) ;
|
||||
bool GeneratePocketingPv( int nPathId, const ICurveComposite* pCompo) ;
|
||||
bool AddZigZag( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs, int nPathId) ;
|
||||
bool CalcZigZag( const ICurveComposite* pOffs, ICRVCOMPOPOVECTOR& vpCrvs) ;
|
||||
bool OptimizedZigZag( int nPathId, const Vector3d& vtTool, double dDepth, double dSafeZ,
|
||||
Frame3d& frPocket, bool& bOptimizedZigZag, ICRVCOMPOPOVECTOR& vpCrvs) ;
|
||||
bool ZigZagOptimizedNoClosedEdges( ICurveComposite* pCrvPocket, bool& bOptimizedZigZag, Vector3d& vtDir) ;
|
||||
bool ZigZagOptimizedOneClosedEdge( ICurveComposite* pCrvPocket, int nClosedId, bool& bOptimizedZigZag, Vector3d& vtDir) ;
|
||||
bool ZigZagOptimizedTwoClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag,
|
||||
@@ -95,38 +89,17 @@ class Pocketing : public Machining
|
||||
bool ZigZagOptimizedComputeOffset( ICurveComposite* pCrvPocket, const Vector3d& vtMainDir, int nOffsettedEdgesOnY,
|
||||
const INTVECTOR& vnClosedIds) ;
|
||||
bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ;
|
||||
bool GetUnclearedRegion( ICRVCOMPOPOVECTOR& vFirstOffs, ICRVCOMPOPOVECTOR& vCrvs, ICURVEPOVECTOR& vLinks, ISurfFlatRegion* pSrfToCut) ;
|
||||
// ==================
|
||||
|
||||
// ==== OneWay ======
|
||||
bool AddOneWay( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
|
||||
// ==================
|
||||
|
||||
// ==== SpiralIn/Out ====
|
||||
bool AddSpiralIn( const ISurfFlatRegion* pSrfPock, const PNTVECTOR vPtStart, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth,
|
||||
double dElev, double dOkStep, bool bSplitArcs, BOOLVECTOR vbMidOpen, PNTVECTOR vPtMidOpen, VCT3DVECTOR vVtMidOut, int nPathId) ;
|
||||
bool AddSpiralOut( const ISurfFlatRegion* pSrfpock, const PNTVECTOR vPtStart, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth, double dElev,
|
||||
double dOkStep, bool bSplitArcs, int nPathId) ;
|
||||
bool CalcSpiral( const ISurfFlatRegion* pSrfChunk, int nReg, Point3d ptStart, bool bSplitArcs, ICurveComposite* pMCrv, ICurveComposite* pRCrv, int nPathId,
|
||||
bool& bOptimizedTrap) ;
|
||||
bool RemoveExtraParts( ISurfFlatRegion* pSrfToCut, ICRVCOMPOPOVECTOR& vOffs, ICRVCOMPOPOVECTOR& vOffsClosedCurves, ICRVCOMPOPOVECTOR& vOffsFirstCurve,
|
||||
ICURVEPOVECTOR& vLinks) ;
|
||||
bool RemoveExtraPartByMedialAxis( ISurfFlatRegion* pChunkToCut, ICRVCOMPOPOVECTOR& vOffsFirstCurve, int& nOptFlag, Point3d& ptCentroid,
|
||||
ICurveComposite* pCrvPath) ;
|
||||
bool CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, 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 ModifyBiArc( ICurve* pCrvBiArc, double dCutToll, ICurveComposite* pNewCrv) ;
|
||||
bool CutCurveByOffsets( ICurveComposite* pCurve, ICRVCOMPOPOVECTOR& vOffs) ;
|
||||
bool GetCurveWeightInfo( ICurveComposite* pCrvCompo, double dMaxLen, double& dToTRot, int& nSmallArcs, int& nSmallLines) ;
|
||||
bool ChoosePath( ICurveComposite* pCrv1, ICurveComposite* pCrv2, int nP, double dPerP, double dMaxLen, int& nC) ;
|
||||
bool CutCurveToConnect( ICurveComposite* pCrvS, ICurveComposite* pCrvE, ICRVCOMPOPOVECTOR& vOffs, ICRVCOMPOPOVECTOR& vOffIslands,
|
||||
ICurveComposite* pCrvLink, double dLenPercS = 0.01, double dLenPercE = 0.01, int nMaxIter = 2) ;
|
||||
bool GetNewCurvetWithCentroid( ICurveComposite* pCrvH1, ICurveComposite* pCrvH2, Point3d& ptC, bool bCir, ICRVCOMPOPOVECTOR& VFirstOff,
|
||||
ICurveComposite* pCrvNewCurve) ;
|
||||
bool GetNewCurvetWithPath( ICurveComposite* pCrvH1, ICurveComposite* pCrvH2, ICurveComposite* pCrvPath, ICRVCOMPOPOVECTOR& VFirstOff, ICRVCOMPOPOVECTOR& VoffsCl,
|
||||
ICurveComposite* pCrvNewCurve) ;
|
||||
bool ManageSmoothAndAutoInters( ICurveComposite* pCrv, ICurveComposite* pCrvPath, ICurveComposite* pPath1, ICurveComposite* pPath2, ICRVCOMPOPOVECTOR& vOffsCL) ;
|
||||
bool AddOneWay( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
|
||||
bool AddSpiralIn( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs, bool bMidOpen,
|
||||
const Point3d& ptMidOpen, const Vector3d& vtMidOut, int nPathId) ;
|
||||
bool AddSpiralOut( const ICurveComposite* pCompo, const Vector3d& vtTool, const Vector3d& vtExtr,
|
||||
double dDepth, double dElev, double dOkStep, bool bSplitArcs, int nPathId) ;
|
||||
bool CalcSpiral( const ICurveComposite* pCompo, int nReg, bool bSplitArcs,
|
||||
ICurveComposite* pMCrv, ICurveComposite* pRCrv, int nPathId, bool& bOptimizedTrap) ;
|
||||
bool CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, const ICurve* pCrvBound,
|
||||
ICurveComposite* pCrvLink) ;
|
||||
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,
|
||||
@@ -139,10 +112,7 @@ class Pocketing : public Machining
|
||||
bool SpecialAdjustTrapezoidSpiralForAngles( ICurveComposite* pMCrv, const ICurveComposite* pCrvPocket) ;
|
||||
bool AdjustTrapezoidSpiralForLeadInLeadOut( ICurveComposite * pCompo, ICurveComposite * pRCrv, const Vector3d& vtTool,
|
||||
double dDepth, int& nOutsideRaw) ;
|
||||
bool ComputeTrapezoidSpiralLeadInLeadOut( ICurveComposite * pCompo, const Vector3d& vtMainDir, bool bLeadIn, const Vector3d& vtTool, double dDepth,
|
||||
bool& bIsOutsideRaw) ;
|
||||
// ==================
|
||||
|
||||
bool ComputeTrapezoidSpiralLeadInLeadOut( ICurveComposite * pCompo, const Vector3d& vtMainDir, bool bLeadIn, const Vector3d& vtTool, double dDepth, bool& bIsOutsideRaw) ;
|
||||
bool ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool bSplitArcs) ;
|
||||
bool AddEpicycles( ICurveComposite * pCompo, ICurveComposite * pCrv, ICurveComposite * pCrvBound = nullptr) ;
|
||||
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
|
||||
@@ -155,17 +125,21 @@ 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 Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtN,
|
||||
const ICurveComposite* pCompo, 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, Point3d& ptP1, double& dElev, bool bNoneForced = false) ;
|
||||
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced,
|
||||
Point3d& ptP1, double& dElev) ;
|
||||
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
|
||||
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced,
|
||||
Point3d& ptP1, double& dElev, bool& bOppositeHome) ;
|
||||
double GetRadiusForStartEndElevation( void) const ;
|
||||
bool GetMidOfLongestOpenSide( const ICurveComposite* pCompo, Point3d& ptMid, Vector3d& vtMidOut) ;
|
||||
bool AdjustContourWithOpenEdges( ICurveComposite* pCompo) ;
|
||||
bool AdjustContourStart( ICurveComposite* pCompo) ;
|
||||
bool VerifyLeadInHelix( ISurfFlatRegion* pSrfChunk, const Point3d& ptCen, double dRad) const ;
|
||||
bool VerifyLeadInZigZag( ISurfFlatRegion* pSrfChunk, const Point3d& ptPa, const Point3d& ptPb) const ;
|
||||
bool VerifyLeadInHelix( const ICurveComposite* pCompo, const Point3d& ptCen, double dRad) const ;
|
||||
bool VerifyLeadInZigZag( const ICurveComposite* pCompo, const Point3d& ptPa, const Point3d& ptPb) const ;
|
||||
bool CalcDistanceFromRawSurface( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist, Vector3d& vtNorm) ;
|
||||
|
||||
private :
|
||||
@@ -191,7 +165,7 @@ class Pocketing : public Machining
|
||||
if ( m_Params.m_nLeadInType != POCKET_LI_GLIDE && m_Params.m_dLiElev < 10 * EPS_SMALL)
|
||||
return POCKET_LI_NONE ;
|
||||
return m_Params.m_nLeadInType ; }
|
||||
int LeadInIsOk( void) const
|
||||
bool LeadInRawIsOk( void) const
|
||||
{ if ( m_TParams.m_nType != TT_MILL_NOTIP)
|
||||
return true ;
|
||||
return (( GetLeadInType() == POCKET_LI_ZIGZAG || GetLeadInType() == POCKET_LI_HELIX) &&
|
||||
@@ -212,10 +186,11 @@ class Pocketing : public Machining
|
||||
int m_nStatus ; // stato di aggiornamento della lavorazione
|
||||
int m_nPockets ; // numero di percorsi di svuotatura generati
|
||||
bool m_bTiltingTab ; // flag utilizzo tavola basculante
|
||||
Vector3d m_vtTiltingAx ; // versore direzione eventuale asse basculante
|
||||
bool m_bAboveHead ; // flag utilizzo testa da sopra
|
||||
bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto
|
||||
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
|
||||
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
|
||||
bool m_bOpenOutRaw ; // flag forzatura lati aperti sempre fuori dal grezzo
|
||||
POLYLINEVECTOR m_VplIsland ; // vettore che contiene le curve che descrivono le isole
|
||||
double m_dOpenMinSafe ; // minima distanza di sicurezza di attacco su lato aperto
|
||||
} ;
|
||||
+2
-2
@@ -184,8 +184,8 @@ Processor::ProcessDisposition( int nOpId, int nOpInd)
|
||||
bool bEmpty = pDisp->IsEmpty() ;
|
||||
bool bSomeByHand = pDisp->GetSomeByHand() ;
|
||||
|
||||
// Se disposizione con movimenti macchina
|
||||
if ( ! pDisp->IsEmpty()) {
|
||||
// Se disposizione con movimenti autonomi e utensile associato
|
||||
if ( ! pDisp->IsEmpty() && pDisp->IsWithTool()) {
|
||||
// Recupero l'utensile della disposizione corrente
|
||||
string sTool ; string sHead ; int nExit ; string sTcPos ;
|
||||
if ( ! pDisp->GetToolData( sTool, sHead, nExit, sTcPos))
|
||||
|
||||
+24
-4
@@ -795,11 +795,31 @@ SawFinishing::UpdateToolData( bool* pbChanged)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
// verifico se sono diversi (ad esclusione del nome)
|
||||
m_TParams.m_sName = pTdata->m_sName ;
|
||||
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
int nOrigExit = m_TParams.m_nExit ;
|
||||
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
|
||||
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
|
||||
// aggiorno comunque i parametri
|
||||
m_TParams = *pTdata ;
|
||||
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
|
||||
string sTcPos ; string sHead ; int nExit ;
|
||||
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
|
||||
if ( sOrigTcPos != sTcPos ||
|
||||
sOrigHead != sHead ||
|
||||
nOrigExit != nExit)
|
||||
bChanged = true ;
|
||||
m_TParams.m_sTcPos = sTcPos ;
|
||||
m_TParams.m_sHead = sHead ;
|
||||
m_TParams.m_nExit = nExit ;
|
||||
}
|
||||
else {
|
||||
if ( sOrigTcPos != pTdata->m_sTcPos ||
|
||||
sOrigHead != pTdata->m_sHead ||
|
||||
nOrigExit != pTdata->m_nExit)
|
||||
bChanged = true ;
|
||||
}
|
||||
// eventuali segnalazioni
|
||||
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
|
||||
string sInfo = "Warning in SawFinishing : tool name changed (" +
|
||||
@@ -967,7 +987,7 @@ SawFinishing::AdjustGeometry( int nAuxId)
|
||||
// verifiche sull'ampiezza dell'angolo al centro degli eventuali archi
|
||||
VerifyArcs( pCompo) ;
|
||||
// reinserisco nella curva originale
|
||||
pGuide.Set( Release( pCompo)) ;
|
||||
pGuide.Set( pCompo) ;
|
||||
}
|
||||
// deve iniziare in comune con la prima sezione ed essere ivi perpendicolare
|
||||
Vector3d vtGdDir ;
|
||||
|
||||
+24
-4
@@ -753,11 +753,31 @@ SawRoughing::UpdateToolData( bool* pbChanged)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
// verifico se sono diversi (ad esclusione del nome)
|
||||
m_TParams.m_sName = pTdata->m_sName ;
|
||||
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
int nOrigExit = m_TParams.m_nExit ;
|
||||
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
|
||||
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
|
||||
// aggiorno comunque i parametri
|
||||
m_TParams = *pTdata ;
|
||||
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
|
||||
string sTcPos ; string sHead ; int nExit ;
|
||||
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
|
||||
if ( sOrigTcPos != sTcPos ||
|
||||
sOrigHead != sHead ||
|
||||
nOrigExit != nExit)
|
||||
bChanged = true ;
|
||||
m_TParams.m_sTcPos = sTcPos ;
|
||||
m_TParams.m_sHead = sHead ;
|
||||
m_TParams.m_nExit = nExit ;
|
||||
}
|
||||
else {
|
||||
if ( sOrigTcPos != pTdata->m_sTcPos ||
|
||||
sOrigHead != pTdata->m_sHead ||
|
||||
nOrigExit != pTdata->m_nExit)
|
||||
bChanged = true ;
|
||||
}
|
||||
// eventuali segnalazioni
|
||||
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
|
||||
string sInfo = "Warning in SawRoughing : tool name changed (" +
|
||||
@@ -925,7 +945,7 @@ SawRoughing::AdjustGeometry( int nAuxId)
|
||||
// verifiche sull'ampiezza dell'angolo al centro degli eventuali archi
|
||||
VerifyArcs( pCompo) ;
|
||||
// reinserisco nella curva originale
|
||||
pGuide.Set( Release( pCompo)) ;
|
||||
pGuide.Set( pCompo) ;
|
||||
}
|
||||
// deve iniziare in comune con la prima sezione ed essere ivi perpendicolare
|
||||
Vector3d vtGdDir ;
|
||||
|
||||
+51
-20
@@ -1025,11 +1025,31 @@ Sawing::UpdateToolData( bool* pbChanged)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
// verifico se sono diversi (ad esclusione del nome)
|
||||
m_TParams.m_sName = pTdata->m_sName ;
|
||||
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
int nOrigExit = m_TParams.m_nExit ;
|
||||
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
|
||||
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
|
||||
// aggiorno comunque i parametri
|
||||
m_TParams = *pTdata ;
|
||||
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
|
||||
string sTcPos ; string sHead ; int nExit ;
|
||||
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
|
||||
if ( sOrigTcPos != sTcPos ||
|
||||
sOrigHead != sHead ||
|
||||
nOrigExit != nExit)
|
||||
bChanged = true ;
|
||||
m_TParams.m_sTcPos = sTcPos ;
|
||||
m_TParams.m_sHead = sHead ;
|
||||
m_TParams.m_nExit = nExit ;
|
||||
}
|
||||
else {
|
||||
if ( sOrigTcPos != pTdata->m_sTcPos ||
|
||||
sOrigHead != pTdata->m_sHead ||
|
||||
nOrigExit != pTdata->m_nExit)
|
||||
bChanged = true ;
|
||||
}
|
||||
// eventuali segnalazioni
|
||||
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
|
||||
string sInfo = "Warning in Sawing : tool name changed (" +
|
||||
@@ -1478,7 +1498,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
|
||||
ICurveComposite* pCompo = GetCurveComposite( m_pGeomDB->GetGeoObj( nCopyId)) ;
|
||||
|
||||
// unisco le parti allineate
|
||||
if ( ! pCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL))
|
||||
if ( ! pCompo->MergeCurves( 100 * EPS_SMALL, 100 * EPS_ANG_SMALL))
|
||||
return false ;
|
||||
|
||||
// eventuale inversione percorso
|
||||
@@ -1831,10 +1851,10 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
|
||||
// Eventuale variazioni di velocità all'inizio e alla fine del percorso
|
||||
FseVar FvVar ;
|
||||
if ( pCrvP == nullptr) {
|
||||
string sFsta = ExtractInfo( m_Params.m_sUserNotes, "Fsta:") ;
|
||||
string sFsta = ExtractInfo( m_Params.m_sUserNotes, "Fsta=") ;
|
||||
if ( ! sFsta.empty()) {
|
||||
string sLen, sPu ;
|
||||
SplitFirst( sFsta, "=", sLen, sPu) ;
|
||||
SplitFirst( sFsta, ",", sLen, sPu) ;
|
||||
FromString( sLen, FvVar.dLenStart) ;
|
||||
FvVar.dLenStart = max( FvVar.dLenStart, 0.) ;
|
||||
FromString( sPu, FvVar.dPuStart) ;
|
||||
@@ -1842,10 +1862,10 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
|
||||
}
|
||||
}
|
||||
if ( pCrvN == nullptr) {
|
||||
string sFend = ExtractInfo( m_Params.m_sUserNotes, "Fend:") ;
|
||||
string sFend = ExtractInfo( m_Params.m_sUserNotes, "Fend=") ;
|
||||
if ( ! sFend.empty()) {
|
||||
string sLen, sPu ;
|
||||
SplitFirst( sFend, "=", sLen, sPu) ;
|
||||
SplitFirst( sFend, ",", sLen, sPu) ;
|
||||
FromString( sLen, FvVar.dLenEnd) ;
|
||||
FvVar.dLenEnd = max( FvVar.dLenEnd, 0.) ;
|
||||
FromString( sPu, FvVar.dPuEnd) ;
|
||||
@@ -3812,29 +3832,40 @@ bool
|
||||
Sawing::CalculateToolAndCorrVersors( const Vector3d& vtTang, int nHeadSide, int nWorkSide, double dSideAng,
|
||||
Vector3d& vtTool, Vector3d& vtCorr)
|
||||
{
|
||||
// Versore fresa : annullo la componente in Z e normalizzo
|
||||
vtTool = vtTang ;
|
||||
vtTool.z = 0 ;
|
||||
if ( ! vtTool.Normalize())
|
||||
// Direzione tangente nel piano XY
|
||||
Vector3d vtXYTg = vtTang ;
|
||||
vtXYTg.z = 0 ;
|
||||
double dLenXYTg = vtXYTg.Len() ;
|
||||
if ( dLenXYTg < EPS_SMALL)
|
||||
return false ;
|
||||
// ruoto attorno a Zglob+ a seconda del lato mandrino
|
||||
vtXYTg /= dLenXYTg ;
|
||||
// se direzione tangente inclinata in Z e SideAng non nullo devo calcolare la vera tangente nel piano XY
|
||||
if ( abs( vtTang.z) > EPS_SMALL && abs( dSideAng) > EPS_ANG_SMALL) {
|
||||
double dSinDelta = vtTang.z * tan( dSideAng * DEGTORAD) / dLenXYTg ;
|
||||
double dCosDelta = sqrt( 1 - dSinDelta * dSinDelta) ;
|
||||
if ( nHeadSide == SAW_HS_LEFT)
|
||||
vtXYTg.Rotate( Z_AX, dCosDelta, dSinDelta) ;
|
||||
else
|
||||
vtXYTg.Rotate( Z_AX, dCosDelta, -dSinDelta) ;
|
||||
}
|
||||
|
||||
// Versore fresa : ruoto direzione nel piano XY attorno a Zglob+ a seconda del lato mandrino
|
||||
vtTool = vtXYTg ;
|
||||
if ( nHeadSide == SAW_HS_LEFT)
|
||||
vtTool.Rotate( Z_AX, 0, 1) ;
|
||||
else
|
||||
vtTool.Rotate( Z_AX, 0, -1) ;
|
||||
|
||||
// Versore correzione
|
||||
// Versore correzione : se lama sbandata devo aggiustare
|
||||
vtCorr = Z_AX ;
|
||||
|
||||
// Se lama sbandata
|
||||
if ( abs( dSideAng) > EPS_ANG_SMALL) {
|
||||
if ( nWorkSide == SAW_WS_RIGHT) {
|
||||
vtTool.Rotate( vtTang, - dSideAng) ;
|
||||
vtCorr.Rotate( vtTang, - dSideAng) ;
|
||||
vtTool.Rotate( vtXYTg, - dSideAng) ;
|
||||
vtCorr.Rotate( vtXYTg, - dSideAng) ;
|
||||
}
|
||||
else {
|
||||
vtTool.Rotate( vtTang, dSideAng) ;
|
||||
vtCorr.Rotate( vtTang, dSideAng) ;
|
||||
vtTool.Rotate( vtXYTg, dSideAng) ;
|
||||
vtCorr.Rotate( vtXYTg, dSideAng) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+47
-18
@@ -72,6 +72,7 @@ Simulator::Simulator( void)
|
||||
m_nAuxEInd = 0 ;
|
||||
m_nExit = 0 ;
|
||||
m_dTDiam = 0 ;
|
||||
m_bCutOnTip = false ;
|
||||
m_dSafeDist = SAFEDIST_STD ;
|
||||
m_nAxesMask = 0 ;
|
||||
m_bEnabAxes = true ;
|
||||
@@ -134,6 +135,7 @@ Simulator::Start( bool bFirst)
|
||||
m_sHead.clear() ;
|
||||
m_nExit = 0 ;
|
||||
m_dTDiam = 0 ;
|
||||
m_bCutOnTip = false ;
|
||||
ResetInterpolation() ;
|
||||
ResetAxes() ;
|
||||
ResetAuxAxes() ;
|
||||
@@ -470,6 +472,9 @@ Simulator::UpdateTool( bool bFirst, int& nErr)
|
||||
m_sHead = sHead ;
|
||||
m_nExit = nExit ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, m_dTDiam) ;
|
||||
double dTipFeed = 0 ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_TIPFEED, dTipFeed) ;
|
||||
m_bCutOnTip = ( dTipFeed > EPS_MACH_LEN_PAR) ;
|
||||
// ripristino la lavorazione corrente
|
||||
m_pMchMgr->SetCurrMachining( nCurrMchId) ;
|
||||
// aggiorno gli assi macchina
|
||||
@@ -509,6 +514,9 @@ Simulator::UpdateTool( bool bFirst, int& nErr)
|
||||
m_sHead = sHead ;
|
||||
m_nExit = nExit ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, m_dTDiam) ;
|
||||
double dTipFeed = 0 ;
|
||||
m_pMchMgr->TdbGetCurrToolParam( TPA_TIPFEED, dTipFeed) ;
|
||||
m_bCutOnTip = ( dTipFeed > EPS_MACH_LEN_PAR) ;
|
||||
// aggiorno gli assi macchina
|
||||
if ( ! UpdateAxes())
|
||||
return false ;
|
||||
@@ -679,11 +687,13 @@ Simulator::FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus)
|
||||
}
|
||||
// cambio fase
|
||||
m_pMchMgr->SetCurrPhase( nPhase, ( nPhase == 1)) ;
|
||||
// aggiorno utensile e assi conseguenti
|
||||
int nErr ;
|
||||
if ( ! UpdateTool( bFirst, nErr)) {
|
||||
nStatus = CalcStatusOnError( nErr) ;
|
||||
return false ;
|
||||
// se previsto, aggiorno utensile e assi conseguenti
|
||||
if ( pDisp->IsWithTool()) {
|
||||
int nErr ;
|
||||
if ( ! UpdateTool( bFirst, nErr)) {
|
||||
nStatus = CalcStatusOnError( nErr) ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
++ m_nOpInd ;
|
||||
// richiamo gestione evento inizio disposizione
|
||||
@@ -1038,21 +1048,28 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
|
||||
}
|
||||
m_pMachine->SetAxisPos( m_AuxAxesName[j], dVal) ;
|
||||
}
|
||||
// eseguo eventuale collision check
|
||||
bCollCheck = bCollCheck && ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ;
|
||||
}
|
||||
// se non è rapido o non c'è verifica collisioni, eseguo eventuale Vmill
|
||||
if ( nMoveType != 0 || ! NeedCollisionCheck()) {
|
||||
for ( int i = 0 ; i < int( m_VmTool.size()) ; ++ i) {
|
||||
Point3d ptNoseF ; Vector3d vtDirF ; Vector3d vtAuxF ;
|
||||
bool bOkF = GetHeadCurrPosDirAux( m_VmTool[i].sHead, m_VmTool[i].nExit, ptNoseF, vtDirF, vtAuxF) ;
|
||||
for ( int j = 0 ; j < int( m_VmId.size()) ; ++ j) {
|
||||
Frame3d frVzmF ;
|
||||
bOkF = m_pGeomDB->GetGlobFrame( m_VmId[j], frVzmF) && bOkF ;
|
||||
ExecLineVmill( m_VmId[j], i, m_VmTool[i].dTdOffs, m_VmTool[i].dAdOffs,
|
||||
vPtNoseI[i], vVtDirI[i], vVtAuxI[i], vFrVzmI[j], ptNoseF, vtDirF, vtAuxF, frVzmF) ;
|
||||
// se non è rapido o non c'è verifica collisioni, eseguo eventuale Vmill
|
||||
if ( nMoveType != 0 || ! NeedCollisionCheck()) {
|
||||
for ( int j = 0 ; j < int( m_VmTool.size()) ; ++ j) {
|
||||
Point3d ptNoseF ; Vector3d vtDirF ; Vector3d vtAuxF ;
|
||||
bool bOkF = GetHeadCurrPosDirAux( m_VmTool[j].sHead, m_VmTool[j].nExit, ptNoseF, vtDirF, vtAuxF) ;
|
||||
for ( int k = 0 ; k < int( m_VmId.size()) ; ++ k) {
|
||||
Frame3d frVzmF ;
|
||||
bOkF = m_pGeomDB->GetGlobFrame( m_VmId[k], frVzmF) && bOkF ;
|
||||
ExecLineVmill( m_VmId[k], j, m_VmTool[j].dTdOffs, m_VmTool[j].dAdOffs,
|
||||
vPtNoseI[j], vVtDirI[j], vVtAuxI[j], vFrVzmI[k], ptNoseF, vtDirF, vtAuxF, frVzmF) ;
|
||||
// se ultimo utensile, salvo riferimento per prossimo inizio
|
||||
if ( j == int( m_VmTool.size()) - 1)
|
||||
vFrVzmI[k] = frVzmF ;
|
||||
}
|
||||
// aggiorno prossimo inizio
|
||||
vPtNoseI[j] = ptNoseF ;
|
||||
vVtDirI[j] = vtDirF ;
|
||||
vVtAuxI[j] = vtAuxF ;
|
||||
}
|
||||
}
|
||||
// eseguo eventuale collision check
|
||||
bCollCheck = bCollCheck && ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ;
|
||||
}
|
||||
}
|
||||
// Eseguo movimento su arco
|
||||
@@ -1284,6 +1301,18 @@ Simulator::ExecLineVmill( int nVmId, int nCurrTool, double dVmTdOffs, double dVm
|
||||
") Pf=(" + ToString( ptHfL) + ") Vf=(" + ToString( vtHfL) + ") Af=(" + ToString( vtAfL) + ")" ;
|
||||
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str())
|
||||
}
|
||||
// Se utensile che non lavora di testa
|
||||
if ( ! m_bCutOnTip) {
|
||||
// se movimento di testa (angolo movimento verso la testa oltre 5.8deg), non eseguo asportazione
|
||||
Vector3d vtDirM = Media( vtHiL, vtHfL) ;
|
||||
vtDirM.Normalize() ;
|
||||
double dAxMove = ( ptHfL - ptHiL) * vtDirM ;
|
||||
if ( dAxMove < -EPS_SMALL) {
|
||||
double dMove = ( ptHfL - ptHiL).Len() ;
|
||||
if ( dAxMove < -0.1 * abs( dMove))
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
// Eseguo
|
||||
return pVZM->MillingStep( nCurrTool, ptHiL, vtHiL, vtAiL, ptHfL, vtHfL, vtAfL) ;
|
||||
}
|
||||
|
||||
@@ -158,6 +158,7 @@ class Simulator
|
||||
std::string m_sHead ; // nome della testa corrente
|
||||
int m_nExit ; // indice dell'uscita corrente
|
||||
double m_dTDiam ; // diametro dell'utensile corrente
|
||||
bool m_bCutOnTip ; // flag capacità di lavorare di testa dell'utensile corrente
|
||||
INTVECTOR m_VmId ; // vettore identificativi Zmap per Virtual Milling
|
||||
INTVECTOR m_CdId ; // vettore identificativi Zmap per Collision Detection
|
||||
VMTVECTOR m_VmTool ; // vettore utensili attivi per virtual milling
|
||||
|
||||
+29
-8
@@ -800,11 +800,31 @@ SurfFinishing::UpdateToolData( bool* pbChanged)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
// verifico se sono diversi (ad esclusione del nome)
|
||||
m_TParams.m_sName = pTdata->m_sName ;
|
||||
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
int nOrigExit = m_TParams.m_nExit ;
|
||||
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
|
||||
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
|
||||
// aggiorno comunque i parametri
|
||||
m_TParams = *pTdata ;
|
||||
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
|
||||
string sTcPos ; string sHead ; int nExit ;
|
||||
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
|
||||
if ( sOrigTcPos != sTcPos ||
|
||||
sOrigHead != sHead ||
|
||||
nOrigExit != nExit)
|
||||
bChanged = true ;
|
||||
m_TParams.m_sTcPos = sTcPos ;
|
||||
m_TParams.m_sHead = sHead ;
|
||||
m_TParams.m_nExit = nExit ;
|
||||
}
|
||||
else {
|
||||
if ( sOrigTcPos != pTdata->m_sTcPos ||
|
||||
sOrigHead != pTdata->m_sHead ||
|
||||
nOrigExit != pTdata->m_nExit)
|
||||
bChanged = true ;
|
||||
}
|
||||
// eventuali segnalazioni
|
||||
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
|
||||
string sInfo = "Warning in SurfFinishing : tool name changed (" +
|
||||
@@ -1359,7 +1379,7 @@ SurfFinishing::AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
|
||||
if ( IsNull( pCompo) || ! pCompo->FromPolyLine( PL))
|
||||
return false ;
|
||||
// sostituisco la vecchia curva con la nuova
|
||||
vpCrvs[k].Set( Release( pCompo )) ;
|
||||
vpCrvs[k].Set( pCompo) ;
|
||||
}
|
||||
// ciclo sulle curve elementari
|
||||
int nMaxInd = vpCrvs[k]->GetCurveCount() - 1 ;
|
||||
@@ -1720,7 +1740,7 @@ SurfFinishing::AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
|
||||
if ( IsNull( pCompo) || ! pCompo->FromPolyLine( PL))
|
||||
return false ;
|
||||
// sostituisco la vecchia curva con la nuova
|
||||
pMCrv.Set( Release( pCompo )) ;
|
||||
pMCrv.Set( pCompo) ;
|
||||
}
|
||||
// ciclo sulle curve elementari
|
||||
int nMaxInd = pMCrv->GetCurveCount() - 1 ;
|
||||
@@ -1883,7 +1903,7 @@ SurfFinishing::CalcSpiral( const ICurveComposite* pCompo, bool bSplitArcs,
|
||||
if ( bNextOk) {
|
||||
// sistemo per prossimo step
|
||||
dCurrRad = dRad ;
|
||||
pOffs.Set( Release( pNextOffs)) ;
|
||||
pOffs.Set( pNextOffs) ;
|
||||
pCurr = Get( pOffs) ;
|
||||
// nuovo valore pari allo step
|
||||
dOffs = GetSideStep() ;
|
||||
@@ -2083,6 +2103,7 @@ SurfFinishing::GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) con
|
||||
double
|
||||
SurfFinishing::GetRadiusForStartEndElevation( void) const
|
||||
{
|
||||
const double DELTA_ELEV_RAD = 20.0 ;
|
||||
return ( 0.5 * m_TParams.m_dTDiam + DELTA_ELEV_RAD) ;
|
||||
const double DELTA_ELEV_RAD = 4.0 ;
|
||||
double dDeltaRad = min( DELTA_ELEV_RAD, 0.5 * m_TParams.m_dTDiam) ;
|
||||
return ( 0.5 * m_TParams.m_dTDiam + dDeltaRad) ;
|
||||
}
|
||||
|
||||
+5
-5
@@ -72,7 +72,7 @@ struct ToolData
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline bool
|
||||
SameTool( const ToolData& Td1, const ToolData& Td2)
|
||||
SameTool( const ToolData& Td1, const ToolData& Td2, bool bAlsoNameTcPosHeadExit = true)
|
||||
{
|
||||
const double EPS_TOOL_LEN = 10 * EPS_SMALL ;
|
||||
const double EPS_TOOL_ANG = 10 * EPS_ANG_SMALL ;
|
||||
@@ -80,11 +80,11 @@ SameTool( const ToolData& Td1, const ToolData& Td2)
|
||||
const double EPS_FEED = 0.5 ;
|
||||
const double EPS_ABSORP = 0.5 ;
|
||||
return ( Td1.m_Uuid == Td2.m_Uuid &&
|
||||
Td1.m_sName == Td2.m_sName &&
|
||||
( Td1.m_sName == Td2.m_sName || ! bAlsoNameTcPosHeadExit) &&
|
||||
Td1.m_sDraw == Td2.m_sDraw &&
|
||||
Td1.m_sTcPos == Td2.m_sTcPos &&
|
||||
Td1.m_sHead == Td2.m_sHead &&
|
||||
Td1.m_nExit == Td2.m_nExit &&
|
||||
( Td1.m_sTcPos == Td2.m_sTcPos || ! bAlsoNameTcPosHeadExit) &&
|
||||
( Td1.m_sHead == Td2.m_sHead || ! bAlsoNameTcPosHeadExit) &&
|
||||
( Td1.m_nExit == Td2.m_nExit || ! bAlsoNameTcPosHeadExit) &&
|
||||
Td1.m_nCorr == Td2.m_nCorr &&
|
||||
Td1.m_nType == Td2.m_nType &&
|
||||
abs( Td1.m_dMaxSpeed - Td2.m_dMaxSpeed) < EPS_SPEED &&
|
||||
|
||||
+8
-4
@@ -694,12 +694,16 @@ ToolsMgr::GetCurrToolMaxDepth( double dSafe, double& dMaxDepth) const
|
||||
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ;
|
||||
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam) ;
|
||||
}
|
||||
// calcolo il massimo affondamento
|
||||
// calcolo il massimo affondamento per le limitazioni dal portautensili
|
||||
dMaxDepth = m_tdCurrTool.m_dLen - dSafe ;
|
||||
if ( m_tdCurrTool.m_dDiam > dTHoldDiam)
|
||||
dMaxDepth -= dTHoldBase ;
|
||||
else
|
||||
if ( dTHoldDiam > m_tdCurrTool.m_dDiam + EPS_SMALL)
|
||||
dMaxDepth -= dTHoldLen ;
|
||||
else
|
||||
dMaxDepth -= dTHoldBase ;
|
||||
// recupero l'eventuale diametro gambo utensile (definito se non nullo)
|
||||
double dStemDiam ; m_tdCurrTool.GetParam( TPA_STEMDIAM, dStemDiam) ;
|
||||
if ( dStemDiam > m_tdCurrTool.m_dDiam + EPS_SMALL)
|
||||
dMaxDepth = min( dMaxDepth, m_tdCurrTool.m_dMaxMat) ;
|
||||
return true ;
|
||||
}
|
||||
// se mortasatrice o sega a catena
|
||||
|
||||
+25
-5
@@ -964,11 +964,31 @@ WaterJetting::UpdateToolData( bool* pbChanged)
|
||||
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
|
||||
if ( pTdata == nullptr)
|
||||
return false ;
|
||||
// verifico se sono diversi (ad esclusione del nome)
|
||||
m_TParams.m_sName = pTdata->m_sName ;
|
||||
bool bChanged = ! SameTool( m_TParams, *pTdata) ;
|
||||
// salvo posizione TC, testa e uscita originali
|
||||
string sOrigTcPos = m_TParams.m_sTcPos ;
|
||||
string sOrigHead = m_TParams.m_sHead ;
|
||||
int nOrigExit = m_TParams.m_nExit ;
|
||||
// verifico se sono diversi (ad esclusione di nome, posizione TC, testa e uscita)
|
||||
bool bChanged = ( ! SameTool( m_TParams, *pTdata, false)) ;
|
||||
// aggiorno comunque i parametri
|
||||
m_TParams = *pTdata ;
|
||||
// se definito attrezzaggio, aggiorno i parametri che ne possono derivare
|
||||
string sTcPos ; string sHead ; int nExit ;
|
||||
if ( m_pMchMgr->GetCurrSetupMgr().GetToolData( m_TParams.m_sName, sTcPos, sHead, nExit)) {
|
||||
if ( sOrigTcPos != sTcPos ||
|
||||
sOrigHead != sHead ||
|
||||
nOrigExit != nExit)
|
||||
bChanged = true ;
|
||||
m_TParams.m_sTcPos = sTcPos ;
|
||||
m_TParams.m_sHead = sHead ;
|
||||
m_TParams.m_nExit = nExit ;
|
||||
}
|
||||
else {
|
||||
if ( sOrigTcPos != pTdata->m_sTcPos ||
|
||||
sOrigHead != pTdata->m_sHead ||
|
||||
nOrigExit != pTdata->m_nExit)
|
||||
bChanged = true ;
|
||||
}
|
||||
// eventuali segnalazioni
|
||||
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
|
||||
string sInfo = "Warning in WaterJetting : tool name changed (" +
|
||||
@@ -1941,7 +1961,7 @@ WaterJetting::AddLeadInPreview( const ICurveComposite* pCompo, ISurfFlatRegion*
|
||||
{ PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
|
||||
if ( IsNull( pLine) || ! pLine->Set( ptP1, ptStart))
|
||||
return false ;
|
||||
pCrv.Set( Release( pLine)) ;
|
||||
pCrv.Set( pLine) ;
|
||||
} break ;
|
||||
case WJET_LI_TANGENT :
|
||||
pCrv.Set( GetArc2PVN( ptStart, ptP1, - vtStart, vtN)) ;
|
||||
@@ -2010,7 +2030,7 @@ WaterJetting::AddLeadOutPreview( const ICurveComposite* pCompo, ISurfFlatRegion*
|
||||
Point3d ptP1 = ptEnd + vtEnd * dTang + vtPerp * dPerp ;
|
||||
if ( IsNull( pLine) || ! pLine->Set( ptEnd, ptP1))
|
||||
return false ;
|
||||
pCrv.Set( Release( pLine)) ;
|
||||
pCrv.Set( pLine) ;
|
||||
} break ;
|
||||
case WJET_LO_TANGENT :
|
||||
{ // calcolo punto finale dell'uscita
|
||||
|
||||
Reference in New Issue
Block a user