Compare commits

..

1 Commits

Author SHA1 Message Date
DarioS d86f1cf47f EgtMachKernel 2.5a3 :
- pulizia codice.
2023-01-23 16:52:25 +01:00
60 changed files with 4461 additions and 11407 deletions
+13 -16
View File
@@ -17,11 +17,9 @@
#include "Axis.h" #include "Axis.h"
#include "MachConst.h" #include "MachConst.h"
#include "/EgtDev/Include/EGkGdbConst.h" #include "/EgtDev/Include/EGkGdbConst.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGkUserObjFactory.h" #include "/EgtDev/Include/EGkUserObjFactory.h"
#include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkUiUnits.h" #include "/EgtDev/Include/EGkUiUnits.h"
#include "/EgtDev/Include/EgtNumUtils.h"
using namespace std ; using namespace std ;
@@ -139,8 +137,9 @@ Axis::Set( const string& sName, const string& sToken, bool bInvert, double dOffs
bool bool
Axis::Modify( const Point3d& ptPos, double dAxisMaxAdjust) Axis::Modify( const Point3d& ptPos, double dAxisMaxAdjust)
{ {
// Verifico che lo spostamento perpendicolare alla sua direzione non superi il massimo ammesso // Verifico che lo spostamento non superi il massimo ammesso
Vector3d vtDeltaPerp = OrthoCompo( ptPos - m_ptPos, m_vtDir) ; Vector3d vtDelta = ptPos - m_ptPos ;
Vector3d vtDeltaPerp = vtDelta - ( vtDelta * m_vtDir) * m_vtDir ;
if ( vtDeltaPerp.Len() > dAxisMaxAdjust) { if ( vtDeltaPerp.Len() > dAxisMaxAdjust) {
string sOut = " Modify Axis " + m_sName + " Position (" + ToString( ptPos) + ") failed" ; string sOut = " Modify Axis " + m_sName + " Position (" + ToString( ptPos) + ") failed" ;
LOG_ERROR( GetEMkLogger(), sOut.c_str()) ; LOG_ERROR( GetEMkLogger(), sOut.c_str()) ;
@@ -148,11 +147,6 @@ Axis::Modify( const Point3d& ptPos, double dAxisMaxAdjust)
} }
// Assegno la nuova posizione // Assegno la nuova posizione
m_ptPos = ptPos ; m_ptPos = ptPos ;
// Sistemo la geometria dell'asse
int nV = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, m_sName) ;
IGeoVector3d* pGV = GetGeoVector3d( m_pGeomDB->GetGeoObj( nV)) ;
if ( pGV != nullptr)
pGV->ChangeBase( m_ptPos) ;
return true ; return true ;
} }
@@ -170,11 +164,6 @@ Axis::Modify( const Vector3d& vtDir, double dAxisMaxRotAdj)
} }
// Assegno la nuova direzione // Assegno la nuova direzione
m_vtDir = vtDirN ; m_vtDir = vtDirN ;
// Sistemo la geometria dell'asse
int nV = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, m_sName) ;
IGeoVector3d* pGV = GetGeoVector3d( m_pGeomDB->GetGeoObj( nV)) ;
if ( pGV != nullptr)
pGV->ChangeVector( m_vtDir) ;
return true ; return true ;
} }
@@ -183,7 +172,10 @@ bool
Axis::Modify( const STROKE& Stroke) Axis::Modify( const STROKE& Stroke)
{ {
m_Stroke = Stroke ; m_Stroke = Stroke ;
m_dHomeVal = Clamp( m_dHomeVal, m_Stroke.Min, m_Stroke.Max) ; if ( m_dHomeVal < m_Stroke.Min)
m_dHomeVal = m_Stroke.Min ;
else if ( m_dHomeVal > m_Stroke.Max)
m_dHomeVal = m_Stroke.Max ;
return true ; return true ;
} }
@@ -191,7 +183,12 @@ Axis::Modify( const STROKE& Stroke)
bool bool
Axis::Modify( double dHome) Axis::Modify( double dHome)
{ {
m_dHomeVal = Clamp( dHome, m_Stroke.Min, m_Stroke.Max) ; if ( dHome < m_Stroke.Min)
m_dHomeVal = m_Stroke.Min ;
else if ( dHome > m_Stroke.Max)
m_dHomeVal = m_Stroke.Max ;
else
m_dHomeVal = dHome ;
return true ; return true ;
} }
+8 -29
View File
@@ -1,14 +1,13 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2015-2023 // EgalTech 2015-2016
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : CamData.cpp Data : 22.11.23 Versione : 2.5k3 // File : CamData.cpp Data : 24.02.16 Versione : 1.6n8
// Contenuto : Implementazione informazioni Cam di ogni movimento. // Contenuto : Implementazione informazioni Cam di ogni movimento.
// //
// //
// //
// Modifiche : 10.06.15 DS Creazione modulo. // Modifiche : 10.06.15 DS Creazione modulo.
// 24.02.16 DS Versione 2 (aggiunti m_nMove e m_ptCen). // 24.02.16 DS Versione 2 (aggiunti m_nMove e m_ptCen).
// 22.11.23 DS Aggiunto flag ToolShow (forza in ogni caso la visualizzazione della direzione utensile).
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -54,9 +53,7 @@ static int CAM_PARAM_V7 = 22 ;
static string CAM_ORIGFEED = "OrFeed" ; static string CAM_ORIGFEED = "OrFeed" ;
static int CAM_PARAM_V8 = 23 ; static int CAM_PARAM_V8 = 23 ;
static string CAM_FLAG2 = "Flg2" ; static string CAM_FLAG2 = "Flg2" ;
static int CAM_PARAM_V9 = 24 ; static int CAM_TOTPARAM =CAM_PARAM_V8 ;
static string CAM_TOOLSHOW = "TSh" ;
static int CAM_TOTPARAM = CAM_PARAM_V9 ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -82,7 +79,6 @@ CamData::Clone( void) const
pCam->m_pGeomDB = nullptr ; pCam->m_pGeomDB = nullptr ;
pCam->m_nMove = m_nMove ; pCam->m_nMove = m_nMove ;
pCam->m_nCorre = m_nCorre ; pCam->m_nCorre = m_nCorre ;
pCam->m_bToolShow = m_bToolShow ;
pCam->m_vtTool = m_vtTool ; pCam->m_vtTool = m_vtTool ;
pCam->m_vtCorr = m_vtCorr ; pCam->m_vtCorr = m_vtCorr ;
pCam->m_vtAux = m_vtAux ; pCam->m_vtAux = m_vtAux ;
@@ -143,7 +139,6 @@ CamData::Dump( string& sOut, bool bMM, const char* szNewLine) const
sOut += CAM_AXND + "=" + ToString( m_vtMachN) + szNewLine ; sOut += CAM_AXND + "=" + ToString( m_vtMachN) + szNewLine ;
sOut += CAM_NDLT + "=" + ToString( m_dDeltaN) + szNewLine ; sOut += CAM_NDLT + "=" + ToString( m_dDeltaN) + szNewLine ;
sOut += CAM_BDIR + "=" + ToString( m_vtBackAux) + szNewLine ; sOut += CAM_BDIR + "=" + ToString( m_vtBackAux) + szNewLine ;
sOut += CAM_TOOLSHOW + "=" + ToString( m_bToolShow) + szNewLine ;
return true ; return true ;
} }
@@ -154,8 +149,6 @@ CamData::SetOwner( int nId, IGeomDB* pGDB)
{ {
m_nOwnerId = nId ; m_nOwnerId = nId ;
m_pGeomDB = pGDB ; m_pGeomDB = pGDB ;
if ( m_pGeomDB != nullptr)
m_pGeomDB->SetStipple( m_nOwnerId, ( m_nMove == 0 ? 3 : 0), 0x8C8C) ;
return ( m_nOwnerId != GDB_ID_NULL && m_pGeomDB != nullptr) ; return ( m_nOwnerId != GDB_ID_NULL && m_pGeomDB != nullptr) ;
} }
@@ -210,8 +203,6 @@ CamData::Save( int nBaseId, STRVECTOR& vString) const
vString[++k] = CAM_ORIGFEED + "=" + ToString( m_dOrigFeed) ; vString[++k] = CAM_ORIGFEED + "=" + ToString( m_dOrigFeed) ;
// parametri aggiunti V8 // parametri aggiunti V8
vString[++k] = CAM_FLAG2 + "=" + ToString( m_nFlag2) ; vString[++k] = CAM_FLAG2 + "=" + ToString( m_nFlag2) ;
// parametri aggiunti V9
vString[++k] = CAM_TOOLSHOW + "=" + ToString( m_bToolShow) ;
} }
catch( ...) { catch( ...) {
return false ; return false ;
@@ -304,14 +295,6 @@ CamData::Load( const STRVECTOR& vString, int nBaseGdbId)
else { else {
m_nFlag2 = 0 ; m_nFlag2 = 0 ;
} }
// parametri aggiunti V9
if ( int( vString.size()) >= CAM_PARAM_V9) {
if ( ! GetVal( vString[++k], CAM_TOOLSHOW, m_bToolShow))
return false ;
}
else {
m_bToolShow = false ;
}
return true ; return true ;
} }
@@ -328,7 +311,7 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
PolyLine& PL = lstPL.back() ; PolyLine& PL = lstPL.back() ;
// dimensioni // dimensioni
const double TLEN = 40 ; const double TLEN = 40 ;
const double ALEN = 1 ; const double ALEN = 4 ;
// inserisco disegno nella polilinea // inserisco disegno nella polilinea
PL.AddUPoint( 0, m_ptEnd) ; PL.AddUPoint( 0, m_ptEnd) ;
Point3d ptTip = m_ptEnd + m_vtTool * TLEN ; Point3d ptTip = m_ptEnd + m_vtTool * TLEN ;
@@ -350,9 +333,6 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
ptP6.ToGlob( frF) ; ptP6.ToGlob( frF) ;
PL.AddUPoint( 6, ptP6) ; PL.AddUPoint( 6, ptP6) ;
PL.AddUPoint( 6, ptTip) ; PL.AddUPoint( 6, ptTip) ;
// da visualizzare sempre se richiesto
if ( m_bToolShow)
PL.SetTempProp( 1) ;
} }
// se vettore correzione non nullo // se vettore correzione non nullo
if ( ! m_vtCorr.IsSmall()) { if ( ! m_vtCorr.IsSmall()) {
@@ -362,14 +342,14 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
PolyLine& PL = lstPL.back() ; PolyLine& PL = lstPL.back() ;
// dimensioni // dimensioni
const double CLEN = 20 ; const double CLEN = 20 ;
const double ALEN = 1 ; const double ALEN = 2 ;
// inserisco disegno nella polilinea // inserisco disegno nella polilinea
PL.AddUPoint( 0, m_ptEnd) ; PL.AddUPoint( 0, m_ptEnd) ;
Point3d ptTip = m_ptEnd + m_vtCorr * CLEN ; Point3d ptTip = m_ptEnd + m_vtCorr * CLEN ;
PL.AddUPoint( 1, ptTip) ; PL.AddUPoint( 1, ptTip) ;
// aggiungo simil-freccia // aggiungo simil-freccia
Frame3d frF ; Frame3d frF ;
if ( m_vtTool. IsSmall() || AreSameOrOppositeVectorApprox( m_vtTool, m_vtCorr)) if ( m_vtTool. IsSmall())
frF.Set( ptTip, m_vtCorr) ; frF.Set( ptTip, m_vtCorr) ;
else else
frF.Set( ptTip, m_vtCorr, m_vtTool) ; frF.Set( ptTip, m_vtCorr, m_vtTool) ;
@@ -391,14 +371,14 @@ CamData::GetDrawPolyLines( POLYLINELIST& lstPL) const
PolyLine& PL = lstPL.back() ; PolyLine& PL = lstPL.back() ;
// dimensioni // dimensioni
const double CLEN = 20 ; const double CLEN = 20 ;
const double ALEN = 1 ; const double ALEN = 2 ;
// inserisco disegno nella polilinea // inserisco disegno nella polilinea
PL.AddUPoint( 0, m_ptEnd) ; PL.AddUPoint( 0, m_ptEnd) ;
Point3d ptTip = m_ptEnd + m_vtAux * CLEN ; Point3d ptTip = m_ptEnd + m_vtAux * CLEN ;
PL.AddUPoint( 1, ptTip) ; PL.AddUPoint( 1, ptTip) ;
// aggiungo simil-freccia // aggiungo simil-freccia
Frame3d frF ; Frame3d frF ;
if ( m_vtTool. IsSmall() || AreSameOrOppositeVectorApprox( m_vtTool, m_vtAux)) if ( m_vtTool. IsSmall())
frF.Set( ptTip, m_vtAux) ; frF.Set( ptTip, m_vtAux) ;
else else
frF.Set( ptTip, m_vtAux, m_vtTool) ; frF.Set( ptTip, m_vtAux, m_vtTool) ;
@@ -566,7 +546,6 @@ CamData::CamData( void)
m_pGeomDB = nullptr ; m_pGeomDB = nullptr ;
m_nMove = 0 ; m_nMove = 0 ;
m_nCorre = 0 ; m_nCorre = 0 ;
m_bToolShow = false ;
m_dAngCen = 0 ; m_dAngCen = 0 ;
m_dDeltaN = 0 ; m_dDeltaN = 0 ;
m_dFeed = 0 ; m_dFeed = 0 ;
+5 -10
View File
@@ -68,13 +68,11 @@ class CamData : public IUserObj
bool SetAxesAngCen( double dAngCen) ; bool SetAxesAngCen( double dAngCen) ;
bool SetAxesNormDir( const Vector3d& vtDir) ; bool SetAxesNormDir( const Vector3d& vtDir) ;
bool SetBackAuxDir( const Vector3d& vtDir) ; bool SetBackAuxDir( const Vector3d& vtDir) ;
bool SetToolShow( bool bShow) const int GetMoveType( void) const
{ m_bToolShow = bShow ; return true ; }
int GetMoveType( void) const
{ return m_nMove ; } { return m_nMove ; }
bool IsLine( void) const const bool IsLine( void) const
{ return ( m_nMove == 0 || m_nMove == 1) ; } { return ( m_nMove == 0 || m_nMove == 1) ; }
bool IsArc( void) const const bool IsArc( void) const
{ return ( m_nMove == 2 || m_nMove == 3) ; } { return ( m_nMove == 2 || m_nMove == 3) ; }
const Vector3d& GetToolDir( void) const const Vector3d& GetToolDir( void) const
{ return m_vtTool ; } { return m_vtTool ; }
@@ -110,16 +108,14 @@ class CamData : public IUserObj
{ return m_vMachAxes ; } { return m_vMachAxes ; }
const Point3d& GetAxesCen( void) const const Point3d& GetAxesCen( void) const
{ return m_ptMachCen ; } { return m_ptMachCen ; }
double GetAxesRad( void) const const double GetAxesRad( void) const
{ return m_dMachRad ; } { return m_dMachRad ; }
double GetAxesAngCen( void) const const double GetAxesAngCen( void) const
{ return m_dMachAngCen ; } { return m_dMachAngCen ; }
const Vector3d& GetAxesNormDir( void) const const Vector3d& GetAxesNormDir( void) const
{ return m_vtMachN ; } { return m_vtMachN ; }
const Vector3d& GetBackAuxDir( void) const const Vector3d& GetBackAuxDir( void) const
{ return m_vtBackAux ; } { return m_vtBackAux ; }
bool GetToolShow( void) const
{ return m_bToolShow ; }
public : public :
enum { AS_NONE = 0, enum { AS_NONE = 0,
@@ -143,7 +139,6 @@ class CamData : public IUserObj
IGeomDB* m_pGeomDB ; IGeomDB* m_pGeomDB ;
int m_nMove ; // tipo movimento (0=rapido, 1=lineare, 2=arco CW, 3=arco CCW) int m_nMove ; // tipo movimento (0=rapido, 1=lineare, 2=arco CW, 3=arco CCW)
int m_nCorre ; // tipo correzione (0, 41, 42, 141, 142, 40) int m_nCorre ; // tipo correzione (0, 41, 42, 141, 142, 40)
bool m_bToolShow ; // flag per forzare la visualizzazione della direzione utensile in ogni caso
Vector3d m_vtTool ; // versore fresa Vector3d m_vtTool ; // versore fresa
Vector3d m_vtCorr ; // versore correzione Vector3d m_vtCorr ; // versore correzione
Vector3d m_vtAux ; // versore ausiliario Vector3d m_vtAux ; // versore ausiliario
+5 -28
View File
@@ -595,9 +595,6 @@ Chiseling::Update( bool bPostApply)
return true ; return true ;
} }
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione // imposto eventuale asse bloccato da lavorazione
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
@@ -771,31 +768,11 @@ Chiseling::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ; const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr) if ( pTdata == nullptr)
return false ; return false ;
// salvo posizione TC, testa e uscita originali // verifico se sono diversi (ad esclusione del nome)
string sOrigTcPos = m_TParams.m_sTcPos ; m_TParams.m_sName = pTdata->m_sName ;
string sOrigHead = m_TParams.m_sHead ; bool bChanged = ! SameTool( m_TParams, *pTdata) ;
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 // aggiorno comunque i parametri
m_TParams = *pTdata ; 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 // eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) { if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in Chiseling : tool name changed (" + string sInfo = "Warning in Chiseling : tool name changed (" +
@@ -1036,8 +1013,8 @@ Chiseling::GetCurves( SelData Id, ICURVEPLIST& lstPC)
for ( int nC = nCstart ; nC < nCend ; ++ nC) { for ( int nC = nCstart ; nC < nCend ; ++ nC) {
// recupero i contorni del chunk // recupero i contorni del chunk
for ( int nL = 0 ; nL < pReg->GetLoopCount( nC) ; ++ nL) { for ( int nL = 0 ; nL < pReg->GetLoopCount( nC) ; ++ nL) {
PtrOwner<ICurveComposite> pCrvCompo ; PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
if ( ! pCrvCompo.Set( ConvertCurveToComposite( pReg->GetLoop( nC, nL)))) if ( IsNull( pCrvCompo) || ! pCrvCompo->AddCurve( pReg->GetLoop( nC, nL)))
return false ; return false ;
// assegno l'estrusione dalla normale alla regione // assegno l'estrusione dalla normale alla regione
pCrvCompo->SetExtrusion( vtN) ; pCrvCompo->SetExtrusion( vtN) ;
+2 -6
View File
@@ -71,10 +71,6 @@ struct ChiselingData : public MachiningData
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline const ChiselingData* GetChiselingData( const MachiningData* pMdata) inline const ChiselingData* GetChiselingData( const MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_CHISELING) { return (dynamic_cast<const ChiselingData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<const ChiselingData*>( pMdata)) ; }
inline ChiselingData* GetChiselingData( MachiningData* pMdata) inline ChiselingData* GetChiselingData( MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_CHISELING) { return (dynamic_cast<ChiselingData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<ChiselingData*>( pMdata)) ; }
+3 -23
View File
@@ -86,8 +86,6 @@ Disposition::Clone( void) const
// eseguo copia dei dati // eseguo copia dei dati
if ( pDisp != nullptr) { if ( pDisp != nullptr) {
try { pDisp->m_sTabName = m_sTabName ; try { pDisp->m_sTabName = m_sTabName ;
pDisp->m_pMchMgr = m_pMchMgr ;
pDisp->m_nPhase = m_nPhase ;
pDisp->m_ptRef1 = m_ptRef1 ; pDisp->m_ptRef1 = m_ptRef1 ;
pDisp->m_b3Area1 = m_b3Area1 ; pDisp->m_b3Area1 = m_b3Area1 ;
pDisp->m_dAreaOffset = m_dAreaOffset ; pDisp->m_dAreaOffset = m_dAreaOffset ;
@@ -1207,23 +1205,6 @@ Disposition::InsertMoveInfoInList( int nRawId, int nType, const Point3d& ptP, in
return true ; return true ;
} }
//----------------------------------------------------------------------------
bool
Disposition::UpdateRawPartId( int nRawId, int nNewRawId)
{
// aggiorno i movimenti registrati per questo grezzo
while ( true) {
auto iIter = find_if( m_vMvrData.begin(), m_vMvrData.end(),
[ nRawId]( const MoveRawData& Mrv)
{ return ( Mrv.nRawId == nRawId) ; }) ;
if ( iIter == m_vMvrData.end())
break ;
else
iIter->nRawId = nNewRawId ;
}
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Disposition::RemoveRawPart( int nRawId) Disposition::RemoveRawPart( int nRawId)
@@ -1372,8 +1353,7 @@ Disposition::SpecialApply( bool bRecalc)
bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ; bOk = bOk && pMch->LuaResetGlobVar( EMC_VAR) ;
// segnalo errori ed esco // segnalo errori ed esco
if ( ! bOk || nErr > 0) { if ( ! bOk || nErr > 0) {
if ( m_nShifts != -1) m_nShifts = - 1 ;
m_nShifts = -2 ;
string sOut = sMsg ; string sOut = sMsg ;
if ( IsEmptyOrSpaces( sOut)) if ( IsEmptyOrSpaces( sOut))
sOut = " Error in " + ON_SPECIAL_APPLY + " (" + ToString( nErr) + ")" ; sOut = " Error in " + ON_SPECIAL_APPLY + " (" + ToString( nErr) + ")" ;
@@ -1413,12 +1393,12 @@ Disposition::SpecialUpdate( void)
// se disposizione vuota, esco // se disposizione vuota, esco
if ( m_nShifts <= 0) { if ( m_nShifts <= 0) {
if ( m_nShifts == -2) if ( m_nShifts < 0)
m_pMchMgr->SetWarning( 2052, "Warning in Disposition : No shifts") ; m_pMchMgr->SetWarning( 2052, "Warning in Disposition : No shifts") ;
return true ; return true ;
} }
// calcolo assi macchina // calcolo assi macchina
if ( ! CalculateAxesValues( "", false)) { if ( ! CalculateAxesValues( "")) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ; string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty()) if ( sInfo.empty())
m_pMchMgr->SetLastError( 2007, "Error in Disposition : axes values not calculable") ; m_pMchMgr->SetLastError( 2007, "Error in Disposition : axes values not calculable") ;
+6 -9
View File
@@ -58,12 +58,12 @@ class Disposition : public Operation
bool Load( const STRVECTOR& vString, int nBaseGdbId) override ; bool Load( const STRVECTOR& vString, int nBaseGdbId) override ;
public : // Operation public : // Operation
int GetType( void) const override int GetType( void) const override
{ return OPER_DISP ; } { return OPER_DISP ; }
bool IsEmpty( void) const override bool IsEmpty( void) const override
{ return ( m_nShifts == 0) ; } { return ( m_nShifts == 0) ; }
bool UpdateStatus( int nModif) override bool UpdateStatus( int nModif) override
{ m_nStatus |= nModif ; return true ; } { m_nStatus |= nModif ; return true ; }
protected : // Operation protected : // Operation
const std::string& GetToolName( void) const override ; const std::string& GetToolName( void) const override ;
@@ -71,7 +71,7 @@ class Disposition : public Operation
int GetExitNbr( void) const override ; int GetExitNbr( void) const override ;
const std::string& GetToolTcPos( void) const override ; const std::string& GetToolTcPos( void) const override ;
int GetSolCh( void) const override int GetSolCh( void) const override
{ return 0 ; } { return 0 ; }
bool NeedPrevHome( void) const override ; bool NeedPrevHome( void) const override ;
public : public :
@@ -102,7 +102,6 @@ class Disposition : public Operation
bool MoveRawPart( int nRawId, const Vector3d& vtMove) ; bool MoveRawPart( int nRawId, const Vector3d& vtMove) ;
bool RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg) ; bool RotateRawPart( int nRawId, const Vector3d& vtAx, double dAngRotDeg) ;
bool ApplyRotationToRawPart( int nRawId, double dAngCDeg, double dAngADeg, double dAngC1Deg, bool bAddToList = true) ; bool ApplyRotationToRawPart( int nRawId, double dAngCDeg, double dAngADeg, double dAngC1Deg, bool bAddToList = true) ;
bool UpdateRawPartId( int nRawId, int nNewRawId) ;
bool RemoveRawPart( int nRawId) ; bool RemoveRawPart( int nRawId) ;
bool GetFixtureData( int nInd, std::string& sName, int& nId, Point3d& ptPos, bool GetFixtureData( int nInd, std::string& sName, int& nId, Point3d& ptPos,
double& dAngDeg, double& dMov) const ; double& dAngDeg, double& dMov) const ;
@@ -112,8 +111,6 @@ class Disposition : public Operation
bool GetToolData( std::string& sName, std::string& sHead, int& nExit, std::string& sTcPos) const ; bool GetToolData( std::string& sName, std::string& sHead, int& nExit, std::string& sTcPos) const ;
bool GetSomeByHand( void) const bool GetSomeByHand( void) const
{ return m_bSomeByHand ; } { return m_bSomeByHand ; }
bool IsWithTool( void)
{ return ( m_nShifts != -1) ;}
private : private :
bool InsertMoveInfoInList( int nRawId, int nType, const Point3d& ptP, int nFlag) ; bool InsertMoveInfoInList( int nRawId, int nType, const Point3d& ptP, int nFlag) ;
+25 -614
View File
@@ -1,13 +1,12 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2015-2023 // EgalTech 2015-2015
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : Drilling.cpp Data : 20.12.23 Versione : 2.5l47 // File : Drilling.cpp Data : 21.05.15 Versione : 1.6e7
// Contenuto : Implementazione gestione forature. // Contenuto : Implementazione gestione forature.
// //
// Note : Questa lavorazione è sempre espressa nel riferimento globale. // Note : Questa lavorazione è sempre espressa nel riferimento globale.
// //
// Modifiche : 21.05.15 DS Creazione modulo. // Modifiche : 21.05.15 DS Creazione modulo.
// 20.12.23 RE Forature multiple con aggregati.
// //
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -20,7 +19,6 @@
#include "OperationConst.h" #include "OperationConst.h"
#include "/EgtDev/Include/EXeCmdLogOff.h" #include "/EgtDev/Include/EXeCmdLogOff.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h" #include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGkCurveLine.h" #include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h" #include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkCurveComposite.h" #include "/EgtDev/Include/EGkCurveComposite.h"
@@ -29,7 +27,6 @@
#include "/EgtDev/Include/EGkUserObjFactory.h" #include "/EgtDev/Include/EGkUserObjFactory.h"
#include "/EgtDev/Include/EGnStringKeyVal.h" #include "/EgtDev/Include/EGnStringKeyVal.h"
#include "/EgtDev/Include/EgtPointerOwner.h" #include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EGkGeoFrame3d.h"
using namespace std ; using namespace std ;
@@ -48,9 +45,6 @@ using namespace std ;
// 2112 = "Error in Drilling : link outstroke xx" // 2112 = "Error in Drilling : link outstroke xx"
// 2113 = "Error in Drilling : post apply not calculable" // 2113 = "Error in Drilling : post apply not calculable"
// 2114 = "Error in Drilling : blind hole not reversible" // 2114 = "Error in Drilling : blind hole not reversible"
// 2115 = "Error in Drilling : Mirror for Double calculation failed"
// 2116 = "Error in Drilling : multi drilling head without valid tools"
// 2117 = "Error in Drilling : incorrect multi drilling head"
// 2151 = "Warning in Drilling : Skipped entity (xx)" // 2151 = "Warning in Drilling : Skipped entity (xx)"
// 2152 = "Warning in Drilling : No machinable path" // 2152 = "Warning in Drilling : No machinable path"
// 2153 = "Warning in Drilling : Tool name changed (xx)" // 2153 = "Warning in Drilling : Tool name changed (xx)"
@@ -74,39 +68,6 @@ struct Hole
: nOriId( GDB_ID_NULL), ptIni(), vtDir(), dDiam( 0), dThick( 0), dLen( 0), bBlind( true) {} : nOriId( GDB_ID_NULL), ptIni(), vtDir(), dDiam( 0), dThick( 0), dLen( 0), bBlind( true) {}
} ; } ;
struct MHDrill {
int nInd_id_hole ; // indice foro
Vector3d vtAux ; // vettore ausiliario per tale foratura
} ;
struct HoleInfo {
Hole hole ; // foro
bool bDrill = false ; // se alla fine verrà lavorato
bool bTempDrill = false ; // per test maschera (se durante un test viene lavorato o no)
int nTempTool = -1 ; // per test maschera ( indice utensile che lo lavora durante un test)
bool bSkipToAngle = false ; // nel caso di più assi rotanti, se foro già lavorato con testa orientata
bool bForToolM = false ; // se tool main lavorerà 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 lavorazione in vToolHole (ordinati)
VCT3DVECTOR vVtAux ; // vettore dei vtAux ausiliari del tool principale per lavorare questo foro (ordinati)
int nIndTool = -1 ; // indice del tool che alla fine lavorerà il foro
Vector3d vtAux ; // vettore ausiliario del tool principale che permette al tool principale di lavorare questo foro
Point3d ptBtn ; // punto interno alla base del foro
int nIndInSelVector = 0 ; // indice nel vettore m_vId (id fori selezionati)
} ;
struct ToolInfo
{
const ToolData* pTool ; // puntatore per utensile (nullo se utensile non presente)
Point3d ptToolTip ; // punto finale del tool (per ptBtn del foro)
ToolInfo( void)
: pTool( nullptr) {}
ToolInfo( const ToolData* pT)
: pTool( pT) {}
} ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
USEROBJ_REGISTER( GetOperationClass( OPER_DRILLING), Drilling) ; USEROBJ_REGISTER( GetOperationClass( OPER_DRILLING), Drilling) ;
@@ -134,7 +95,6 @@ Drilling::Clone( void) const
pDri->m_nStatus = m_nStatus ; pDri->m_nStatus = m_nStatus ;
pDri->m_nDrillings = m_nDrillings ; pDri->m_nDrillings = m_nDrillings ;
pDri->m_bTiltingTab = m_bTiltingTab ; pDri->m_bTiltingTab = m_bTiltingTab ;
pDri->m_vtTiltingAx = m_vtTiltingAx ;
pDri->m_bAboveHead = m_bAboveHead ; pDri->m_bAboveHead = m_bAboveHead ;
pDri->m_bAggrBottom = m_bAggrBottom ; pDri->m_bAggrBottom = m_bAggrBottom ;
} }
@@ -490,16 +450,16 @@ Drilling::SetGeometry( const SELVECTOR& vIds)
// se lavorazione standard // se lavorazione standard
if ( m_Params.m_nSubType == DRI_SUB_STD) { if ( m_Params.m_nSubType == DRI_SUB_STD) {
// recupero il valore di tolleranza sul diametro // 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 // verifico che gli identificativi rappresentino dei fori con il corretto diametro
for ( int i = 0 ; i < int( vIds.size()) ; ++ i) { for ( int i = 0 ; i < int( vIds.size()) ; ++ i) {
// recupero i dati del foro // recupero i dati del foro
//Hole hole ; Hole hole ;
//if ( ! GetHoleData( vIds[i], hole) || !VerifyDiameter(hole.dDiam, m_TParams.m_dDiam, dDiamTol)) { if ( ! GetHoleData( vIds[i], hole) || ! VerifyDiameter( hole.dDiam, m_TParams.m_dDiam, dDiamTol)) {
// string sInfo = "Warning in Drilling : Skipped entity " + ToString( vIds[i].nId) ; string sInfo = "Warning in Drilling : Skipped entity " + ToString( vIds[i].nId) ;
// m_pMchMgr->SetWarning( 2151, sInfo) ; m_pMchMgr->SetWarning( 2151, sInfo) ;
// continue ; continue ;
//} }
// posso aggiungere alla lista // posso aggiungere alla lista
m_vId.push_back( vIds[i]) ; m_vId.push_back( vIds[i]) ;
} }
@@ -553,7 +513,7 @@ Drilling::Preview( bool bRecalc)
// se lavorazione standard // se lavorazione standard
if ( m_Params.m_nSubType == DRI_SUB_STD) if ( m_Params.m_nSubType == DRI_SUB_STD)
return StandardProcess( bRecalc, nPvId, GDB_ID_NULL) ; return StdandardProcess( bRecalc, nPvId, GDB_ID_NULL) ;
// se altrimenti lavorazione lungo curve // se altrimenti lavorazione lungo curve
else if ( m_Params.m_nSubType == DRI_SUB_ALONG_CURVE) else if ( m_Params.m_nSubType == DRI_SUB_ALONG_CURVE)
return AlongCurveProcess( bRecalc, nPvId, GDB_ID_NULL) ; return AlongCurveProcess( bRecalc, nPvId, GDB_ID_NULL) ;
@@ -609,16 +569,9 @@ Drilling::Apply( bool bRecalc, bool bPostApply)
else else
m_pGeomDB->EmptyGroup( nClId) ; m_pGeomDB->EmptyGroup( nClId) ;
// elimino eventuale gruppo geometria simmetrica per lavorazione in doppio
int nDblId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_DBL) ;
if ( nDblId != GDB_ID_NULL) {
m_pGeomDB->Erase( nDblId) ;
nDblId = GDB_ID_NULL ;
}
// se lavorazione standard // se lavorazione standard
if ( m_Params.m_nSubType == DRI_SUB_STD) { if ( m_Params.m_nSubType == DRI_SUB_STD) {
if ( ! StandardProcess( bRecalc, GDB_ID_NULL, nClId)) if ( ! StdandardProcess( bRecalc, GDB_ID_NULL, nClId))
return false ; return false ;
} }
// se altrimenti lavorazione lungo curve // se altrimenti lavorazione lungo curve
@@ -637,12 +590,6 @@ Drilling::Apply( bool bRecalc, bool bPostApply)
if ( ! Update( bPostApply)) if ( ! Update( bPostApply))
return false ; return false ;
// se lavorazione in doppio, aggiungo geometria della parte simmetrica
if ( ! CalcMirrorByDouble( nClId, m_Params.m_sUserNotes)) {
m_pMchMgr->SetLastError( 2115, "Error in Drilling : Mirror for Double calculation failed") ;
return false ;
}
// aggiorno stato della lavorazione // aggiorno stato della lavorazione
m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ; m_nStatus = ( bPostApply ? MCH_ST_OK : MCH_ST_NO_POSTAPPL) ;
// dichiaro successiva da aggiornare // dichiaro successiva da aggiornare
@@ -667,9 +614,6 @@ Drilling::Update( bool bPostApply)
return true ; return true ;
} }
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione // imposto eventuale asse bloccato da lavorazione
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
@@ -714,42 +658,10 @@ Drilling::Update( bool bPostApply)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId) Drilling::StdandardProcess( bool bRecalc, int nPvId, int nClId)
{ {
// controllo se ho più uscite
string sCurrHead ; // elaboro i singoli fori
if ( ! m_pMchMgr->GetCurrMachine()->GetCurrHead( sCurrHead))
return false ;
int nExitCnt = m_pMchMgr->GetCurrMachine()->GetHeadExitCount( sCurrHead) ;
TABMHDRILL tabDrills ;
double dMHOff = 0 ;
// se ho più uscite...
if ( nExitCnt > 1) {
if ( ! MultiHeadDrilling( nExitCnt, m_vId, nClId, tabDrills, dMHOff))
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 ; int i = 0 ;
for ( const auto& vId : m_vId) { for ( const auto& vId : m_vId) {
// se richiesto preview // se richiesto preview
@@ -766,491 +678,12 @@ Drilling::StandardProcess( bool bRecalc, int nPvId, int nClId)
return false ; return false ;
} }
// incremento indice // incremento indice
++i ; ++ i ;
} }
return true ; return true ;
} }
//----------------------------------------------------------------------------
bool
Drilling::MultiHeadDrilling( int nExitCnt, const SELVECTOR& vId, int nClId, TABMHDRILL& tabDrills, double& dMHOff, bool bOrd)
{
// controllo parametri
tabDrills.clear() ;
if ( vId.empty())
return true ;
// recupero il nome della testa
string sHead ;
m_pMchMgr->GetCurrMachine()->GetCurrHead( sHead) ;
// gestore degli utensili
ToolsMgr* pTMgr = m_pMchMgr->GetCurrToolsMgr() ;
if ( pTMgr == nullptr)
return false ;
// Recupero i dati degli utensili montati sulla testa
int nMainToolInd = -1 ;
VECTORTOOL vTools ; vTools.reserve( nExitCnt) ;
// ricavo gli utensili presenti sulle uscite
for ( int nT = 0 ; nT < nExitCnt ; ++ nT) {
string sToolName ;
ToolInfo TInf ;
if ( ! m_pMchMgr->GetLoadedTool( sHead, nT + 1, sToolName) || sToolName.empty()) {
// non c'è utensile
vTools.emplace_back( nullptr) ;
continue ;
}
// se presente e valido
const ToolData* pTdata = pTMgr->GetTool( sToolName) ;
vTools.emplace_back( pTdata) ;
// imposto il tool di riferimento come il tool m_TParams
if ( pTdata->m_Uuid == m_TParams.m_Uuid)
nMainToolInd = nT ;
}
// se non ho utensili attivi o validi, errore
if ( nMainToolInd == -1 || vTools.empty()) {
m_pMchMgr->SetLastError( 2116, "Error in Drilling : multi drilling head without valid tools") ;
return false ;
}
// carico i dati della testa con le sue uscite
Vector3d vtTool, vtAux ;
for ( int nT = 0 ; nT < nExitCnt ; ++ nT) {
// se non attrezzato, salto al successivo
if ( vTools[nT].pTool == nullptr)
continue ;
// recupero i dati dell'uscita
Point3d ptExit ;
Vector3d vtCurrDir, vtCurrAux ;
m_pMchMgr->GetCurrMachine()->GetHeadExitPosDirAux( sHead, nT + 1, ptExit, vtCurrDir, vtCurrAux) ;
// se utensile successivo
if ( ! vtTool.IsSmall()) {
// controllo abbia la stessa direzione dei precedenti, altrimenti errore
if ( ! AreSameVectorApprox( vtCurrDir, vtTool)) {
vtTool = V_NULL ;
break ;
}
}
// altrimenti primo utensile
else {
vtTool = vtCurrDir ;
vtAux = vtCurrAux ;
}
// assegno tip utensile
vTools[nT].ptToolTip = ptExit - vtCurrDir * vTools[nT].pTool->m_dLen ;
}
if ( vtTool.IsSmall() || vtAux.IsSmall()) {
m_pMchMgr->SetLastError( 2117, "Error in Drilling : incorrect multi drilling head") ;
return false ;
}
// Recupero le geometrie dei fori
bool bSomeHoleOk = false ;
VECTORHOLE vHoles( vId.size()) ;
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 ;
bSomeHoleOk = true ;
}
if ( ! bSomeHoleOk)
return true ;
// calcolo la corrispondenza tra utensili e fori
if ( ! CalcMask( vHoles, vTools, nMainToolInd, vtTool, vtAux))
return false ;
// i fori con dimensione 0 del vettore vToolHole non possono essere lavorati
int nNoDrillHoles = 0 ;
for ( int i = 0 ; i < ( int)vHoles.size() ; ++ i) {
if ( vHoles[i].vToolHole.size() == 0)
++ nNoDrillHoles ;
}
// resetto le variabili di controllo di lavorazione temporanea per tutti i fori
for ( int k = 0 ; k < ( int)vHoles.size() ; ++k)
vHoles[k].bTempDrill = false ;
// numero di fori lavorati
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 = nMainToolInd ;
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[nMainToolInd].pTool->m_dTLen ;
double dOffMax = 0 ;
for ( int nT = 0 ; nT < ( int)vTools.size() && nNoDrillHoles != (int)vHoles.size() ; ++ nT) {
if ( vTools[nT].pTool == nullptr || nT == nMainToolInd)
continue ;
if ( vTools[nT].pTool->m_dTLen > dRefLen + dOffMax) {
dOffMax = vTools[nT].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 ( vVtA.empty())
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() ;
}
// se non trovo corrispondenze ...
if ( tabDrills.empty())
return true ;
// se devo riordinare
if ( bOrd) {
struct Order {
int nInd_id_hole ;
Point3d ptIni ;
} ;
vector<Order> 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, const VECTORTOOL& vTools, int nIndMT, const Vector3d& vtTool, const Vector3d& vtAux)
{
// controllo dei parametri
if ( vHoles.empty() || vTools.empty())
return false ;
// recupero il valore di tolleranza sul diametro
double dDiamToler = m_pMchMgr->GetCurrMachiningsMgr()->GetHoleDiamToler() ;
int nExitCnt = ( 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, dDiamToler, 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].ptToolTip, vtTool, vtAux) ;
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, dDiamToler, nDrills) ;
// controllo quanti fori sono riuscito a svuotare e setto i loro parametri di foratura
if ( nDrills == nExitCnt - 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 ;
}
// se la testa può ruotare
if ( nStat < 0) {
// 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, dDiamToler, 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].ptToolTip - vTools[nIndMT].ptToolTip ;
Vector3d vtRefH = Hole_j.ptIni - Hole_j.vtDir * Hole_j.dLen -
( Hole_i.ptIni - Hole_i.vtDir * Hole_i.dLen) ;
// se le distanze sono compatibili
if ( abs( vtRefH.Len() - vtRefT.Len()) < EPS_SMALL) {
// 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].ptToolTip ;
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, dDiamToler, 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 == nExitCnt - 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, const VECTORTOOL& vTools, int nIndTM, int nIndHTM, Hole holeICP,
const Frame3d& frMT, const Frame3d& frHMT, double dDiamToler, int& nDrills)
{
// controllo parametri
if ( vHoles.empty() || vTools.empty())
return true ;
if ( nIndTM < 0 || nIndTM >= ( int)vTools.size() ||
nIndHTM < 0 || nIndHTM >= ( int)vHoles.size() ||
! 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].ptToolTip ;
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, dDiamToler, 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)) {
// un foro in più lavorato
++ nDrills ;
// aggiorno le variabili temporanee
vHoles[j].bTempDrill = true ;
vHoles[j].nTempTool = t ;
// non controllo gli altri vertici per la punta t-esima
break ;
}
}
}
return true ;
}
//----------------------------------------------------------------------------
bool
Drilling::MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamToler, SelData Id)
{
// verifico che il diamtro del tool sia compatibile con quello del foro
if ( ! VerifyDiameter( hole.dDiam, Tool->m_dDiam, dDiamToler))
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 bool
Drilling::AlongCurveProcess( bool bRecalc, int nPvId, int nClId) Drilling::AlongCurveProcess( bool bRecalc, int nPvId, int nClId)
@@ -1543,12 +976,12 @@ Drilling::GenerateHolePv( int nInd, const SelData& nCircId, const string& sPName
PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ; PtrOwner<ICurveArc> pCrvArc( CreateCurveArc()) ;
if ( IsNull( pCrvArc) || ! pCrvArc->Set( hole.ptIni, hole.vtDir, 0.5 * m_TParams.m_dDiam)) if ( IsNull( pCrvArc) || ! pCrvArc->Set( hole.ptIni, hole.vtDir, 0.5 * m_TParams.m_dDiam))
return false ; return false ;
// assegno il versore estrusione e lo spessore // assegno il versore estrusione e lo spessore
pCrvArc->SetExtrusion( hole.vtDir) ; pCrvArc->SetExtrusion( hole.vtDir) ;
pCrvArc->SetThickness( - hole.dLen) ; pCrvArc->SetThickness( - hole.dLen) ;
// inserisco nel DB // inserisco nel DB
int nDriId = m_pGeomDB->AddGeoObj( GDB_ID_NULL, nPathId, Release( pCrvArc)) ; 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->SetName( nDriId, MCH_PV_CUT) ;
m_pGeomDB->SetMaterial( nDriId, LIME) ; m_pGeomDB->SetMaterial( nDriId, LIME) ;
// aggiorno numero forature // aggiorno numero forature
@@ -1558,7 +991,7 @@ Drilling::GenerateHolePv( int nInd, const SelData& nCircId, const string& sPName
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName, int nClId, double dMHOff, Vector3d vtA) Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName, int nClId)
{ {
// creo gruppo per geometria di lavorazione del foro // creo gruppo per geometria di lavorazione del foro
int nPathId = m_pGeomDB->AddGroup( GDB_ID_NULL, nClId, Frame3d()) ; int nPathId = m_pGeomDB->AddGroup( GDB_ID_NULL, nClId, Frame3d()) ;
@@ -1609,7 +1042,7 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName
} }
// verifico se tavola basculante // verifico se tavola basculante
bool bTiltTab = false ; bool bTiltTab = false ;
m_bTiltingTab = ( m_pMchMgr->GetCurrMachine()->GetCurrTableIsTilting( bTiltTab, m_vtTiltingAx) && bTiltTab) ; m_bTiltingTab = ( m_pMchMgr->GetCurrMachine()->GetCurrTableIsTilting( bTiltTab) && bTiltTab) ;
// verifico se testa da sopra (Z+) // verifico se testa da sopra (Z+)
m_bAboveHead = m_pMchMgr->GetHeadAbove( m_TParams.m_sHead) ; m_bAboveHead = m_pMchMgr->GetHeadAbove( m_TParams.m_sHead) ;
// verifiche per foro verso il basso // verifiche per foro verso il basso
@@ -1626,7 +1059,7 @@ Drilling::GenerateHoleCl( int nInd, const SelData& nCircId, const string& sPName
// foro normale // foro normale
if ( m_Params.m_dStep < EPS_SMALL || if ( m_Params.m_dStep < EPS_SMALL ||
m_Params.m_dStep > hole.dLen - EPS_SMALL) { m_Params.m_dStep > hole.dLen - EPS_SMALL) {
if ( DoStandardDrilling( hole, nCircId, nPathId, dMHOff, vtA)) { if ( DoStandardDrilling( hole, nCircId, nPathId)) {
// aggiorno numero forature // aggiorno numero forature
++ m_nDrillings ; ++ m_nDrillings ;
} }
@@ -1871,31 +1304,11 @@ Drilling::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ; const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr) if ( pTdata == nullptr)
return false ; return false ;
// salvo posizione TC, testa e uscita originali // verifico se sono diversi (ad esclusione del nome)
string sOrigTcPos = m_TParams.m_sTcPos ; m_TParams.m_sName = pTdata->m_sName ;
string sOrigHead = m_TParams.m_sHead ; bool bChanged = ! SameTool( m_TParams, *pTdata) ;
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 // aggiorno comunque i parametri
m_TParams = *pTdata ; 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 // eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) { if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in Drilling : tool name changed (" + string sInfo = "Warning in Drilling : tool name changed (" +
@@ -2044,7 +1457,7 @@ Drilling::VerifyHoleFromBottom( const Hole& hole, SelData Id)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double dMHOff, Vector3d vtA) Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId)
{ {
// aggiusto alcuni parametri del ciclo di foratura // aggiusto alcuni parametri del ciclo di foratura
double dStartSlowLen = abs( m_Params.m_dStartSlowLen) ; double dStartSlowLen = abs( m_Params.m_dStartSlowLen) ;
@@ -2074,7 +1487,7 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() ;
double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ; double dSafeAggrBottZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeAggrBottZ() ;
double dAppr = ( m_bAggrBottom ? dSafeAggrBottZ : dSafeZ) ; double dAppr = ( m_bAggrBottom ? dSafeAggrBottZ : dSafeZ) ;
Point3d ptP1 = hole.ptIni + hole.vtDir * ( dAppr + dElev + dTExtrLen + dMHOff) ; Point3d ptP1 = hole.ptIni + hole.vtDir * ( dAppr + dElev + dTExtrLen) ;
if ( m_bAggrBottom) { if ( m_bAggrBottom) {
Point3d ptP0 = ptP1 + m_vtAggrBottom * ( m_dDistBottom + m_AggrBottom.dEncH + dSafeZ) ; 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) ; Point3d ptP00 = ptP0 + Z_AX * ( m_AggrBottom.dEncV + m_TParams.m_dLen + dAppr + dTExtrLen) ;
@@ -2101,8 +1514,6 @@ Drilling::DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double
return false ; return false ;
} }
else { else {
if( ! vtA.IsSmall())
SetAuxDir( vtA) ;
if ( AddRapidStart( ptP1) == GDB_ID_NULL) if ( AddRapidStart( ptP1) == GDB_ID_NULL)
return false ; return false ;
} }
+3 -15
View File
@@ -19,13 +19,7 @@
#include "MachiningConst.h" #include "MachiningConst.h"
struct Hole ; struct Hole ;
struct MHDrill ;
struct HoleInfo ;
struct ToolInfo ;
class ICurve ; class ICurve ;
typedef std::vector<std::vector<MHDrill>> TABMHDRILL ;
typedef std::vector<HoleInfo> VECTORHOLE ;
typedef std::vector<ToolInfo> VECTORTOOL ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class Drilling : public Machining class Drilling : public Machining
@@ -74,23 +68,18 @@ class Drilling : public Machining
private : private :
bool GetHoleData( SelData Id, Hole& hole) ; bool GetHoleData( SelData Id, Hole& hole) ;
bool StandardProcess( bool bRecalc, int nPvId, int nClId) ; bool StdandardProcess( bool bRecalc, int nPvId, int nClId) ;
bool AlongCurveProcess( bool bRecalc, int nPvId, int nClId) ; bool AlongCurveProcess( bool bRecalc, int nPvId, int nClId) ;
bool Chain( int nGrpDestId) ; bool Chain( int nGrpDestId) ;
ICurve* GetCurve( SelData Id) ; ICurve* GetCurve( SelData Id) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ; bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool GenerateHolePv( int nInd, const SelData& nCircId, const std::string& sPName, int nPvId) ; 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, double dMHOff = .0, Vector3d vtAux = V_NULL) ; bool GenerateHoleCl( int nInd, const SelData& nCircId, const std::string& sPName, int nClId) ;
bool GenerateHoleRegionPv( int nFirstId, int nCount, int nPvId) ; bool GenerateHoleRegionPv( int nFirstId, int nCount, int nPvId) ;
bool VerifyDiameter( double dHdiam, double dTdiam, double ddiamTol) ; bool VerifyDiameter( double dHdiam, double dTdiam, double ddiamTol) ;
bool VerifyHoleFromBottom( const Hole& hole, SelData Id) ; bool VerifyHoleFromBottom( const Hole& hole, SelData Id) ;
bool DoStandardDrilling( const Hole& hole, SelData Id, int nPathId, double nMHOff, Vector3d vtA) ; bool DoStandardDrilling( const Hole& hole, SelData Id, int nPathId) ;
bool DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) ; bool DoPeckDrilling( const Hole& hole, SelData Id, int nPathId) ;
bool MultiHeadDrilling( int nExitCnt, const SELVECTOR& vId, int nClId, TABMHDRILL& vDrills, double& dMHOff, bool bOrd = true) ;
bool CalcMask( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndMT, const Vector3d& vtTool, const Vector3d& vtAux) ;
bool CheckOtherHolesWithTools( VECTORHOLE& vHoles, const VECTORTOOL& vTools, int nIndTM, int nIndHTM, Hole holeICP,
const Frame3d& frHTM, const Frame3d& frHMTOP, double dDiamToler, int& nDrills) ;
bool MultiHeadVerifyHole( Hole& hole, const ToolData* Tool, double dDiamToler, SelData Id) ;
private : private :
double GetSpeed() const double GetSpeed() const
@@ -111,7 +100,6 @@ class Drilling : public Machining
int m_nStatus ; // stato di aggiornamento della lavorazione int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nDrillings ; // numero di fori generati int m_nDrillings ; // numero di fori generati
bool m_bTiltingTab ; // flag utilizzo tavola basculante 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_bAboveHead ; // flag utilizzo testa da sopra
bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
+2 -6
View File
@@ -75,10 +75,6 @@ struct DrillingData : public MachiningData
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline const DrillingData* GetDrillingData( const MachiningData* pMdata) inline const DrillingData* GetDrillingData( const MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_DRILLING) { return (dynamic_cast<const DrillingData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<const DrillingData*>( pMdata)) ; }
inline DrillingData* GetDrillingData( MachiningData* pMdata) inline DrillingData* GetDrillingData( MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_DRILLING) { return (dynamic_cast<DrillingData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<DrillingData*>( pMdata)) ; }
BIN
View File
Binary file not shown.
+4 -6
View File
@@ -21,7 +21,7 @@
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{0BD58222-92F3-48B2-B656-4497D1956874}</ProjectGuid> <ProjectGuid>{0BD58222-92F3-48B2-B656-4497D1956874}</ProjectGuid>
<RootNamespace>EgtMachKernel</RootNamespace> <RootNamespace>EgtMachKernel</RootNamespace>
<WindowsTargetPlatformVersion>10.0.20348.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@@ -100,12 +100,11 @@
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EMK;_VRONI;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EMK;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<OpenMPSupport>false</OpenMPSupport> <OpenMPSupport>true</OpenMPSupport>
<PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeader>Use</PrecompiledHeader>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
@@ -167,7 +166,6 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration> <EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<WholeProgramOptimization>false</WholeProgramOptimization> <WholeProgramOptimization>false</WholeProgramOptimization>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>false</GenerateDebugInformation> <GenerateDebugInformation>false</GenerateDebugInformation>
@@ -195,7 +193,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers> <OmitFramePointers>true</OmitFramePointers>
<PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EMK;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_WINDOWS;I_AM_EMK;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<OpenMPSupport>false</OpenMPSupport> <OpenMPSupport>false</OpenMPSupport>
<PrecompiledHeader>Use</PrecompiledHeader> <PrecompiledHeader>Use</PrecompiledHeader>
<CompileAs>CompileAsCpp</CompileAs> <CompileAs>CompileAsCpp</CompileAs>
-3
View File
@@ -124,9 +124,6 @@ Exit::Modify( const Point3d& ptPos, double dExitMaxAdjust)
} }
// Assegno la nuova posizione // Assegno la nuova posizione
m_ptPos = ptPos ; m_ptPos = ptPos ;
// Sistemo la geometria dell'uscita
if ( ! vtDelta.IsZero())
m_pGeomDB->Translate( m_nOwnerId, vtDelta) ;
return true ; return true ;
} }
+3 -59
View File
@@ -55,17 +55,6 @@ static const string EVAR_STARTPOS = ".STARTPOS" ; // IN (num) quota di inizio l
static const string EVAR_OFFSR = ".OFFSR" ; // IN (num) offset radiale static const string EVAR_OFFSR = ".OFFSR" ; // IN (num) offset radiale
static const string EVAR_OFFSL = ".OFFSL" ; // IN (num) offset longitudinale static const string EVAR_OFFSL = ".OFFSL" ; // IN (num) offset longitudinale
static const string EVAR_TOOL = ".TOOL" ; // IN (string) nome dell'utensile static const string EVAR_TOOL = ".TOOL" ; // IN (string) nome dell'utensile
static const string EVAR_HEAD = ".HEAD" ; // IN (string) nome testa
static const string EVAR_EXIT = ".EXIT" ; // IN (int) indice uscita
static const string EVAR_TTYPE = ".TTYPE" ; // IN (int) tipo utensile
static const string EVAR_TMAXMAT = ".TMAXMAT" ; // IN (num) massimo materiale
static const string EVAR_TDIAM = ".TDIAM" ; // IN (num) diametro utensile
static const string EVAR_TTOTDIAM = ".TTOTDIAM" ; // IN (num) diametro totale utensile
static const string EVAR_TLEN = ".TLEN" ; // IN (num) lunghezza utensile
static const string EVAR_TTOTLEN = ".TTOTLEN" ; // IN (num) lunghezza totale utensile
static const string EVAR_TTHICK = ".THICK" ; // IN (num) spessore per lame o altezza taglienti
static const string EVAR_TCORNRAD = ".TCORNRAD" ; // IN (num) raggio corner
static const string EVAR_TSIDEANG = ".TSIDEANG" ; // IN (num) angolo del fianco rispetto all'asse
static const string EVAR_FEED = ".FEED" ; // IN (num) feed dell'utensile static const string EVAR_FEED = ".FEED" ; // IN (num) feed dell'utensile
static const string EVAR_STARTFEED = ".STARTFEED" ;// IN (num) feed di inizio dell'utensile static const string EVAR_STARTFEED = ".STARTFEED" ;// IN (num) feed di inizio dell'utensile
static const string EVAR_ENDFEED = ".ENDFEED" ; // IN (num) feed di fine dell'utensile static const string EVAR_ENDFEED = ".ENDFEED" ; // IN (num) feed di fine dell'utensile
@@ -492,17 +481,6 @@ GenMachining::Preview( bool bRecalc)
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSR, GetOffsR()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSR, GetOffsR()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSL, GetOffsL()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSL, GetOffsL()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEAD, m_TParams.m_sHead) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_EXIT, m_TParams.m_nExit) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTYPE, m_TParams.m_nType) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TMAXMAT, m_TParams.m_dMaxMat) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TDIAM, m_TParams.m_dDiam) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTDIAM, m_TParams.m_dTDiam) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TLEN, m_TParams.m_dLen) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTLEN, m_TParams.m_dTLen) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTHICK, m_TParams.m_dThick) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TCORNRAD, m_TParams.m_dCornRad) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TSIDEANG, m_TParams.m_dSideAng) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_FEED, GetFeed()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_FEED, GetFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ;
@@ -606,17 +584,6 @@ GenMachining::Apply( bool bRecalc, bool bPostApply)
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSR, GetOffsR()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSR, GetOffsR()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSL, GetOffsL()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_OFFSL, GetOffsL()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TOOL, m_TParams.m_sName) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_HEAD, m_TParams.m_sHead) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_EXIT, m_TParams.m_nExit) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTYPE, m_TParams.m_nType) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TMAXMAT, m_TParams.m_dMaxMat) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TDIAM, m_TParams.m_dDiam) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTDIAM, m_TParams.m_dTDiam) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TLEN, m_TParams.m_dLen) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTOTLEN, m_TParams.m_dTLen) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TTHICK, m_TParams.m_dThick) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TCORNRAD, m_TParams.m_dCornRad) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_TSIDEANG, m_TParams.m_dSideAng) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_FEED, GetFeed()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_FEED, GetFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_STARTFEED, GetStartFeed()) ;
bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ; bOk = bOk && pMch->LuaSetGlobVar( EMC_VAR + EVAR_ENDFEED, GetEndFeed()) ;
@@ -669,9 +636,6 @@ GenMachining::Update( bool bPostApply)
return true ; return true ;
} }
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione // imposto eventuale asse bloccato da lavorazione
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
@@ -842,31 +806,11 @@ GenMachining::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ; const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr) if ( pTdata == nullptr)
return false ; return false ;
// salvo posizione TC, testa e uscita originali // verifico se sono diversi (ad esclusione del nome)
string sOrigTcPos = m_TParams.m_sTcPos ; m_TParams.m_sName = pTdata->m_sName ;
string sOrigHead = m_TParams.m_sHead ; bool bChanged = ! SameTool( m_TParams, *pTdata) ;
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 // aggiorno comunque i parametri
m_TParams = *pTdata ; 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 // eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) { if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in GenMachining : tool name changed (" + string sInfo = "Warning in GenMachining : tool name changed (" +
+2 -6
View File
@@ -67,10 +67,6 @@ struct GenMachiningData : public MachiningData
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline const GenMachiningData* GetGenMachiningData( const MachiningData* pMdata) inline const GenMachiningData* GetGenMachiningData( const MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_GENMACHINING) { return (dynamic_cast<const GenMachiningData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<const GenMachiningData*>( pMdata)) ; }
inline GenMachiningData* GetGenMachiningData( MachiningData* pMdata) inline GenMachiningData* GetGenMachiningData( MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_GENMACHINING) { return (dynamic_cast<GenMachiningData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<GenMachiningData*>( pMdata)) ; }
+11 -29
View File
@@ -19,7 +19,6 @@
#include "OutputConst.h" #include "OutputConst.h"
#include "/EgtDev/Include/EMkDllMain.h" #include "/EgtDev/Include/EMkDllMain.h"
#include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EGnGetKeyData.h"
using namespace std ; using namespace std ;
@@ -47,31 +46,19 @@ Generator::Init( MachMgr* pMchMgr)
bool bool
Generator::Run( const string& sCncFile, const string& sInfo) Generator::Run( const string& sCncFile, const string& sInfo)
{ {
// Controllo della licenza // verifico sia abilitato dalla licenza
unsigned int nOpt1, nOpt2 ; bool bEnabled = false ;
int nOptExpDays ; if ( GetEMkNetHwKey()) {
int nRet = GetEGnKeyOptions( KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, bEnabled = true ;
nOpt1, nOpt2, nOptExpDays) ; }
if ( ! GetEMkNetHwKey()) else {
unsigned int nOpt1, nOpt2 ;
int nOptExpDays ;
int nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV, int nRet = GetKeyOptions( GetEMkKey(), KEY_BASELIB_PROD, KEY_BASELIB_VER, KEY_BASELIB_LEV,
nOpt1, nOpt2, nOptExpDays) ; nOpt1, nOpt2, nOptExpDays) ;
bEnabled = ( nRet == KEY_OK && ( nOpt1 & KEYOPT_EMK_NC_OFF) == 0) ;
// Verifica della abilitazione }
bool bMinTime = false ; if ( bEnabled) {
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 // emetto info di log
{ string sOut = "Generator Run : " + sCncFile ; { string sOut = "Generator Run : " + sCncFile ;
@@ -92,11 +79,6 @@ Generator::Run( const string& sCncFile, const string& sInfo)
return bOk ; 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 // Generazione non abilitata
m_pMchMgr->SetLastError( 1000, "NC_OFF") ; m_pMchMgr->SetLastError( 1000, "NC_OFF") ;
std::string sErr = "Warning on Key (MKC/NCO)" ; std::string sErr = "Warning on Key (MKC/NCO)" ;
+1 -1
View File
@@ -82,7 +82,7 @@ GetRotationComponent( const Vector3d& vtDir1, double dComp, const Vector3d& vtDi
double dDenom = dT0uv * dSinG ; double dDenom = dT0uv * dSinG ;
double dNumer = dComp - dT0w * dCosG ; double dNumer = dComp - dT0w * dCosG ;
// due angoli possibili // due angoli possibili
if ( abs( dDenom) > abs( dNumer) + SIN_EPS_ANG_ZERO) { if ( abs( dDenom) > abs( dNumer)) {
double dDeltaAngRad = acos( dNumer / dDenom) ; double dDeltaAngRad = acos( dNumer / dDenom) ;
dAng1Deg = ( dOffsAngRad + dDeltaAngRad) * RADTODEG ; dAng1Deg = ( dOffsAngRad + dDeltaAngRad) * RADTODEG ;
dAng2Deg = ( dOffsAngRad - dDeltaAngRad) * RADTODEG ; dAng2Deg = ( dOffsAngRad - dDeltaAngRad) * RADTODEG ;
-1
View File
@@ -19,7 +19,6 @@
//----------- Costanti per approssimazioni con polilinee o poliarchi -------- //----------- Costanti per approssimazioni con polilinee o poliarchi --------
const double LIN_TOL_STD = 0.1 ; const double LIN_TOL_STD = 0.1 ;
const double LIN_TOL_MID = 0.05 ; const double LIN_TOL_MID = 0.05 ;
const double LIN_TOL_RAW = 0.5 ;
const double ANG_TOL_MAX_DEG = 90 ; const double ANG_TOL_MAX_DEG = 90 ;
const double ANG_TOL_STD_DEG = 15 ; const double ANG_TOL_STD_DEG = 15 ;
const double LIN_FEA_STD = 20 ; const double LIN_FEA_STD = 20 ;
+4 -9
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2015-2023 // EgalTech 2015-2022
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : MachMgr.h Data : 28.10.23 Versione : 2.5j4 // File : MachMgr.h Data : 21.09.22 Versione : 2.4i4
// Contenuto : Dichiarazione della classe MachMgr. // Contenuto : Dichiarazione della classe MachMgr.
// //
// //
@@ -11,8 +11,6 @@
// 17.08.20 DS Aggiunte GetAxisMin e GetAxisMax. // 17.08.20 DS Aggiunte GetAxisMin e GetAxisMax.
// 17.03.21 DS Aggiunte funzioni per import/export utensili. // 17.03.21 DS Aggiunte funzioni per import/export utensili.
// 21.09.22 DS Aggiunta GetAxisOffset. // 21.09.22 DS Aggiunta GetAxisOffset.
// 25.08.23 DS Aggiunta CopyMachGroup.
// 28.10.23 DS Aggiunte GetClEntAxesVal e GetToolSetupPosInCurrSetup.
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -97,7 +95,6 @@ class MachMgr : public IMachMgr
int GetPrevMachGroup( int nId) const override ; int GetPrevMachGroup( int nId) const override ;
bool GetMachGroupNewName( std::string& sName) const override ; bool GetMachGroupNewName( std::string& sName) const override ;
int AddMachGroup( const std::string& sName, const std::string& sMachineName) override ; int AddMachGroup( const std::string& sName, const std::string& sMachineName) override ;
int CopyMachGroup( const std::string& sSouName, const std::string& sName) override ;
bool RemoveMachGroup( int nId) override ; bool RemoveMachGroup( int nId) override ;
std::string GetMachGroupName( int nId) const override ; std::string GetMachGroupName( int nId) const override ;
std::string GetMachGroupMachineName( int nId) const override ; std::string GetMachGroupMachineName( int nId) const override ;
@@ -206,7 +203,6 @@ class MachMgr : public IMachMgr
bool ImportSetup( const std::string& sName) override ; bool ImportSetup( const std::string& sName) override ;
bool VerifyCurrSetup( STRVECTOR& vsErrors) override ; bool VerifyCurrSetup( STRVECTOR& vsErrors) override ;
bool FindToolInCurrSetup( const std::string& sTool) override ; bool FindToolInCurrSetup( const std::string& sTool) override ;
bool GetToolSetupPosInCurrSetup( const std::string& sTool, std::string& sTcPos) override ;
bool GetToolsInCurrSetupPos( const std::string& sTcPos, STRVECTOR& vsTools) override ; bool GetToolsInCurrSetupPos( const std::string& sTcPos, STRVECTOR& vsTools) override ;
bool UpdateCurrSetup( void) override ; bool UpdateCurrSetup( void) override ;
bool EraseCurrSetup( void) override ; bool EraseCurrSetup( void) override ;
@@ -305,9 +301,8 @@ class MachMgr : public IMachMgr
bool GetMachiningEndPoint( Point3d& ptEnd) const override ; bool GetMachiningEndPoint( Point3d& ptEnd) const override ;
// CL Entities Interrogations // CL Entities Interrogations
bool GetClEntMove( int nEntId, int& nMove) const override ; bool GetClEntMove( int nEntId, int& nMove) const override ;
bool GetClEntFlag( int nEntId, int& nFlag, int& nFlag2) const override ; bool GetClEntFlag( int nEntId, int& nFlag) const override ;
bool GetClEntIndex( int nEntId, int& nIndex) const override ; bool GetClEntIndex( int nEntId, int& nIndex) const override ;
bool GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const override ;
// Simulation // Simulation
bool SimInit( void) override ; bool SimInit( void) override ;
bool SimStart( bool bFirst) override ; bool SimStart( bool bFirst) override ;
@@ -326,7 +321,6 @@ class MachMgr : public IMachMgr
// Machine Calc // Machine Calc
bool SetCalcTable( const std::string& sTable) override ; bool SetCalcTable( const std::string& sTable) override ;
bool SetCalcTool( const std::string& sTool, const std::string& sHead, int nExit) override ; bool SetCalcTool( const std::string& sTool, const std::string& sHead, int nExit) override ;
bool GetAllCurrAxesName( STRVECTOR& vAxName) const override ;
bool SetRotAxisBlock( const std::string& sAxis, double dVal) override ; bool SetRotAxisBlock( const std::string& sAxis, double dVal) override ;
bool GetRotAxisBlocked( int nInd, std::string& sAxis, double& dVal) const override ; bool GetRotAxisBlocked( int nInd, std::string& sAxis, double& dVal) const override ;
bool GetCalcTool( std::string& sTool) const override ; bool GetCalcTool( std::string& sTool) const override ;
@@ -436,6 +430,7 @@ class MachMgr : public IMachMgr
// MachineCalc // MachineCalc
int GetCurrLinAxes( void) const ; int GetCurrLinAxes( void) const ;
int GetCurrRotAxes( void) const ; int GetCurrRotAxes( void) const ;
bool GetAllCurrAxesName( STRVECTOR& vAxName) const ;
bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ; bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ;
bool GetCurrAxisHomePos( int nInd, double& dHome) const ; bool GetCurrAxisHomePos( int nInd, double& dHome) const ;
const Frame3d& GetCurrLinAxesFrame( void) const ; const Frame3d& GetCurrLinAxesFrame( void) const ;
+4 -24
View File
@@ -1,7 +1,7 @@
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// EgalTech 2019-2023 // EgalTech 2019-2019
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// File : MachMgrClEntities.cpp Data : 27.10.23 Versione : 2.5j4 // File : MachMgrClEntities.cpp Data : 15.10.19 Versione : 2.1j4
// Contenuto : Implementazione interrogazione entità CL della classe MachMgr. // Contenuto : Implementazione interrogazione entità CL della classe MachMgr.
// //
// //
@@ -39,11 +39,10 @@ MachMgr::GetClEntMove( int nEntId, int& nMove) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::GetClEntFlag( int nEntId, int& nFlag, int& nFlag2) const MachMgr::GetClEntFlag( int nEntId, int& nFlag) const
{ {
// default // default
nFlag = 0 ; nFlag = 0 ;
nFlag2 = 0 ;
// verifico validita GeomDB // verifico validita GeomDB
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
return false ; return false ;
@@ -51,9 +50,8 @@ MachMgr::GetClEntFlag( int nEntId, int& nFlag, int& nFlag2) const
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ; const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr) if ( pCamData == nullptr)
return false ; return false ;
// recupero i flag // recupero il flag
nFlag = pCamData->GetFlag() ; nFlag = pCamData->GetFlag() ;
nFlag2 = pCamData->GetFlag2() ;
return true ; return true ;
} }
@@ -74,21 +72,3 @@ MachMgr::GetClEntIndex( int nEntId, int& nIndex) const
nIndex = pCamData->GetIndex() ; nIndex = pCamData->GetIndex() ;
return true ; return true ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::GetClEntAxesVal( int nEntId, DBLVECTOR& vAxes) const
{
// default
vAxes.clear() ;
// verifico validita GeomDB
if ( m_pGeomDB == nullptr)
return false ;
// recupero l'oggetto CamData
const CamData* pCamData = GetCamData( m_pGeomDB->GetUserObj( nEntId)) ;
if ( pCamData == nullptr)
return false ;
// recupero i valori degli assi
vAxes = pCamData->GetAxesVal() ;
return true ;
}
+1 -14
View File
@@ -631,8 +631,6 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
pTdata->GetParam( TPA_TOTDIAM, dTotDiam) ; pTdata->GetParam( TPA_TOTDIAM, dTotDiam) ;
double dDist = 0 ; double dDist = 0 ;
pTdata->GetParam( TPA_DIST, dDist) ; pTdata->GetParam( TPA_DIST, dDist) ;
double dStemDiam = 0 ;
pTdata->GetParam( TPA_STEMDIAM, dStemDiam) ;
double dMaxMat = 0 ; double dMaxMat = 0 ;
pTdata->GetParam( TPA_MAXMAT, dMaxMat) ; pTdata->GetParam( TPA_MAXMAT, dMaxMat) ;
double dCornRad = 0 ; double dCornRad = 0 ;
@@ -696,7 +694,6 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.LEN", dLen) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.LEN", dLen) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.TOTDIAM", dTotDiam) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.TOTDIAM", dTotDiam) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.DIAM", dDiam) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.STEMDIAM", dStemDiam) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.MAXMAT", dMaxMat) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.MAXMAT", dMaxMat) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.HEIGHT", dThick) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.HEIGHT", dThick) ;
bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SIDEANG", dSideAng) ; bOk = bOk && ExeLuaSetGlobNumVar( "TOOL.SIDEANG", dSideAng) ;
@@ -721,7 +718,7 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
if ( ! ExeLuaGetGlobIntVar( "TOOL.ERR", &nErr) || nErr != 0) if ( ! ExeLuaGetGlobIntVar( "TOOL.ERR", &nErr) || nErr != 0)
return nErr ; return nErr ;
// Se per salvataggio // Se per salvataggio
if ( bOk && bToSave) { if ( bOk && bToSave) {
// Nascondo layer ausiliario // Nascondo layer ausiliario
int nAuxId = ExeGetFirstNameInGroup( ExeGetFirstGroupInGroup( GDB_ID_ROOT), "AUX") ; int nAuxId = ExeGetFirstNameInGroup( ExeGetFirstGroupInGroup( GDB_ID_ROOT), "AUX") ;
ExeSetStatus( { nAuxId}, GDB_ST_OFF) ; ExeSetStatus( { nAuxId}, GDB_ST_OFF) ;
@@ -731,16 +728,6 @@ MachMgr::UpdateStandardToolDraw( const ToolData* pTdata, int nGenCtx, int nToolC
ExeRotate( { nPartId}, ORIG, Z_AX, -90, RTY_GLOB) ; ExeRotate( { nPartId}, ORIG, Z_AX, -90, RTY_GLOB) ;
} }
} }
// altrimenti per visualizzazione
else if ( bOk) {
// Nascondo oggetto/i Carter
int nSolidId = ExeGetFirstNameInGroup( ExeGetFirstGroupInGroup( GDB_ID_ROOT), "SOLID") ;
int nCarterId = ExeGetFirstNameInGroup( nSolidId, "Carter") ;
while ( nCarterId != GDB_ID_NULL) {
ExeSetStatus( { nCarterId}, GDB_ST_OFF) ;
nCarterId = ExeGetNextName( nCarterId, "Carter") ;
}
}
return ( bOk ? 0 : TD_INT_ERR) ; return ( bOk ? 0 : TD_INT_ERR) ;
} }
+3 -49
View File
@@ -182,52 +182,6 @@ MachMgr::AddMachGroup( const string& sName, const string& sMachineName)
return nNewId ; return nNewId ;
} }
//----------------------------------------------------------------------------
int
MachMgr::CopyMachGroup( const string& sSouName, const string& sName)
{
// recupero il gruppo sorgente
int nSouMGrpId = GetMachGroupId( sSouName) ;
if ( nSouMGrpId == GDB_ID_NULL)
return GDB_ID_NULL ;
// verifico esista la sua macchina
string sMachineName ;
m_pGeomDB->GetInfo( nSouMGrpId, MACH_MACHINE_KEY, sMachineName) ;
if ( sMachineName.empty() || ! LoadMachine( sMachineName))
return GDB_ID_NULL ;
// verifico nome nuovo gruppo (non deve essere vuoto e non deve esserci già un gruppo con questo nome)
if ( &sName == nullptr || sName.empty() || GetMachGroupId( sName) != GDB_ID_NULL)
return GDB_ID_NULL ;
// reset gruppo corrente
ResetCurrMachGroup() ;
// eseguo la copia del gruppo sorgente e la metto in coda
int nNewMGrpId = m_pGeomDB->Copy( nSouMGrpId, GDB_ID_NULL, m_nMachBaseId) ;
if ( nNewMGrpId == GDB_ID_NULL)
return GDB_ID_NULL ;
// assegno il nome
m_pGeomDB->SetName( nNewMGrpId, sName) ;
// converto opportunamente gli indicativi dei grezzi nelle disposizioni
int nSouRawPartId = m_pGeomDB->GetFirstGroupInGroup( m_pGeomDB->GetFirstNameInGroup( nSouMGrpId, MACH_RAW_GROUP)) ;
int nNewRawPartId = m_pGeomDB->GetFirstGroupInGroup( m_pGeomDB->GetFirstNameInGroup( nNewMGrpId, MACH_RAW_GROUP)) ;
while ( nSouRawPartId != GDB_ID_NULL && nNewRawPartId != GDB_ID_NULL) {
// ciclo sulle disposizioni del nuovo gruppo di lavoro
int nOperId = m_pGeomDB->GetFirstGroupInGroup( m_pGeomDB->GetFirstNameInGroup( nNewMGrpId, MACH_OPER_GROUP)) ;
while ( nOperId != GDB_ID_NULL) {
Disposition* pDisp = GetDisposition( m_pGeomDB->GetUserObj( nOperId)) ;
if ( pDisp != nullptr)
pDisp->UpdateRawPartId( nSouRawPartId, nNewRawPartId) ;
nOperId = m_pGeomDB->GetNextGroup( nOperId) ;
}
// passo alla coppia successiva
nSouRawPartId = m_pGeomDB->GetNextGroup( nSouRawPartId) ;
nNewRawPartId = m_pGeomDB->GetNextGroup( nNewRawPartId) ;
}
// lo rendo corrente
SetCurrMachGroup( nNewMGrpId) ;
// restituisco l'identificativo del gruppo
return nNewMGrpId ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::RemoveMachGroup( int nId) MachMgr::RemoveMachGroup( int nId)
@@ -344,14 +298,14 @@ MachMgr::GetMachGroupId( const string& sName) const
{ {
// verifica dei parametri // verifica dei parametri
if ( &sName == nullptr || sName.empty()) if ( &sName == nullptr || sName.empty())
return GDB_ID_NULL ; return false ;
// verifica del gruppo base per le lavorazioni // verifica del gruppo base per le lavorazioni
if ( ! VerifyMachBase()) if ( ! VerifyMachBase())
return GDB_ID_NULL ; return false ;
// recupero l'identificativo del gruppo con il nome indicato // recupero l'identificativo del gruppo con il nome indicato
PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ; PtrOwner<IGdbIterator> pIter( CreateGdbIterator( m_pGeomDB)) ;
if ( IsNull( pIter)) if ( IsNull( pIter))
return GDB_ID_NULL ; return false ;
bool bIter = pIter->GoToFirstGroupInGroup( m_nMachBaseId) ; bool bIter = pIter->GoToFirstGroupInGroup( m_nMachBaseId) ;
while( bIter) { while( bIter) {
// verifico il nome // verifico il nome
+1 -1
View File
@@ -356,7 +356,7 @@ bool
MachMgr::SetAxisPos( const string& sAxis, double dVal, double* pdNewVal) MachMgr::SetAxisPos( const string& sAxis, double dVal, double* pdNewVal)
{ {
Machine* pMch = GetCurrMachine() ; Machine* pMch = GetCurrMachine() ;
return ( ( pMch != nullptr) ? pMch->SetAxisPos( sAxis, dVal, true, pdNewVal) : false) ; return ( ( pMch != nullptr) ? pMch->SetAxisPos( sAxis, dVal, pdNewVal) : false) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
-1
View File
@@ -625,7 +625,6 @@ MachMgr::VerifyRawPartPhase( int nRawId, int nPhase) const
INTVECTOR vPhase ; INTVECTOR vPhase ;
if ( ! GetRawPartPhases( nRawId, vPhase)) if ( ! GetRawPartPhases( nRawId, vPhase))
return false ; return false ;
// verifico presenza nella fase indicata
return ( find( vPhase.begin(), vPhase.end(), nPhase) != vPhase.end()) ; return ( find( vPhase.begin(), vPhase.end(), nPhase) != vPhase.end()) ;
} }
-7
View File
@@ -130,13 +130,6 @@ MachMgr::FindToolInCurrSetup( const string& sTool)
return m_stuMgr.FindTool( sTool) ; return m_stuMgr.FindTool( sTool) ;
} }
//----------------------------------------------------------------------------
bool
MachMgr::GetToolSetupPosInCurrSetup( const string& sTool, string& sTcPos)
{
return m_stuMgr.GetToolSetupPos( sTool, sTcPos) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
MachMgr::GetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools) MachMgr::GetToolsInCurrSetupPos( const string& sTcPos, STRVECTOR& vsTools)
+7 -69
View File
@@ -441,16 +441,8 @@ Machine::ModifyMachineAxisPosition( const string& sName, const Point3d& ptPos)
Axis* pAx = GetAxis( nAxGrp) ; Axis* pAx = GetAxis( nAxGrp) ;
if ( pAx == nullptr) if ( pAx == nullptr)
return false ; return false ;
// se valore dell'asse non nullo, lo annullo
double dCurrVal = pAx->GetCurrVal() ;
if ( abs( dCurrVal) > EPS_ZERO)
SetAxisPos( sName, 0, false) ;
// eseguo la modifica // eseguo la modifica
bool bOk = pAx->Modify( ptPos, m_dAxisMaxAdjust) ; return pAx->Modify( ptPos, m_dAxisMaxAdjust) ;
// ripristino l'asse al valore corrente
if ( abs( dCurrVal) > EPS_ZERO)
SetAxisPos( sName, dCurrVal, false) ;
return bOk ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -466,16 +458,8 @@ Machine::ModifyMachineAxisDirection( const string& sName, const Vector3d& vtDir)
Axis* pAx = GetAxis( nAxGrp) ; Axis* pAx = GetAxis( nAxGrp) ;
if ( pAx == nullptr) if ( pAx == nullptr)
return false ; return false ;
// se valore dell'asse non nullo, lo annullo
double dCurrVal = pAx->GetCurrVal() ;
if ( abs( dCurrVal) > EPS_ZERO)
SetAxisPos( sName, 0, false) ;
// eseguo la modifica // eseguo la modifica
bool bOk = pAx->Modify( vtDir, m_dAxisMaxRotAdj) ; return pAx->Modify( vtDir, m_dAxisMaxRotAdj) ;
// ripristino l'asse al valore corrente
if ( abs( dCurrVal) > EPS_ZERO)
SetAxisPos( sName, dCurrVal, false) ;
return bOk ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -659,9 +643,9 @@ Machine::LoadMachineSpecialHead( const string& sName, const string& sParent, con
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::LoadMachineStdTcPos( const string& sName, const string& sParent, Machine::LoadMachineTcPos( const string& sName, const string& sParent,
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir, const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
const string& sGeo, const STRVECTOR& vsAux) const string& sGeo, const STRVECTOR& vsAux)
{ {
// recupero pezzo e layer della geometria originale della posizione nel cambio utensile // recupero pezzo e layer della geometria originale della posizione nel cambio utensile
string sPart, sLay ; string sPart, sLay ;
@@ -701,48 +685,6 @@ Machine::LoadMachineStdTcPos( const string& sName, const string& sParent,
return m_mapGroups.emplace( sName, nLay).second ; return m_mapGroups.emplace( sName, nLay).second ;
} }
//----------------------------------------------------------------------------
bool
Machine::LoadMachineMultiTcPos( const string& sName, const string& sParent,
const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
const string& sGeo, const STRVECTOR& vsAux)
{
// recupero pezzo e layer della geometria originale della posizione nel cambio utensile
string sPart, sLay ;
Split( sGeo, "/", true, sPart, sLay) ;
// cerco il gruppo nella geometria originale
int nPart = m_pGeomDB->GetFirstNameInGroup( m_nTempGroupId, sPart) ;
int nLay = m_pGeomDB->GetFirstNameInGroup( nPart, sLay) ;
if ( nLay == GDB_ID_NULL)
return false ;
// cerco il gruppo padre per spostarvelo
int nParentId = GetGroup( sParent) ;
if ( nParentId == GDB_ID_NULL ||
! m_pGeomDB->RelocateGlob( nLay, nParentId, GDB_LAST_SON))
return false ;
// sistemo lo stato di visualizzazione
m_pGeomDB->SetStatus( nLay, GDB_ST_ON) ;
// gli assegno il nome
m_pGeomDB->SetName( nLay, sName) ;
// sistemo la geometria ausiliaria
if ( ! AdjustAuxGeometry( vsAux, nLay))
return false ;
// installo e inizializzo il gestore della posizione nel cambio utensile
TcPos* pTcPos = new(nothrow) TcPos ;
if ( pTcPos == nullptr)
return false ;
pTcPos->Set( sName, vtADir) ;
m_pGeomDB->SetUserObj( nLay, pTcPos) ;
// sistemo il riferimento dell'uscita rispetto alla direzione ausiliaria
if ( ! AdjustExitFrames( nLay, vMuExit, vtADir))
return false ;
// trasformazione del riferimento di uscita in gruppo di uscita
if ( ! CreateExitGroups( nLay, vMuExit))
return false ;
// lo inserisco nel dizionario dei gruppi della macchina
return m_mapGroups.emplace( sName, nLay).second ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
Machine::GetGroup( const string& sGroup) const Machine::GetGroup( const string& sGroup) const
@@ -976,7 +918,7 @@ Machine::CreateExitGroups( int nLay, const MUEXITVECTOR& vMuExit)
return false ; return false ;
} }
else { else {
Vector3d vtRotAx = vtTDir ^ vtDirN ; vtRotAx.Normalize( EPS_ZERO) ; Vector3d vtRotAx = vtTDir ^ vtDirN ; vtRotAx.Normalize() ;
string sOut = " Exit " + sName + " rotation = (" + ToString( dAngRot) + "/" + ToString( vtRotAx) + ")" ; string sOut = " Exit " + sName + " rotation = (" + ToString( dAngRot) + "/" + ToString( vtRotAx) + ")" ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ; LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) ;
vtRotAx.ToLoc( frHead) ; vtRotAx.ToLoc( frHead) ;
@@ -1034,11 +976,7 @@ Machine::ModifyMachineExitPosition( const string& sHead, int nExit, const Point3
if ( pExit == nullptr) if ( pExit == nullptr)
return false ; return false ;
// eseguo la modifica // eseguo la modifica
if ( ! pExit->Modify( ptPos, m_dExitMaxAdjust)) return pExit->Modify( ptPos, m_dExitMaxAdjust) ;
return false ;
// eventuale aggiornamento variabile lua EMC.EXITPOS con la nuova posizione
LuaSetGlobVar( "EMC.EXITPOS", ptPos) ;
return true ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
+5 -12
View File
@@ -81,7 +81,7 @@ class Machine
bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const ; bool GetAxisInvert( const std::string& sAxis, bool& bInvert) const ;
bool GetAxisOffset( const std::string& sAxis, double& dOffset) const ; bool GetAxisOffset( const std::string& sAxis, double& dOffset) const ;
bool GetAxisType( const std::string& sAxis, bool& bLinear) const ; bool GetAxisType( const std::string& sAxis, bool& bLinear) const ;
bool SetAxisPos( const std::string& sAxis, double dVal, bool bInStroke = true, double* pdNewVal = nullptr) ; bool SetAxisPos( const std::string& sAxis, double dVal, double* pdNewVal = nullptr) ;
bool GetAxisPos( const std::string& sAxis, double& dVal) const ; bool GetAxisPos( const std::string& sAxis, double& dVal) const ;
bool GetAxisMin( const std::string& sAxis, double& dMin) const ; bool GetAxisMin( const std::string& sAxis, double& dMin) const ;
bool GetAxisMax( const std::string& sAxis, double& dMax) const ; bool GetAxisMax( const std::string& sAxis, double& dMax) const ;
@@ -95,7 +95,7 @@ class Machine
bool GetCurrTableRef1( Point3d& ptRef1) const ; bool GetCurrTableRef1( Point3d& ptRef1) const ;
bool GetCurrTableArea1( BBox3d& b3Area1) const ; bool GetCurrTableArea1( BBox3d& b3Area1) const ;
bool GetCurrTableDeltaRef1( Vector3d& vtDelta1) const ; bool GetCurrTableDeltaRef1( Vector3d& vtDelta1) const ;
bool GetCurrTableIsTilting( bool& bTilting, Vector3d& vtTiltingAx) const ; bool GetCurrTableIsTilting( bool& bTilting) const ;
bool SetCurrTool( const std::string& sTool, const std::string& sHead, int nExit) ; bool SetCurrTool( const std::string& sTool, const std::string& sHead, int nExit) ;
bool ResetCurrTool( void) ; bool ResetCurrTool( void) ;
int GetCurrTool( void) const ; int GetCurrTool( void) const ;
@@ -125,8 +125,6 @@ class Machine
bool GetAllCurrAxesToken( STRVECTOR& vAxToken) const ; bool GetAllCurrAxesToken( STRVECTOR& vAxToken) const ;
bool GetCurrAxisMin( int nInd, double& dMin) const ; bool GetCurrAxisMin( int nInd, double& dMin) const ;
bool GetCurrAxisMax( int nInd, double& dMax) 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 GetCurrAxisHomePos( int nInd, double& dHome) const ;
bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ; bool GetAllCurrAxesHomePos( DBLVECTOR& vAxHomeVal) const ;
const Frame3d& GetCurrLinAxesFrame( void) const const Frame3d& GetCurrLinAxesFrame( void) const
@@ -215,12 +213,9 @@ class Machine
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir, const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl, double dRot1W, bool bMaxDeltaR2On1, const STROKE& Rot2Stroke, int nSolCh, const STRVECTOR& vsOthColl,
const std::string& sGeo, const STRVECTOR& vsAux) ; const std::string& sGeo, const STRVECTOR& vsAux) ;
bool LoadMachineStdTcPos( const std::string& sName, const std::string& sParent, bool LoadMachineTcPos( const std::string& sName, const std::string& sParent,
const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir, const Point3d& ptPos, const Vector3d& vtTDir, const Vector3d& vtADir,
const std::string& sGeo, const STRVECTOR& vsAux) ; const std::string& sGeo, const STRVECTOR& vsAux) ;
bool LoadMachineMultiTcPos( const std::string& sName, const std::string& sParent,
const MUEXITVECTOR& vMuExit, const Vector3d& vtADir,
const std::string& sGeo, const STRVECTOR& vsAux) ;
int GetGroup( const std::string& sGroup) const ; int GetGroup( const std::string& sGroup) const ;
bool IsBaseGroup( int nGroup) const ; bool IsBaseGroup( int nGroup) const ;
Axis* GetAxis( int nGroup) const ; Axis* GetAxis( int nGroup) const ;
@@ -328,8 +323,6 @@ class Machine
static int LuaEmtMultiHead( lua_State* L) ; static int LuaEmtMultiHead( lua_State* L) ;
static int LuaEmtSpecialHead( lua_State* L) ; static int LuaEmtSpecialHead( lua_State* L) ;
static int LuaEmtTcPos( lua_State* L) ; static int LuaEmtTcPos( lua_State* L) ;
static int LuaEmtStdTcPos( lua_State* L) ;
static int LuaEmtMultiTcPos( lua_State* L) ;
static int LuaEmtModifyAxisPosition( lua_State* L) ; static int LuaEmtModifyAxisPosition( lua_State* L) ;
static int LuaEmtModifyAxisDirection( lua_State* L) ; static int LuaEmtModifyAxisDirection( lua_State* L) ;
static int LuaEmtModifyAxisStroke( lua_State* L) ; static int LuaEmtModifyAxisStroke( lua_State* L) ;
+5 -3
View File
@@ -19,7 +19,6 @@
#include "/EgtDev/Include/EGkGeoVector3d.h" #include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGnStringUtils.h" #include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EgtNumUtils.h"
using namespace std ; using namespace std ;
@@ -89,7 +88,7 @@ Machine::GetAxisType( const string& sAxis, bool& bLinear) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::SetAxisPos( const string& sAxis, double dVal, bool bInStroke, double* pdNewVal) Machine::SetAxisPos( const string& sAxis, double dVal, double* pdNewVal)
{ {
// controllo GeomDB // controllo GeomDB
if ( m_pGeomDB == nullptr) if ( m_pGeomDB == nullptr)
@@ -115,7 +114,10 @@ Machine::SetAxisPos( const string& sAxis, double dVal, bool bInStroke, double* p
Vector3d vtDir = pGV->GetVector() ; Vector3d vtDir = pGV->GetVector() ;
vtDir.Normalize() ; vtDir.Normalize() ;
// limito il movimento alla corsa dell'asse // limito il movimento alla corsa dell'asse
dVal = Clamp( dVal, Stroke.Min, Stroke.Max) ; if ( dVal > Stroke.Max)
dVal = Stroke.Max ;
else if ( dVal < Stroke.Min)
dVal = Stroke.Min ;
// eseguo il movimento // eseguo il movimento
if ( bLinear) if ( bLinear)
m_pGeomDB->TranslateGroup( nAxGrp, vtDir * ( dVal - dCurrVal)) ; m_pGeomDB->TranslateGroup( nAxGrp, vtDir * ( dVal - dCurrVal)) ;
+14 -75
View File
@@ -24,13 +24,11 @@
#include "/EgtDev/Include/EGkGeoVector3d.h" #include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGnStringUtils.h" #include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EGnFileUtils.h" #include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EgtNumUtils.h"
using namespace std ; using namespace std ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo static const string EMC_VAR = "EMC" ; // tabella variabili locali per calcolo
static const string EVAR_VER = ".VER" ; // (string) versione della Dll
static const string EVAR_TABNAME = ".TABNAME" ; // (string) nome della tavola macchina static const string EVAR_TABNAME = ".TABNAME" ; // (string) nome della tavola macchina
static const string EVAR_HEAD = ".HEAD" ; // (string) nome della testa static const string EVAR_HEAD = ".HEAD" ; // (string) nome della testa
static const string EVAR_EXIT = ".EXIT" ; // (int) numero dell'uscita static const string EVAR_EXIT = ".EXIT" ; // (int) numero dell'uscita
@@ -39,7 +37,6 @@ static const string EVAR_TOTDIAM = ".TOTDIAM" ; // (num) diametro di in
static const string EVAR_TOTLEN = ".TOTLEN" ; // (num) lunghezza di ingombro dell'utensile static const string EVAR_TOTLEN = ".TOTLEN" ; // (num) lunghezza di ingombro dell'utensile
static const string EVAR_DIST = ".DIST" ; // (num) distanza dell'utensile (per seghe a catena) static const string EVAR_DIST = ".DIST" ; // (num) distanza dell'utensile (per seghe a catena)
static const string EVAR_EXITPOS = ".EXITPOS" ; // (point) posizione attuale dell'uscita static const string EVAR_EXITPOS = ".EXITPOS" ; // (point) posizione attuale dell'uscita
static const string EVAR_USERNOTES = ".USERNOTES" ; // (string) note utente dell'utensile
static const string EVAR_TCPOS = ".TCPOS" ; // (string) posizione nell'attrezzaggio static const string EVAR_TCPOS = ".TCPOS" ; // (string) posizione nell'attrezzaggio
static const string EVAR_L1 = ".L1" ; // (num) valore del primo asse lineare static const string EVAR_L1 = ".L1" ; // (num) valore del primo asse lineare
static const string EVAR_L2 = ".L2" ; // (num) valore del secondo asse lineare static const string EVAR_L2 = ".L2" ; // (num) valore del secondo asse lineare
@@ -77,7 +74,6 @@ Machine::SetCurrTable( const string& sTable)
bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ; bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ;
// definisco variabili // definisco variabili
bool bOk = LuaCreateGlobTable( EMC_VAR) ; bool bOk = LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_VER, GetEMkVer()) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TABNAME, sTable) ; bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TABNAME, sTable) ;
// chiamo funzione // chiamo funzione
bOk = bOk && LuaCallFunction( ON_SET_TABLE) ; bOk = bOk && LuaCallFunction( ON_SET_TABLE) ;
@@ -171,23 +167,17 @@ Machine::GetCurrTableDeltaRef1( Vector3d& vtDelta1) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Machine::GetCurrTableIsTilting( bool& bTilting, Vector3d& vtTiltingAx) const Machine::GetCurrTableIsTilting( bool& bTilting) const
{ {
// default // default
bTilting = false ; bTilting = false ;
vtTiltingAx = V_NULL ;
// verifico esistenza tavola // verifico esistenza tavola
if ( m_nCalcTabId == GDB_ID_NULL) if ( m_nCalcTabId == GDB_ID_NULL)
return false ; return false ;
// verifico se presente flag che lo forza come tale // verifico se presente flag che lo forza come tale
int nTiltingLike ; bool bTiltingLike ;
if ( m_pGeomDB->GetInfo( m_nCalcTabId, MCH_TILTINGLIKE, nTiltingLike) && nTiltingLike != 0) { if ( m_pGeomDB->GetInfo( m_nCalcTabId, MCH_TILTINGLIKE, bTiltingLike) && bTiltingLike) {
bTilting = true ; bTilting = true ;
switch ( abs( nTiltingLike)) {
default : vtTiltingAx = X_AX ; break ;
case 2 : vtTiltingAx = Y_AX ; break ;
case 3 : vtTiltingAx = Z_AX ; break ;
}
return true ; return true ;
} }
// recupero gli eventuali assi rotanti della tavola // recupero gli eventuali assi rotanti della tavola
@@ -202,7 +192,6 @@ Machine::GetCurrTableIsTilting( bool& bTilting, Vector3d& vtTiltingAx) const
// verifico se asse rotante orizzontale // verifico se asse rotante orizzontale
if ( pAx->GetType() == MCH_AT_ROTARY && abs( pAx->GetDir().z) < EPS_SMALL) { if ( pAx->GetType() == MCH_AT_ROTARY && abs( pAx->GetDir().z) < EPS_SMALL) {
bTilting = true ; bTilting = true ;
vtTiltingAx = pAx->GetDir() ;
return true ; return true ;
} }
// risalgo lungo la catena // risalgo lungo la catena
@@ -249,7 +238,6 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
double dTOvLen = 0 ; double dTOvLen = 0 ;
double dTOvDiam = 0 ; double dTOvDiam = 0 ;
double dTDist = 0 ; double dTDist = 0 ;
string sTUserNotes = "" ;
string sTcPos = "" ; string sTcPos = "" ;
// se definito // se definito
if ( ! sTool.empty()) { if ( ! sTool.empty()) {
@@ -268,8 +256,7 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
! m_pMchMgr->TdbGetCurrToolParam( TPA_LEN, dTLen) || ! m_pMchMgr->TdbGetCurrToolParam( TPA_LEN, dTLen) ||
! m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, dTDiam) || ! m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, dTDiam) ||
! m_pMchMgr->TdbGetCurrToolParam( TPA_TOTLEN, dTOvLen) || ! m_pMchMgr->TdbGetCurrToolParam( TPA_TOTLEN, dTOvLen) ||
! m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, dTOvDiam) || ! m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, dTOvDiam))
! m_pMchMgr->TdbGetCurrToolParam( TPA_USERNOTES, sTUserNotes))
return false ; return false ;
m_pMchMgr->TdbGetCurrToolParam( TPA_DIST, dTDist) ; // opzionale m_pMchMgr->TdbGetCurrToolParam( TPA_DIST, dTDist) ; // opzionale
if ( ! m_pMchMgr->GetCurrSetupMgr().GetToolSetupPos( sTool, sTcPos)) if ( ! m_pMchMgr->GetCurrSetupMgr().GetToolSetupPos( sTool, sTcPos))
@@ -309,7 +296,6 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ; bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ;
// definisco variabili // definisco variabili
bool bOk = LuaCreateGlobTable( EMC_VAR) ; bool bOk = LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_VER, GetEMkVer()) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_HEAD, sHead) ; bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_HEAD, sHead) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_EXIT, nExit) ; bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_EXIT, nExit) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TOOL, sTool) ; bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TOOL, sTool) ;
@@ -317,7 +303,6 @@ Machine::SetCurrTool( const string& sTool, const string& sHead, int nExit)
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TOTDIAM, dTOvDiam) ; bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TOTDIAM, dTOvDiam) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TOTLEN, dTOvLen) ; bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TOTLEN, dTOvLen) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_DIST, dTDist) ; bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_DIST, dTDist) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_USERNOTES, sTUserNotes) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TCPOS, sTcPos) ; bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_TCPOS, sTcPos) ;
// chiamo funzione // chiamo funzione
bOk = bOk && LuaCallFunction( ON_SET_HEAD) ; bOk = bOk && LuaCallFunction( ON_SET_HEAD) ;
@@ -502,10 +487,8 @@ Machine::CalculateKinematicChain( void)
m_vCalcLinAx[i].nInd *= -1 ; m_vCalcLinAx[i].nInd *= -1 ;
} }
// devono essere 3 // devono essere 3
if ( m_vCalcLinAx.size() != 3) { if ( m_vCalcLinAx.size() != 3)
LOG_ERROR( GetEMkLogger(), "Linear Axes are not 3 in number")
return false ; return false ;
}
// devono essere ordinabili come XYZ // devono essere ordinabili come XYZ
if ( ! m_vCalcLinAx[0].vtDir.IsX()) { if ( ! m_vCalcLinAx[0].vtDir.IsX()) {
if ( m_vCalcLinAx[1].vtDir.IsX()) if ( m_vCalcLinAx[1].vtDir.IsX())
@@ -968,8 +951,8 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
vtAx2.Invert() ; vtAx2.Invert() ;
// calcolo secondo angolo di rotazione // calcolo secondo angolo di rotazione
nStat = GetRotationComponent( vtDirHn, dCompTSuAxR1, vtAx1, vtAx2, dAngB1, dAngB2, bDet) ; nStat = GetRotationComponent( vtDirHn, dCompTSuAxR1, vtAx1, vtAx2, dAngB1, dAngB2, bDet) ;
// se indeterminato, provo ricalcolo con direzione aux // se indeterminato con richiesta direzione ausiliaria esatta, ricalcolo con direzione aux
if ( nStat >= 1 && ! bDet) { if ( nStat >= 1 && ! bDet && m_bSolChExact) {
// componente versore ausiliario desiderato su direzione primo asse rotante // componente versore ausiliario desiderato su direzione primo asse rotante
Vector3d vtSccDir ; Vector3d vtSccDir ;
if ( GetSccDir( m_nCalcSolCh, vtDirAn, vtSccDir)) { if ( GetSccDir( m_nCalcSolCh, vtDirAn, vtSccDir)) {
@@ -1019,7 +1002,7 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
// calcolo primo angolo di rotazione per seconda soluzione // calcolo primo angolo di rotazione per seconda soluzione
bool bDet2 = true ; bool bDet2 = true ;
if ( nStat == 2) { if ( nStat == 2) {
if ( ! vtDirH2.GetRotation( vtDirTn, vtAx1, SIN_EPS_ANG_SMALL, dAngA2, bDet2)) if ( ! vtDirH2.GetRotation( vtDirTn, vtAx1, dAngA2, bDet2) )
nStat = 1 ; nStat = 1 ;
else { else {
// se indeterminato, provo a determinarlo con la direzione ausiliaria // se indeterminato, provo a determinarlo con la direzione ausiliaria
@@ -1042,7 +1025,7 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
// calcolo primo angolo di rotazione per prima soluzione // calcolo primo angolo di rotazione per prima soluzione
bool bDet1 = true ; bool bDet1 = true ;
if ( nStat >= 1) { if ( nStat >= 1) {
if ( ! vtDirH1.GetRotation( vtDirTn, vtAx1, SIN_EPS_ANG_SMALL, dAngA1, bDet1)) if ( ! vtDirH1.GetRotation( vtDirTn, vtAx1, dAngA1, bDet1) )
nStat = 0 ; nStat = 0 ;
else { else {
// se indeterminato, provo a determinarlo con la direzione ausiliaria // se indeterminato, provo a determinarlo con la direzione ausiliaria
@@ -1087,7 +1070,7 @@ Machine::GetMyAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
} }
if ( nStat >= 1) { if ( nStat >= 1) {
// se non riesco ad aggiustare, elimino // se non riesco ad aggiustare, elimino
if ( ( bDet1 && ! AdjustAngleInStroke( RotAx1.stroke, dAngA1)) || if ( ! AdjustAngleInStroke( RotAx1.stroke, dAngA1) ||
( nNumRotAx == 2 && ! AdjustAngleInStroke( RotAx2.stroke, dAngB1))) { ( nNumRotAx == 2 && ! AdjustAngleInStroke( RotAx2.stroke, dAngB1))) {
-- nStat ; -- nStat ;
// riloco eventuale soluzione rimasta // riloco eventuale soluzione rimasta
@@ -1491,7 +1474,10 @@ Machine::LimitAngleToStroke( int nInd, double& dAng) const
if ( nInd < 0 || nInd >= int( m_vCalcRotAx.size())) if ( nInd < 0 || nInd >= int( m_vCalcRotAx.size()))
return true ; return true ;
// se angolo fuori corsa, lo porto all'estremo più vicino // se angolo fuori corsa, lo porto all'estremo più vicino
dAng = Clamp( dAng, m_vCalcRotAx[nInd].stroke.Min, m_vCalcRotAx[nInd].stroke.Max) ; if ( dAng < m_vCalcRotAx[nInd].stroke.Min)
dAng = m_vCalcRotAx[nInd].stroke.Min ;
else if ( dAng > m_vCalcRotAx[nInd].stroke.Max)
dAng = m_vCalcRotAx[nInd].stroke.Max ;
return true ; return true ;
} }
@@ -1586,7 +1572,6 @@ Machine::VerifyProtectedAreas( double dX, double dY, double dZ, const DBLVECTOR&
bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ; bool bOldEMC = LuaChangeNameGlobVar( EMC_VAR, EMC_VAR_BACKUP) ;
// definisco variabili // definisco variabili
bOk = bOk && LuaCreateGlobTable( EMC_VAR) ; bOk = bOk && LuaCreateGlobTable( EMC_VAR) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_VER, GetEMkVer()) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_L1, dX) ; bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_L1, dX) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_L2, dY) ; bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_L2, dY) ;
bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_L3, dZ) ; bOk = bOk && LuaSetGlobVar( EMC_VAR + EVAR_L3, dZ) ;
@@ -1835,52 +1820,6 @@ Machine::GetCurrAxisMax( int nInd, double& dMax) const
return false ; 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 bool
Machine::GetCurrAxisHomePos( int nInd, double& dHome) const Machine::GetCurrAxisHomePos( int nInd, double& dHome) const
+7 -90
View File
@@ -44,7 +44,6 @@ static const string FLD_INVERT = "Invert" ;
static const string FLD_AXIS_OFFSET = "Offset" ; static const string FLD_AXIS_OFFSET = "Offset" ;
static const string FLD_REF1 = "Ref1" ; static const string FLD_REF1 = "Ref1" ;
static const string FLD_SCALE = "Scale" ; static const string FLD_SCALE = "Scale" ;
static const string FLD_EXIT_NBR = "ExitNbr" ;
static const string FLD_POS = "Pos" ; static const string FLD_POS = "Pos" ;
static const string FLD_DIR = "Dir" ; static const string FLD_DIR = "Dir" ;
static const string FLD_STROKE = "Stroke" ; static const string FLD_STROKE = "Stroke" ;
@@ -662,7 +661,7 @@ Machine::LuaEmtMultiHead( lua_State* L)
LuaCheckTabFieldParam( L, 1, FLD_HSET, sHSet) LuaCheckTabFieldParam( L, 1, FLD_HSET, sHSet)
// lettura campo 'ExitNbr' dalla tabella // lettura campo 'ExitNbr' dalla tabella
int nExitNbr ; int nExitNbr ;
LuaCheckTabFieldParam( L, 1, FLD_EXIT_NBR, nExitNbr) LuaCheckTabFieldParam( L, 1, "ExitNbr", nExitNbr)
// lettura campi 'PosN' e 'TDirN' per ogni uscita dalla tabella // lettura campi 'PosN' e 'TDirN' per ogni uscita dalla tabella
MUEXITVECTOR vMuExit ; MUEXITVECTOR vMuExit ;
vMuExit.reserve( nExitNbr) ; vMuExit.reserve( nExitNbr) ;
@@ -677,7 +676,7 @@ Machine::LuaEmtMultiHead( lua_State* L)
// inserimento nell'array // inserimento nell'array
vMuExit.emplace_back( ptPos, vtTDir) ; vMuExit.emplace_back( ptPos, vtTDir) ;
} }
// lettura eventuale campo 'ADir' dalla tabella // lettura campo 'ADir' dalla tabella
Vector3d vtADir ; Vector3d vtADir ;
LuaGetTabFieldParam( L, 1, FLD_ADIR, vtADir) ; LuaGetTabFieldParam( L, 1, FLD_ADIR, vtADir) ;
// lettura eventuale campo 'Rot1W' dalla tabella (default 1) // lettura eventuale campo 'Rot1W' dalla tabella (default 1)
@@ -714,7 +713,7 @@ Machine::LuaEmtMultiHead( lua_State* L)
// carico i dati della testa multipla // carico i dati della testa multipla
if ( ! m_pMchLua->LoadMachineMultiHead( sName, sParent, sHSet, vMuExit, vtADir, if ( ! m_pMchLua->LoadMachineMultiHead( sName, sParent, sHSet, vMuExit, vtADir,
dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl, sGeo, vsAux)) dRot1W, bMaxDeltaR2On1, Rot2Stroke, nSolCh, vsOthColl, sGeo, vsAux))
return luaL_error( L, " Load Machine Multi Head failed") ; return luaL_error( L, " Load Machine Standard Head failed") ;
// restituisco l'indice della testa // restituisco l'indice della testa
int nHeadId = m_pMchLua->GetHeadId( sName) ; int nHeadId = m_pMchLua->GetHeadId( sName) ;
@@ -798,26 +797,6 @@ Machine::LuaEmtSpecialHead( lua_State* L)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int int
Machine::LuaEmtTcPos( lua_State* L) Machine::LuaEmtTcPos( lua_State* L)
{
// Il parametro 1 deve essere una tabella
if ( ! lua_istable( L, 1))
return luaL_error( L, " Invalid Parameter, required a table") ;
// lettura campo opzionale 'ExitNbr' dalla tabella
int nExitNbr = 1 ;
LuaGetTabFieldParam( L, 1, FLD_EXIT_NBR, nExitNbr) ;
// Procedo alla lettura a seconda del tnumero di uscite
if ( nExitNbr == 1)
return LuaEmtStdTcPos( L) ;
else if ( nExitNbr > 1)
return LuaEmtMultiTcPos( L) ;
else
return luaL_error( L, " Tc Position type unknown") ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtStdTcPos( lua_State* L)
{ {
// Il parametro 1 deve essere una tabella // Il parametro 1 deve essere una tabella
if ( ! lua_istable( L, 1)) if ( ! lua_istable( L, 1))
@@ -854,70 +833,8 @@ Machine::LuaEmtStdTcPos( lua_State* L)
return luaL_error( L, " Unknown Machine") ; return luaL_error( L, " Unknown Machine") ;
// carico i dati della posizione cambio utensile // carico i dati della posizione cambio utensile
if ( ! m_pMchLua->LoadMachineStdTcPos( sName, sParent, ptPos, vtTDir, vtADir, sGeo, vsAux)) if ( ! m_pMchLua->LoadMachineTcPos( sName, sParent, ptPos, vtTDir, vtADir, sGeo, vsAux))
return luaL_error( L, " Load Machine Standard Tc Position failed") ; return luaL_error( L, " Load Machine Tc Position failed") ;
// restituisco l'indice della posizione cambio utensile
int nTcPosId = m_pMchLua->GetTcPosId( sName) ;
if ( nTcPosId != GDB_ID_NULL)
LuaSetParam( L, nTcPosId) ;
else
LuaSetParam( L) ;
return 1 ;
}
//----------------------------------------------------------------------------
int
Machine::LuaEmtMultiTcPos( lua_State* L)
{
// Il parametro 1 deve essere una tabella
if ( ! lua_istable( L, 1))
return luaL_error( L, " Invalid Parameter, required a table") ;
// lettura campo 'Name' dalla tabella
string sName ;
LuaCheckTabFieldParam( L, 1, FLD_NAME, sName)
// lettura campo 'Parent' dalla tabella
string sParent ;
LuaCheckTabFieldParam( L, 1, FLD_PARENT, sParent)
// lettura campo 'ExitNbr' dalla tabella
int nExitNbr ;
LuaCheckTabFieldParam( L, 1, FLD_EXIT_NBR, nExitNbr)
// lettura campi 'PosN' e 'TDirN' per ogni uscita dalla tabella
MUEXITVECTOR vMuExit ;
vMuExit.reserve( nExitNbr) ;
for ( int i = 0 ; i < nExitNbr ; ++ i) {
// lettura
string sPos = FLD_POS + ToString( i + 1) ;
Point3d ptPos ;
LuaCheckTabFieldParam( L, 1, sPos.c_str(), ptPos)
string sTDir = FLD_TDIR + ToString( i + 1) ;
Vector3d vtTDir ;
LuaCheckTabFieldParam( L, 1, sTDir.c_str(), vtTDir)
// inserimento nell'array
vMuExit.emplace_back( ptPos, vtTDir) ;
}
// lettura eventuale campo 'ADir' dalla tabella
Vector3d vtADir ;
LuaGetTabFieldParam( L, 1, FLD_ADIR, vtADir) ;
// lettura campo 'Geo' dalla tabella
string sGeo ;
LuaCheckTabFieldParam( L, 1, FLD_GEO, sGeo)
// lettura eventuale campo 'Aux' dalla tabella
STRVECTOR vsAux ;
LuaGetTabFieldParam( L, 1, FLD_AUX, vsAux) ;
LuaClearStack( L) ;
// info
string sOut = "LuaEmtTcPos : " + sName ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str())
// verifico ci sia una macchina attiva
if ( m_pMchLua == nullptr)
return luaL_error( L, " Unknown Machine") ;
// carico i dati della posizione cambio utensile
if ( ! m_pMchLua->LoadMachineMultiTcPos( sName, sParent, vMuExit, vtADir, sGeo, vsAux))
return luaL_error( L, " Load Machine Multi Tc Position failed") ;
// restituisco l'indice della posizione cambio utensile // restituisco l'indice della posizione cambio utensile
int nTcPosId = m_pMchLua->GetTcPosId( sName) ; int nTcPosId = m_pMchLua->GetTcPosId( sName) ;
@@ -1478,7 +1395,7 @@ Machine::LuaEmtAddToolForVmill( lua_State* L)
int int
Machine::LuaEmtMoveAxes( lua_State* L) Machine::LuaEmtMoveAxes( lua_State* L)
{ {
// 4, ..., 31 parametri : nMoveType, sAx1, dPos1, dStep1 [, sAx2, dPos2, dStep2] ... [, sAx10, dPos10, dStep10] // 4, ..., 16 parametri : nMoveType, sAx1, dPos1, dStep1 [, sAx2, dPos2, dStep2] [, sAx3, dPos3, dStep3] [, sAx4, dPos4, dStep4] [, sAx5, dPos5, dStep5]
int nMoveType ; int nMoveType ;
LuaCheckParam( L, 1, nMoveType) LuaCheckParam( L, 1, nMoveType)
string sAx1 ; string sAx1 ;
@@ -1489,7 +1406,7 @@ Machine::LuaEmtMoveAxes( lua_State* L)
LuaCheckParam( L, 4, dStep1) ; LuaCheckParam( L, 4, dStep1) ;
SAMVECTOR vAxNaEpSt ; SAMVECTOR vAxNaEpSt ;
vAxNaEpSt.emplace_back( sAx1, dEnd1, dStep1) ; vAxNaEpSt.emplace_back( sAx1, dEnd1, dStep1) ;
for ( int i = 0 ; i < 9 ; ++ i) { for ( int i = 0 ; i < 4 ; ++ i) {
int nInd = 5 + 3 * i ; int nInd = 5 + 3 * i ;
string sAxN ; string sAxN ;
double dEndN ; double dEndN ;
+4 -16
View File
@@ -31,7 +31,7 @@ using namespace std ;
int int
Machine::LuaEmtAddRapidStart( lua_State* L) Machine::LuaEmtAddRapidStart( lua_State* L)
{ {
// 6 o 7 parametri : nPathId, ptP, vtTool, vtCorr, vtAux, nFlag [, bToolShow] // 6 parametri : nPathId, ptP, vtTool, vtCorr, vtAux, nFlag
int nPathId ; int nPathId ;
LuaCheckParam( L, 1, nPathId) LuaCheckParam( L, 1, nPathId)
Point3d ptP ; Point3d ptP ;
@@ -44,8 +44,6 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
LuaCheckParam( L, 5, vtAux) LuaCheckParam( L, 5, vtAux)
int nFlag ; int nFlag ;
LuaCheckParam( L, 6, nFlag) LuaCheckParam( L, 6, nFlag)
bool bToolShow = false ;
LuaGetParam( L, 7, bToolShow) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida // verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr || if ( m_pMchLua == nullptr ||
@@ -71,7 +69,6 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
pCam->SetEndPoint( ptP) ; pCam->SetEndPoint( ptP) ;
pCam->SetFeed( 0) ; pCam->SetFeed( 0) ;
pCam->SetFlag( nFlag) ; pCam->SetFlag( nFlag) ;
pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico // associo questo oggetto a quello geometrico
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ; m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
} }
@@ -87,7 +84,7 @@ Machine::LuaEmtAddRapidStart( lua_State* L)
int int
Machine::LuaEmtAddRapidMove( lua_State* L) Machine::LuaEmtAddRapidMove( lua_State* L)
{ {
// 7 o 8 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, nFlag [, bToolShow] // 7 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, nFlag
int nPathId ; int nPathId ;
LuaCheckParam( L, 1, nPathId) LuaCheckParam( L, 1, nPathId)
Point3d ptIni ; Point3d ptIni ;
@@ -102,8 +99,6 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
LuaCheckParam( L, 6, vtAux) LuaCheckParam( L, 6, vtAux)
int nFlag ; int nFlag ;
LuaCheckParam( L, 7, nFlag) LuaCheckParam( L, 7, nFlag)
bool bToolShow = false ;
LuaGetParam( L, 8, bToolShow) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida // verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr || if ( m_pMchLua == nullptr ||
@@ -129,7 +124,6 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
pCam->SetEndPoint( ptFin) ; pCam->SetEndPoint( ptFin) ;
pCam->SetFeed( 0) ; pCam->SetFeed( 0) ;
pCam->SetFlag( nFlag) ; pCam->SetFlag( nFlag) ;
pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico // associo questo oggetto a quello geometrico
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ; m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
} }
@@ -145,7 +139,7 @@ Machine::LuaEmtAddRapidMove( lua_State* L)
int int
Machine::LuaEmtAddLinearMove( lua_State* L) Machine::LuaEmtAddLinearMove( lua_State* L)
{ {
// 8 o 9 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, dFeed, nFlag [, bToolShow] // 8 parametri : nPathId, ptIni, ptFin, vtTool, vtCorr, vtAux, dFeed, nFlag
int nPathId ; int nPathId ;
LuaCheckParam( L, 1, nPathId) LuaCheckParam( L, 1, nPathId)
Point3d ptIni ; Point3d ptIni ;
@@ -162,8 +156,6 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
LuaCheckParam( L, 7, dFeed) LuaCheckParam( L, 7, dFeed)
int nFlag ; int nFlag ;
LuaCheckParam( L, 8, nFlag) LuaCheckParam( L, 8, nFlag)
bool bToolShow = false ;
LuaGetParam( L, 9, bToolShow) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida // verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr || if ( m_pMchLua == nullptr ||
@@ -189,7 +181,6 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
pCam->SetEndPoint( ptFin) ; pCam->SetEndPoint( ptFin) ;
pCam->SetFeed( dFeed) ; pCam->SetFeed( dFeed) ;
pCam->SetFlag( nFlag) ; pCam->SetFlag( nFlag) ;
pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico // associo questo oggetto a quello geometrico
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ; m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
} }
@@ -205,7 +196,7 @@ Machine::LuaEmtAddLinearMove( lua_State* L)
int int
Machine::LuaEmtAddArcMove( lua_State* L) Machine::LuaEmtAddArcMove( lua_State* L)
{ {
// 11 o 12 parametri : nPathId, ptIni, ptFin, ptCen, dAngCen, vtN, vtTool, vtCorr, vtAux, dFeed, nFlag [, bToolShow] // 11 parametri : nPathId, ptIni, ptFin, ptCen, dAngCen, vtN, vtTool, vtCorr, vtAux, dFeed, nFlag
int nPathId ; int nPathId ;
LuaCheckParam( L, 1, nPathId) LuaCheckParam( L, 1, nPathId)
Point3d ptIni ; Point3d ptIni ;
@@ -228,8 +219,6 @@ Machine::LuaEmtAddArcMove( lua_State* L)
LuaCheckParam( L, 10, dFeed) LuaCheckParam( L, 10, dFeed)
int nFlag ; int nFlag ;
LuaCheckParam( L, 11, nFlag) LuaCheckParam( L, 11, nFlag)
bool bToolShow = false ;
LuaGetParam( L, 12, bToolShow) ;
LuaClearStack( L) ; LuaClearStack( L) ;
// verifico ci sia una macchina attiva valida // verifico ci sia una macchina attiva valida
if ( m_pMchLua == nullptr || if ( m_pMchLua == nullptr ||
@@ -263,7 +252,6 @@ Machine::LuaEmtAddArcMove( lua_State* L)
pCam->SetNormDir( vtN) ; pCam->SetNormDir( vtN) ;
pCam->SetFeed( dFeed) ; pCam->SetFeed( dFeed) ;
pCam->SetFlag( nFlag) ; pCam->SetFlag( nFlag) ;
pCam->SetToolShow( bToolShow) ;
// associo questo oggetto a quello geometrico // associo questo oggetto a quello geometrico
m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ; m_pMchLua->m_pGeomDB->SetUserObj( nId, Release( pCam)) ;
} }
+2 -2
View File
@@ -287,12 +287,12 @@ Machining::ToolPreview( int nEntId, int nFlag) const
Frame3d frHead ; Frame3d frHead ;
m_pGeomDB->GetGroupGlobFrame( nId, frHead) ; m_pGeomDB->GetGroupGlobFrame( nId, frHead) ;
Frame3d frRef ; Frame3d frRef ;
if ( vtAux.IsSmall() || AreSameOrOppositeVectorApprox( vtAux, vtDir)) if ( vtAux.IsSmall())
frRef.Set( ptOrig, vtDir) ; frRef.Set( ptOrig, vtDir) ;
else else
frRef.Set( ptOrig, vtDir, vtAux) ; frRef.Set( ptOrig, vtDir, vtAux) ;
Frame3d frShow ; Frame3d frShow ;
if ( vtBAux.IsSmall() || AreSameOrOppositeVectorApprox( vtBAux, vtTool)) if ( vtBAux.IsSmall())
frShow.Set( ptEnd + vtTool * GetToolData().m_dLen, vtTool) ; frShow.Set( ptEnd + vtTool * GetToolData().m_dLen, vtTool) ;
else else
frShow.Set( ptEnd + vtTool * GetToolData().m_dLen, vtTool, vtBAux) ; frShow.Set( ptEnd + vtTool * GetToolData().m_dLen, vtTool, vtBAux) ;
+1 -10
View File
@@ -103,11 +103,7 @@ GetMachiningTitle( int nMchType)
"SawRoughing", "SawRoughing",
"SawFinishing", "SawFinishing",
"GenMachining", "GenMachining",
"Chiseling", "Chiseling"} ;
"SurfRoughing",
"SurfFinishing",
"Waterjetting",
"5axMachining"} ;
switch ( nMchType) { switch ( nMchType) {
case MT_DRILLING : return MchTitle[1] ; case MT_DRILLING : return MchTitle[1] ;
case MT_SAWING : return MchTitle[2] ; case MT_SAWING : return MchTitle[2] ;
@@ -118,11 +114,6 @@ GetMachiningTitle( int nMchType)
case MT_SAWFINISHING : return MchTitle[7] ; case MT_SAWFINISHING : return MchTitle[7] ;
case MT_GENMACHINING : return MchTitle[8] ; case MT_GENMACHINING : return MchTitle[8] ;
case MT_CHISELING : return MchTitle[9] ; case MT_CHISELING : return MchTitle[9] ;
case MT_SURFROUGHING : return MchTitle[10] ;
case MT_SURFFINISHING : return MchTitle[11] ;
case MT_WATERJETTING : return MchTitle[12] ;
case MT_5AXMACHINING : return MchTitle[13] ;
} }
return MchTitle[0] ; return MchTitle[0] ;
} }
+371 -841
View File
File diff suppressed because it is too large Load Diff
+6 -21
View File
@@ -98,21 +98,19 @@ class Milling : public Machining
double dDepth, double dElev, double dOkStep, bool bSplitArcs) ; double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ, bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bOutStart, bool bAboveStart) ; double dElev, double dAppr, bool bOutStart, bool bAboveStart) ;
bool AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, const Vector3d& vtTool, bool AddSawBladeSideApproach( const Point3d& ptP, const Vector3d& vtAppr, double dSafeZ, double dStElev, double dAppr) ;
double dSafeZ, double dSawStElev, double dStElev, double dAppr) ;
bool AddDirectApproach( const Point3d& ptP) ; bool AddDirectApproach( const Point3d& ptP) ;
bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ, bool AddRetract( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
double dElev, double dAppr, bool bAboveEnd) ; double dElev, double dAppr, bool bAboveEnd) ;
bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, const Vector3d& vtTool, bool AddSawBladeSideRetract( const Point3d& ptP, const Vector3d& vtRetr, double dSafeZ, double dEndElev, double dAppr) ;
double dSafeZ, double dSawEndElev, double dEndElev, double dAppr) ;
bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool, bool CalcLeadInStart( const Point3d& ptStart, const Vector3d& vtStart, const Vector3d& vtTool,
double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1, Vector3d& vtDir1) const ; double dStElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1) const ;
bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart, bool AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vector3d& vtStart,
const Vector3d& vtTool, double dStElev, bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs) ; const Vector3d& vtTool, bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs) ;
bool CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool, bool CalcLeadOutEnd( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool,
double dEndElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1) const ; double dEndElev, bool bInvert, const ICurveComposite* pCompo, Point3d& ptP1) const ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool, double dEndElev, bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtTool, double dEndElev,
bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs, Point3d& ptP1, Vector3d& vtDir1) ; bool bInvert, const ICurveComposite* pCompo, bool bSplitArcs, Point3d& ptP1) ;
bool AdjustOscillParams( const ICurve* pCrv, bool& bPathOscEnable, double& dRampLen, double& dFlatLen) ; bool AdjustOscillParams( const ICurve* pCrv, bool& bPathOscEnable, double& dRampLen, double& dFlatLen) ;
bool AddOscillLine( const ICurveLine* pLine, const Vector3d& vtTool, double dRampLen, double dFlatLen) ; bool AddOscillLine( const ICurveLine* pLine, const Vector3d& vtTool, double dRampLen, double dFlatLen) ;
bool AddOscillArc( const ICurveArc* pArc, const Vector3d& vtTool, double dRampLen, double dFlatLen) ; bool AddOscillArc( const ICurveArc* pArc, const Vector3d& vtTool, double dRampLen, double dFlatLen) ;
@@ -147,17 +145,7 @@ class Milling : public Machining
bool IsLeadInHelixOrZigzag() const bool IsLeadInHelixOrZigzag() const
{ int nType = GetLeadInType() ; { int nType = GetLeadInType() ;
return ( nType == MILL_LI_ZIGZAG || nType == MILL_LI_HELIX) ; } return ( nType == MILL_LI_ZIGZAG || nType == MILL_LI_HELIX) ; }
bool IsLeadInHelixOrZigzagOrGlide() const friend class LeadIOStatus ;
{ int nType = GetLeadInType() ;
return ( nType == MILL_LI_ZIGZAG || nType == MILL_LI_HELIX || nType == MILL_LI_GLIDE) ; }
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 : private :
SELVECTOR m_vId ; // identificativi entità geometriche da lavorare SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
@@ -172,13 +160,10 @@ class Milling : public Machining
double m_dAddedOverlap ; // overlap effettivamente aggiunto a percorso chiuso double m_dAddedOverlap ; // overlap effettivamente aggiunto a percorso chiuso
int m_nHeadSolCh ; // criterio scelta soluzione impostato nella testa int m_nHeadSolCh ; // criterio scelta soluzione impostato nella testa
bool m_bTiltingTab ; // flag utilizzo tavola basculante 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_bAboveHead ; // flag utilizzo testa da sopra
bool m_bAggrBottom ; // flag utilizzo di aggregato da sotto bool m_bAggrBottom ; // flag utilizzo di aggregato da sotto
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
double m_dCurrOscillLen ; // lunghezza corrente lungo il percorso per l'oscillazione double m_dCurrOscillLen ; // lunghezza corrente lungo il percorso per l'oscillazione
double m_dCurrTabsLen ; // lunghezza corrente lungo il percorso per tabs 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
} ; } ;
+2 -6
View File
@@ -110,10 +110,6 @@ struct MillingData : public MachiningData
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline const MillingData* GetMillingData( const MachiningData* pMdata) inline const MillingData* GetMillingData( const MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_MILLING) { return (dynamic_cast<const MillingData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<const MillingData*>( pMdata)) ; }
inline MillingData* GetMillingData( MachiningData* pMdata) inline MillingData* GetMillingData( MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_MILLING) { return (dynamic_cast<MillingData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<MillingData*>( pMdata)) ; }
+8 -31
View File
@@ -634,9 +634,6 @@ Mortising::Update( bool bPostApply)
return true ; return true ;
} }
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione // imposto eventuale asse bloccato da lavorazione
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
@@ -644,7 +641,7 @@ Mortising::Update( bool bPostApply)
string sHint = ExtractHint( m_Params.m_sUserNotes) ; string sHint = ExtractHint( m_Params.m_sUserNotes) ;
if ( ! m_Params.m_sInitAngs.empty()) if ( ! m_Params.m_sInitAngs.empty())
sHint = m_Params.m_sInitAngs ; sHint = m_Params.m_sInitAngs ;
if ( ! CalculateAxesValues( sHint, true, true)) { if ( ! CalculateAxesValues( sHint, true)) {
string sInfo = m_pMchMgr->GetOutstrokeInfo() ; string sInfo = m_pMchMgr->GetOutstrokeInfo() ;
if ( sInfo.empty()) if ( sInfo.empty())
m_pMchMgr->SetLastError( 2507, "Error in Mortising : axes values not calculable") ; m_pMchMgr->SetLastError( 2507, "Error in Mortising : axes values not calculable") ;
@@ -819,31 +816,11 @@ Mortising::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ; const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr) if ( pTdata == nullptr)
return false ; return false ;
// salvo posizione TC, testa e uscita originali // verifico se sono diversi (ad esclusione del nome)
string sOrigTcPos = m_TParams.m_sTcPos ; m_TParams.m_sName = pTdata->m_sName ;
string sOrigHead = m_TParams.m_sHead ; bool bChanged = ! SameTool( m_TParams, *pTdata) ;
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 // aggiorno comunque i parametri
m_TParams = *pTdata ; 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 // eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) { if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in Mortising : tool name changed (" + string sInfo = "Warning in Mortising : tool name changed (" +
@@ -1560,8 +1537,8 @@ Mortising::GenerateOnePlungeCl( const Point3d& ptStart, const Point3d& ptEnd, co
double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() + m_pMchMgr->GetDeltaSafeZ( m_TParams.m_sHead) ; double dSafeZ = m_pMchMgr->GetCurrMachiningsMgr()->GetSafeZ() + m_pMchMgr->GetDeltaSafeZ( m_TParams.m_sHead) ;
double dStartElev = 0 ; double dStartElev = 0 ;
Point3d ptLi = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * dDelta ; Point3d ptLi = ( nPlunge != MORTISE_PLUNGE_END ? ptStart : ptEnd) + vtTool * dDelta ;
bool bUnderStart = GetAhPointUnderRaw( ptLi, vtTool, 0, bool bUnderStart = GetPointUnderRaw( ptLi, vtTool, 0,
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dStartElev) ; GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dStartElev) ;
// altrimenti ridetermino elevazione su inizio percorso di lavoro // altrimenti ridetermino elevazione su inizio percorso di lavoro
if ( ! bUnderStart) if ( ! bUnderStart)
GetElevation( m_nPhase, ptLi, vtTool, GetRadiusForStartEndElevation(), vtTool, dStartElev) ; GetElevation( m_nPhase, ptLi, vtTool, GetRadiusForStartEndElevation(), vtTool, dStartElev) ;
@@ -1666,8 +1643,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 // determino se la fine dell'uscita è esattamente sotto il grezzo, nel qual caso ricalcolo l'elevazione
double dEndElev = 0 ; double dEndElev = 0 ;
Point3d ptLo = ptLast + vtTool * dDelta ; Point3d ptLo = ptLast + vtTool * dDelta ;
bool bUnderEnd = GetAhPointUnderRaw( ptLo, vtTool, 0, bool bUnderEnd = GetPointUnderRaw( ptLo, vtTool, 0,
GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dEndElev) ; GetRadiusForStartEndElevation(), m_TParams.m_dLen, false, dSafeZ, vtTool, dEndElev) ;
// altrimenti ridetermino elevazione su fine percorso di lavoro // altrimenti ridetermino elevazione su fine percorso di lavoro
if ( ! bUnderEnd) if ( ! bUnderEnd)
GetElevation( m_nPhase, ptLo, vtTool, GetRadiusForStartEndElevation(), vtTool, dEndElev) ; GetElevation( m_nPhase, ptLo, vtTool, GetRadiusForStartEndElevation(), vtTool, dEndElev) ;
+2 -6
View File
@@ -77,10 +77,6 @@ struct MortisingData : public MachiningData
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline const MortisingData* GetMortisingData( const MachiningData* pMdata) inline const MortisingData* GetMortisingData( const MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_MORTISING) { return (dynamic_cast<const MortisingData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<const MortisingData*>( pMdata)) ; }
inline MortisingData* GetMortisingData( MachiningData* pMdata) inline MortisingData* GetMortisingData( MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_MORTISING) { return (dynamic_cast<MortisingData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<MortisingData*>( pMdata)) ; }
+68 -638
View File
@@ -22,7 +22,6 @@
#include "/EgtDev/Include/EGkAngle.h" #include "/EgtDev/Include/EGkAngle.h"
#include "/EgtDev/Include/EGkBBox1d.h" #include "/EgtDev/Include/EGkBBox1d.h"
#include "/EgtDev/Include/EGkGeoPoint3d.h" #include "/EgtDev/Include/EGkGeoPoint3d.h"
#include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGkCurveLine.h" #include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EGkCurveArc.h" #include "/EgtDev/Include/EGkCurveArc.h"
#include "/EgtDev/Include/EGkArcSpecial.h" #include "/EgtDev/Include/EGkArcSpecial.h"
@@ -33,12 +32,10 @@
#include "/EgtDev/Include/EGkGeomDB.h" #include "/EgtDev/Include/EGkGeomDB.h"
#include "/EgtDev/Include/EGkCDeBoxClosedSurfTm.h" #include "/EgtDev/Include/EGkCDeBoxClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeCylClosedSurfTm.h" #include "/EgtDev/Include/EGkCDeCylClosedSurfTm.h"
#include "/EgtDev/Include/EGkCAvToolSurfTm.h"
#include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EXeConst.h" #include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EgtNumUtils.h" #include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EgtPointerOwner.h" #include "/EgtDev/Include/EgtPointerOwner.h"
#include "/EgtDev/Include/EGkDistPointSurfTm.h"
using namespace std ; using namespace std ;
@@ -173,32 +170,13 @@ Operation::GetElevation( int nPhase, const Point3d& ptP,
const Vector3d& vtDir, double& dElev) const const Vector3d& vtDir, double& dElev) const
{ {
Vector3d vtNorm ; Vector3d vtNorm ;
INTVECTOR vRawStmId ; return GetElevation( nPhase, ptP, vtDir, dElev, vtNorm) ;
return GetElevation( nPhase, ptP, vtDir, dElev, vtNorm, vRawStmId) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Operation::GetElevation( int nPhase, const Point3d& ptP, Operation::GetElevation( int nPhase, const Point3d& ptP,
const Vector3d& vtDir, double& dElev, Vector3d& vtNorm) const 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) if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ; return false ;
@@ -262,13 +240,11 @@ Operation::GetElevation( int nPhase, const Point3d& ptP,
} }
} }
} }
// se c'è triangolo di intersezione, ne recupero la normale e salvo Id del grezzo // se c'è triangolo di intersezione, ne recupero la normale
if ( nTria != SVT_NULL) { if ( nTria != SVT_NULL) {
Triangle3d Tria ; Triangle3d Tria ;
if ( pStm->GetTriangle( nTria, Tria)) if ( pStm->GetTriangle( nTria, Tria))
vtNorm = Tria.GetN() ; vtNorm = Tria.GetN() ;
if ( find( vRawStmId.begin(), vRawStmId.end(), nStmId) == vRawStmId.end())
vRawStmId.emplace_back( nStmId) ;
} }
} }
} }
@@ -317,7 +293,7 @@ Operation::GetElevation( int nPhase, const Point3d& ptP1, const Point3d& ptP2,
double dElevS = 0 ; double dElevS = 0 ;
// faccio test con un insieme di punti ( !!! sostituire con intersezione tra rettangolo e trimesh !!!) // faccio test con un insieme di punti ( !!! sostituire con intersezione tra rettangolo e trimesh !!!)
const double STEP = 50 ; const double STEP = 50 ;
int nStep = max( (int) ceil( ApproxDist( ptP1L, ptP2L) / STEP), 2) ; int nStep = max( (int) ceil( ApproxDist( ptP1L, ptP2L) / STEP), 3) ;
for ( int i = 0 ; i <= nStep ; ++ i) { for ( int i = 0 ; i <= nStep ; ++ i) {
// calcolo punto di test // calcolo punto di test
double dFraz = i / (double) nStep ; double dFraz = i / (double) nStep ;
@@ -385,130 +361,34 @@ bool
Operation::GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad, Operation::GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad,
const Vector3d& vtDir, double& dElev) const const Vector3d& vtDir, double& dElev) const
{ {
const double STD_TOOL_LEN = 100 ;
return GetElevation( nPhase, ptP, vtTool, dRad, STD_TOOL_LEN, vtDir, dElev) ;
}
//----------------------------------------------------------------------------
bool
Operation::GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad, double dLen,
const Vector3d& vtDir, double& dElev) const
{
// risultato di default
dElev = 0 ;
// verifico oggetti base
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr) if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ; return false ;
// inizializzo elevazioni per ogni grezzo // considero il punto centrale
INTDBLVECTOR vRawElev ; if ( ! GetElevation( nPhase, ptP, vtDir, dElev))
// ciclo sui grezzi della fase return false ;
int nRawId = m_pMchMgr->GetFirstRawPart() ; // considero più direzioni sulla circonferenza
while ( nRawId != GDB_ID_NULL) { const int MIN_STEP = 8 ;
// verifico che il grezzo compaia nella fase const double LEN_STEP = 25 ;
if ( m_pMchMgr->VerifyRawPartPhase( nRawId, nPhase)) { int nStep = max( int( ( 2 * PIGRECO * dRad) / LEN_STEP), MIN_STEP) ;
// recupero la trimesh del grezzo Vector3d vtRad = FromUprightOrtho( vtTool) * dRad ;
int nStmId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ; for ( int i = 0 ; i < nStep ; ++ i) {
ISurfTriMesh* pStm = GetSurfTriMesh( m_pGeomDB->GetGeoObj( nStmId)) ; // esploro 4 posizioni sulle direzioni
if ( pStm != nullptr) { for ( int j = 1 ; j <= 8 ; j *= 2) {
// recupero il riferimento della trimesh double dElevT = 0 ;
Frame3d frStm ; if ( ! GetElevation( nPhase, ptP + vtRad / j, vtDir, dElevT))
m_pGeomDB->GetGlobFrame( nStmId, frStm) ; return false ;
// porto posizione e direzioni in questo riferimento dElev = max( dElev, dElevT) ;
Point3d ptPL = GetToLoc( ptP, frStm) ;
Vector3d vtToolL = GetToLoc( vtTool, frStm) ;
Vector3d vtDirL = GetToLoc( vtDir, frStm) ;
// determino quanto allontanarsi
PtrOwner<ICAvToolSurfTm> pCAvTlStm( CreateCAvToolSurfTm()) ;
if ( IsNull( pCAvTlStm))
return false ;
pCAvTlStm->SetStdTool( dLen, dRad, 0) ;
pCAvTlStm->SetSurfTm( *pStm) ;
double dDist = 0 ;
// non è ammesso un angolo oltre 90deg tra direzione utensile e vettore movimento
if ( vtToolL * vtDirL < 0) {
// il tip utensile è qui il naso mandrino per Collision Avoid
if ( ! pCAvTlStm->TestPosition( ptPL, -vtToolL, vtDirL, dDist))
return false ;
}
else {
// per Collision Avoid il punto di riferimento non è il tip dell'utensile ma il naso mandrino
if ( ! pCAvTlStm->TestPosition( ptPL + dLen * vtToolL, vtToolL, vtDirL, dDist))
return false ;
}
if ( dDist > EPS_SMALL)
vRawElev.emplace_back( nStmId, dDist) ;
}
} }
// passo al grezzo successivo // passo alla direzione successiva
nRawId = m_pMchMgr->GetNextRawPart( nRawId) ; vtRad.Rotate( vtTool, ANG_FULL / nStep) ;
} }
// se trovate elevazioni
if ( ! vRawElev.empty()) {
// ordino il vettore secondo l'elevazione crescente
sort( vRawElev.begin(), vRawElev.end(), []( const INTDBL& a, const INTDBL& b)
{ return a.second < b.second ; }) ;
// box dell'utensile nella posizione iniziale
BBox3d b3Tool ;
b3Tool.Add( ptP) ;
b3Tool.Add( ptP + dLen * vtTool) ;
if ( vtTool.IsX())
b3Tool.Expand( 0, dRad, dRad) ;
else if ( vtTool.IsY())
b3Tool.Expand( dRad, 0, dRad) ;
else if ( vtTool.IsZ())
b3Tool.Expand( dRad, dRad, 0) ;
else {
double dExpandX = dRad * sqrt( 1 - vtTool.x * vtTool.x) ;
double dExpandY = dRad * sqrt( 1 - vtTool.y * vtTool.y) ;
double dExpandZ = dRad * sqrt( 1 - vtTool.z * vtTool.z) ;
b3Tool.Expand( dExpandX, dExpandY, dExpandZ) ;
}
b3Tool.Expand( MAX_DIST_RAW) ;
// verifico la reale interferenza dell'utensile con i diversi grezzi
for ( int i = 0 ; i < int( vRawElev.size()) ; ++ i) {
// box del grezzo
BBox3d b3Raw ;
m_pGeomDB->GetGlobalBBox( vRawElev[i].first, b3Raw) ;
// confronto con il box dell'utensile nella posizione precedente
BBox3d b3CurrTool = b3Tool ;
b3CurrTool.Translate( dElev * vtDir) ;
if ( b3Raw.Overlaps( b3CurrTool))
dElev = vRawElev[i].second ;
}
}
return true ; return true ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Operation::GetElevation( int nPhase, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtTool, double dRad, double dLen, Operation::GetPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
const Vector3d& vtDir, double& dElev) const double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const
{
// risultato di default
bool bOk = false ;
dElev = 0 ;
// faccio test sui punti dall'inizio alla fine
const double STEP = 50 ;
int nStep = max( (int) ceil( ApproxDist( ptS, ptE) / STEP), 2) ;
for ( int i = 0 ; i <= nStep ; ++ i) {
// calcolo punto di test
double dFraz = i / (double) nStep ;
Point3d ptP = Media( ptS, ptE, dFraz) ;
// eseguo il calcolo
double dCurrElev ;
if ( GetElevation( nPhase, ptP, vtTool, dRad, dLen, vtDir, dCurrElev)) {
bOk = true ;
dElev = max( dElev, dCurrElev) ;
}
}
return bOk ;
}
//----------------------------------------------------------------------------
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 // punto a metà lunghezza utensile
Point3d ptQ = ptP + vtTool * dToolLen / 2 ; Point3d ptQ = ptP + vtTool * dToolLen / 2 ;
@@ -544,340 +424,17 @@ Operation::GetAhPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, doubl
// determino elevazione del punto rispetto al grezzo a metà altezza // determino elevazione del punto rispetto al grezzo a metà altezza
Point3d ptTest( ptP.x, ptP.y, dRawCentZ) ; Point3d ptTest( ptP.x, ptP.y, dRawCentZ) ;
double dNewElev ; double dNewElev ;
if ( GetElevation( m_nPhase, ptTest, vtTool, dToolRadForElev, vtMyDir, dNewElev)) if ( GetElevation( m_nPhase, ptTest - 10 * EPS_SMALL * vtTool, vtTool, dToolRadForElev, vtMyDir, dNewElev))
dElev = max( dElev, dNewElev) ; dElev = max( dElev, dNewElev) ;
// se direzione di fuga quasi orizzontale (max 30 deg) e ingombro utensile rilevante rispetto ad altezza grezzo // 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) { if ( vtMyDir.z < 0.5 && dToolDimZ > dRawDimZ / 2) {
// determino elevazione del punto rispetto al grezzo a metà altezza più metà ingombro utensile // determino elevazione del punto rispetto al grezzo a metà altezza più metà ingombro utensile
ptTest = Point3d( ptP.x, ptP.y, dRawCentZ + dToolDimZ / 2) ; ptTest = Point3d( ptP.x, ptP.y, dRawCentZ + dToolDimZ / 2) ;
if ( GetElevation( m_nPhase, ptTest, vtTool, dToolRadForElev, vtMyDir, dNewElev)) if ( GetElevation( m_nPhase, ptTest - 10 * EPS_SMALL * vtTool, vtTool, dToolRadForElev, vtMyDir, dNewElev))
dElev = max( dElev, dNewElev) ; dElev = max( dElev, dNewElev) ;
// determino elevazione del punto rispetto al grezzo a metà altezza meno metà ingombro utensile // determino elevazione del punto rispetto al grezzo a metà altezza meno metà ingombro utensile
ptTest = Point3d( ptP.x, ptP.y, dRawCentZ - dToolDimZ / 2) ; ptTest = Point3d( ptP.x, ptP.y, dRawCentZ - dToolDimZ / 2) ;
if ( GetElevation( m_nPhase, ptTest, vtTool, dToolRadForElev, vtMyDir, dNewElev)) 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 IsPointOnBox( BBox3d BBox, Point3d pt) {
if ( BBox.IsEmpty())
return false ;
int nCheck = 0 ;
if (( pt.x - BBox.GetMin().x) < EPS_SMALL)
++ nCheck ;
if (( pt.y - BBox.GetMin().y) < EPS_SMALL)
++ nCheck ;
if (( pt.z - BBox.GetMin().z) < EPS_SMALL)
++ nCheck ;
if (( pt.x - BBox.GetMax().x) < EPS_SMALL)
++ nCheck ;
if (( pt.y - BBox.GetMax().y) < EPS_SMALL)
++ nCheck ;
if (( pt.z - BBox.GetMax().z) < EPS_SMALL)
++ nCheck ;
if ( nCheck >= 2)
return true ;
return false ;
}
//----------------------------------------------------------------------------
bool
Operation::GetSignedDistFromStmRaw( int nPhase, const Point3d ptP, const Vector3d vtDir,
double& dDist, Vector3d& vtNorm) const
{
// controllo MachManager e database geometrico
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
// la distanza negativa se il punto interno, positiva se esterno, 0 se sulla suprificie
const double RAY_LEN = 100000 ;
bool bIsInside = false ; // se punto interno ad un RawPart
bool bIsPointOn = false ; // se il punto stato trovato su una faccia
bool bIsOnLoop = false ; // se il punto su un loop
bool bIsOnBox = false ; // se il punto su un Box3D
bool bSkip = false ; // se salto controlli sui bordi
// vettore dei grezzi
ISURFTMPOVECTOR vSrfRawPart ;
int nRawId = m_pMchMgr->GetFirstRawPart() ;
while( nRawId != GDB_ID_NULL) {
// verifico che il grezzo compaia nella fase
if ( m_pMchMgr->VerifyRawPartPhase( nRawId, nPhase)) {
// recupero l'oggetto dal database con tale Id
int nRawSolidId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
const IGeoObj* pGObj = m_pGeomDB->GetGeoObj( nRawSolidId) ;
// recupero il frame in cui si trova
Frame3d frRaw ;
m_pGeomDB->GetGlobFrame( nRawSolidId, frRaw) ;
if ( pGObj == nullptr)
return false ;
// controllo che sia una Trimesh
if ( pGObj->GetType() == SRF_TRIMESH) {
// Trimesh della parte p-esima
PtrOwner<ISurfTriMesh> pStmRawPart( CloneSurfTriMesh( GetSurfTriMesh( pGObj))) ;
if ( IsNull( pStmRawPart))
return false ;
// porto la trimesh in globale
pStmRawPart->ToGlob( frRaw) ;
// salvo la superificie
vSrfRawPart.emplace_back( pStmRawPart->Clone()) ;
// distanza dalla parte p-esima
double dCurrDist = 0 ;
// recupero la distanza tra il punto e la parte p-esima
DistPointSurfTm distPtStm( ptP, *pStmRawPart) ;
if ( ! distPtStm.GetDist( dCurrDist))
return false ;
// controllo se il punto dentro al grezzo
if ( distPtStm.IsPointInside()) {
bIsInside = true ;
bSkip = true ;
}
if ( dCurrDist < EPS_SMALL && !bSkip) {
// controllo se sono su un Loop
POLYLINEVECTOR vP ;
bool bIsCurrOnLoop = false ;
for ( int i = 0 ; i < pStmRawPart->GetFacetCount() ; ++ i) {
pStmRawPart->GetFacetLoops( i, vP) ;
for ( int j = 0 ; j < ( int)vP.size() && !bIsCurrOnLoop ; ++ j) {
PtrOwner<ICurveComposite> pCrvEdge( CreateCurveComposite()) ;
if ( IsNull( pCrvEdge))
return false ;
pCrvEdge->FromPolyLine( vP[j]) ;
if ( !pCrvEdge->IsValid() || pCrvEdge->GetCurveCount() == 0)
return false ;
if ( pCrvEdge->IsPointOn( ptP))
bIsCurrOnLoop = true ;
}
}
// se il punto sta sulla curva...
if ( bIsCurrOnLoop) {
if ( bIsOnLoop) { // se ho gi trovato una curva che contiene il punto ...
BBox3d bCurrBox ;
if ( ! pStmRawPart->GetBBox( GLOB_FRM, bCurrBox))
return false ;
if ( IsPointOnBox( bCurrBox, ptP)) { // se il punto sta sul Box
if ( bIsOnBox) { // se il punto stava gi su un altro Box
bIsInside = false ;
bSkip = true ;
}
else // se il punto non stava gi su un box
bIsInside = true ;
bSkip = true ;
}
else // se il punto non sta sul box
bIsInside = true ;
}
else { // se la prima curva a contenere il punto
bIsPointOn = true ;
// controllo se il punto sta sulla faccia del box del grezzo corrente
BBox3d bCurrBox ;
if ( ! pStmRawPart->GetBBox( GLOB_FRM, bCurrBox))
return false ;
// controllo se il punto sta su una faccia del box
if ( IsPointOnBox( bCurrBox, ptP))
bIsOnBox = true ;
}
}
// se il punto non sta sulla curva ...
else {
if ( bIsPointOn) {
bIsInside = true ;
bSkip = true ;
}
else
bIsPointOn = true ;
}
}
}
}
// passo al grezzo successivo
nRawId = m_pMchMgr->GetNextRawPart( nRawId) ;
}
if ( bSkip) {
bIsPointOn = false ;
bIsOnLoop = false ;
bIsOnBox = false ;
}
double dCurrDist = bIsInside ? -INFINITO : INFINITO ; // distanza attuale
dDist = dCurrDist ;
double dTmpCurrDist = 0 ;
for ( int i = 0 ; i < ( int)vSrfRawPart.size() ; ++ i) {
ILSIVECTOR vInfo ; // info
Triangle3d Tria ; // triangolo della trimesh intersecato
// recupero la distanza tra il punto e la parte p-esima
if ( IntersLineSurfTm( ptP, vtDir, RAY_LEN, *vSrfRawPart[i], vInfo)) {
if (( int)vInfo.size() == 0)
continue ;
DistPointSurfTm distPtStm( ptP, *vSrfRawPart[i]) ;
if( ! distPtStm.GetDist( dTmpCurrDist))
return false ;
if (( bIsPointOn && !bIsInside)) { // punto sulla superificie totale dei grezzi
// se il grezzo quello giusto ...
if ( dTmpCurrDist < EPS_SMALL) {
dDist = 0 ;
vSrfRawPart[i]->GetTriangle( vInfo[0].nT, Tria) ;
vtNorm = Tria.GetN() ;
return true ;
}
else { // se sono su un altro ... ( prima o poi ritorno al controllo sopra ...)
}
}
else if (( int)vInfo.size() == 1 && bIsInside) {
if ( distPtStm.IsPointInside() || dTmpCurrDist < EPS_SMALL) {
// se punto interno alla grezzo corrente
double dUCurr = vInfo[0].dU ;
// se direzione || ad una faccia faccia, ma punto non interno al grezzo corrente
if ( vInfo[0].nILTT == ILTT_SEGM || vInfo[0].nILTT == ILTT_EDGE)
double dUCurr = - vInfo[0].dU2 ;
if ( dUCurr > dCurrDist) {
dCurrDist = dUCurr ;
vSrfRawPart[i]->GetTriangle( vInfo[0].nT, Tria) ;
vtNorm = Tria.GetN() ;
}
}
else { // se interno ma non al grezzo corrente ( prima o poi ritono al controllo sopra )
}
}
else if (( int)vInfo.size() > 1) { // se la linea trapassa il grezzo corrente (entra ed esce)...
if ( bIsInside) { // e il punto interno ( quindi non al grezzo corrente )
double dUCurr = 0 ;
int nT ;
for ( int j = 0 ; j < ( int)vInfo.size() ; ++ j) {
IntLinStmInfo Info = vInfo[j] ;
if ( Info.nILTT == ILTT_SEGM || Info.nILTT == ILTT_SEGM_ON_EDGE) {
// se prosegue un tratto precedente, non devo controllare sia minimo
dUCurr = Info.dU2 ;
nT = Info.nT ;
//break ; ???????
}
// se altrimenti intersezione puntuale, verifico che esca (coseno >= 0)
else if ( Info.dCosDN > - COS_ORTO_ANG_ZERO) {
dUCurr = Info.dU ;
nT = Info.nT ;
break ;
}
// se altrimenti la prima ed entra ( non la considero ...)
else {
}
}
if ( dUCurr > dCurrDist) { // tengo la distanza pi grande
dCurrDist = dUCurr ;
vSrfRawPart[i]->GetTriangle( nT, Tria) ;
vtNorm = Tria.GetN() ;
}
}
else { // se invece un punto esterno a tutto
if ( vInfo[0].dU < dCurrDist) { // tengo la distanza ( positiva) pi grande
dCurrDist = vInfo[0].dU ;
vSrfRawPart[i]->GetTriangle( vInfo[0].nT, Tria) ;
vtNorm = Tria.GetN() ;
}
}
}
}
}
if ( dCurrDist > INFINITO - 1 && ! bIsInside) // non ho intersecato mai nessun grezzo
dDist = INFINITO ;
if ( dCurrDist < -INFINITO + 1 && bIsInside) // sono interno ma non interseco un grezzo ... errore
return false ;
dDist = bIsInside ? - dCurrDist : dCurrDist ;
return true ;
}
//----------------------------------------------------------------------------
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, 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, 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, vtTool, dToolRadForElev, vtMyDir, dNewElev))
dElev = max( dElev, dNewElev) ; dElev = max( dElev, dNewElev) ;
} }
return true ; return true ;
@@ -963,12 +520,8 @@ Operation::GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3
IntersCurveCurve intCC( *pRay, *pOut) ; IntersCurveCurve intCC( *pRay, *pOut) ;
int nInters = intCC.GetIntersCount() ; int nInters = intCC.GetIntersCount() ;
IntCrvCrvInfo aInfo ; IntCrvCrvInfo aInfo ;
if ( nInters > 0 && intCC.GetIntCrvCrvInfo( nInters - 1, aInfo)) { if ( nInters > 0 && intCC.GetIntCrvCrvInfo( nInters - 1, aInfo))
if ( ! aInfo.bOverlap) dDist = aInfo.IciA[0].dU * RAY_LEN - EXTRA_LEN ;
dDist = aInfo.IciA[0].dU * RAY_LEN - EXTRA_LEN ;
else
dDist = aInfo.IciA[1].dU * RAY_LEN - EXTRA_LEN ;
}
else else
dDist = 0 ; dDist = 0 ;
return true ; return true ;
@@ -1084,36 +637,36 @@ Operation::GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dEx
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool 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) if (m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ; return false;
// ricerco grezzi interessati dal percorso // ricerco grezzi interessati dal percorso
BBox3d b3Compo ; BBox3d b3Compo;
if ( ! m_pGeomDB->GetGlobalBBox( nPathId, b3Compo)) if (!m_pGeomDB->GetGlobalBBox(nPathId, b3Compo))
return false ; return false;
return GetDistanceFromRawBottom( nPhase, b3Compo, dToler, dRbDist, dAllRbDist) ; return GetDistanceFromRawBottom(nPhase, b3Compo, dToler, dRbDist, dAllRbDist);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Operation::GetDistanceFromRawBottom( int nPhase, BBox3d& b3Test, double dToler, double& dRbDist, double& dAllRbDist) const 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 ; return false ;
// recupero distanza da fondo dei grezzi interessati o no dal percorso // recupero distanza da fondo dei grezzi interessati o no dal percorso
dRbDist = 0 ; dRbDist = 0 ;
dAllRbDist = 0 ; dAllRbDist = 0 ;
b3Test.Expand( dToler, dToler, 0) ; b3Test.Expand(dToler, dToler, 0) ;
int nRawId = m_pMchMgr->GetFirstRawPart() ; int nRawId = m_pMchMgr->GetFirstRawPart() ;
while ( nRawId != GDB_ID_NULL) { while ( nRawId != GDB_ID_NULL) {
// verifico che il grezzo compaia nella fase // verifico che il grezzo compaia nella fase
if ( m_pMchMgr->VerifyRawPartPhase( nRawId, nPhase)) { if ( m_pMchMgr->VerifyRawPartPhase( nRawId, nPhase)) {
BBox3d b3Raw ; BBox3d b3Raw ;
int nRawSolidId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ; int nRawSolidId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
if ( m_pGeomDB->GetGlobalBBox( nRawSolidId, b3Raw)) { if (m_pGeomDB->GetGlobalBBox( nRawSolidId, b3Raw)) {
double dDist = b3Test.GetMax().z - b3Raw.GetMin().z ; double dDist = b3Test.GetMax().z - b3Raw.GetMin().z ;
if ( b3Test.OverlapsXY( b3Raw) && dDist > dRbDist) if ( b3Test.OverlapsXY( b3Raw) && dDist > dRbDist)
dRbDist = dDist ; dRbDist = dDist ;
@@ -1169,29 +722,6 @@ Operation::GetRawGlobBox( int nPhase, const BBox3d& b3Test, double dToler, BBox3
return true ; return true ;
} }
//----------------------------------------------------------------------------
bool
Operation::GetCurrRawsGlobBox( BBox3d& b3Raw) const
{
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ;
// inizializzo box
b3Raw.Reset() ;
// Ciclo sui grezzi attivi
int nRawId = m_pMchMgr->GetFirstRawPart() ;
while ( nRawId != GDB_ID_NULL) {
if ( m_pMchMgr->VerifyRawPartPhase( nRawId, m_nPhase)) {
BBox3d b3OneRaw ;
int nRawSolidId = m_pGeomDB->GetFirstNameInGroup( nRawId, MACH_RAW_SOLID) ;
if ( m_pGeomDB->GetGlobalBBox( nRawSolidId, b3OneRaw)) {
b3Raw.Add( b3OneRaw) ;
}
}
nRawId = m_pMchMgr->GetNextRawPart( nRawId) ;
}
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline Vector3d inline Vector3d
@@ -1418,9 +948,6 @@ Operation::ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp)
pCompo->GetExtrusion( vtExtr) ; pCompo->GetExtrusion( vtExtr) ;
double dThick = 0 ; double dThick = 0 ;
pCompo->GetThickness( dThick) ; pCompo->GetThickness( dThick) ;
// recupero le proprietà temporanee
int nProp0 = pCompo->GetTempProp( 0) ;
int nProp1 = pCompo->GetTempProp( 1) ;
// verifico se ci sono tante linee corte // verifico se ci sono tante linee corte
int nSmallLineCnt = 0 ; int nSmallLineCnt = 0 ;
const ICurve* pCrv = pCompo->GetFirstCurve() ; const ICurve* pCrv = pCompo->GetFirstCurve() ;
@@ -1435,9 +962,8 @@ Operation::ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp)
// limito l'approssimazione alle curve piane // limito l'approssimazione alle curve piane
Frame3d frRef ; Frame3d frRef ;
frRef.Set( ORIG, vtExtr) ; frRef.Set( ORIG, vtExtr) ;
Frame3d frInvRef = frRef ; frInvRef.Invert() ;
BBox3d b3Crv ; BBox3d b3Crv ;
if ( ! pCompo->GetBBox( frInvRef, b3Crv) || abs( b3Crv.GetMax().z - b3Crv.GetMin().z - dThick) > 100 * EPS_SMALL) if ( ! pCompo->GetBBox( frRef, b3Crv) || abs( b3Crv.GetMax().z - b3Crv.GetMin().z - dThick) > 100 * EPS_SMALL)
return true ; return true ;
// porto la curva nel suo piano perchè ApproxWithArcsEx funziona bene solo nel piano XY (all'uscita va ripristinato il rif. originale) // porto la curva nel suo piano perchè ApproxWithArcsEx funziona bene solo nel piano XY (all'uscita va ripristinato il rif. originale)
pCompo->ToLoc( frRef) ; pCompo->ToLoc( frRef) ;
@@ -1500,7 +1026,7 @@ Operation::ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp)
for ( int j = 0 ; j < pCC->GetCurveCount() ; ++ j) for ( int j = 0 ; j < pCC->GetCurveCount() ; ++ j)
pCC->SetCurveTempProp( j, vInt[i].second) ; pCC->SetCurveTempProp( j, vInt[i].second) ;
// reinserisco nel vettore di curve // reinserisco nel vettore di curve
vpCrvs.back().Set( pCC) ; vpCrvs.back().Set( Release( pCC)) ;
} }
} }
// riassemblo la curva e assegno le opportune proprietà // riassemblo la curva e assegno le opportune proprietà
@@ -1516,10 +1042,6 @@ Operation::ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp)
pCompo->SetExtrusion( vtExtr) ; pCompo->SetExtrusion( vtExtr) ;
pCompo->SetThickness( dThick) ; pCompo->SetThickness( dThick) ;
// riassegno le proprietà temporanee
pCompo->SetTempProp( nProp0, 0) ;
pCompo->SetTempProp( nProp1, 1) ;
return true ; return true ;
} }
@@ -1707,55 +1229,6 @@ Operation::CalcAndSetAxesBBox( void)
return true ; return true ;
} }
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
bool
Operation::CalcMirrorByDouble( int nClId, const std::string& sUserNotes)
{
// verifico se prevista lavorazione in doppio
int nDouble ;
if ( ! GetValInNotes( sUserNotes, "DOUBLE", nDouble) ||
( nDouble != 1 && nDouble != 2 && nDouble != 3))
return true ;
// copio gruppo di lavorazione e cambio nome
int nDblId = m_pGeomDB->Copy( nClId, GDB_ID_NULL, nClId, GDB_AFTER) ;
if ( nDblId == GDB_ID_NULL)
return false ;
m_pGeomDB->SetName( nDblId, MCH_DBL) ;
// assegno colore di copia
int nClPathId = m_pGeomDB->GetFirstGroupInGroup( nDblId) ;
while ( nClPathId != GDB_ID_NULL) {
m_pGeomDB->SetMaterial( nClPathId, GRAY) ;
nClPathId = m_pGeomDB->GetNextGroup( nClPathId) ;
}
// determino posizione del piano di mirroring
BBox3d b3Raw ;
Point3d ptOn ;
if ( ! GetCurrRawsGlobBox( b3Raw) || ! b3Raw.GetCenter( ptOn))
return false ;
Vector3d vtNorm ;
switch ( nDouble) {
case 1 : vtNorm = X_AX ; break ;
case 2 : vtNorm = Y_AX ; break ;
case 3 : vtNorm = Z_AX ; break ;
}
double dPlanePos ;
if ( GetValInNotes( sUserNotes, "MirrorAx", dPlanePos))
ptOn = b3Raw.GetMin() + dPlanePos * vtNorm ;
// eseguo mirroring rispetto a piano opportuno
m_pGeomDB->MirrorGroup( nDblId, ptOn, vtNorm) ;
// se presente una differenza in Z, eseguo spostamento
double dDeltaZ ;
if ( GetValInNotes( sUserNotes, "DeltaZ", dDeltaZ) && abs( dDeltaZ) > EPS_SMALL)
m_pGeomDB->TranslateGlob( nDblId, Vector3d( 0, 0, dDeltaZ)) ;
return true ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
@@ -1954,22 +1427,26 @@ Operation::SetBlockedRotAxis( const string& sBlockedAxis) const
int nLinAxes = m_pMchMgr->GetCurrLinAxes() ; int nLinAxes = m_pMchMgr->GetCurrLinAxes() ;
int nRotAxes = m_pMchMgr->GetCurrRotAxes() ; int nRotAxes = m_pMchMgr->GetCurrRotAxes() ;
// lo cerco tra i token degli assi rotanti correnti // lo cerco tra i token degli assi rotanti correnti
for ( int i = 0 ; i < nRotAxes ; ++ i) { bool bFound = false ;
for ( int i = 0 ; i < nRotAxes && ! bFound ; ++ i) {
string sAxToken ; string sAxToken ;
if ( m_pMchMgr->GetCurrMachine()->GetCurrAxisToken( i + nLinAxes, sAxToken) && if ( m_pMchMgr->GetCurrMachine()->GetCurrAxisToken( i + nLinAxes, sAxToken) &&
sKey == Trim( sAxToken, " \t\r\n=")) { sKey == Trim( sAxToken)) {
string sAxis ; string sAxis ;
m_pMchMgr->GetCurrMachine()->GetCurrAxisName( i + nLinAxes, sAxis) ; m_pMchMgr->GetCurrMachine()->GetCurrAxisName( i + nLinAxes, sAxis) ;
return m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ; m_pMchMgr->SetRotAxisBlock( sAxis, dVal) ;
bFound = true ;
} }
} }
if ( bFound)
return true ;
// lo cerco tra gli assi rotanti della macchina // lo cerco tra gli assi rotanti della macchina
return m_pMchMgr->SetRotAxisBlock( sKey, dVal) ; return m_pMchMgr->SetRotAxisBlock( sKey, dVal) ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Operation::CalculateAxesValues( const string& sHint, bool bRotContOnNext, bool bSolChExact) Operation::CalculateAxesValues( const string& sHint, bool bSolChExact)
{ {
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr) if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ; return false ;
@@ -2032,19 +1509,10 @@ Operation::CalculateAxesValues( const string& sHint, bool bRotContOnNext, bool b
for ( int i = 0 ; i < nRotAxes ; ++ i) { for ( int i = 0 ; i < nRotAxes ; ++ i) {
string sAxToken ; string sAxToken ;
if ( m_pMchMgr->GetCurrMachine()->GetCurrAxisToken( nLinAxes + i, sAxToken) && if ( m_pMchMgr->GetCurrMachine()->GetCurrAxisToken( nLinAxes + i, sAxToken) &&
szKey == Trim( sAxToken, " \t\r\n=")) { szKey == Trim( sAxToken)) {
double dVal ; 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 ; vAxRotPrec[i] = dVal ;
}
break ; break ;
} }
} }
@@ -2078,12 +1546,12 @@ Operation::CalculateAxesValues( const string& sHint, bool bRotContOnNext, bool b
DBLVECTOR vAxRotPrecOri = vAxRotPrec ; DBLVECTOR vAxRotPrecOri = vAxRotPrec ;
int nOutStrC = 0 ; int nOutStrC = 0 ;
if ( ! CalculateClPathAxesValues( nClPathId, nLinAxes, nRotAxes, dRot1W, bMaxDeltaR2OnFirst, if ( ! CalculateClPathAxesValues( nClPathId, nLinAxes, nRotAxes, dRot1W, bMaxDeltaR2OnFirst,
bRotContOnNext, dAngDeltaMinForHome, vAxRotHome, vAxRotPrec, nOutStrC)) { dAngDeltaMinForHome, vAxRotHome, vAxRotPrec, nOutStrC)) {
// se attivata scelta angolo iniziale vicino ad home ed extra corsa C, provo a rifarlo disattivando // se attivata scelta angolo iniziale vicino ad home ed extra corsa C, provo a rifarlo disattivando
if ( dAngDeltaMinForHome < ANG_FULL && nOutStrC != 0) { if ( dAngDeltaMinForHome < ANG_FULL && nOutStrC != 0) {
m_pMchMgr->GetCurrMachine()->ResetOutstrokeInfo() ; m_pMchMgr->GetCurrMachine()->ResetOutstrokeInfo() ;
CalculateClPathAxesValues( nClPathId, nLinAxes, nRotAxes, dRot1W, bMaxDeltaR2OnFirst, CalculateClPathAxesValues( nClPathId, nLinAxes, nRotAxes, dRot1W, bMaxDeltaR2OnFirst,
bRotContOnNext, INFINITO, vAxRotHome, vAxRotPrec, nOutStrC) ; INFINITO, vAxRotHome, vAxRotPrec, nOutStrC) ;
} }
// se extracorsa dell'asse C, provo a precaricarlo al contrario // se extracorsa dell'asse C, provo a precaricarlo al contrario
if ( nOutStrC != 0) { if ( nOutStrC != 0) {
@@ -2091,7 +1559,7 @@ Operation::CalculateAxesValues( const string& sHint, bool bRotContOnNext, bool b
vAxRotPrec[0] = vAxRotPrecOri[0] + ( nOutStrC > 0 ? - ANG_FULL : ANG_FULL) ; vAxRotPrec[0] = vAxRotPrecOri[0] + ( nOutStrC > 0 ? - ANG_FULL : ANG_FULL) ;
m_pMchMgr->GetCurrMachine()->ResetOutstrokeInfo() ; m_pMchMgr->GetCurrMachine()->ResetOutstrokeInfo() ;
if ( ! CalculateClPathAxesValues( nClPathId, nLinAxes, nRotAxes, dRot1W, bMaxDeltaR2OnFirst, if ( ! CalculateClPathAxesValues( nClPathId, nLinAxes, nRotAxes, dRot1W, bMaxDeltaR2OnFirst,
bRotContOnNext, INFINITO, vAxRotHome, vAxRotPrec, nOutStrC)) INFINITO, vAxRotHome, vAxRotPrec, nOutStrC))
bOk = false ; bOk = false ;
} }
else else
@@ -2105,9 +1573,8 @@ Operation::CalculateAxesValues( const string& sHint, bool bRotContOnNext, bool b
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W, Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W, bool bMaxDeltaR2OnFirst,
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC)
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC)
{ {
if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr) if ( m_pMchMgr == nullptr || m_pGeomDB == nullptr)
return false ; return false ;
@@ -2170,12 +1637,9 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes,
else { else {
// scelgo gli angoli più vicini, per continuità non applico offset per stare nelle corse // scelgo gli angoli più vicini, per continuità non applico offset per stare nelle corse
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) { for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
if ( bRotContOnNext) vAng1[i] = AngleNearAngle( vAng1[i], vAxRotPrec[i]) ;
vAng1[i] = AngleNearAngle( vAng1[i], vAxRotPrec[i]) ;
else
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome) if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ; vAng1[i] = AngleNearAngle( vAng1[i], vAxRotHome[i]) ;
} }
// se sol.ne indeterminata (sempre il primo asse libero), assegno il precedente // se sol.ne indeterminata (sempre il primo asse libero), assegno il precedente
if ( nRStat < 0 && vAng1.size() >= 1) { if ( nRStat < 0 && vAng1.size() >= 1) {
@@ -2221,18 +1685,12 @@ Operation::CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes,
else { else {
// scelgo gli angoli più vicini, per continuità non applico offset per stare nelle corse // scelgo gli angoli più vicini, per continuità non applico offset per stare nelle corse
for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) { for ( int i = 0 ; i < int( vAng1.size()) ; ++ i) {
if ( bRotContOnNext) vAng1[i] = AngleNearAngle( vAng1[i], vAxRotPrec[i]) ;
vAng1[i] = AngleNearAngle( vAng1[i], vAxRotPrec[i]) ;
else
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng1[i]) ;
if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome) if ( abs( vAng1[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng1[i]) ; vAng1[i] = AngleNearAngle( vAng1[i], vAxRotHome[i]) ;
if ( bRotContOnNext) vAng2[i] = AngleNearAngle( vAng2[i], vAxRotPrec[i]) ;
vAng2[i] = AngleNearAngle( vAng2[i], vAxRotPrec[i]) ;
else
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotPrec[i], vAng2[i]) ;
if ( abs( vAng2[i] - vAxRotPrec[i]) > dAngDeltaMinForHome) if ( abs( vAng2[i] - vAxRotPrec[i]) > dAngDeltaMinForHome)
m_pMchMgr->GetNearestAngleInStroke( i, vAxRotHome[i], vAng2[i]) ; vAng2[i] = AngleNearAngle( vAng2[i], vAxRotHome[i]) ;
} }
// se sol.ne indeterminata (sempre il primo asse libero), assegno il precedente // se sol.ne indeterminata (sempre il primo asse libero), assegno il precedente
if ( nRStat < 0 && vAng1.size() >= 1) { if ( nRStat < 0 && vAng1.size() >= 1) {
@@ -2599,15 +2057,12 @@ Operation::AdjustStartEndMovements( bool bVerifyPreviousLink)
else else
return false ; return false ;
} }
// Recupero box complessivo dei grezzi attivi
BBox3d b3Raws ;
GetCurrRawsGlobBox( b3Raws) ;
// Se già a Zmax // Se già a Zmax
if ( bMaxZ) { if ( bMaxZ) {
// non devo fare alcunché // non devo fare alcunché
} }
// se altrimenti richiesta risalita a Zmax // se altrimenti richiesta risalita a Zmax
else if ( bToZmax || ForcedZmax( vAxVal, vAxIni, b3Raws)) { else if ( bToZmax || ForcedZmax( vAxVal, vAxIni)) {
// cancello eventuale risalita parziale della lavorazione precedente // cancello eventuale risalita parziale della lavorazione precedente
pPrevOp->RemoveRise() ; pPrevOp->RemoveRise() ;
// aggiungo risalita a Zmax // aggiungo risalita a Zmax
@@ -2838,9 +2293,6 @@ Operation::AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation*
} }
// verifico se la testa interferisce con i pezzi o i bloccaggi sulla tavola // verifico se la testa interferisce con i pezzi o i bloccaggi sulla tavola
else { else {
// Recupero box complessivo dei grezzi attivi
BBox3d b3Raws ;
GetCurrRawsGlobBox( b3Raws) ;
// recupero se ZHome è in basso // recupero se ZHome è in basso
bool bZHomeDown = GetZHomeDown() ; bool bZHomeDown = GetZHomeDown() ;
// determino la Z più alta tra le due posizioni // determino la Z più alta tra le due posizioni
@@ -2849,7 +2301,7 @@ Operation::AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation*
DBLVECTOR vAxPrevTmp = vAxPrev ; vAxPrevTmp[2] = dTopZ ; DBLVECTOR vAxPrevTmp = vAxPrev ; vAxPrevTmp[2] = dTopZ ;
DBLVECTOR vAxCurrTmp = vAxCurr ; vAxCurrTmp[2] = dTopZ ; DBLVECTOR vAxCurrTmp = vAxCurr ; vAxCurrTmp[2] = dTopZ ;
// verifico se forzata risalita a Zmax // verifico se forzata risalita a Zmax
bool bForcedZMax = ForcedZmax( vAxPrevTmp, vAxCurrTmp, b3Raws) ; bool bForcedZMax = ForcedZmax( vAxPrevTmp, vAxCurrTmp) ;
// se interferisce // se interferisce
if ( bForcedZMax || ! TestCollisionAvoid( vAxPrevTmp, vAxCurrTmp)) { if ( bForcedZMax || ! TestCollisionAvoid( vAxPrevTmp, vAxCurrTmp)) {
// recupero HomeZ // recupero HomeZ
@@ -3306,21 +2758,6 @@ Operation::RemoveHome( void)
return true ; return true ;
} }
//----------------------------------------------------------------------------
bool
Operation::RemoveClimbRiseHome( void)
{
// elimino le entità CLIMB, RISE e HOME delle diverse path dell'operazione
int nClId = m_pGeomDB->GetFirstNameInGroup( m_nOwnerId, MCH_CL) ;
int nClPathId = m_pGeomDB->GetFirstGroupInGroup( nClId) ;
while ( nClPathId != GDB_ID_NULL) {
RemoveClimb( nClPathId) ;
RemoveRise( nClPathId) ;
nClPathId = m_pGeomDB->GetNextGroup( nClPathId) ;
}
return ( nClId != GDB_ID_NULL) ;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Operation::CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) const Operation::CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) const
@@ -3379,7 +2816,7 @@ Operation::CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR
bool bool
Operation::GetExtraZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1, Operation::GetExtraZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
const DBLVECTOR& vAx2, const Vector3d& vtTool2, const DBLVECTOR& vAx2, const Vector3d& vtTool2,
double dHomeZ, double& dExtraZ) const double dSafeZ, double& dExtraZ) const
{ {
// Recupero macchina corrente // Recupero macchina corrente
Machine* pMch = ( m_pMchMgr != nullptr ? m_pMchMgr->GetCurrMachine() : nullptr) ; Machine* pMch = ( m_pMchMgr != nullptr ? m_pMchMgr->GetCurrMachine() : nullptr) ;
@@ -3401,12 +2838,12 @@ Operation::GetExtraZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
if ( SpecialGetMaxZ( vAx1, vtTool1, vAx2, vtTool2, dMaxZ)) { if ( SpecialGetMaxZ( vAx1, vtTool1, vAx2, vtTool2, dMaxZ)) {
// se caso standard // se caso standard
if ( ! bZHomeDown) { if ( ! bZHomeDown) {
dExtraZ = min( dMaxZ, dAxZmax) - dHomeZ ; dExtraZ = min( dMaxZ, dAxZmax) - dSafeZ ;
return ( dExtraZ > EPS_SMALL) ; return ( dExtraZ > EPS_SMALL) ;
} }
// altrimenti caso con posizione sicura in basso (teste da sotto) // altrimenti caso con posizione sicura in basso (teste da sotto)
else { else {
dExtraZ = max( dMaxZ, dAxZmin) - dHomeZ ; dExtraZ = max( dMaxZ, dAxZmin) - dSafeZ ;
return ( dExtraZ < EPS_SMALL) ; return ( dExtraZ < EPS_SMALL) ;
} }
} }
@@ -3431,14 +2868,14 @@ Operation::GetExtraZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
if ( ! bZHomeDown) { if ( ! bZHomeDown) {
double dZmax ; double dZmax ;
pMch->GetCurrAxisMax( 2, dZmax) ; pMch->GetCurrAxisMax( 2, dZmax) ;
dExtraZ = min( vdVal[0], dZmax - dHomeZ) ; dExtraZ = min( vdVal[0], dZmax - dSafeZ) ;
return ( dExtraZ > EPS_SMALL) ; return ( dExtraZ > EPS_SMALL) ;
} }
// altrimenti caso con posizione sicura in basso (teste da sotto) // altrimenti caso con posizione sicura in basso (teste da sotto)
else { else {
double dZmin ; double dZmin ;
pMch->GetCurrAxisMin( 2, dZmin) ; pMch->GetCurrAxisMin( 2, dZmin) ;
dExtraZ = max( vdVal[0], dZmin - dHomeZ) ; dExtraZ = max( vdVal[0], dZmin - dSafeZ) ;
return ( dExtraZ < EPS_SMALL) ; return ( dExtraZ < EPS_SMALL) ;
} }
} }
@@ -3524,7 +2961,7 @@ Operation::GetRotationAtZmax( void) const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool bool
Operation::ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, const BBox3d& b3Raws) const Operation::ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const
{ {
// Recupero macchina corrente // Recupero macchina corrente
Machine* pMch = ( m_pMchMgr != nullptr ? m_pMchMgr->GetCurrMachine() : nullptr) ; Machine* pMch = ( m_pMchMgr != nullptr ? m_pMchMgr->GetCurrMachine() : nullptr) ;
@@ -3542,13 +2979,6 @@ Operation::ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, const
int nHeadId = pMch->GetCurrHead() ; int nHeadId = pMch->GetCurrHead() ;
DBLVECTOR vdVal ; DBLVECTOR vdVal ;
if ( m_pGeomDB->GetInfo( nHeadId, MCH_ZMAXONROT, vdVal) && vdVal.size() >= 1 && lround(vdVal[0]) > 0) { if ( m_pGeomDB->GetInfo( nHeadId, MCH_ZMAXONROT, vdVal) && vdVal.size() >= 1 && lround(vdVal[0]) > 0) {
// controllo altezza minima grezzi
double dHmin = 100 * EPS_SMALL ;
if ( vdVal.size() >= 3)
dHmin = max( vdVal[2], dHmin) ;
if ( b3Raws.GetDimZ() < dHmin)
return false ;
// controllo variazione angolare minima
double dAngTol = 100 * EPS_ANG_SMALL ; double dAngTol = 100 * EPS_ANG_SMALL ;
if ( vdVal.size() >= 2) if ( vdVal.size() >= 2)
dAngTol = max( vdVal[1], dAngTol) ; dAngTol = max( vdVal[1], dAngTol) ;
+8 -26
View File
@@ -20,7 +20,6 @@
#include "/EgtDev/Include/EGkUserObj.h" #include "/EgtDev/Include/EGkUserObj.h"
#include "/EgtDev/Include/EGkSelection.h" #include "/EgtDev/Include/EGkSelection.h"
#include "/EgtDev/Include/EgtNumCollection.h" #include "/EgtDev/Include/EgtNumCollection.h"
#include "/EgtDev/Include/EGkStmStandard.h"
class MachMgr ; class MachMgr ;
class CamData ; class CamData ;
@@ -72,26 +71,14 @@ class Operation : public IUserObj
const Vector3d& vtDir, double& dElev) const ; const Vector3d& vtDir, double& dElev) const ;
bool GetElevation( int nPhase, const Point3d& ptP, bool GetElevation( int nPhase, const Point3d& ptP,
const Vector3d& vtDir, double& dElev, Vector3d& vtNorm) const ; 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, bool GetElevation( int nPhase, const Point3d& ptP1, const Point3d& ptP2,
const Vector3d& vtDir, double& dElev) const ; const Vector3d& vtDir, double& dElev) const ;
bool GetElevation( int nPhase, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptP3, bool GetElevation( int nPhase, const Point3d& ptP1, const Point3d& ptP2, const Point3d& ptP3,
const Vector3d& vtDir, double& dElev) const ; const Vector3d& vtDir, double& dElev) const ;
bool GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad, bool GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad,
const Vector3d& vtDir, double& dElev) const ; const Vector3d& vtDir, double& dElev) const ;
bool GetElevation( int nPhase, const Point3d& ptP, const Vector3d& vtTool, double dRad, double dLen, bool GetPointUnderRaw( const Point3d& ptP, const Vector3d& vtTool, double dToolRad, double dToolRadForElev,
const Vector3d& vtDir, double& dElev) const ; double dToolLen, bool bIsSaw, double dSafeZ, const Vector3d& vtDir, double& dElev) const ;
bool GetElevation( int nPhase, const Point3d& ptS, const Point3d& ptE, 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 GetSignedDistFromStmRaw( int nPhase, const Point3d ptP, const Vector3d vtDir,
double& dDist, Vector3d& vtNorm) const ;
bool GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist) const ; bool GetDistanceFromRawSide( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist) const ;
bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand, bool GetMinDistanceFromRawSide( int nPhase, const Point3d& ptP, double dExpand,
double& dDist, Vector3d& vtDir) const ; double& dDist, Vector3d& vtDir) const ;
@@ -102,10 +89,9 @@ class Operation : public IUserObj
{ double dDummy ; { double dDummy ;
return GetDistanceFromRawBottom( nPhase, nPathId, dToler, dRbDist, 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, int nPathId, double dToler, double& dRbDist, double& dAllRbDist) const ;
bool GetDistanceFromRawBottom( int nPhase, BBox3d& b3Test, 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, int nPathId, double dToler, BBox3d& b3Raw) const ;
bool GetRawGlobBox( int nPhase, const BBox3d& b3Test, double dToler, BBox3d& b3Raw) const ; bool GetRawGlobBox( int nPhase, const BBox3d& b3Test, double dToler, BBox3d& b3Raw) const ;
bool GetCurrRawsGlobBox( BBox3d& b3Raw) const ;
bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo, int nToolDir, int nFaceUse, double dToolThick, int nGrade = 3) ; bool AdjustCurveFromSurf( ICurveComposite* pCrvCompo, int nToolDir, int nFaceUse, double dToolThick, int nGrade = 3) ;
bool ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp = false) const ; bool ApproxWithArcsIfUseful( ICurveComposite* pCompo, bool bCareTempProp = false) const ;
@@ -115,8 +101,6 @@ class Operation : public IUserObj
bool CalcAndSetBBox( int nClId) ; bool CalcAndSetBBox( int nClId) ;
bool CalcAndSetAxesBBox( void) ; bool CalcAndSetAxesBBox( void) ;
bool CalcMirrorByDouble( int nClId, const std::string& sUserNotes) ;
bool GetInitialAxesValues( bool bSkipClimb, DBLVECTOR& vAxVal) const ; bool GetInitialAxesValues( bool bSkipClimb, DBLVECTOR& vAxVal) const ;
bool GetClPathInitialAxesValues( int nClPathId, bool bSkipClimb, DBLVECTOR& vAxVal) const ; bool GetClPathInitialAxesValues( int nClPathId, bool bSkipClimb, DBLVECTOR& vAxVal) const ;
bool GetFinalAxesValues( bool bSkipRise, DBLVECTOR& vAxVal) const ; bool GetFinalAxesValues( bool bSkipRise, DBLVECTOR& vAxVal) const ;
@@ -132,10 +116,9 @@ class Operation : public IUserObj
std::string ExtractInfo( const std::string& sNotes, const std::string& sKey) const ; std::string ExtractInfo( const std::string& sNotes, const std::string& sKey) const ;
std::string ExtractHint( const std::string& sNotes) const ; std::string ExtractHint( const std::string& sNotes) const ;
bool SetBlockedRotAxis( const std::string& sBlockedAxis) const ; bool SetBlockedRotAxis( const std::string& sBlockedAxis) const ;
bool CalculateAxesValues( const std::string& sHint, bool bRotContOnNext = true, bool bSolChExact = false) ; bool CalculateAxesValues( const std::string& sHint, bool bSolChExact = false) ;
bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W, bool CalculateClPathAxesValues( int nClPathId, int nLinAxes, int nRotAxes, double dRot1W, bool bMaxDeltaR2OnFirst,
bool bMaxDeltaR2OnFirst, bool bRotContOnNext, double dAngDeltaMinForHome, double dAngDeltaMinForHome, const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
const DBLVECTOR& vAxRotHome, DBLVECTOR& vAxRotPrec, int& nOutStrC) ;
bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ; bool AdjustStartEndMovements( bool bVerifyPreviousLink = true) ;
bool AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, const DBLVECTOR& vAxPrev, bool bMaxZ) ; bool AdjustOneStartMovement( int nClPathId, int nPrevClPathId, Operation* pPrevOp, const DBLVECTOR& vAxPrev, bool bMaxZ) ;
bool ToolChangeNeeded( const Operation& Op1, const Operation& Op2) const ; bool ToolChangeNeeded( const Operation& Op1, const Operation& Op2) const ;
@@ -144,16 +127,15 @@ class Operation : public IUserObj
bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, int nFlag = 0) ; bool AddSpecialRise( const DBLVECTOR& vAxVal, bool bOk = true, int nClPathId = GDB_ID_NULL, int nFlag = 0) ;
bool RemoveRise( int nClPathId = GDB_ID_NULL) ; bool RemoveRise( int nClPathId = GDB_ID_NULL) ;
bool AddHome( void) ; bool AddHome( void) ;
bool RemoveClimbRiseHome( void) ;
bool CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) const ; bool CalcDeltaZForHeadRotation( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, double& dDeltaZ) const ;
bool GetExtraZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1, bool GetExtraZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
const DBLVECTOR& vAx2, const Vector3d& vtTool2, const DBLVECTOR& vAx2, const Vector3d& vtTool2,
double dHomeZ, double& dExtraZ) const ; double dSafeZ, double& dExtraZ) const ;
bool SpecialGetMaxZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1, bool SpecialGetMaxZ( const DBLVECTOR& vAx1, const Vector3d& vtTool1,
const DBLVECTOR& vAx2, const Vector3d& vtTool2, const DBLVECTOR& vAx2, const Vector3d& vtTool2,
double& dMaxZ) const ; double& dMaxZ) const ;
bool GetRotationAtZmax( void) const ; bool GetRotationAtZmax( void) const ;
bool ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd, const BBox3d& b3Raws) const ; bool ForcedZmax( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
int GetUserNotesZmax( void) const ; int GetUserNotesZmax( void) const ;
bool GetZHomeDown( void) const ; bool GetZHomeDown( void) const ;
bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ; bool TestCollisionAvoid( const DBLVECTOR& vAxStart, const DBLVECTOR& vAxEnd) const ;
-1
View File
@@ -60,7 +60,6 @@ static const std::string GVAR_TOOL = ".TOOL" ; // (string) nome uten
static const std::string GVAR_HEAD = ".HEAD" ; // (string) nome testa static const std::string GVAR_HEAD = ".HEAD" ; // (string) nome testa
static const std::string GVAR_EXIT = ".EXIT" ; // (int) indice uscita static const std::string GVAR_EXIT = ".EXIT" ; // (int) indice uscita
static const std::string GVAR_TCPOS = ".TCPOS" ; // (string) eventuale posizione utensile nel TC static const std::string GVAR_TCPOS = ".TCPOS" ; // (string) eventuale posizione utensile nel TC
static const std::string GVAR_TTYPE = ".TTYPE" ; // (int) tipo utensile
static const std::string GVAR_TCOMP = ".TCOMP" ; // (int) numero correttore utensile static const std::string GVAR_TCOMP = ".TCOMP" ; // (int) numero correttore utensile
static const std::string GVAR_TDIAM = ".TDIAM" ; // (num) diametro utensile static const std::string GVAR_TDIAM = ".TDIAM" ; // (num) diametro utensile
static const std::string GVAR_TTOTDIAM = ".TTOTDIAM" ; // (num) diametro totale utensile static const std::string GVAR_TTOTDIAM = ".TTOTDIAM" ; // (num) diametro totale utensile
+3495 -7842
View File
File diff suppressed because it is too large Load Diff
+77 -180
View File
@@ -20,8 +20,6 @@
#include "/EgtDev/Include/EGkCurveLine.h" #include "/EgtDev/Include/EGkCurveLine.h"
#include "/EgtDev/Include/EgtNumUtils.h" #include "/EgtDev/Include/EgtNumUtils.h"
#include "/EgtDev/Include/EGkSurfFlatRegion.h" #include "/EgtDev/Include/EGkSurfFlatRegion.h"
#include "/EgtDev/Include/EGkSurfTriMesh.h"
#include "/EgtDev/Include/EGkCurveArc.h"
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
class Pocketing : public Machining class Pocketing : public Machining
@@ -70,172 +68,81 @@ class Pocketing : public Machining
private : private :
bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ; bool VerifyGeometry( SelData Id, int& nSubs, int& nType) ;
bool GetCurvesAndPartialVolume( SelData Id, ICURVEPLIST& lstPC, ISurfTriMesh* pStmTmp, Vector3d& vtN) ; bool GetCurves( SelData Id, ICURVEPLIST& lstPC) ;
bool GetForcedClosed( void) ; bool SetCurveAllTempProp( int nCrvId, ICurve* pCurve) ;
bool SetCurveAllTempProp( int nCrvId, bool bForcedClose, ICurve* pCurve, bool* pbSomeOpen = nullptr) ;
bool ResetCurveAllTempProp( ICurve* pCurve) ; bool ResetCurveAllTempProp( ICurve* pCurve) ;
bool Chain( int nGrpDestId) ; bool Chain( int nGrpDestId) ;
bool ProcessPath( int nPathId, int nPvId, int nClId) ; bool ProcessPath( int nPathId, int nPvId, int nClId) ;
bool CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double dLen, double& dElev) const ; bool CalcRegionElevation( const ICurveComposite* pCompo, const Vector3d& vtTool, double dDepth, double dRad, double& dElev) const ;
bool VerifyPathFromBottom( const ICurveComposite* pCompo, const Vector3d& vtTool) ; bool VerifyPathFromBottom( const ISurfFlatRegion* pSrf, const Vector3d& vtTool) ;
bool GeneratePocketingPv( int nPathId, const ISurfTriMesh* pStm_PartVolume) ; bool GeneratePocketingPv( int nPathId, const ISurfFlatRegion* pSrfPock) ;
bool CheckSimpleOverlap( const ICurve* pCrv, const ICurveComposite* pCrvOri, int& nStat, double dToll) ;
bool CalcDepth( const int nId, const Vector3d& vtExtr, double dThick, double& dDepth) ; bool ModifyCurveToSmooted( ICurveComposite* pCrvOffset, double dRightPer, double dleftPer) ;
bool ChainCurveArray( const SELVECTOR vInds, ICURVEPOVECTOR& vpCrvs, ICRVCOMPOPOVECTOR& vCrvCompo) ;
bool CreateStmForIntersection( ISurfTriMesh* pStm, ICRVCOMPOPOVECTOR& vCrvCompo, const Vector3d& vtN) ; // ===== ZigZag =====
bool CalcOffsExtensionsForCurves( const ICurveComposite* pCrvCompo, const Vector3d& vtN, double& dExt) ; bool AddZigZag( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth, double dElev, double dOkStep,
bool GetExtendedLoopToFitStmVolume( ICurveComposite* pCrvLoop, const double& dExt, const Vector3d& vtN) ; bool bSplitArcs, int nPathId) ;
bool GetCurrentPart( const Point3d& ptInside, ISurfTriMesh* pStmPart) ;
bool SetPocketingVolume( const Point3d& ptInside, ISurfTriMesh* pStm) ;
bool AdjustPocketingSideForVolumePart( ISurfTriMesh* pStmVolPart, const Vector3d& vtTool) ;
bool SewingMissingFacesOnPlanes( ISurfTriMesh* pStm, const Plane3d& plPlane) ;
bool SliceVolume( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part, ISURFFRPOVECTOR& vSrfSliced,
std::vector<ICRVCOMPOPOVECTOR>& vCrvOEWithFlags, BOOLVECTOR& vbChangedPrec,
VCT3DVECTOR& vVtTrasl, int& nStep, const Vector3d vtTool,
const double dElev, const double dDepth, const double dStep) ;
bool CalcExtraSteps( const ISurfTriMesh* pStmVol, VCT3DVECTOR& vVtTrasl, int& nStep, const double dElev,
const double dDepth, const double dStep, INTVECTOR& vIndExtraSteps,
ISURFTMPOVECTOR& vStmES_Edges_OC) ;
bool CutVolumeByPlane( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part, const Vector3d& vtTrasl,
const bool bIsExtraStep, ISurfFlatRegion* pSfrResult) ;
bool ProjectVolume( const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part, const Vector3d& vtTrasl,
const Vector3d& vtTraslPrec, ISurfFlatRegion* pSfrOpenProjPrec, ISurfFlatRegion* pSfr) ;
bool ChooseCloseOrOpenEdge( ISurfFlatRegion* pSfr, const ISurfTriMesh* pStm, const bool bOnIsClosed = false) ;
bool GetCurvesForOptimizedPocketing( ISurfFlatRegion* pSfr, ICRVCOMPOPOVECTOR& vCrvOEWithFlags) ;
bool ModifySurfByOpenEdges( ISurfFlatRegion* pSfr, const ISurfFlatRegion* pSfrLimit) ;
bool AdjustContourWithOpenEdges( ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vCrvIsl, const double dDiam,
const double dOffR, const double dStep, const ISurfFlatRegion* pSfrLimit) ;
bool AdjustOpenEdge( const ICurveComposite* pCrvCompo, const ICRVCOMPOPOVECTOR& vCrvIsland,
const double dParS, const double dParE, const double dRad, const double dDiamJ,
const ISurfFlatRegion* pSfrLimit, ICurveComposite* pCrvBorder) ;
bool GetProjectionOfStmToNotPocket( const ISurfTriMesh* pStmPart, const ISurfTriMesh* pStmVol,
const Vector3d& vtTrasl, ISurfFlatRegion* pSfrProj) ;
bool CreateSurfFrIncidence( const ICurveComposite* pCrv, const double dRad, ISurfFlatRegion* pSfrInc) ;
bool GetNewSfrByAnotherPocketing( ISurfFlatRegion* pSfrPock, const ISurfFlatRegion* pSfrNoExtendedByOpenEdges,
const ISurfTriMesh* pStmVol, const ISurfTriMesh* pStm_Part,
const ISurfFlatRegion* pSfrLimit) ;
bool CalcAdaptedElevation( const Point3d& pt1, const Point3d& pt2) ;
bool GetHomogeneousParts( ICurveComposite* pCrvCompo, ICRVCOMPOPOVECTOR& vpCrvs) ;
bool ModifyCurveToSmoothed( ICurveComposite* pCrv, double dRightLen, double dLeftLen, bool bAsParam) ;
bool OrderCurvesByLastPntOfPath( ICRVCOMPOPOVECTOR& vCrv, Point3d ptEnd, PNTVECTOR& vPtStart,
VCT3DVECTOR& vVtOut, BOOLVECTOR& vbMidOut) ;
bool SetBetterPtStartForSubChunks( ICurveComposite* pCrv0, const ISurfFlatRegion* pSrfToWork, Point3d& ptStart,
Vector3d& vtMidOut, bool& bMidOut) ;
bool GetOptCrvIndex( const std::vector<ICRVCOMPOPOVECTOR>& vCrvOEWithFlags, int nStep, ISurfFlatRegion* pSrfChunkFinal,
int& nIndex) ;
bool GetTrapezoidFromShape( const ICurveComposite* pCrvCompo, ICurveComposite* pCrvTrap, Frame3d& frTrap,
double& dPocketSize, int& nBase, int& nSecondBase) ;
bool CheckTrapezoidClosedEdgePosition( const ICurveComposite* pCrvCompo, const int nCrvInd, const double dDimBoxY,
INTVECTOR& vIndClosedSides, bool& bOk,
ICurveComposite* pCrvTrap) ;
bool CheckSecondBaseTrapezoid( const ICurveComposite* pCrvCompo, const int nCrvInd, int& nSecondBase) ;
bool PreparareTrapezoidTwoBases( const ICurveComposite* pCrvCompo, BBox3d BBox, const int nBase, int& nSecondBase,
bool& bOk, ICurveComposite* pCrvTrap) ;
bool GetSfrByStm( const ISurfTriMesh* pStm, ISurfFlatRegion* pSfr, const Plane3d plPock, const Vector3d& vtExtr,
const double dThick, double dToll = 5 * EPS_SMALL) ;
bool ProjectStmOnPlane( const ISurfTriMesh* pStmAbove, const Plane3d plPock, ISurfFlatRegion* pSfrProj) ;
bool GetCoeffLinArc( const ICurveArc* pArc, double dDiam, double& dSubArc) ;
bool GetParamOnOpenSide( const ICurveComposite* pCompo,const ICRVCOMPOPOVECTOR& vCrvIsl, Point3d& ptMid, Vector3d& vtMidOut) ;
bool AdjustContourStart( ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvIsl, bool bOrder = false) ;
bool GetParamForPtStartOnEdge( const ICurve* pCrv, const ICurveComposite* pCompo, const ICRVCOMPOPOVECTOR& vCrvIsl,
double& dPar) ;
bool CheckForRemovingIsland( const ICurveComposite* pCrvIslandBorder, double dOffs, bool bRemove) ;
bool AddZigZag( ISURFFRPOVECTOR& vSfr, const std::vector<ICRVCOMPOPOVECTOR>& vCrvOrig, BOOLVECTOR& vbChangedPrec,
VCT3DVECTOR& vVtTrasl, const Vector3d& vtTool, const Vector3d& vtExtr,
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs) ;
bool CalcZigZag( const ISurfFlatRegion* pSrfZigZag, ICRVCOMPOPOVECTOR& vpCrvs) ; bool CalcZigZag( const ISurfFlatRegion* pSrfZigZag, ICRVCOMPOPOVECTOR& vpCrvs) ;
bool CalcZigZagLink( ICurveComposite* pCrv1, ICurveComposite* pCrv2, ICurveComposite* pCrvLink) ; bool CalcBoundedZigZagLink( ICurveLine* pCrv1, ICurveLine* pCrv2, ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink, int nIndexCut = 3) ;
bool OptimizedZigZag( ISurfFlatRegion* pSrf, const Vector3d & vtTool, double dDepth, double dSafeZ, bool OptimizedZigZag( ISurfFlatRegion* pSrf, const Vector3d & vtTool, double dDepth, double dSafeZ, Frame3d & frPocket, bool & bOptimizedZigZag,
Frame3d& frPocket, ICurveComposite* pCrvOrig, bool& bOptimizedZigZag, ICRVCOMPOPOVECTOR & vpCrvs) ;
ICRVCOMPOPOVECTOR& vpCrvs, ICRVCOMPOPOVECTOR& vCrvIslMergeBorders, double& dOffs, bool ZigZagOptimizedNoClosedEdges( ICurveComposite* pCrvPocket, bool& bOptimizedZigZag, Vector3d& vtDir) ;
int& nClosedSides, bool& bTwoOpposite) ; bool ZigZagOptimizedOneClosedEdge( ICurveComposite* pCrvPocket, int nClosedId, bool& bOptimizedZigZag, Vector3d& vtDir) ;
bool ZigZagOptimizedNoClosedEdges( ICurveComposite* pCrvPocket, bool& bOptimizedZigZag, Vector3d& vtDir, double& dOffs) ; bool ZigZagOptimizedTwoClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag,
bool ZigZagOptimizedOneClosedEdge( ICurveComposite* pCrvPocket, int nClosedId, bool& bOptimizedZigZag, bool& bOpposite, Vector3d& vtDir) ;
Vector3d& vtDir, double& dOffs) ;
bool ZigZagOptimizedTwoClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds,
bool& bOptimizedZigZag, bool& bOpposite, Vector3d& vtDir, double& dOffs) ;
bool ZigZagOptimizedThreeClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag, bool ZigZagOptimizedThreeClosedEdges( ICurveComposite* pCrvPocket, const INTVECTOR& vnClosedIds, bool& bOptimizedZigZag,
bool& bOpposite, Vector3d& vtDir, double& dOffs) ; bool& bOpposite, Vector3d& vtDir) ;
bool ZigZagOptimizedComputeOffset( ICurveComposite* pCrvPocket, const Vector3d& vtMainDir, int nOffsettedEdgesOnY, bool ZigZagOptimizedComputeOffset( ICurveComposite* pCrvPocket, const Vector3d& vtMainDir, int nOffsettedEdgesOnY,
const INTVECTOR& vnClosedIds, double& dOffs) ; const INTVECTOR& vnClosedIds) ;
bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ; bool CutCurveWithLine( ICurveComposite* pCrvA, const ICurveLine* pCrvB) ;
bool AddOneWay( ISURFFRPOVECTOR& vSfr, const std::vector<ICRVCOMPOPOVECTOR>& vCrvOrig, BOOLVECTOR& vbChangedPrec, bool GetUnclearedRegion( ICRVCOMPOPOVECTOR& vFirstOffs, ICRVCOMPOPOVECTOR& vCrvs, ICURVEPOVECTOR& vLinks, ISurfFlatRegion* pSrfToCut) ;
VCT3DVECTOR& vVtTrasl, const Vector3d& vtTool, const Vector3d& vtExtr, // ==================
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs) ;
bool AddSpiralIn( ISURFFRPOVECTOR& vSfr, const std::vector<ICRVCOMPOPOVECTOR>& vCrvOrig, BOOLVECTOR& vbChangedPrec, // ==== OneWay ======
VCT3DVECTOR& vVtTrasl, const Vector3d& vtTool, const Vector3d& vtExtr, bool AddOneWay( const ISurfFlatRegion* pSrfPock, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth, double dElev, double dOkStep, bool bSplitArcs) ;
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs) ; // ==================
bool AddSpiralOut( ISURFFRPOVECTOR& vSfr, const std::vector<ICRVCOMPOPOVECTOR>& vCrvOrig, BOOLVECTOR& vbChangedPrec,
VCT3DVECTOR& vVtTrasl, const Vector3d& vtTool, const Vector3d& vtExtr, // ==== SpiralIn/Out ====
double dDepth, double dElev, double dMaxElev, double dOkStep, bool bSplitArcs) ; bool AddSpiralIn( const ISurfFlatRegion* pSrfPock, const PNTVECTOR vPtStart, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth,
bool CalcSpiral( const ISurfFlatRegion* pSrfPock, int& nReg, Point3d& ptStart, Vector3d& vtMidOut , bool& bMidOut, double dElev, double dOkStep, bool bSplitArcs, BOOLVECTOR vbMidOpen, PNTVECTOR vPtMidOpen, VCT3DVECTOR vVtMidOut, int nPathId) ;
bool bSplitArcs,ICurveComposite* pMCrv, ICurveComposite* pRCrv, ICurveComposite* pCrvOEWithFlags, bool AddSpiralOut( const ISurfFlatRegion* pSrfpock, const PNTVECTOR vPtStart, const Vector3d& vtTool, const Vector3d& vtExtr, double dDepth, double dElev,
bool vbChangedPrec, bool& bOptimizedTrap) ; double dOkStep, bool bSplitArcs, int nPathId) ;
bool CheckIfOffsetIsNecessary( const ICurveComposite* pCrvOffs, const double dOffs, const int nIter, bool CalcSpiral( const ISurfFlatRegion* pSrfChunk, int nReg, Point3d ptStart, bool bSplitArcs, ICurveComposite* pMCrv, ICurveComposite* pRCrv, int nPathId,
const int nOffsCount, const Vector3d& vtN, bool& bInsert) ; bool& bOptimizedTrap) ;
bool GetUnclearedRegion( ICRVCOMPOPOVECTOR& vFirstOffs, ICRVCOMPOPOVECTOR& vCrvs, ICURVEPOVECTOR& vLinks, bool RemoveExtraParts( ISurfFlatRegion* pSrfToCut, ICRVCOMPOPOVECTOR& vOffs, ICRVCOMPOPOVECTOR& vOffsClosedCurves, ICRVCOMPOPOVECTOR& vOffsFirstCurve,
const ICurveComposite* pCrv_orig, ISurfFlatRegion* pSrfToCut) ; ICURVEPOVECTOR& vLinks) ;
bool GetDynamicClearedRegion( ISurfFlatRegion* pSrfPrec, const ICurveComposite* pCrv) ; bool RemoveExtraPartByMedialAxis( ISurfFlatRegion* pChunkToCut, ICRVCOMPOPOVECTOR& vOffsFirstCurve, int& nOptFlag, Point3d& ptCentroid,
bool RemoveFirstLoopFromSfr( ISurfFlatRegion* pSrfOrig ) ; ICurveComposite* pCrvPath) ;
bool RemoveExtraParts( ISurfFlatRegion* pSrfToCut, ICRVCOMPOPOVECTOR& vOffs, ICRVCOMPOPOVECTOR& vOffsClosedCurves, bool CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink) ;
ICRVCOMPOPOVECTOR& vOffsFirstCurve, ICURVEPOVECTOR& vLinks) ;
bool RemoveExtraPartByMedialAxis( const ISurfFlatRegion* pChunkToCut, ICRVCOMPOPOVECTOR& vOffsFirstCurve,
int& nOptFlag, Point3d& ptCentroid, ICurveComposite* pCrvPath) ;
bool CutOffsetToClosestPoint( ICRVCOMPOPOVECTOR& vCurves, const Point3d& ptFocus, ICurveComposite* pCrv1,
ICurveComposite* pCrv2, int& nIndex) ;
bool CutLinkToClosestPoint( ICURVEPOVECTOR& vCurves, ICRVCOMPOPOVECTOR& vOffs, const Point3d& ptFocus,
ICurveComposite* pCrv1, ICurveComposite* pCrv2, bool& bFound, int& nIndex) ;
bool GetNewCurvetWithCentroid( const ICurveComposite* pCrvH1, const ICurveComposite* pCrvH2, Point3d& ptC, bool bCir,
ICRVCOMPOPOVECTOR& VFirstOff, ICurveComposite* pCrvNewCurve) ;
bool GetNewCurvetWithPath( const ICurveComposite* pCrvH1, const ICurveComposite* pCrvH2, ICurveComposite* pCrvPath,
ICRVCOMPOPOVECTOR& VFirstOff, ICRVCOMPOPOVECTOR& VoffsCl, ICurveComposite* pCrvNewCurve) ;
bool ManageSmoothAndAutoInters( ICurveComposite* pCrv, ICurveComposite* pCrvPath, ICurveComposite* pPath1,
ICurveComposite* pPath2, ICRVCOMPOPOVECTOR& vOffsCL) ;
bool GetCurveWeightInfo( const ICurveComposite* pCrvCompo, double dMaxLen, double& dToTRot, int& nSmallArcs, int& nSmallLines) ;
bool ChoosePath( const ICurveComposite* pCrv1, const ICurveComposite* pCrv2, int nP, double dPerP, double dMaxLen, int& nC) ;
bool CalcBoundedLink( const Point3d& ptStart, const Point3d& ptEnd, ICRVCOMPOPOVECTOR& vOffIslands,
ICurveComposite* pCrvLink) ;
bool CalcBoundedSmootedLink( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd, const Vector3d& vtEnd, double dParMeet, bool CalcBoundedSmootedLink( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd, const Vector3d& vtEnd, double dParMeet,
ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink) ; ICRVCOMPOPOVECTOR& vOffIslands, ICurveComposite* pCrvLink) ;
bool ModifyBiArc( ICurve* pCrvBiArc, double dCutToll, ICurveComposite* pNewCrv) ; bool ModifyBiArc( ICurve* pCrvBiArc, double dCutToll, ICurveComposite* pNewCrv) ;
bool CutCurveByOffsets( ICurveComposite* pCurve, ICRVCOMPOPOVECTOR& vOffs) ; 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, bool CutCurveToConnect( ICurveComposite* pCrvS, ICurveComposite* pCrvE, ICRVCOMPOPOVECTOR& vOffs, ICRVCOMPOPOVECTOR& vOffIslands,
ICurveComposite* pCrvLink, double dLenPercS = 0.01, double dLenPercE = 0.01, int nMaxIter = 2) ; 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 CalcBoundedLinkWithBiArcs( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd, const Vector3d& vtEnd, bool CalcBoundedLinkWithBiArcs( const Point3d& ptStart, const Vector3d& vtStart, const Point3d& ptEnd, const Vector3d& vtEnd,
const ICurve* pCrvBound, ICurveComposite* pCrvLink) ; const ICurve* pCrvBound, ICurveComposite* pCrvLink) ;
bool CalcCircleSpiral( const Point3d& ptCen, const Vector3d& vtN, double dOutRad, double dIntRad, bool CalcCircleSpiral( const Point3d& ptCen, const Vector3d& vtN, double dOutRad, double dIntRad,
bool bSplitArcs, ICurveComposite* pMCrv, ICurveComposite* pRCrv) ; bool bSplitArcs, ICurveComposite* pMCrv, ICurveComposite* pRCrv) ;
bool CalcTrapezoidSpiral( ICurveComposite* pCrvPocket, const Frame3d& frTrap, double dPocketSize, int nBase, bool CalcTrapezoidSpiral( ICurveComposite* pCrvPocket, const Vector3d& vtDir, double dPocketSize,
int nSecondBase, ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool& bOptimizedTrap) ; ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool& bOptimizedTrap) ;
bool CalcTrapezoidSpiralLocalFrame( ICurveComposite * pCrvPocket, const Vector3d& vtDir, Frame3d& frLoc) ; bool CalcTrapezoidSpiralLocalFrame( ICurveComposite * pCrvPocket, const Vector3d& vtDir, Frame3d& frLoc) ;
bool CalcTrapezoidSpiralXCoord( const ICurveComposite * pCrvPocket, int nBase,int nSecondBase, bool CalcTrapezoidSpiralXCoord( const ICurveComposite * pCrvPocket, bool bStart, double dYCoord, double& dXCoord, double dPocketSize) ;
bool bStart, double dYCoord, double& dXCoord, double dPocketSize) ; bool AdjustTrapezoidSpiralForAngles( ICurveComposite * pMCrv, const ICurveComposite * pCrvPocket, bool bStart) ;
bool AdjustTrapezoidSpiralForAngles( ICurveComposite * pMCrv, const ICurveComposite * pCrvPocket, bool SpecialAdjustTrapezoidSpiralForAngles( ICurveComposite* pMCrv, const ICurveComposite* pCrvPocket) ;
bool bStart) ;
bool SpecialAdjustTrapezoidSpiralForAngles( ICurveComposite* pMCrv, const bool bEven, const ICurveComposite* pCrvPocket) ;
bool AdjustTrapezoidSpiralForLeadInLeadOut( ICurveComposite * pCompo, ICurveComposite * pRCrv, const Vector3d& vtTool, bool AdjustTrapezoidSpiralForLeadInLeadOut( ICurveComposite * pCompo, ICurveComposite * pRCrv, const Vector3d& vtTool,
double dDepth, int& nOutsideRaw) ; double dDepth, int& nOutsideRaw) ;
bool ComputeTrapezoidSpiralLeadInLeadOut( ICurveComposite * pCompo, const Vector3d& vtMainDir, bool bLeadIn, const Vector3d& vtTool, double dDepth, bool ComputeTrapezoidSpiralLeadInLeadOut( ICurveComposite * pCompo, const Vector3d& vtMainDir, bool bLeadIn, const Vector3d& vtTool, double dDepth,
bool& bIsOutsideRaw) ; bool& bIsOutsideRaw) ;
bool GetSignedDistFromRealDirection( const Point3d ptP, const Vector3d vtDir, double& dDist, Vector3d& vtNorm) ; // ==================
double GetMinFeed( void ) const { return GetFeed() * GetSideStep() / m_TParams.m_dDiam ; }
double GetMaxFeed( void ) const { return GetFeed() ; }
bool GetFeedForParam( double& dPar, double& dFeed) ;
bool AssignDefaultFeed( ICurveComposite* pCrv) ;
bool DrawColoredCrvForFeedTest( ICurve* pCurve, double dFeed) ;
bool AssignFeedForOpenEdge( ICurveComposite* pCrv, const ICurveComposite* pCrvOF_ori) ;
bool AssignFeedForLineInOut( ICurveComposite* pCrv, const bool bIsIn) ;
bool AssignFeedOnCorners( ICurveComposite* pCrv, const ICurveComposite* pCrv_orig, const double dLenToll) ;
bool AssignFeedForEdgeCleaning( ICurveComposite *pCrv, const ICRVCOMPOPOVECTOR& vCrvOF_orig, int nInd = -1) ;
bool AssignFeedZigZagOneWay( ICurveComposite* pCompoLine, const bool bIsLink, const ICURVEPOVECTOR& vLAbove,
const ICURVEPOVECTOR& vLUnder, const ICRVCOMPOPOVECTOR& vAddedLinks) ;
bool AssignFeedSpiral( ICurveComposite* pCrv, const ISurfFlatRegion* pSrfRemoved_offs, const bool bIsLink,
const ICRVCOMPOPOVECTOR& vLinks_done, const ICurveComposite* pCrv_orig, double dToll) ;
bool AssignFeedSpiralOpt( const int nOptType, ICurveComposite* pCrv) ;
bool AssignFeedCrvOnUnclearedRegions( ICurveComposite* pCrv) ;
bool AssignFeedForReturnPath( ICurveComposite* pCrv) ;
bool VerifyLeadInHelix( ISurfFlatRegion* pSrfChunk, const Point3d& ptCen, double dRad) const ;
bool VerifyLeadInZigZag( ISurfFlatRegion* pSrfChunk, const Point3d& ptPa, const Point3d& ptPb) const ;
bool ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool bSplitArcs) ; bool ComputePolishingPath( ICurveComposite* pMCrv, ICurveComposite* pRCrv, bool bSplitArcs) ;
bool AddEpicycles( ICurveComposite * pCompo, ICurveComposite * pCrv, ICurveComposite * pCrvBound = nullptr) ; bool AddEpicycles( ICurveComposite * pCompo, ICurveComposite * pCrv, ICurveComposite * pCrvBound = nullptr) ;
bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ, bool AddApproach( const Point3d& ptP, const Vector3d& vtTool, double dSafeZ, double dSafeAggrBottZ,
@@ -252,13 +159,14 @@ class Pocketing : public Machining
ISurfFlatRegion* pSrfChunk, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs, ISurfFlatRegion* pSrfChunk, const ICurveComposite* pRCrv, bool bAtLeft, bool bSplitArcs,
bool bNoneForced = false, bool bSkipControl = false) ; bool bNoneForced = false, bool bSkipControl = false) ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN, bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced, Point3d& ptP1, const ICurveComposite* pRCrv, bool bSplitArcs, Point3d& ptP1, double& dElev, bool bNoneForced = false) ;
double& dElev, bool bRecalcElev = true) ;
bool AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vector3d& vtN,
const ICurveComposite* pRCrv, bool bSplitArcs, bool bNoneForced,
Point3d& ptP1, double& dElev, bool& bOppositeHome, bool bRecalcElev = true) ;
double GetRadiusForStartEndElevation( void) const ; 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 CalcDistanceFromRawSurface( int nPhase, const Point3d& ptP, const Vector3d& vtDir, double& dDist, Vector3d& vtNorm) ;
private : private :
double GetSpeed( void) const double GetSpeed( void) const
@@ -283,7 +191,7 @@ class Pocketing : public Machining
if ( m_Params.m_nLeadInType != POCKET_LI_GLIDE && m_Params.m_dLiElev < 10 * EPS_SMALL) if ( m_Params.m_nLeadInType != POCKET_LI_GLIDE && m_Params.m_dLiElev < 10 * EPS_SMALL)
return POCKET_LI_NONE ; return POCKET_LI_NONE ;
return m_Params.m_nLeadInType ; } return m_Params.m_nLeadInType ; }
bool LeadInRawIsOk( void) const int LeadInIsOk( void) const
{ if ( m_TParams.m_nType != TT_MILL_NOTIP) { if ( m_TParams.m_nType != TT_MILL_NOTIP)
return true ; return true ;
return (( GetLeadInType() == POCKET_LI_ZIGZAG || GetLeadInType() == POCKET_LI_HELIX) && return (( GetLeadInType() == POCKET_LI_ZIGZAG || GetLeadInType() == POCKET_LI_HELIX) &&
@@ -294,31 +202,20 @@ class Pocketing : public Machining
return m_Params.m_nLeadOutType ; } return m_Params.m_nLeadOutType ; }
private : private :
SELVECTOR m_vId ; // identificativi entit geometriche da lavorare SELVECTOR m_vId ; // identificativi entità geometriche da lavorare
PocketingData m_Params ; // parametri lavorazione PocketingData m_Params ; // parametri lavorazione
ToolData m_TParams ; // parametri utensile ToolData m_TParams ; // parametri utensile
double m_dTHoldBase ; // posizione base del porta-utensile double m_dTHoldBase ; // posizione base del porta-utensile
double m_dTHoldLen ; // lunghezza del porta-utensile double m_dTHoldLen ; // lunghezza del porta-utensile
double m_dTHoldDiam ; // diametro del porta-utensile double m_dTHoldDiam ; // diametro del porta-utensile
double m_dMaxHelixRad ; // raggio massimo attacco ad elica nel caso di cerchi double m_dMaxHelixRad ; // raggio massimo attacco ad elica nel caso di cerchi
int m_nStatus ; // stato di aggiornamento della lavorazione int m_nStatus ; // stato di aggiornamento della lavorazione
int m_nPockets ; // numero di percorsi di svuotatura generati int m_nPockets ; // numero di percorsi di svuotatura generati
bool m_bTiltingTab ; // flag utilizzo tavola basculante 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_bAboveHead ; // flag utilizzo testa da sopra bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto
bool m_bAggrBottom ; // flag di utilizzo dell'aggregato da sotto Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto
Vector3d m_vtAggrBottom ; // vettore direzione ausiliaria aggregato da sotto AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto
AggrBottom m_AggrBottom ; // dati eventuale aggregato da sotto bool m_bOpenOutRaw ; // flag forzatura lati aperti sempre fuori dal grezzo
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
bool m_bOptOffset = true ; // flag per ottimizzazione numero di Offset necessari
bool m_bOptOffsetCM = false ; // flag per ottimizzazione numero di Offset necessari con centroidi e medial Axis
bool m_bAssignFeed = false ; // flag per controllo della Feed
double m_dDiam_Prec = 0.0 ; // diametro utensile per precedente svuotatura
double m_dOffsetR_Prec = 0.0 ; // offset radiale della svuotatura precedente
double m_dSideStep_Prec = 0.0 ; // side Step della svuotatura precedente
double m_dLen_Prec = 0.0 ; // Lunghezza del tool precedente
bool m_bOrderStepZ = true ; // parametro per ordinare gli step Extra per Z decrescente o meno
bool m_bPocketPlane = false ; // flag per svuotare solo la rimanenza sullo Step Extra
} ; } ;
+2 -6
View File
@@ -83,10 +83,6 @@ struct PocketingData : public MachiningData
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline const PocketingData* GetPocketingData( const MachiningData* pMdata) inline const PocketingData* GetPocketingData( const MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_POCKETING) { return (dynamic_cast<const PocketingData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<const PocketingData*>( pMdata)) ; }
inline PocketingData* GetPocketingData( MachiningData* pMdata) inline PocketingData* GetPocketingData( MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_POCKETING) { return (dynamic_cast<PocketingData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<PocketingData*>( pMdata)) ; }
+4 -15
View File
@@ -84,9 +84,6 @@ Processor::Run( const string& sOutFile, const string& sInfo)
if ( ! VerifySetup()) if ( ! VerifySetup())
return false ; return false ;
// imposto la fase iniziale come corrente
m_pMchMgr->SetCurrPhase( 1) ;
// evento inizio esecuzione // evento inizio esecuzione
bool bOk = true ; bool bOk = true ;
if ( ! OnStart()) { if ( ! OnStart()) {
@@ -148,9 +145,6 @@ Processor::Run( const string& sOutFile, const string& sInfo)
LOG_ERROR( GetEMkLogger(), "OnEnd error") ; LOG_ERROR( GetEMkLogger(), "OnEnd error") ;
} }
// imposto la fase iniziale come corrente
m_pMchMgr->SetCurrPhase( 1) ;
return bOk ; return bOk ;
} }
@@ -190,8 +184,8 @@ Processor::ProcessDisposition( int nOpId, int nOpInd)
bool bEmpty = pDisp->IsEmpty() ; bool bEmpty = pDisp->IsEmpty() ;
bool bSomeByHand = pDisp->GetSomeByHand() ; bool bSomeByHand = pDisp->GetSomeByHand() ;
// Se disposizione con movimenti autonomi e utensile associato // Se disposizione con movimenti macchina
if ( ! pDisp->IsEmpty() && pDisp->IsWithTool()) { if ( ! pDisp->IsEmpty()) {
// Recupero l'utensile della disposizione corrente // Recupero l'utensile della disposizione corrente
string sTool ; string sHead ; int nExit ; string sTcPos ; string sTool ; string sHead ; int nExit ; string sTcPos ;
if ( ! pDisp->GetToolData( sTool, sHead, nExit, sTcPos)) if ( ! pDisp->GetToolData( sTool, sHead, nExit, sTcPos))
@@ -609,7 +603,6 @@ Processor::ProcessToolData( void)
string sHead ; string sHead ;
int nExit ; int nExit ;
string sTcPos ; string sTcPos ;
int nType ;
int nComp ; int nComp ;
double dDiam ; double dDiam ;
double dTDiam ; double dTDiam ;
@@ -618,7 +611,7 @@ Processor::ProcessToolData( void)
double dDist ; double dDist ;
double dMaxSpeed ; double dMaxSpeed ;
MyToolData( void) MyToolData( void)
: sName(), sHead(), nExit( 0), sTcPos(), nType(0), nComp(0), dDiam( 0), dLen( 0), dDist( 0), dMaxSpeed( 0) {} : sName(), sHead(), nExit( 0), sTcPos(), nComp(0), dDiam( 0), dLen( 0), dDist( 0), dMaxSpeed( 0) {}
} ; } ;
typedef vector<MyToolData> TDATAVECTOR ; typedef vector<MyToolData> TDATAVECTOR ;
TDATAVECTOR vTdata ; TDATAVECTOR vTdata ;
@@ -643,7 +636,6 @@ Processor::ProcessToolData( void)
m_pMchMgr->TdbGetCurrToolParam( TPA_HEAD, Tdata.sHead) ; m_pMchMgr->TdbGetCurrToolParam( TPA_HEAD, Tdata.sHead) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_EXIT, Tdata.nExit) ; m_pMchMgr->TdbGetCurrToolParam( TPA_EXIT, Tdata.nExit) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TCPOS, Tdata.sTcPos) ; m_pMchMgr->TdbGetCurrToolParam( TPA_TCPOS, Tdata.sTcPos) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TYPE, Tdata.nType) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_CORR, Tdata.nComp) ; m_pMchMgr->TdbGetCurrToolParam( TPA_CORR, Tdata.nComp) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, Tdata.dDiam) ; m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, Tdata.dDiam) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, Tdata.dTDiam) ; m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, Tdata.dTDiam) ;
@@ -682,8 +674,7 @@ Processor::ProcessToolData( void)
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXIT, nExit) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXIT, nExit) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, sTcPos) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, sTcPos) ;
if ( m_pMchMgr->TdbSetCurrTool( sTool)) { if ( m_pMchMgr->TdbSetCurrTool( sTool)) {
int nType ; int nComp ; double dDiam ; double dTDiam ; double dLen ; double dTLen ; double dDist ; double dMaxSpeed ; int nComp ; double dDiam ; double dTDiam ; double dLen ; double dTLen ; double dDist ; double dMaxSpeed ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TYPE, nType) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_CORR, nComp) ; m_pMchMgr->TdbGetCurrToolParam( TPA_CORR, nComp) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, dDiam) ; m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, dDiam) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, dTDiam) ; m_pMchMgr->TdbGetCurrToolParam( TPA_TOTDIAM, dTDiam) ;
@@ -691,7 +682,6 @@ Processor::ProcessToolData( void)
m_pMchMgr->TdbGetCurrToolParam( TPA_TOTLEN, dTLen) ; m_pMchMgr->TdbGetCurrToolParam( TPA_TOTLEN, dTLen) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_DIST, dDist) ; m_pMchMgr->TdbGetCurrToolParam( TPA_DIST, dDist) ;
m_pMchMgr->TdbGetCurrToolParam( TPA_MAXSPEED, dMaxSpeed) ; m_pMchMgr->TdbGetCurrToolParam( TPA_MAXSPEED, dMaxSpeed) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTYPE, nType) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCOMP, nComp) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCOMP, nComp) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TDIAM, dDiam) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TDIAM, dDiam) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTOTDIAM, dTDiam) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTOTDIAM, dTDiam) ;
@@ -731,7 +721,6 @@ Processor::ProcessToolData( void)
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_HEAD, vTdata[i].sHead) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_HEAD, vTdata[i].sHead) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXIT, vTdata[i].nExit) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_EXIT, vTdata[i].nExit) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, vTdata[i].sTcPos) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCPOS, vTdata[i].sTcPos) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTYPE, vTdata[i].nType) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCOMP, vTdata[i].nComp) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TCOMP, vTdata[i].nComp) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TDIAM, vTdata[i].dDiam) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TDIAM, vTdata[i].dDiam) ;
bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTOTDIAM, vTdata[i].dTDiam) ; bOk = bOk && m_pMachine->LuaSetGlobVar( GLOB_VAR + GVAR_TTOTDIAM, vTdata[i].dTDiam) ;
+10 -47
View File
@@ -607,9 +607,6 @@ SawFinishing::Update( bool bPostApply)
return true ; return true ;
} }
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione // imposto eventuale asse bloccato da lavorazione
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
@@ -798,31 +795,11 @@ SawFinishing::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ; const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr) if ( pTdata == nullptr)
return false ; return false ;
// salvo posizione TC, testa e uscita originali // verifico se sono diversi (ad esclusione del nome)
string sOrigTcPos = m_TParams.m_sTcPos ; m_TParams.m_sName = pTdata->m_sName ;
string sOrigHead = m_TParams.m_sHead ; bool bChanged = ! SameTool( m_TParams, *pTdata) ;
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 // aggiorno comunque i parametri
m_TParams = *pTdata ; 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 // eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) { if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in SawFinishing : tool name changed (" + string sInfo = "Warning in SawFinishing : tool name changed (" +
@@ -982,15 +959,15 @@ SawFinishing::AdjustGeometry( int nAuxId)
if ( ! pGuide->IsFlat( plPlane, false, 10 * EPS_SMALL) || ! AreSameOrOppositeVectorApprox( plPlane.GetVersN(), Z_AX)) if ( ! pGuide->IsFlat( plPlane, false, 10 * EPS_SMALL) || ! AreSameOrOppositeVectorApprox( plPlane.GetVersN(), Z_AX))
return false ; return false ;
// verifiche sulla curva (che trasformo in composita) // verifiche sulla curva (che trasformo in composita)
PtrOwner<ICurveComposite> pCompo ; PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
if ( ! pCompo.Set( ConvertCurveToComposite( Release( pGuide)))) if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pGuide)))
return false ; return false ;
// converto in archi e rette // converto in archi e rette
pCompo->ArcsBezierCurvesToArcsPerpExtr( LIN_TOL_MID, ANG_TOL_STD_DEG) ; pCompo->ArcsBezierCurvesToArcsPerpExtr( LIN_TOL_MID, ANG_TOL_STD_DEG) ;
// verifiche sull'ampiezza dell'angolo al centro degli eventuali archi // verifiche sull'ampiezza dell'angolo al centro degli eventuali archi
VerifyArcs( pCompo) ; VerifyArcs( pCompo) ;
// reinserisco nella curva originale // reinserisco nella curva originale
pGuide.Set( pCompo) ; pGuide.Set( Release( pCompo)) ;
} }
// deve iniziare in comune con la prima sezione ed essere ivi perpendicolare // deve iniziare in comune con la prima sezione ed essere ivi perpendicolare
Vector3d vtGdDir ; Vector3d vtGdDir ;
@@ -1587,18 +1564,6 @@ SawFinishing::CalculateCurvedAcrossToolPath( int nAuxId, int nClId)
// La porto in globale // La porto in globale
PL.ToGlob( frSect) ; PL.ToGlob( frSect) ;
// Calcolo eventuale anticipo dell'inizio
double dAddStart = 0 ;
if ( m_Params.m_nLeadLinkType == SAWFIN_LL_OUT) {
BBox3d b3PL ;
PL.GetLocalBBox( b3PL) ;
double dMaxElev = min( dDepth, b3Raw.GetMax().z - b3PL.GetMin().z) ;
if ( dMaxElev > 0.0 && dMaxElev < 0.5 * m_TParams.m_dDiam)
dAddStart = sqrt( dMaxElev * m_TParams.m_dDiam - dMaxElev * dMaxElev) ;
else
dAddStart = 0.5 * m_TParams.m_dDiam ;
}
// Imposto versore fresa come Z+ // Imposto versore fresa come Z+
Vector3d vtTool = Z_AX ; Vector3d vtTool = Z_AX ;
@@ -1880,7 +1845,6 @@ SawFinishing::ClassifySection( ICurve* pCrv, INTVECTOR& vnClass)
{ {
const ICurveComposite* pCompo = GetCurveComposite( pCrv) ; const ICurveComposite* pCompo = GetCurveComposite( pCrv) ;
if ( pCompo != nullptr) { if ( pCompo != nullptr) {
int Ind = 0 ;
const ICurve* pSimpCrv = pCompo->GetFirstCurve() ; const ICurve* pSimpCrv = pCompo->GetFirstCurve() ;
while ( pSimpCrv != nullptr) { while ( pSimpCrv != nullptr) {
// analizzo la curva // analizzo la curva
@@ -1898,7 +1862,6 @@ SawFinishing::ClassifySection( ICurve* pCrv, INTVECTOR& vnClass)
else else
vnClass.push_back( CCL_FALL) ; vnClass.push_back( CCL_FALL) ;
// passo alla curva successiva // passo alla curva successiva
++ Ind ;
pSimpCrv = pCompo->GetNextCurve() ; pSimpCrv = pCompo->GetNextCurve() ;
} }
} }
@@ -2403,8 +2366,8 @@ SawFinishing::CalcCurvedAlongVerticalCuts( ICurve* pSect, int nUmin, int nUmax,
Vector3d vtMove = ( dY - m_TParams.m_dThick / 2) * Z_AX ; Vector3d vtMove = ( dY - m_TParams.m_dThick / 2) * Z_AX ;
OffsetCurve OffsCrv ; OffsetCurve OffsCrv ;
OffsCrv.Make( pGuide, dOffs, ICurve::OFF_FILLET) ; OffsCrv.Make( pGuide, dOffs, ICurve::OFF_FILLET) ;
PtrOwner<ICurveComposite> pCut ; PtrOwner<ICurveComposite> pCut( CreateCurveComposite()) ;
if ( ! pCut.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve()))) if ( IsNull( pCut) || ! pCut->AddCurve( OffsCrv.GetLongerCurve()))
return false ; return false ;
VerifyArcs( pCut) ; VerifyArcs( pCut) ;
pCut->SimpleOffset( SAWRF_OFFS, ICurve::OFF_FORCE_OPEN) ; pCut->SimpleOffset( SAWRF_OFFS, ICurve::OFF_FORCE_OPEN) ;
@@ -2478,8 +2441,8 @@ SawFinishing::CalcCurvedAlongStdCuts( ICurve* pSect, double dUmin, double dUmax,
Vector3d vtMove = ( ptP.y - m_TParams.m_dThick / 2) * Z_AX ; Vector3d vtMove = ( ptP.y - m_TParams.m_dThick / 2) * Z_AX ;
OffsetCurve OffsCrv ; OffsetCurve OffsCrv ;
OffsCrv.Make( pGuide, dOffs, ICurve::OFF_FILLET) ; OffsCrv.Make( pGuide, dOffs, ICurve::OFF_FILLET) ;
PtrOwner<ICurveComposite> pCut ; PtrOwner<ICurveComposite> pCut( CreateCurveComposite()) ;
if ( ! pCut.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve()))) if ( IsNull( pCut) || ! pCut->AddCurve( OffsCrv.GetLongerCurve()))
return false ; return false ;
VerifyArcs( pCut) ; VerifyArcs( pCut) ;
pCut->SimpleOffset( SAWRF_OFFS, ICurve::OFF_FORCE_OPEN) ; pCut->SimpleOffset( SAWRF_OFFS, ICurve::OFF_FORCE_OPEN) ;
+2 -6
View File
@@ -81,10 +81,6 @@ struct SawFinishingData : public MachiningData
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline const SawFinishingData* GetSawFinishingData( const MachiningData* pMdata) inline const SawFinishingData* GetSawFinishingData( const MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWFINISHING) { return (dynamic_cast<const SawFinishingData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<const SawFinishingData*>( pMdata)) ; }
inline SawFinishingData* GetSawFinishingData( MachiningData* pMdata) inline SawFinishingData* GetSawFinishingData( MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWFINISHING) { return (dynamic_cast<SawFinishingData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<SawFinishingData*>( pMdata)) ; }
+8 -31
View File
@@ -571,9 +571,6 @@ SawRoughing::Update( bool bPostApply)
return true ; return true ;
} }
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione // imposto eventuale asse bloccato da lavorazione
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
@@ -756,31 +753,11 @@ SawRoughing::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ; const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr) if ( pTdata == nullptr)
return false ; return false ;
// salvo posizione TC, testa e uscita originali // verifico se sono diversi (ad esclusione del nome)
string sOrigTcPos = m_TParams.m_sTcPos ; m_TParams.m_sName = pTdata->m_sName ;
string sOrigHead = m_TParams.m_sHead ; bool bChanged = ! SameTool( m_TParams, *pTdata) ;
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 // aggiorno comunque i parametri
m_TParams = *pTdata ; 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 // eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) { if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in SawRoughing : tool name changed (" + string sInfo = "Warning in SawRoughing : tool name changed (" +
@@ -940,15 +917,15 @@ SawRoughing::AdjustGeometry( int nAuxId)
if ( ! pGuide->IsFlat( plPlane, false, 10 * EPS_SMALL) || ! AreSameOrOppositeVectorApprox( plPlane.GetVersN(), Z_AX)) if ( ! pGuide->IsFlat( plPlane, false, 10 * EPS_SMALL) || ! AreSameOrOppositeVectorApprox( plPlane.GetVersN(), Z_AX))
return false ; return false ;
// verifiche sulla curva (che trasformo in composita) // verifiche sulla curva (che trasformo in composita)
PtrOwner<ICurveComposite> pCompo ; PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
if ( ! pCompo.Set( ConvertCurveToComposite( Release( pGuide)))) if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pGuide)))
return false ; return false ;
// converto in archi e rette // converto in archi e rette
pCompo->ArcsBezierCurvesToArcsPerpExtr( LIN_TOL_MID, ANG_TOL_STD_DEG) ; pCompo->ArcsBezierCurvesToArcsPerpExtr( LIN_TOL_MID, ANG_TOL_STD_DEG) ;
// verifiche sull'ampiezza dell'angolo al centro degli eventuali archi // verifiche sull'ampiezza dell'angolo al centro degli eventuali archi
VerifyArcs( pCompo) ; VerifyArcs( pCompo) ;
// reinserisco nella curva originale // reinserisco nella curva originale
pGuide.Set( pCompo) ; pGuide.Set( Release( pCompo)) ;
} }
// deve iniziare in comune con la prima sezione ed essere ivi perpendicolare // deve iniziare in comune con la prima sezione ed essere ivi perpendicolare
Vector3d vtGdDir ; Vector3d vtGdDir ;
@@ -1330,8 +1307,8 @@ SawRoughing::CalculateCurvedToolPath( int nAuxId, int nClId)
// creo la curva di taglio // creo la curva di taglio
OffsetCurve OffsCrv ; OffsetCurve OffsCrv ;
OffsCrv.Make( pGuide, dX, ICurve::OFF_FILLET) ; OffsCrv.Make( pGuide, dX, ICurve::OFF_FILLET) ;
PtrOwner<ICurveComposite> pCut ; PtrOwner<ICurveComposite> pCut( CreateCurveComposite()) ;
if ( ! pCut.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve()))) if ( IsNull( pCut) || ! pCut->AddCurve( OffsCrv.GetLongerCurve()))
return false ; return false ;
VerifyArcs( pCut) ; VerifyArcs( pCut) ;
Vector3d vtMove = ( dY - m_TParams.m_dThick / 2) * Z_AX ; Vector3d vtMove = ( dY - m_TParams.m_dThick / 2) * Z_AX ;
+2 -6
View File
@@ -78,10 +78,6 @@ struct SawRoughingData : public MachiningData
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline const SawRoughingData* GetSawRoughingData( const MachiningData* pMdata) inline const SawRoughingData* GetSawRoughingData( const MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWROUGHING) { return (dynamic_cast<const SawRoughingData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<const SawRoughingData*>( pMdata)) ; }
inline SawRoughingData* GetSawRoughingData( MachiningData* pMdata) inline SawRoughingData* GetSawRoughingData( MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWROUGHING) { return (dynamic_cast<SawRoughingData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<SawRoughingData*>( pMdata)) ; }
+22 -56
View File
@@ -742,9 +742,6 @@ Sawing::Update( bool bPostApply)
return true ; return true ;
} }
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione // imposto eventuale asse bloccato da lavorazione
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
@@ -1028,31 +1025,11 @@ Sawing::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ; const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr) if ( pTdata == nullptr)
return false ; return false ;
// salvo posizione TC, testa e uscita originali // verifico se sono diversi (ad esclusione del nome)
string sOrigTcPos = m_TParams.m_sTcPos ; m_TParams.m_sName = pTdata->m_sName ;
string sOrigHead = m_TParams.m_sHead ; bool bChanged = ! SameTool( m_TParams, *pTdata) ;
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 // aggiorno comunque i parametri
m_TParams = *pTdata ; 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 // eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) { if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in Sawing : tool name changed (" + string sInfo = "Warning in Sawing : tool name changed (" +
@@ -1279,8 +1256,8 @@ Sawing::GetCurve( SelData Id)
// recupero l'indice del chunk // recupero l'indice del chunk
int nChunk = ( ( Id.nSub == SEL_SUB_ALL) ? 0 : Id.nSub) ; int nChunk = ( ( Id.nSub == SEL_SUB_ALL) ? 0 : Id.nSub) ;
// recupero il contorno esterno del chunk // recupero il contorno esterno del chunk
PtrOwner<ICurveComposite> pCrvCompo ; PtrOwner<ICurveComposite> pCrvCompo( CreateCurveComposite()) ;
if ( ! pCrvCompo.Set( ConvertCurveToComposite( pReg->GetLoop( nChunk, 0)))) if ( IsNull( pCrvCompo) || ! pCrvCompo->AddCurve( pReg->GetLoop( nChunk, 0)))
return nullptr ; return nullptr ;
// recupero la normale della regione // recupero la normale della regione
Vector3d vtN = pReg->GetNormVersor() ; Vector3d vtN = pReg->GetNormVersor() ;
@@ -1501,7 +1478,7 @@ Sawing::ProcessPath( int nPathId, int nPvId, int nClId)
ICurveComposite* pCompo = GetCurveComposite( m_pGeomDB->GetGeoObj( nCopyId)) ; ICurveComposite* pCompo = GetCurveComposite( m_pGeomDB->GetGeoObj( nCopyId)) ;
// unisco le parti allineate // unisco le parti allineate
if ( ! pCompo->MergeCurves( 100 * EPS_SMALL, 100 * EPS_ANG_SMALL)) if ( ! pCompo->MergeCurves( 10 * EPS_SMALL, 10 * EPS_ANG_SMALL))
return false ; return false ;
// eventuale inversione percorso // eventuale inversione percorso
@@ -1854,10 +1831,10 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
// Eventuale variazioni di velocità all'inizio e alla fine del percorso // Eventuale variazioni di velocità all'inizio e alla fine del percorso
FseVar FvVar ; FseVar FvVar ;
if ( pCrvP == nullptr) { if ( pCrvP == nullptr) {
string sFsta = ExtractInfo( m_Params.m_sUserNotes, "Fsta=") ; string sFsta = ExtractInfo( m_Params.m_sUserNotes, "Fsta:") ;
if ( ! sFsta.empty()) { if ( ! sFsta.empty()) {
string sLen, sPu ; string sLen, sPu ;
SplitFirst( sFsta, ",", sLen, sPu) ; SplitFirst( sFsta, "=", sLen, sPu) ;
FromString( sLen, FvVar.dLenStart) ; FromString( sLen, FvVar.dLenStart) ;
FvVar.dLenStart = max( FvVar.dLenStart, 0.) ; FvVar.dLenStart = max( FvVar.dLenStart, 0.) ;
FromString( sPu, FvVar.dPuStart) ; FromString( sPu, FvVar.dPuStart) ;
@@ -1865,10 +1842,10 @@ Sawing::ProcessLine( const ICurve* pCrvP, const ICurveLine* pLineC, const ICurve
} }
} }
if ( pCrvN == nullptr) { if ( pCrvN == nullptr) {
string sFend = ExtractInfo( m_Params.m_sUserNotes, "Fend=") ; string sFend = ExtractInfo( m_Params.m_sUserNotes, "Fend:") ;
if ( ! sFend.empty()) { if ( ! sFend.empty()) {
string sLen, sPu ; string sLen, sPu ;
SplitFirst( sFend, ",", sLen, sPu) ; SplitFirst( sFend, "=", sLen, sPu) ;
FromString( sLen, FvVar.dLenEnd) ; FromString( sLen, FvVar.dLenEnd) ;
FvVar.dLenEnd = max( FvVar.dLenEnd, 0.) ; FvVar.dLenEnd = max( FvVar.dLenEnd, 0.) ;
FromString( sPu, FvVar.dPuEnd) ; FromString( sPu, FvVar.dPuEnd) ;
@@ -3835,40 +3812,29 @@ bool
Sawing::CalculateToolAndCorrVersors( const Vector3d& vtTang, int nHeadSide, int nWorkSide, double dSideAng, Sawing::CalculateToolAndCorrVersors( const Vector3d& vtTang, int nHeadSide, int nWorkSide, double dSideAng,
Vector3d& vtTool, Vector3d& vtCorr) Vector3d& vtTool, Vector3d& vtCorr)
{ {
// Direzione tangente nel piano XY // Versore fresa : annullo la componente in Z e normalizzo
Vector3d vtXYTg = vtTang ; vtTool = vtTang ;
vtXYTg.z = 0 ; vtTool.z = 0 ;
double dLenXYTg = vtXYTg.Len() ; if ( ! vtTool.Normalize())
if ( dLenXYTg < EPS_SMALL)
return false ; return false ;
vtXYTg /= dLenXYTg ; // ruoto attorno a Zglob+ a seconda del lato mandrino
// 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) if ( nHeadSide == SAW_HS_LEFT)
vtTool.Rotate( Z_AX, 0, 1) ; vtTool.Rotate( Z_AX, 0, 1) ;
else else
vtTool.Rotate( Z_AX, 0, -1) ; vtTool.Rotate( Z_AX, 0, -1) ;
// Versore correzione : se lama sbandata devo aggiustare // Versore correzione
vtCorr = Z_AX ; vtCorr = Z_AX ;
// Se lama sbandata
if ( abs( dSideAng) > EPS_ANG_SMALL) { if ( abs( dSideAng) > EPS_ANG_SMALL) {
if ( nWorkSide == SAW_WS_RIGHT) { if ( nWorkSide == SAW_WS_RIGHT) {
vtTool.Rotate( vtXYTg, - dSideAng) ; vtTool.Rotate( vtTang, - dSideAng) ;
vtCorr.Rotate( vtXYTg, - dSideAng) ; vtCorr.Rotate( vtTang, - dSideAng) ;
} }
else { else {
vtTool.Rotate( vtXYTg, dSideAng) ; vtTool.Rotate( vtTang, dSideAng) ;
vtCorr.Rotate( vtXYTg, dSideAng) ; vtCorr.Rotate( vtTang, dSideAng) ;
} }
} }
+2 -6
View File
@@ -99,10 +99,6 @@ struct SawingData : public MachiningData
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline const SawingData* GetSawingData( const MachiningData* pMdata) inline const SawingData* GetSawingData( const MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWING) { return (dynamic_cast<const SawingData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<const SawingData*>( pMdata)) ; }
inline SawingData* GetSawingData( MachiningData* pMdata) inline SawingData* GetSawingData( MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SAWING) { return (dynamic_cast<SawingData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<SawingData*>( pMdata)) ; }
+5 -21
View File
@@ -271,20 +271,14 @@ SetupMgr::GetPosData( int nPos, string& sTcPos, string& sHead, int& nExit, strin
bool bool
SetupMgr::GetToolData( const string& sName, string& sTcPos, string& sHead, int& nExit, int* pnPos) const SetupMgr::GetToolData( const string& sName, string& sTcPos, string& sHead, int& nExit, int* pnPos) const
{ {
// reset valori di ritorno
sTcPos.clear() ;
sHead.clear() ;
nExit = 0 ;
if ( pnPos != nullptr)
*pnPos = 0 ;
// verifico validità utensile // verifico validità utensile
if ( IsEmptyOrSpaces( sName)) if ( IsEmptyOrSpaces( sName))
return false ; return false ;
// cerco l'utensile // cerco l'utensile
int nI = - 1 ; int nI = - 1 ;
for ( int i = 0 ; i < int( m_vStuData.size()) ; ++ i) { for ( size_t i = 0 ; i < m_vStuData.size() ; ++ i) {
if ( m_vStuData[i].m_nExit > 0 && EqualNoCase( sName, m_vStuData[i].m_sName)) { if ( m_vStuData[i].m_nExit > 0 && EqualNoCase( sName, m_vStuData[i].m_sName)) {
nI = i ; nI = int( i) ;
break ; break ;
} }
} }
@@ -318,21 +312,11 @@ SetupMgr::GetToolName( const string& sHead, int nExit, string& sName) const
bool bool
SetupMgr::GetToolsInSetupPos( const string& sTcPos, STRVECTOR& vsTools) const SetupMgr::GetToolsInSetupPos( const string& sTcPos, STRVECTOR& vsTools) const
{ {
// default vettore vuoto
vsTools.clear() ; vsTools.clear() ;
// verifico macchina // eseguo ricerca
if ( m_pMachine == nullptr)
return false ;
// eseguo ricerca (con inserimento nel vettore secondo indice dell'uscita)
for ( int i = 0 ; i < int( m_vStuData.size()) ; ++ i) { for ( int i = 0 ; i < int( m_vStuData.size()) ; ++ i) {
if ( ! IsEmptyOrSpaces( m_vStuData[i].m_sHead) && EqualNoCase( sTcPos, m_vStuData[i].m_sTcPos)) { if ( EqualNoCase( sTcPos, m_vStuData[i].m_sTcPos)) {
if ( vsTools.empty()) { vsTools.emplace_back( m_vStuData[i].m_sName) ;
int nExitCnt = m_pMachine->GetHeadExitCount( m_vStuData[i].m_sHead) ;
vsTools.resize( nExitCnt) ;
}
int nExit = m_vStuData[i].m_nExit ;
if ( nExit > 0 && nExit <= int( vsTools.size()))
vsTools[nExit - 1] = m_vStuData[i].m_sName ;
} }
} }
return true ; return true ;
+72 -167
View File
@@ -25,11 +25,9 @@
#include "/EgtDev/Include/EGkCDeCylClosedSurfTm.h" #include "/EgtDev/Include/EGkCDeCylClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeSpheClosedSurfTm.h" #include "/EgtDev/Include/EGkCDeSpheClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeConeFrustumClosedSurfTm.h" #include "/EgtDev/Include/EGkCDeConeFrustumClosedSurfTm.h"
#include "/EgtDev/Include/EGkCDeClosedSurfTmClosedSurfTm.h"
#include "/EgtDev/Include/EGkVolZmap.h" #include "/EgtDev/Include/EGkVolZmap.h"
#include "/EgtDev/Include/EGkGeoVector3d.h" #include "/EgtDev/Include/EGkGeoVector3d.h"
#include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGkSurfLocal.h"
#include "/EgtDev/Include/EXeCmdLogOff.h" #include "/EgtDev/Include/EXeCmdLogOff.h"
#include "/EgtDev/Include/EXeConst.h" #include "/EgtDev/Include/EXeConst.h"
#include "/EgtDev/Include/EMkToolConst.h" #include "/EgtDev/Include/EMkToolConst.h"
@@ -47,12 +45,10 @@ static const double MIN_STEP = 1.0 ;
static const double MAX_STEP = 100.0 ; static const double MAX_STEP = 100.0 ;
static const double MID_STEP = 50.0 ; static const double MID_STEP = 50.0 ;
static const double COLL_STEP = 10. ; static const double COLL_STEP = 10. ;
static const double SQ_COEFF_ROT_MOVE = 100. ;
static const double COEFF_LIM = 0.999 ; static const double COEFF_LIM = 0.999 ;
static const double SAFEDIST_STD = 5.0 ; static const double SAFEDIST_STD = 5.0 ;
static const int ERR_OUTSTROKE = 1 ; static const int ERR_OUTSTROKE = 1 ;
static const int ERR_COLLISION = 11 ; static const int ERR_COLLISION = 11 ;
static const int ERR_TOOL_SEL = 21 ;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
Simulator::Simulator( void) Simulator::Simulator( void)
@@ -76,7 +72,6 @@ Simulator::Simulator( void)
m_nAuxEInd = 0 ; m_nAuxEInd = 0 ;
m_nExit = 0 ; m_nExit = 0 ;
m_dTDiam = 0 ; m_dTDiam = 0 ;
m_bCutOnTip = false ;
m_dSafeDist = SAFEDIST_STD ; m_dSafeDist = SAFEDIST_STD ;
m_nAxesMask = 0 ; m_nAxesMask = 0 ;
m_bEnabAxes = true ; m_bEnabAxes = true ;
@@ -127,28 +122,21 @@ Simulator::Start( bool bFirst)
m_pMchMgr->ResetLastError() ; m_pMchMgr->ResetLastError() ;
m_pMchMgr->ResetWarnings() ; m_pMchMgr->ResetWarnings() ;
bool bOk = true ; // Forzo aggiornamento attrezzaggio della macchinata
bool bOk = m_pMchMgr->UpdateCurrSetup() ;
// Se avvio vero // Se avvio vero, verifico attrezzaggio
if ( bFirst) { if ( bFirst && ! VerifySetup())
// Forzo aggiornamento attrezzaggio della macchinata bOk = false ;
if ( ! m_pMchMgr->UpdateCurrSetup())
bOk = false ;
// Verifico attrezzaggio
if ( ! VerifySetup())
bOk = false ;
}
// Reset utensile, interpolazione e assi correnti // Reset utensile, interpolazione e assi correnti
m_sTool.clear() ; m_sTool.clear() ;
m_sHead.clear() ; m_sHead.clear() ;
m_nExit = 0 ; m_nExit = 0 ;
m_dTDiam = 0 ; m_dTDiam = 0 ;
m_bCutOnTip = false ;
ResetInterpolation() ; ResetInterpolation() ;
ResetAxes() ; ResetAxes() ;
ResetAuxAxes() ; ResetAuxAxes() ;
// porto la macchina in home // porto la macchina in home
if ( ! GoHome()) if ( ! GoHome())
bOk = false ; bOk = false ;
@@ -482,9 +470,6 @@ Simulator::UpdateTool( bool bFirst, int& nErr)
m_sHead = sHead ; m_sHead = sHead ;
m_nExit = nExit ; m_nExit = nExit ;
m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, m_dTDiam) ; 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 // ripristino la lavorazione corrente
m_pMchMgr->SetCurrMachining( nCurrMchId) ; m_pMchMgr->SetCurrMachining( nCurrMchId) ;
// aggiorno gli assi macchina // aggiorno gli assi macchina
@@ -524,9 +509,6 @@ Simulator::UpdateTool( bool bFirst, int& nErr)
m_sHead = sHead ; m_sHead = sHead ;
m_nExit = nExit ; m_nExit = nExit ;
m_pMchMgr->TdbGetCurrToolParam( TPA_DIAM, m_dTDiam) ; 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 // aggiorno gli assi macchina
if ( ! UpdateAxes()) if ( ! UpdateAxes())
return false ; return false ;
@@ -697,13 +679,11 @@ Simulator::FindAndManageOperationStart( bool bStart, bool bFirst, int& nStatus)
} }
// cambio fase // cambio fase
m_pMchMgr->SetCurrPhase( nPhase, ( nPhase == 1)) ; m_pMchMgr->SetCurrPhase( nPhase, ( nPhase == 1)) ;
// se previsto, aggiorno utensile e assi conseguenti // aggiorno utensile e assi conseguenti
if ( pDisp->IsWithTool()) { int nErr ;
int nErr ; if ( ! UpdateTool( bFirst, nErr)) {
if ( ! UpdateTool( bFirst, nErr)) { nStatus = CalcStatusOnError( nErr) ;
nStatus = CalcStatusOnError( nErr) ; return false ;
return false ;
}
} }
++ m_nOpInd ; ++ m_nOpInd ;
// richiamo gestione evento inizio disposizione // richiamo gestione evento inizio disposizione
@@ -999,21 +979,11 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
double dSqDist = 0 ; double dSqDist = 0 ;
for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i) { for ( size_t i = 0 ; i < m_AxesName.size() ; ++ i) {
// coefficiente moltiplicativo per differenziare assi lineari (primi 3) e rotanti (altri) // coefficiente moltiplicativo per differenziare assi lineari (primi 3) e rotanti (altri)
double dSqCoeff = (( i < 3) ? 1 : SQ_COEFF_ROT_MOVE) ; double dSqCoeff = (( i < 3) ? 1 : 100) ;
dSqDist += dSqCoeff * ( AxesEnd[i] - m_AxesVal[i]) * ( AxesEnd[i] - m_AxesVal[i]) ; dSqDist += dSqCoeff * ( AxesEnd[i] - m_AxesVal[i]) * ( AxesEnd[i] - m_AxesVal[i]) ;
} }
// Calcolo distanza di movimento eventuali assi ausiliari
double dSqDistAux = 0 ;
for ( int i = 0 ; i < int( m_AuxAxesName.size()) ; ++ i) {
if ( m_AuxAxesLink[i] != 0)
continue ;
// coefficiente moltiplicativo per differenziare assi lineari e rotanti
double dSqCoeff = ( m_AuxAxesLinear[i] ? 1 : SQ_COEFF_ROT_MOVE) ;
dSqDistAux += dSqCoeff * ( m_AuxAxesEnd[i] - m_AuxAxesVal[i]) * ( m_AuxAxesEnd[i] - m_AuxAxesVal[i]) ;
}
// Considero il massimo delle due distanze
double dPrevCoeff = m_dCoeff ; double dPrevCoeff = m_dCoeff ;
double dDist = sqrt( max( dSqDist, dSqDistAux)) ; double dDist = sqrt( dSqDist) ;
if ( dDist > EPS_SMALL) { if ( dDist > EPS_SMALL) {
double dStep = min( ( nMoveType == 0 ? 2 : 1) * m_dStep, MAX_STEP) ; double dStep = min( ( nMoveType == 0 ? 2 : 1) * m_dStep, MAX_STEP) ;
int nStep = max( int( dDist / dStep), 1) ; int nStep = max( int( dDist / dStep), 1) ;
@@ -1036,12 +1006,6 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
for ( int i = 0 ; i < int( m_VmId.size()) ; ++ i) for ( int i = 0 ; i < int( m_VmId.size()) ; ++ i)
bOkI = m_pGeomDB->GetGlobFrame( m_VmId[i], vFrVzmI[i]) && bOkI ; bOkI = m_pGeomDB->GetGlobFrame( m_VmId[i], vFrVzmI[i]) && bOkI ;
// Log per debug
if ( ExeGetDebugLevel() >= 10) {
string sOut = "MoveType=" + ToString( nMoveType) + " Coeff=" + ToString( m_dCoeff) ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str())
}
// Eseguo movimento rapido o lineare // Eseguo movimento rapido o lineare
if ( nMoveType != 2 && nMoveType != 3) { if ( nMoveType != 2 && nMoveType != 3) {
// se attivo CollisionCheck approssimo movimento con più step // se attivo CollisionCheck approssimo movimento con più step
@@ -1074,29 +1038,22 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
} }
m_pMachine->SetAxisPos( m_AuxAxesName[j], dVal) ; m_pMachine->SetAxisPos( m_AuxAxesName[j], dVal) ;
} }
// 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 // eseguo eventuale collision check
bCollCheck = bCollCheck && ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ; 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) ;
}
}
}
} }
// Eseguo movimento su arco // Eseguo movimento su arco
else { else {
@@ -1190,7 +1147,7 @@ Simulator::ManageSingleMove( int& nStatus, double& dMove)
double dSqDist = 0 ; double dSqDist = 0 ;
for ( int i = 0 ; i < int( m_AuxAxesName.size()) ; ++ i) { for ( int i = 0 ; i < int( m_AuxAxesName.size()) ; ++ i) {
// coefficiente moltiplicativo per differenziare assi lineari e rotanti // coefficiente moltiplicativo per differenziare assi lineari e rotanti
double dSqCoeff = ( m_AuxAxesLinear[i] ? 1 : SQ_COEFF_ROT_MOVE) ; double dSqCoeff = ( m_AuxAxesLinear[i] ? 1 : 100) ;
dSqDist += dSqCoeff * ( m_AuxAxesEnd[i] - m_AuxAxesVal[i]) * ( m_AuxAxesEnd[i] - m_AuxAxesVal[i]) ; dSqDist += dSqCoeff * ( m_AuxAxesEnd[i] - m_AuxAxesVal[i]) * ( m_AuxAxesEnd[i] - m_AuxAxesVal[i]) ;
} }
double dPrevCoeff = m_dCoeff ; double dPrevCoeff = m_dCoeff ;
@@ -1308,11 +1265,8 @@ Simulator::ExecLineVmill( int nVmId, int nCurrTool, double dVmTdOffs, double dVm
{ {
// Recupero Zmap // Recupero Zmap
IVolZmap* pVZM = GetVolZmap( m_pGeomDB->GetGeoObj( nVmId)) ; IVolZmap* pVZM = GetVolZmap( m_pGeomDB->GetGeoObj( nVmId)) ;
if ( pVZM == nullptr) { if ( pVZM == nullptr)
string sOut = " --> GetVolZmap (" + ToString( nVmId) +") Error <--" ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str())
return false ; return false ;
}
// Porto gli estremi nel riferimento opportuno dello Zmap // Porto gli estremi nel riferimento opportuno dello Zmap
Point3d ptHiL = ptHi ; ptHiL.ToLoc( frVzmI) ; Point3d ptHiL = ptHi ; ptHiL.ToLoc( frVzmI) ;
Vector3d vtHiL = vtHi ; vtHiL.ToLoc( frVzmI) ; Vector3d vtHiL = vtHi ; vtHiL.ToLoc( frVzmI) ;
@@ -1325,35 +1279,13 @@ Simulator::ExecLineVmill( int nVmId, int nCurrTool, double dVmTdOffs, double dVm
ptHfL += dVmTdOffs * vtHfL + dVmAdOffs * vtAfL ; ptHfL += dVmTdOffs * vtHfL + dVmAdOffs * vtAfL ;
// Log per debug // Log per debug
if ( ExeGetDebugLevel() >= 10) { if ( ExeGetDebugLevel() >= 10) {
string sOut = "Zmap=" + ToString( nVmId) + " Tool=" + ToString( nCurrTool) + string sOut = "Zmap=" + ToString( nVmId) + " CurrTool=" + ToString( nCurrTool) +
" Pi=(" + ToString( ptHiL) + ") Vi=(" + ToString( vtHiL) + ") Ai=(" + ToString( vtAiL) + "Pi=(" + ToString( ptHiL) + ") Vi=(" + ToString( vtHiL) + ") Ai=(" + ToString( vtAiL) +
") Pf=(" + ToString( ptHfL) + ") Vf=(" + ToString( vtHfL) + ") Af=(" + ToString( vtAfL) + ")" ; ") Pf=(" + ToString( ptHfL) + ") Vf=(" + ToString( vtHfL) + ") Af=(" + ToString( vtAfL) + ")" ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str()) 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 // Eseguo
bool bOk = pVZM->MillingStep( nCurrTool, ptHiL, vtHiL, vtAiL, ptHfL, vtHfL, vtAfL) ; return pVZM->MillingStep( nCurrTool, ptHiL, vtHiL, vtAiL, ptHfL, vtHfL, vtAfL) ;
if ( ! bOk) {
if ( ExeGetDebugLevel() < 10) {
string sOut = "Zmap=" + ToString( nVmId) + " Tool=" + ToString( nCurrTool) +
" Pi=(" + ToString( ptHiL) + ") Vi=(" + ToString( vtHiL) + ") Ai=(" + ToString( vtAiL) +
") Pf=(" + ToString( ptHfL) + ") Vf=(" + ToString( vtHfL) + ") Af=(" + ToString( vtAfL) + ")" ;
LOG_DBG_INFO( GetEMkLogger(), sOut.c_str())
}
LOG_DBG_INFO( GetEMkLogger(), " --> MillingStep Error <--")
}
return bOk ;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -1392,62 +1324,44 @@ Simulator::ExecCollisionCheck( int& nCdInd, int& nObjInd, int nMoveType)
// se utensile attivo su grezzo in lavoro e non è rapido, salto // se utensile attivo su grezzo in lavoro e non è rapido, salto
if ( bIsTool && bIsRaw && nMoveType != 0) if ( bIsTool && bIsRaw && nMoveType != 0)
continue ; continue ;
// se riferimento non trovato, si salta
const IGeoFrame3d* pGeoFrame = GetGeoFrame3d( m_pGeomDB->GetGeoObj( m_CollObj[j].nFrameId)) ;
if ( pGeoFrame == nullptr)
continue ;
// esecuzione controlli di collisione // esecuzione controlli di collisione
bool bOk = true ; bool bOk = true ;
// oggetti che richiedono frame associato (Box, Cylinder, Sphere, Cone) Frame3d frObj = pGeoFrame->GetFrame() ;
if ( m_CollObj[j].nType != MCH_SIM_COB_POLY) { if ( ! m_CollObj[j].vtMove.IsSmall())
// se riferimento non trovato, si salta frObj.Translate( m_CollObj[j].vtMove.x * frObj.VersX() +
const IGeoFrame3d* pGeoFrame = GetGeoFrame3d( m_pGeomDB->GetGeoObj( m_CollObj[j].nFrameId)) ; m_CollObj[j].vtMove.y * frObj.VersY() +
if ( pGeoFrame == nullptr) m_CollObj[j].vtMove.z * frObj.VersZ()) ;
continue ; Frame3d frParent ; m_pGeomDB->GetGlobFrame( m_CollObj[j].nFrameId, frParent) ;
Frame3d frObj = pGeoFrame->GetFrame() ; frObj.LocToLoc( frParent, frCd) ;
if ( ! m_CollObj[j].vtMove.IsSmall()) if ( m_CollObj[j].nType == MCH_SIM_COB_BOX) {
frObj.Translate( m_CollObj[j].vtMove.x * frObj.VersX() + Vector3d vtDiag( m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3) ;
m_CollObj[j].vtMove.y * frObj.VersY() + if ( pVZM != nullptr)
m_CollObj[j].vtMove.z * frObj.VersZ()) ; bOk = pVZM->AvoidBox( frObj, vtDiag, m_dSafeDist) ;
Frame3d frParent ; m_pGeomDB->GetGlobFrame( m_CollObj[j].nFrameId, frParent) ;
frObj.LocToLoc( frParent, frCd) ;
// controlli di collisione
if ( m_CollObj[j].nType == MCH_SIM_COB_BOX) {
Vector3d vtDiag( m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3) ;
if ( pVZM != nullptr)
bOk = pVZM->AvoidBox( frObj, vtDiag, m_dSafeDist) ;
else
bOk = ! CDeBoxClosedSurfTm( frObj, vtDiag, m_dSafeDist, *pSTM) ;
}
else if ( m_CollObj[j].nType == MCH_SIM_COB_CYL) {
if ( pVZM != nullptr)
bOk = pVZM->AvoidCylinder( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_dSafeDist) ;
else
bOk = ! CDeCylClosedSurfTm( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_dSafeDist, *pSTM) ;
}
else if ( m_CollObj[j].nType == MCH_SIM_COB_SPHE) {
if ( pVZM != nullptr)
bOk = pVZM->AvoidSphere( frObj.Orig(), m_CollObj[j].dPar1, m_dSafeDist) ;
else
bOk = ! CDeSpheClosedSurfTm( frObj.Orig(), m_CollObj[j].dPar1, m_dSafeDist, *pSTM) ;
}
else if ( m_CollObj[j].nType == MCH_SIM_COB_CONE) {
if ( pVZM != nullptr)
bOk = pVZM->AvoidConeFrustum( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3, m_dSafeDist) ;
else
bOk = ! CDeConeFrustumClosedSurfTm( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3, m_dSafeDist, *pSTM) ;
}
}
// altrimenti poliedro
else {
SurfLocal SurfLoc( m_pGeomDB, m_CollObj[j].nFrameId, frCd) ;
const ISurfTriMesh* pStmLoc = GetSurfTriMesh( SurfLoc) ;
if ( pStmLoc != nullptr) {
if ( pVZM != nullptr)
bOk = pVZM->AvoidSurfTm( *pStmLoc, m_dSafeDist) ;
else
bOk = ! CDeClosedSurfTmClosedSurfTm( *pStmLoc, *pSTM, m_dSafeDist) ;
}
else else
bOk = false ; bOk = ! CDeBoxClosedSurfTm( frObj, vtDiag, m_dSafeDist, *pSTM) ;
}
else if ( m_CollObj[j].nType == MCH_SIM_COB_CYL) {
if ( pVZM != nullptr)
bOk = pVZM->AvoidCylinder( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_dSafeDist) ;
else
bOk = ! CDeCylClosedSurfTm( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_dSafeDist, *pSTM) ;
}
else if ( m_CollObj[j].nType == MCH_SIM_COB_SPHE) {
if ( pVZM != nullptr)
bOk = pVZM->AvoidSphere( frObj.Orig(), m_CollObj[j].dPar1, m_dSafeDist) ;
else
bOk = ! CDeSpheClosedSurfTm( frObj.Orig(), m_CollObj[j].dPar1, m_dSafeDist, *pSTM) ;
}
else if ( m_CollObj[j].nType == MCH_SIM_COB_CONE) {
if ( pVZM != nullptr)
bOk = pVZM->AvoidConeFrustum( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3, m_dSafeDist) ;
else
bOk = ! CDeConeFrustumClosedSurfTm( frObj, m_CollObj[j].dPar1, m_CollObj[j].dPar2, m_CollObj[j].dPar3, m_dSafeDist, *pSTM) ;
} }
// se trovata collisione
if ( ! bOk) { if ( ! bOk) {
nCdInd = i ; nCdInd = i ;
nObjInd = j ; nObjInd = j ;
@@ -1636,10 +1550,8 @@ Simulator::OnToolSelect( const string& sTool, const string& sHead, int nExit, co
m_AuxAxesLink.emplace_back( 0) ; m_AuxAxesLink.emplace_back( 0) ;
} }
} }
else { else
bOk = false ; bOk = false ;
nErr = ERR_TOOL_SEL ;
}
} }
return ( bOk && nErr == 0) ; return ( bOk && nErr == 0) ;
@@ -2032,10 +1944,6 @@ Simulator::AddCollisionObj( int nInd, bool bToolOn, int nFrameId, int nType, con
if ( ( dPar1 < EPS_SMALL && dPar2 < EPS_SMALL) || dPar3 < EPS_SMALL) if ( ( dPar1 < EPS_SMALL && dPar2 < EPS_SMALL) || dPar3 < EPS_SMALL)
return false ; return false ;
break ; break ;
case MCH_SIM_COB_POLY :
if ( ! ExeSurfIsClosed( nFrameId))
return false ;
break ;
default : default :
return false ; return false ;
} }
@@ -2088,7 +1996,10 @@ Simulator::SetToolForVmill( const string& sTool, const string& sHead, int nExit,
else if ( nType == TT_WATERJET) else if ( nType == TT_WATERJET)
ExeVolZmapSetStdTool( vVmill, sTool, dLen + 50, dDiam, dCornR, dMaxMat, nFlag, bFirst) ; ExeVolZmapSetStdTool( vVmill, sTool, dLen + 50, dDiam, dCornR, dMaxMat, nFlag, bFirst) ;
else if ( abs( dSideAng) < EPS_ANG_SMALL || abs( dThick) < EPS_SMALL) { else if ( abs( dSideAng) < EPS_ANG_SMALL || abs( dThick) < EPS_SMALL) {
ExeVolZmapSetStdTool( vVmill, sTool, dLen, dDiam, dCornR, dMaxMat, nFlag, bFirst) ; if ( dDiam <= dMaxStemDiam)
ExeVolZmapSetStdTool( vVmill, sTool, dLen, dDiam, dCornR, dMaxMat, nFlag, bFirst) ;
else
ExeVolZmapSetSawTool( vVmill, sTool, dLen, dDiam, dMaxMat, 0, dCornR, nFlag, bFirst) ;
} }
else { else {
bool bExtra = ( dThick > 0) ; bool bExtra = ( dThick > 0) ;
@@ -2171,7 +2082,6 @@ Simulator::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
static const int STEP_RAPID = -2 ; static const int STEP_RAPID = -2 ;
static const int STEP_RAPROT = -3 ; static const int STEP_RAPROT = -3 ;
static const int STEP_COLLROT = -4 ; static const int STEP_COLLROT = -4 ;
bool bViewAllFrames = true ;
int nStep = 1 ; int nStep = 1 ;
for ( int i = 0 ; i < nAxCount ; ++ i) { for ( int i = 0 ; i < nAxCount ; ++ i) {
double dMove = abs( vAxNaEpSt[i].dEndPos - vPrev[i]) ; double dMove = abs( vAxNaEpSt[i].dEndPos - vPrev[i]) ;
@@ -2181,14 +2091,10 @@ Simulator::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
dStep = m_dStep ; dStep = m_dStep ;
else if ( abs( dStep - STEP_RAPID) < EPS_SMALL) else if ( abs( dStep - STEP_RAPID) < EPS_SMALL)
dStep = 4 * m_dStep ; dStep = 4 * m_dStep ;
else if ( abs( dStep - STEP_RAPROT) < EPS_SMALL) { else if ( abs( dStep - STEP_RAPROT) < EPS_SMALL)
dStep = 0.4 * m_dStep ; dStep = 0.4 * m_dStep ;
bViewAllFrames = false ; else // STEP_COLLROT
}
else { // STEP_COLLROT
dStep = min( 0.4 * m_dStep, 10.) ; dStep = min( 0.4 * m_dStep, 10.) ;
bViewAllFrames = false ;
}
} }
dStep = max( dStep, 1.) ; dStep = max( dStep, 1.) ;
int nAxStep = int( dMove / dStep) + 1 ; int nAxStep = int( dMove / dStep) + 1 ;
@@ -2223,8 +2129,7 @@ Simulator::MoveAxes( int nMoveType, const SAMVECTOR& vAxNaEpSt)
} }
} }
// Aggiorno visualizzazione // Aggiorno visualizzazione
if ( bViewAllFrames || ( i % 2) == 0 || i == nStep) ExeDraw() ;
ExeDraw() ;
// Verifico collisioni // Verifico collisioni
int nCdInd, nObjInd ; int nCdInd, nObjInd ;
bool bCollCheck = ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ; bool bCollCheck = ExecCollisionCheck( nCdInd, nObjInd, nMoveType) ;
-1
View File
@@ -158,7 +158,6 @@ class Simulator
std::string m_sHead ; // nome della testa corrente std::string m_sHead ; // nome della testa corrente
int m_nExit ; // indice dell'uscita corrente int m_nExit ; // indice dell'uscita corrente
double m_dTDiam ; // diametro dell'utensile 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_VmId ; // vettore identificativi Zmap per Virtual Milling
INTVECTOR m_CdId ; // vettore identificativi Zmap per Collision Detection INTVECTOR m_CdId ; // vettore identificativi Zmap per Collision Detection
VMTVECTOR m_VmTool ; // vettore utensili attivi per virtual milling VMTVECTOR m_VmTool ; // vettore utensili attivi per virtual milling
+10 -41
View File
@@ -606,9 +606,6 @@ SurfFinishing::Update( bool bPostApply)
return true ; return true ;
} }
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione // imposto eventuale asse bloccato da lavorazione
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
@@ -803,31 +800,11 @@ SurfFinishing::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ; const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr) if ( pTdata == nullptr)
return false ; return false ;
// salvo posizione TC, testa e uscita originali // verifico se sono diversi (ad esclusione del nome)
string sOrigTcPos = m_TParams.m_sTcPos ; m_TParams.m_sName = pTdata->m_sName ;
string sOrigHead = m_TParams.m_sHead ; bool bChanged = ! SameTool( m_TParams, *pTdata) ;
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 // aggiorno comunque i parametri
m_TParams = *pTdata ; 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 // eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) { if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in SurfFinishing : tool name changed (" + string sInfo = "Warning in SurfFinishing : tool name changed (" +
@@ -1331,8 +1308,8 @@ SurfFinishing::AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
bool bStart = true ; bool bStart = true ;
while ( OffsCrv.GetCurveCount() > 0) { while ( OffsCrv.GetCurveCount() > 0) {
// recupero la prima curva di offset // recupero la prima curva di offset
PtrOwner<ICurveComposite> pOffs ; PtrOwner<ICurveComposite> pOffs( CreateCurveComposite()) ;
if ( ! pOffs.Set( ConvertCurveToComposite( OffsCrv.GetLongerCurve()))) { if ( IsNull( pOffs) || ! pOffs->AddCurve( OffsCrv.GetLongerCurve())) {
m_pMchMgr->SetLastError( 3110, "Error in SurfFinishing : Toolpath not computable") ; m_pMchMgr->SetLastError( 3110, "Error in SurfFinishing : Toolpath not computable") ;
return false ; return false ;
} }
@@ -1382,7 +1359,7 @@ SurfFinishing::AddZigZag( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
if ( IsNull( pCompo) || ! pCompo->FromPolyLine( PL)) if ( IsNull( pCompo) || ! pCompo->FromPolyLine( PL))
return false ; return false ;
// sostituisco la vecchia curva con la nuova // sostituisco la vecchia curva con la nuova
vpCrvs[k].Set( pCompo) ; vpCrvs[k].Set( Release( pCompo )) ;
} }
// ciclo sulle curve elementari // ciclo sulle curve elementari
int nMaxInd = vpCrvs[k]->GetCurveCount() - 1 ; int nMaxInd = vpCrvs[k]->GetCurveCount() - 1 ;
@@ -1672,13 +1649,6 @@ SurfFinishing::CalcZigZag( const ICurveComposite* pOffs,
nJ = -1 ; nJ = -1 ;
} }
} }
// se richiesta percorrenza invertita
if ( m_Params.m_bInvert) {
for ( auto& pCompo : vpCrvs)
pCompo->Invert() ;
}
return true ; return true ;
} }
@@ -1750,7 +1720,7 @@ SurfFinishing::AddSpiral( ICAvToolSurfTm* pCAvTlStm, const Frame3d& frSurf,
if ( IsNull( pCompo) || ! pCompo->FromPolyLine( PL)) if ( IsNull( pCompo) || ! pCompo->FromPolyLine( PL))
return false ; return false ;
// sostituisco la vecchia curva con la nuova // sostituisco la vecchia curva con la nuova
pMCrv.Set( pCompo) ; pMCrv.Set( Release( pCompo )) ;
} }
// ciclo sulle curve elementari // ciclo sulle curve elementari
int nMaxInd = pMCrv->GetCurveCount() - 1 ; int nMaxInd = pMCrv->GetCurveCount() - 1 ;
@@ -1913,7 +1883,7 @@ SurfFinishing::CalcSpiral( const ICurveComposite* pCompo, bool bSplitArcs,
if ( bNextOk) { if ( bNextOk) {
// sistemo per prossimo step // sistemo per prossimo step
dCurrRad = dRad ; dCurrRad = dRad ;
pOffs.Set( pNextOffs) ; pOffs.Set( Release( pNextOffs)) ;
pCurr = Get( pOffs) ; pCurr = Get( pOffs) ;
// nuovo valore pari allo step // nuovo valore pari allo step
dOffs = GetSideStep() ; dOffs = GetSideStep() ;
@@ -2113,7 +2083,6 @@ SurfFinishing::GetRightFeed( const Vector3d& vtMove, const Vector3d& vtTool) con
double double
SurfFinishing::GetRadiusForStartEndElevation( void) const SurfFinishing::GetRadiusForStartEndElevation( void) const
{ {
const double DELTA_ELEV_RAD = 4.0 ; const double DELTA_ELEV_RAD = 20.0 ;
double dDeltaRad = min( DELTA_ELEV_RAD, 0.5 * m_TParams.m_dTDiam) ; return ( 0.5 * m_TParams.m_dTDiam + DELTA_ELEV_RAD) ;
return ( 0.5 * m_TParams.m_dTDiam + dDeltaRad) ;
} }
+2 -6
View File
@@ -83,10 +83,6 @@ struct SurfFinishingData : public MachiningData
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline const SurfFinishingData* GetSurfFinishingData( const MachiningData* pMdata) inline const SurfFinishingData* GetSurfFinishingData( const MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SURFFINISHING) { return (dynamic_cast<const SurfFinishingData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<const SurfFinishingData*>( pMdata)) ; }
inline SurfFinishingData* GetSurfFinishingData( MachiningData* pMdata) inline SurfFinishingData* GetSurfFinishingData( MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_SURFFINISHING) { return (dynamic_cast<SurfFinishingData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<SurfFinishingData*>( pMdata)) ; }
+5 -5
View File
@@ -72,7 +72,7 @@ struct ToolData
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline bool inline bool
SameTool( const ToolData& Td1, const ToolData& Td2, bool bAlsoNameTcPosHeadExit = true) SameTool( const ToolData& Td1, const ToolData& Td2)
{ {
const double EPS_TOOL_LEN = 10 * EPS_SMALL ; const double EPS_TOOL_LEN = 10 * EPS_SMALL ;
const double EPS_TOOL_ANG = 10 * EPS_ANG_SMALL ; const double EPS_TOOL_ANG = 10 * EPS_ANG_SMALL ;
@@ -80,11 +80,11 @@ SameTool( const ToolData& Td1, const ToolData& Td2, bool bAlsoNameTcPosHeadExit
const double EPS_FEED = 0.5 ; const double EPS_FEED = 0.5 ;
const double EPS_ABSORP = 0.5 ; const double EPS_ABSORP = 0.5 ;
return ( Td1.m_Uuid == Td2.m_Uuid && return ( Td1.m_Uuid == Td2.m_Uuid &&
( Td1.m_sName == Td2.m_sName || ! bAlsoNameTcPosHeadExit) && Td1.m_sName == Td2.m_sName &&
Td1.m_sDraw == Td2.m_sDraw && Td1.m_sDraw == Td2.m_sDraw &&
( Td1.m_sTcPos == Td2.m_sTcPos || ! bAlsoNameTcPosHeadExit) && Td1.m_sTcPos == Td2.m_sTcPos &&
( Td1.m_sHead == Td2.m_sHead || ! bAlsoNameTcPosHeadExit) && Td1.m_sHead == Td2.m_sHead &&
( Td1.m_nExit == Td2.m_nExit || ! bAlsoNameTcPosHeadExit) && Td1.m_nExit == Td2.m_nExit &&
Td1.m_nCorr == Td2.m_nCorr && Td1.m_nCorr == Td2.m_nCorr &&
Td1.m_nType == Td2.m_nType && Td1.m_nType == Td2.m_nType &&
abs( Td1.m_dMaxSpeed - Td2.m_dMaxSpeed) < EPS_SPEED && abs( Td1.m_dMaxSpeed - Td2.m_dMaxSpeed) < EPS_SPEED &&
+4 -8
View File
@@ -694,16 +694,12 @@ ToolsMgr::GetCurrToolMaxDepth( double dSafe, double& dMaxDepth) const
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ; GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THLEN, dTHoldLen) ;
GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam) ; GetValInNotes( m_tdCurrTool.m_sSysNotes, TSI_THDIAM, dTHoldDiam) ;
} }
// calcolo il massimo affondamento per le limitazioni dal portautensili // calcolo il massimo affondamento
dMaxDepth = m_tdCurrTool.m_dLen - dSafe ; dMaxDepth = m_tdCurrTool.m_dLen - dSafe ;
if ( dTHoldDiam > m_tdCurrTool.m_dDiam + EPS_SMALL) if ( m_tdCurrTool.m_dDiam > dTHoldDiam)
dMaxDepth -= dTHoldLen ;
else
dMaxDepth -= dTHoldBase ; dMaxDepth -= dTHoldBase ;
// recupero l'eventuale diametro gambo utensile (definito se non nullo) else
double dStemDiam ; m_tdCurrTool.GetParam( TPA_STEMDIAM, dStemDiam) ; dMaxDepth -= dTHoldLen ;
if ( dStemDiam > m_tdCurrTool.m_dDiam + EPS_SMALL)
dMaxDepth = min( dMaxDepth, m_tdCurrTool.m_dMaxMat) ;
return true ; return true ;
} }
// se mortasatrice o sega a catena // se mortasatrice o sega a catena
+9 -32
View File
@@ -740,9 +740,6 @@ WaterJetting::Update( bool bPostApply)
return true ; return true ;
} }
// elimino le entità CLIMB, RISE e HOME della lavorazione, potrebbero falsare i calcoli degli assi (in ogni casi vengono riaggiunte dopo)
RemoveClimbRiseHome() ;
// imposto eventuale asse bloccato da lavorazione // imposto eventuale asse bloccato da lavorazione
SetBlockedRotAxis( m_Params.m_sBlockedAxis) ; SetBlockedRotAxis( m_Params.m_sBlockedAxis) ;
@@ -967,31 +964,11 @@ WaterJetting::UpdateToolData( bool* pbChanged)
const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ; const ToolData* pTdata = pTMgr->GetTool( m_Params.m_ToolUuid) ;
if ( pTdata == nullptr) if ( pTdata == nullptr)
return false ; return false ;
// salvo posizione TC, testa e uscita originali // verifico se sono diversi (ad esclusione del nome)
string sOrigTcPos = m_TParams.m_sTcPos ; m_TParams.m_sName = pTdata->m_sName ;
string sOrigHead = m_TParams.m_sHead ; bool bChanged = ! SameTool( m_TParams, *pTdata) ;
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 // aggiorno comunque i parametri
m_TParams = *pTdata ; 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 // eventuali segnalazioni
if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) { if ( ! EqualNoCase( m_Params.m_sToolName, m_TParams.m_sName)) {
string sInfo = "Warning in WaterJetting : tool name changed (" + string sInfo = "Warning in WaterJetting : tool name changed (" +
@@ -1964,7 +1941,7 @@ WaterJetting::AddLeadInPreview( const ICurveComposite* pCompo, ISurfFlatRegion*
{ PtrOwner<ICurveLine> pLine( CreateCurveLine()) ; { PtrOwner<ICurveLine> pLine( CreateCurveLine()) ;
if ( IsNull( pLine) || ! pLine->Set( ptP1, ptStart)) if ( IsNull( pLine) || ! pLine->Set( ptP1, ptStart))
return false ; return false ;
pCrv.Set( pLine) ; pCrv.Set( Release( pLine)) ;
} break ; } break ;
case WJET_LI_TANGENT : case WJET_LI_TANGENT :
pCrv.Set( GetArc2PVN( ptStart, ptP1, - vtStart, vtN)) ; pCrv.Set( GetArc2PVN( ptStart, ptP1, - vtStart, vtN)) ;
@@ -2033,7 +2010,7 @@ WaterJetting::AddLeadOutPreview( const ICurveComposite* pCompo, ISurfFlatRegion*
Point3d ptP1 = ptEnd + vtEnd * dTang + vtPerp * dPerp ; Point3d ptP1 = ptEnd + vtEnd * dTang + vtPerp * dPerp ;
if ( IsNull( pLine) || ! pLine->Set( ptEnd, ptP1)) if ( IsNull( pLine) || ! pLine->Set( ptEnd, ptP1))
return false ; return false ;
pCrv.Set( pLine) ; pCrv.Set( Release( pLine)) ;
} break ; } break ;
case WJET_LO_TANGENT : case WJET_LO_TANGENT :
{ // calcolo punto finale dell'uscita { // calcolo punto finale dell'uscita
@@ -2610,8 +2587,8 @@ WaterJetting::AddLeadIn( const Point3d& ptP1, const Point3d& ptStart, const Vect
pCrv->Invert() ; pCrv->Invert() ;
// eventuale spezzatura // eventuale spezzatura
if ( bSplitArcs) { if ( bSplitArcs) {
PtrOwner<ICurveComposite> pCompo ; PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
if ( ! pCompo.Set( ConvertCurveToComposite( Release( pCrv))) || ! ApproxWithLines( pCompo)) if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pCrv)) || ! ApproxWithLines( pCompo))
return false ; return false ;
return ( AddCurveMove( pCompo, MCH_CL_LEADIN) != GDB_ID_NULL) ; return ( AddCurveMove( pCompo, MCH_CL_LEADIN) != GDB_ID_NULL) ;
} }
@@ -2681,8 +2658,8 @@ WaterJetting::AddLeadOut( const Point3d& ptEnd, const Vector3d& vtEnd, const Vec
return false ; return false ;
// eventuale spezzatura // eventuale spezzatura
if ( bSplitArcs) { if ( bSplitArcs) {
PtrOwner<ICurveComposite> pCompo ; PtrOwner<ICurveComposite> pCompo( CreateCurveComposite()) ;
if ( ! pCompo.Set( ConvertCurveToComposite( Release( pCrv))) || ! ApproxWithLines( pCompo)) if ( IsNull( pCompo) || ! pCompo->AddCurve( Release( pCrv)) || ! ApproxWithLines( pCompo))
return false ; return false ;
return ( AddCurveMove( pCompo, MCH_CL_LEADOUT) != GDB_ID_NULL) ; return ( AddCurveMove( pCompo, MCH_CL_LEADOUT) != GDB_ID_NULL) ;
} }
+2 -6
View File
@@ -102,10 +102,6 @@ struct WaterJettingData : public MachiningData
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline const WaterJettingData* GetWaterJettingData( const MachiningData* pMdata) inline const WaterJettingData* GetWaterJettingData( const MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_WATERJETTING) { return (dynamic_cast<const WaterJettingData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<const WaterJettingData*>( pMdata)) ; }
inline WaterJettingData* GetWaterJettingData( MachiningData* pMdata) inline WaterJettingData* GetWaterJettingData( MachiningData* pMdata)
{ if ( pMdata == nullptr || pMdata->GetType() != MT_WATERJETTING) { return (dynamic_cast<WaterJettingData*>( pMdata)) ; }
return nullptr ;
return ( static_cast<WaterJettingData*>( pMdata)) ; }